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 Platform
from hydrotools.nwm_client import gcp as nwm
import pandas as pd
# Instantiate model data service
model_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 requirement
my_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 data
forecast_data = model_data_service.get(
configuration = "short_range",
reference_time = "20220126T01Z"
)
# Look at the data
print(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 rows
count_col = len(forecast_data.columns) # Gives number of columns
print("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.Basic Example
Open
main.py
in your preferred editor and add the following code:Run the script using:
Output: