High Resolution Terrain Height Data in WRF

This page is not very easy to read. It is a basic "how to" for someone who already has good computer skills and also knows their way around WRF. Partially, it is just a place to store the procedure so I can do it again for another location. I am willing to share this hard earned information with others, but am not inclined to give detailed tutoring when I have so much more I have to get done. Good luck. I hope it helps you.


WRF comes with sets of static terrain related data. One of those sets contains terrain height that is used to build the WRF nests. It comes in different horizontal resolutions:  10 arc minutes, 5 minutes, 2 minutes, and 30 arc seconds. The last ends up being approximately 1 km horizontally. Other terrain height data is available from USGS at 1/3 arc second resolution, which is about 10 meters horizontally, but it is not already prepared for WRF use. Below is a description of how to acquire and prepare that higher resolution data.


Restrictions and Decisions Concerning the Data

The terrain height data files, like the other terrain data fed into geogrid, contains index values within the name of the file. It has starting and ending north-south indexes and starting and ending east-west indexes in its name. The index values must be  5 digits, so no set of data can have more than 99999 values in either direction. That is not enough to cover the entire USA, so I have divided the 10 meter terrain height data set into multiple parts, one part for each state. Each degree of longitude or latitude is about 10800 values. Only a few degrees are needed, in each direction for each state or some similar area. Each state's files are in a different directory which allows them to have files with the same names, but the starting longitude/latitude for index 1 is different for each state's directory. So each directory has files of the same name. The offset is controlled by a file in each directory named "index" which also has other important information about how to interpret the data files. Index values start with one, not zero. Data files can not overlap each other. Files can be missing within a set but each one must be complete. The size of the files is specified in the "index" file. Since unix allows links, you may want to consider creating a directory with each data file having an understandable name, like its longitude and latitude. Then use links with the required naming in a separate directory to build a set for you area of interest. That way you can cross borders or have multiple areas without duplicating the large files.

A convenient size for this resolution is one arc degree in each direction. That size (232 MB) is almost the maximum size (250 MB) that is allowed to be downloaded in a contiguous file. I am using whole number degree values for the left and bottom of each file. It goes up to but does not include the next whole degree value. For Idaho I start with -118 as the longitude because someday I may want to create a detailed nest that goes farther west than the state border at -117. Data in each state's directory is independent of other directories, so directories can overlap.

Details about the file and the "index" file can be found in the WRF users guide, Spring 2009 edition. It was at about page 3-34 with a subtitle heading of "Writing Static Data to the Geogrid Binary Format".


Where to Find the Data and How to Get It

The USGS site from which to get the data is: http://seamless.usgs.gov/website/seamless/viewer.htm

On the left hand side, use the "Define Download Area by Coordinates" button, and on the resulting pop up page, use the "Switch to Decimal Degrees" option. Enter the coordinates you want to download. An example that worked for some Wyoming data is 41.00 to 41.99998 latitude and -107.00 to -106.0001 longitude. The amount less than the next whole degree seems to be different for longitude and latitude. I don't know why. It takes experimenting to get the exact 10800 values in both the rows and the columns. "Add the area" to get the next page: "Request Summary Page" which will default to the 1 arc second data. Choose "Modify Data Request" to get a page with very many data set options. About 90% down the list will be the 1 arc second option that will be checked. Also check the one below it, which is the 1/3 arc second. After the page updates, change the options for 1/3 arc second to BIL format, TGZ compression, and HTML. Then uncheck the 1 arc second option. After the page updates again, go to the bottom and "Save Changes and Return to Summary." That page will now show your chosen longitude latitude pairs. If you chose 1 X 1 degree block, expect 232 MB. Download it. Uncompress it. Check the file with .hdr extension; it can be read with gvim. Make sure it says 10800 X 10800 rows and columns. Then rename the file to fit with whatever was specified in the "index" file. Using topo_id starting at -118.00 and 42.00, the .bil file for -116.00 to -115.0001 and 42.00 to 42.99998 gets renamed to 21601-32400.00001-10800.

Below is a "index" file for the Idaho example. I name the directories for each state similar to the other data that comes with WRF. For example, Idaho is topo_id. Below the index file is a copy of the changes I made to the GEOGRID.TBL so that it uses the topo_wy for the finest detail rather than the default topo_30s. It also seemed appropriate to change the way it interpolates since the 10 meter data will be smaller than the WRF grid cells. I removed the smoothing option because I specifically want all the detail rather than have it smoothed away.


"index" File for 10 Meter Terrain Height Data.

type = continuous
signed = yes
projection = regular_ll
dx = 0.00009259259259259259259
dy = 0.00009259259259259259259
known_x = 1.0
known_y = 1.0
known_lat = 42.000
known_lon = -118.000
wordsize = 2
endian = little
tile_x = 10800
tile_y = 10800
row_order = top_bottom
tile_z = 1
units="meters MSL"
description="Topography height"

GEOGRID.TBL File for Using 10 Meter Terrain Height Data

This was done in version 3.0, so you may have to handmake these changes in the new 3.1 version which is a significantly different GEOGRID.TBL.
# See options.txt for a (somewhat up to date) list of the
# options that may be specified here.
===============================
name = HGT_M
        priority = 1
        dest_type = continuous
        df_dx=SLPX
        df_dy=SLPY
