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 interpret filenames of binary files in the geog folder

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.

Dear WRF Experts,

I'd like to know how to interpret the filenames of the binary files in the geog folder. For example, in the landuse_10m, there is a file named:
02041-02160.00481-00600

How do I know the coordinates of this or where is this tile located?

Here are the details of the index file:

type=continuous
category_min=1
category_max=24
projection=regular_ll
dx=0.16666667
dy=0.16666667
known_x=1.0
known_y=1.0
known_lat=-89.916667
known_lon=-179.916667
wordsize=1
tile_x=120
tile_y=120
tile_z=24
tile_bdr=3
units="category"
description="24-category USGS landuse"


I'll appreciate any help on this.
 
The file naming convention is described on slides 14 and 15 of the Advanced Usage of the WPS tutorial presentation. If you have any additional questions about the file names, please don't hesitate to follow up in this forum and I can offer further details.
 
@mgduda

Thank you so much for the help.

I have another question. How can I plot these raw binary files?

Right now, I'm running geogrid and using NCL to plot them, but is there a way plot the raw binary files easily?

Sincerely,
Lyndz
 
Plotting the raw data with Python is relatively straight-forward, since the files can be read into numpy arrays with numpy.fromfile. Here's a minimal example that should produce a plot of the fractions for category 16 (15 in 0-based indexing) for a tile of the 10-arc-minute USGS land cover data over the western U.S.:
Code:
import numpy as np
import matplotlib.pyplot as plt
a = np.fromfile('/your/geographical/directory/landuse_10m/00361-00480.00721-00840', dtype='i1').reshape((24,126,126))
plt.imshow(a[15,:,:], origin='lower')
plt.savefig('modis.png')

The reshaping dimension 24 comes from the tile_z=24 specification in the index file, and the dimension 126 come from tile_y + 2 * tile_bdr and tile_x + 2 * tile_bdr. The tile_bdr parameter gives the number of halo (or "border") rows and columns on each side of the tiles.

The origin='lower' option to imshow accounts for the fact that the geogrid program treats the (1,1) (or (0,0) in 0-based indexing) pixel of each tile as residing in the south-western corner of a dataset. For geographical datasets that specify row_order=top_bottom in their index files, I think you'd need to omit origin='lower' (or use origin='upper').
 
Top