File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 11# `dataretrieval` package developed by USGS is used for the USGS stations: https://usgs-python.github.io/dataretrieval/
22#
3- # This pacakge is a thin wrapper around NWIS _REST API: https://waterservices.usgs.gov/rest/
3+ # This package is a thin wrapper around NWIS _REST API: https://waterservices.usgs.gov/rest/
44# We take the return values from `dataretrieval` to be the original data
55from __future__ import annotations
66
2222import pandas as pd
2323import xarray as xr
2424from dataretrieval import nwis
25- from dataretrieval .codes import state_codes
25+ from dataretrieval .codes import state_codes as _DATARETRIEVAL_STATE_CODES
2626from dataretrieval .utils import BaseMetadata
2727from shapely .geometry import MultiPolygon
2828from shapely .geometry import Polygon
4343# This will stop working if pandas switches its versioning scheme to CalVer or something...
4444_PANDAS_MAJOR_VERSION = int (importlib .metadata .version ("pandas" ).split ("." )[0 ])
4545
46+ # https://github.com/DOI-USGS/dataretrieval-python/compare/v1.0.8...v1.0.9
47+ if isinstance (_DATARETRIEVAL_STATE_CODES , list ):
48+ STATE_CODES = sorted (_DATARETRIEVAL_STATE_CODES )
49+ else :
50+ STATE_CODES = sorted (_DATARETRIEVAL_STATE_CODES .values ())
51+
4652# constants
4753USGS_OUTPUT_OF_INTEREST = (
4854 "elevation" , # Overlaps some of the specific codes below
@@ -156,7 +162,7 @@ def _get_all_usgs_stations(normalize: bool = True) -> gpd.GeoDataFrame:
156162 "hasDataType" : dtp ,
157163 }
158164 for st , dtp in product (
159- state_codes ,
165+ STATE_CODES ,
160166 USGS_OUTPUT_TYPE ,
161167 )
162168 ],
You can’t perform that action at this time.
0 commit comments