NAME copygb - copies GRIB files SYNOPSIS copygb [-g "grid [kgds]"] [-i "ip [ipopts]"] [-k "kpds"] [-v "uparms"] [-X] [-B mapgrib [-b mapindex] [-A "<> mapthreshold"] [-K "mapkpds"]] [-M "mask"] [-a] then either: grib1 index1 grib2 or: -x grib1 grib2 DESCRIPTION The command copygb copies all or part of one GRIB file to another GRIB file, interpolating if necessary. Unless otherwise directed (-x option), the GRIB index file is also used to speed the reading. The fields are interpolated to an output grid if specified (-g option). The interpolation type defaults to bilinear but may be specified directly (-i option). The copying may be limited to specific fields (-k option). It may also be limited to a specified subgrid of the output grid or to a subrange of the input fields (-B and -b, -A, and -K options). Fields can be identified as scalars or vectors (-v option), which are interpolated differently. The invalid data in the output field can be filled with mask values or merged with a merge field (-M and -m options). The output GRIB message can also be appended to a file (-a option). If grib2 is specified as '-', then the output GRIB file is written to standard output. Options -a Appends rather than overwrites the output GRIB file. -A "<> mapthreshold" Inequality and threshold used in determining where on the map the data will be copied. The data are copied only where the given map field is on the correct side of the threshold. The mapthreshold defaults to '>-1.e30'; in this case, only the map field's bitmap will limit the domain. -b mapindex Optional index file used to get the map field. -B mapgrib GRIB file used to get the map field. The map field is read from the GRIB file and compared to the map threshold to determine for which region on the map the data will be copied. The mapgrib can be the name of an actual GRIB file (in which case the index file may be specified with the -b option) or it can be '-1'. If mapgrib is '-1', then the input GRIB file (first positional argument) is used. The -K option specifies which field to read from the mapgrib GRIB file. If mapgrib is an actual file, then the first field is taken if -K is not specified. On the other hand, if mapgrib is '-1', then if the if -K is not specified, the current field is taken as the map field. A special exception is if -K '-1' is specified, in which case the current field is taken as the map field and it is applied before any interpolation; otherwise the map field is always applied after interpolation. -g "grid [kgds]" Output grid identification. If grid=-1 (the default), then the output grid is the same as the input grid. If grid=-4, then the grid is that of the map field. If grid=-5, then the grid is that of the merge field. If 00 -M\#0 $g1 $x1 gribout3 (4) Copy precipitation again, but with no index file and only over land. day=960716 g1=/com/avn/PROD/avn.$day/gblav.T00Z.PGrbF24 copygb -xg212 -i3 -k'4*-1 61' -B-1 -K'4*-1 81' -A\>0.5 $g1 gribout4 (5) Copy momentum flux as a vector to a user-defined grid, specifically a 0.1 x 0.1 degree grid from 25N to 45N and from 90W to 70W. day=960716 g1=/com/avn/PROD/avn.$day/gblav.T00Z.PGrbF24 grid='255 0 201 201 25000 270000 128 45000 290000 100 100 64' copygb -g"$grid" -i3 -k'4*-1 124' -v124 $g1 $x1 gribout5 (6) Interpolate 250 mb height from staggered eta grid to AWIPS 212 grid. day=960716 g1=/com/eta/PROD/meso.$day/meso.T12Z.EGRD3D09.tm00 copygb -xg212 -k'4*-1 7 100 250' $g1 gribout6 (7) Verbosely extract 500 mb height from ECMWF file. day=960716 g1=/scom/mrf/prod/ecmwf.$day/ecmgrb25.T12Z x1=/scom/mrf/prod/ecmwf.$day/ecmgrbi25.T12Z copygb -X -k'4*-1,7,100,500' $g1 $x1 gribout7 (8) Use wgrib to extract 1000 and 500 mb heights to grid 2 and append output to the pre-existing file gribarch8. day=19991005 g1=/com/fnl/prod/fnl.$day/gdas1.t00z.pgrbf00 wgrib $g1|grep :HGT:|grep -E ':1000 mb:|:500 mb:'|\ copygb -xg2 -kw -a $g1 gribarch8 (9) Use wgrib to merge two WAFS files onto grid 212. copygb -xg212 -M wafs39 wafs40 wafs212 (10) Force vertical velocity to have a decimal scaling of 3. day=20000119 g1=/com/eta/prod/eta.$day/eta.t12z.awip3224.tm00 echo ' &NLCOPYGB IDS(039)=3, /' >tmpnlcopygb copygb -N tmpnlcopygb -g3 -x $g1 gribout10 rm tmpnlcopygb AUTHOR Mark Iredell Global Modeling Branch Environmental Modeling Center National Centers for Environmental Prediction National Weather Service National Oceanographic and Atmospheric Administration Department of Commerce Man page last modified on January 19, 2000.