Combine multiple geogrid binary files into one

Questions related to the use of new landuse, or geographical static data, or to modifications to the existing data
Post Reply
X_Huang
Posts: 6
Joined: Wed Sep 02, 2020 9:10 pm

Combine multiple geogrid binary files into one

Post by X_Huang » Tue Oct 06, 2020 4:07 am

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
00001-07200.00001-03600.dat
(24.72 MiB) Downloaded 25 times
index.txt
(269 Bytes) Downloaded 38 times

kwerner
Posts: 2287
Joined: Wed Feb 14, 2018 9:21 pm

Re: Combine multiple geogrid binary files into one

Post by kwerner » Wed Oct 07, 2020 5:05 pm

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.
NCAR/MMM

X_Huang
Posts: 6
Joined: Wed Sep 02, 2020 9:10 pm

Re: Combine multiple geogrid binary files into one

Post by X_Huang » Wed Oct 07, 2020 7:26 pm

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!

kwerner
Posts: 2287
Joined: Wed Feb 14, 2018 9:21 pm

Re: Combine multiple geogrid binary files into one

Post by kwerner » Fri Oct 09, 2020 7:38 pm

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.
NCAR/MMM

X_Huang
Posts: 6
Joined: Wed Sep 02, 2020 9:10 pm

Re: Combine multiple geogrid binary files into one

Post by X_Huang » Mon Oct 12, 2020 7:43 pm

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!

mgduda
Posts: 466
Joined: Mon Feb 26, 2018 7:35 pm

Re: Combine multiple geogrid binary files into one

Post by mgduda » Mon Oct 19, 2020 10:16 pm

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: Select all

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: Select all

tile_z = 12
.
NCAR/MMM

X_Huang
Posts: 6
Joined: Wed Sep 02, 2020 9:10 pm

Re: Combine multiple geogrid binary files into one

Post by X_Huang » Tue Oct 20, 2020 12:01 am

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.

Amber_yq
Posts: 7
Joined: Fri Sep 18, 2020 10:05 pm

Re: Combine multiple geogrid binary files into one

Post by Amber_yq » Wed Oct 28, 2020 6:34 am

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

X_Huang
Posts: 6
Joined: Wed Sep 02, 2020 9:10 pm

Re: Combine multiple geogrid binary files into one

Post by X_Huang » Wed Oct 28, 2020 9:10 pm

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

Post Reply

Return to “New/Modified Static Data”