From shaox at us.ibm.com Wed Apr 11 19:23:15 2018 From: shaox at us.ibm.com (Xiaoyan Shao) Date: Wed, 11 Apr 2018 13:23:15 -0400 Subject: [Rnomads-user] Extract SOILW 4 layers from GFS analysis Message-ID: Dear rNOMADS users, I am relatively new to GFS grib2 data processing. Need some help here. Thanks in advance. I ran into some difficulty in extracting the 4 soil water content parameters from GFS reanalysis files. Here is the download link for a specific file I am testing: https://nomads.ncdc.noaa.gov/data/gfsanl/201801/20180101/gfsanl_4_20180101_0000_006.grb2 I would like to extract 4 parameters using this R package. I have the grb2 file downloaded to my local computer. library(rNOMADS) fpath<-"gfsanl_4_20180101_0000_006.grb2" variables<-c("SOILW") levels<-c("0.1-0.4 m below ground") # I want to test one parameter first export_data<- ReadGrib(fpath,levels=levels,variables=variables) > str(export_data) List of 9 $ model.run.date: chr(0) $ forecast.date : chr(0) $ variables : chr(0) $ levels : chr(0) $ lon : num(0) $ lat : num(0) $ value : chr(0) $ meta.data : chr "None - this field is used for grib1 files" $ grib.type : chr "grib2" What did I do wrong here? There are 4 SOILW parameters at different levels: [271] "271:43400382:d=2018010100:SOILW:0-0.1 m below ground:6 hour fcst:" [273] "273:43583330:d=2018010100:SOILW:0.1-0.4 m below ground:6 hour fcst:" [275] "275:43764744:d=2018010100:SOILW:0.4-1 m below ground:6 hour fcst:" [277] "277:43943879:d=2018010100:SOILW:1-2 m below ground:6 hour fcst:" When I change the variables to the 4th layer above, then it returns some data. It also works with the other 3 variables I am interested shown below: [286] "286:45186361:d=2018010100:TMAX:2 m above ground:0-6 hour max fcst:" [287] "287:45421594:d=2018010100:TMIN:2 m above ground:0-6 hour min fcst:" [293] "293:46556801:d=2018010100:APCP:surface:0-6 hour acc fcst:" Also gdal_translate will get the data out, for example temperature will be in C unit, but if I use the above command for the TMAX and TMIN, the unit seems to be K? Thanks & Regards, Cheyenne -------------- next part -------------- An HTML attachment was scrubbed... URL: From danny.c.bowman at gmail.com Sun Apr 15 05:01:55 2018 From: danny.c.bowman at gmail.com (Daniel Bowman) Date: Sat, 14 Apr 2018 21:01:55 -0600 Subject: [Rnomads-user] Extract SOILW 4 layers from GFS analysis In-Reply-To: <7958545b0d7a46d7a6d64c4bdce3a155@CY1PR0301MB0891.namprd03.prod.outlook.com> References: <7958545b0d7a46d7a6d64c4bdce3a155@CY1PR0301MB0891.namprd03.prod.outlook.com> Message-ID: Hi Cheyenne, I am sorry I took so long to get back to you. I am able to read the file: str(export_data) List of 9 $ model.run.date: chr [1:87995] "2018-01-01 00:00:00" "2018-01-01 00:00:00" "2018-01-01 00:00:00" "2018-01-01 00:00:00" ... $ forecast.date : chr [1:87995] "2018-01-01 06:00:00" "2018-01-01 06:00:00" "2018-01-01 06:00:00" "2018-01-01 06:00:00" ... $ variables : chr [1:87995] "SOILW" "SOILW" "SOILW" "SOILW" ... $ levels : chr [1:87995] "0.1-0.4 m below ground" "0.1-0.4 m below ground" "0.1-0.4 m below ground" "0.1-0.4 m below ground" ... $ lon : num [1:87995] 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 ... $ lat : num [1:87995] -90 -90 -90 -90 -90 -90 -90 -90 -90 -90 ... $ value : num [1:87995] 1 1 1 1 1 1 1 1 1 1 ... $ meta.data : chr "None - this field is used for grib1 files" $ grib.type : chr "grib2" Can you give me the results of: library(rNOMADS) sessionInfo() Maybe that will give us clues about the difference between our operating systems or R versions. In my experience, GFS data are in Kelvin. I suppose either way is fine as long as the units are clear. Best, Danny On Wed, Apr 11, 2018 at 11:23 AM, Xiaoyan Shao wrote: > Dear rNOMADS users, > > I am relatively new to GFS grib2 data processing. Need some help here. > Thanks in advance. > > I ran into some difficulty in extracting the 4 soil water content parameters > from GFS reanalysis files. > > Here is the download link for a specific file I am testing: > https://nomads.ncdc.noaa.gov/data/gfsanl/201801/20180101/gfsanl_4_20180101_0000_006.grb2 > > I would like to extract 4 parameters using this R package. I have the grb2 > file downloaded to my local computer. > > library(rNOMADS) > fpath<-"gfsanl_4_20180101_0000_006.grb2" > variables<-c("SOILW") > levels<-c("0.1-0.4 m below ground") # I want to test one parameter first > export_data<- ReadGrib(fpath,levels=levels,variables=variables) > >> str(export_data) > List of 9 > $ model.run.date: chr(0) > $ forecast.date : chr(0) > $ variables : chr(0) > $ levels : chr(0) > $ lon : num(0) > $ lat : num(0) > $ value : chr(0) > $ meta.data : chr "None - this field is used for grib1 files" > $ grib.type : chr "grib2" > > What did I do wrong here? > > There are 4 SOILW parameters at different levels: > [271] "271:43400382:d=2018010100:SOILW:0-0.1 m below ground:6 hour fcst:" > [273] "273:43583330:d=2018010100:SOILW:0.1-0.4 m below ground:6 hour fcst:" > [275] "275:43764744:d=2018010100:SOILW:0.4-1 m below ground:6 hour fcst:" > [277] "277:43943879:d=2018010100:SOILW:1-2 m below ground:6 hour fcst:" > > When I change the variables to the 4th layer above, then it returns some > data. It also works with the other 3 variables I am interested shown below: > [286] "286:45186361:d=2018010100:TMAX:2 m above ground:0-6 hour max fcst:" > [287] "287:45421594:d=2018010100:TMIN:2 m above ground:0-6 hour min fcst:" > [293] "293:46556801:d=2018010100:APCP:surface:0-6 hour acc fcst:" > > Also gdal_translate will get the data out, for example temperature will be > in C unit, but if I use the above command for the TMAX and TMIN, the unit > seems to be K? > > Thanks & Regards, > Cheyenne