bufr.pm:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
bufr.pm:start [2010-08-12 15:20:11]
pals
bufr.pm:start [2022-05-31 09:29:31] (current)
Line 1: Line 1:
 ====== Geo::BUFR ====== ====== Geo::BUFR ======
  
-[[http://search.cpan.org/dist/Geo-BUFR/|Geo::BUFR]] is a [[http://www.cpan.org/|CPAN]] module for BUFR decoding and encoding developed at the Norwegian Meteorological Institute (met.no).+[[http://search.cpan.org/dist/Geo-BUFR/|Geo::BUFR]] is a [[http://www.cpan.org/|CPAN]] module for BUFR decoding and encoding developed at the Norwegian Meteorological Institute.
  
-Below you will find a toolkit of BUFR handling programs used actively at met.no, with examples of use and complete source code. Hopefully this will demonstrate the power of Geo::BUFR as well as providing potential users of Geo::BUFR an easy start. The first 5 programs are included in the CPAN Geo::BUFR distribution+Below you will find a toolkit of BUFR handling programs used actively at MET Norway, with examples of use and complete source code. The first 5 programs are included in the CPAN Geo::BUFR distribution (will be installed in the ''bin'' subdirectory of the installation directory). Note that even if the programs are written in Perlno knowledge of Perl is required to use them 
- +
-You might want to change the value of the following constants in source code:  DEFAULT_TABLE_PATHDEFAULT_TABLE and DEFAULT_CTABLE.+
  
 A line consisting solely of three dots (...) in the examples of output from running the programs, marks that a (not so interesting) part of the output has been left out. A line consisting solely of three dots (...) in the examples of output from running the programs, marks that a (not so interesting) part of the output has been left out.
 +
 +Notes to users outside MET Norway:
 +
 +  * Before trying to install Geo::BUFR you should check that you have Perl installed.
 +
 +  * Installing Geo::BUFR will not install any BUFR tables. When invoking the utility programs you should use the option ''%%--%%tablepath'' to tell in which directory you keep your [[http://search.cpan.org/dist/Geo-BUFR/lib/Geo/BUFR.pm#BUFR-TABLE-FILES|BUFR table files]], and possibly ''%%--%%tableformat'' to tell the table format. Alternatively, you can set the environment variable ''BUFR_TABLES'', or you can change the value of the constant ''DEFAULT_TABLE_PATH'' in the source code of the utility programs (possibly you might want to change the values of ''DEFAULT_TABLE_FORMAT'', ''DEFAULT_TABLE'' and ''DEFAULT_CTABLE'' also).
 +  
  
 ===== bufrread.pl ===== ===== bufrread.pl =====
  
-Decodes and prints section 0-4 in BUFR messages in input file(s). If the BUFR message is contained in a WMO bulletin, will also print WMO ahl.+Decodes and prints section 0-4 in BUFR messages in input file(s). If the BUFR message is contained in a GTS bulletin, will also print AHL (Abbreviated Header Line).
  
 [[bufrread.pl|source code]] [[bufrread.pl|source code]]
Line 34: Line 39:
  
 [[bufrread_strict_checking|Example]]: Processing a file containing BUFR BUOY bulletins with recoverable formatting errors in the BUFR messages, with option %%--%%strict_checking set [[bufrread_strict_checking|Example]]: Processing a file containing BUFR BUOY bulletins with recoverable formatting errors in the BUFR messages, with option %%--%%strict_checking set
 +
 +[[bufrread_ahl|Example]]: Filtering a file containing a large number of GTS bulletins to decode BUFR BUOYs only, using option %%--%%ahl
  
 ===== bufrresolve.pl ===== ===== bufrresolve.pl =====
Line 53: Line 60:
 [[bufrresolve_noexpand|Example]]: Executing bufrresolve.pl on a sequence of descriptors with option %%--%%noexpand [[bufrresolve_noexpand|Example]]: Executing bufrresolve.pl on a sequence of descriptors with option %%--%%noexpand
  
-[[bufrresolve_code|Example]]: Showing content of code table (option %%--%%code)+[[bufrresolve_code|Example]]: Showing contents of code table (option %%--%%code)
  
 [[bufrresolve_flag|Example]]: Resolving flag value (option %%--%%flag)  [[bufrresolve_flag|Example]]: Resolving flag value (option %%--%%flag) 
 +
 +[[bufrresolve_bufrtable|Example]]: Illustrating use of options %%--%%bufrtable and %%--%%tablepath (for a local table B descriptor) 
 +
 +[[bufrresolve_tableformat|Example]]: Illustrating use of option %%--%%tableformat ECCODES on a local table D descriptor
 +
 +[[bufrresolve_verbose|Example]]: Illustrating use of option %%--%%verbose 1 (to see which tables are loaded)
 +
  
 ===== bufrencode.pl ===== ===== bufrencode.pl =====
Line 84: Line 98:
 ===== bufralter.pl ===== ===== bufralter.pl =====
  
-bufralter.pl provides an even easier way to do some basic manipulation of BUFR messages than does bufr_reencode.pl (although much more restricted in what changes are possible). Besides, bufralter.pl has the nice feature of not touching the text between the BUFR messages. This might be handy if you for example have a file with WMO bulletines and want to do some changes in the BUFR messages without affecting or losing the WMO bulletin envelopes.+bufralter.pl provides an even easier way to do some basic manipulation of BUFR messages than does bufr_reencode.pl (although much more restricted in what changes are possible). Besides, bufralter.pl has the nice feature of not touching the text between the BUFR messages. This might be handy if you for example have a file with GTS bulletins and want to do some changes in the BUFR messages without affecting or losing the GTS bulletin envelopes.
  
 [[bufralter.pl_source|source code]] [[bufralter.pl_source|source code]]
Line 93: Line 107:
  
 [[bufralter.pl_synop|Example]]: Altering a single subset BUFR SYNOP message, by changing value of hour, minute and temperature in section 4, changing update sequence number and changing version number for master table and local table. [[bufralter.pl_synop|Example]]: Altering a single subset BUFR SYNOP message, by changing value of hour, minute and temperature in section 4, changing update sequence number and changing version number for master table and local table.
 +
 +===== bufrextract.pl =====
 +
 +Extract (raw) BUFR messages and/or AHLs from file(s).
 +
 +[[bufrextract.pl_source|source code]]
 +
 +[[bufrextract.pl_ex1|Example]]: Executing bufrextract.pl without arguments
 +
 +[[bufrextract.pl_help|Example]]: bufrextract.pl %%--%%help
 +
 +[[bufrextract.pl_ahl|Example]]: bufrextract.pl %%--%%ahl
 +
 +[[bufrextract.pl_onlyahl|Example]]: bufrextract.pl %%--%%only_ahl
 +
 +[[bufrextract.pl_ahl_onlyahl|Examples]]: bufrextract.pl %%--%%ahl %%--%%only_ahl
  
 ===== bufrdump.pl ===== ===== bufrdump.pl =====
  
-A BUFR toolkit wouldn't be complete unless you have a way to dump the contents of BUFR files in a way which requires no prior knowledge whatsoever of the BUFR format. Therefore, the program bufrdump.pl is included even though it actually does not employ Geo::BUFR.pm, but rather is a wrapper around a Fortran program ([[bufrdump]]) which uses the ECMWF [[http://www.ecmwf.int/products/data/software/bufr.html|libbufr]] library for the BUFR decoding. The reason for this choice was that for this particular program speed might be important (expecting users to dump huge BUFR files and grep'ing on the output), besides the fact that the main part of the program would be equally boring to code whether in Fortran or Perl.+A BUFR toolkit wouldn't be complete unless you have a way to dump the contents of BUFR files in a way which requires no prior knowledge whatsoever of the BUFR format. Therefore, the program bufrdump.pl is included even though it actually does not employ Geo::BUFR.pm, but rather is a wrapper around a Fortran program (named [[bufrdump|bufrdump]]) which uses the [[https://software.ecmwf.int/wiki/display/BUFR/BUFRDC+Home|ECMWF BUFRDC library]] for the BUFR decoding. The reason for this choice was that for this particular program speed might be important (expecting users to dump huge BUFR files and grep'ing on the output), besides the fact that the main part of the program would be equally boring to code whether in Fortran or Perl.
  
-The parameters are dumped in a ''name=value'' fashion according to what most users at met.no expects, e.g. ''TA=-9.3'' for temperature at 2 m equal to -9.3 Celsius. If your users are accustomed to other symbols and/or units, this should be rather easy to modify in source code of bufrdump.F.+The parameters are dumped in a ''name=value'' fashion according to what most users at Met Norway expects (see [[https://wiki.met.no/kvalobs/kvalobs/kvalobs-parametre_sortert_alfabetisk_etter_kode|Parametere i Kvalobs-databasen]]), e.g. ''TA=-9.3'' for temperature at 2 m equal to -9.3 Celsius. If your users are accustomed to other symbols and/or units, this should be rather easy to modify in source code of bufrdump.F.
  
-So far only dumping of BUFR SYNOP and BUFR TEMP has been implemented. More observation types are likely to be included in the future.+So far dumping of BUFR SYNOPTEMP, AMDAR and BUOY have been implemented (probably works also for PILOT, BATHY and TESAC). More observation types are likely to be included in the future.
  
 [[bufrdump.pl_source|source code]] [[bufrdump.pl_source|source code]]
Line 116: Line 146:
 [[bufrdump.pl_filter|Example]]: Same as the %%--%%param example above, but also with option %%--%%filter set [[bufrdump.pl_filter|Example]]: Same as the %%--%%param example above, but also with option %%--%%filter set
  
-[[bufrdump.pl_sort|Example]]: Same as the %%--%%param example above, but also with option %%--%%sort set+[[bufrdump.pl_sort|Example]]: Same as the %%--%%param example above, but also with option %%--%%sort set, for sorting on station identification
  
 [[bufrdump.pl_sort_on|Example]]: Same as the %%--%%param example above, but also with option %%--%%sort_on TA- set, for sorting on descending temperatures [[bufrdump.pl_sort_on|Example]]: Same as the %%--%%param example above, but also with option %%--%%sort_on TA- set, for sorting on descending temperatures
 +
 +[[bufrdump.pl_syno2|Example]]: Dumping another BUFR SYNOP file with some selected parameters only
 +
 +[[bufrdump.pl_transform|Example]]: Same as above, but this time using %%--transform%% to display wind speed in knots and cloud cover in %
 +
 +[[bufrdump.pl_syno3|Example]]: Dumping yet another BUFR SYNOP file with filter conditions (e.g. stations) and parameters selected on command line
  
 [[bufrdump.pl_temp|Example]]: Dumping a BUFR TEMP message with no options set [[bufrdump.pl_temp|Example]]: Dumping a BUFR TEMP message with no options set
  
 +[[bufrdump.pl_amdar|Example]]: Dumping a BUFR AMDAR file with no options set
 +
 +[[bufrdump.pl_buoy1|Example]]: Dumping a BUFR BUOY file (IOB bulletins) with option %%--%%''obstype ocea''
 +
 +[[bufrdump.pl_buoy2|Example]]: Same as above, but this time with option %%--%%''obstype surface''
  
 ===== Extracting from BUFR tables ===== ===== Extracting from BUFR tables =====
Line 127: Line 168:
 [[#bufrresolve.pl]] does provide several ways of extracting information from BUFR tables, but you might have special needs not covered by the program. Making your own scripts based on Geo::BUFR should not bee too difficult, however. As an illustration, see [[dump_flag_tables.pl]] for a script that dumps all the flag tables in a (hard coded) table file. Running this script produced this [[dump_flag_output|output]]. [[#bufrresolve.pl]] does provide several ways of extracting information from BUFR tables, but you might have special needs not covered by the program. Making your own scripts based on Geo::BUFR should not bee too difficult, however. As an illustration, see [[dump_flag_tables.pl]] for a script that dumps all the flag tables in a (hard coded) table file. Running this script produced this [[dump_flag_output|output]].
  
 +
 +===== Merging BUFR TEMP =====
 +
 +BUFR TEMP should according to WMO regulations be issued on the GTS in one IUK-bulletin containing data up to 100 hPa, and one IUS-bulletin containing the whole sounding. Some centres, however, reformat TAC TEMP part A-D part for part into 4 different BUFR TEMP bulletins, which are very cumbersome to handle in data processing. Therefore [[mergebufrtemp.pl]] was created in the hope that some data producers will find this program useful for doing the necessary merging of (BUFR) TEMP parts. Example of use: <code>  mergebufrtemp.pl <bufr.a> <bufr.b> --outfile <bufr.ab> </code> where the file bufr.a is supposed to contain a BUFR TEMP message converted from BUFR TEMP part A only, bufr.b a BUFR TEMP message converted from BUFR TEMP part B only, and the file bufr.ab is the result of merging these two parts into a BUFR message suitable to be included in an IUK-bulletin. Repeated use of mergebufrtemp.pl might be used to create a file bufr.abcd to be included in the IUS-bulletin, containing the whole ascent.
 +
 +
 +===== Sorting BUFR TEMP =====
 +
 +According to B/C 25.7: "Temperature, dew-point and wind data at pressure levels obtained during the radiosonde ascent shall be included in descending order with respect to pressure. Data at each pressure level shall be included only once". This makes perfect sense, since it is hard to think of any application where you would not prefer to have this ordering and uniqueness of pressure levels. However, many data producers sin against this regulation, and even more astounding: in Note (1) to B/C 25.7 WMO explicitly allows violations of this regulation (for BUFR TEMP converted from TAC TEMP). 
 +
 +Therefore [[sortbufrtemp.pl]] was created to do the necessary sorting of pressure levels and possible merging of duplicate levels (i.e. pressure levels having same value for pressure, time and position coordinates).
 +
 +[[sortbufrtemp.pl_help|Example]]: sortbufrtemp.pl %%--%%help
  • bufr.pm/start.1281626411.txt.gz
  • Last modified: 2022-05-31 09:23:11
  • (external edit)