...
Login to ecs-login and work in your $SCRATCH:
Make a copy of the practicals directory in your $SCRATCH to Atos:
No Format |
---|
$> tar –xvf-xvf /home/trx/grib_practicals.tar |
...
Expand |
---|
title | Click here to see solution... |
---|
|
To list the GRIB messages in t2m.grib1 No Format |
---|
$> grib_ls t2m.grib1
t2m.grib1
edition centre typeOfLevel level dataDate stepRange dataType shortName packingType gridType
1 ecmf surface 0 20170217 0 cf 2t grid_simple reduced_gg
1 ecmf surface 0 20170217 6 cf 2t grid_simple reduced_gg
1 ecmf surface 0 20170217 12 cf 2t grid_simple reduced_gg
1 ecmf surface 0 20170217 18 cf 2t grid_simple reduced_gg
1 ecmf surface 0 20170217 24 cf 2t grid_simple reduced_gg
5 of 5 grib messages in t2m.grib1
5 of 5 total grib messages in 1 file |
The file contains 2 metre temperature (shortName=2tl) from the ECMWF Ensemble control forecast (dataType=cf) for 6-hourly steps (stepRange) from 0 to 24 hours for dataDate=20170217. Similarly, for t2m.grib2: No Format |
---|
$> grib_ls t2m.grib2
t2m.grib2
edition centre date dataType gridType stepRange typeOfLevel level shortName packingType
2 ecmf 20170217 cf reduced_gg 0 heightAboveGround 2 2t grid_simple
2 ecmf 20170217 cf reduced_gg 6 heightAboveGround 2 2t grid_simple
2 ecmf 20170217 cf reduced_gg 12 heightAboveGround 2 2t grid_simple
2 ecmf 20170217 cf reduced_gg 18 heightAboveGround 2 2t grid_simple
2 ecmf 20170217 cf reduced_gg 24 heightAboveGround 2 2t grid_simple
5 of 5 grib messages in t2m.grib1
5 of 5 total grib messages in 1 files |
Again, the file contains 2 metre temperature (shortName=2t) from the ECMWF Ensemble control forecast (dataType=cf) for 6-hourly steps (stepRange) from 0 to 24 hours for dataDate=20170217. In fact, they are the same fields as in t2m.grib1 but encoded in GRIB edition 2 and obtained from the TIGGE archive. |
...
Expand |
---|
title | Click here to see solution... |
---|
|
To print the mars keys, use either grib_ls -m or grib_ls -n mars. This is the output for the file t2m.grib1: No Format |
---|
$> grib_ls -m t2m.grib1
t2m.grib1
domain levtype date time step param class type stream expver
g sfc 20170217 0000 0 167.128 od cf enfo 0001
g sfc 20170217 0000 6 167.128 od cf enfo 0001
g sfc 20170217 0000 12 167.128 od cf enfo 0001
g sfc 20170217 0000 18 167.128 od cf enfo 0001
g sfc 20170217 0000 24 167.128 od cf enfo 0001
5 of 5 grib messages in t2m.grib1
5 of 5 total grib messages in 1 files |
For t2m.grib2, the same command gives: No Format |
---|
$> grib_ls -m t2m.grib2
t2m.grib2
origin date time step levtype number param expver class model type stream
ecmf 20170217 0000 0 sfc 0 167 prod ti glob cf enfo
ecmf 20170217 0000 6 sfc 0 167 prod ti glob cf enfo
ecmf 20170217 0000 12 sfc 0 167 prod ti glob cf enfo
ecmf 20170217 0000 18 sfc 0 167 prod ti glob cf enfo
ecmf 20170217 0000 24 sfc 0 167 prod ti glob cf enfo
5 of 5 grib messages in t2m.grib2
5 of 5 total grib messages in 1 files |
|
...
Expand |
---|
title | Click here to see solution... |
---|
|
To print the shortName along with the list of mars keys use the –P option e.g.: No Format |
---|
$> grib_ls -m -P shortName t2m.grib1
t2m.grib1
shortName domain levtype date time step param class type stream expver
2t g sfc 20170217 0000 0 167.128 od cf enfo 0001
2t g sfc 20170217 0000 6 167.128 od cf enfo 0001
2t g sfc 20170217 0000 12 167.128 od cf enfo 0001
2t g sfc 20170217 0000 18 167.128 od cf enfo 0001
2t g sfc 20170217 0000 24 167.128 od cf enfo 0001
5 of 5 grib messages in t2m.grib1
5 of 5 total grib messages in 1 files |
|
...
Expand |
---|
title | Click here to see the solution... |
---|
|
To order the output in descending step order use the –B option: No Format |
---|
$> grib_ls -B "step:i desc" t2m.grib1
edition centre typeOfLevel level dataDate stepRange dataType shortName packingType gridType
1 ecmf surface 0 20170217 24 cf 2t grid_simple reduced_gg
1 ecmf surface 0 20170217 18 cf 2t grid_simple reduced_gg
1 ecmf surface 0 20170217 12 cf 2t grid_simple reduced_gg
1 ecmf surface 0 20170217 6 cf 2t grid_simple reduced_gg
1 ecmf surface 0 20170217 0 cf 2t grid_simple reduced_gg
5 of 5 grib messages in t2m.grib1
5 of 5 total grib messages in 1 files |
Tip |
---|
Note that you need to specify “step:i” so that step is treated as an integer rather than a character string. |
|
...
Expand |
---|
title | Click here to see solution... |
---|
|
To specify a set of keys to print, use the -p option: No Format |
---|
$> grib_ls -p centre,dataDate,stepRange,typeOfLevel,shortName 2tm.grib1
t2m.grib1
centre dataDate stepRange typeOfLevel shortName
ecmf 20170217 0 surface t2m
ecmf 20170217 6 surface t2m
ecmf 20170217 12 surface t2m
ecmf 20170217 18 surface t2m
ecmf 20170217 24 surface t2m
5 of 5 grib messages in t2m.grib1
5 of 5 total grib messages in 1 files |
|
...
Expand |
---|
title | Click here to see solution... |
---|
|
To print the keys for forecast step 6 only, use the -p option with the -w option: No Format |
---|
$> grib_ls -w stepRange=6 -p centre,dataDate,stepRange,typeOfLevel,shortName t2m.grib1
t2m.grib1
centre date stepRange levelType shortName
ecmf 20170217 6 surface t2m
1 of 5 grib messages in t2m.grib1
1 of 5 total grib messages in 1 files |
Using the same commands with the file t2m.grib2 gives similar output. |
...
Expand |
---|
title | Click here to see solution... |
---|
|
Specifying the key as "centre:i" and “centre:s” prints the centre both as an integer and a string: No Format |
---|
$> grib_ls -w stepRange=6 -p centre:i,centre:s,dataDate,stepRange,typeOfLevel,shortName t2m.grib1
t2m.grib1
centre centre dataDate stepRange typeOfLevel shortName
98 ecmf 20170217 6 surface t2m
1 of 5 grib messages in t2m.grib1
1 of 5 total grib messages in 1 files |
As before, using the same commands with the file t2m.grib2 gives similar output. |
...
Expand |
---|
To output only the forecast step and 2 metre temperature value at the nearest grid point set the MODE option to 1 and specify that the stepRange key only should be printed using the -p option: No Format |
---|
$> grib_ls -l 51.42,-0.95,1 -p stepRange t2m.grib1
t2m.grib1
stepRange value
0 279.889
6 278.54
12 282.242
18 278.133
24 276.823
5 of 5 messages in t2m.grib1
5 of 5 total messages in 1 files
Input Point: latitude=51.42 longitude=-0.95
Grid Point chosen #2 index=156197 latitude=51.38 longitude=359.03 distance=4.79 (Km)
Other grid Points
- 1 - index=156198 latitude=51.38 longitude=359.35 distance=21.64 (Km)
- 2 - index=156197 latitude=51.38 longitude=359.03 distance=4.79 (Km)
- 3 - index=155082 latitude=51.52 longitude=359.35 distance=23.65 (Km)
- 4 - index=155081 latitude=51.52 longitude=359.03 distance=11.09 (Km)
|
|
...
Expand |
---|
The output format of the values is specified with the -F option. Here, -F"%.2f" is used to specify decimal format with 2 decimal places. To specify the land-sea mask, pass the name of the file containing the land-sea mask as the FILE option: No Format |
---|
% grib_ls -F"%.2f" -l 51.42,-0.95,1,lsm.grib1 -p step t2m.grib1
t2m.grib1
step value
0 279.89
6 278.54
12 282.24
18 278.13
24 276.82
5 of 5 messages in t2m.grib1
5 of 5 total messages in 1 files
Input Point: latitude=51.42 longitude=-0.95
Grid Point chosen #2 index=156197 latitude=51.38 longitude=359.03 distance=4.79 (Km)
Mask values:
- 1 - index=156198 latitude=51.38 longitude=359.35 distance=21.64 (Km) value=1.00
- 2 - index=156197 latitude=51.38 longitude=359.03 distance=4.79 (Km) value=0.99
- 3 - index=155082 latitude=51.52 longitude=359.35 distance=23.65 (Km) value=0.99
- 4 - index=155081 latitude=51.52 longitude=359.03 distance=11.09 (Km) value=0.99 |
Here the value=1.00 (or 0.99) at the end of the line showing the four nearest grid points indicates which are land points (mask=1.0). Land points have mask ≥ 0.5; sea points have mask<0.5. Tip |
---|
Once the index of the nearest grid point is known, its value can be obtained directly with the -i option: No Format |
---|
$> grib_ls -F"%.2f" -i 156197 -p step t2m.grib1
t2m.grib1
step value(156197)
0 279.89
6 278.54
12 282.24
18 278.13
24 276.82
5 of 5 messages in t2m.grib1
5 of 5 total messages in 1 files |
|
|
...