You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This ticket serves as a discussion area for downloading National Water Model data from Google Cloud Platform using hydrotools.
Installation
Assuming a UNIX-like environment, execute the following commands. The primary outcome should be a Python virtual environment with the hydrotools.nwm_client[gcp] package installed from PyPI.
Open main.py in your preferred editor and add the following code:
# Import the NWM Client for Google Cloud Platformfromhydrotools.nwm_clientimportgcpasnwmimportpandasaspd# Instantiate model data servicemodel_data_service=nwm.NWMDataService()
# Create a location mapping with your desired comid and # fake USGS site codes# Note: This is a work around until we fix the USGS requirementmy_mapping=pd.DataFrame({
"nwm_feature_id": [101, 179],
"usgs_site_code": ["my_site_a", "my_site_b"]
}).set_index("nwm_feature_id")
model_data_service.crosswalk=my_mapping# Retrieve forecast dataforecast_data=model_data_service.get(
configuration="short_range",
reference_time="20220126T01Z"
)
# Look at the dataprint(forecast_data.info(memory_usage='deep'))
print(forecast_data[[
'value_time',
'value',
'nwm_feature_id',
'measurement_unit',
'usgs_site_code',
'variable_name',
'configuration',
'reference_time'
]].head(100))
count_row=len(forecast_data.index) # Gives number of rowscount_col=len(forecast_data.columns) # Gives number of columnsprint("Total Rows: "+str(count_row))
print("Total Columns: "+str(count_col))
This ticket serves as a discussion area for downloading National Water Model data from Google Cloud Platform using
hydrotools
.Installation
Assuming a UNIX-like environment, execute the following commands. The primary outcome should be a Python virtual environment with the
hydrotools.nwm_client[gcp]
package installed from PyPI.$ python3 -m venv env $ source env/bin/activate (env) $ python3 -m pip install -U pip wheel (env) $ python3 -m pip install hydrotools.nwm_client[gcp] (env) $ touch main.py
Basic Example
Open
main.py
in your preferred editor and add the following code:Run the script using:
Output:
The text was updated successfully, but these errors were encountered: