NCEPLIBS-g2 4.0.0
|
Compare grib files. More...
Go to the source code of this file.
Functions/Subroutines | |
program | copygb |
The command copygb copies all or part of one GRIB file to another GRIB file, interpolating if necessary. | |
subroutine | cpgb (lg1, lx1, lgb, lxb, lgm, lxm, lg2, igi, kgdsi, ip, ipopt, jpds1, nuv, iuv, jpdsb, jb, jbk, lab, ab, lam, am, lxx, lwg, ids, ibs, nbs) |
Copy grib files. | |
subroutine | cpgb1 (lg1, lx1, m1, cbuf1, nlen1, nnum1, mnum1, mbuf, mf, mi, igi, kgdsi, ip, ipopt, jpds1, nuv, iuv, jpdsb, jb, jbk, lab, ab, lam, am, ids, ibs, nbs, lgb, lxb, mb, cbufb, nlenb, nnumb, mnumb, lgm, lxm, mm, cbufm, nlenm, nnumm, mnumm, lg2, lxx, ks1, no, iret) |
Copy one grib field. | |
subroutine | eusage |
Print proper usage to stderr. | |
subroutine | intgrib (iv, ip, ipopt, kgds1, k1, ib1, l1, f1, g1, kgds2, k2, ib2, l2, f2, g2, iret) |
Interpolate field. | |
subroutine | intgrib1 (k1f, kgds1f, k2f, kgds2f, mrl, mro, iv, ip, ipopt, kgds1, k1, ib1, l1, f1, g1, kgds2, k2, ib2, l2, f2, g2, iret) |
Interpolate field. | |
function | lengdsf (kgds, kgdsf) |
Return the length of a filled grid. | |
program copygb |
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). Some defaults can be overridden in a namelist file (-N option).
-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 0<grid<255, then grid designates an NCEP grid. If grid=255, then the grid must be specified by the full set of kgds parameters determining a GRIB GDS (grid description section) in the W3FI63 format.
-i "ip [ipopts]" Interpolation options. The default is bilinear interpolation (ip=0). Other interpolation options are bicubic (ip=1), neighbor (ip=2), budget (ip=3), and spectral (ip=4). Spectral interpolation is forced even if the input and output grids are the same. See the documentation for iplib for further details.
-k "kpds" Full set of kpds parameters determing a GRIB PDS (product definition section) in the W3FI63 format determining the field(s) to be copied. Note that kpds(5) is the parameter indicator (PDS octet 9). A wildcard is specified by -1 (the defaults). If "kpds" is equal to "w", then the requested record numbers are read in from standard input instead, one record per line and possibly delimited by a colon (so that wgrib could pipe requests to copygb). If the -k is not specified, then copygb will attempt to copy every field in the input GRIB file.
-K "mapkpds" Full set of kpds parameters determing a GRIB PDS (product definition section) in the W3FI63 format determining the map field to be used to determine where on the map the data will be copied. A wildcard is specified by -1 (the defaults).
-m mergeindex Optional index file used to get the merge field.
-M "mask"/mergegrib Mask used to fill out bitmapped areas of the map. If specified, there will be no bitmap in the output. The mask must be in the format '#value' where value is the real number used to fill out the field. Otherwise, the argument is interpreted as a merge GRIB file. Then for each GRIB message copied, a merge field is found in the merge GRIB file with the same parameter and level indicators as the copied field. This merge field is interpolated to the output grid and used to fill out the bitmapped areas of the map, at least where the merge field is not bitmapped. No merging is done if no merge field is found.
-N namelist Namelist file to override default output options. The namelist must start with " &NLCOPYGB" and end with "/". Namelist variables are IDS(255) Output decimal scaling by parameter IBS(255) Output binary scaling by parameter NBS(255) Output number of bits by parameter
-v "uparms" Parameter indicator(s) for the u-component of vectors. The parameter indicator for the v-component is assumed to be one more than that of the u-component. If the -v option is not specified, then the wind components (parameters 33 and 34) are the only fields assumed to be vector components in the GRIB file.
-x Turns off the use of an index file. The index records are then extracted from the GRIB file, which will increase the time taken by copygb.
-X Turns on verbose printout. This option is incompatible with GRIB output to standard output.
Definition at line 149 of file copygb.F90.
subroutine cpgb | ( | lg1, | |
lx1, | |||
lgb, | |||
lxb, | |||
lgm, | |||
lxm, | |||
lg2, | |||
igi, | |||
integer, dimension(200) | kgdsi, | ||
ip, | |||
integer, dimension(20) | ipopt, | ||
integer, dimension(100) | jpds1, | ||
nuv, | |||
integer, dimension(100) | iuv, | ||
integer, dimension(100) | jpdsb, | ||
jb, | |||
jbk, | |||
lab, | |||
ab, | |||
lam, | |||
am, | |||
lxx, | |||
lwg, | |||
integer, dimension(255) | ids, | ||
integer, dimension(255) | ibs, | ||
integer, dimension(255) | nbs | ||
) |
Copy grib files.
[in] | lg1 | integer unit number for grib file 1 |
[in] | lx1 | integer unit number for grib index file 1 |
[in] | lgb | integer unit number for grib file map |
[in] | lxb | integer unit number for grib index file map |
[in] | lgm | integer unit number for grib file merge |
[in] | lxm | integer unit number for grib index file merge |
[in] | lg2 | integer unit number for grib file 2 |
[in] | igi | integer output grid identification |
[in] | kgdsi | integer (200) output grid parameters |
[in] | ip | integer interpolation type |
[in] | ipopt | integer (20) interpolation options |
[in] | jpds1 | integer (100) kpds search options |
[in] | nuv | integer number of vector parameter ids |
[in] | iuv | integer (100) vector parameter ids |
[in] | jpdsb | integer (100) kpds search options (map) |
[in] | jb | integer flag for map optiion |
[in] | jbk | integer flag for map optiion |
[in] | lab | integer flag for map threshold inequality |
[in] | ab | real map threshold |
[in] | lam | integer flag for mask value |
[in] | am | real mask value |
[in] | lxx | integer flag for verbose output |
[in] | lwg | integer flag for stdin selection |
[in] | ids | integer (255) decimal scaling (-9999 for no change) |
[in] | ibs | integer (255) binary scaling (-9999 for no change) |
[in] | nbs | integer (255) number of bits (-9999 for no change) |
Definition at line 562 of file copygb.F90.
References cpgb1().
subroutine cpgb1 | ( | lg1, | |
lx1, | |||
m1, | |||
character, dimension(mbuf) | cbuf1, | ||
nlen1, | |||
nnum1, | |||
mnum1, | |||
mbuf, | |||
mf, | |||
mi, | |||
igi, | |||
integer, dimension(200) | kgdsi, | ||
ip, | |||
integer, dimension(20) | ipopt, | ||
integer, dimension(100) | jpds1, | ||
nuv, | |||
integer, dimension(100) | iuv, | ||
integer, dimension(100) | jpdsb, | ||
jb, | |||
jbk, | |||
lab, | |||
ab, | |||
lam, | |||
am, | |||
integer, dimension(255) | ids, | ||
integer, dimension(255) | ibs, | ||
integer, dimension(255) | nbs, | ||
lgb, | |||
lxb, | |||
mb, | |||
character, dimension(mbuf) | cbufb, | ||
nlenb, | |||
nnumb, | |||
mnumb, | |||
lgm, | |||
lxm, | |||
mm, | |||
character, dimension(mbuf) | cbufm, | ||
nlenm, | |||
nnumm, | |||
mnumm, | |||
lg2, | |||
lxx, | |||
ks1, | |||
no, | |||
iret | |||
) |
Copy one grib field.
[in] | lg1 | integer unit number for grib file 1 |
[in] | lx1 | integer unit number for grib index file 1 |
[in] | m1 | integer dimension of grib field 1 |
[in] | cbuf1 | character (mbuf) index buffer 1 |
[in] | nlen1 | integer record length of index buffer 1 |
[in] | nnum1 | integer number of index records 1 |
[in] | mnum1 | integer number of index records 1 skipped |
[in] | mbuf | integer dimension of index buffers |
[in] | mf | integer dimension of field |
[in] | mi | integer dimension of output grid |
[in] | igi | integer output grid identification |
[in] | kgdsi | integer (200) output grid parameters |
[in] | ip | integer interpolation type |
[in] | ipopt | integer (20) interpolation options |
[in] | jpds1 | integer (100) kpds search options |
[in] | nuv | integer number of vector parameter ids |
[in] | iuv | integer (100) vector parameter ids |
[in] | jpdsb | integer (100) kpds search options (map) |
[in] | jb | integer flag for map optiion |
[in] | jbk | integer flag for map optiion |
[in] | lab | integer flag for map threshold inequality |
[in] | ab | real map threshold |
[in] | lam | integer flag for mask value |
[in] | am | real mask value |
[in] | ids | integer (255) decimal scaling (-9999 for no change) |
[in] | ibs | integer (255) binary scaling (-9999 for no change) |
[in] | nbs | integer (255) number of bits (-9999 for no change) |
[in] | lgb | integer unit number for grib file map |
[in] | lxb | integer unit number for grib index file map |
[in] | mb | integer dimension of grib field map |
[in] | cbufb | character (mbuf) index buffer map |
[in] | nlenb | integer record length of index buffer map |
[in] | nnumb | integer number of records in index buffer map |
[in] | mnumb | integer number of index records map skipped |
[in] | lgm | integer unit number for grib file merge |
[in] | lxm | integer unit number for grib index file merge |
[in] | mm | integer dimension of grib field merge |
[in] | cbufm | character (mbuf) index buffer merge |
[in] | nlenm | integer record length of index buffer merge |
[in] | nnumm | integer number of records in index buffer merge |
[in] | mnumm | integer number of index records merge skipped |
[in] | lg2 | integer unit number for grib file 2 |
[in] | lxx | integer flag for verbose output |
[in] | ks1 | integer input record counter |
[out] | no | integer output record counter |
[out] | iret | integer return code |
Definition at line 779 of file copygb.F90.
References intgrib().
subroutine eusage |
subroutine intgrib | ( | iv, | |
ip, | |||
integer, dimension(20) | ipopt, | ||
integer, dimension(200) | kgds1, | ||
k1, | |||
ib1, | |||
logical*1, dimension(k1) | l1, | ||
real, dimension(k1) | f1, | ||
real, dimension(k1) | g1, | ||
integer, dimension(200) | kgds2, | ||
k2, | |||
ib2, | |||
logical*1, dimension(k2) | l2, | ||
real, dimension(k2) | f2, | ||
real, dimension(k2) | g2, | ||
iret | |||
) |
Interpolate field.
[in] | iv | integer vector flag |
[in] | ip | integer interpolation type |
[in] | ipopt | integer (20) interpolation options |
[in] | kgds1 | integer (200) input grid parameters |
[in] | k1 | integer input dimension |
[in] | ib1 | integer input bitmap flag |
[in] | l1 | logical*1 (k1) input bitmap if ib1=1 |
[in] | f1 | real (k1) input field |
[in] | g1 | real (k1) input y-component if iv=1 |
[in] | kgds2 | integer (200) output grid parameters |
[in] | k2 | integer output dimension |
[in] | ib2 | integer output bitmap flag |
[in] | l2 | logical*1 (k2) output bitmap |
[in] | f2 | real (k2) output field |
[in] | g2 | real (k2) output y-component if iv=1 |
[out] | iret | integer return code |
Definition at line 1093 of file copygb.F90.
References intgrib1(), and lengdsf().
Referenced by cpgb1().
subroutine intgrib1 | ( | k1f, | |
integer, dimension(200) | kgds1f, | ||
k2f, | |||
integer, dimension(200) | kgds2f, | ||
mrl, | |||
mro, | |||
iv, | |||
ip, | |||
integer, dimension(20) | ipopt, | ||
integer, dimension(200) | kgds1, | ||
k1, | |||
ib1, | |||
logical*1, dimension(k1) | l1, | ||
real, dimension(k1) | f1, | ||
real, dimension(k1) | g1, | ||
integer, dimension(200) | kgds2, | ||
k2, | |||
ib2, | |||
logical*1, dimension(k2) | l2, | ||
real, dimension(k2) | f2, | ||
real, dimension(k2) | g2, | ||
iret | |||
) |
Interpolate field.
[in] | k1f | integer regularized input dimension |
[in] | kgds1f | integer (200) regularized input grid parameters |
[in] | k2f | integer regularized output dimension |
[in] | kgds2f | integer (200) regularized output grid parameters |
[in] | mrl | integer dimension of rlat and rlon |
[in] | mro | integer dimension of crot and srot |
[in] | iv | integer vector flag |
[in] | ip | integer interpolation type |
[in] | ipopt | integer (20) interpolation options |
[in] | kgds1 | integer (200) input grid parameters |
[in] | k1 | integer input dimension |
[in] | ib1 | integer input bitmap flag |
[in] | l1 | logical*1 (k1) input bitmap if ib1=1 |
[in] | f1 | real (k1) input field |
[in] | g1 | real (k1) input y-component if iv=1 |
[in] | kgds2 | integer (200) output grid parameters |
[in] | k2 | integer output dimension |
[in] | ib2 | integer output bitmap flag |
[in] | l2 | logical*1 (k2) output bitmap |
[in] | f2 | real (k2) output field |
[in] | g2 | real (k2) output y-component if iv=1 |
[out] | iret | integer return code |
Definition at line 1172 of file copygb.F90.
function lengdsf | ( | integer, dimension(200) | kgds, |
integer, dimension(200) | kgdsf | ||
) |
Return the length of a filled grid.
Given a grid description section (in w3fi63 format), return the grid description section and size of its regularized counterpart. That is, if the input grid is regular, then itself is returned along with its grid size; however if the input grid is only quasi-regular (such as the wafs grids), then its filled regular version is returned along with its filled grid size.
[in] | kgds | integer (200) gds parameters in w3fi63 format |
[out] | kgdsf | integer (200) regular gds parameters in w3fi63 format |
Definition at line 1343 of file copygb.F90.
References lengdsf().