National Water Model output to GSSHA input (NWMtoGSSHA)

http://water.noaa.gov/about/nwm

NWMtoGSSHA

class gsshapy.grid.NWMtoGSSHA(gssha_project_folder, gssha_project_file_name, lsm_input_folder_path, lsm_search_card='*.nc', lsm_lat_var='y', lsm_lon_var='x', lsm_time_var='time', lsm_lat_dim='y', lsm_lon_dim='x', lsm_time_dim='time', output_timezone=None)[source]

Bases: gsshapy.grid.grid_to_gssha.GRIDtoGSSHA

This class converts the National Water Model output data to GSSHA formatted input. This class inherits from class:GRIDtoGSSHA.

gssha_project_folder

str – Path to the GSSHA project folder

gssha_project_file_name

str – Name of the GSSHA elevation grid file.

lsm_input_folder_path

str – Path to the input folder for the LSM files.

lsm_search_card

str – Glob search pattern for LSM files. Ex. “*.grib2”.

lsm_lat_var

Optional[str] – Name of the latitude variable in the LSM netCDF files. Defaults to ‘lat’.

lsm_lon_var

Optional[str] – Name of the longitude variable in the LSM netCDF files. Defaults to ‘lon’.

lsm_time_var

Optional[str] – Name of the time variable in the LSM netCDF files. Defaults to ‘time’.

lsm_lat_dim

Optional[str] – Name of the latitude dimension in the LSM netCDF files. Defaults to ‘lat’.

lsm_lon_dim

Optional[str] – Name of the longitude dimension in the LSM netCDF files. Defaults to ‘lon’.

lsm_time_dim

Optional[str] – Name of the time dimension in the LSM netCDF files. Defaults to ‘time’.

output_timezone

Optional[tzinfo] – This is the timezone to output the dates for the data. Default is he GSSHA model timezone. This option does NOT currently work for NetCDF output.

Example:

from datetime import datetime
from gsshapy.grid import NWMtoGSSHA

n2g = NWMtoGSSHA(gssha_project_folder='E:\GSSHA',
                 gssha_project_file_name='gssha.prj',
                 lsm_input_folder_path='E:\GSSHA\nwm-data',
                 lsm_search_card="*.grib")

# example rain gage
out_gage_file = 'E:\GSSHA\nwm_rain1.gag'
n2g.lsm_precip_to_gssha_precip_gage(out_gage_file,
                                    lsm_data_var="RAINRATE",
                                    precip_type="RADAR")

# example data var map array
# WARNING: This is not complete
data_var_map_array = [
    ['precipitation_rate', 'RAINRATE'],
    ['pressure', 'PSFC'],
    ['relative_humidity', ['Q2D','T2D', 'PSFC']],
    ['wind_speed', ['U2D', 'V2D']],
    ['direct_radiation', 'SWDOWN'],  # ???
    ['diffusive_radiation', 'SWDOWN'],  # ???
    ['temperature', 'T2D'],
    ['cloud_cover', '????'],
]
e2g.lsm_data_to_arc_ascii(data_var_map_array)