pygrib icon indicating copy to clipboard operation
pygrib copied to clipboard

Find location of grib subset within entire grid

Open edougherty32 opened this issue 6 years ago • 0 comments

Hi there,

I am wondering if there is a function in pygrib that allows me to determine the indices (i,j) of a lat/lon subset with respect to the full grid. For example, Stage IV data's grid is 1121 x 881 and I am pulling a subset using the following:

gr = pygrib.open('stage_iv/2006/ST4.2006101504.01h')
            for g in gr:
                    pcps,lats, lons = g.data(lat1= 28.6, lat2= 38.6, lon1= -105 ,lon2= -95) 

And I would like to know the i,j indices of where these values are in the 1121 x 881 grid, since I am only returned a 1d-array. Does anyone have any ideas?

edougherty32 avatar Oct 17 '18 19:10 edougherty32