I have been struggling with this problem for quite some time. I will be grateful if someone would please help resolve it.
I am trying to read NOAA's GFS weather data which is in .grb2 format with Pygrib in PYTHON. An example of the data can be found https://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.20230610/06/atmos/gfs.t06z.pgrb2.0p25.f000
The issue is that Pygrib output a 721 X 1440 array for the wind data.
I converted the file to NetCDF using wgrib2 (https://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/netcdf.html) and the output of the .nc file is 1440 X 721.
I suspect the reason, could be that Most weather models assume that the data is in Fortran order. Python has its roots in C, and maybe the default order in my system is "C".
Please who has experience in reading GFS data using Pygrib?.
I did a workaround with the following code and the output from pygrib and wgrib2 are now the same. Is there a better way to achieve this?
import pygrib
file_name = 'my_grib_file.grb2'
wind_data = pygrib.open(file_name)
UGRD_950mb = wind_data[1].values
UGRD_1000mb = UGRD_1000mb.T
UGRD_1000mb = np.flip(UGRD_1000mb,1)