TempEst-NEXT 0.1.5__tar.gz → 0.2.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TempEst-NEXT
3
- Version: 0.1.5
3
+ Version: 0.2.0
4
4
  Summary: TempEst-NEXT, Stream Temperature Estimation - Near-term Expected Temperatures: a statistical stream temperature model with coefficient estimation for ungaged watersheds
5
5
  Home-page: https://rivertempest.org/next/readme.html
6
6
  Author: Daniel Philippus
@@ -22,7 +22,7 @@ Requires-Dist: pynldas2
22
22
  Requires-Dist: dataretrieval
23
23
  Requires-Dist: geopandas
24
24
  Requires-Dist: pynhd>=0.19
25
- Requires-Dist: pygeohydro
25
+ Requires-Dist: pygeohydro>=0.19
26
26
  Requires-Dist: py3dep
27
27
  Requires-Dist: xarray-spatial
28
28
  Requires-Dist: rioxarray
@@ -33,6 +33,7 @@ Requires-Dist: metpy
33
33
  Requires-Dist: getgfs
34
34
  Requires-Dist: dask
35
35
  Requires-Dist: cfgrib
36
+ Requires-Dist: dynamical-catalog
36
37
  Dynamic: license-file
37
38
 
38
39
  # TempEst-NEXT
@@ -51,6 +52,12 @@ Install from PyPI: `pip install tempest-next`. The installed module is called N
51
52
 
52
53
  Dependencies: pandas, numpy>=2, TempEst-NEWT, pygam>=0.10, pydaymet>=0.19, pynldas2, dataretrieval, geopandas, pynhd>=0.19, pygeohydro, py3dep, xarray-spatial, s3fs, zarr, cartopy, metpy, getgfs, dask
53
54
 
