This lesson covers creating your case-specific domain and defining static and initial conditions used for the land surface model within WRF-Hydro.
The uses the following software:
Note: Only USGS and default datasets are supported in this container. Lai_modis_30s
, nlcd2011_30m
, and topo_30s
are subsets for training purposes only
WRF-Hydro leverages the extensive domain generation and geophysical dataset processing tools available in the WRF Preprocessing System (WPS) to define model domains and generate input files for the land surface model. In particular WRF-Hydro requires the "geogrid" file derived from the WPS geogrid.exe
utility and a wrfinput file from WRF or a utility script provided by the WRF-Hydro team.
This tutorial walks users through the process of manually creating a geogrid file from an existing WPS installation and creating wrfinput files from provided script packages.
For those interested in the details of running the complete WPS system and generating wrfinput files through WRF, this is covered in our Docker training on the coupled WRF and WRF-Hydro modeling system.
The WPS geographical input data (e.g. land cover, soil texture, and terrain height) are some of the primary datasets used by WRF-Hydro. The entire dataset collection can be obtained from the WPS geographical input data download page. However, these data are rather large (~50GB) and contain a number of datasets that are not used in most implementations of WRF-Hydro.
To facilitate the domain generation process, the WRF-Hydro team has created a subset of the data by removing unnecessary data, removing resolutions of the data not commonly used, and limiting the areal extent of this subset. This is consistent with the availability of other datasets used in this tutorial. Thus, the dataset provided with this container is considerably smaller than the complete WPS geographical input dataset.
The WPS program geogrid.exe
is used to create the geo_em.d01.nc
file, hereafter referred to as the geogrid file. The geogrid.exe
program takes a Fortran namelist (namelist.wps
) defining the projection, resolution, and extent of the model domain as well as the desired input fields and the WPS geographical input data as inputs and creates the geogrid file.
The land surface model in WRF-Hydro operates on the domain defined within the geogrid file. The geogrid.exe
program generates this file based upon input variables specified in the namelist.wps
file.
The first step to creating the geogrid file is to define our domain boundaries. The geogrid.exe
program takes by default a centerpoint x and y grid specification, and other projection information to define a bounding box for the domain. If you do not already have coordinates, you can obtain them from Google Earth or a standard GIS system. However, for this tutorial we have supplied the coordinates for you and you may use the WRF-Hydro geogrid Python command line utility to visualize the domain location and create the geogrid file given these coordinates.
The WPS geogrid.exe
utility is controlled by options set in the namelist.wps
. As previously stated, there are many options in the namelist.wps
file that are not relevant to most WRF-Hydro users. For educational purposes, we will take a quick look at a full namelist.wps
file and then discuss the relevant options used by the WRF-Hydro geogrid utility in more detail.
Step 1: Setup the directory for this lesson
First, we need to create a directory to hold the inputs and outputs for this lesson.
%%bash
mkdir -p ~/wrf-hydro-training/lesson-wps/geogrid
Step 2: View the namelist
In the example case is a sample namelist.wps
file for the domain of interest
%%bash
cd ~/wrf-hydro-training/lesson-wps
cp ~/wrf-hydro-training/example_case/supplemental/namelist.wps .
cat namelist.wps
&share wrf_core = 'ARW', max_dom = 1, start_date = '2006-08-16_12:00:00', end_date = '2006-08-16_18:00:00', interval_seconds = 21600, io_form_geogrid = 2, / &geogrid parent_id = 1, parent_grid_ratio = 1, i_parent_start = 1, j_parent_start = 1, e_we = 23, e_sn = 29, dx = 1000, dy = 1000, map_proj = 'lambert', ref_lat = 41.14989, ref_lon = -75.48096, truelat1 = 30.0, truelat2 = 60.0, stand_lon = -97.0, geog_data_res = 'nlcd2011_30m+gtopo_30s+default', geog_data_path = '/home/docker/WRF_WPS/geog_conus', / &ungrib out_format = 'WPS', prefix = 'FILE', / &metgrid fg_name = 'FILE', io_form_metgrid = 2, /
A full description of these options can be found in the WPS User Guide.
The options that are of interest to most WRF-Hydro users are the following:
Table 1. WPS namelist options relevent to WRF-Hydro
Option | Description |
---|---|
e_we | The number of grid edges in the west-east dimension. The number of grid centers will be e_we-1. |
e_sn | The number of grid edges in the south-north dimension. The number of grid centers will be e_sn-1. |
ref_lat | A real value specifying the latitude part of a (latitude, longitude) center-point of the domain. South latitudes are negative, and the value of ref_lat should be in the range [-90, 90]. |
ref_lon | A real value specifying the longitude part of a (latitude, longitude) center-point of the domain. West longitudes are negative, and the value of ref_lon should be in the range [-180, 180]. |
dx | A real value specifying the grid distance in the x-direction where the map scale factor is 1. The grid distance is in meters for the 'polar', 'lambert', and 'mercator' projection, and in degrees longitude for the 'lat-lon' projection. |
dy | A real value specifying the grid distance in the y-direction where the map scale factor is 1. The grid distance is in meters for the 'polar', 'lambert', and 'mercator' projection, and in degrees latitude for the 'lat-lon' projection. |
map_proj | A character string specifying the projection of the simulation domain. Accepted projections are 'lambert', 'polar', 'mercator', and 'lat-lon'. Default value is 'lambert'. |
truelat1 | A real value specifying, the first true latitude for the Lambert conformal conic projection, or the only true latitude for the Mercator and polar stereographic projections. |
truelat2 | A real value specifying, the second true latitude for the Lambert conformal conic projection. For all other projections, truelat2 is ignored. No default value. |
stand_lon | A real value specifying, the longitude that is parallel with the y-axis in the Lambert conformal and polar stereographic projections. For the regular latitude-longitude projection, this value gives the rotation about the earth's geographic poles. No default value. |
geog_data_res | A character string specifying a corresponding resolution or list of resolutions separated by + symbols of source data to be used when interpolating static terrestrial data to the grid. This string should contain a resolution matching a string preceding a colon in a rel_path or abs_path specification (see the description of GEOGRID.TBL options) in the GEOGRID.TBL file for each field. If a resolution in the string does not match any such string in a rel_path or abs_path specification for a field in GEOGRID.TBL, a default resolution of data for that field, if one is specified, will be used. If multiple resolutions match, the first resolution to match a string in a rel_path or abs_path specification in the GEOGRID.TBL file will be used. Default value is 'default'. |
geog_data_path | A character string giving the path, either relative or absolute, to the directory where the geographical data directories may be found. This path is the one to which rel_path specifications in the GEOGRID.TBL file are given in relation to. No default value. |
In this section, we will create the geogrid file using the WPS geogrid utility.
%%bash
cd ~/wrf-hydro-training/lesson-wps
cp ~/WRF_WPS/WPS/geogrid/*.exe geogrid
cp ~/WRF_WPS/geog_conus/*TBL* geogrid/GEOGRID.TBL
./geogrid/geogrid.exe
Parsed 7 entries in GEOGRID.TBL Processing domain 1 of 1 Processing XLAT and XLONG Processing MAPFAC Processing F and E Processing ROTANG Processing LANDUSEF Calculating landmask from LANDUSEF ( WATER = 16 ) Processing HGT_M Processing SOILTEMP Processing SOILCTOP Processing SCT_DOM Processing SOILCBOT Processing SCB_DOM Processing GREENFRAC Processing LAI12M !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Successful completion of geogrid. ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Now that we have created our geogrid file, we will quickly display the file header using the ncdump command line utility and open the file using the Python library xarray
to visualize its contents.
%%bash
cd ~/wrf-hydro-training/lesson-wps
ncdump -h geo_em.d01.nc
netcdf geo_em.d01 { dimensions: Time = UNLIMITED ; // (1 currently) DateStrLen = 19 ; west_east = 22 ; south_north = 28 ; south_north_stag = 29 ; west_east_stag = 23 ; land_cat = 24 ; soil_cat = 16 ; month = 12 ; variables: char Times(Time, DateStrLen) ; float XLAT_M(Time, south_north, west_east) ; XLAT_M:FieldType = 104 ; XLAT_M:MemoryOrder = "XY " ; XLAT_M:units = "degrees latitude" ; XLAT_M:description = "Latitude on mass grid" ; XLAT_M:stagger = "M" ; XLAT_M:sr_x = 1 ; XLAT_M:sr_y = 1 ; float XLONG_M(Time, south_north, west_east) ; XLONG_M:FieldType = 104 ; XLONG_M:MemoryOrder = "XY " ; XLONG_M:units = "degrees longitude" ; XLONG_M:description = "Longitude on mass grid" ; XLONG_M:stagger = "M" ; XLONG_M:sr_x = 1 ; XLONG_M:sr_y = 1 ; float XLAT_V(Time, south_north_stag, west_east) ; XLAT_V:FieldType = 104 ; XLAT_V:MemoryOrder = "XY " ; XLAT_V:units = "degrees latitude" ; XLAT_V:description = "Latitude on V grid" ; XLAT_V:stagger = "V" ; XLAT_V:sr_x = 1 ; XLAT_V:sr_y = 1 ; float XLONG_V(Time, south_north_stag, west_east) ; XLONG_V:FieldType = 104 ; XLONG_V:MemoryOrder = "XY " ; XLONG_V:units = "degrees longitude" ; XLONG_V:description = "Longitude on V grid" ; XLONG_V:stagger = "V" ; XLONG_V:sr_x = 1 ; XLONG_V:sr_y = 1 ; float XLAT_U(Time, south_north, west_east_stag) ; XLAT_U:FieldType = 104 ; XLAT_U:MemoryOrder = "XY " ; XLAT_U:units = "degrees latitude" ; XLAT_U:description = "Latitude on U grid" ; XLAT_U:stagger = "U" ; XLAT_U:sr_x = 1 ; XLAT_U:sr_y = 1 ; float XLONG_U(Time, south_north, west_east_stag) ; XLONG_U:FieldType = 104 ; XLONG_U:MemoryOrder = "XY " ; XLONG_U:units = "degrees longitude" ; XLONG_U:description = "Longitude on U grid" ; XLONG_U:stagger = "U" ; XLONG_U:sr_x = 1 ; XLONG_U:sr_y = 1 ; float CLAT(Time, south_north, west_east) ; CLAT:FieldType = 104 ; CLAT:MemoryOrder = "XY " ; CLAT:units = "degrees latitude" ; CLAT:description = "Computational latitude on mass grid" ; CLAT:stagger = "M" ; CLAT:sr_x = 1 ; CLAT:sr_y = 1 ; float CLONG(Time, south_north, west_east) ; CLONG:FieldType = 104 ; CLONG:MemoryOrder = "XY " ; CLONG:units = "degrees longitude" ; CLONG:description = "Computational longitude on mass grid" ; CLONG:stagger = "M" ; CLONG:sr_x = 1 ; CLONG:sr_y = 1 ; float MAPFAC_M(Time, south_north, west_east) ; MAPFAC_M:FieldType = 104 ; MAPFAC_M:MemoryOrder = "XY " ; MAPFAC_M:units = "none" ; MAPFAC_M:description = "Mapfactor on mass grid" ; MAPFAC_M:stagger = "M" ; MAPFAC_M:sr_x = 1 ; MAPFAC_M:sr_y = 1 ; float MAPFAC_V(Time, south_north_stag, west_east) ; MAPFAC_V:FieldType = 104 ; MAPFAC_V:MemoryOrder = "XY " ; MAPFAC_V:units = "none" ; MAPFAC_V:description = "Mapfactor on V grid" ; MAPFAC_V:stagger = "V" ; MAPFAC_V:sr_x = 1 ; MAPFAC_V:sr_y = 1 ; float MAPFAC_U(Time, south_north, west_east_stag) ; MAPFAC_U:FieldType = 104 ; MAPFAC_U:MemoryOrder = "XY " ; MAPFAC_U:units = "none" ; MAPFAC_U:description = "Mapfactor on U grid" ; MAPFAC_U:stagger = "U" ; MAPFAC_U:sr_x = 1 ; MAPFAC_U:sr_y = 1 ; float MAPFAC_MX(Time, south_north, west_east) ; MAPFAC_MX:FieldType = 104 ; MAPFAC_MX:MemoryOrder = "XY " ; MAPFAC_MX:units = "none" ; MAPFAC_MX:description = "Mapfactor (x-dir) on mass grid" ; MAPFAC_MX:stagger = "M" ; MAPFAC_MX:sr_x = 1 ; MAPFAC_MX:sr_y = 1 ; float MAPFAC_VX(Time, south_north_stag, west_east) ; MAPFAC_VX:FieldType = 104 ; MAPFAC_VX:MemoryOrder = "XY " ; MAPFAC_VX:units = "none" ; MAPFAC_VX:description = "Mapfactor (x-dir) on V grid" ; MAPFAC_VX:stagger = "V" ; MAPFAC_VX:sr_x = 1 ; MAPFAC_VX:sr_y = 1 ; float MAPFAC_UX(Time, south_north, west_east_stag) ; MAPFAC_UX:FieldType = 104 ; MAPFAC_UX:MemoryOrder = "XY " ; MAPFAC_UX:units = "none" ; MAPFAC_UX:description = "Mapfactor (x-dir) on U grid" ; MAPFAC_UX:stagger = "U" ; MAPFAC_UX:sr_x = 1 ; MAPFAC_UX:sr_y = 1 ; float MAPFAC_MY(Time, south_north, west_east) ; MAPFAC_MY:FieldType = 104 ; MAPFAC_MY:MemoryOrder = "XY " ; MAPFAC_MY:units = "none" ; MAPFAC_MY:description = "Mapfactor (y-dir) on mass grid" ; MAPFAC_MY:stagger = "M" ; MAPFAC_MY:sr_x = 1 ; MAPFAC_MY:sr_y = 1 ; float MAPFAC_VY(Time, south_north_stag, west_east) ; MAPFAC_VY:FieldType = 104 ; MAPFAC_VY:MemoryOrder = "XY " ; MAPFAC_VY:units = "none" ; MAPFAC_VY:description = "Mapfactor (y-dir) on V grid" ; MAPFAC_VY:stagger = "V" ; MAPFAC_VY:sr_x = 1 ; MAPFAC_VY:sr_y = 1 ; float MAPFAC_UY(Time, south_north, west_east_stag) ; MAPFAC_UY:FieldType = 104 ; MAPFAC_UY:MemoryOrder = "XY " ; MAPFAC_UY:units = "none" ; MAPFAC_UY:description = "Mapfactor (y-dir) on U grid" ; MAPFAC_UY:stagger = "U" ; MAPFAC_UY:sr_x = 1 ; MAPFAC_UY:sr_y = 1 ; float E(Time, south_north, west_east) ; E:FieldType = 104 ; E:MemoryOrder = "XY " ; E:units = "-" ; E:description = "Coriolis E parameter" ; E:stagger = "M" ; E:sr_x = 1 ; E:sr_y = 1 ; float F(Time, south_north, west_east) ; F:FieldType = 104 ; F:MemoryOrder = "XY " ; F:units = "-" ; F:description = "Coriolis F parameter" ; F:stagger = "M" ; F:sr_x = 1 ; F:sr_y = 1 ; float SINALPHA(Time, south_north, west_east) ; SINALPHA:FieldType = 104 ; SINALPHA:MemoryOrder = "XY " ; SINALPHA:units = "none" ; SINALPHA:description = "Sine of rotation angle" ; SINALPHA:stagger = "M" ; SINALPHA:sr_x = 1 ; SINALPHA:sr_y = 1 ; float COSALPHA(Time, south_north, west_east) ; COSALPHA:FieldType = 104 ; COSALPHA:MemoryOrder = "XY " ; COSALPHA:units = "none" ; COSALPHA:description = "Cosine of rotation angle" ; COSALPHA:stagger = "M" ; COSALPHA:sr_x = 1 ; COSALPHA:sr_y = 1 ; float LANDMASK(Time, south_north, west_east) ; LANDMASK:FieldType = 104 ; LANDMASK:MemoryOrder = "XY " ; LANDMASK:units = "none" ; LANDMASK:description = "Landmask : 1=land, 0=water" ; LANDMASK:stagger = "M" ; LANDMASK:sr_x = 1 ; LANDMASK:sr_y = 1 ; float XLAT_C(Time, south_north_stag, west_east_stag) ; XLAT_C:FieldType = 104 ; XLAT_C:MemoryOrder = "XY " ; XLAT_C:units = "degrees latitude" ; XLAT_C:description = "Latitude at grid cell corners" ; XLAT_C:stagger = "CORNER" ; XLAT_C:sr_x = 1 ; XLAT_C:sr_y = 1 ; float XLONG_C(Time, south_north_stag, west_east_stag) ; XLONG_C:FieldType = 104 ; XLONG_C:MemoryOrder = "XY " ; XLONG_C:units = "degrees longitude" ; XLONG_C:description = "Longitude at grid cell corners" ; XLONG_C:stagger = "CORNER" ; XLONG_C:sr_x = 1 ; XLONG_C:sr_y = 1 ; float SINALPHA_U(Time, south_north, west_east_stag) ; SINALPHA_U:FieldType = 104 ; SINALPHA_U:MemoryOrder = "XY " ; SINALPHA_U:units = "none" ; SINALPHA_U:description = "Sine of rotation angle on U grid" ; SINALPHA_U:stagger = "U" ; SINALPHA_U:sr_x = 1 ; SINALPHA_U:sr_y = 1 ; float COSALPHA_U(Time, south_north, west_east_stag) ; COSALPHA_U:FieldType = 104 ; COSALPHA_U:MemoryOrder = "XY " ; COSALPHA_U:units = "none" ; COSALPHA_U:description = "Cosine of rotation angle on U grid" ; COSALPHA_U:stagger = "U" ; COSALPHA_U:sr_x = 1 ; COSALPHA_U:sr_y = 1 ; float SINALPHA_V(Time, south_north_stag, west_east) ; SINALPHA_V:FieldType = 104 ; SINALPHA_V:MemoryOrder = "XY " ; SINALPHA_V:units = "none" ; SINALPHA_V:description = "Sine of rotation angle on V grid" ; SINALPHA_V:stagger = "V" ; SINALPHA_V:sr_x = 1 ; SINALPHA_V:sr_y = 1 ; float COSALPHA_V(Time, south_north_stag, west_east) ; COSALPHA_V:FieldType = 104 ; COSALPHA_V:MemoryOrder = "XY " ; COSALPHA_V:units = "none" ; COSALPHA_V:description = "Cosine of rotation angle on V grid" ; COSALPHA_V:stagger = "V" ; COSALPHA_V:sr_x = 1 ; COSALPHA_V:sr_y = 1 ; float LANDUSEF(Time, land_cat, south_north, west_east) ; LANDUSEF:FieldType = 104 ; LANDUSEF:MemoryOrder = "XYZ" ; LANDUSEF:units = "category" ; LANDUSEF:description = "2011 30 meter, USGS reclass" ; LANDUSEF:stagger = "M" ; LANDUSEF:sr_x = 1 ; LANDUSEF:sr_y = 1 ; float LU_INDEX(Time, south_north, west_east) ; LU_INDEX:FieldType = 104 ; LU_INDEX:MemoryOrder = "XY " ; LU_INDEX:units = "category" ; LU_INDEX:description = "Dominant category" ; LU_INDEX:stagger = "M" ; LU_INDEX:sr_x = 1 ; LU_INDEX:sr_y = 1 ; float HGT_M(Time, south_north, west_east) ; HGT_M:FieldType = 104 ; HGT_M:MemoryOrder = "XY " ; HGT_M:units = "meters MSL" ; HGT_M:description = "Topography height" ; HGT_M:stagger = "M" ; HGT_M:sr_x = 1 ; HGT_M:sr_y = 1 ; float SOILTEMP(Time, south_north, west_east) ; SOILTEMP:FieldType = 104 ; SOILTEMP:MemoryOrder = "XY " ; SOILTEMP:units = "Kelvin" ; SOILTEMP:description = "Annual mean deep soil temperature" ; SOILTEMP:stagger = "M" ; SOILTEMP:sr_x = 1 ; SOILTEMP:sr_y = 1 ; float SOILCTOP(Time, soil_cat, south_north, west_east) ; SOILCTOP:FieldType = 104 ; SOILCTOP:MemoryOrder = "XYZ" ; SOILCTOP:units = "category" ; SOILCTOP:description = "16-category top-layer soil type" ; SOILCTOP:stagger = "M" ; SOILCTOP:sr_x = 1 ; SOILCTOP:sr_y = 1 ; float SCT_DOM(Time, south_north, west_east) ; SCT_DOM:FieldType = 104 ; SCT_DOM:MemoryOrder = "XY " ; SCT_DOM:units = "category" ; SCT_DOM:description = "Dominant category" ; SCT_DOM:stagger = "M" ; SCT_DOM:sr_x = 1 ; SCT_DOM:sr_y = 1 ; float SOILCBOT(Time, soil_cat, south_north, west_east) ; SOILCBOT:FieldType = 104 ; SOILCBOT:MemoryOrder = "XYZ" ; SOILCBOT:units = "category" ; SOILCBOT:description = "16-category bottom-layer soil type" ; SOILCBOT:stagger = "M" ; SOILCBOT:sr_x = 1 ; SOILCBOT:sr_y = 1 ; float SCB_DOM(Time, south_north, west_east) ; SCB_DOM:FieldType = 104 ; SCB_DOM:MemoryOrder = "XY " ; SCB_DOM:units = "category" ; SCB_DOM:description = "Dominant category" ; SCB_DOM:stagger = "M" ; SCB_DOM:sr_x = 1 ; SCB_DOM:sr_y = 1 ; float GREENFRAC(Time, month, south_north, west_east) ; GREENFRAC:FieldType = 104 ; GREENFRAC:MemoryOrder = "XYZ" ; GREENFRAC:units = "fraction" ; GREENFRAC:description = "MODIS FPAR" ; GREENFRAC:stagger = "M" ; GREENFRAC:sr_x = 1 ; GREENFRAC:sr_y = 1 ; float LAI12M(Time, month, south_north, west_east) ; LAI12M:FieldType = 104 ; LAI12M:MemoryOrder = "XYZ" ; LAI12M:units = "m^2/m^2" ; LAI12M:description = "MODIS LAI" ; LAI12M:stagger = "M" ; LAI12M:sr_x = 1 ; LAI12M:sr_y = 1 ; // global attributes: :TITLE = "OUTPUT FROM GEOGRID V4.2" ; :SIMULATION_START_DATE = "0000-00-00_00:00:00" ; :WEST-EAST_GRID_DIMENSION = 23 ; :SOUTH-NORTH_GRID_DIMENSION = 29 ; :BOTTOM-TOP_GRID_DIMENSION = 0 ; :WEST-EAST_PATCH_START_UNSTAG = 1 ; :WEST-EAST_PATCH_END_UNSTAG = 22 ; :WEST-EAST_PATCH_START_STAG = 1 ; :WEST-EAST_PATCH_END_STAG = 23 ; :SOUTH-NORTH_PATCH_START_UNSTAG = 1 ; :SOUTH-NORTH_PATCH_END_UNSTAG = 28 ; :SOUTH-NORTH_PATCH_START_STAG = 1 ; :SOUTH-NORTH_PATCH_END_STAG = 29 ; :GRIDTYPE = "C" ; :DX = 1000.f ; :DY = 1000.f ; :DYN_OPT = 2 ; :CEN_LAT = 41.1499f ; :CEN_LON = -75.48096f ; :TRUELAT1 = 30.f ; :TRUELAT2 = 60.f ; :MOAD_CEN_LAT = 41.1499f ; :STAND_LON = -97.f ; :POLE_LAT = 90.f ; :POLE_LON = 0.f ; :corner_lats = 41.0548f, 41.29664f, 41.24474f, 41.00313f, 41.05603f, 41.29786f, 41.24351f, 41.0019f, 41.05032f, 41.30112f, 41.24922f, 40.99865f, 41.05154f, 41.30235f, 41.24798f, 40.99742f ; :corner_lons = -75.64975f, -75.5618f, -75.31165f, -75.40051f, -75.6557f, -75.56775f, -75.30569f, -75.39459f, -75.65137f, -75.56015f, -75.31f, -75.40216f, -75.65729f, -75.5661f, -75.30405f, -75.39624f ; :MAP_PROJ = 1 ; :MMINLU = "USGS" ; :NUM_LAND_CAT = 24 ; :ISWATER = 16 ; :ISLAKE = -1 ; :ISICE = 24 ; :ISURBAN = 1 ; :ISOILWATER = 14 ; :grid_id = 1 ; :parent_id = 1 ; :i_parent_start = 1 ; :j_parent_start = 1 ; :i_parent_end = 23 ; :j_parent_end = 29 ; :parent_grid_ratio = 1 ; :sr_x = 1 ; :sr_y = 1 ; :FLAG_MF_XY = 1 ; :FLAG_LAI12M = 1 ; }
import xarray as xr
from matplotlib import pyplot as plt
xr.set_options(display_style="html")
ds = xr.open_dataset('~/wrf-hydro-training/lesson-wps/geo_em.d01.nc')
ds
<xarray.Dataset> Dimensions: (Time: 1, land_cat: 24, month: 12, soil_cat: 16, south_north: 28, south_north_stag: 29, west_east: 22, west_east_stag: 23) Dimensions without coordinates: Time, land_cat, month, soil_cat, south_north, south_north_stag, west_east, west_east_stag Data variables: Times (Time) |S19 b'0000-00-00_00:00:00' XLAT_M (Time, south_north, west_east) float32 41.0548 ... 41.244736 XLONG_M (Time, south_north, west_east) float32 -75.64975 ... -75.311646 XLAT_V (Time, south_north_stag, west_east) float32 41.050323 ... 41.... XLONG_V (Time, south_north_stag, west_east) float32 -75.65137 ... -75.31 XLAT_U (Time, south_north, west_east_stag) float32 41.056026 ... 41.... XLONG_U (Time, south_north, west_east_stag) float32 -75.6557 ... -75.... CLAT (Time, south_north, west_east) float32 41.0548 ... 41.244736 CLONG (Time, south_north, west_east) float32 -75.64975 ... -75.311646 MAPFAC_M (Time, south_north, west_east) float32 0.96873313 ... 0.96848786 MAPFAC_V (Time, south_north_stag, west_east) float32 0.9687391 ... 0.9... MAPFAC_U (Time, south_north, west_east_stag) float32 0.96873164 ... 0.... MAPFAC_MX (Time, south_north, west_east) float32 0.96873313 ... 0.96848786 MAPFAC_VX (Time, south_north_stag, west_east) float32 0.9687391 ... 0.9... MAPFAC_UX (Time, south_north, west_east_stag) float32 0.96873164 ... 0.... MAPFAC_MY (Time, south_north, west_east) float32 0.96873313 ... 0.96848786 MAPFAC_VY (Time, south_north_stag, west_east) float32 0.9687391 ... 0.9... MAPFAC_UY (Time, south_north, west_east_stag) float32 0.96873164 ... 0.... E (Time, south_north, west_east) float32 0.000109975284 ... 0.0... F (Time, south_north, west_east) float32 9.578487e-05 ... 9.614... SINALPHA (Time, south_north, west_east) float32 -0.26397792 ... -0.266... COSALPHA (Time, south_north, west_east) float32 0.96452874 ... 0.96373206 LANDMASK (Time, south_north, west_east) float32 1.0 1.0 1.0 ... 1.0 1.0 XLAT_C (Time, south_north_stag, west_east_stag) float32 41.05154 ...... XLONG_C (Time, south_north_stag, west_east_stag) float32 -75.65729 ..... SINALPHA_U (Time, south_north, west_east_stag) float32 -0.26392105 ... -... COSALPHA_U (Time, south_north, west_east_stag) float32 0.9645443 ... 0.9... SINALPHA_V (Time, south_north_stag, west_east) float32 -0.26284102 ... -... COSALPHA_V (Time, south_north_stag, west_east) float32 0.96483916 ... 0.... LANDUSEF (Time, land_cat, south_north, west_east) float32 0.0 0.0 ... 0.0 LU_INDEX (Time, south_north, west_east) float32 11.0 14.0 ... 11.0 11.0 HGT_M (Time, south_north, west_east) float32 569.91296 ... 574.8651 SOILTEMP (Time, south_north, west_east) float32 282.65735 ... 282.4951 SOILCTOP (Time, soil_cat, south_north, west_east) float32 0.0 0.0 ... 0.0 SCT_DOM (Time, south_north, west_east) float32 4.0 4.0 4.0 ... 3.0 3.0 SOILCBOT (Time, soil_cat, south_north, west_east) float32 0.0 0.0 ... 0.0 SCB_DOM (Time, south_north, west_east) float32 4.0 4.0 4.0 ... 3.0 3.0 GREENFRAC (Time, month, south_north, west_east) float32 0.4768918 ... 0.35 LAI12M (Time, month, south_north, west_east) float32 0.7879837 ... 0.5 Attributes: TITLE: OUTPUT FROM GEOGRID V4.2 SIMULATION_START_DATE: 0000-00-00_00:00:00 WEST-EAST_GRID_DIMENSION: 23 SOUTH-NORTH_GRID_DIMENSION: 29 BOTTOM-TOP_GRID_DIMENSION: 0 WEST-EAST_PATCH_START_UNSTAG: 1 WEST-EAST_PATCH_END_UNSTAG: 22 WEST-EAST_PATCH_START_STAG: 1 WEST-EAST_PATCH_END_STAG: 23 SOUTH-NORTH_PATCH_START_UNSTAG: 1 SOUTH-NORTH_PATCH_END_UNSTAG: 28 SOUTH-NORTH_PATCH_START_STAG: 1 SOUTH-NORTH_PATCH_END_STAG: 29 GRIDTYPE: C DX: 1000.0 DY: 1000.0 DYN_OPT: 2 CEN_LAT: 41.149902 CEN_LON: -75.48096 TRUELAT1: 30.0 TRUELAT2: 60.0 MOAD_CEN_LAT: 41.149902 STAND_LON: -97.0 POLE_LAT: 90.0 POLE_LON: 0.0 corner_lats: [41.0548 41.29664 41.244736 41.003128... corner_lons: [-75.64975 -75.5618 -75.311646 -75.40... MAP_PROJ: 1 MMINLU: USGS NUM_LAND_CAT: 24 ISWATER: 16 ISLAKE: -1 ISICE: 24 ISURBAN: 1 ISOILWATER: 14 grid_id: 1 parent_id: 1 i_parent_start: 1 j_parent_start: 1 i_parent_end: 23 j_parent_end: 29 parent_grid_ratio: 1 sr_x: 1 sr_y: 1 FLAG_MF_XY: 1 FLAG_LAI12M: 1
array([b'0000-00-00_00:00:00'], dtype='|S19')
array([[[41.0548 , 41.052353, ..., 41.005608, 41.003128], [41.06376 , 41.06131 , ..., 41.014553, 41.012077], ..., [41.287685, 41.285217, ..., 41.238277, 41.235798], [41.29664 , 41.294178, ..., 41.247234, 41.244736]]], dtype=float32)
array([[[-75.64975 , -75.63788 , ..., -75.412384, -75.40051 ], [-75.646484, -75.63461 , ..., -75.40912 , -75.39725 ], ..., [-75.56506 , -75.55313 , ..., -75.32684 , -75.31494 ], [-75.5618 , -75.549866, ..., -75.32355 , -75.311646]]], dtype=float32)
array([[[41.050323, 41.047874, ..., 41.001137, 40.998653], [41.059277, 41.056835, ..., 41.010082, 41.007603], ..., [41.29216 , 41.289703, ..., 41.242756, 41.240265], [41.301117, 41.298653, ..., 41.2517 , 41.24922 ]]], dtype=float32)
array([[[-75.65137 , -75.639465, ..., -75.414 , -75.40216 ], [-75.64813 , -75.63623 , ..., -75.410736, -75.398865], ..., [-75.563416, -75.55151 , ..., -75.325195, -75.31329 ], [-75.56015 , -75.54822 , ..., -75.3219 , -75.31 ]]], dtype=float32)
array([[[41.056026, 41.05358 , ..., 41.004375, 41.001904], [41.064983, 41.062534, ..., 41.013317, 41.01085 ], ..., [41.28891 , 41.28645 , ..., 41.23704 , 41.23456 ], [41.297863, 41.295406, ..., 41.24599 , 41.243507]]], dtype=float32)
array([[[-75.6557 , -75.6438 , ..., -75.40643 , -75.39459 ], [-75.652435, -75.640564, ..., -75.40317 , -75.3913 ], ..., [-75.571014, -75.55908 , ..., -75.32089 , -75.30899 ], [-75.56775 , -75.55585 , ..., -75.3176 , -75.305695]]], dtype=float32)
array([[[41.0548 , 41.052353, ..., 41.005608, 41.003128], [41.06376 , 41.06131 , ..., 41.014553, 41.012077], ..., [41.287685, 41.285217, ..., 41.238277, 41.235798], [41.29664 , 41.294178, ..., 41.247234, 41.244736]]], dtype=float32)
array([[[-75.64975 , -75.63788 , ..., -75.412384, -75.40051 ], [-75.646484, -75.63461 , ..., -75.40912 , -75.39725 ], ..., [-75.56506 , -75.55313 , ..., -75.32684 , -75.31494 ], [-75.5618 , -75.549866, ..., -75.32355 , -75.311646]]], dtype=float32)
array([[[0.968733, 0.968736, ..., 0.968798, 0.968802], [0.968721, 0.968725, ..., 0.968786, 0.96879 ], ..., [0.968434, 0.968437, ..., 0.968496, 0.968499], [0.968423, 0.968426, ..., 0.968485, 0.968488]]], dtype=float32)
array([[[0.968739, 0.968742, ..., 0.968804, 0.968808], [0.968727, 0.968731, ..., 0.968792, 0.968796], ..., [0.968428, 0.968431, ..., 0.96849 , 0.968494], [0.968417, 0.96842 , ..., 0.968479, 0.968482]]], dtype=float32)
array([[[0.968732, 0.968735, ..., 0.9688 , 0.968803], [0.96872 , 0.968723, ..., 0.968788, 0.968791], ..., [0.968432, 0.968435, ..., 0.968498, 0.968501], [0.968421, 0.968424, ..., 0.968486, 0.968489]]], dtype=float32)
array([[[0.968733, 0.968736, ..., 0.968798, 0.968802], [0.968721, 0.968725, ..., 0.968786, 0.96879 ], ..., [0.968434, 0.968437, ..., 0.968496, 0.968499], [0.968423, 0.968426, ..., 0.968485, 0.968488]]], dtype=float32)
array([[[0.968739, 0.968742, ..., 0.968804, 0.968808], [0.968727, 0.968731, ..., 0.968792, 0.968796], ..., [0.968428, 0.968431, ..., 0.96849 , 0.968494], [0.968417, 0.96842 , ..., 0.968479, 0.968482]]], dtype=float32)
array([[[0.968732, 0.968735, ..., 0.9688 , 0.968803], [0.96872 , 0.968723, ..., 0.968788, 0.968791], ..., [0.968432, 0.968435, ..., 0.968498, 0.968501], [0.968421, 0.968424, ..., 0.968486, 0.968489]]], dtype=float32)
array([[[0.968733, 0.968736, ..., 0.968798, 0.968802], [0.968721, 0.968725, ..., 0.968786, 0.96879 ], ..., [0.968434, 0.968437, ..., 0.968496, 0.968499], [0.968423, 0.968426, ..., 0.968485, 0.968488]]], dtype=float32)
array([[[0.968739, 0.968742, ..., 0.968804, 0.968808], [0.968727, 0.968731, ..., 0.968792, 0.968796], ..., [0.968428, 0.968431, ..., 0.96849 , 0.968494], [0.968417, 0.96842 , ..., 0.968479, 0.968482]]], dtype=float32)
array([[[0.968732, 0.968735, ..., 0.9688 , 0.968803], [0.96872 , 0.968723, ..., 0.968788, 0.968791], ..., [0.968432, 0.968435, ..., 0.968498, 0.968501], [0.968421, 0.968424, ..., 0.968486, 0.968489]]], dtype=float32)
array([[[0.00011, 0.00011, ..., 0.00011, 0.00011], [0.00011, 0.00011, ..., 0.00011, 0.00011], ..., [0.00011, 0.00011, ..., 0.00011, 0.00011], [0.00011, 0.00011, ..., 0.00011, 0.00011]]], dtype=float32)
array([[[9.578487e-05, 9.578017e-05, ..., 9.569041e-05, 9.568565e-05], [9.580208e-05, 9.579737e-05, ..., 9.570760e-05, 9.570284e-05], ..., [9.623109e-05, 9.622637e-05, ..., 9.613655e-05, 9.613181e-05], [9.624821e-05, 9.624350e-05, ..., 9.615369e-05, 9.614891e-05]]], dtype=float32)
array([[[-0.263978, -0.263987, ..., -0.265525, -0.266634], [-0.26384 , -0.263954, ..., -0.266591, -0.265448], ..., [-0.264203, -0.264212, ..., -0.266843, -0.267117], [-0.264326, -0.264074, ..., -0.266809, -0.266872]]], dtype=float32)
array([[[0.964529, 0.964526, ..., 0.964104, 0.963798], [0.964566, 0.964535, ..., 0.96381 , 0.964125], ..., [0.964467, 0.964465, ..., 0.96374 , 0.963664], [0.964433, 0.964502, ..., 0.963749, 0.963732]]], dtype=float32)
array([[[1., 1., ..., 1., 1.], [1., 1., ..., 1., 1.], ..., [1., 1., ..., 1., 1.], [1., 1., ..., 1., 1.]]], dtype=float32)
array([[[41.05154 , 41.049103, ..., 40.999893, 40.99742 ], [41.0605 , 41.058056, ..., 41.008846, 41.00637 ], ..., [41.29339 , 41.290936, ..., 41.241512, 41.239025], [41.302345, 41.299892, ..., 41.250458, 41.247982]]], dtype=float32)
array([[[-75.65729 , -75.64542 , ..., -75.40808 , -75.39624 ], [-75.65405 , -75.64218 , ..., -75.404816, -75.392944], ..., [-75.5694 , -75.557465, ..., -75.319244, -75.30734 ], [-75.5661 , -75.5542 , ..., -75.31595 , -75.30405 ]]], dtype=float32)
array([[[-0.263921, -0.262725, ..., -0.266629, -0.26779 ], [-0.263835, -0.263949, ..., -0.265549, -0.266711], ..., [-0.264251, -0.26426 , ..., -0.267995, -0.268057], [-0.264165, -0.264174, ..., -0.266867, -0.268023]]], dtype=float32)
array([[[0.964544, 0.964871, ..., 0.963799, 0.963477], [0.964568, 0.964537, ..., 0.964097, 0.963777], ..., [0.964454, 0.964451, ..., 0.96342 , 0.963403], [0.964478, 0.964475, ..., 0.963733, 0.963412]]], dtype=float32)
array([[[-0.262841, -0.263795, ..., -0.266694, -0.266757], [-0.263909, -0.262713, ..., -0.265455, -0.26667 ], ..., [-0.265229, -0.265396, ..., -0.266879, -0.266836], [-0.264257, -0.265414, ..., -0.266898, -0.266802]]], dtype=float32)
array([[[0.964839, 0.964579, ..., 0.963781, 0.963764], [0.964548, 0.964874, ..., 0.964123, 0.963788], ..., [0.964185, 0.96414 , ..., 0.96373 , 0.963742], [0.964452, 0.964134, ..., 0.963725, 0.963751]]], dtype=float32)
array([[[[0. , ..., 0.001688], ..., [0.011814, ..., 0. ]], ..., [[0. , ..., 0. ], ..., [0. , ..., 0. ]]]], dtype=float32)
array([[[11., 14., ..., 11., 11.], [11., 11., ..., 11., 11.], ..., [11., 11., ..., 11., 11.], [11., 11., ..., 11., 11.]]], dtype=float32)
array([[[569.91296, 583.4651 , ..., 368.02408, 341.3742 ], [578.97784, 591.30945, ..., 410.59042, 356.63464], ..., [512.07434, 527.1422 , ..., 561.0746 , 577.46545], [520.2049 , 534.9481 , ..., 559.92615, 574.8651 ]]], dtype=float32)
array([[[282.65735, 282.65628, ..., 282.65247, 282.65268], [282.65186, 282.6508 , ..., 282.64685, 282.64703], ..., [282.5133 , 282.51205, ..., 282.5015 , 282.50113], [282.5077 , 282.50644, ..., 282.4955 , 282.4951 ]]], dtype=float32)
array([[[[0., ..., 0.], ..., [0., ..., 0.]], ..., [[0., ..., 0.], ..., [0., ..., 0.]]]], dtype=float32)
array([[[4., 4., ..., 4., 4.], [4., 4., ..., 4., 4.], ..., [4., 4., ..., 3., 3.], [4., 4., ..., 3., 3.]]], dtype=float32)
array([[[[0., ..., 0.], ..., [0., ..., 0.]], ..., [[0., ..., 0.], ..., [0., ..., 0.]]]], dtype=float32)
array([[[4., 4., ..., 6., 6.], [4., 4., ..., 3., 6.], ..., [6., 4., ..., 3., 3.], [6., 4., ..., 3., 3.]]], dtype=float32)
array([[[[0.476892, ..., 0.423363], ..., [0.35952 , ..., 0.364814]], ..., [[0.457654, ..., 0.44575 ], ..., [0.369337, ..., 0.35 ]]]], dtype=float32)
array([[[[0.787984, ..., 0.615228], ..., [0.446443, ..., 0.5 ]], ..., [[0.696187, ..., 0.660903], ..., [0.455875, ..., 0.5 ]]]], dtype=float32)
p = ds.HGT_M.plot()
p.axes.set_aspect('equal')
%%bash
cd ~/wrf-hydro-training/lesson-wps
cp ~/wrf-hydro-training/wrf_hydro_model_tools/parameters/create_wrfinput/*.R .
Rscript create_wrfinput.R --geogrid="geo_em.d01.nc"
[1] "ncks -O -4 -v XLAT_M,XLONG_M,HGT_M,SOILTEMP,LU_INDEX,MAPFAC_MX,MAPFAC_MY,GREENFRAC,LAI12M,SOILCTOP geo_em.d01.nc wrfinput_d01.nc" [1] "ncrename -O -v HGT_M,HGT wrfinput_d01.nc wrfinput_d01.nc" [1] "ncrename -O -v XLAT_M,XLAT wrfinput_d01.nc wrfinput_d01.nc" [1] "ncrename -O -v XLONG_M,XLONG wrfinput_d01.nc wrfinput_d01.nc" [1] "ncrename -O -v LU_INDEX,IVGTYP wrfinput_d01.nc wrfinput_d01.nc" [1] "ncks -O -x -v SOILTEMP,GREENFRAC,LAI12M,SOILCTOP wrfinput_d01.nc wrfinput_d01.nc"
View the wrfinput_d01.nc file
%%bash
cd ~/wrf-hydro-training/lesson-wps
ncdump -h wrfinput_d01.nc
netcdf wrfinput_d01 { dimensions: Time = UNLIMITED ; // (1 currently) south_north = 28 ; west_east = 22 ; soil_layers_stag = 4 ; variables: float CANWAT(Time, south_north, west_east) ; CANWAT:units = "kg/m^2" ; CANWAT:_FillValue = -1.e+36f ; float DZS(Time, soil_layers_stag) ; DZS:units = "m" ; DZS:_FillValue = -1.e+36f ; float HGT(Time, south_north, west_east) ; HGT:FieldType = 104 ; HGT:MemoryOrder = "XY " ; HGT:units = "meters MSL" ; HGT:description = "Topography height" ; HGT:stagger = "M" ; HGT:sr_x = 1 ; HGT:sr_y = 1 ; int ISLTYP(Time, south_north, west_east) ; ISLTYP:_FillValue = -9999 ; float IVGTYP(Time, south_north, west_east) ; IVGTYP:FieldType = 104 ; IVGTYP:MemoryOrder = "XY " ; IVGTYP:units = "category" ; IVGTYP:description = "Dominant category" ; IVGTYP:stagger = "M" ; IVGTYP:sr_x = 1 ; IVGTYP:sr_y = 1 ; float LAI(Time, south_north, west_east) ; LAI:units = "m^2/m^2" ; LAI:_FillValue = -1.e+36f ; float MAPFAC_MX(Time, south_north, west_east) ; MAPFAC_MX:FieldType = 104 ; MAPFAC_MX:MemoryOrder = "XY " ; MAPFAC_MX:units = "none" ; MAPFAC_MX:description = "Mapfactor (x-dir) on mass grid" ; MAPFAC_MX:stagger = "M" ; MAPFAC_MX:sr_x = 1 ; MAPFAC_MX:sr_y = 1 ; float MAPFAC_MY(Time, south_north, west_east) ; MAPFAC_MY:FieldType = 104 ; MAPFAC_MY:MemoryOrder = "XY " ; MAPFAC_MY:units = "none" ; MAPFAC_MY:description = "Mapfactor (y-dir) on mass grid" ; MAPFAC_MY:stagger = "M" ; MAPFAC_MY:sr_x = 1 ; MAPFAC_MY:sr_y = 1 ; float SEAICE(Time, south_north, west_east) ; SEAICE:_FillValue = -1.e+36f ; float SHDMAX(Time, south_north, west_east) ; SHDMAX:units = "%" ; SHDMAX:_FillValue = -1.e+36f ; float SHDMIN(Time, south_north, west_east) ; SHDMIN:units = "%" ; SHDMIN:_FillValue = -1.e+36f ; float SMOIS(Time, soil_layers_stag, south_north, west_east) ; SMOIS:units = "m^3/m^3" ; SMOIS:_FillValue = -1.e+36f ; float SNOW(Time, south_north, west_east) ; SNOW:units = "kg/m^2" ; SNOW:_FillValue = -1.e+36f ; float TMN(Time, south_north, west_east) ; TMN:units = "K" ; TMN:_FillValue = -1.e+36f ; float TSK(Time, south_north, west_east) ; TSK:units = "K" ; TSK:_FillValue = -1.e+36f ; float TSLB(Time, soil_layers_stag, south_north, west_east) ; TSLB:units = "K" ; TSLB:_FillValue = -1.e+36f ; int XLAND(Time, south_north, west_east) ; XLAND:_FillValue = -9999 ; float XLAT(Time, south_north, west_east) ; XLAT:FieldType = 104 ; XLAT:MemoryOrder = "XY " ; XLAT:units = "degrees latitude" ; XLAT:description = "Latitude on mass grid" ; XLAT:stagger = "M" ; XLAT:sr_x = 1 ; XLAT:sr_y = 1 ; float XLONG(Time, south_north, west_east) ; XLONG:FieldType = 104 ; XLONG:MemoryOrder = "XY " ; XLONG:units = "degrees longitude" ; XLONG:description = "Longitude on mass grid" ; XLONG:stagger = "M" ; XLONG:sr_x = 1 ; XLONG:sr_y = 1 ; float ZS(Time, soil_layers_stag) ; ZS:units = "m" ; ZS:_FillValue = -1.e+36f ; // global attributes: :TITLE = "OUTPUT FROM GEOGRID V4.2" ; :SIMULATION_START_DATE = "0000-00-00_00:00:00" ; :WEST-EAST_GRID_DIMENSION = 23 ; :SOUTH-NORTH_GRID_DIMENSION = 29 ; :BOTTOM-TOP_GRID_DIMENSION = 0 ; :WEST-EAST_PATCH_START_UNSTAG = 1 ; :WEST-EAST_PATCH_END_UNSTAG = 22 ; :WEST-EAST_PATCH_START_STAG = 1 ; :WEST-EAST_PATCH_END_STAG = 23 ; :SOUTH-NORTH_PATCH_START_UNSTAG = 1 ; :SOUTH-NORTH_PATCH_END_UNSTAG = 28 ; :SOUTH-NORTH_PATCH_START_STAG = 1 ; :SOUTH-NORTH_PATCH_END_STAG = 29 ; :GRIDTYPE = "C" ; :DX = 1000.f ; :DY = 1000.f ; :DYN_OPT = 2 ; :CEN_LAT = 41.1499f ; :CEN_LON = -75.48096f ; :TRUELAT1 = 30.f ; :TRUELAT2 = 60.f ; :MOAD_CEN_LAT = 41.1499f ; :STAND_LON = -97.f ; :POLE_LAT = 90.f ; :POLE_LON = 0.f ; :corner_lats = 41.0548f, 41.29664f, 41.24474f, 41.00313f, 41.05603f, 41.29786f, 41.24351f, 41.0019f, 41.05032f, 41.30112f, 41.24922f, 40.99865f, 41.05154f, 41.30235f, 41.24798f, 40.99742f ; :corner_lons = -75.64975f, -75.5618f, -75.31165f, -75.40051f, -75.6557f, -75.56775f, -75.30569f, -75.39459f, -75.65137f, -75.56015f, -75.31f, -75.40216f, -75.65729f, -75.5661f, -75.30405f, -75.39624f ; :MAP_PROJ = 1 ; :MMINLU = "USGS" ; :NUM_LAND_CAT = 24 ; :ISWATER = 16 ; :ISLAKE = -1 ; :ISICE = 24 ; :ISURBAN = 1 ; :ISOILWATER = 14 ; :grid_id = 1 ; :parent_id = 1 ; :i_parent_start = 1 ; :j_parent_start = 1 ; :i_parent_end = 23 ; :j_parent_end = 29 ; :parent_grid_ratio = 1 ; :sr_x = 1 ; :sr_y = 1 ; :FLAG_MF_XY = 1 ; :FLAG_LAI12M = 1 ; :NCO = "netCDF Operators version 4.9.5 (Homepage = http://nco.sf.net, Code = http://github.com/nco/nco)" ; :history = "Wed Oct 6 17:24:43 2021: ncks -O -x -v SOILTEMP,GREENFRAC,LAI12M,SOILCTOP wrfinput_d01.nc wrfinput_d01.nc\nWed Oct 6 17:24:43 2021: ncrename -O -v LU_INDEX,IVGTYP wrfinput_d01.nc wrfinput_d01.nc\nWed Oct 6 17:24:42 2021: ncrename -O -v XLONG_M,XLONG wrfinput_d01.nc wrfinput_d01.nc\nWed Oct 6 17:24:42 2021: ncrename -O -v XLAT_M,XLAT wrfinput_d01.nc wrfinput_d01.nc\nWed Oct 6 17:24:42 2021: ncrename -O -v HGT_M,HGT wrfinput_d01.nc wrfinput_d01.nc\nWed Oct 6 17:24:42 2021: ncks -O -4 -v XLAT_M,XLONG_M,HGT_M,SOILTEMP,LU_INDEX,MAPFAC_MX,MAPFAC_MY,GREENFRAC,LAI12M,SOILCTOP geo_em.d01.nc wrfinput_d01.nc" ; }
ds = xr.open_dataset('~/wrf-hydro-training/lesson-wps/wrfinput_d01.nc')
ds
<xarray.Dataset> Dimensions: (Time: 1, soil_layers_stag: 4, south_north: 28, west_east: 22) Dimensions without coordinates: Time, soil_layers_stag, south_north, west_east Data variables: CANWAT (Time, south_north, west_east) float32 0.0 0.0 0.0 ... 0.0 0.0 DZS (Time, soil_layers_stag) float32 0.1 0.3 0.6 1.0 HGT (Time, south_north, west_east) float32 569.91296 ... 574.8651 ISLTYP (Time, south_north, west_east) float64 4.0 4.0 4.0 ... 3.0 3.0 IVGTYP (Time, south_north, west_east) float32 11.0 14.0 ... 11.0 11.0 LAI (Time, south_north, west_east) float32 5.3809342 ... 5.3048587 MAPFAC_MX (Time, south_north, west_east) float32 0.96873313 ... 0.96848786 MAPFAC_MY (Time, south_north, west_east) float32 0.96873313 ... 0.96848786 SEAICE (Time, south_north, west_east) float32 0.0 0.0 0.0 ... 0.0 0.0 SHDMAX (Time, south_north, west_east) float32 90.841705 ... 90.031006 SHDMIN (Time, south_north, west_east) float32 45.76544 47.8144 ... 35.0 SMOIS (Time, soil_layers_stag, south_north, west_east) float32 0.2 .... SNOW (Time, south_north, west_east) float32 0.0 0.0 0.0 ... 0.0 0.0 TMN (Time, south_north, west_east) float32 278.9529 ... 278.75845 TSK (Time, south_north, west_east) float32 290.0 290.0 ... 290.0 TSLB (Time, soil_layers_stag, south_north, west_east) float32 285.0... XLAND (Time, south_north, west_east) float64 1.0 1.0 1.0 ... 1.0 1.0 XLAT (Time, south_north, west_east) float32 41.0548 ... 41.244736 XLONG (Time, south_north, west_east) float32 -75.64975 ... -75.311646 ZS (Time, soil_layers_stag) float32 0.05 0.25 0.7 1.5 Attributes: TITLE: OUTPUT FROM GEOGRID V4.2 SIMULATION_START_DATE: 0000-00-00_00:00:00 WEST-EAST_GRID_DIMENSION: 23 SOUTH-NORTH_GRID_DIMENSION: 29 BOTTOM-TOP_GRID_DIMENSION: 0 WEST-EAST_PATCH_START_UNSTAG: 1 WEST-EAST_PATCH_END_UNSTAG: 22 WEST-EAST_PATCH_START_STAG: 1 WEST-EAST_PATCH_END_STAG: 23 SOUTH-NORTH_PATCH_START_UNSTAG: 1 SOUTH-NORTH_PATCH_END_UNSTAG: 28 SOUTH-NORTH_PATCH_START_STAG: 1 SOUTH-NORTH_PATCH_END_STAG: 29 GRIDTYPE: C DX: 1000.0 DY: 1000.0 DYN_OPT: 2 CEN_LAT: 41.149902 CEN_LON: -75.48096 TRUELAT1: 30.0 TRUELAT2: 60.0 MOAD_CEN_LAT: 41.149902 STAND_LON: -97.0 POLE_LAT: 90.0 POLE_LON: 0.0 corner_lats: [41.0548 41.29664 41.244736 41.003128... corner_lons: [-75.64975 -75.5618 -75.311646 -75.40... MAP_PROJ: 1 MMINLU: USGS NUM_LAND_CAT: 24 ISWATER: 16 ISLAKE: -1 ISICE: 24 ISURBAN: 1 ISOILWATER: 14 grid_id: 1 parent_id: 1 i_parent_start: 1 j_parent_start: 1 i_parent_end: 23 j_parent_end: 29 parent_grid_ratio: 1 sr_x: 1 sr_y: 1 FLAG_MF_XY: 1 FLAG_LAI12M: 1 NCO: netCDF Operators version 4.9.5 (Homepage... history: Wed Oct 6 17:24:43 2021: ncks -O -x -v ...
array([[[0., 0., ..., 0., 0.], [0., 0., ..., 0., 0.], ..., [0., 0., ..., 0., 0.], [0., 0., ..., 0., 0.]]], dtype=float32)
array([[0.1, 0.3, 0.6, 1. ]], dtype=float32)
array([[[569.91296, 583.4651 , ..., 368.02408, 341.3742 ], [578.97784, 591.30945, ..., 410.59042, 356.63464], ..., [512.07434, 527.1422 , ..., 561.0746 , 577.46545], [520.2049 , 534.9481 , ..., 559.92615, 574.8651 ]]], dtype=float32)
array([[[4., 4., ..., 4., 4.], [4., 4., ..., 4., 4.], ..., [4., 4., ..., 3., 3.], [4., 4., ..., 3., 3.]]])
array([[[11., 14., ..., 11., 11.], [11., 11., ..., 11., 11.], ..., [11., 11., ..., 11., 11.], [11., 11., ..., 11., 11.]]], dtype=float32)
array([[[5.380934, 5.19938 , ..., 5.187696, 5.501086], [5.381517, 5.411871, ..., 5.250041, 5.248753], ..., [5.342553, 5.203114, ..., 5.279592, 5.460351], [4.398367, 5.098849, ..., 5.238607, 5.304859]]], dtype=float32)
array([[[0.968733, 0.968736, ..., 0.968798, 0.968802], [0.968721, 0.968725, ..., 0.968786, 0.96879 ], ..., [0.968434, 0.968437, ..., 0.968496, 0.968499], [0.968423, 0.968426, ..., 0.968485, 0.968488]]], dtype=float32)
array([[[0.968733, 0.968736, ..., 0.968798, 0.968802], [0.968721, 0.968725, ..., 0.968786, 0.96879 ], ..., [0.968434, 0.968437, ..., 0.968496, 0.968499], [0.968423, 0.968426, ..., 0.968485, 0.968488]]], dtype=float32)
array([[[0., 0., ..., 0., 0.], [0., 0., ..., 0., 0.], ..., [0., 0., ..., 0., 0.], [0., 0., ..., 0., 0.]]], dtype=float32)
array([[[90.841705, 90.75746 , ..., 89.843155, 90.842834], [90.73008 , 90.86328 , ..., 90.39497 , 90.202545], ..., [90.627106, 90.00976 , ..., 90.516594, 90.80176 ], [88.366356, 89.79935 , ..., 89.825195, 90.031006]]], dtype=float32)
array([[[45.76544 , 47.8144 , ..., 45.02385 , 42.336334], [43.317963, 42.279053, ..., 43.36473 , 40.389828], ..., [44.87596 , 43.84149 , ..., 35.85842 , 34.778137], [33.9299 , 41.963688, ..., 36.492176, 35. ]]], dtype=float32)
array([[[[0.2 , ..., 0.2 ], ..., [0.2 , ..., 0.2 ]], ..., [[0.27, ..., 0.27], ..., [0.27, ..., 0.27]]]], dtype=float32)
array([[[0., 0., ..., 0., 0.], [0., 0., ..., 0., 0.], ..., [0., 0., ..., 0., 0.], [0., 0., ..., 0., 0.]]], dtype=float32)
array([[[278.9529 , 278.86377, ..., 280.2603 , 280.43375], [278.8885 , 278.80728, ..., 279.97803, 280.32892], ..., [279.1848 , 279.08563, ..., 278.85452, 278.7476 ], [279.12637, 279.02927, ..., 278.856 , 278.75845]]], dtype=float32)
array([[[290., 290., ..., 290., 290.], [290., 290., ..., 290., 290.], ..., [290., 290., ..., 290., 290.], [290., 290., ..., 290., 290.]]], dtype=float32)
array([[[[285., ..., 285.], ..., [285., ..., 285.]], ..., [[277., ..., 277.], ..., [277., ..., 277.]]]], dtype=float32)
array([[[1., 1., ..., 1., 1.], [1., 1., ..., 1., 1.], ..., [1., 1., ..., 1., 1.], [1., 1., ..., 1., 1.]]])
array([[[41.0548 , 41.052353, ..., 41.005608, 41.003128], [41.06376 , 41.06131 , ..., 41.014553, 41.012077], ..., [41.287685, 41.285217, ..., 41.238277, 41.235798], [41.29664 , 41.294178, ..., 41.247234, 41.244736]]], dtype=float32)
array([[[-75.64975 , -75.63788 , ..., -75.412384, -75.40051 ], [-75.646484, -75.63461 , ..., -75.40912 , -75.39725 ], ..., [-75.56506 , -75.55313 , ..., -75.32684 , -75.31494 ], [-75.5618 , -75.549866, ..., -75.32355 , -75.311646]]], dtype=float32)
array([[0.05, 0.25, 0.7 , 1.5 ]], dtype=float32)
p = ds.SMOIS.sel(soil_layers_stag=0).plot()
p.axes.set_aspect('equal')
%%bash
cd ~/wrf-hydro-training/lesson-wps
cp ~/wrf-hydro-training/wrf_hydro_model_tools/parameters/create_soilproperties/*.R .
cp ~/wrf-hydro-training/wrf_hydro_nwm_public/trunk/NDHMS/Land_models/NoahMP/run/*TBL .
cp ~/wrf-hydro-training/wrf_hydro_nwm_public/trunk/NDHMS/template/HYDRO/*TBL .
Rscript create_soilproperties.R
[1] "ncks -O -4 -v HGT_M geo_em.d01.nc soil_properties.nc" [1] "ncks -O -x -v HGT_M soil_properties.nc soil_properties.nc" [1] "ncks -O -4 -v HGT_M geo_em.d01.nc hydro2dtbl.nc" [1] "ncks -O -x -v HGT_M hydro2dtbl.nc hydro2dtbl.nc" [1] "Processing bexp" [1] "Updating soil parameters: bexp BB" [1] "Processing cwpvt" [1] "Updating MP parameters: cwpvt CWPVT" [1] "Processing dksat" [1] "Updating soil parameters: dksat SATDK" [1] "Processing dwsat" [1] "Updating soil parameters: dwsat SATDW" [1] "Processing hvt" [1] "Updating MP parameters: hvt HVT" [1] "Processing mfsno" [1] "Updating MP parameters: mfsno MFSNO" [1] "Processing mp" [1] "Updating MP parameters: mp MP" [1] "Processing psisat" [1] "Updating soil parameters: psisat SATPSI" [1] "Processing quartz" [1] "Updating soil parameters: quartz QTZ" [1] "Processing refdk" [1] "Updating GEN parameters: refdk REFDK" [1] "Processing refkdt" [1] "Updating GEN parameters: refkdt REFKDT" [1] "Processing rsurfexp" [1] "Updating global MP parameters: rsurfexp RSURF_EXP" [1] "Processing slope" [1] "Updating GEN parameters: slope SLOPE" [1] "Processing smcdry" [1] "Updating soil parameters: smcdry DRYSMC" [1] "Processing smcmax" [1] "Updating soil parameters: smcmax MAXSMC" [1] "Processing smcref" [1] "Updating soil parameters: smcref REFSMC" [1] "Processing smcwlt" [1] "Updating soil parameters: smcwlt WLTSMC" [1] "Processing vcmx25" [1] "Updating MP parameters: vcmx25 VCMX25" [1] "Processing LKSAT" [1] "Updating HYDRO soil parameters: LKSAT dksat SATDK" [1] "Processing OV_ROUGH2D" [1] "Updating HYDRO veg parameters: OV_ROUGH2D OV_ROUGH2D" [1] "Processing SMCMAX1" [1] "Updating HYDRO soil parameters: SMCMAX1 smcmax MAXSMC" [1] "Processing SMCREF1" [1] "Updating HYDRO soil parameters: SMCREF1 smcref REFSMC" [1] "Processing SMCWLT1" [1] "Updating HYDRO soil parameters: SMCWLT1 smcwlt WLTSMC"
smcref dwsat smcdry smcwlt bexp dksat psisat quartz refdk refkdt slope smcmax cwpvt vcmx25 mp hvt mfsno rsurfexp SMCMAX1 SMCREF1 SMCWLT1 OV_ROUGH2D LKSAT Geogrid attributes: vegWater=16 vegLake=-1 soilWater=14 maxSoilClass=16 Updating: soil_properties.nc The following `from` values were not present in `x`: 1, 2, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19 The following `from` values were not present in `x`: 2, 3, 4, 6, 8, 9, 10, 12, 13, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27 The following `from` values were not present in `x`: 1, 2, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19 The following `from` values were not present in `x`: 1, 2, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19 The following `from` values were not present in `x`: 2, 3, 4, 6, 8, 9, 10, 12, 13, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27 The following `from` values were not present in `x`: 2, 3, 4, 6, 8, 9, 10, 12, 13, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27 The following `from` values were not present in `x`: 2, 3, 4, 6, 8, 9, 10, 12, 13, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27 The following `from` values were not present in `x`: 1, 2, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19 The following `from` values were not present in `x`: 1, 2, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19 The following `from` values were not present in `x`: 1, 2, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19 The following `from` values were not present in `x`: 1, 2, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19 The following `from` values were not present in `x`: 1, 2, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19 The following `from` values were not present in `x`: 1, 2, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19 The following `from` values were not present in `x`: 2, 3, 4, 6, 8, 9, 10, 12, 13, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27 Updating: hydro2dtbl.nc The following `from` values were not present in `x`: 1, 2, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19 The following `from` values were not present in `x`: 2, 3, 4, 6, 8, 9, 10, 12, 13, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28 The following `from` values were not present in `x`: 1, 2, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19 The following `from` values were not present in `x`: 1, 2, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19 The following `from` values were not present in `x`: 1, 2, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19
ds = xr.open_dataset('~/wrf-hydro-training/lesson-wps/soil_properties.nc')
ds
<xarray.Dataset> Dimensions: (Time: 1, soil_layers_stag: 4, south_north: 28, west_east: 22) Dimensions without coordinates: Time, soil_layers_stag, south_north, west_east Data variables: bexp (Time, soil_layers_stag, south_north, west_east) float32 5.33 .... cwpvt (Time, south_north, west_east) float32 0.18 0.18 ... 0.18 0.18 dksat (Time, soil_layers_stag, south_north, west_east) float32 2.81e-... dwsat (Time, soil_layers_stag, south_north, west_east) float32 2.39e-... hvt (Time, south_north, west_east) float32 16.0 20.0 ... 16.0 16.0 mfsno (Time, south_north, west_east) float32 2.5 2.5 2.5 ... 2.5 2.5 2.5 mp (Time, south_north, west_east) float32 9.0 6.0 6.0 ... 9.0 9.0 9.0 psisat (Time, soil_layers_stag, south_north, west_east) float32 0.759 ... quartz (Time, soil_layers_stag, south_north, west_east) float32 0.25 .... refdk (Time, south_north, west_east) float32 2e-06 2e-06 ... 2e-06 2e-06 refkdt (Time, south_north, west_east) float32 3.0 3.0 3.0 ... 3.0 3.0 3.0 rsurfexp (Time, south_north, west_east) float32 5.0 5.0 5.0 ... 5.0 5.0 5.0 slope (Time, south_north, west_east) float32 0.1 0.1 0.1 ... 0.1 0.1 0.1 smcdry (Time, soil_layers_stag, south_north, west_east) float32 0.084 ... smcmax (Time, soil_layers_stag, south_north, west_east) float32 0.476 ... smcref (Time, soil_layers_stag, south_north, west_east) float32 0.36 .... smcwlt (Time, soil_layers_stag, south_north, west_east) float32 0.084 ... vcmx25 (Time, south_north, west_east) float32 60.0 50.0 ... 60.0 60.0 Attributes: TITLE: OUTPUT FROM GEOGRID V4.2 SIMULATION_START_DATE: 0000-00-00_00:00:00 WEST-EAST_GRID_DIMENSION: 23 SOUTH-NORTH_GRID_DIMENSION: 29 BOTTOM-TOP_GRID_DIMENSION: 0 WEST-EAST_PATCH_START_UNSTAG: 1 WEST-EAST_PATCH_END_UNSTAG: 22 WEST-EAST_PATCH_START_STAG: 1 WEST-EAST_PATCH_END_STAG: 23 SOUTH-NORTH_PATCH_START_UNSTAG: 1 SOUTH-NORTH_PATCH_END_UNSTAG: 28 SOUTH-NORTH_PATCH_START_STAG: 1 SOUTH-NORTH_PATCH_END_STAG: 29 GRIDTYPE: C DX: 1000.0 DY: 1000.0 DYN_OPT: 2 CEN_LAT: 41.149902 CEN_LON: -75.48096 TRUELAT1: 30.0 TRUELAT2: 60.0 MOAD_CEN_LAT: 41.149902 STAND_LON: -97.0 POLE_LAT: 90.0 POLE_LON: 0.0 corner_lats: [41.0548 41.29664 41.244736 41.003128... corner_lons: [-75.64975 -75.5618 -75.311646 -75.40... MAP_PROJ: 1 MMINLU: USGS NUM_LAND_CAT: 24 ISWATER: 16 ISLAKE: -1 ISICE: 24 ISURBAN: 1 ISOILWATER: 14 grid_id: 1 parent_id: 1 i_parent_start: 1 j_parent_start: 1 i_parent_end: 23 j_parent_end: 29 parent_grid_ratio: 1 sr_x: 1 sr_y: 1 FLAG_MF_XY: 1 FLAG_LAI12M: 1 history: Wed Oct 6 17:24:44 2021: ncks -O -x -v ... NCO: netCDF Operators version 4.9.5 (Homepage...
array([[[[5.33, ..., 5.33], ..., [5.33, ..., 4.74]], ..., [[5.33, ..., 5.33], ..., [5.33, ..., 4.74]]]], dtype=float32)
array([[[0.18, 0.18, ..., 0.18, 0.18], [0.18, 0.18, ..., 0.18, 0.18], ..., [0.18, 0.18, ..., 0.18, 0.18], [0.18, 0.18, ..., 0.18, 0.18]]], dtype=float32)
array([[[[2.81e-06, ..., 2.81e-06], ..., [2.81e-06, ..., 5.23e-06]], ..., [[2.81e-06, ..., 2.81e-06], ..., [2.81e-06, ..., 5.23e-06]]]], dtype=float32)
array([[[[2.39e-05, ..., 2.39e-05], ..., [2.39e-05, ..., 8.05e-06]], ..., [[2.39e-05, ..., 2.39e-05], ..., [2.39e-05, ..., 8.05e-06]]]], dtype=float32)
array([[[16., 20., ..., 16., 16.], [16., 16., ..., 16., 16.], ..., [16., 16., ..., 16., 16.], [16., 16., ..., 16., 16.]]], dtype=float32)
array([[[2.5, 2.5, ..., 2.5, 2.5], [2.5, 2.5, ..., 2.5, 2.5], ..., [2.5, 2.5, ..., 2.5, 2.5], [2.5, 2.5, ..., 2.5, 2.5]]], dtype=float32)
array([[[9., 6., ..., 9., 9.], [9., 9., ..., 9., 9.], ..., [9., 9., ..., 9., 9.], [9., 9., ..., 9., 9.]]], dtype=float32)
array([[[[0.759, ..., 0.759], ..., [0.759, ..., 0.141]], ..., [[0.759, ..., 0.759], ..., [0.759, ..., 0.141]]]], dtype=float32)
array([[[[0.25, ..., 0.25], ..., [0.25, ..., 0.6 ]], ..., [[0.25, ..., 0.25], ..., [0.25, ..., 0.6 ]]]], dtype=float32)
array([[[2.e-06, 2.e-06, ..., 2.e-06, 2.e-06], [2.e-06, 2.e-06, ..., 2.e-06, 2.e-06], ..., [2.e-06, 2.e-06, ..., 2.e-06, 2.e-06], [2.e-06, 2.e-06, ..., 2.e-06, 2.e-06]]], dtype=float32)
array([[[3., 3., ..., 3., 3.], [3., 3., ..., 3., 3.], ..., [3., 3., ..., 3., 3.], [3., 3., ..., 3., 3.]]], dtype=float32)
array([[[5., 5., ..., 5., 5.], [5., 5., ..., 5., 5.], ..., [5., 5., ..., 5., 5.], [5., 5., ..., 5., 5.]]], dtype=float32)
array([[[0.1, 0.1, ..., 0.1, 0.1], [0.1, 0.1, ..., 0.1, 0.1], ..., [0.1, 0.1, ..., 0.1, 0.1], [0.1, 0.1, ..., 0.1, 0.1]]], dtype=float32)
array([[[[0.084, ..., 0.084], ..., [0.084, ..., 0.047]], ..., [[0.084, ..., 0.084], ..., [0.084, ..., 0.047]]]], dtype=float32)
array([[[[0.476, ..., 0.476], ..., [0.476, ..., 0.434]], ..., [[0.476, ..., 0.476], ..., [0.476, ..., 0.434]]]], dtype=float32)
array([[[[0.36 , ..., 0.36 ], ..., [0.36 , ..., 0.312]], ..., [[0.36 , ..., 0.36 ], ..., [0.36 , ..., 0.312]]]], dtype=float32)
array([[[[0.084, ..., 0.084], ..., [0.084, ..., 0.047]], ..., [[0.084, ..., 0.084], ..., [0.084, ..., 0.047]]]], dtype=float32)
array([[[60., 50., ..., 60., 60.], [60., 60., ..., 60., 60.], ..., [60., 60., ..., 60., 60.], [60., 60., ..., 60., 60.]]], dtype=float32)
p = ds.smcmax.sel(soil_layers_stag=0).plot()
p.axes.set_aspect('equal')
This concludes the lesson on domain definition and initial conditions for WRF-Hydro.
© UCAR 2020