#        smooth_option = smth-desmth_special; smooth_passes=1
        fill_missing=0.
        interp_option =     wy:average_gcell(4.0)+four_pt+average_4pt
#        interp_option =     wy:nearest_neighbor
        interp_option =     30s:average_gcell(4.0)+four_pt+average_4pt
#        interp_option =     30s:nearest_neighbor
        interp_option =      2m:four_pt
        interp_option =      5m:four_pt
        interp_option =     10m:four_pt
        interp_option = default:four_pt
        rel_path=     wy:topo_wy/
        rel_path=     30s:topo_30s/
        rel_path=      2m:topo_2m/
        rel_path=      5m:topo_5m/
        rel_path=     10m:topo_10m/
        rel_path= default:topo_30s/
===============================
name = HGT_U
        output_stagger = U
        priority = 1
        dest_type = continuous
        interp_option =     wy:average_gcell(4.0)+four_pt+average_4pt
        interp_option =     30s:average_gcell(4.0)+four_pt+average_4pt
        interp_option =      2m:four_pt
        interp_option =      5m:four_pt
        interp_option =     10m:four_pt
        interp_option = default:four_pt
#        smooth_option = smth-desmth_special; smooth_passes=1
        fill_missing=0.
        rel_path=     wy:topo_wy/
        rel_path=     30s:topo_30s/
        rel_path=      2m:topo_2m/
        rel_path=      5m:topo_5m/
        rel_path=     10m:topo_10m/
        rel_path= default:topo_30s/
===============================
name = HGT_V
        output_stagger = V
        priority = 1
        dest_type = continuous
        interp_option =     wy:average_gcell(4.0)+four_pt+average_4pt
        interp_option =     30s:average_gcell(4.0)+four_pt+average_4pt
        interp_option =      2m:four_pt
        interp_option =      5m:four_pt
        interp_option =     10m:four_pt
        interp_option = default:four_pt
#        smooth_option = smth-desmth_special; smooth_passes=1
        fill_missing=0.
        rel_path=     wy:topo_wy/
        rel_path=     30s:topo_30s/
        rel_path=      2m:topo_2m/
        rel_path=      5m:topo_5m/
        rel_path=     10m:topo_10m/
        rel_path= default:topo_30s/
===============================
name=LANDUSEF
        priority=1
        dest_type=categorical
        z_dim_name=land_cat
        landmask_water=16               # Calculate a landmask from this field
        dominant=LU_INDEX
        interp_option =     30s:nearest_neighbor
        interp_option =      2m:four_pt
        interp_option =      5m:four_pt
        interp_option =     10m:four_pt
        interp_option = default:four_pt
        rel_path=     30s:landuse_30s/
        rel_path=      2m:landuse_2m/
        rel_path=      5m:landuse_5m/
        rel_path=     10m:landuse_10m/
        rel_path= default:landuse_30s/
===============================
name=SOILTEMP
        priority=1
        dest_type=continuous
        interp_option=default:sixteen_pt+four_pt+average_4pt+average_16pt+search
        masked=water
        fill_missing=0.
        rel_path=default:soiltemp_1deg/
===============================
name=SOILCTOP
        priority=1
        dest_type=categorical
        z_dim_name=soil_cat
        interp_option =     30s:nearest_neighbor
        interp_option =      2m:four_pt
        interp_option =      5m:four_pt
        interp_option =     10m:four_pt
        interp_option = default:four_pt
        rel_path=     30s:soiltype_top_30s/
        rel_path=      2m:soiltype_top_2m/
        rel_path=      5m:soiltype_top_5m/
        rel_path=     10m:soiltype_top_10m/
        rel_path= default:soiltype_top_30s/
===============================
name=SOILCBOT
        priority=1
        dest_type=categorical
        z_dim_name=soil_cat
        interp_option =     30s:nearest_neighbor
        interp_option =      2m:four_pt
        interp_option =      5m:four_pt
        interp_option =     10m:four_pt
        interp_option = default:four_pt
        rel_path=     30s:soiltype_bot_30s/
        rel_path=      2m:soiltype_bot_2m/
        rel_path=      5m:soiltype_bot_5m/
        rel_path=     10m:soiltype_bot_10m/
        rel_path= default:soiltype_bot_30s/
===============================
name=ALBEDO12M
        priority=1
        dest_type=continuous
        z_dim_name=month
        masked = water
        fill_missing = 8.
        interp_option=default:four_pt+average_4pt+average_16pt+search
        rel_path=default:albedo_ncep/
===============================
name=GREENFRAC
        priority=1
        dest_type=continuous
        interp_option=default:four_pt+average_4pt+average_16pt+search
        z_dim_name=month
        masked = water
        fill_missing = 0.
        rel_path=default:greenfrac/
===============================
name=SNOALB
        priority=1
        dest_type=continuous
        interp_option=default:four_pt+average_4pt+average_16pt+search
        masked = water
        fill_missing = 0.
        rel_path=default:maxsnowalb/
===============================
name=SLOPECAT
        priority=1
        dominant_only=SLOPECAT
        dest_type=categorical
        z_dim_name=slope_cat
        masked = water
        fill_missing = 0.
        interp_option=default:nearest_neighbor+average_16pt+search
        rel_path=default:islope/
===============================