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

Writing Static Data to Geogrid

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.

thodgdon818

New member
I was a participant at the WRF Basic tutorial this past July and I am beginning my first foray into the world of WRF. One thing I have been running into issues with is writing new static data fields into the Geogrid binary format. I am following the documentation provided online which recommends using the write_geogrid.c file. However, since I am so new to using WRF (and C) I don’t have a great understanding of how to effectively use this program. The file I am trying to convert is a GeoTiff generated using ArcGIS. Any guidance you can provide with converting the Geotiff into the required Geogrid format would be extremely helpful.
 
If the dataset is in GeoTIFF format, a simpler option might be to use GDAL's gdal_translate tool (https://gdal.org/) to convert from GeoTIFF directly to the binary raster format used by the geogrid program. Assuming your GeoTIFF file is named "foo.tif", a command like the following should work after you've installed the GDAL tools:
Code:
gdal_translate -of foo.tif temporary.dat
The gdal_translate tool should print out two numbers that give the number of columns and the number of rows in the dataset; you can then use those two numbers to rename the "temporary.dat" file using the naming scheme expected by geogrid, e.g.,
Code:
mv temporary.dat 00001-NCOLS.00001-NROWS
where NCOLS and NROWS are the numbers provided by gdal translate, written as zero-padded five-digit integers.
 
Thanks for the reply. When I try and run that command I get and error that says "FAILURE: No target dataset specified". Is this due to the -of flag? If I remove it the .dat file is created, but is that the correct binary raster format?
 
Sorry about that -- I left of part of the gdal_translate command, which should read:
Code:
gdal_translate -of ENVI foo.tif temporary.dat
 
Top