I have several grib2 files containing hourly accumulated precipitation data however I would like to merge these files so that I have the accumulated precipitation across several hours.
So say I have these files, each one is the accumulated precipitation for that hour:
I came across the wgrib2 tips and tricks page and found an example (46) that indicated that it would be possible to use rpn and import_grib to do this:
(46) Land-sea mask mismatch problem: The SST and sea-ice analysis can be created with a different land-sea mask than used by numerical model. So if the sst analysis in the model, some sea points may have no analyzed SSTs. Assuming the land points have an undefined value (for SST), this will extend the SST analysis by 2 grid points. wgrib2 $in -set_scaling -2 0 -rpn smth9g -grib_out tmp.1 -rpn smth9g -grib_out tmp.2 smth9 will do a 9-point smoothing. A side effect is that undefined points that are adjacent to a defined point will become defined. The above line creates a smoothed SST with a defined sst that are 1 (tmp.1) and 2 (tmp.2) points from the sst analysis. wgrib2 $in -rpn sto_1 -import_grib tmp.1 -rpn ":rcl_1:merge:sto_1" \ -import_grib tmp.2 -rpn "rcl_1:merge" \ -set_grib_type c3 -set_scaling -2 0 -grib_out $in.fill This command merges the 3 files with the following priority: $in > tmp.1 > tmp.2 The net result is a new SST analysis which can be used with minor mismatches in the land-sea mask.However -import_grib isn't listed as a wgrib2 command so anything I try throws an error:
wgrib2 rtma2p5.2015063000.pcp.184.grb2 -rpn sto_1 rtma2p5.2015063001.pcp.184.grb2 -rpn "dup:rcl_1:+:sto_1" -grib_out rtma2p5.2015063000_01.pcp.184.grb2*** FATAL ERROR: unknown option -import_grib ***I also tried using CDO but have had some trouble getting it to play with grib2 files.
Does anyone know whether it is possible to merge/combine grib2 files?
أكثر...
So say I have these files, each one is the accumulated precipitation for that hour:
- rtma2p5.2015063000.pcp.184.grb2
- rtma2p5.2015063001.pcp.184.grb2
- rtma2p5.2015063002.pcp.184.grb2
- rtma2p5.2015063003.pcp.184.grb2
- rtma2p5.2015063004.pcp.184.grb2
- rtma2p5.2015063005.pcp.184.grb2
- rtma2p5.2015063000_01.pcp.184.grb2
- rtma2p5.2015063000_02.pcp.184.grb2
- rtma2p5.2015063000_03.pcp.184.grb2
- rtma2p5.2015063000_04.pcp.184.grb2
- rtma2p5.2015063000_05.pcp.184.grb2
I came across the wgrib2 tips and tricks page and found an example (46) that indicated that it would be possible to use rpn and import_grib to do this:
(46) Land-sea mask mismatch problem: The SST and sea-ice analysis can be created with a different land-sea mask than used by numerical model. So if the sst analysis in the model, some sea points may have no analyzed SSTs. Assuming the land points have an undefined value (for SST), this will extend the SST analysis by 2 grid points. wgrib2 $in -set_scaling -2 0 -rpn smth9g -grib_out tmp.1 -rpn smth9g -grib_out tmp.2 smth9 will do a 9-point smoothing. A side effect is that undefined points that are adjacent to a defined point will become defined. The above line creates a smoothed SST with a defined sst that are 1 (tmp.1) and 2 (tmp.2) points from the sst analysis. wgrib2 $in -rpn sto_1 -import_grib tmp.1 -rpn ":rcl_1:merge:sto_1" \ -import_grib tmp.2 -rpn "rcl_1:merge" \ -set_grib_type c3 -set_scaling -2 0 -grib_out $in.fill This command merges the 3 files with the following priority: $in > tmp.1 > tmp.2 The net result is a new SST analysis which can be used with minor mismatches in the land-sea mask.However -import_grib isn't listed as a wgrib2 command so anything I try throws an error:
wgrib2 rtma2p5.2015063000.pcp.184.grb2 -rpn sto_1 rtma2p5.2015063001.pcp.184.grb2 -rpn "dup:rcl_1:+:sto_1" -grib_out rtma2p5.2015063000_01.pcp.184.grb2*** FATAL ERROR: unknown option -import_grib ***I also tried using CDO but have had some trouble getting it to play with grib2 files.
Does anyone know whether it is possible to merge/combine grib2 files?
أكثر...