Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

How to replace MODIS Land Use data in WPS

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

meteors

New member
Dear all wrf users,

I wan to use new MODIS land use data in WPS and replace it with WPS default land use data. Here is the the steps I have done:
1- MODIS HDF MCD12Q1 tile was converted to GeoTiff format using dal_translate
2- The coordinate system (sinusoidal) was changed to geographical lat-lon
3- The GeoTiff file was converted to a binary raster file (gdal_translate -of ENVI MODIS.tif bianaryRaster.bil) and the file name (bianaryRaster.bil) was changed into ‘00001-ncols.00001-nrows’ (ncols and nrows are the number of columns and rows in the data file), then the binary raster file was copied into a new directory (named test_modis in this example) under WPS_GEOG directory
4- New index file (meta data file) was generated in the test_modis directory as below:

type=categorical
category_min=1
category_max=17
projection=regular_ll
dx=0.007553286
dy=0.007549054
known_x=1.0
known_y=750.0
known_lat= 35.748
known_lon= -92.35172
wordsize=1
tile_x=735
tile_y=750
tile_z=1
units="category"
description="MODIS 17-category land use"
iswater=17
islake=17
isice=15
isurban=13

5- The GEOGRID.TBL file which is located under WPS/geogrid directory was modified as below:
under the name=LANDUSEF session, these three line added as same as the other lines:
landmask_water = mcd12q1:17 # Calculate a landmask from this field
interp_option = mcd12q1:nearest_neighbor
rel_path = mcd12q1:test_modis/

in the nameless.wps, under &geogrid session, the name of the new data was addressed.
geog_data_res = 'mcd12q1',

The problem is that after running the geogrid.exe, the geo_em.d01.nc file is generated, but the LU_INDEX (dominant land use) and LANDUSEF is empty!
Note: The MODIS raster file spatially covers the domain 01.
A sample of MODIS land use GeoTiff file is available in the below temporary link:
http://climatology.ml/down/MODIS.tif

Any suggestion or idea would be appreciated.

Thanks.
 
The process you've describe sounds correct.

What is the size in bytes of your 00001-00735.00001-00750 file? Since "wordsize=1" in your index file, we would expect the file to be exactly 551250 bytes.

Also, i you could attach your namelist.wps file, I could try producing a fake dataset with the same index file as your MODIS dataset and verify that I can correctly map the fake land cover to your WRF model domain.
 
Dear mgduda,

Thank you for your consideration;
All the data set (MODIS.tif, namelist.wps, GEOGRID.TBL, index, and binary raster (00001-03250-00001-03114) ) attached as a zip file.
Please let me know if you need any further information.
 

Attachments

  • sample_data.zip
    2.4 MB · Views: 187
There are several issues that I think may be preventing geogrid from properly using your data.

1) The filename should have a "." rather than a "-" to separate the x-coordinate range from the y-coordinate range: rather than a filename of "00001-03250-00001-03114", the filename would need to be "00001-03250.00001-03114" for geogrid to find the file.

2) It looks like the number of rows and the number of columns in the dataset may be reversed. Assuming 3250 columns (the ending x-coordinate) and 3114 rows (the ending y-coordinate), the dataset would be interpreted by geogrid as in the plot, below.

00001-03250.00001-03114.png

Instead, if we assume the dataset has 3114 columns and 3250 rows, geogrid would interpret the dataset as in the plot, below.

00001-03114.00001-03250.png

3) The geogrid program assumes by default that rows are ordered from south to north in datasets; however, adding the specification "row_order=top_bottom" to your index file should correct the reversed south-north direction in the plot, above.

4) In your index file, you have "known_x=1.0" and "known_y=3250.0", which tells the geogrid program that the (1,3250) pixel in your dataset corresponds to the location that you've specified by "known_lat" and "known_lon". The (1,1) pixel by convention is at the south-west corner of the dataset, so "known_y=3250.0" in combination with "known_lat=20.3446852" tells the geogrid program that the north-west pixel in your dataset is at 20.34 degrees north latitude, which I think places the dataset below the southern boundary of your WRF grid. Under the assumption that the "known_lat" and "known_lon" values in your index file refer to the south-west corner of your dataset, you'll probably need to set "known_y=1.0".

5) Lastly, there appears to be values of -1 (255) in your dataset, and the geogrid program will complain that these values are outside the specified range of categories defined in your index file. The simplest solution here might be to add the specification "missing_value=255" in your index file.
 
Although it's outside the scope of replacing land use data, I can also recommend carefully considering whether a 6-km model coarse domain that is only 43x33 grid cells is going to provide you with good simulation results. Although it depends on the source of model initial and boundary conditions, the length of the simulation, and other factors, typical WRF domains are at least 100x100 grid cells. Of course, it's entirely possible that 43x33 grid cells was chosen in your namelist.wps simply to test whether the MCD12Q1 data could be successfully used by geogrid.
 
Dear mgduda,

I appreciate for your time and your help. Now it is working. :)
Actually the problem was 1) a "." rather than "-" to separate x and y coordinates, and 5) missing data option (missing_value=255). I had tested all the rest options as you explained but because of these two issue geogrid.exe could not read the MODIS data correctly.

Thank you.
 
Top