2
$\begingroup$

Looking at this GFS http://nomads.ncep.noaa.gov:9090/dods/gfs_0p50/gfs20170707/gfs_0p50_12z.ascii?tmax2m[0:2][124:128][279:283]

The range defined by the second and third set of brackets specify the grid coordinates, however I'm not sure how to convert between what NOAA is using and the common geographic coordinate system.

What would the NOAA equivalent be for this coordinate pair: (36.25, -78.75)?

$\endgroup$
  • $\begingroup$ Hi Rafael, I edited the question to make it more clear as to what I think you are asking. Please revert it back if this is not what you mean. $\endgroup$ – farrenthorpe Jul 10 '17 at 16:37
1
$\begingroup$

** All of the links given with times will need to be adjusted to current dates if reading this at later times or else will appear dead **

Once upon a time I dealt with such files, but not in quite a few years... and Google wasn't the best help at first in finding documentation on what the .ascii is exactly... but thanks to Kevin Goebbert's code here, I was able to find the description page for the model in question is located by removing the .ascii and inputs (and thus here):

And so right now it lists:

Longitude:  
0.00000000000°E to 359.50000000000°E
     (720 points, avg. res. 0.5°)
Latitude:   
-90.00000000000°N to 90.00000000000°N
     (361 points, avg. res. 0.5°)
Altitude:   
1000.00000000000 to 1.00000000000
     (47 points, avg. res. 21.717)
Time:   
12Z07JUL2017 to 12Z17JUL2017
     (81 points, avg. res. 0.125 days) 

The p50 indicates a grid space of only half a degree in that file, so you couldn't actually use your point in this moel.

However, use the 0.25 resolution instead (description):

So first is time first is time, the second is longitude points starting at the Prime Meridian and going east, and the third is latitude starting at the South Pole and going north. (GFS time steps have always been a mire... but based on this full list of data files and the info page previously given, it indeed appears the data provided here is just every 3 hours for the first 10 days.)

So to pick your value for the second input, it'd be something like

ifpositive: (longitude)*4 - 1 ifnegative: (180+longitude)*4 + 719

And for latitude:

360+(latitude)*4

And so if I didn't make a mistake, that'd be this point (lat gridpoint 505, lon gridpoint 1124).

$\endgroup$
1
$\begingroup$

The coordinates defined in Global Forecast System (GFS -0.5º Degree) data defined somewhat unusual. In the GFS, longitudes and latitude contains 720 and 361 values respectively. Therefore to convert them to a common geographic coordinate system follow the procedure below:

Suppose you are looking for index of coordinate pairs (36.5, -78.5) in the GFS data:

your_lat_start = x
your_lat_end = x
your_lon_start = x
your_lon_end = x
your_dataset = half_degree_gfs_dataset

lat_index_start = np.where(np.array(your_dataset['lat'][:].data)==your_lat)[0][0]
lat_index_end = np.where(np.array(your_dataset['lat'][:].data)==your_lat_end)[0][0] 
lon_index_start = np.where(np.array(your_dataset['lon'][:].data)==your_lon_start)[0]
lon_index_end = np.where(np.array(your_dataset['lon'][:].data)==your_lon_end)[0][0]

if lat_index_start > lat_index_end:
    lat_index_start, lat_index_end = lat_index_end, lat_index_start + 1 
    lon_index_start, lon_index_end = lon_index_start , lon_index_end + 1

dataset[var_name][:,lat_index_start:lat_index_end, lon_index_start:lon_index_end].data
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.