-
Notifications
You must be signed in to change notification settings - Fork 78
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
Missing "v"-component of wind from NAM GRIB files. #111
Comments
Using recent RAP/RUC GRIB2 files, cfgrib has been doing that same thing with the winds. I presume the RAP is doing something similar to the winds as the NAM. My temporary work around has been to convert the GRIB2 to a netCDF4 using NCL, This does pick out the v-component from my RAP files. Using archived HRRR files from the Utah Archive, the HRRR GRIB2 files provide both the u and v components when cfgrib puts it into an xarray for me. So far only the RAP and NAM I am seeing this with. |
The problem is those GRIB files use MULTI-FIELD messages for wind variables and I didn't find a way to consistently make random access reads on MULTI-FIELD messages with ecCodes. |
Okay. Thank you for the information and update! |
I see there have been a few updated releases in the last couple months. No specific notes on it, but has there been any luck with multi-field messages for wind in these kind of GRIB files yet? |
No, same issue applies. I went looking around and couldn't find a solution. NAM/RAP files seem to have the issues with the multi-fields, not an issue for GFS/HRRR GRIB 2 files. |
I've been struggling with this for hours, using the python eccodes library on the RAP grib2 data, and am happy to see it's not just me. Thanks for this bug report. |
@gdh101 I know its not a great solution, but if you need a solution for RAP use wgrib2 and just do a direct conversion to nc, you could then put it together into vertical profiles, and for an areal subset as follows (unless you are looking for direct parameters, or want the whole domain then just modify as you need): #Load wgrib2 parsed file #Subset to domain of interest (You will want to change this) #Strip off the names of the individual variables and turn them into a list. #Sort the list of variables in order so that all parameters of one type will be together. #Search this list for all parameters containing the partial string UGRD or whichever variable. #Now Pick Out the 2D profile variables needed (may vary model to model) #PRES_surface = data_sub.PRES_surface.values#[1,1].squeeze() ds1 = xr.concat([data_sub[name] for name in ugrd_pres], 'pressure') data = xr.merge([ds1,ds2,ds3,ds4,ds5,data_sub.PRES_surface,data_sub[ugrd_surf],data_sub[vgrd_surf],data_sub[temp_surf],data_sub[rh_surf]]) #If you Want to output only: |
Thanks @xebadir. I actually was already using wgrib2 to convert to netcdf, then scipy.io to extract the data to a numpy array. It's faster iterating through a netcdf file than a grib2 (and the parameter names are resolved better), but not if accounting for the extra time to convert to netcdf. So I was trying to upgrade my code to use eccodes and ran into the v-component issue just with the RAP model so far (hadn't tried the NAM yet). But thanks for the code. There's always a thousand ways to solve the same problem, and I'll see if there's parts I can use. |
Thanks for the additional information. For the RAP I have been using NCL to convert the grib2 files to a netCDF4. Even with compression my file sizes are increasing quite a bit, but it gets the job done when I need it. For those that are struggling with file size using this method, I have been converting them to netCDF4 files and then taking using Python to extract from just the area that I need, and then put that into a new, smaller netCDF4 file. It's time consuming, but can greatly reduce the file size. Thanks! |
Contrary to the above GFS also has this issue - went looking deeper in the variables, and it excludes them as well on the isobaric surfaces. |
All, I know it took a long time but I may have found a way to access consistently all data in MULTI-FIELD messages and possibly fix the cases when cfgrib silently drops the I needed to dive deep into ecCodes and it has not been easy, but I have just committed a tentative fix in |
I just tested on a NAM grib and it appears that the u and v components are now available. Thank you for the continued support of this issue. I hope this turns out to be stable and reliable! |
Just release version |
Testing for GFS and RAP also confirms this is now resolved in 0.9.8.2. Great work on solving this. |
Excellent. Thank you for your extra effort in doing this. It is greatly appreciated. I will test it out myself by the end of this week, but it sounds like others have had success. This will be great not to have to go through the extra step of converting to netCDF4 file. Thank you again! |
I commented on #45 a few weeks ago, but I decided to create a new ticket since that ticket is closed and most likely not being tracked. For reference, I was the original reporter of that Issue. Here is the comment from that ticket:
Additional information requested from your contributing guidelines:
pip
withxarray==0.14.1
The text was updated successfully, but these errors were encountered: