ngiab-data-preprocess 4.2.2__py3-none-any.whl → 4.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,308 @@
1
+ Metadata-Version: 2.4
2
+ Name: ngiab_data_preprocess
3
+ Version: 4.4.0
4
+ Summary: Graphical Tools for creating Next Gen Water model input data.
5
+ Author-email: Josh Cunningham <jcunningham8@ua.edu>
6
+ Project-URL: Homepage, https://github.com/CIROH-UA/NGIAB_data_preprocess
7
+ Project-URL: Issues, https://github.com/CIROH-UA/NGIAB_data_preprocess/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: pyogrio>=0.7.2
15
+ Requires-Dist: pyproj>=3.6.1
16
+ Requires-Dist: Flask==3.0.2
17
+ Requires-Dist: geopandas>=1.0.0
18
+ Requires-Dist: requests==2.32.4
19
+ Requires-Dist: igraph==0.11.4
20
+ Requires-Dist: s3fs==2024.3.1
21
+ Requires-Dist: xarray==2024.2.0
22
+ Requires-Dist: zarr==2.17.1
23
+ Requires-Dist: netCDF4>=1.6.5
24
+ Requires-Dist: dask==2024.4.1
25
+ Requires-Dist: dask[distributed]==2024.4.1
26
+ Requires-Dist: h5netcdf==1.3.0
27
+ Requires-Dist: exactextract==0.2.0
28
+ Requires-Dist: numpy>=1.26.4
29
+ Requires-Dist: tqdm==4.66.4
30
+ Requires-Dist: rich==13.7.1
31
+ Requires-Dist: colorama==0.4.6
32
+ Requires-Dist: bokeh==3.5.1
33
+ Requires-Dist: boto3
34
+ Requires-Dist: numcodecs<0.16.0
35
+ Requires-Dist: scipy>=1.15.3
36
+ Provides-Extra: eval
37
+ Requires-Dist: ngiab_eval; extra == "eval"
38
+ Provides-Extra: plot
39
+ Requires-Dist: ngiab_eval[plot]; extra == "plot"
40
+ Dynamic: license-file
41
+
42
+ # NGIAB Data Preprocess
43
+
44
+ This repository contains tools for preparing data to run a [NextGen](https://github.com/NOAA-OWP/ngen)-based simulation using [NGIAB](https://github.com/CIROH-UA/NGIAB-CloudInfra). The tools allow you to select a catchment of interest on an interactive map, choose a date range, and prepare the data with just a few clicks!
45
+
46
+ ![map screenshot](https://github.com/CIROH-UA/NGIAB_data_preprocess/blob/main/modules/map_app/static/resources/screenshot.jpg)
47
+
48
+ | | |
49
+ | --- | --- |
50
+ | ![CIROH Logo](./ciroh-bgsafe.png) | Funding for this project was provided by the National Oceanic & Atmospheric Administration (NOAA), awarded to the Cooperative Institute for Research to Operations in Hydrology (CIROH) through the NOAA Cooperative Agreement with The University of Alabama (NA22NWS4320003). |
51
+
52
+ ## Table of Contents
53
+
54
+ 1. [What does this tool do?](#what-does-this-tool-do)
55
+ 2. [Limitations](#limitations)
56
+ - [Custom realizations](#custom-realizations)
57
+ - [Calibration](#calibration)
58
+ - [Evaluation](#evaluation)
59
+ - [Visualisation](#visualisation)
60
+ 3. [Requirements](#requirements)
61
+ 4. [Installation and running](#installation-and-running)
62
+ - [Running without install](#running-without-install)
63
+ - [For uv installation](#for-uv-installation)
64
+ - [For legacy pip installation](#for-legacy-pip-installation)
65
+ - [Development installation](#development-installation)
66
+ 5. [Map interface documentation](#map-interface-documentation)
67
+ - [Running the map interface app](#running-the-map-interface-app)
68
+ - [Using the map interace](#using-the-map-interface)
69
+ 6. [CLI documentation](#cli-documentation)
70
+ - [Running the CLI](#running-the-cli)
71
+ - [Arguments](#arguments)
72
+ - [Usage notes](#usage-notes)
73
+ - [Examples](#examples)
74
+ 7. [Realization information](#realization-information)
75
+ - [NOAH + CFE](#noah--cfe)
76
+
77
+ ## What does this tool do?
78
+
79
+ This tool prepares data to run a NextGen-based simulation by creating a run package that can be used with NGIAB.
80
+ It uses geometry and model attributes from the [v2.2 hydrofabric](https://lynker-spatial.s3-us-west-2.amazonaws.com/hydrofabric/v2.2/conus/conus_nextgen.gpkg) more information on [all data sources here](https://lynker-spatial.s3-us-west-2.amazonaws.com/hydrofabric/v2.2/hfv2.2-data_model.html).
81
+ The raw forcing data is [nwm retrospective v3 forcing](https://noaa-nwm-retrospective-3-0-pds.s3.amazonaws.com/index.html#CONUS/zarr/forcing/) data or the [AORC 1km gridded data](https://noaa-nws-aorc-v1-1-1km.s3.amazonaws.com/index.html) depending on user input
82
+
83
+ 1. **Subsets** (delineates) everything upstream of your point of interest (catchment, gage, flowpath etc) from the hydrofabric. This subset is output as a geopackage (.gpkg).
84
+ 2. Calculates **forcings** as a weighted mean of the gridded NWM or AORC forcings. Weights are calculated using [exact extract](https://isciences.github.io/exactextract/) and computed with numpy.
85
+ 3. Creates **configuration files** for a default NGIAB model run.
86
+ - realization.json - ngen model configuration
87
+ - troute.yaml - routing configuration.
88
+ - **per catchment** model configuration
89
+ 4. Optionally performs a non-interactive [Docker-based NGIAB](https://github.com/CIROH-UA/NGIAB-CloudInfra) run.
90
+
91
+ ## Limitations
92
+ This tool cannot do the following:
93
+
94
+ ### Custom realizations
95
+ This tool currently only outputs a single, default realization, which is described in "[Realization information](#realization-information)". Support for additional model configurations is planned, but not currently available.
96
+
97
+ ### Calibration
98
+ If available, this repository will download [calibrated parameters](https://communityhydrofabric.s3.us-east-1.amazonaws.com/index.html#hydrofabrics/community/gage_parameters/) from the [Community Hydrofabric](https://github.com/CIROH-UA/community_hf_patcher) AWS S3 bucket.
99
+ However, many gages and catchments will not have such parameters available. In these cases, Data Preprocess will output realizations with default values.
100
+
101
+ For automatic calibration, please see [ngiab-cal](https://github.com/CIROH-UA/ngiab-cal), which is under active development.
102
+
103
+ ### Evaluation
104
+ For automatic evaluation using [TEEHR](https://github.com/RTIInternational/teehr), please run [NGIAB](https://github.com/CIROH-UA/NGIAB-CloudInfra) interactively using the `guide.sh` script.
105
+
106
+ ### Visualisation
107
+ For automatic interactive visualisation, please run [NGIAB](https://github.com/CIROH-UA/NGIAB-CloudInfra) interactively using the `guide.sh` script
108
+
109
+ # Requirements
110
+
111
+ This tool is **officially supported** on **macOS** and **Ubuntu** (tested on 22.04 & 24.04). To use it on Windows, please install [**WSL**](https://learn.microsoft.com/en-us/windows/wsl/install).
112
+
113
+ It is also **highly recommended** to use [Astral UV](https://docs.astral.sh/uv/) to install and run this tool. Installing the project via `pip` without the use of a virtual environment creates a **severe risk** of dependency conflicts.
114
+
115
+ # Installation and running
116
+
117
+ ### Running without install
118
+ This package supports pipx and uvx, which means you can run the tool without installing it. No virtual environment needed, just UV.
119
+ ```bash
120
+ # Run these from anywhere!
121
+ uvx --from ngiab-data-preprocess cli --help # Running the CLI
122
+ uvx ngiab-prep --help # Alias for the CLI
123
+ uvx --from ngiab-data-preprocess map_app # Running the map interface
124
+ ```
125
+
126
+ ### For uv installation
127
+
128
+ <details>
129
+ <summary>Click here to expand</summary>
130
+
131
+ ```bash
132
+ # Install UV
133
+ curl -LsSf https://astral.sh/uv/install.sh | sh
134
+ # It can be installed via pip if that fails
135
+ # pip install uv
136
+
137
+ # Create a virtual environment in the current directory
138
+ uv venv
139
+
140
+ # Install the tool in the virtual environment
141
+ uv pip install ngiab_data_preprocess
142
+
143
+ # To run the cli
144
+ uv run cli --help
145
+
146
+ # To run the map
147
+ uv run map_app
148
+ ```
149
+
150
+ UV automatically detects any virtual environments in the current directory and will use them when you use `uv run`.
151
+
152
+ </details>
153
+
154
+ ### For legacy pip installation
155
+
156
+ <details>
157
+ <summary>Click here to expand</summary>
158
+
159
+ ```bash
160
+ # If you're installing this on jupyterhub / 2i2c you HAVE TO DEACTIVATE THE CONDA ENV
161
+ (notebook) jovyan@jupyter-user:~$ conda deactivate
162
+ jovyan@jupyter-user:~$
163
+ # The interactive map won't work on 2i2c
164
+ ```
165
+
166
+ ```bash
167
+ # This tool is likely to not work without a virtual environment
168
+ python3 -m venv .venv
169
+ source .venv/bin/activate
170
+ # installing and running the tool
171
+ pip install 'ngiab_data_preprocess'
172
+ python -m map_app
173
+ # CLI instructions at the bottom of the README
174
+ ```
175
+ </details>
176
+
177
+ ### Development installation
178
+
179
+ <details>
180
+ <summary>Click to expand installation steps</summary>
181
+
182
+ To install and run the tool, follow these steps:
183
+
184
+ 1. Clone the repository:
185
+ ```bash
186
+ git clone https://github.com/CIROH-UA/NGIAB_data_preprocess
187
+ cd NGIAB_data_preprocess
188
+ ```
189
+ 2. Create a virtual environment:
190
+ ```bash
191
+ uv venv
192
+ ```
193
+ 3. Install the tool:
194
+ ```bash
195
+ uv pip install -e .
196
+ ```
197
+ 4. Run the map app:
198
+ ```bash
199
+ uv run map_app
200
+ ```
201
+ </details>
202
+
203
+ # Map interface documentation
204
+
205
+ ## Running the map interface app
206
+
207
+ Running the `map_app` tool will open the app in a new browser tab.
208
+
209
+ Install-free: `uvx --from ngiab-data-preprocess map_app`
210
+ Installed with uv: `uv run map_app`
211
+
212
+ ## Using the map interface
213
+
214
+ 1. Select the catchment you're interested in on the map.
215
+ 2. Pick the time period you want to simulate.
216
+ 3. Click the following buttons in order:
217
+ 1) Create subset gpkg
218
+ 2) Create Forcing from Zarrs
219
+ 3) Create Realization
220
+
221
+ Once all the steps are finished, you can run NGIAB on the folder shown underneath the subset button.
222
+
223
+ **Note:** When using the tool, the default output will be stored in the `~/ngiab_preprocess_output/<your-input-feature>/` folder. There is no overwrite protection on the folders.
224
+
225
+ # CLI documentation
226
+
227
+ ## Running the CLI
228
+
229
+ Install-free: `uvx ngiab-prep`
230
+ Installed with uv: `uv run cli`
231
+
232
+ ## Arguments
233
+
234
+ - `-h`, `--help`: Show the help message and exit.
235
+ - `-i INPUT_FEATURE`, `--input_feature INPUT_FEATURE`: ID of feature to subset. Providing a prefix will automatically convert to catid, e.g., cat-5173 or gage-01646500 or wb-1234.
236
+ - `--vpu VPU_ID` : The id of the vpu to subset e.g 01. 10 = 10L + 10U and 03 = 03N + 03S + 03W. `--help` will display all the options.
237
+ - `-l`, `--latlon`: Use latitude and longitude instead of catid. Expects comma-separated values via the CLI, e.g., `python -m ngiab_data_cli -i 54.33,-69.4 -l -s`.
238
+ - `-g`, `--gage`: Use gage ID instead of catid. Expects a single gage ID via the CLI, e.g., `python -m ngiab_data_cli -i 01646500 -g -s`.
239
+ - `-s`, `--subset`: Subset the hydrofabric to the given feature.
240
+ - `-f`, `--forcings`: Generate forcings for the given feature.
241
+ - `-r`, `--realization`: Create a realization for the given feature.
242
+ - `--start_date START_DATE`, `--start START_DATE`: Start date for forcings/realization (format YYYY-MM-DD).
243
+ - `--end_date END_DATE`, `--end END_DATE`: End date for forcings/realization (format YYYY-MM-DD).
244
+ - `-o OUTPUT_NAME`, `--output_name OUTPUT_NAME`: Name of the output folder.
245
+ - `--source` : The datasource you want to use, either `nwm` for retrospective v3 or `aorc`. Default is `nwm`
246
+ - `-D`, `--debug`: Enable debug logging.
247
+ - `--run`: Automatically run [NGIAB's docker distribution](https://github.com/CIROH-UA/NGIAB-CloudInfra) against the output folder.
248
+ - `--validate`: Run every missing step required to run NGIAB.
249
+ - `-a`, `--all`: Run all operations. Equivalent to `-sfr` and `--run`.
250
+
251
+ ## Usage notes
252
+ - If your input has a prefix of `gage-`, you do not need to pass `-g`.
253
+ - The `-l`, `-g`, `-s`, `-f`, `-r` flags can be combined like normal CLI flags. For example, to subset, generate forcings, and create a realization, you can use `-sfr` or `-s -f -r`.
254
+ - When using the `--all` flag, it automatically sets `subset`, `forcings`, `realization`, and `run` to `True`.
255
+ - Using the `--run` flag automatically sets the `--validate` flag.
256
+
257
+ ## Examples
258
+
259
+ 1. Prepare everything for an NGIAB run at a given gage:
260
+ ```bash
261
+ uvx ngiab-prep -i gage-10154200 -sfr --start 2022-01-01 --end 2022-02-28
262
+ # add --run or replace -sfr with --all to run NGIAB, too
263
+ # to name the folder, add -o folder_name
264
+ ```
265
+
266
+ 2. Subset the hydrofabric using a catchment ID or VPU:
267
+ ```bash
268
+ uvx ngiab-prep -i cat-7080 -s
269
+ uvx ngiab-prep --vpu 01 -s
270
+ ```
271
+
272
+ 3. Generate forcings using a single catchment ID:
273
+ ```bash
274
+ uvx ngiab-prep -i cat-5173 -f --start 2022-01-01 --end 2022-02-28
275
+ ```
276
+
277
+ 4. Create realization using a latitude/longitude pair and output to a named folder:
278
+ ```bash
279
+ uvx ngiab-prep -i 33.22,-87.54 -l -r --start 2022-01-01 --end 2022-02-28 -o custom_output
280
+ ```
281
+
282
+ 5. Perform all operations using a latitude/longitude pair:
283
+ ```bash
284
+ uvx ngiab-prep -i 33.22,-87.54 -l -s -f -r --start 2022-01-01 --end 2022-02-28
285
+ ```
286
+
287
+ 6. Subset the hydrofabric using a gage ID:
288
+ ```bash
289
+ uvx ngiab-prep -i 10154200 -g -s
290
+ # or
291
+ uvx ngiab-prep -i gage-10154200 -s
292
+ ```
293
+
294
+ 7. Generate forcings using a single gage ID:
295
+ ```bash
296
+ uvx ngiab-prep -i 01646500 -g -f --start 2022-01-01 --end 2022-02-28
297
+ ```
298
+
299
+ # Realization information
300
+
301
+ This tool currently offers one default realization.
302
+
303
+ ## NOAH + CFE
304
+
305
+ [This realization](https://github.com/CIROH-UA/NGIAB_data_preprocess/blob/main/modules/data_sources/cfe-nowpm-realization-template.json) is intended to be roughly comparable to earlier versions of the National Water Model.
306
+ - [NOAH-OWP-Modular](https://github.com/NOAA-OWP/NOAH-OWP-Modular): A refactoring of Noah-MP, a land-surface model. Used to model groundwater properties.
307
+ - [Conceptual Functional Equivalent (CFE)](https://github.com/NOAA-OWP/CFE): A simplified conceptual approximation of versions 1.2, 2.0, and 2.1 of the National Water Model. Used to model precipitation and evaporation.
308
+ - [SLoTH](https://github.com/NOAA-OWP/SLoTH): A module used to feed through unchanged values. In this default configuration, it simply forces certain soil moisture and ice fraction properties to zero.
@@ -0,0 +1,43 @@
1
+ data_processing/create_realization.py,sha256=mdse8W2DgPg5Lj2_ErUsLJh-touTmShKwQrrOWO0jlY,15958
2
+ data_processing/dask_utils.py,sha256=A2IP94WAz8W9nek3etXKEKTOxGPf0NWSFLh8cZ5S-xU,2454
3
+ data_processing/dataset_utils.py,sha256=AJOxE2nRfZnWYon_qqGcfkpRZuRW8Yy8YI86SxVDU3M,11168
4
+ data_processing/datasets.py,sha256=_EJ1uZSWTU1HWpvF7TQSikneJqWZFikTrdo9usCV8A0,4665
5
+ data_processing/file_paths.py,sha256=l2iCUFt_pk-jjzl7OS7npROAnQxwqFfZ7b2wRjViqiU,4720
6
+ data_processing/forcings.py,sha256=k-JhBncTnXcdjSieam1Q2cDx5Xt9hH5Aywv0gDY4O2U,19010
7
+ data_processing/gpkg_utils.py,sha256=tSSIMlHeqqgxTJQyF3X9tPmunQTJYx0xrCNHqUBQxkg,20590
8
+ data_processing/graph_utils.py,sha256=qvHw6JlzQxLi--eMsGgC_rUBP4nDatl6X9mSa03Xxyo,8306
9
+ data_processing/s3fs_utils.py,sha256=ki1EmA0ezV0r26re6dRWIGzL5FudGdwF9Qw1eVLR0Bc,2747
10
+ data_processing/subset.py,sha256=XoojOgWCwxOi5Q4KXHXARNQeoZlobJp-mqhIIvTRtTw,3793
11
+ data_sources/cfe-nowpm-realization-template.json,sha256=8an6q1drWD8wU1ocvdPab-GvZDvlQ-0di_-NommH3QI,3528
12
+ data_sources/cfe-template.ini,sha256=6e5-usqjWtm3MWVvtm8CTeZTJJMxO1ZswkOXq0L9mnc,2033
13
+ data_sources/em-catchment-template.yml,sha256=M08ixazEUHYI2PNavtI0xPZeSzcQ9bg2g0XzNT-8_u4,292
14
+ data_sources/em-config.yml,sha256=y0J8kEA70rxLWXJjz-CQ7sawcVyhQcayofeLlq4Svbo,1330
15
+ data_sources/em-realization-template.json,sha256=DJvB7N8lCeS2vLFenmbTzysBDR-xPaJ09XA8heu1ijY,1466
16
+ data_sources/forcing_template.nc,sha256=uRuVAqX3ngdlougZINavtwl_wC2VLD8fHqG7_CLim1s,85284
17
+ data_sources/ngen-routing-template.yaml,sha256=wM5v6jj0kwcJBVatLFuy2big6g8nlSXxzc8a23nwI5s,4655
18
+ data_sources/noah-owp-modular-init.namelist.input,sha256=Vb7mp40hFpJogruOrXrDHwVW1bKi9h1ciDNyDvTzn20,3045
19
+ data_sources/source_validation.py,sha256=RmvyPLjuDetpuNOUqCclgDfe8zd_Ojr7pfbUoUya2pQ,9498
20
+ data_sources/template.sql,sha256=ZnFqAqleEq9wgmAhNO90Wue_L9k0JAn8KF99DYtcxgs,10457
21
+ data_sources/triggers.sql,sha256=G0d_175eNsamKAFhsbphPATvzMPuPL_iCleIhlToduQ,14906
22
+ map_app/__init__.py,sha256=OarJao9X98kcbLyiwewN4ObWNAYkKDichcxbuWywTsA,818
23
+ map_app/__main__.py,sha256=Uj7__cJUyPQkZo2tNQ2x2g6rwizsyg1DcNtJkQniHzY,1650
24
+ map_app/views.py,sha256=ajU_QSd-Oa7UrRQEZPX4rmOlaKwo76Q8UPQNXtt-e2k,5622
25
+ map_app/static/css/console.css,sha256=xN6G2MMFyKc9YW9HEVpUUTUjx2o2nokBR4nCX5c18UM,803
26
+ map_app/static/css/main.css,sha256=HmRIfhWeHTrNLOCHGpaKuzwGj05LkkUiQy538D-ZRLY,6464
27
+ map_app/static/css/toggle.css,sha256=Ep6tXT7gCrPRRITuEMpXyisuiTQgiLIEKFFTWRmC82o,1913
28
+ map_app/static/js/console.js,sha256=BnG0pED5B9d563sLWshDNt_q-SyoTY48sETvVoOVJkU,1377
29
+ map_app/static/js/data_processing.js,sha256=wXv0p_bPmNOrSpU_p6Yqtfd17vqOFRJFAmLdUUWLF7s,5486
30
+ map_app/static/js/main.js,sha256=_Yq1tuzyREqWU24rFQJSh5zIaXtAXEGlfZPo36QLHvI,9690
31
+ map_app/static/resources/loading.gif,sha256=ggdkZf1AD7rSwIpSJwfiIqANgmVV1WHlxGuKxQKv7uY,72191
32
+ map_app/static/resources/screenshot.jpg,sha256=Ia358aX-OHM9BP4B8lX05cLnguF2fHUIimno9bnFLYw,253730
33
+ map_app/templates/index.html,sha256=Jy2k1Ob2_et--BPpfmTYO22Yin3vrG6IOeNlwzUoEqY,7878
34
+ ngiab_data_cli/__main__.py,sha256=13W3RnD73weQNYZdq6munx_0oMBgzc-yzluKEm5nSxg,10570
35
+ ngiab_data_cli/arguments.py,sha256=yBULJnFgUvgP4YZmZ5HhR7g0EfdMtBCdQuDkDuYSXCQ,4322
36
+ ngiab_data_cli/custom_logging.py,sha256=iS2XozaxudcxQj17qAsrCgbVK9LJAYAPmarJuVWJo1k,1280
37
+ ngiab_data_cli/forcing_cli.py,sha256=eIWRxRWUwPqR16fihFDEIV4VzGlNuvcD6lJW5VYjkPU,3635
38
+ ngiab_data_preprocess-4.4.0.dist-info/licenses/LICENSE,sha256=6dMSprwwnsRzEm02mEDbKHD9dUbL8bPIt9Vhrhb0Ulk,1081
39
+ ngiab_data_preprocess-4.4.0.dist-info/METADATA,sha256=8PlfoGwOJIpuKhFwtfWmfxdMaDeXBfFRz9CAeZ3sZKk,13344
40
+ ngiab_data_preprocess-4.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
41
+ ngiab_data_preprocess-4.4.0.dist-info/entry_points.txt,sha256=spwlhKEJ3ZnNETQsJGeTjD7Vwy8O_zGHb9GdX8ACCtw,128
42
+ ngiab_data_preprocess-4.4.0.dist-info/top_level.txt,sha256=CjhYAUZrdveR2fOK6rxffU09VIN2IuPD7hk4V3l3pV0,52
43
+ ngiab_data_preprocess-4.4.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.4.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,258 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: ngiab_data_preprocess
3
- Version: 4.2.2
4
- Summary: Graphical Tools for creating Next Gen Water model input data.
5
- Author-email: Josh Cunningham <jcunningham8@ua.edu>
6
- Project-URL: Homepage, https://github.com/CIROH-UA/NGIAB_data_preprocess
7
- Project-URL: Issues, https://github.com/CIROH-UA/NGIAB_data_preprocess/issues
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.10
12
- Description-Content-Type: text/markdown
13
- License-File: LICENSE
14
- Requires-Dist: pyogrio>=0.7.2
15
- Requires-Dist: pyproj>=3.6.1
16
- Requires-Dist: Flask==3.0.2
17
- Requires-Dist: geopandas>=1.0.0
18
- Requires-Dist: requests==2.32.2
19
- Requires-Dist: igraph==0.11.4
20
- Requires-Dist: s3fs==2024.3.1
21
- Requires-Dist: xarray==2024.2.0
22
- Requires-Dist: zarr==2.17.1
23
- Requires-Dist: netCDF4>=1.6.5
24
- Requires-Dist: dask==2024.4.1
25
- Requires-Dist: dask[distributed]==2024.4.1
26
- Requires-Dist: h5netcdf==1.3.0
27
- Requires-Dist: exactextract==0.2.0
28
- Requires-Dist: numpy>=1.26.4
29
- Requires-Dist: tqdm==4.66.4
30
- Requires-Dist: rich==13.7.1
31
- Requires-Dist: colorama==0.4.6
32
- Requires-Dist: bokeh==3.5.1
33
- Requires-Dist: boto3
34
- Requires-Dist: numcodecs<0.16.0
35
- Provides-Extra: eval
36
- Requires-Dist: ngiab_eval; extra == "eval"
37
- Provides-Extra: plot
38
- Requires-Dist: ngiab_eval[plot]; extra == "plot"
39
- Dynamic: license-file
40
-
41
- # NGIAB Data Preprocess
42
-
43
- This repository contains tools for preparing data to run a [next gen](https://github.com/NOAA-OWP/ngen) simulation using [NGIAB](https://github.com/CIROH-UA/NGIAB-CloudInfra). The tools allow you to select a catchment of interest on an interactive map, choose a date range, and prepare the data with just a few clicks!
44
-
45
- ![map screenshot](https://github.com/CIROH-UA/NGIAB_data_preprocess/blob/main/modules/map_app/static/resources/screenshot.jpg)
46
-
47
- ## Table of Contents
48
-
49
- 1. [What does this tool do?](#what-does-this-tool-do)
50
- 2. [Requirements](#requirements)
51
- 3. [Installation and Running](#installation-and-running)
52
- 4. [Development Installation](#development-installation)
53
- 5. [Usage](#usage)
54
- 6. [CLI Documentation](#cli-documentation)
55
- - [Arguments](#arguments)
56
- - [Examples](#examples)
57
- - [File Formats](#file-formats)
58
- - [Output](#output)
59
-
60
- ## What does this tool do?
61
-
62
- This tool prepares data to run a next gen simulation by creating a run package that can be used with NGIAB.
63
- It uses geometry and model attributes from the [v2.2 hydrofabric](https://lynker-spatial.s3-us-west-2.amazonaws.com/hydrofabric/v2.2/conus/conus_nextgen.gpkg) more information on [all data sources here](https://lynker-spatial.s3-us-west-2.amazonaws.com/hydrofabric/v2.2/hfv2.2-data_model.html).
64
- The raw forcing data is [nwm retrospective v3 forcing](https://noaa-nwm-retrospective-3-0-pds.s3.amazonaws.com/index.html#CONUS/zarr/forcing/) data or the [AORC 1km gridded data](https://noaa-nws-aorc-v1-1-1km.s3.amazonaws.com/index.html) depending on user input
65
-
66
- 1. **Subset** (delineate) everything upstream of your point of interest (catchment, gage, flowpath etc). Outputs as a geopackage.
67
- 2. **Calculates** Forcings as a weighted mean of the gridded AORC forcings. Weights are calculated using [exact extract](https://isciences.github.io/exactextract/) and computed with numpy.
68
- 3. Creates **configuration files** needed to run nextgen.
69
- - realization.json - ngen model configuration
70
- - troute.yaml - routing configuration.
71
- - **per catchment** model configuration
72
- 4. Optionally Runs a non-interactive [Next gen in a box](https://github.com/CIROH-UA/NGIAB-CloudInfra).
73
-
74
- ## What does it not do?
75
-
76
- ### Evaluation
77
- For automatic evaluation using [Teehr](https://github.com/RTIInternational/teehr), please run [NGIAB](https://github.com/CIROH-UA/NGIAB-CloudInfra) interactively using the `guide.sh` script.
78
-
79
- ### Visualisation
80
- For automatic interactive visualisation, please run [NGIAB](https://github.com/CIROH-UA/NGIAB-CloudInfra) interactively using the `guide.sh` script
81
-
82
- ## Requirements
83
-
84
- * This tool is officially supported on macOS or Ubuntu (tested on 22.04 & 24.04). To use it on Windows, please install [WSL](https://learn.microsoft.com/en-us/windows/wsl/install).
85
-
86
- ## Installation and Running
87
- It is highly recommended to use [Astral UV](https://docs.astral.sh/uv/) to install and run this tool. It works similarly to pip and conda, and I would also recommend you use it for other python projects as it is so useful.
88
-
89
- ```bash
90
- # Install UV
91
- curl -LsSf https://astral.sh/uv/install.sh | sh
92
- # It can be installed via pip if that fails
93
- # pip install uv
94
-
95
- # Create a virtual environment in the current directory
96
- uv venv
97
-
98
- # Install the tool in the virtual environment
99
- uv pip install ngiab_data_preprocess
100
-
101
- # To run the cli
102
- uv run cli --help
103
-
104
- # To run the map
105
- uv run map_app
106
- ```
107
-
108
- UV automatically detects any virtual environments in the current directory and will use them when you use `uv run`.
109
-
110
- ### Running without install
111
- This package supports pipx and uvx which means you can run the tool without installing it. No virtual environment needed, just UV.
112
- ```bash
113
- # run this from anywhere
114
- uvx --from ngiab_data_preprocess cli --help
115
- # for the map
116
- uvx --from ngiab_data_preprocess map_app
117
- ```
118
-
119
- ## For legacy pip installation
120
- <details>
121
- <summary>Click here to expand</summary>
122
-
123
- ```bash
124
- # If you're installing this on jupyterhub / 2i2c you HAVE TO DEACTIVATE THE CONDA ENV
125
- (notebook) jovyan@jupyter-user:~$ conda deactivate
126
- jovyan@jupyter-user:~$
127
- # The interactive map won't work on 2i2c
128
- ```
129
-
130
- ```bash
131
- # This tool is likely to not work without a virtual environment
132
- python3 -m venv .venv
133
- source .venv/bin/activate
134
- # installing and running the tool
135
- pip install 'ngiab_data_preprocess'
136
- python -m map_app
137
- # CLI instructions at the bottom of the README
138
- ```
139
- </details>
140
-
141
- ## Development Installation
142
-
143
- <details>
144
- <summary>Click to expand installation steps</summary>
145
-
146
- To install and run the tool, follow these steps:
147
-
148
- 1. Clone the repository:
149
- ```bash
150
- git clone https://github.com/CIROH-UA/NGIAB_data_preprocess
151
- cd NGIAB_data_preprocess
152
- ```
153
- 2. Create a virtual environment:
154
- ```bash
155
- uv venv
156
- ```
157
- 3. Install the tool:
158
- ```bash
159
- uv pip install -e .
160
- ```
161
- 4. Run the map app:
162
- ```bash
163
- uv run map_app
164
- ```
165
- </details>
166
-
167
- ## Usage
168
-
169
- Running the command `uv run map_app` will open the app in a new browser tab.
170
-
171
- To use the tool:
172
- 1. Select the catchment you're interested in on the map.
173
- 2. Pick the time period you want to simulate.
174
- 3. Click the following buttons in order:
175
- 1) Create subset gpkg
176
- 2) Create Forcing from Zarrs
177
- 3) Create Realization
178
-
179
- Once all the steps are finished, you can run NGIAB on the folder shown underneath the subset button.
180
-
181
- **Note:** When using the tool, the default output will be stored in the `~/ngiab_preprocess_output/<your-input-feature>/` folder. There is no overwrite protection on the folders.
182
-
183
- # CLI Documentation
184
-
185
- ## Arguments
186
-
187
- - `-h`, `--help`: Show the help message and exit.
188
- - `-i INPUT_FEATURE`, `--input_feature INPUT_FEATURE`: ID of feature to subset. Providing a prefix will automatically convert to catid, e.g., cat-5173 or gage-01646500 or wb-1234.
189
- - `--vpu VPU_ID` : The id of the vpu to subset e.g 01. 10 = 10L + 10U and 03 = 03N + 03S + 03W. `--help` will display all the options.
190
- - `-l`, `--latlon`: Use latitude and longitude instead of catid. Expects comma-separated values via the CLI, e.g., `python -m ngiab_data_cli -i 54.33,-69.4 -l -s`.
191
- - `-g`, `--gage`: Use gage ID instead of catid. Expects a single gage ID via the CLI, e.g., `python -m ngiab_data_cli -i 01646500 -g -s`.
192
- - `-s`, `--subset`: Subset the hydrofabric to the given feature.
193
- - `-f`, `--forcings`: Generate forcings for the given feature.
194
- - `-r`, `--realization`: Create a realization for the given feature.
195
- - `--start_date START_DATE`, `--start START_DATE`: Start date for forcings/realization (format YYYY-MM-DD).
196
- - `--end_date END_DATE`, `--end END_DATE`: End date for forcings/realization (format YYYY-MM-DD).
197
- - `-o OUTPUT_NAME`, `--output_name OUTPUT_NAME`: Name of the output folder.
198
- - `--source` : The datasource you want to use, either `nwm` for retrospective v3 or `aorc`. Default is `nwm`
199
- - `-D`, `--debug`: Enable debug logging.
200
- - `--run`: Automatically run Next Gen against the output folder.
201
- - `--validate`: Run every missing step required to run ngiab.
202
- - `-a`, `--all`: Run all operations: subset, forcings, realization, run Next Gen
203
-
204
- ## Usage Notes
205
- - If your input has a prefix of `gage-`, you do not need to pass `-g`.
206
- - The `-l`, `-g`, `-s`, `-f`, `-r` flags can be combined like normal CLI flags. For example, to subset, generate forcings, and create a realization, you can use `-sfr` or `-s -f -r`.
207
- - When using the `--all` flag, it automatically sets `subset`, `forcings`, `realization`, and `run` to `True`.
208
- - Using the `--run` flag automatically sets the `--validate` flag.
209
-
210
- ## Examples
211
-
212
- 0. Prepare everything for a nextgen run at a given gage:
213
- ```bash
214
- python -m ngiab_data_cli -i gage-10154200 -sfr --start 2022-01-01 --end 2022-02-28
215
- # add --run or replace -sfr with --all to run nextgen in a box too
216
- # to name the folder, add -o folder_name
217
- ```
218
-
219
- 1. Subset hydrofabric using catchment ID or VPU:
220
- ```bash
221
- python -m ngiab_data_cli -i cat-7080 -s
222
- python -m ngiab_data_cli --vpu 01 -s
223
- ```
224
-
225
- 2. Generate forcings using a single catchment ID:
226
- ```bash
227
- python -m ngiab_data_cli -i cat-5173 -f --start 2022-01-01 --end 2022-02-28
228
- ```
229
-
230
- 3. Create realization using a lat/lon pair and output to a named folder:
231
- ```bash
232
- python -m ngiab_data_cli -i 54.33,-69.4 -l -r --start 2022-01-01 --end 2022-02-28 -o custom_output
233
- ```
234
-
235
- 4. Perform all operations using a lat/lon pair:
236
- ```bash
237
- python -m ngiab_data_cli -i 54.33,-69.4 -l -s -f -r --start 2022-01-01 --end 2022-02-28
238
- ```
239
-
240
- 5. Subset hydrofabric using gage ID:
241
- ```bash
242
- python -m ngiab_data_cli -i 10154200 -g -s
243
- # or
244
- python -m ngiab_data_cli -i gage-10154200 -s
245
- ```
246
-
247
- 6. Generate forcings using a single gage ID:
248
- ```bash
249
- python -m ngiab_data_cli -i 01646500 -g -f --start 2022-01-01 --end 2022-02-28
250
- ```
251
-
252
- 7. Run all operations, including Next Gen and evaluation/plotting:
253
- ```bash
254
- python -m ngiab_data_cli -i cat-5173 -a --start 2022-01-01 --end 2022-02-28
255
- ```
256
-
257
-
258
-
@@ -1,42 +0,0 @@
1
- data_processing/create_realization.py,sha256=BqGtJSfl-XlsCQOIxonQcZKxLddz_LE18x6At4qCiRo,14948
2
- data_processing/dataset_utils.py,sha256=4qmRmK3qMWPkiWZHXhXv3c-ISbtOwr7QhciEl2ok6Ao,7314
3
- data_processing/datasets.py,sha256=BB_X0IvGnUrjBmj-wryn6-Nv5cd0Lje3zly3p896eU4,4822
4
- data_processing/file_paths.py,sha256=Cp3BxbO6sD50464ciTshjb3Z0vTvL0ZeSbOJgNdOqQ0,4698
5
- data_processing/forcings.py,sha256=bHVXEUpSTzw3iBdw6_jww0Wk_HksZseWdFJ0oF-Ri-E,18910
6
- data_processing/gpkg_utils.py,sha256=fr0X62HawnSXzWRHcC_9aFrnoKv5atz4XkalydxCSko,20538
7
- data_processing/graph_utils.py,sha256=I9IFkU08SkXb8pfVASTvkm7T8BYt-92CaNj7TV6wJFE,8244
8
- data_processing/s3fs_utils.py,sha256=WoqqwxkHpv0Qq4I5f5-gUZBCFtVQ68ehXbdOjWRKTDQ,2752
9
- data_processing/subset.py,sha256=ns-WIHzshi74CFetmGsYvd72QgNtQFwl6Avc9rIYpf4,2604
10
- data_sources/cfe-nowpm-realization-template.json,sha256=8an6q1drWD8wU1ocvdPab-GvZDvlQ-0di_-NommH3QI,3528
11
- data_sources/cfe-template.ini,sha256=6e5-usqjWtm3MWVvtm8CTeZTJJMxO1ZswkOXq0L9mnc,2033
12
- data_sources/em-catchment-template.yml,sha256=M08ixazEUHYI2PNavtI0xPZeSzcQ9bg2g0XzNT-8_u4,292
13
- data_sources/em-config.yml,sha256=y0J8kEA70rxLWXJjz-CQ7sawcVyhQcayofeLlq4Svbo,1330
14
- data_sources/em-realization-template.json,sha256=DJvB7N8lCeS2vLFenmbTzysBDR-xPaJ09XA8heu1ijY,1466
15
- data_sources/forcing_template.nc,sha256=uRuVAqX3ngdlougZINavtwl_wC2VLD8fHqG7_CLim1s,85284
16
- data_sources/ngen-routing-template.yaml,sha256=RV28MAbyQNx9U8FAYmZhD2Fv8Yu6o_08Ekoc77KNdH4,4622
17
- data_sources/noah-owp-modular-init.namelist.input,sha256=Vb7mp40hFpJogruOrXrDHwVW1bKi9h1ciDNyDvTzn20,3045
18
- data_sources/source_validation.py,sha256=9mC1LiL8TXh0mtHFwOlFkT2jN1DEorgw_K7qccrdFfA,8038
19
- data_sources/template.sql,sha256=ZnFqAqleEq9wgmAhNO90Wue_L9k0JAn8KF99DYtcxgs,10457
20
- data_sources/triggers.sql,sha256=G0d_175eNsamKAFhsbphPATvzMPuPL_iCleIhlToduQ,14906
21
- map_app/__init__.py,sha256=OarJao9X98kcbLyiwewN4ObWNAYkKDichcxbuWywTsA,818
22
- map_app/__main__.py,sha256=D9uuAcsOUyfgYqGXQwsmNLo3n3BQ8pnziCAQWQnV4RU,1617
23
- map_app/views.py,sha256=0T-tvAzyfD1ttEQsZ84iAc2ELVN_KS056_YxiyHQ_DE,5122
24
- map_app/static/css/console.css,sha256=xN6G2MMFyKc9YW9HEVpUUTUjx2o2nokBR4nCX5c18UM,803
25
- map_app/static/css/main.css,sha256=UkctdgBijejzpjhLVwOBx2LxdPAY625_yTIe90fKpv0,6188
26
- map_app/static/css/toggle.css,sha256=Ep6tXT7gCrPRRITuEMpXyisuiTQgiLIEKFFTWRmC82o,1913
27
- map_app/static/js/console.js,sha256=BnG0pED5B9d563sLWshDNt_q-SyoTY48sETvVoOVJkU,1377
28
- map_app/static/js/data_processing.js,sha256=X6NSuggOGNIJUF-LEyGGYJjtiA5J29xmkXgFFmfBw18,6711
29
- map_app/static/js/main.js,sha256=dM0fCzNg-nV3wEqZFQ_wEam0Sm8RqHOv2GgRYg97pQQ,6875
30
- map_app/static/resources/loading.gif,sha256=ggdkZf1AD7rSwIpSJwfiIqANgmVV1WHlxGuKxQKv7uY,72191
31
- map_app/static/resources/screenshot.jpg,sha256=Ia358aX-OHM9BP4B8lX05cLnguF2fHUIimno9bnFLYw,253730
32
- map_app/templates/index.html,sha256=82zRdoPar5qfgdwFiVkuXeIQC4okt9iDgCPeNxKdX9I,7403
33
- ngiab_data_cli/__main__.py,sha256=V-g0dwa000e5Qye7PBMTtHTK7Cl7as3JS0UoAR0QrZ4,10503
34
- ngiab_data_cli/arguments.py,sha256=7ptImy8tLM1XvjfDr13tZszkjGVtenXo0KqllJeE3Mw,4372
35
- ngiab_data_cli/custom_logging.py,sha256=iS2XozaxudcxQj17qAsrCgbVK9LJAYAPmarJuVWJo1k,1280
36
- ngiab_data_cli/forcing_cli.py,sha256=lkcqWDk5H8IPyGv0DwLIZMQldqTUXpfwSX0C_RIuIJ8,3890
37
- ngiab_data_preprocess-4.2.2.dist-info/licenses/LICENSE,sha256=6dMSprwwnsRzEm02mEDbKHD9dUbL8bPIt9Vhrhb0Ulk,1081
38
- ngiab_data_preprocess-4.2.2.dist-info/METADATA,sha256=qzh_j7XnKUvF6Zq4sx3idNEp1MneIpAL8ci06lfZDLw,10252
39
- ngiab_data_preprocess-4.2.2.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
40
- ngiab_data_preprocess-4.2.2.dist-info/entry_points.txt,sha256=spwlhKEJ3ZnNETQsJGeTjD7Vwy8O_zGHb9GdX8ACCtw,128
41
- ngiab_data_preprocess-4.2.2.dist-info/top_level.txt,sha256=CjhYAUZrdveR2fOK6rxffU09VIN2IuPD7hk4V3l3pV0,52
42
- ngiab_data_preprocess-4.2.2.dist-info/RECORD,,