How to ingest heat flux data
When dealing with real data, it is often necessary to reproject and interpolate raw data sources onto a WRF simulation grid. This is possible using WPS in a manner similar to the method used here. This page illustrates this procedure on MODIS heat flux data. The source data is converted and interpolated from its native geotiff format into a WRF compatible netCDF file where it can be merged into a wrfinput file or analyzed using standard netCDF tools.
Converting data to geotiff
The method outlined here requires data in a geotiff format; however, not all data comes in this form. Most GIS utilities provide converters to save data in geotiff format. One free and cross platform utility for accomplishing this is the gdal_translate command, which is part of the Geospatial Data Abstraction Library (GDAL) [1]. Often it is sufficient to run the following command to perform the conversion:
gdal_translate -of GTiff <source dataset> <destination dataset>
GDAL command line scripts are also capable of performing reprojection as well as simple processing of nearly any GIS file format.
Interpolating data onto a model grid using geogrid
Using the original namelist.wps used to create the domain. It is relatively simple to rerun geogrid with an additional dataset from your source data. In this example, we will use the namelist linked here and the geotiff data at File:O9820-B65-P1 fire mask.tif.
- Compile WPS as described here to enable geotiff support.
- Edit the geogrid table at geogrid/GEOGRID.TBL to contain the new variable. See the list of table parameters here. You can remove all of the variables present
with the exception of LANDUSEF to save on computation time. A minimal table is as follows:
===============================
name=LANDUSEF
priority=1
dest_type=categorical
z_dim_name=land_cat
landmask_water = modis_30s:17 # Calculate a landmask from this field
landmask_water = modis_lakes:17,21 # Calculate a landmask from this field
landmask_water = usgs_lakes:16,28 # Calculate a landmask from this field
landmask_water = default:16 # Calculate a landmask from this field
dominant=LU_INDEX
interp_option = modis_30s:nearest_neighbor
interp_option = 30s:nearest_neighbor
interp_option = usgs_lakes:nearest_neighbor
interp_option = modis_lakes:nearest_neighbor
interp_option = 2m:four_pt
interp_option = 5m:four_pt
interp_option = 10m:four_pt
interp_option = default:four_pt
rel_path= modis_30s:modis_landuse_20class_30s/
rel_path= 30s:landuse_30s/
rel_path= usgs_lakes:landuse_30s_with_lakes/
rel_path= modis_lakes:modis_landuse_21class_30s/
rel_path= 2m:landuse_2m/
rel_path= 5m:landuse_5m/
rel_path= 10m:landuse_10m/
rel_path= default:landuse_2m/
===============================
name=FIREMASK
priority=1
subgrid=yes
dominant_only=FIREMASK
dest_type=categorical
z_dim_name=firecat
fill_missing = 0.
interp_option=default:nearest_neighbor
abs_path=default:./firemask
===============================
- Create a new directory under WPS (here we use firemask) and copy the geotiff file into this directory.
- Create an index file in the directory you created. The format of the index file is described here and here. In this example, our index file will contain
the following
geotiff=O9820-B65-P1_fire_mask.tif type=categorical category_min=1 category_max=9 tile_bdr=3
- Run geogrid.exe
At this point, the newly interpolated data is in the file geo_em.d01.nc under the variable given in the table (here FIREMASK in File:FIREMASK Geo em.nc.gz). The data can be added to a wrfinput or wrfrst file using ncks [2] using the following command:
ncks -A -v FIREMASK geo_em.d01.nc wrfinput_d01