-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
16f5465
commit a66184e
Showing
566 changed files
with
85,262 additions
and
5,928 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
See _README.clang |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
Using wgrib2 to process space-perspective EUMETSAT grib2 fields | ||
revised 9.2017 | ||
|
||
9/2017: Bugs found in space view perspective code when the satellite | ||
is not at 0N OE. Fixed in wgrib2 2.0.7. Space view perspective | ||
is limited to 0N XX-E- (Original testing only had satellite at 0N OE.) | ||
|
||
|
||
Some of the EUMETSAT data is on a space view perspective grid. | ||
|
||
-sh-3.00$ wgrib2 LMPEF_CLM_110328_0945.grib2 -grid | ||
1:0:grid_template=90:winds(N/S): | ||
Space view perspective or orographic grid (3712 x 3712) units 1e-06 | ||
input EW:SN output WE:SN res 0 | ||
sub-sat point: lat 0.000000 lon 0.000000 ix=1856.000000 iy=1856.000000 | ||
diameter of earth dx=3622 dy=3610 grid cells ori_angle 0.000000 | ||
sat. altitude=6.610700 (equatorial radii) grid_origin Xo=0 Yo=0 | ||
|
||
wgrib2 has support for space view perspective grids with the restriction that | ||
the sub-sat point have a latitude of 0. | ||
|
||
The rest of the text assumes that you have a space view perspective file. | ||
|
||
0. Getting the value at a specific point | ||
|
||
bash-4.1$ wgrib2 LMPEF_CLM_110328_0945.grib2.c0 -S | ||
1:0:D=20110328094500:CLOUDM:no_level:anl: | ||
bash-4.1$ wgrib2 LMPEF_CLM_110328_0945.grib2.c0 -lon 10 20 | ||
ALPHA: experimental space_view2ll scan=12 | ||
ALPHA: experimental space_view2ij | ||
1:0:lon=9.989726,lat=20.003905,val=1 | ||
|
||
note: use -S otherwise wgrib2 will use a YYYYMMDDHH date code format | ||
and then may complain that the minutes/seconds are non-zero | ||
|
||
1. IIRATE has undefined, not zeros | ||
|
||
I have a file of IIRATE (instantaneous rain rate), and the values | ||
are either > 0 or undefined. Maybe the values are undefined because | ||
of algorithm limitations but for display, I wanted to have the undefineds | ||
replaced by zero. This is easily done by the -rpn option | ||
|
||
wgrib2 IN.grb -rpn "0:exc:merge" -grib_out OUT.grb | ||
|
||
|
||
2. PDT 30 is not supported by GrADS | ||
|
||
My version of GrADS does not support product definition template 30 (PDT 30), | ||
so you need to convert it to a supported PDT. You can convert the PDT to | ||
zero by. | ||
|
||
wgrib2 IN.grb -set_pdt +0 -grib_out OUT.grb | ||
|
||
|
||
3. No level or forecast time | ||
|
||
PDT 0 has metadata for level and forecast time. They can be added by | ||
|
||
wgrib2 IN.grb -set_lev surface -set_ftime anl -grib OUT.grb | ||
|
||
|
||
1-3. Update space view perspective file. | ||
|
||
Steps 1-3 can be combined into one by | ||
|
||
In this example, the 1st grib message is space view perspective | ||
|
||
wgrib2 IN.grb -d 1 -rpn "0:exc:merge" -set_pdt +0 -set_lev surface | ||
-set_ftime anl -grib_out final_svp.grb | ||
|
||
|
||
4. Convert to a lat-lon grid | ||
|
||
GrADS does not understand space view perspecive grid, you need to convert | ||
it to a lat-lon grid. | ||
|
||
wgrib2 final_svp.grb -lola 0:3600:.1 -90:1801:.1 latlon.grb grib | ||
|
||
|
||
5. Make a GrADS control and index file | ||
|
||
g2ctl latlon.grb >latlon.ctl | ||
gribmap -i new.ctl | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
Using the DWD's ICON forecast grib files with wgrib2 updated 12/2019, 4/2020 | ||
|
||
|
||
|
||
The DWD is making global forecasts using the ICON model. This model uses a triangular | ||
mesh, and the forecast quantities are valid for the center of the triangles. The DWD | ||
opendata server is distributing data in grib format for the forecast values from | ||
the center of the triangles. This note shows how to process the grib data using | ||
wgrib2. | ||
|
||
|
||
Basics that DWD may change: | ||
|
||
https://opendata.dwd.de/weather/nwp/icon/grib/HH | ||
|
||
HH = 00, 06, 12 or 18 | ||
|
||
Step 1. Download the CLAT and CLON file | ||
|
||
CLAT=latitude of the center of the triangles | ||
CLON=longitude of the center of the triangles | ||
|
||
https://opendata.dwd.de/weather/nwp/icon/grib/00/clat/icon_global_icosahedral_time-invariant_YYYYMMDDHH_CLAT.grib2.bz2 | ||
https://opendata.dwd.de/weather/nwp/icon/grib/00/clon/icon_global_icosahedral_time-invariant_YYYYMMDDHH_CLON.grib2.bz2 | ||
|
||
Step 2: Download some forecast files | ||
|
||
Example | ||
|
||
https://opendata.dwd.de/weather/nwp/icon/grib/00/t_2m/icon_global_icosahedral_single-level_YYYYMMDDHH_000_T_2M.grib2.bz2 | ||
https://opendata.dwd.de/weather/nwp/icon/grib/00/t_2m/icon_global_icosahedral_single-level_YYYYMMDDHH_001_T_2M.grib2.bz2 | ||
.. | ||
https://opendata.dwd.de/weather/nwp/icon/grib/00/t_2m/icon_global_icosahedral_single-level_YYYYMMDDHH_180_T_2M.grib2.bz2 | ||
|
||
Step 3: Uncompress the data | ||
bunzip2: | ||
|
||
Step 4: Combining the files | ||
Bash: | ||
cat icon_global_icosahedral_time-invariant_YYYYMMDDHH_CLAT.grib2 \ | ||
icon_global_icosahedral_time-invariant_YYYYMMDDHH_CLON.grib2 \ | ||
icon_global_icosahedral_single-level_YYYYMMDDHH_006_TMAX_2M.grib2 >icon.grb | ||
|
||
Windows: | ||
copy /b icon_global_icosahedral_time-invariant_YYYYMMDDHH_CLAT.grib2 + | ||
icon_global_icosahedral_time-invariant_YYYYMMDDHH_CLON.grib2 + | ||
icon_global_icosahedral_single-level_YYYYMMDDHH_006_TMAX_2M.grib2 icon.grb | ||
|
||
(all of above on one line) | ||
|
||
Contents of icon.grb | ||
$ wgrib2 icon.grb | ||
1:0:d=2019040900:GEOLON:surface:anl: | ||
2:5898409:d=2019040900:GEOLAT:surface:anl: | ||
3:11796818:d=2019040900:TMP:2 m above ground:0-360 min max fcst: | ||
|
||
Comment: | ||
|
||
Regridding takes a long time for the first field because wgrib2 searches | ||
each grid point to find the nearest neighbor. The rest of the fields | ||
is much faster because wgrib2 retains a list of the nearest neighbors. | ||
So processing is faster if all the fields that need regridding are put | ||
into one file. (The unix cat command works for grib files.) This | ||
slow first field behavior also works for the -lon option. The | ||
nearest neighbor search is faster when using multiple cores and the | ||
OpenMP version of wgrib2. | ||
|
||
|
||
Example 1: Obtaining values for (10E, 20N) and (10W, 30S) | ||
|
||
wgrib2 v2.0.9 (in development) | ||
v2.0.9 adds -else, -elseif and -endif | ||
v2.0.9 updates -grid_def to use GEOLAT and GEOLON | ||
|
||
$ wgrib2 icon.grb -if "^(1|2):" -grid_def -else -s -lon 10 20 -lon 15 -30 -endif | ||
1:0 | ||
2:5898409 | ||
3:11796818:d=2019040900:TMP:2 m above ground:0-6 hour max fcst::lon=9.968750,lat=20.012680, | ||
val=296.588:lon=15.078125,lat=-30.069351,val=290.953 | ||
|
||
|
||
|
||
wgrib2 v2.0.6 - v2.0.8 (earlier versions of wgrib2 had a bug in -grid_def) | ||
|
||
$ wgrib2 icon.grb \ | ||
-if ":GEOLAT:" -set center 7 -set_var NLAT -fi \ | ||
-if ":GEOLON:" -set center 7 -set_var ELON -fi \ | ||
-grid_def -s \ | ||
-not_if "^(1|2):" -lon 10 20 -lon 15 -30 -fi | ||
1:0:d=2019040900:ELON:surface:anl: | ||
2:5898409:d=2019040900:NLAT:surface:anl: | ||
3:11796818:d=2019040900:TMP:2 m above ground:0-360 min max fcst::lon=9.968750,lat=20.012680,val=296.588: | ||
lon=15.078125,lat=-30.069351,val=290.953 | ||
|
||
|
||
Example 2: a 1x1 degree global grid by nearest neighbor interpolation | ||
|
||
|
||
wgrib2 v2.0.9 (in development) | ||
|
||
$ wgrib2 icon.grb -if "^(1|2):" -grid_def -else -s -lola 0:360:1 -90:181:1 1x1.grb grib -endif | ||
1:0 | ||
2:5898409 | ||
3:11796818:d=2019040900:TMP:2 m above ground:0-6 hour max fcst: | ||
|
||
wgrib2 v2.0.6 - v2.0.8 (earlier versions of wgrib2 had a bug in -grid_def) | ||
|
||
$ wgrib2 icon.grb \ | ||
-if ":GEOLAT:" -set center 7 -set_var NLAT -fi \ | ||
-if ":GEOLON:" -set center 7 -set_var ELON -fi \ | ||
-grid_def -s \ | ||
-not_if "^(1|2):" -lola 0:360:1 -90:181:1 1x1.grb grib | ||
1:0:d=2019040900:ELON:local level type 1 0:anl: | ||
2:5898409:d=2019040900:NLAT:local level type 1 0:anl: | ||
3:11796818:d=2019040900:TMP:local level type 103 2:0-6 hour max fcst: | ||
|
||
|
||
Example 3: Making a netcdf file | ||
|
||
The raw ICON grib files do not have latitude and longitude information. By prepending | ||
the CLON and CLAT files, the file has the longitude and latitude information. However, | ||
the wgrib2 cannot make a netcdf file because the data are not on a lat-lon grid. One | ||
could update the netcdf converter to output the ICON data on a trianglular mesh, but | ||
how many visualization codes could read that netcdf file and make a plot? | ||
|
||
The suggested method to make a netcdf file using wgrib2 is by making a lat-lon grib | ||
file. See example 2. Once you have made the lat-lon file, you can make a netcdf | ||
file using the grib2->netcdf utility of your choice. | ||
|
||
The conversion from the trianglar mesh to a lat-lon grid is slow because a linear search | ||
is used to find the nearest neighbor. The conversion can be made faster by using more cores | ||
and setting the appropriate number of cores to use (export OMP_NUM_THREADS=n). This is why | ||
you want more cores! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
A user had trouble making a 64 bit version of wgrib2 with the Leopard OS. | ||
Some of the libraries where 32 and other 64 bits. To get everything | ||
to work, he had to get the "-m64" flag to all the compiles. He | ||
did this by setting the following environment variables before | ||
doing the "gmake -f makefile" | ||
|
||
export CC=/usr/bin/gcc | ||
export CXX=/usr/bin/c++ | ||
export F77=ifort | ||
export CFLAGS="-O2 -m64" | ||
export CXXFLAGS="-O2 -m64" | ||
export FFLAGS="-O2 -m64" | ||
|
||
Another user had to the above and change makefile | ||
|
||
wCPPFLAGS=-O2 | ||
|
||
to | ||
|
||
wCPPFLAGS=-O2 -m64 | ||
|
||
------------------------------------------------- | ||
|
||
Another user Mac user had 32-bit MySQL libraries and had to | ||
remove the -m64 (2/2010) |
Oops, something went wrong.