55
+ ### Instant Command Line Use
56
+
57
+ All of the below requirements are automated under certain assumptions and can be used directly through the command line or interactive use. After installing TempEst-NEXT as above, just open a terminal/command line and run: `tempest-next` (or `NEXT`, or, if those aren't on your path, `python -m NEXT`). This will interactively request all required information to automatically run the model for a given site (currently, pour point coordinates or a USGS gage ID), including forecasts. (Note that forecast data retrieval is rather slow, and the model does need at least a few years of data to predict well. Future updates will include the option to combine forecast data with climatology-adjusted historical estimates, which are much faster to retrieve.)
58
+
59
+ You can also pre-specify arguments instead of providing them interactively, which also means you can automate large-scale NEXT runs through the command line (or high-performance computing jobs, etc). To see all arguments, run `tempest-next --help`.
60
+
54
61
  ### Data Preparation
55
62
 
56
63
  TempEst-NEXT provides automatic tools for data retrieval, for example: `NEXT.data.full_data("-105.1235:40.5723", start="2020", end="2024", site_type="coordinates")`. You can also provide an input data frame. Required columns are `["id", "tmax", "prcp", "vp", "area", "elev_min", "elev", "slope", "wetland", "developed", "ice_snow", "water", "canopy", "ws_canopy", "date", "day"]`, with the addition of a "temperature" column if you wish to train a model.
@@ -71,7 +78,7 @@ Column details:
71
78
 
72
79
  Note: Daymet and NLDAS2 data retrieval are currently not working due to upstream issues. Gridmet (now set to default) works. The analysis in the paper was carried out using Daymet, so results may not be identical.
73
80
 
74
- For forecast data, past and present HRRR works (except, in historical data, for humidity, which must be retrieved through Gridmet), but has become very slow for unknown reasons. It is quick enough for actual forecasting use, but for historical (coefficient estimation) data, I recommend using a shorter sample of HRRR data to adjust Gridmet climatology. Gridmet is far faster.
81
+ For forecast data, past and present HRRR works, but is relatively slow. It is quick enough for actual forecasting use, but for historical (coefficient estimation) data, I recommend using a shorter sample of HRRR data to adjust Gridmet climatology. Gridmet is far faster. (HRRR is now quite a bit faster using the Dynamical.org catalog, but Gridmet is still the faster option.)
75
82
 
76
83
  For forecasting only (no long-term archives), GFS works well, but is rather memory-intensive, provided that your system supports `cfgrib` (which has experimental support for Windows, but mainly tagets Linux). Otherwise, it uses a native Python implementation which may work, but is slow and rather unreliable.
77
84
 
@@ -14,6 +14,12 @@ Install from PyPI: `pip install tempest-next`. The installed module is called N
14
14
 
15
15
  Dependencies: pandas, numpy>=2, TempEst-NEWT, pygam>=0.10, pydaymet>=0.19, pynldas2, dataretrieval, geopandas, pynhd>=0.19, pygeohydro, py3dep, xarray-spatial, s3fs, zarr, cartopy, metpy, getgfs, dask
16
16
 
17
+ ### Instant Command Line Use
18
+
19
+ All of the below requirements are automated under certain assumptions and can be used directly through the command line or interactive use. After installing TempEst-NEXT as above, just open a terminal/command line and run: `tempest-next` (or `NEXT`, or, if those aren't on your path, `python -m NEXT`). This will interactively request all required information to automatically run the model for a given site (currently, pour point coordinates or a USGS gage ID), including forecasts. (Note that forecast data retrieval is rather slow, and the model does need at least a few years of data to predict well. Future updates will include the option to combine forecast data with climatology-adjusted historical estimates, which are much faster to retrieve.)
20
+
21
+ You can also pre-specify arguments instead of providing them interactively, which also means you can automate large-scale NEXT runs through the command line (or high-performance computing jobs, etc). To see all arguments, run `tempest-next --help`.
22
+
17
23
  ### Data Preparation
18
24
 
19
25
  TempEst-NEXT provides automatic tools for data retrieval, for example: `NEXT.data.full_data("-105.1235:40.5723", start="2020", end="2024", site_type="coordinates")`. You can also provide an input data frame. Required columns are `["id", "tmax", "prcp", "vp", "area", "elev_min", "elev", "slope", "wetland", "developed", "ice_snow", "water", "canopy", "ws_canopy", "date", "day"]`, with the addition of a "temperature" column if you wish to train a model.
@@ -34,7 +40,7 @@ Column details:
34
40
 
35
41
  Note: Daymet and NLDAS2 data retrieval are currently not working due to upstream issues. Gridmet (now set to default) works. The analysis in the paper was carried out using Daymet, so results may not be identical.
36
42
 
37
- For forecast data, past and present HRRR works (except, in historical data, for humidity, which must be retrieved through Gridmet), but has become very slow for unknown reasons. It is quick enough for actual forecasting use, but for historical (coefficient estimation) data, I recommend using a shorter sample of HRRR data to adjust Gridmet climatology. Gridmet is far faster.
43
+ For forecast data, past and present HRRR works, but is relatively slow. It is quick enough for actual forecasting use, but for historical (coefficient estimation) data, I recommend using a shorter sample of HRRR data to adjust Gridmet climatology. Gridmet is far faster. (HRRR is now quite a bit faster using the Dynamical.org catalog, but Gridmet is still the faster option.)
38
44
 
39
45
  For forecasting only (no long-term archives), GFS works well, but is rather memory-intensive, provided that your system supports `cfgrib` (which has experimental support for Windows, but mainly tagets Linux). Otherwise, it uses a native Python implementation which may work, but is slow and rather unreliable.
40
46
 
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = TempEst-NEXT
3
- version = 0.1.5
3
+ version = 0.2.0
4
4
  author = Daniel Philippus
5
5
  author_email = daniel@dphilippus.com
6
6
  description = TempEst-NEXT, Stream Temperature Estimation - Near-term Expected Temperatures: a statistical stream temperature model with coefficient estimation for ungaged watersheds
@@ -30,7 +30,7 @@ install_requires =
30
30
  dataretrieval
31
31
  geopandas
32
32
  pynhd>=0.19
33
- pygeohydro
33
+ pygeohydro>=0.19
34
34
  py3dep
35
35
  xarray-spatial
36
36
  rioxarray
@@ -41,6 +41,7 @@ install_requires =
41
41
  getgfs
42
42
  dask
43
43
  cfgrib
44
+ dynamical-catalog
44
45
 
45
46
  [options.packages.find]
46
47
  where = src
@@ -48,6 +49,11 @@ where = src
48
49
  [options.package_data]
49
50
  * = *.pickle
50
51
 
52
+ [options.entry_points]
53
+ console_scripts =
54
+ tempest-next = NEXT:cmdrun
55
+ NEXT = NEXT:cmdrun
56
+
51
57
  [egg_info]
52
58
  tag_build =
53
59
  tag_date = 0
@@ -0,0 +1,5 @@
1
+ from NEXT.model_manager import NEXT
2
+ from NEXT.data import full_data, all_data_gpkg
3
+ from NEXT import data
4
+ from NEXT import wforecast
5
+ from NEXT.interactive import cmdrun
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ Created on Thu Jun 11 09:35:04 2026
5
+
6
+ @author: daniel
7
+ """
8
+
9
+ from NEXT.interactive import cmdrun
10
+ cmdrun()
@@ -38,6 +38,7 @@ import shapely as shp
38
38
  import NEXT.wforecast as wfc
39
39
  import warnings
40
40
  import os
41
+ import rioxarray
41
42
 
42
43
  tid = "10343500"
43
44
  nldi_inst = [None]
@@ -437,7 +438,7 @@ def merit_geom(merit_id):
437
438
  # I don't know if this is straightforwardly doable, but useful for non-CONUS.
438
439
  pass
439
440
 
440
- geom_fns = {"usgs": gage_geom, "nhd": nhd_geom, "merit": merit_geom,
441
+ geom_fns = {"usgs": gage_geom,
441
442
  "coordinates": watershed_geom}
442
443
 
443
444
  # Weather requirements: date, tmax, prcp, vp
@@ -482,7 +483,7 @@ hrrr_varnames = {
482
483
  # "SPFH": ("vp", lambda x: wfc.sphum_to_vp(x.mean())) # humidity, but not available at surface.
483
484
  }
484
485
 
485
- def weather_hrrr(geom, start, end):
486
+ def weather_hrrr_archive(geom, start, end):
486
487
  start = np.datetime64(start)
487
488
  end = np.datetime64(end)
488
489
  dates = pd.Series(np.arange(start, end + np.timedelta64(1, "D")))
@@ -494,6 +495,45 @@ def weather_hrrr(geom, start, end):
494
495
  for var in hrrr_varnames
495
496
  ], axis=1).reset_index()
496
497
 
498
+ dynhrrr_varnames = {
499
+ "temperature_2m": ("tmax", lambda x: x.max()),
500
+ "precipitation_surface": ("prcp", lambda x: x[1:].mean() * 3600 * 24), # mm/s --> mm/day
501
+ "dew_point_temperature_2m": ("vp", lambda x: wfc.dpt_to_vp(x.mean()))
502
+ }
503
+
504
+ def weather_hrrr(geom, start, end):
505
+ return wfc.weather_dynamical(geom, start, end,
506
+ "noaa-hrrr-forecast-48-hour",
507
+ dynhrrr_varnames,
508
+ projstr,
509
+ 1)
510
+
511
+ gefs_varnames = {
512
+ "temperature_2m": ("tmax", lambda x: x.max()),
513
+ "precipitation_surface": ("prcp", lambda x: x[1:].mean() * 3600 * 24), # mm/s --> mm/day
514
+ # Needs conversion, but we do that in the function since temp is relevant
515
+ "relative_humidity_2m": ("vp", lambda x: x.mean())
516
+ }
517
+
518
+ def weather_gefs(geom, start, end, _keep_going=True):
519
+ """ Uses the mean over ensemble members, for now. """
520
+ try:
521
+ result = wfc.weather_dynamical(geom, start, end,
522
+ "noaa-gefs-forecast-35-day",
523
+ gefs_varnames,
524
+ "4326",
525
+ 34,
526
+ ["latitude", "longitude", "ensemble_member"])
527
+ # RH to vapor pressure using saturated vapor pressure
528
+ result['vp'] = result['vp']/100 * wfc.dpt_to_vp(result['tmax'])
529
+ return result
530
+ except rioxarray.exceptions.NoDataInBounds:
531
+ # Try buffering for coarser datasets
532
+ return weather_gefs(
533
+ geom.to_crs(projstr).buffer(10000).to_crs(geom.crs),
534
+ start, end, False # only try once
535
+ )
536
+
497
537
 
498
538
  def weather_gfs(geom, start, end):
499
539
  """
@@ -510,8 +550,9 @@ def weather_gfs(geom, start, end):
510
550
 
511
551
  # HRRR can be used for prediction, but not to build coefficient estimation weather,
512
552
  # as HRRR-Zarr doesn't have srad.
513
- weather_fns = {"daymet": weather_daymet, "nldas": weather_nldas,
514
- "gfs": weather_gfs, "hrrr": weather_hrrr, "gridmet": weather_gridmet}
553
+ weather_fns = {#"daymet": weather_daymet, "nldas": weather_nldas,
554
+ "gfs": weather_gfs, "hrrr": weather_hrrr, "gridmet": weather_gridmet,
555
+ "gefs": weather_gefs}
515
556
 
516
557
  # lcov requirements: forest, wetland, developed, ice_snow, water
517
558
  def lcov_nlcd(geom, start, end):
@@ -588,7 +629,7 @@ def topo_3dep(geom, area):
588
629
  def topo_merit(geom):
589
630
  pass
590
631
 
591
- topo_fns = {"3dep": topo_3dep, "merit": topo_merit}
632
+ topo_fns = {"3dep": topo_3dep}
592
633
 
593
634
  def obs_usgs(usgs_id, start, end):
594
635
  # Observed temperature
@@ -0,0 +1,173 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ Created on Wed Jun 10 12:05:09 2026
5
+
6
+ @author: Daniel Philippus
7
+
8
+ This module supports interactive and command-line use.
9
+ """
10
+
11
+ import urllib.request as request
12
+ import os
13
+ from NEXT import NEXT
14
+ import pickle
15
+ from NEXT import data
16
+ import pandas as pd
17
+ import argparse
18
+
19
+ next_url = "https://github.com/mines-ciroh/TempEst-NEXT/raw/refs/heads/master/coefs.pickle"
20
+
21
+ def get_model(cache=None, url=next_url, overwrite=False):
22
+ """
23
+ Retrieve and return a pre-trained model.
24
+
25
+ Parameters
26
+ ----------
27
+ cache : str, optional
28
+ If provided, retrieve from or write to a local file. The default is None.
29
+ url : str, optional
30
+ URL from which to retrieve model file. The default is next_url.
31
+ overwrite : bool, optional
32
+ Overwrite cached model if it exists. The default is False.
33
+
34
+ Returns
35
+ -------
36
+ NEXT.NEXT
37
+ The pre-trained model.
38
+ """
39
+ # Check if a stored model exists
40
+ if not overwrite and cache is not None:
41
+ if os.path.exists(cache):
42
+ return NEXT.from_pickle(cache)
43
+ # No stored model.
44
+ with request.urlopen(url) as req:
45
+ model = pickle.loads(req.read())
46
+ if cache is not None:
47
+ if overwrite or os.path.exists(cache):
48
+ model.to_pickle(cache)
49
+ return model
50
+
51
+
52
+ def iget(arg, query, options=None, default=None):
53
+ """
54
+ Interactively update parameter if needed.
55
+
56
+ Parameters
57
+ ----------
58
+ arg : str
59
+ Pre-specified value. Will only ask if arg is None.
60
+ query : str
61
+ What to ask the user for.
62
+ options : [str], optional
63
+ List of options for categorical questions. The default is None. Will
64
+ be set to all lowercase.
65
+ default : str, optional
66
+ The default option if user enters nothing. The default is None. If
67
+ None, it will just complain and ask again.
68
+
69
+ Returns
70
+ -------
71
+ str
72
+ New argument value.
73
+ """
74
+ oq = query
75
+ if arg is not None:
76
+ return arg
77
+ if options is not None:
78
+ options = [x.lower() for x in options]
79
+ query = query + f" ({', '.join(options)})"
80
+ if default is not None:
81
+ query = query + f" [default: {default}]"
82
+ arg = input(query + ': ')
83
+ if not arg.strip():
84
+ if default is not None:
85
+ return default
86
+ print("Error: a value must be provided.")
87
+ return iget(None, oq, options, default)
88
+ if options is not None:
89
+ if arg.lower() in options:
90
+ return arg
91
+ print(f"Error: invalid answer {arg}")
92
+ return iget(None, oq, options, default)
93
+ return arg.lower()
94
+
95
+
96
+ # Query, options, default. We separate these out as a dict so they are usable
97
+ # for multiple interaction modes.
98
+ descs = {
99
+ "site_type": ("Site type", list(data.geom_fns), None),
100
+ "site": ("Numeric site ID (no prefix; e.g., 10343500)", None, None),
101
+ "lat": ("Pour point latitude (Decimal degrees North, e.g. 40.623)", None, None),
102
+ "lon": ("Pour point longitude (Decimal degrees East, e.g. -120.1)", None, None),
103
+ "start": ("Start date (yyyy-mm-dd)", None, "2001-01-01"),
104
+ "end": ("End date (yyyy-mm-dd)", None, "2020-12-31"),
105
+ "weather": ("Weather data source", list(data.weather_fns), "gridmet"),
106
+ "model": ("Pre-trained model URL (optional)", None,
107
+ next_url),
108
+ "modpath": ("Pre-trained model cache file (optional)", None, "./model.pickle"),
109
+ "datafile": ("Location to cache input data (optional)", None, ""),
110
+ "output": ("Output file location", None, None)
111
+ }
112
+
113
+
114
+ def run(site_type=None, site=None, lat=None, lon=None, start=None, end=None,
115
+ weather=None, model=None, modpath=None, datafile=None, output=None):
116
+ # Validate inputs
117
+ site_type = iget(site_type, *descs['site_type'])
118
+ if site_type == 'coordinates':
119
+ lat = iget(lat, *descs['lat'])
120
+ lon = iget(lon, *descs['lon'])
121
+ site = lon + ":" + lat
122
+ else:
123
+ site = iget(site, *descs['site'])
124
+ start = iget(start, *descs['start'])
125
+ end = iget(end, *descs['end'])
126
+ weather = iget(weather, *descs['weather'])
127
+ model = iget(model, *descs['model'])
128
+ modpath = iget(modpath, *descs['modpath'])
129
+ datafile = iget(datafile, *descs['datafile'])
130
+ output = iget(output, *descs['output'])
131
+ # Actually run the model, retrieve data, etc
132
+ print("Retrieving model")
133
+ nxt = get_model(modpath, model, False)
134
+ print("Downloading prediction data")
135
+ if datafile and os.path.exists(datafile):
136
+ inpdata = pd.read_csv(datafile, parse_dates=['date'])
137
+ else:
138
+ inpdata = data.full_data(site, start, end, site_type=site_type,
139
+ weather=weather)
140
+ if datafile:
141
+ inpdata.to_csv(datafile)
142
+ print("Running model")
143
+ predictions = nxt.run(inpdata, reset=True)
144
+ print("Results preview")
145
+ print(predictions)
146
+ predictions.to_csv(output)
147
+ print(f"Done; results are in {output}")
148
+
149
+
150
+ def parser():
151
+ ap = argparse.ArgumentParser(
152
+ description="TempEst-NEXT Command Line\n"
153
+ "Carry out full TempEst-NEXT model runs from the "
154
+ "terminal/command prompt with no code. "
155
+ "All arguments are optional, with missing values requested "
156
+ "interactively. Site ID and lat/lon are mutually exclusive ("
157
+ "lat/lon will be ignored if site ID is provided).")
158
+ for (name, (desc, opts, default)) in descs.items():
159
+ name = "--" + name
160
+ ap.add_argument(name, choices=opts, required=False, default=default,
161
+ help=desc)
162
+ return ap
163
+
164
+
165
+ def cmdrun():
166
+ args = parser().parse_args()
167
+ run(**vars(args))
168
+
169
+ if __name__ == "__main__":
170
+ # Test args
171
+ # --site_type usgs --site 10343500 --start 2024-01-01 --end 2025-12-31 --modpath cache.pickle --datafile sagehen.csv --output sagehen_pred.csv
172
+ cmdrun()
173
+
@@ -21,6 +21,8 @@ import warnings
21
21
  import getgfs as gfs
22
22
  import urllib.request as urq
23
23
  import os
24
+ import dynamical_catalog as dyn
25
+
24
26
 
25
27
 
26
28
  # Direct copy-paste from https://mesowest.utah.edu/html/hrrr/zarr_documentation/html/zarr_HowToDownload.html
@@ -199,6 +201,10 @@ def sphum_to_vp(q, p=1e5):
199
201
  # Convert specific humidity, in kg/kg, to vapor pressure.
200
202
  return q*p / (0.622 + 0.378 * q)
201
203
 
204
+ def dpt_to_vp(dpt):
205
+ # Convert dewpoint to vapor pressure
206
+ return 611 * np.exp(7.5 * dpt / (237.3 + dpt))
207
+
202
208
 
203
209
  def get_gfs(basin, date, varbs=["tmp2m", "spfh2m", "dswrfsfc", "pratesfc"],
204
210
  new_names=["tmax", "vp", "srad", "prcp"],
@@ -238,3 +244,58 @@ def hrrr_series(basin, dates, var, new_name, operator):
238
244
  raw = pd.concat([hrrr_areal_summary(basin, date, var, new_name, operator)
239
245
  for date in dates])
240
246
  return raw.groupby("date").first()
247
+
248
+
249
+ def weather_dynamical(geom, start, end, name, items, proj, maxlead,
250
+ dims=["x", "y"]):
251
+ """
252
+ Generic retriever for weather data from the dynamical.org catalog.
253
+
254
+ Parameters
255
+ ----------
256
+ geom : pd.GeoDataFrame or similar
257
+ Basin geometry
258
+ start : str | np.datetime64
259
+ Start time recognizable by numpy.
260
+ end : str | np.datetime64
261
+ End time recognizable by numpy.
262
+ name : str
263
+ Name of the dataset in dynamical.org (https://dynamical.org/catalog).
264
+ items : dict {str: (str, function)}
265
+ Variables to seek. Key is dynamical.org variable name. First value
266
+ is the output name, e.g., "tmax". Second value converts a NumPy timeseries
267
+ to a single final value (e.g., mean, max, unit conversions).
268
+ proj : str
269
+ Projection string.
270
+ maxlead : int
271
+ Maximum lead time in days.
272
+ dims : [str]
273
+ List of spatial (or other averaging) dimensions.
274
+ Returns
275
+ -------
276
+ pd.DataFrame
277
+ Date and all variables specified by "items".
278
+
279
+ """
280
+ dataset = dyn.open(name)
281
+ geom = geom.to_crs(proj).geometry # rio-friendly geometry in relevant proj
282
+ one = np.timedelta64(1, "D")
283
+ start = np.datetime64(start)
284
+ end = np.datetime64(end)
285
+ dates = pd.Series(np.arange(start, end + one))
286
+ today = np.datetime64("today")
287
+ # for each date, we want that day's HRRR run unless it is after today.
288
+ # Then we want the shortest applicable forecast.
289
+ if dates.max() > today + one * maxlead:
290
+ raise ValueError("Max lead time exceeded")
291
+ timings = [(
292
+ date, slice("0D", "0D")
293
+ ) for date in dates if date <= today] + [(
294
+ today, slice("0D", date - today))
295
+ for date in dates if date > today]
296
+ return pd.DataFrame([
297
+ {"date": init} | {
298
+ name: fn(dataset.sel(init_time=init, lead_time=lead)[k].
299
+ rio.clip(geom).mean(dims).compute().to_numpy())
300
+ for (k, (name, fn)) in items.items()}
301
+ for (init, lead) in timings])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TempEst-NEXT
3
- Version: 0.1.5
3
+ Version: 0.2.0
4
4
  Summary: TempEst-NEXT, Stream Temperature Estimation - Near-term Expected Temperatures: a statistical stream temperature model with coefficient estimation for ungaged watersheds
5
5
  Home-page: https://rivertempest.org/next/readme.html
6
6
  Author: Daniel Philippus
@@ -22,7 +22,7 @@ Requires-Dist: pynldas2
22
22
  Requires-Dist: dataretrieval
23
23
  Requires-Dist: geopandas
24
24
  Requires-Dist: pynhd>=0.19
25
- Requires-Dist: pygeohydro
25
+ Requires-Dist: pygeohydro>=0.19
26
26
  Requires-Dist: py3dep
27
27
  Requires-Dist: xarray-spatial
28
28
  Requires-Dist: rioxarray
@@ -33,6 +33,7 @@ Requires-Dist: metpy
33
33
  Requires-Dist: getgfs
34
34
  Requires-Dist: dask
35
35
  Requires-Dist: cfgrib
36
+ Requires-Dist: dynamical-catalog
36
37
  Dynamic: license-file
37
38
 
38
39
  # TempEst-NEXT
@@ -51,6 +52,12 @@ Install from PyPI: `pip install tempest-next`. The installed module is called N
51
52
 
52
53
  Dependencies: pandas, numpy>=2, TempEst-NEWT, pygam>=0.10, pydaymet>=0.19, pynldas2, dataretrieval, geopandas, pynhd>=0.19, pygeohydro, py3dep, xarray-spatial, s3fs, zarr, cartopy, metpy, getgfs, dask
53
54
 
55
+ ### Instant Command Line Use
56
+
57
+ All of the below requirements are automated under certain assumptions and can be used directly through the command line or interactive use. After installing TempEst-NEXT as above, just open a terminal/command line and run: `tempest-next` (or `NEXT`, or, if those aren't on your path, `python -m NEXT`). This will interactively request all required information to automatically run the model for a given site (currently, pour point coordinates or a USGS gage ID), including forecasts. (Note that forecast data retrieval is rather slow, and the model does need at least a few years of data to predict well. Future updates will include the option to combine forecast data with climatology-adjusted historical estimates, which are much faster to retrieve.)
58
+
59
+ You can also pre-specify arguments instead of providing them interactively, which also means you can automate large-scale NEXT runs through the command line (or high-performance computing jobs, etc). To see all arguments, run `tempest-next --help`.
60
+
54
61
  ### Data Preparation
55
62
 
56
63
  TempEst-NEXT provides automatic tools for data retrieval, for example: `NEXT.data.full_data("-105.1235:40.5723", start="2020", end="2024", site_type="coordinates")`. You can also provide an input data frame. Required columns are `["id", "tmax", "prcp", "vp", "area", "elev_min", "elev", "slope", "wetland", "developed", "ice_snow", "water", "canopy", "ws_canopy", "date", "day"]`, with the addition of a "temperature" column if you wish to train a model.
@@ -71,7 +78,7 @@ Column details:
71
78
 
72
79
  Note: Daymet and NLDAS2 data retrieval are currently not working due to upstream issues. Gridmet (now set to default) works. The analysis in the paper was carried out using Daymet, so results may not be identical.
73
80
 
74
- For forecast data, past and present HRRR works (except, in historical data, for humidity, which must be retrieved through Gridmet), but has become very slow for unknown reasons. It is quick enough for actual forecasting use, but for historical (coefficient estimation) data, I recommend using a shorter sample of HRRR data to adjust Gridmet climatology. Gridmet is far faster.
81
+ For forecast data, past and present HRRR works, but is relatively slow. It is quick enough for actual forecasting use, but for historical (coefficient estimation) data, I recommend using a shorter sample of HRRR data to adjust Gridmet climatology. Gridmet is far faster. (HRRR is now quite a bit faster using the Dynamical.org catalog, but Gridmet is still the faster option.)
75
82
 
76
83
  For forecasting only (no long-term archives), GFS works well, but is rather memory-intensive, provided that your system supports `cfgrib` (which has experimental support for Windows, but mainly tagets Linux). Otherwise, it uses a native Python implementation which may work, but is slow and rather unreliable.
77
84
 
@@ -3,14 +3,17 @@ README.md
3
3
  pyproject.toml
4
4
  setup.cfg
5
5
  src/NEXT/__init__.py
6
+ src/NEXT/__main__.py
6
7
  src/NEXT/coef_est.py
7
8
  src/NEXT/data.py
8
9
  src/NEXT/datatools.py
10
+ src/NEXT/interactive.py
9
11
  src/NEXT/model_manager.py
10
12
  src/NEXT/reach_prep.py
11
13
  src/NEXT/wforecast.py
12
14
  src/TempEst_NEXT.egg-info/PKG-INFO
13
15
  src/TempEst_NEXT.egg-info/SOURCES.txt
14
16
  src/TempEst_NEXT.egg-info/dependency_links.txt
17
+ src/TempEst_NEXT.egg-info/entry_points.txt
15
18
  src/TempEst_NEXT.egg-info/requires.txt
16
19
  src/TempEst_NEXT.egg-info/top_level.txt
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ NEXT = NEXT:cmdrun
3
+ tempest-next = NEXT:cmdrun
@@ -8,7 +8,7 @@ pynldas2
8
8
  dataretrieval
9
9
  geopandas
10
10
  pynhd>=0.19
11
- pygeohydro
11
+ pygeohydro>=0.19
12
12
  py3dep
13
13
  xarray-spatial
14
14
  rioxarray
@@ -19,3 +19,4 @@ metpy
19
19
  getgfs
20
20
  dask
21
21
  cfgrib
22
+ dynamical-catalog
@@ -1,2 +0,0 @@
1
- from NEXT.model_manager import NEXT
2
- from NEXT.data import full_data, all_data_gpkg
File without changes