-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to extract data on a particular lat and long? #27
Comments
I am also interested in a solution for this. Or at least documentation on the structure of the message value arrays. |
Understand that a grib message is a 2D array of data, and the entire message needs to be decoded at once. You can't just decode one grid point on the grid. The best way to extract one point is to grab the entire 2d grid, then use the lat and lon arrays to determine the grid index of the point you want (or interpolate to that point). |
Is there any built-in implementation for data interpolation in pygrib? e.g. something similar to the wgrib2 command: which interpolate the data to lat/lon meshgrid? |
The command above will print a 2d array with dimmensions 720 x 360 ( my grib file is 0.5 deg * 0.5 deg). [[ 52.87586589 52.87586589 52.87586589 ... 52.87586589 52.87586589 To find specific coordinates within this 720 x 360 array i just extrapolate the coordinates to the array. Ex: If I want to find data for New York New York coordinates ~40.5N 74 W I'll map those coordinates to the array to by doing 2x(90-40.5) and 2x (180-74) to find the following result:
This returns the temperature result converted to Fahrenheit of (79 degrees). |
Right now I am performing the steps above, but my extrapolation is not correct. To fix this problem I need to know how grib files are formatted in relation to latitude and longitude. Are they formatted top to bottom or bottom to top? Ex if I am looking for coordinates 40.5N and 75 W do I find the corresponding grib file by doing 2x(90-40.5) North coordinate and 2x(180-74) West Coordinate to find |
I am able to extract the data for a particular region with the help of documentation. How do I extract for a specif location say
lat 13.0
andlon 80.0
?The text was updated successfully, but these errors were encountered: