[ncl-talk] Fwd: Conactenate or joint GFS grib2 files
Dennis Shea
shea at ucar.edu
Sat Jul 1 08:58:53 MDT 2017
Hi Rabah,
NCL's default mode when importing dimensions of size one is to eliminate
that dimension. Size one dimensions are considered 'degenerate.' GRIB
formatted 'gfs' files [ eg: gfs.t00z.pgrb2.0p25.f000 ,
gfs.t00z.pgrb2.0p25.f006, gfs.t00z.pgrb2.0p25.f012, ...] have two 'size
one' temporal dimensions: initial_time0_hours and forecast_time0:
initial_time0_hours: initial time of the forecast; this should be the
same for each file
forecast_time0: forecast time [hours offset from the initial_time0_hours];
0, 6, 12, ...
For the gfs files you are reading, the 'initial_time0_hours' will be the
same for all the files but the 'forecast_time0' will will differ.
Try the following:
%> ncl_filedump gfs.t00z.pgrb2.0p25.f006.grb2 | less
%> ncl_filedump gfs.t00z.pgrb2.0p25.f006.grb2 -ftime | less
%> ncl_filedump gfs.t00z.pgrb2.0p25.f006.grb2 -itime -ftime | less
The -itime and -ftime force NCL to not consider the single element
dimension sizes as degenerate.
%> ncl_filedump -h
------
Your situation
[1]
grib_files = systemfunc("ls gfs.t00z.pgrb2.0p25.f*") + ".grib2"
a = addfiles(grib_files,"r")
print( a[0] ) ; no 'time' dimensions
; 'time information' is
included but are variable attributes
x = a[:]->.... ; where ... is some variable on
your file
print(x) ; x will be 2-dimension ... no
time dimension(s)
; 'time information' is
included but are attributes
==============
Start over ...
... aggregating the 'forecast dimension'
Read 'SingleDimensions' portion of:
http://www.ncl.ucar.edu/Document/Functions/Built-in/setfileoption.shtml
[2]
setfileoption("grb","SingleElementDimensions","forecast_time")
grib_files = systemfunc("ls gfs.t00z.pgrb2.0p25.f*") + ".grib2"
a = addfiles(grib_files,"r")
print( a[0] )
x = a[:]->...
print(x)
Cheers
On Fri, Jun 30, 2017 at 4:10 PM, Rabah Hachelaf <hachelaf at sca.uqam.ca>
wrote:
> Hello,
>
> Why we can not concatenate or joint GFS 0.25 grib2 file
> like in this example ?!
> Any suggestions to solve this issue ?
>
> Thank you
> Rabah
>
>
>
> grib_files = systemfunc("ls "+gfs_dir+"/gfs*") + ".grib2"
> a = addfiles(grib_files,"r")
>
> ListSetType (a, "join") or ListSetType (a, "cat")
> rain =a[:]->APCP_P8_L1_GLL0_acc
> printVarSummary(rain)
>
> --------------------------------------------------
> Variable: rain
> Type: float
> Total Size: 4152960 bytes
> 1038240 values
> Number of Dimensions: 2
> Dimensions and sizes: [lat_0 | 721] x [lon_0 | 1440]
> Coordinates:
> lat_0: [90..-90]
> lon_0: [ 0..359.75]
> Number Of Attributes: 15
> center : US National Weather Service - NCEP (WMC)
> production_status : Operational products
> long_name : Total precipitation
> units : kg m-2
> _FillValue : 1e+20
> grid_type : Latitude/longitude
> parameter_discipline_and_category : Meteorological products, Moisture
> parameter_template_discipline_category_number : ( 8, 0, 1, 8 )
> level_type : Ground or water surface
> level : 0
> type_of_statistical_processing : Accumulation
> statistical_process_duration : initial time to forecast time
> forecast_time : 6
> forecast_time_units : hours
> initial_time : 06/23/2017 (00:00)
>
>
> --
> ------------------------------
> Cordialement,
> Best regards,
> Rabah Hachelaf
>
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170701/9f6f8cd0/attachment.html
More information about the ncl-talk
mailing list