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

Combine multiple geogrid binary files into one

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.

X_Huang

New member
Hi,

I would like to update the vegetation fractional data (greenfrac) in WPS using my own data. I have a .tif map for each month and I was able to convert each of these .tif files into the geogrid binary format using gdal_translate. However, the default greenfrac input contains 12 month in one file. Because I want to use the output from geogrid later for CMAQ model, I would like to have my data in the exact same structure as the default greenfrac input, i.e. to have all months in a single binary file. Does anyone know how can I do that?

I read the "writing static data to geogrid binary format" part in the user's guide and was aware of the read_geogrid.c and the write_geogrid.c. But I am new to WRF/WPS and I am not sure whether or how can I use these routines to read multiple binary files and write them into one.

One example of my binary files and the index file were attached.

Thanks a lot,
Xinyue
 

Attachments

  • index.txt
    269 bytes · Views: 84
  • 00001-07200.00001-03600.dat
    24.7 MB · Views: 59
Hi Xinyue,
I don't think it should be necessary to put them all in a single file. If you take a look at the directory "greenfrac_fpar_modis" they aren't all in a single file, so having them separate should be okay.
 
Hi Werner,
Thanks very much for the reply. But I'm still not sure about what to do. The original files under the "greenfrac_fpar_modis" directory cover different domains and they each contains 12 months, whereas my files all cover the same domain. If it is possible to feed all of them to geogrid through a single run, how should I name them, and should I change the namelist.wps and the GEOGRID.TBL accordingly?
Thanks!
 
The files under "greenfrac_fpar_modis" are each specific to a small area of a larger domain. They start at the bottom left corner of the full domain, and move to the right. There is a particular naming convention that is used for the files, based on their position on the full domain. Take a look at this section of the Users' Guide, that discusses how this is broken down.
 
According to the naming convention, all my files would have the same name since they cover the exact same domain. Therefore, I don't know how to read them together through one geogrid run.

Each of the binary files contains a 2d array for the average vegetation coverage of one month. I tried to combine the binary files together to get a new binary file containing a 3d array where the third dimension would be "month". I used the 'cat' command on Linux and got a combined binary file, but when I feed it to geogrid, I got the following error:

Processing domain 1 of 1
Processing XLAT and XLONG
ERROR: Error in ext_pkg_write_field

Do you have ideas on how to fix this? Thanks!
 
If you have twelve files (one for each month of the year) that are all on the same horizontal grid, you can use the 'cat' command to concatenate them all into a single file. For example, let's suppose that we have the files:
  • 00001-07200.00001.03600.January
  • 00001-07200.00001.03600.February
  • 00001-07200.00001.03600.March
  • 00001-07200.00001.03600.April
  • etc.
Then we could use
Code:
cat 00001-07200.00001.03600.January >> 00001-07200.00001.03600
cat 00001-07200.00001.03600.February >> 00001-07200.00001.03600
cat 00001-07200.00001.03600.March >> 00001-07200.00001.03600
cat 00001-07200.00001.03600.April >> 00001-07200.00001.03600
etc.
to create a file that would be usable by the geogrid program.

In the 'index' file for the dataset, we would just need to set
Code:
tile_z = 12
.
 
Thanks for the reply, Dr. Duda! I followed your instructions to get a combined file for 12 months, and it worked!

It seemed that the tile_z has to be 12. When I concatenated three of the 2D files using the same method and fed it to geogrid, I got an error.
 
Hi Xinyue,

I would like to use a higher resolution greenfrac data than the default one in WRF V4.0. So can you kindly point me to the data sources or the literature from which I can compute the vegetation fraction?

Thanks,
Yue
 
Hi Yue,

I actually downloaded my data instead of having generated them, so I may not have the information that you are looking for. My data include fractions of photosynthetic and non-photosynthetic vegetation calculated from MCD43A4, which has a resolution of 500 meters (https://data.csiro.au/dap/landingpage?pid=csiro%3A19311).
As far as I know, if you are satisfied with interpolating the default greenfrac data to finer grids, maybe you can do that with geogrid. Otherwise, I am not an expert in generating data from calculations or observations.

Good luck!
Xinyue
 
Top