From ea7a96eab7f7683cdd1239885600c135ef1981ab Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA Date: Fri, 6 Sep 2024 09:57:50 -0600 Subject: [PATCH 1/2] moved web_docs to docs subdirectory --- docs/web_docs/0xSec.html | 194 +++++ docs/web_docs/AAIG.html | 215 ++++++ docs/web_docs/AAIGlong.html | 220 ++++++ docs/web_docs/EUMETSAT.html | 258 +++++++ docs/web_docs/GRIB.html | 209 ++++++ docs/web_docs/MM.html | 187 +++++ docs/web_docs/Match_inv.html | 190 +++++ docs/web_docs/N_ens.html | 192 +++++ docs/web_docs/RT.html | 187 +++++ docs/web_docs/S.html | 184 +++++ docs/web_docs/Sec0.html | 187 +++++ docs/web_docs/Sec3.html | 187 +++++ docs/web_docs/Sec4.html | 188 +++++ docs/web_docs/Sec5.html | 185 +++++ docs/web_docs/Sec6.html | 184 +++++ docs/web_docs/Sec_len.html | 196 +++++ docs/web_docs/T.html | 199 ++++++ docs/web_docs/V.html | 187 +++++ docs/web_docs/VT.html | 199 ++++++ docs/web_docs/YY.html | 185 +++++ docs/web_docs/aerosol_size.html | 197 +++++ docs/web_docs/aerosol_wavelength.html | 186 +++++ docs/web_docs/alarm.html | 212 ++++++ docs/web_docs/all_commands.html | 392 ++++++++++ docs/web_docs/append.html | 188 +++++ docs/web_docs/ave.html | 518 ++++++++++++++ docs/web_docs/ave0.html | 175 +++++ docs/web_docs/ave_fcst_ave_merge_fcst.html | 223 ++++++ docs/web_docs/ave_var.html | 232 ++++++ docs/web_docs/big_endian.html | 187 +++++ docs/web_docs/bin.html | 226 ++++++ docs/web_docs/bin_ieee_text_format.html | 262 +++++++ docs/web_docs/bitmap.html | 205 ++++++ docs/web_docs/box_ave.html | 206 ++++++ docs/web_docs/c_grb2_inq.html | 242 +++++++ docs/web_docs/c_grb2_mk_inv.html | 219 ++++++ docs/web_docs/c_wgrib2api.html | 319 +++++++++ docs/web_docs/callable_wgrib2.html | 246 +++++++ docs/web_docs/calling_wgrib2.html | 254 +++++++ docs/web_docs/center.html | 191 +++++ docs/web_docs/check_pdt_size.html | 192 +++++ docs/web_docs/checksum.html | 270 +++++++ docs/web_docs/code_table.html | 197 +++++ docs/web_docs/colon.html | 196 +++++ docs/web_docs/compile_questions.html | 664 +++++++++++++++++ docs/web_docs/config.html | 224 ++++++ docs/web_docs/convert_wgrib2.html | 293 ++++++++ docs/web_docs/count.html | 200 ++++++ docs/web_docs/cress_lola.html | 231 ++++++ docs/web_docs/crlf.html | 180 +++++ docs/web_docs/csv.html | 344 +++++++++ docs/web_docs/csv_long.html | 310 ++++++++ docs/web_docs/ctl_ens.html | 168 +++++ docs/web_docs/ctl_inv.html | 168 +++++ docs/web_docs/cyclic.html | 210 ++++++ docs/web_docs/d.html | 236 ++++++ docs/web_docs/default_inv.html | 267 +++++++ docs/web_docs/disc.html | 190 +++++ docs/web_docs/domain.html | 175 +++++ docs/web_docs/egrep.html | 260 +++++++ docs/web_docs/egrep_v.html | 260 +++++++ docs/web_docs/else.html | 177 +++++ docs/web_docs/elseif.html | 189 +++++ docs/web_docs/elseif_fs.html | 192 +++++ docs/web_docs/elseif_n.html | 193 +++++ docs/web_docs/elseif_rec.html | 195 +++++ docs/web_docs/elseif_reg.html | 197 +++++ docs/web_docs/end.html | 195 +++++ docs/web_docs/end_FT.html | 200 ++++++ docs/web_docs/end_ft.html | 200 ++++++ docs/web_docs/endif.html | 177 +++++ docs/web_docs/ens.html | 193 +++++ docs/web_docs/ens_processing.html | 480 +++++++++++++ docs/web_docs/ens_qc.html | 338 +++++++++ docs/web_docs/eof_bin.html | 203 ++++++ docs/web_docs/eof_string.html | 203 ++++++ docs/web_docs/err_bin.html | 214 ++++++ docs/web_docs/err_string.html | 214 ++++++ docs/web_docs/error_final.html | 223 ++++++ docs/web_docs/example_merra_2_grib2.html | 225 ++++++ docs/web_docs/export_lonlat.html | 206 ++++++ docs/web_docs/ext_name.html | 284 ++++++++ docs/web_docs/fcst_ave.html | 518 ++++++++++++++ docs/web_docs/fgrep.html | 260 +++++++ docs/web_docs/fgrep_v.html | 260 +++++++ docs/web_docs/fi.html | 208 ++++++ docs/web_docs/fix_CFSv2_fcst.html | 469 ++++++++++++ docs/web_docs/fix_ncep.html | 198 ++++++ docs/web_docs/flush.html | 192 +++++ docs/web_docs/for.html | 202 ++++++ docs/web_docs/for_n.html | 337 +++++++++ docs/web_docs/ftime.html | 275 +++++++ docs/web_docs/ftime1.html | 190 +++++ docs/web_docs/ftime2.html | 198 ++++++ docs/web_docs/ftn_api_fn0.html | 175 +++++ docs/web_docs/full_name.html | 177 +++++ docs/web_docs/function.html | 230 ++++++ docs/web_docs/g2clib.html | 269 +++++++ docs/web_docs/gctpc.html | 310 ++++++++ docs/web_docs/gdt.html | 192 +++++ docs/web_docs/geolocation.html | 245 +++++++ docs/web_docs/get_byte.html | 195 +++++ docs/web_docs/get_hex.html | 205 ++++++ docs/web_docs/get_ieee.html | 195 +++++ docs/web_docs/get_int.html | 193 +++++ docs/web_docs/get_int2.html | 194 +++++ docs/web_docs/grb2_free_file.html | 187 +++++ docs/web_docs/grb2_inq.html | 250 +++++++ docs/web_docs/grb2_inq_scanning.html | 264 +++++++ docs/web_docs/grb2_mk_inv.html | 228 ++++++ docs/web_docs/grb2_undefined.html | 196 +++++ docs/web_docs/grb2_wrt.html | 314 ++++++++ docs/web_docs/grep.html | 260 +++++++ docs/web_docs/grib.html | 205 ++++++ docs/web_docs/grib_ieee.html | 168 +++++ docs/web_docs/grib_max_bits.html | 197 +++++ docs/web_docs/grib_out.html | 221 ++++++ docs/web_docs/grib_out_irr.html | 219 ++++++ docs/web_docs/grib_out_irr2.html | 222 ++++++ docs/web_docs/gribify2.html | 201 ++++++ docs/web_docs/gribify_cmorph.html | 615 ++++++++++++++++ docs/web_docs/gribify_ieee.html | 421 +++++++++++ docs/web_docs/gribtable_used.html | 227 ++++++ docs/web_docs/grid.html | 298 ++++++++ docs/web_docs/grid_101.html | 253 +++++++ docs/web_docs/grid_changes.html | 200 ++++++ docs/web_docs/grid_def.html | 301 ++++++++ docs/web_docs/grid_id.html | 171 +++++ docs/web_docs/gridout.html | 203 ++++++ docs/web_docs/h.html | 205 ++++++ docs/web_docs/header.html | 198 ++++++ docs/web_docs/help.html | 224 ++++++ docs/web_docs/i.html | 319 +++++++++ docs/web_docs/i_file.html | 319 +++++++++ docs/web_docs/ieee.html | 221 ++++++ docs/web_docs/if.html | 329 +++++++++ docs/web_docs/if_block.html | 216 ++++++ docs/web_docs/if_delayed_error.html | 217 ++++++ docs/web_docs/if_fs.html | 191 +++++ docs/web_docs/if_n.html | 212 ++++++ docs/web_docs/if_rec.html | 212 ++++++ docs/web_docs/if_reg.html | 232 ++++++ docs/web_docs/if_structure.html | 289 ++++++++ docs/web_docs/ij.html | 189 +++++ docs/web_docs/ijbox.html | 207 ++++++ docs/web_docs/ijlat.html | 192 +++++ docs/web_docs/ijsmall_grib.html | 209 ++++++ docs/web_docs/ijundefine.html | 221 ++++++ docs/web_docs/ilat.html | 199 ++++++ docs/web_docs/import_bin.html | 247 +++++++ docs/web_docs/import_grib.html | 247 +++++++ docs/web_docs/import_grib_fs.html | 228 ++++++ docs/web_docs/import_ieee.html | 247 +++++++ docs/web_docs/import_lonlat.html | 225 ++++++ docs/web_docs/import_netcdf.html | 431 +++++++++++ docs/web_docs/import_text.html | 247 +++++++ docs/web_docs/index.html | 629 ++++++++++++++++ docs/web_docs/interpolating_NDFD.html | 188 +++++ docs/web_docs/interpolation.html | 228 ++++++ docs/web_docs/inv.html | 217 ++++++ docs/web_docs/inv_f77.html | 206 ++++++ docs/web_docs/irr_grid.html | 218 ++++++ "docs/web_docs/jj\177\177\177" | 580 +++++++++++++++ docs/web_docs/last.html | 216 ++++++ docs/web_docs/last0.html | 191 +++++ docs/web_docs/lev.html | 183 +++++ docs/web_docs/lev0.html | 168 +++++ docs/web_docs/libwgrib2.html | 186 +++++ docs/web_docs/limit.html | 181 +++++ docs/web_docs/limitations.html | 236 ++++++ docs/web_docs/little_endian.html | 187 +++++ docs/web_docs/ll2i.html | 228 ++++++ docs/web_docs/ll2ij.html | 196 +++++ docs/web_docs/lola.html | 222 ++++++ docs/web_docs/lon.html | 315 ++++++++ docs/web_docs/long_cmd_list.html | 538 ++++++++++++++ docs/web_docs/lvl.html | 256 +++++++ docs/web_docs/macros.html | 187 +++++ docs/web_docs/match.html | 286 ++++++++ docs/web_docs/match_fs.html | 218 ++++++ docs/web_docs/match_inv.html | 233 ++++++ docs/web_docs/match_inv_add.html | 224 ++++++ docs/web_docs/match_inv_f77.html | 222 ++++++ docs/web_docs/max.html | 234 ++++++ docs/web_docs/mem_blocks.html | 209 ++++++ docs/web_docs/mem_del.html | 201 ++++++ docs/web_docs/mem_final.html | 202 ++++++ docs/web_docs/mem_init.html | 215 ++++++ docs/web_docs/merge_fcst.html | 249 +++++++ docs/web_docs/min.html | 234 ++++++ docs/web_docs/misc.html | 203 ++++++ docs/web_docs/mpe.png | Bin 0 -> 16091 bytes docs/web_docs/n.html | 220 ++++++ docs/web_docs/names.html | 291 ++++++++ docs/web_docs/nc3.html | 203 ++++++ docs/web_docs/nc4.html | 203 ++++++ docs/web_docs/nc_grads.html | 552 ++++++++++++++ docs/web_docs/nc_nlev.html | 552 ++++++++++++++ docs/web_docs/nc_pack.html | 552 ++++++++++++++ docs/web_docs/nc_table.html | 557 +++++++++++++++ docs/web_docs/nc_time.html | 552 ++++++++++++++ docs/web_docs/ncep_norm.html | 303 ++++++++ docs/web_docs/ncep_uv.html | 205 ++++++ docs/web_docs/ncpu.html | 205 ++++++ docs/web_docs/ndate.html | 230 ++++++ docs/web_docs/ndates.html | 389 ++++++++++ docs/web_docs/ndates_fmt.html | 227 ++++++ docs/web_docs/netcdf.html | 642 +++++++++++++++++ docs/web_docs/netcdf_2_grib_ostia.html | 331 +++++++++ docs/web_docs/new_grib.html | 208 ++++++ docs/web_docs/new_grid.html | 671 ++++++++++++++++++ docs/web_docs/new_grid_format.html | 253 +++++++ docs/web_docs/new_grid_interpolation.html | 241 +++++++ docs/web_docs/new_grid_intro.html | 436 ++++++++++++ docs/web_docs/new_grid_ipopt.html | 236 ++++++ docs/web_docs/new_grid_order.html | 244 +++++++ docs/web_docs/new_grid_usage.html | 285 ++++++++ docs/web_docs/new_grid_v2.html | 187 +++++ docs/web_docs/new_grid_vectors.html | 201 ++++++ docs/web_docs/new_grid_winds.html | 202 ++++++ docs/web_docs/nl.html | 189 +++++ docs/web_docs/nl_out.html | 189 +++++ docs/web_docs/nlons.html | 214 ++++++ docs/web_docs/no_append.html | 188 +++++ docs/web_docs/no_flush.html | 182 +++++ docs/web_docs/no_header.html | 198 ++++++ docs/web_docs/no_nc_grads.html | 552 ++++++++++++++ docs/web_docs/no_nc_pack.html | 552 ++++++++++++++ docs/web_docs/no_nc_table.html | 552 ++++++++++++++ docs/web_docs/no_nc_time.html | 552 ++++++++++++++ docs/web_docs/not.html | 242 +++++++ docs/web_docs/not_fs.html | 240 +++++++ docs/web_docs/not_if.html | 199 ++++++ docs/web_docs/not_if_fs.html | 183 +++++ docs/web_docs/npts.html | 180 +++++ ...r_of_coordinate_values_after_template.html | 226 ++++++ docs/web_docs/nxny.html | 190 +++++ docs/web_docs/one_line.html | 196 +++++ docs/web_docs/openmp.html | 254 +++++++ docs/web_docs/order.html | 195 +++++ docs/web_docs/packing.html | 213 ++++++ docs/web_docs/pds_fcst_time.html | 208 ++++++ docs/web_docs/pdt.html | 188 +++++ docs/web_docs/persistent.html | 190 +++++ docs/web_docs/pipes.html | 250 +++++++ docs/web_docs/precision.html | 212 ++++++ docs/web_docs/print.html | 184 +++++ docs/web_docs/print_out.html | 204 ++++++ docs/web_docs/prob.html | 203 ++++++ docs/web_docs/problems.html | 284 ++++++++ docs/web_docs/process.html | 190 +++++ docs/web_docs/processid.html | 188 +++++ docs/web_docs/proj4.html | 317 +++++++++ docs/web_docs/py_wgrib2api.html | 206 ++++++ docs/web_docs/pywgrib2.html | 251 +++++++ docs/web_docs/pywgrib2_s.html | 343 +++++++++ docs/web_docs/pywgrib2_s_close.html | 201 ++++++ docs/web_docs/pywgrib2_s_conventions.html | 213 ++++++ .../web_docs/pywgrib2_s_global_variables.html | 197 +++++ docs/web_docs/pywgrib2_s_inq.html | 346 +++++++++ docs/web_docs/pywgrib2_s_install.html | 241 +++++++ docs/web_docs/pywgrib2_s_mk_inv.html | 209 ++++++ docs/web_docs/pywgrib2_s_read_inv.html | 194 +++++ docs/web_docs/pywgrib2_s_wgrib2.html | 286 ++++++++ docs/web_docs/pywgrib2_s_write.html | 312 ++++++++ docs/web_docs/quit.html | 211 ++++++ docs/web_docs/radius.html | 188 +++++ docs/web_docs/range.html | 168 +++++ docs/web_docs/read_sec.html | 188 +++++ docs/web_docs/reduced_gaussian_grid.html | 264 +++++++ docs/web_docs/reset_delayed_error.html | 229 ++++++ docs/web_docs/rewind_final.html | 196 +++++ docs/web_docs/rewind_init.html | 196 +++++ docs/web_docs/rewind_proc.html | 194 +++++ docs/web_docs/rpn.html | 579 +++++++++++++++ docs/web_docs/rpn_non-trivial_example.html | 293 ++++++++ docs/web_docs/rpn_raw2_2raw.html | 277 ++++++++ docs/web_docs/rpn_rcl.html | 182 +++++ docs/web_docs/rpn_smth9.html | 192 +++++ docs/web_docs/rpn_sto.html | 183 +++++ docs/web_docs/rpn_wind-chill.html | 228 ++++++ docs/web_docs/s.html | 196 +++++ docs/web_docs/s_out.html | 193 +++++ docs/web_docs/scale.html | 200 ++++++ docs/web_docs/scaling.html | 203 ++++++ docs/web_docs/scaling_0001.html | 204 ++++++ docs/web_docs/scan.html | 249 +++++++ docs/web_docs/selecting_messages.html | 189 +++++ docs/web_docs/set.html | 261 +++++++ docs/web_docs/set_ave.html | 179 +++++ docs/web_docs/set_bin_prec.html | 240 +++++++ docs/web_docs/set_bitmap.html | 208 ++++++ docs/web_docs/set_byte.html | 199 ++++++ docs/web_docs/set_center.html | 170 +++++ docs/web_docs/set_date.html | 246 +++++++ docs/web_docs/set_ens_num.html | 217 ++++++ docs/web_docs/set_ensm_derived_fcst.html | 201 ++++++ docs/web_docs/set_ext_name.html | 264 +++++++ docs/web_docs/set_ext_name_chars.html | 213 ++++++ docs/web_docs/set_ftime.html | 205 ++++++ docs/web_docs/set_ftime1.html | 177 +++++ docs/web_docs/set_ftime_mode.html | 236 ++++++ docs/web_docs/set_grib_max_bits.html | 226 ++++++ docs/web_docs/set_grib_type.html | 236 ++++++ docs/web_docs/set_hex.html | 256 +++++++ docs/web_docs/set_ieee.html | 196 +++++ docs/web_docs/set_ijval.html | 196 +++++ docs/web_docs/set_int.html | 204 ++++++ docs/web_docs/set_int2.html | 203 ++++++ docs/web_docs/set_ival.html | 195 +++++ docs/web_docs/set_lev.html | 251 +++++++ docs/web_docs/set_lvl1.html | 265 +++++++ docs/web_docs/set_metadata.html | 285 ++++++++ docs/web_docs/set_metadata_str.html | 191 +++++ docs/web_docs/set_pdt.html | 229 ++++++ docs/web_docs/set_percentile.html | 196 +++++ docs/web_docs/set_prob.html | 218 ++++++ docs/web_docs/set_radius.html | 205 ++++++ docs/web_docs/set_regex.html | 273 +++++++ docs/web_docs/set_scaling.html | 257 +++++++ docs/web_docs/set_sec_size.html | 203 ++++++ docs/web_docs/set_subcenter.html | 170 +++++ docs/web_docs/set_ts_dates.html | 216 ++++++ docs/web_docs/set_var.html | 258 +++++++ docs/web_docs/short_cmd_list.html | 463 ++++++++++++ docs/web_docs/single_dual_stream.png | Bin 0 -> 28920 bytes docs/web_docs/small_fast_databases.html | 248 +++++++ docs/web_docs/small_grib.html | 242 +++++++ docs/web_docs/spatial_proc.html | 200 ++++++ docs/web_docs/special_file_names.html | 305 ++++++++ docs/web_docs/speed.html | 306 ++++++++ docs/web_docs/spread.html | 232 ++++++ docs/web_docs/start_FT.html | 200 ++++++ docs/web_docs/start_ft.html | 200 ++++++ docs/web_docs/stats.html | 234 ++++++ docs/web_docs/status.html | 179 +++++ docs/web_docs/subcenter.html | 191 +++++ docs/web_docs/submessages.html | 233 ++++++ docs/web_docs/submsg.html | 241 +++++++ docs/web_docs/submsg_uv.html | 205 ++++++ docs/web_docs/sys.html | 190 +++++ docs/web_docs/t.html | 199 ++++++ docs/web_docs/table.html | 182 +++++ docs/web_docs/text.html | 214 ++++++ docs/web_docs/text_col.html | 197 +++++ docs/web_docs/tigge.html | 174 +++++ docs/web_docs/time.html | 199 ++++++ docs/web_docs/time_interpolation.html | 228 ++++++ docs/web_docs/time_processing.html | 526 ++++++++++++++ docs/web_docs/timer.html | 215 ++++++ docs/web_docs/tosubmsg.html | 258 +++++++ docs/web_docs/transient.html | 190 +++++ docs/web_docs/type_reftime.html | 201 ++++++ docs/web_docs/types.html | 400 +++++++++++ docs/web_docs/udf.html | 202 ++++++ docs/web_docs/undefine.html | 213 ++++++ docs/web_docs/undefine_val.html | 201 ++++++ docs/web_docs/unix_time.html | 218 ++++++ docs/web_docs/unmerge_fcst.html | 302 ++++++++ docs/web_docs/update_2.0.8.html | 209 ++++++ docs/web_docs/usage_questions.html | 190 +++++ docs/web_docs/user_grib2tables.html | 323 +++++++++ docs/web_docs/v.html | 196 +++++ docs/web_docs/v0.html | 196 +++++ docs/web_docs/v1.html | 196 +++++ docs/web_docs/v2.html | 196 +++++ docs/web_docs/var.html | 240 +++++++ docs/web_docs/varX.html | 252 +++++++ docs/web_docs/vector_dir.html | 215 ++++++ docs/web_docs/verf.html | 187 +++++ docs/web_docs/version.html | 186 +++++ docs/web_docs/vt.html | 199 ++++++ docs/web_docs/wgrib2_dev.html | 204 ++++++ docs/web_docs/wgrib2_hello_world.html | 208 ++++++ docs/web_docs/wgrib2_memory.html | 251 +++++++ docs/web_docs/wgrib2_options.html | 279 ++++++++ docs/web_docs/wgrib2_scripts.html | 187 +++++ docs/web_docs/wgrib2_utility_callable.html | 244 +++++++ docs/web_docs/wgrib2_v3.0.0_changes.html | 205 ++++++ docs/web_docs/wgrib2_v3.0.2_changes.html | 216 ++++++ docs/web_docs/wgrib2_v3.1.0_changes.html | 186 +++++ docs/web_docs/wgrib2_v3.1.1_changes.html | 220 ++++++ docs/web_docs/wgrib2_v3.1.2_changes.html | 262 +++++++ docs/web_docs/wgrib2_v3.1.3_changes.html | 225 ++++++ docs/web_docs/wgrib2api.html | 370 ++++++++++ docs/web_docs/wgrib2api_ave_rh.html | 299 ++++++++ docs/web_docs/wgrib2api_hpc.html | 216 ++++++ docs/web_docs/wgrib2m.html | 418 +++++++++++ docs/web_docs/wgrib2ms.html | 254 +++++++ docs/web_docs/wind_dir.html | 224 ++++++ docs/web_docs/wind_speed.html | 204 ++++++ docs/web_docs/wind_uv.html | 215 ++++++ docs/web_docs/write_sec.html | 189 +++++ 393 files changed, 95490 insertions(+) create mode 100644 docs/web_docs/0xSec.html create mode 100644 docs/web_docs/AAIG.html create mode 100644 docs/web_docs/AAIGlong.html create mode 100644 docs/web_docs/EUMETSAT.html create mode 100644 docs/web_docs/GRIB.html create mode 100644 docs/web_docs/MM.html create mode 100644 docs/web_docs/Match_inv.html create mode 100644 docs/web_docs/N_ens.html create mode 100644 docs/web_docs/RT.html create mode 100644 docs/web_docs/S.html create mode 100644 docs/web_docs/Sec0.html create mode 100644 docs/web_docs/Sec3.html create mode 100644 docs/web_docs/Sec4.html create mode 100644 docs/web_docs/Sec5.html create mode 100644 docs/web_docs/Sec6.html create mode 100644 docs/web_docs/Sec_len.html create mode 100644 docs/web_docs/T.html create mode 100644 docs/web_docs/V.html create mode 100644 docs/web_docs/VT.html create mode 100644 docs/web_docs/YY.html create mode 100644 docs/web_docs/aerosol_size.html create mode 100644 docs/web_docs/aerosol_wavelength.html create mode 100644 docs/web_docs/alarm.html create mode 100644 docs/web_docs/all_commands.html create mode 100644 docs/web_docs/append.html create mode 100644 docs/web_docs/ave.html create mode 100644 docs/web_docs/ave0.html create mode 100644 docs/web_docs/ave_fcst_ave_merge_fcst.html create mode 100644 docs/web_docs/ave_var.html create mode 100644 docs/web_docs/big_endian.html create mode 100644 docs/web_docs/bin.html create mode 100644 docs/web_docs/bin_ieee_text_format.html create mode 100644 docs/web_docs/bitmap.html create mode 100644 docs/web_docs/box_ave.html create mode 100644 docs/web_docs/c_grb2_inq.html create mode 100644 docs/web_docs/c_grb2_mk_inv.html create mode 100644 docs/web_docs/c_wgrib2api.html create mode 100644 docs/web_docs/callable_wgrib2.html create mode 100644 docs/web_docs/calling_wgrib2.html create mode 100644 docs/web_docs/center.html create mode 100644 docs/web_docs/check_pdt_size.html create mode 100644 docs/web_docs/checksum.html create mode 100644 docs/web_docs/code_table.html create mode 100644 docs/web_docs/colon.html create mode 100644 docs/web_docs/compile_questions.html create mode 100644 docs/web_docs/config.html create mode 100644 docs/web_docs/convert_wgrib2.html create mode 100644 docs/web_docs/count.html create mode 100644 docs/web_docs/cress_lola.html create mode 100644 docs/web_docs/crlf.html create mode 100644 docs/web_docs/csv.html create mode 100644 docs/web_docs/csv_long.html create mode 100644 docs/web_docs/ctl_ens.html create mode 100644 docs/web_docs/ctl_inv.html create mode 100644 docs/web_docs/cyclic.html create mode 100644 docs/web_docs/d.html create mode 100644 docs/web_docs/default_inv.html create mode 100644 docs/web_docs/disc.html create mode 100644 docs/web_docs/domain.html create mode 100644 docs/web_docs/egrep.html create mode 100644 docs/web_docs/egrep_v.html create mode 100644 docs/web_docs/else.html create mode 100644 docs/web_docs/elseif.html create mode 100644 docs/web_docs/elseif_fs.html create mode 100644 docs/web_docs/elseif_n.html create mode 100644 docs/web_docs/elseif_rec.html create mode 100644 docs/web_docs/elseif_reg.html create mode 100644 docs/web_docs/end.html create mode 100644 docs/web_docs/end_FT.html create mode 100644 docs/web_docs/end_ft.html create mode 100644 docs/web_docs/endif.html create mode 100644 docs/web_docs/ens.html create mode 100644 docs/web_docs/ens_processing.html create mode 100644 docs/web_docs/ens_qc.html create mode 100644 docs/web_docs/eof_bin.html create mode 100644 docs/web_docs/eof_string.html create mode 100644 docs/web_docs/err_bin.html create mode 100644 docs/web_docs/err_string.html create mode 100644 docs/web_docs/error_final.html create mode 100644 docs/web_docs/example_merra_2_grib2.html create mode 100644 docs/web_docs/export_lonlat.html create mode 100644 docs/web_docs/ext_name.html create mode 100644 docs/web_docs/fcst_ave.html create mode 100644 docs/web_docs/fgrep.html create mode 100644 docs/web_docs/fgrep_v.html create mode 100644 docs/web_docs/fi.html create mode 100644 docs/web_docs/fix_CFSv2_fcst.html create mode 100644 docs/web_docs/fix_ncep.html create mode 100644 docs/web_docs/flush.html create mode 100644 docs/web_docs/for.html create mode 100644 docs/web_docs/for_n.html create mode 100644 docs/web_docs/ftime.html create mode 100644 docs/web_docs/ftime1.html create mode 100644 docs/web_docs/ftime2.html create mode 100644 docs/web_docs/ftn_api_fn0.html create mode 100644 docs/web_docs/full_name.html create mode 100644 docs/web_docs/function.html create mode 100644 docs/web_docs/g2clib.html create mode 100644 docs/web_docs/gctpc.html create mode 100644 docs/web_docs/gdt.html create mode 100644 docs/web_docs/geolocation.html create mode 100644 docs/web_docs/get_byte.html create mode 100644 docs/web_docs/get_hex.html create mode 100644 docs/web_docs/get_ieee.html create mode 100644 docs/web_docs/get_int.html create mode 100644 docs/web_docs/get_int2.html create mode 100644 docs/web_docs/grb2_free_file.html create mode 100644 docs/web_docs/grb2_inq.html create mode 100644 docs/web_docs/grb2_inq_scanning.html create mode 100644 docs/web_docs/grb2_mk_inv.html create mode 100644 docs/web_docs/grb2_undefined.html create mode 100644 docs/web_docs/grb2_wrt.html create mode 100644 docs/web_docs/grep.html create mode 100644 docs/web_docs/grib.html create mode 100644 docs/web_docs/grib_ieee.html create mode 100644 docs/web_docs/grib_max_bits.html create mode 100644 docs/web_docs/grib_out.html create mode 100644 docs/web_docs/grib_out_irr.html create mode 100644 docs/web_docs/grib_out_irr2.html create mode 100644 docs/web_docs/gribify2.html create mode 100644 docs/web_docs/gribify_cmorph.html create mode 100644 docs/web_docs/gribify_ieee.html create mode 100644 docs/web_docs/gribtable_used.html create mode 100644 docs/web_docs/grid.html create mode 100644 docs/web_docs/grid_101.html create mode 100644 docs/web_docs/grid_changes.html create mode 100644 docs/web_docs/grid_def.html create mode 100644 docs/web_docs/grid_id.html create mode 100644 docs/web_docs/gridout.html create mode 100644 docs/web_docs/h.html create mode 100644 docs/web_docs/header.html create mode 100644 docs/web_docs/help.html create mode 100644 docs/web_docs/i.html create mode 100644 docs/web_docs/i_file.html create mode 100644 docs/web_docs/ieee.html create mode 100644 docs/web_docs/if.html create mode 100644 docs/web_docs/if_block.html create mode 100644 docs/web_docs/if_delayed_error.html create mode 100644 docs/web_docs/if_fs.html create mode 100644 docs/web_docs/if_n.html create mode 100644 docs/web_docs/if_rec.html create mode 100644 docs/web_docs/if_reg.html create mode 100644 docs/web_docs/if_structure.html create mode 100644 docs/web_docs/ij.html create mode 100644 docs/web_docs/ijbox.html create mode 100644 docs/web_docs/ijlat.html create mode 100644 docs/web_docs/ijsmall_grib.html create mode 100644 docs/web_docs/ijundefine.html create mode 100644 docs/web_docs/ilat.html create mode 100644 docs/web_docs/import_bin.html create mode 100644 docs/web_docs/import_grib.html create mode 100644 docs/web_docs/import_grib_fs.html create mode 100644 docs/web_docs/import_ieee.html create mode 100644 docs/web_docs/import_lonlat.html create mode 100644 docs/web_docs/import_netcdf.html create mode 100644 docs/web_docs/import_text.html create mode 100644 docs/web_docs/index.html create mode 100644 docs/web_docs/interpolating_NDFD.html create mode 100644 docs/web_docs/interpolation.html create mode 100644 docs/web_docs/inv.html create mode 100644 docs/web_docs/inv_f77.html create mode 100644 docs/web_docs/irr_grid.html create mode 100644 "docs/web_docs/jj\177\177\177" create mode 100644 docs/web_docs/last.html create mode 100644 docs/web_docs/last0.html create mode 100644 docs/web_docs/lev.html create mode 100644 docs/web_docs/lev0.html create mode 100644 docs/web_docs/libwgrib2.html create mode 100644 docs/web_docs/limit.html create mode 100644 docs/web_docs/limitations.html create mode 100644 docs/web_docs/little_endian.html create mode 100644 docs/web_docs/ll2i.html create mode 100644 docs/web_docs/ll2ij.html create mode 100644 docs/web_docs/lola.html create mode 100644 docs/web_docs/lon.html create mode 100644 docs/web_docs/long_cmd_list.html create mode 100644 docs/web_docs/lvl.html create mode 100644 docs/web_docs/macros.html create mode 100644 docs/web_docs/match.html create mode 100644 docs/web_docs/match_fs.html create mode 100644 docs/web_docs/match_inv.html create mode 100644 docs/web_docs/match_inv_add.html create mode 100644 docs/web_docs/match_inv_f77.html create mode 100644 docs/web_docs/max.html create mode 100644 docs/web_docs/mem_blocks.html create mode 100644 docs/web_docs/mem_del.html create mode 100644 docs/web_docs/mem_final.html create mode 100644 docs/web_docs/mem_init.html create mode 100644 docs/web_docs/merge_fcst.html create mode 100644 docs/web_docs/min.html create mode 100644 docs/web_docs/misc.html create mode 100644 docs/web_docs/mpe.png create mode 100644 docs/web_docs/n.html create mode 100644 docs/web_docs/names.html create mode 100644 docs/web_docs/nc3.html create mode 100644 docs/web_docs/nc4.html create mode 100644 docs/web_docs/nc_grads.html create mode 100644 docs/web_docs/nc_nlev.html create mode 100644 docs/web_docs/nc_pack.html create mode 100644 docs/web_docs/nc_table.html create mode 100644 docs/web_docs/nc_time.html create mode 100644 docs/web_docs/ncep_norm.html create mode 100644 docs/web_docs/ncep_uv.html create mode 100644 docs/web_docs/ncpu.html create mode 100644 docs/web_docs/ndate.html create mode 100644 docs/web_docs/ndates.html create mode 100644 docs/web_docs/ndates_fmt.html create mode 100644 docs/web_docs/netcdf.html create mode 100644 docs/web_docs/netcdf_2_grib_ostia.html create mode 100644 docs/web_docs/new_grib.html create mode 100644 docs/web_docs/new_grid.html create mode 100644 docs/web_docs/new_grid_format.html create mode 100644 docs/web_docs/new_grid_interpolation.html create mode 100644 docs/web_docs/new_grid_intro.html create mode 100644 docs/web_docs/new_grid_ipopt.html create mode 100644 docs/web_docs/new_grid_order.html create mode 100644 docs/web_docs/new_grid_usage.html create mode 100644 docs/web_docs/new_grid_v2.html create mode 100644 docs/web_docs/new_grid_vectors.html create mode 100644 docs/web_docs/new_grid_winds.html create mode 100644 docs/web_docs/nl.html create mode 100644 docs/web_docs/nl_out.html create mode 100644 docs/web_docs/nlons.html create mode 100644 docs/web_docs/no_append.html create mode 100644 docs/web_docs/no_flush.html create mode 100644 docs/web_docs/no_header.html create mode 100644 docs/web_docs/no_nc_grads.html create mode 100644 docs/web_docs/no_nc_pack.html create mode 100644 docs/web_docs/no_nc_table.html create mode 100644 docs/web_docs/no_nc_time.html create mode 100644 docs/web_docs/not.html create mode 100644 docs/web_docs/not_fs.html create mode 100644 docs/web_docs/not_if.html create mode 100644 docs/web_docs/not_if_fs.html create mode 100644 docs/web_docs/npts.html create mode 100644 docs/web_docs/number_of_coordinate_values_after_template.html create mode 100644 docs/web_docs/nxny.html create mode 100644 docs/web_docs/one_line.html create mode 100644 docs/web_docs/openmp.html create mode 100644 docs/web_docs/order.html create mode 100644 docs/web_docs/packing.html create mode 100644 docs/web_docs/pds_fcst_time.html create mode 100644 docs/web_docs/pdt.html create mode 100644 docs/web_docs/persistent.html create mode 100644 docs/web_docs/pipes.html create mode 100644 docs/web_docs/precision.html create mode 100644 docs/web_docs/print.html create mode 100644 docs/web_docs/print_out.html create mode 100644 docs/web_docs/prob.html create mode 100644 docs/web_docs/problems.html create mode 100644 docs/web_docs/process.html create mode 100644 docs/web_docs/processid.html create mode 100644 docs/web_docs/proj4.html create mode 100644 docs/web_docs/py_wgrib2api.html create mode 100644 docs/web_docs/pywgrib2.html create mode 100644 docs/web_docs/pywgrib2_s.html create mode 100644 docs/web_docs/pywgrib2_s_close.html create mode 100644 docs/web_docs/pywgrib2_s_conventions.html create mode 100644 docs/web_docs/pywgrib2_s_global_variables.html create mode 100644 docs/web_docs/pywgrib2_s_inq.html create mode 100644 docs/web_docs/pywgrib2_s_install.html create mode 100644 docs/web_docs/pywgrib2_s_mk_inv.html create mode 100644 docs/web_docs/pywgrib2_s_read_inv.html create mode 100644 docs/web_docs/pywgrib2_s_wgrib2.html create mode 100644 docs/web_docs/pywgrib2_s_write.html create mode 100644 docs/web_docs/quit.html create mode 100644 docs/web_docs/radius.html create mode 100644 docs/web_docs/range.html create mode 100644 docs/web_docs/read_sec.html create mode 100644 docs/web_docs/reduced_gaussian_grid.html create mode 100644 docs/web_docs/reset_delayed_error.html create mode 100644 docs/web_docs/rewind_final.html create mode 100644 docs/web_docs/rewind_init.html create mode 100644 docs/web_docs/rewind_proc.html create mode 100644 docs/web_docs/rpn.html create mode 100644 docs/web_docs/rpn_non-trivial_example.html create mode 100644 docs/web_docs/rpn_raw2_2raw.html create mode 100644 docs/web_docs/rpn_rcl.html create mode 100644 docs/web_docs/rpn_smth9.html create mode 100644 docs/web_docs/rpn_sto.html create mode 100644 docs/web_docs/rpn_wind-chill.html create mode 100644 docs/web_docs/s.html create mode 100644 docs/web_docs/s_out.html create mode 100644 docs/web_docs/scale.html create mode 100644 docs/web_docs/scaling.html create mode 100644 docs/web_docs/scaling_0001.html create mode 100644 docs/web_docs/scan.html create mode 100644 docs/web_docs/selecting_messages.html create mode 100644 docs/web_docs/set.html create mode 100644 docs/web_docs/set_ave.html create mode 100644 docs/web_docs/set_bin_prec.html create mode 100644 docs/web_docs/set_bitmap.html create mode 100644 docs/web_docs/set_byte.html create mode 100644 docs/web_docs/set_center.html create mode 100644 docs/web_docs/set_date.html create mode 100644 docs/web_docs/set_ens_num.html create mode 100644 docs/web_docs/set_ensm_derived_fcst.html create mode 100644 docs/web_docs/set_ext_name.html create mode 100644 docs/web_docs/set_ext_name_chars.html create mode 100644 docs/web_docs/set_ftime.html create mode 100644 docs/web_docs/set_ftime1.html create mode 100644 docs/web_docs/set_ftime_mode.html create mode 100644 docs/web_docs/set_grib_max_bits.html create mode 100644 docs/web_docs/set_grib_type.html create mode 100644 docs/web_docs/set_hex.html create mode 100644 docs/web_docs/set_ieee.html create mode 100644 docs/web_docs/set_ijval.html create mode 100644 docs/web_docs/set_int.html create mode 100644 docs/web_docs/set_int2.html create mode 100644 docs/web_docs/set_ival.html create mode 100644 docs/web_docs/set_lev.html create mode 100644 docs/web_docs/set_lvl1.html create mode 100644 docs/web_docs/set_metadata.html create mode 100644 docs/web_docs/set_metadata_str.html create mode 100644 docs/web_docs/set_pdt.html create mode 100644 docs/web_docs/set_percentile.html create mode 100644 docs/web_docs/set_prob.html create mode 100644 docs/web_docs/set_radius.html create mode 100644 docs/web_docs/set_regex.html create mode 100644 docs/web_docs/set_scaling.html create mode 100644 docs/web_docs/set_sec_size.html create mode 100644 docs/web_docs/set_subcenter.html create mode 100644 docs/web_docs/set_ts_dates.html create mode 100644 docs/web_docs/set_var.html create mode 100644 docs/web_docs/short_cmd_list.html create mode 100644 docs/web_docs/single_dual_stream.png create mode 100644 docs/web_docs/small_fast_databases.html create mode 100644 docs/web_docs/small_grib.html create mode 100644 docs/web_docs/spatial_proc.html create mode 100644 docs/web_docs/special_file_names.html create mode 100644 docs/web_docs/speed.html create mode 100644 docs/web_docs/spread.html create mode 100644 docs/web_docs/start_FT.html create mode 100644 docs/web_docs/start_ft.html create mode 100644 docs/web_docs/stats.html create mode 100644 docs/web_docs/status.html create mode 100644 docs/web_docs/subcenter.html create mode 100644 docs/web_docs/submessages.html create mode 100644 docs/web_docs/submsg.html create mode 100644 docs/web_docs/submsg_uv.html create mode 100644 docs/web_docs/sys.html create mode 100644 docs/web_docs/t.html create mode 100644 docs/web_docs/table.html create mode 100644 docs/web_docs/text.html create mode 100644 docs/web_docs/text_col.html create mode 100644 docs/web_docs/tigge.html create mode 100644 docs/web_docs/time.html create mode 100644 docs/web_docs/time_interpolation.html create mode 100644 docs/web_docs/time_processing.html create mode 100644 docs/web_docs/timer.html create mode 100644 docs/web_docs/tosubmsg.html create mode 100644 docs/web_docs/transient.html create mode 100644 docs/web_docs/type_reftime.html create mode 100644 docs/web_docs/types.html create mode 100644 docs/web_docs/udf.html create mode 100644 docs/web_docs/undefine.html create mode 100644 docs/web_docs/undefine_val.html create mode 100644 docs/web_docs/unix_time.html create mode 100644 docs/web_docs/unmerge_fcst.html create mode 100644 docs/web_docs/update_2.0.8.html create mode 100644 docs/web_docs/usage_questions.html create mode 100644 docs/web_docs/user_grib2tables.html create mode 100644 docs/web_docs/v.html create mode 100644 docs/web_docs/v0.html create mode 100644 docs/web_docs/v1.html create mode 100644 docs/web_docs/v2.html create mode 100644 docs/web_docs/var.html create mode 100644 docs/web_docs/varX.html create mode 100644 docs/web_docs/vector_dir.html create mode 100644 docs/web_docs/verf.html create mode 100644 docs/web_docs/version.html create mode 100644 docs/web_docs/vt.html create mode 100644 docs/web_docs/wgrib2_dev.html create mode 100644 docs/web_docs/wgrib2_hello_world.html create mode 100644 docs/web_docs/wgrib2_memory.html create mode 100644 docs/web_docs/wgrib2_options.html create mode 100644 docs/web_docs/wgrib2_scripts.html create mode 100644 docs/web_docs/wgrib2_utility_callable.html create mode 100644 docs/web_docs/wgrib2_v3.0.0_changes.html create mode 100644 docs/web_docs/wgrib2_v3.0.2_changes.html create mode 100644 docs/web_docs/wgrib2_v3.1.0_changes.html create mode 100644 docs/web_docs/wgrib2_v3.1.1_changes.html create mode 100644 docs/web_docs/wgrib2_v3.1.2_changes.html create mode 100644 docs/web_docs/wgrib2_v3.1.3_changes.html create mode 100644 docs/web_docs/wgrib2api.html create mode 100644 docs/web_docs/wgrib2api_ave_rh.html create mode 100644 docs/web_docs/wgrib2api_hpc.html create mode 100644 docs/web_docs/wgrib2m.html create mode 100644 docs/web_docs/wgrib2ms.html create mode 100644 docs/web_docs/wind_dir.html create mode 100644 docs/web_docs/wind_speed.html create mode 100644 docs/web_docs/wind_uv.html create mode 100644 docs/web_docs/write_sec.html diff --git a/docs/web_docs/0xSec.html b/docs/web_docs/0xSec.html new file mode 100644 index 0000000..19767c6 --- /dev/null +++ b/docs/web_docs/0xSec.html @@ -0,0 +1,194 @@ + + + + Climate Prediction Center - wgrib2: -0xSec + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -0xSec +
 
+ +

wgrib2: -0xSec

+
+ + +

Introduction:

+ +

+The -0xSec option prints a hex dump of any of +the grib sections. The format of the hex dump depends on the +verbosity level. +

+ +
+$ wgrib2 png.grb2 -0xSec 0
+1:4:Sec0(1..16)=0x4752494200000002000000000000ad9c
+$ wgrib2 png.grb2 -0xSec 0 -v1
+1:4:Sec0(1..16)= 47 52 49 42 00 00 00 02 00 00 00 00 00 00 ad 9c
+$ wgrib2 png.grb2 -0xSec 0 -v2
+1:4:Sec0(1..16)=1:47 2:52 3:49 4:42 5:00 6:00 7:00 8:02 9:00 10:00 11:00 12:00 13:00 14:00 15:ad
+  16:9c 
+
+The above 3 examples show a hex dump of Section 0 using the different 
+verbosity levels.
+
+ +

Usage

+

+ +

+-0xSec N
+N = Section Number
+
+ +See also: +-Sec_len, +-checksum, + +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/AAIG.html b/docs/web_docs/AAIG.html new file mode 100644 index 0000000..3bf44c6 --- /dev/null +++ b/docs/web_docs/AAIG.html @@ -0,0 +1,215 @@ + + + + Climate Prediction Center - wgrib2: -AAIG + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-AAIG +
 
+ +

wgrib2: -AAIG

+

Ascii ArcInfo Grid

+
+ + +

Introduction

+ +

+The -AAIG option writes the data into a Ascii ArcInfo Grid file. +This option is experimental and only supports equally spaced lat-lon grids. +My reading of the format specifications that each file contains a single grid. +Therefore, each field is written to different file (*.asc) which +is written to the current directory. + +

File name convention for ouput: *.asc

+ +

+The file name convention + +

+   NAME = grib name (-var), ex. TEMP, HGT  
+   LEVEL = level, ex. surface, 2_m_above_ground, 500_mb
+   RT = reference time YYYYMMDDHH
+   VT = verification time (end_ft) YYYYMMDDHH
+
+   If RT is the same as VT
+     output = NAME.LEVEL.RT.asc
+
+   If RT is different than VT
+     output = NAME.LEVEL.RT.VT.asc
+
+ +

Problems with file name convention

+ +

The above file name convention works for a simple GFS forecast. +However, life quickly gets more complicated and a new file name +convention was needed (-AAIGlong). + +

Usage

+

+ +

+-AAIG
+
+ + +

Example

+

+

+wgrib2 in_file -match ':HGT:400 mb:' -AAIG
+
+The above line converts all the 400 mb HGT fields into an +arcinfo ascii grid file. + + +

+See also: -AAIGlong, +-csv +

+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: July 30, 2008 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/AAIGlong.html b/docs/web_docs/AAIGlong.html new file mode 100644 index 0000000..732dcba --- /dev/null +++ b/docs/web_docs/AAIGlong.html @@ -0,0 +1,220 @@ + + + + Climate Prediction Center - wgrib2: -AAIGlong + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-AAIGlong +
 
+ +

wgrib2: -AAIGlong

+
+ + +

Introduction

+ +

+The -AAIGlong option is similar to +the -AAIG option except for a new file name convention for the output. +The -AAIGlong option +writes the data into a Ascii ArcInfo Grid file. This option +is experimental and only supports equally spaced lat-lon +grids. (You can use the -new_grid option of wgrib2 to create +an equally spaced lat-lon grid.) Each field is written to different file in the current directory. + +

File name convention for ouput: *.asc

+ +

+The file name convention +

+   NAME=(wgrib2 -S)
+   remove (message number)[.submessage number]:(byte location): 
+   remove trailing semicolon if any
+   replace "/" by " DIV "
+   replace "\" by " BS "
+   replace ":" by "_"
+   replace "'" by " Q "
+   replace '"' by " Q "
+
+   Note: The (wgrib2 -S) output can change between different versions of wgrib2.
+   The grib table can be updated.
+   The new metadata can be added to the inventory in order to uniquely 
+     identify fields.
+   In rare cases, the format of the metadata has been updated.
+
+   If you need to format of the NAME to be unchanging, please freeze the
+    version of wgrib2.
+
+ +

Usage

+

+ +

+-AAIGlong
+
+ + +

Example

+

+

+$ wgrib2 gep19.t00z.pgrb2af180 -match "HGT:500 mb" -AAIGlong
+raster file: D=20090605000000_HGT_500 mb_180 hour fcst_ENS=+19.asc
+9:280952:d=2009060500:HGT:500 mb:180 hour fcst:ENS=+19
+$ ls *asc
+D=20090605000000_HGT_500 mb_180 hour fcst_ENS=+19.asc
+
+The above line converts all the 400 mb HGT fields into an +arcinfo ascii grid file. + + +

+See also: -AAIG +-new_grid +

+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: Nov 18, 2015 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/EUMETSAT.html b/docs/web_docs/EUMETSAT.html new file mode 100644 index 0000000..866d88c --- /dev/null +++ b/docs/web_docs/EUMETSAT.html @@ -0,0 +1,258 @@ + + + + Climate Prediction Center - wgrib2: -stats, max, min + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: using EUMETSAT +
 
+ +

wgrib2: EUMETSAT

+
+ + +

Introduction: using wgrib2 with grib2 EUMETSAT files

+ +

+Many of the satellite data from EUMETSAT come in grib2 files using a space view projection. +Preliminary wgrib2 support for the geolocation or navigation of this grid was added May 2011. +With this support, wgrib2 knows the latitude/longitude of each pixel (grid point). This +give the following capabilities to wgrib2. + +

    +
  1. query latitude and longitude of pixel(i,j) +
  2. obtain pixel value as a function of latitude and longitude +
  3. interpolate to a latitude-longitude grid and write it out as binary, text, CSV or grib file. +
+ +This augments the previous capabilities, + +
    +
  1. obtain value for pixel(i,j) +
  2. write out pixel grid as binary, text files +
  3. compress the grib data (4.4x smaller with sample MPE cloud mask file) +
+ + +

Pixel coordinates

+ +Wgrib2's convention is to arrange the grid to be WE:SN and the pixel +coordinates are X=1..NX and Y=1..NY. With this convention, (1,1) +is the bottom left corner and (NX,NY) is the top right corner. +This differs from the EUMETSAT convention where (0,0) is the bottom +right hand corner and (NX-1,NY-1) is the top left corner. + + +

Example usage (as of 4/29/2011)

+ +
    +
  1. browse URL=https://oiswww.eumetsat.int/~idds/html/grib.html +
  2. download a file, for our example, MPE_20110428_1615_M9_00.grb, rename it MPE.grb +
  3. view inventory:
    +$ wgrib2 MPE.grb
    +1.1:0:d=2011042816:IRRATE:no_level:anl:
    +1.2:0:d=2011042816:var discipline=3 master_table=3 parmcat=1 parm=98:no_level:anl:
    +1.3:0:d=2011042816:var discipline=3 master_table=3 parmcat=1 parm=99:no_level:anl:
    +
  4. figure out what IIRATE means
    +$ wgrib2 MPE.grb -v -d 1
    +1.1:0:d=2011042816:IRRATE Instantaneous Rain Rate [kg/m^2/s]:no_level:anl:
    +
  5. find IRRATE (instantaneous rain rate) at two different locations, 10N,11E and at 12S and 13W,
    +$ wgrib2 MPE.grb -lon 10 11 -lon -12 -13 -d 1
    +experimental space_view2ll scan=12
    +experimental space_view2ij
    +experimental space_view2ij
    +1.1:0:lon=9.996141,lat=10.993532,val=9.999e+20:lon=-12.002473,lat=-13.011990,val=9.999e+20
    + This file uses an undefined value for a zero IRRATE (shown by 9.999e20). +
  6. interpolate the IIRATE to a 70W-70E, 70S-70N 0.1 degree latitude-longitude grid
    +$ wgrib2 MPE.grb -d 1 -lola -70:1401:0.1 -70:1401:0.1 lola.grb2 grib
    +experimental space_view2ll scan=12
    +experimental space_view2ij
    +1.1:0:d=2011042816:IRRATE:no_level:anl:
    +
  7. The version of GrADS that I have installed on my machine doesn't support pdt=30, so to +view the latitude-longitude I have to set the pdt to 0.
    +$ wgrib2 MPE.grb -d 1 -set_pdt +0 -lola -70:1401:0.01 -70:1401:0.1 lola.grb2 grib
    +
  8. Make a plot with GrADS. +
+ + GrADS plot of MPE + +

Thanks to the testers, T. Tiberi and V. Loorits. + +

See also: +-lola, +-lon, +-set_pdt, + + + +

+ + + + + + + + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: April 29, 2011 +
+ + + +

+See also: -undefine +

+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/GRIB.html b/docs/web_docs/GRIB.html new file mode 100644 index 0000000..4912313 --- /dev/null +++ b/docs/web_docs/GRIB.html @@ -0,0 +1,209 @@ + + + + Climate Prediction Center - wgrib2: -GRIB + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-GRIB +
 
+ +

wgrib2: -GRIB

+
+ + +

Introduction

+ +

+The -GRIB option is used to copy an entire +GRIB2 message (including all the submessages) to a specified file. +This is useful if you want to preserve to keep the submessages. +This is in contrast to the -grib option which writes +submessages into its own grib message. + +

The -GRIB option should only be used +to copy the original grib message to another file. Unlike the +the -grib option, changing the metadata +is not recommended. + +

Usage

+

+ +

+-GRIB file_name
+
+ +

Example

+

+The grib standard allows arbitrary data between grib messages. +Sometimes one want to remove this "junk" and only keep the grib +messages. For grib files with no submessages, the cleaning +operation is simple. + +

+$ wgrib2 IN.grb -grib OUT.grb
+
+ +For files with grib submessages, the cleaning can be done by, +
+$ wgrib2 IN.grb -if "^[0-9]*(\.1:|:)" -GRIB OUT.grb                all versions of wgrib2
+$ wgrib2 IN.grb -if "^[0-9]*(\.1:|:)" -GRIB OUT.grb -endif         wgrib2 v3.0.0+
+
+-if "^[0-9]*(\.1:|:)"  matches message number XXX or XXX.1, single grib message or first grib submessage
+-GRIB                  write grib message including any submessage
+
+ + + +See also: -grib +-ncep_uv +-submsg +-tosubmsg +-append +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005, Sep 5, 2023 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/MM.html b/docs/web_docs/MM.html new file mode 100644 index 0000000..d0d18e6 --- /dev/null +++ b/docs/web_docs/MM.html @@ -0,0 +1,187 @@ + + + + Climate Prediction Center - wgrib2: -MM + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-MM +
 
+ +

wgrib2: -MM

+
+ + +

Introduction

+ +

+The -MM option prints the month of the +reference time. The -MM +and -YY options are pretty useless. + +

Usage

+

+ +

+-MM
+
+ +

Example

+

+

+$ wgrib2 png.grb2 -MM
+1:4:MM=06
+
+ + + + + +See also: -t, -T +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/Match_inv.html b/docs/web_docs/Match_inv.html new file mode 100644 index 0000000..31b8788 --- /dev/null +++ b/docs/web_docs/Match_inv.html @@ -0,0 +1,190 @@ + + + + Climate Prediction Center - wgrib2: -Match_inv + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-Match_inv +
 
+ +

wgrib2: -Match_inv

+
+ + +

Introduction

+ +

+The -Match_inv option is identical to +-match_inv except the "d=YYYYMMDDHH" and +"D=YYYYMMDDHHmmss" fields are swapped in the inventories. +The wgrib2api uses -Match_inv option to create +its inventories. + +

Wgrib2 inventories can be used as index files and as metadata +to create grib files. For index files, the -match_inv +makes a fine index file as it exposes a number of important parameters +that you may want to search upon. The problem with using these +files for metadata for creating grib files is that it uses a reference +time of "d=YYYYMMDDHH". Some applications require a reference time +that includes minutes (mm). The -Match_inv option +uses a reference time of "D=YYYYMMDDmmss" which solves this problem. + + +

Usage

+

+ +

+-Match_inv
+
+ +See also: +-match_inv, +-set_metadata, +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: Aug 11, 2017 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/N_ens.html b/docs/web_docs/N_ens.html new file mode 100644 index 0000000..47f6cca --- /dev/null +++ b/docs/web_docs/N_ens.html @@ -0,0 +1,192 @@ + + + + Climate Prediction Center - wgrib2: -N_ens + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-N_ens +
 
+ +

wgrib2: -N_ens

+
+ + +

Introduction

+ +

+The -N_ens option prints the number of members +in the ensemble (ensemble forecasts only). + +

Usage

+

+ +

+-N_ens
+
+ +

Example

+

+ +

+$ wgrib2 in.grb -N_ens
+1:80:10 ens members
+2:218826:10 ens members
+3:434430:10 ens members
+..
+
+for wgrib2 upto 2.0.7, will print -1 ens members for product definition tables that
+do not support number of ensemble members. For wgrib2 2.0.8 and following, the field
+will be empty.
+
+ +See also: +-ens.html +-set_ens_num.html +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page modified: May 15, 2005, Nov 30, 2018 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/RT.html b/docs/web_docs/RT.html new file mode 100644 index 0000000..10d8b9f --- /dev/null +++ b/docs/web_docs/RT.html @@ -0,0 +1,187 @@ + + + + Climate Prediction Center - wgrib2: -RT + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-RT +
 
+ +

wgrib2: -RT

+
+ + +

Introduction

+ +

+The reference time is usually the analysis time or the time of the start of +the forecast (forecast time=0). However, the grib standard also allows the reference +time to be verifying time of the forecast or the observation time as +indicated by Grib Table 1.2. While legal grib, you should think twice +before setting the reference time to the verifying time of the forecast. +The -RT option prints the type (signficance) of +the reference time (Grib Table 1.2). + + +

Usage

+
+-RT
+
+ +

Example

+

+ +

+$ wgrib2 png.grb2 -RT
+1:4:RT=Start of fcst
+
+

+See also: +

+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: Dec 28, 2015 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/S.html b/docs/web_docs/S.html new file mode 100644 index 0000000..b4fc2bf --- /dev/null +++ b/docs/web_docs/S.html @@ -0,0 +1,184 @@ + + + + Climate Prediction Center - wgrib2: -S + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -S +
 
+ +

wgrib2: -S

+
+ + +

Introduction

+ +

+The -s option prints out a simple inventory with minutes and seconds. +-s is equivalent to +-T, -var, -lev, -ftime , and +-misc yyppp + +

+-sh-2.05b$ wgrib2 new.grb2 -s 
+1:0:d=2007032600:HGT:1000 mb:anl:
+2:125535:d=2007032600:HGT:1000 mb:3 hour fcst:
+
+ +

Usage

+

+ +

+-s
+
+ +See also: macros, +-match_inv +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/Sec0.html b/docs/web_docs/Sec0.html new file mode 100644 index 0000000..d6b780a --- /dev/null +++ b/docs/web_docs/Sec0.html @@ -0,0 +1,187 @@ + + + + Climate Prediction Center - wgrib2: -Sec0 + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -Sec0 +
 
+ +

wgrib2: -Sec0

+
+ + +

Introduction:

+ +

+The -Sec0 option prints a short summary of Section 0, +the Indicator Section. +

+ +
+$ wgrib2 png.grb2 -Sec0
+1:4:Sec0=GRIB reserved 0x0000 Discipline=0 Grib_Edition=2 len=44444
+
+GRIB                          octets 1-4, should be GRIB
+reserved 0x0000               octects 5-6, 0x0000 if not used
+Discipline=0                  Discipline, Table 0.0
+Grib_Edition=2                Edition, 2 for grib version2
+len=44444                     length in octets/bytes of entire grib message
+
+ +

Usage

+

+ +

+-Sec0
+
+ +See also: +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/Sec3.html b/docs/web_docs/Sec3.html new file mode 100644 index 0000000..82d08a9 --- /dev/null +++ b/docs/web_docs/Sec3.html @@ -0,0 +1,187 @@ + + + + Climate Prediction Center - wgrib2: -Sec3 + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -Sec3 +
 
+ +

wgrib2: -Sec3

+
+ + +

Introduction:

+ +

+The -Sec3 option prints a short summary of Section 3, +the Grid Definition Section. +

+ +
+$ wgrib2 png.grb2 -Sec3
+1:4:Sec3 len=72 src gdef=0 npts=65160 Grid Def Template=3.0 opt arg=0
+
+len=72                        Section 3 is 72 octets/bytes in length
+src gdef=0                    Source of grid definition, Code Table 3.0
+npts=65160                    Number of data points
+Grid Def Template=3.0         Grid definition template number, Code Table 3.1
+opt arg=0                     optional arguments
+
+ +

Usage

+

+ +

+-Sec3
+
+ +See also: +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/Sec4.html b/docs/web_docs/Sec4.html new file mode 100644 index 0000000..92fca54 --- /dev/null +++ b/docs/web_docs/Sec4.html @@ -0,0 +1,188 @@ + + + + Climate Prediction Center - wgrib2: -Sec4 + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -Sec4 +
 
+ +

wgrib2: -Sec4

+
+ + +

Introduction:

+ +

+The -Sec4 option prints a short summary of Section 4, the +product definition section. +

+ +
+$ wgrib2 -Sec4 png.grb2 
+1:4:Sec4 len=36 #vert coordinate=0 Product Defn Template=4.2 size=36 free=0
+
+len=36                        Section 4 is 36 octets/bytes in length
+#vert coordinate=0            no vertical coordinates have been defined
+Product Defn Template=4.2     using Product Definition Template 4.2  (Code Table 4.0)
+size=36                       Size of PDT excluding vertical coordinates
+free=0                        Should be zero, len-size-8*#vert_coordinates
+
+ +

Usage

+

+ +

+-Sec4
+
+ +See also: +-pdt, +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/Sec5.html b/docs/web_docs/Sec5.html new file mode 100644 index 0000000..13f1d98 --- /dev/null +++ b/docs/web_docs/Sec5.html @@ -0,0 +1,185 @@ + + + + Climate Prediction Center - wgrib2: -Sec5 + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -Sec6 +
 
+ +

wgrib2: -Sec5

+
+ + +

Introduction:

+ +

+The -Sec5 option prints a short summary of Section 5, the +Data Representation Section. +

+ +
+wgrib2 png.grb2 -Sec5
+1:4:Sec5 len=21 #defined data points=65160 Data Repr. Template=5.41
+
+len=21                       Section 5 is 21 octets/bytes in length
+#defined data points=65160   Number of data points with values present in Section 7
+Data Repr. Template=5.41     Data Represenation Template is 5.41
+
+ +

Usage

+

+ +

+-Sec5
+
+ +See also: +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/Sec6.html b/docs/web_docs/Sec6.html new file mode 100644 index 0000000..cb929eb --- /dev/null +++ b/docs/web_docs/Sec6.html @@ -0,0 +1,184 @@ + + + + Climate Prediction Center - wgrib2: -Sec6 + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -Sec6 +
 
+ +

wgrib2: -Sec6

+
+ + +

Introduction:

+ +

+The -Sec6 option prints a short summary of Section 6, the +Bit Map Section. +

+ +
+$ wgrib2 png.grb2 -Sec6
+1:4:Sec6 length 6 bitmap indicator 255
+
+lenth=6                       Section 6 is 6 octets/bytes in length
+bitmap indicator 255          Table 6.0 has a value of 255, (no bitmap)
+
+ +

Usage

+

+ +

+-Sec6
+
+ +See also: +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/Sec_len.html b/docs/web_docs/Sec_len.html new file mode 100644 index 0000000..18ffb79 --- /dev/null +++ b/docs/web_docs/Sec_len.html @@ -0,0 +1,196 @@ + + + + Climate Prediction Center - wgrib2: -Set_len + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-Set_len +
 
+ +

wgrib2: -Sec_len

+
+ + +

Introduction

+ +

+Grib2 messages (records) are comprised of 9 sections (0-8). Sections 0 and 8 +are 16 and 4 bytes long, respectively. When the message contains submessages, +each submessage contains 9 sections but some of the sections can be shared +with the other submessages. +The -Set_late option shows the length of each section +except for sections 0 and 8. + + +

Usage

+
+-Sec_len
+
+ +

Examples

+ +
+$ wgrib2 small.grb2 -Sec_len
+1:0:Sec size msg=188 id(1)=21 local(2)=0 grid(3)=72 product(4)=37 data-rep(5)=21 bitmap(6)=6 data(7)=11
+
+  The size of the grib message is 188 bytes.
+  Section 1 is 21
+  Section 2 is missing and not used
+  Section 3 is 72
+  Section 4 is 37
+  Section 5 is 21
+  Section 6 is 6
+  Section 7 is 11
+
+ +See also: +-0xSec, +-checksum, +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/T.html b/docs/web_docs/T.html new file mode 100644 index 0000000..f39ee5a --- /dev/null +++ b/docs/web_docs/T.html @@ -0,0 +1,199 @@ + + + + Climate Prediction Center - wgrib2: -t -T -vt -VT + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -t -T -vt -VT +
 
+ +

wgrib2: -t -T -vt -VT

+
+ + +

Introduction

+ +

+The -t -T -vt -VT options prints various time flags. +The -t -T prints the reference time +and -vt -VT prints the verification time. +The capitalized versions print the time with the seconds +and the lower case options print the time with out the seconds. +In conjuntion with -v2 verbose mode, the +format of the time will change to be GrADS compatible. + +

Usage

+
+-t
+-T
+-vt
+-VT
+
+ +

Example

+

+ +

+$ wgrib2 g720_360.grb2 -t
+1:4:d=2009010100
+$ wgrib2 g720_360.grb2 -t -v2
+1:4:00Z01jan2009
+$ wgrib2 g720_360.grb2 -T
+1:4:D=20090101000000
+$ wgrib2 g720_360.grb2 -vt
+1:4:vt=2009010600
+$ wgrib2 g720_360.grb2 -vt -v2
+1:4:00Z06jan2009
+$ wgrib2 g720_360.grb2 -VT
+1:4:vt=20090106000000
+
+ +See also: +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/V.html b/docs/web_docs/V.html new file mode 100644 index 0000000..ad31c5c --- /dev/null +++ b/docs/web_docs/V.html @@ -0,0 +1,187 @@ + + + + Climate Prediction Center - wgrib2: -s -verf + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -s -verf +
 
+ +

wgrib2 macros: -s -verf -V

+
+ + +

Introduction

+ +

+The -s, +-verf +and -V +options are really macros +which are defined in the Macro.c file. The -s option is special because if there is no +"inv" option used, wgrib2 will add a -s option to the end of the argument list. + + +

Usage

+

+ +

+-s
+      equivalent to -t -var -lev -ftime -ens
+
+-verf
+      equivalent to -vt -var -lev -ftime -ens
+
+-V
+      equivalent to -vt -lev -ftime -var -ens -stats -grid
+
+
+ +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/VT.html b/docs/web_docs/VT.html new file mode 100644 index 0000000..f39ee5a --- /dev/null +++ b/docs/web_docs/VT.html @@ -0,0 +1,199 @@ + + + + Climate Prediction Center - wgrib2: -t -T -vt -VT + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -t -T -vt -VT +
 
+ +

wgrib2: -t -T -vt -VT

+
+ + +

Introduction

+ +

+The -t -T -vt -VT options prints various time flags. +The -t -T prints the reference time +and -vt -VT prints the verification time. +The capitalized versions print the time with the seconds +and the lower case options print the time with out the seconds. +In conjuntion with -v2 verbose mode, the +format of the time will change to be GrADS compatible. + +

Usage

+
+-t
+-T
+-vt
+-VT
+
+ +

Example

+

+ +

+$ wgrib2 g720_360.grb2 -t
+1:4:d=2009010100
+$ wgrib2 g720_360.grb2 -t -v2
+1:4:00Z01jan2009
+$ wgrib2 g720_360.grb2 -T
+1:4:D=20090101000000
+$ wgrib2 g720_360.grb2 -vt
+1:4:vt=2009010600
+$ wgrib2 g720_360.grb2 -vt -v2
+1:4:00Z06jan2009
+$ wgrib2 g720_360.grb2 -VT
+1:4:vt=20090106000000
+
+ +See also: +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/YY.html b/docs/web_docs/YY.html new file mode 100644 index 0000000..fa20ef0 --- /dev/null +++ b/docs/web_docs/YY.html @@ -0,0 +1,185 @@ + + + + Climate Prediction Center - wgrib2: -YY + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-YY +
 
+ +

wgrib2: -YY

+
+ + +

Introduction

+ +

+The - option prints the year of the +reference time. The -MM +and -YY options are pretty useless. + +

Usage

+

+ +

+-YY
+
+ +

Example

+

+

+$ wgrib2 png.grb2 -YY
+1:4:YY=2009
+
+ + + +See also: -t, -T +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/aerosol_size.html b/docs/web_docs/aerosol_size.html new file mode 100644 index 0000000..0a6de2d --- /dev/null +++ b/docs/web_docs/aerosol_size.html @@ -0,0 +1,197 @@ + + + + Climate Prediction Center - wgrib2: -aerosol_size + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-aerosol_size +
 
+ +

wgrib2: -aerosol_size

+
+ + +

Introduction

+ +

+The -aerosol_size option prints the +size of the aerosol particle if applicable. This applies +to Product Definition Template 4.44 - 4.48. This option is +part of the standard inventory, -s. + +

Usage

+ +

+

+-aerosol_size
+
+ +

Example

+
+$ wgrib2 ngac.t00z.a3df03  -for 2:6
+2:77259:d=2014081000:TMP:1 hybrid level:3 hour fcst:
+3:131943:d=2014081000:RH:1 hybrid level:3 hour fcst:
+4:205847:d=2014081000:MASSMR:1 hybrid level:3 hour fcst:aerosol=Dust Dry:aerosol_size >=2e-07,<2e-06:
+5:243914:d=2014081000:MASSMR:1 hybrid level:3 hour fcst:aerosol=Dust Dry:aerosol_size >=2e-06,<3.6e-06:
+6:279272:d=2014081000:MASSMR:1 hybrid level:3 hour fcst:aerosol=Dust Dry:aerosol_size >=3.6e-06,<6e-06:
+
+Message 4: mass mixing ratio (MASSMR) of Dry Dust, particle size ranges from 2e-7 meters to 2e-6 meters
+
+$ wgrib2 ngac.t00z.a3df03  -for 2:6 -aerosol_size
+2:77259:
+3:131943:
+4:205847:aerosol_size <=2e-07,>2e-06
+5:243914:aerosol_size <=2e-06,>3.6e-06
+6:279272:aerosol_size <=3.6e-06,>6e-06
+
+ +See also: +-aerosol_wavelength, +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: July 30, 2014 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/aerosol_wavelength.html b/docs/web_docs/aerosol_wavelength.html new file mode 100644 index 0000000..b4beb97 --- /dev/null +++ b/docs/web_docs/aerosol_wavelength.html @@ -0,0 +1,186 @@ + + + + Climate Prediction Center - wgrib2: -aerosol_wavelength + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-aerosol_wavelength +
 
+ +

wgrib2: -aerosol_wavelength

+
+ + +

Introduction

+ +

+The option, -aerosol_wavelength, prints the +optical properties of the aerosol particle. This option is part +of the standard inventory, -s. +

+ +

Usage

+ +

+

+-aerosol_wavelength
+
+ +

Example

+
+$ wgrib2 wrib2 ngac.t00z.a2df03  -aerosol_wavelength -d 1 
+1:0:aerosol_wavelength <=5.45e-07,>=5.65e-07
+
+ + +See also: +-aerosol_size, + +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: July 30, 2014 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/alarm.html b/docs/web_docs/alarm.html new file mode 100644 index 0000000..14d5446 --- /dev/null +++ b/docs/web_docs/alarm.html @@ -0,0 +1,212 @@ + + + + Climate Prediction Center - wgrib2: -alarm + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-alarm +
 
+ +

wgrib2: -alarm

+
+ + +

Introduction

+ +

+The -alarm N option terminates wgrib2 after N seconds (real time). +For example, you may want to use -alarm to kill a +wgrib2 job that running too long on a web server (ex. grib_filter). + +

The code for -alarm is SVr4, BSD, POSIX-1-2001 and IEEE Std 1003.1-2001 +compatible. The code is also supported by the Cygwin system for Windows systems. The +-alarm will need to be disabled in the makefile for non-compatible systems. +(Change DISABLE_ALARM=0 to DISABLE_ALARM=1 in the makefile.) + +

The current version of -alarm simply terminates +the process. This may be the appropriate action when wgrib2 is taking too +long. However, this heavy-handed action may not be an ideal action for programs that +are calling the wgrib2 subroutine. For these situations, the alarm +should be set up by the main program so that a more appropriate action can +be taken. + +

The -alarm option is a +replacement for -limit which limits +the number of (sub)messages which are processed. Jobs on +web servers may hang because of problems with the network +connections which will never trigger the +-limit option. + +

Usage

+

+ +

+-alarm N
+          N is an integer from 0..65536 (ISO C standard)
+          N = 0 will remove any pending alarm
+
+ +

+The -alarm option is a setup/init option. So +the alarm is activated in the setup phase, cannot altered in the data +processing phase and is not removed the finalize phase. (wgrib2 v2.0.8+ +will remove the alarm in the finalize phase.) + +

+For Posix systems, the system generates a SIGALRM signal +to the process after N seconds. The default action is to +terminate the process (wgrib2). + + +

+See also: -quit, +-limit + +

+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: August 9, 2017 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/all_commands.html b/docs/web_docs/all_commands.html new file mode 100644 index 0000000..00e5e20 --- /dev/null +++ b/docs/web_docs/all_commands.html @@ -0,0 +1,392 @@ + + + + Climate Prediction Center - wgrib2: + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + +
 
+
+wgrib2 v0.1.9.4-beta2 6/2011 Wesley Ebisuzaki, Reinoud Bokhorst, Jaakko Hyvätti, Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Arlindo da Silva, Niklas Sondell, Sergey Varlamov
+ -0xSec           inv  X      Hex dump of section X (0..8)
+ -bitmap          inv         bitmap mode
+ -center          inv         center
+ -checksum        inv  X      CRC checksum of section X (0..8), whole message (X = -1/message) or (X=data)
+ -code_table_0.0  inv         code table 0.0 discipline
+ -code_table_1.0  inv         code table 1.0 master table version
+ -code_table_1.1  inv         code table 1.1 local table version
+ -code_table_1.2  inv         code table 1.2 significance of reference time
+ -code_table_1.3  inv         code table 1.3 production status of processed data
+ -code_table_1.4  inv         code table 1.4 type of processed data
+ -code_table_3.0  inv         code table 3.0 Source of grid definition
+ -code_table_3.1  inv         code table 3.1 Grid definition template number
+ -code_table_3.11 inv         code table 3.11 regional/global thinned/reduced grid
+ -code_table_3.15 inv         code table 3.15 Physical meaning of vertical coordinate
+ -code_table_3.2  inv         code table 3.2 Size (radius) and Shape of Earth
+ -code_table_3.21 inv         code table 3.21 Vertical Dimension coordinate values defn
+ -code_table_3.6  inv         code table 3.6 Spectral data representation type
+ -code_table_3.7  inv         code table 3.7 Spectral data representation mode
+ -code_table_3.8  inv         code table 3.8 Grid point position
+ -code_table_4.0  inv         code table 4.0 Product Definition Template Number
+ -code_table_4.1  inv         code table 4.1
+ -code_table_4.10 inv         code table 4.10 statistical processing
+ -code_table_4.11 inv         code table 4.11 type of time intervals
+ -code_table_4.15 inv         code table 4.15 type of areal statistical processing
+ -code_table_4.2  inv         code table 4.2
+ -code_table_4.230 inv         code table 4.230 chemical constituent type
+ -code_table_4.3  inv         code table 4.3 Type of Generating Process
+ -code_table_4.4  inv         code table 4.4
+ -code_table_4.5a inv         code table 4.5 (1st value)
+ -code_table_4.5b inv         code table 4.5 (2nd value)
+ -code_table_4.6  inv         code table 4.6 ensemble type
+ -code_table_4.7  inv         code table 4.7 derived forecast
+ -code_table_4.9  inv         code table 4.9 Probability Type
+ -code_table_5.0  inv         code table 5.0 data representation number
+ -code_table_5.1  inv         code table 5.1 type of original field values
+ -code_table_5.4  inv         code table 5.4 group splitting method
+ -code_table_5.5  inv         code table 5.5 missing value management for complex packing
+ -code_table_5.6  inv         code table 5.5 complex packing spatial differencing
+ -code_table_5.7  inv         code table 5.7 precision in IEEE packing
+ -code_table_6.0  inv         code table 6.0 Bitmap indicator
+ -ctl_ens         inv         ens info for g2ctl/GrADS
+ -ctl_inv         inv         ctl inventory dump for g2ctl/GrADS
+ -cyclic          inv         is grid cyclic? (not for gaussian)
+ -disc            inv         discipline (code table 0.0)
+ -domain          inv         find rectangular domain for g2ctl/GrADS plots
+ -ens             inv         ensemble information
+ -ext_name        inv         extended name, var+qualifiers
+ -flag_table_3.10 inv         flag table 3.10 scanning mode for one diamond
+ -flag_table_3.3  inv         flag table 3.3, resolution and component flags
+ -flag_table_3.4  inv         flag table 3.4, scanning mode
+ -flag_table_3.5  inv         flag table 3.5 projection center
+ -flag_table_3.9  inv         flag table 3.9 numbering order of diamonds seen from corresponding pole
+ -ftime           inv         forecast time
+ -full_name       inv         extended name, var+qualifiers
+ -get_byte        inv  X Y Z  get bytes in Section X, location Y (1..N), number of bytes Z (decimal format)
+ -get_hex         inv  X Y Z  get bytes in Section X, location Y (1..N), number of bytes Z (bytes in hexadecimal format)
+ -get_int         inv  X Y Z  get ints in Section X, location Y (byte), number of ints Z
+ -grid            inv         grid definition
+ -ij              inv  X Y    value of field at grid(X,Y) X=1,..,nx Y=1,..,ny (WxText enabled)
+ -ijlat           inv  X Y    lat,lon and grid value at grid(X,Y) X=1,..,nx Y=1,..,ny (WxText enabled)
+ -ilat            inv  X      lat,lon and grid value at Xth grid point, X=1,..,npnts (WxText enabled)
+ -lev             inv         level (code table 4.5)
+ -lev0            inv         level for g2ctl/GrADS
+ -lon             inv  X Y    value at grid point nearest lon=X lat=Y (WxText enabled)
+ -match_inv       inv         inventory used by -match, -not, -if and -not_if
+ -max             inv         print maximum value
+ -min             inv         print minimum value
+ -misc            inv         variable name qualifiers like chemical, ensemble, probability, etc
+ -MM              inv         reference time MM
+ -n               inv         prints out inventory number
+ -N_ens           inv         number of ensemble members
+ -nl              inv         inserts new line into inventory
+ -nlons           inv         number of longitudes for each latitude
+ -nl_out          inv  X      write new line in file X
+ -npts            inv         number of grid points
+ -nxny            inv         nx and ny of grid
+ -packing         inv         shows the packing mode (use -v for more details)
+ -pds_fcst_time   inv         fcst_time(1) in units given by pds
+ -print           inv  X      inserts string into inventory
+ -prob            inv         probability information
+ -process         inv         Process (code table 4.3)
+ -processid       inv         process id (locally defined)
+ -radius          inv         radius of Earth
+ -range           inv         print out location of record in bytes, 0 = first byte
+ -RT              inv         type of reference Time
+ -s               inv         simple inventory
+ -S               inv         simple inventory with minutes and seconds (subject to change)
+ -scale           inv         scale for packing
+ -scaling         inv         scaling for packing (old format)
+ -scan            inv         scan order of grid
+ -Sec0            inv         contents of section0
+ -Sec3            inv         contents of section 3 (Grid Definition Section)
+ -Sec4            inv         Sec 4 values (Product definition section)
+ -Sec5            inv         Sec 5 values (Data representation section)
+ -Sec6            inv         show bit-map section
+ -Sec_len         inv         length of various grib sections
+ -spatial_proc    inv         show spacial processing, pdt=4.15
+ -spectral        inv         show spectral bands
+ -spectral_bands  inv         spectral bands for satellite, pdt=4.31
+ -start_ft        inv         verf time = reference_time + forecast_time (YYYYMMDDHH) - no stat. proc time
+ -start_FT        inv         verf time = reference_time + forecast_time (YYYYMMDDHHMMSS) - no stat. proc time
+ -stats           inv         statistical summary of data values
+ -subcenter       inv         subcenter
+ -t               inv         reference time YYYYMMDDHH, -v2 for alt format
+ -T               inv         reference time YYYYMMDDHHMMSS
+ -table           inv         parameter table
+ -unix_time       inv         print unix timestamp for rt & vt
+ -V               inv         diagnostic output
+ -var             inv         short variable name
+ -varX            inv         raw variable name - discipline mastertab localtab center parmcat parmnum
+ -vector_dir      inv         grid or earth relative winds
+ -verf            inv         simple inventory using verification time
+ -vt              inv         verf time = reference_time + forecast_time, -v2 for alt format
+ -VT              inv         verf time = reference_time + forecast_time (YYYYMMDDHHMMSS)
+ -YY              inv         reference time YYYY
+ -s_out           inv> X      simple inventory written to X
+ -big_endian      misc        sets ieee output to big endian (default is big endian)
+ -colon           misc X      replace item deliminator (:) with X
+ -config          misc        shows the configuration
+ -count           misc        prints number of fields
+ -end             misc        stop after first (sub)message (save time)
+ -fix_ncep        misc        fix ncep PDT=8 headers produced by cnvgrib
+ -grid_changes    misc        prints number of grid changes
+ -grid_def        misc        read lon and lat data from grib file -- experimental
+ -h               misc        help, shows common options
+ -header          misc        f77 header or nx-ny header in text output (default)
+ -help            misc X      help [search string|all], -help all, shows all options
+ -if              misc X      if X (POSIX regular expression) matches, conditional execution up to next output/fi
+ -if_n            misc X      if (inv numbers in range), X=(start:end:step)
+ -if_rec          misc X      if (record numbers in range), X=(start:end:step)
+ -if_reg          misc X      if rpn registers defined, X = A, A:B, A:B:C, etc A = register number
+ -ijundefine      misc X Y Z  sets grid point values to undefined X=(in-box|out-box) Y=ix0:ix1 Z=iy0:iy1 ix=(1..nx) iy=(1..ny)
+ -import_bin      misc X      read binary file (X) for data
+ -import_ieee     misc X      read ieee file (X) for data
+ -import_text     misc X      read text file (X) for data
+ -inv             misc X      write inventory to X
+ -limit           misc X      stops after X fields decoded
+ -little_endian   misc        sets ieee output to little endian (default is big endian)
+ -new_grid_interpolation misc X      new_grid interpolation X=bilinear,bicubic,neighbor,budget
+ -new_grid_ipopt  misc X      new_grid ipopt values X=i1:i2..:iN N <= 20
+ -new_grid_vectors misc X      change fields to vector interpolate: X=none,default,UGRD:VGRD
+ -new_grid_winds  misc X      new_grid wind orientation: X = grid, earth (N/S, default) -- alpha
+ -no_header       misc        no f77 header or nx-ny header in text output
+ -not_if          misc X      if not X (regular expression) matches, conditional execution until next output/fi
+ -one_line        misc        puts all on one line (makes into inventory format)
+ -quit            misc        stop after first (sub)message (save time)
+ -rpn             misc X      reverse polish notation calculator (beta)
+ -set             misc X Y    set X = Y, X=local_table,etc (help: -set help help)
+ -set_ave         misc X      set ave/acc .. only on pdt=4.0 only anl/fcst
+ -set_bin_prec    misc X      X set number of binary bits for grib_out packing
+ -set_byte        misc X Y Z  set bytes in Section X, location Y (1..N), bytes Z (a|a:b:c)
+ -set_center      misc X      changes center X = C or C:S C and S are center/subcenter numbers
+ -set_date        misc X      changes date code .. keep old date code if not specified completely
+ -set_ext_name    misc X      X=0/1 extended name on/off
+ -set_flag_table_3.3 misc X      flag table 3.3 = X
+ -set_flag_table_3.4 misc X      flag table 3.4 = X
+ -set_ftime       misc X      set ftime .. only on pdt=4.0 only anl/fcst
+ -set_grib_max_bits misc X      sets scaling so number of bits does not exceed N in (new) grib output
+ -set_grib_type   misc X      set grib type = jpeg, simple, ieee, complex(1|2|3), same
+ -set_hex         misc X Y Z  set bytes in Section X, location Y (1..N), bytes Z (a|a:b:c) in hexadecimal
+ -set_ijval       misc X Y Z  sets grid point value X=ix Y=iy Z=val
+ -set_int         misc X Y Z  set in in Section X, location Y (1..N), signed integers Z (a|a:b:c)
+ -set_lev         misc X      changes level code .. not complete
+ -set_metadata    misc X      read meta-data for grib writing from file X
+ -set_pdt         misc X      makes new (clean) pdt, X=PDT_number or X=PDT_number:size of PDT in octets
+ -set_radius      misc X      set radius of Earth X= 0,6,8
+ -set_scaling     misc X Y    set decimal scaling=X binary scaling=Y for grib_out packing
+ -set_sec_size    misc X Y    resizes section , X=section number, Y=size in octets, DANGEROUS
+ -set_ts_dates    misc X Y Z  changes date code for time series X=YYYYMMDDHH(mmss) Y=dtime Z=block size
+ -set_var         misc X      changes variable name
+ -submsg          misc X      process submessage X (0=process all messages)
+ -sys             misc X      run system/shell command, X=shell command
+ -text_col        misc X      number of columns on text output
+ -text_fmt        misc X      format for text output (C)
+ -udf             misc X Y    run UDF, X=program+optional_args, Y=return file
+ -udf_arg         misc X Y    add grib-data to UDF argument file, X=file Y=name
+ -undefine        misc X Y Z  sets grid point values to undefined X=(in-box|out-box) Y=lon0:lon1 Z=lat0:lat1
+ -undefine_val    misc X      grid point set to undefined if X=val or X=low:high
+ -v               misc        verbose (v=1)
+ -v0              misc        not verbose (v=0)
+ -v1              misc        verbose (v=1)
+ -v2              misc        really verbose (v=2)
+ -v98             misc        verbose mode for debugging only (v=98)
+ -v99             misc        verbose mode for debugging only (v=99)
+ -version         misc        print version
+ -AAIG            out         writes Ascii ArcInfo Grid file, lat-lon grid only (alpha)
+ -ave             out  X Y    average X=time step, Y=output grib file needs file is special order
+ -bin             out  X      write binary data to X
+ -cress_lola      out  X..Z,A lon-lat grid values X=lon0:nlon:dlon Y=lat0:nlat:dlat Z=file A=radius1:radius2:..:radiusN
+ -csv             out  X      make comma separated file, X=file (WxText enabled)
+ -fcst_ave        out  X Y    average X=time step, Y=output grib file needs file is special order
+ -fi              out         null output operation
+ -grib            out  X      writes GRIB record (one submessage) to X
+ -GRIB            out  X      writes entire GRIB record (all submessages)
+ -grib_ieee       out  X      writes data[] to X.grb, X.head, X.tail, and X.h
+ -grib_out        out  X      writes decoded/modified data in grib-2 format to file X
+ -ieee            out  X      write (default:big-endian) IEEE data to X
+ -ijbox           out  X..Z,A grid values in bounding box X=i1:i2[:di] Y=j1:j2[:dj] Z=file A=[bin|text|spread]
+ -ijsmall_grib    out  X Y Z  make small domain grib file X=ix0:ix1 Y=iy0:iy1 Z=file (beta)
+ -irr_grid        out  X Y Z  make irregular grid, nearest neighbor, X=lon-lat list Y=radius (km) Z=output grib file
+ -lola            out  X..Z,A lon-lat grid values X=lon0:nlon:dlon Y=lat0:nlat:dlat Z=file A=[bin|text|spread|grib]
+ -merge_fcst      out  X Y    normalize NCEP-type ave/acc X=number Y=output grib file
+ -mysql           out  5 args H=[host] U=[user] P=[password] D=[db] T=[table] (alpha)
+ -mysql_dump      out  7 args H=[host] U=[user] P=[password] D=[db] T=[table] W=[western_lons:0|1] PV=[remove unlikely:0|1]
+ -mysql_speed     out  7 args H=[host] U=[user] P=[password] D=[db] T=[table] W=[western_lons:0|1] PV=[remove unlikely:0|1]
+ -ncep_norm       out  X      normalize NCEP-type ave/acc X=output grib file
+ -ncep_uv         out  X      combine U and V fields into one message like NCEP operations
+ -netcdf          out  X      write netcdf data to X
+ -new_grid        out  X..Z,A bilinear interpolate: X=projection Y=x0:nx:dx Z=y0:ny:dy A=grib_file alpha
+ -small_grib      out  X Y Z  make small domain grib file X=lonW:lonE Y=latS:latN Z=file (beta)
+ -spread          out  X      write text - spread sheet format into X (WxText enabled)
+ -text            out  X      write text data into X
+ -tosubmsg        out  X      convert GRIB message to submessage and write to file X
+ -wind_speed      out  X      calculate wind speed, X = output gribfile (U then V in datafile)
+ -append          init        append mode, write to existing output files
+ -d               init X      dump message X (n or n.m), only 1 -d allowed
+ -fix_ncep_2      init        ncep bug fix 2, probability observation < -ve number
+ -fix_ncep_3      init        sets flag to fix ncep bug 3 (constant fields)
+ -fix_ncep_4      init        fixes NCEP grib2 files where DX and DY are undefined
+ -flush           init        flush output buffers after every write (interactive)
+ -for             init X      process record numbers in range, X=(start:end:step), only one -for allowed
+ -for_n           init X      process inv numbers in range, X=(start:end:step), only one -for allowed
+ -g2clib          init X      X=0/1 use g2clib for decoding grib
+ -i               init        read Inventory from stdin
+ -match           init X      process data that matches X (POSIX regular expression)
+ -nc3             init        use netcdf3 (classic)
+ -nc4             init        use netcdf4 (compressed, controlled endianness etc)
+ -nc_grads        init        require netcdf file to be grads v1.9b4 compatible (fixed time step only)
+ -nc_nlev         init X      netcdf, X = max LEV dimension for {TIME,LEV,LAT,LON} data
+ -nc_pack         init X      pack/check limits of all NEW input variables, X=min:max[:byte|short|float]
+ -nc_table        init X      X is conversion_to_netcdf_table file name
+ -nc_time         init X      netcdf, [[-]yyyymmddhhnnss]:[dt{s[ec]|m[in]|h[our]|d[ay]}], [-] is for time alignment only
+ -no_append       init        not append mode, write to new output files (default)
+ -no_flush        init        flush output buffers when full (default)
+ -no_nc_grads     init        netcdf file may be not grads v1.9b4 compatible, variable time step
+ -no_nc_pack      init        no packing in netcdf for NEW variables
+ -no_nc_table     init        disable previously defined conversion_to_netcdf_table
+ -no_nc_time      init        netcdf, disable previously defined initial or relative date and time step
+ -not             init X      process data that does not match X (POSIX regular expression)
+ -order           init X      decoded data in X (raw|we:sn|we:ns) order, we:sn is default
+ -set_regex       init X      set regex mode X = 0:extended regex (default) 1:pattern 2:extended regex & quote metacharacters
+ -tigge           init        use modified-TIGGE grib table
+
+
+ + +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/append.html b/docs/web_docs/append.html new file mode 100644 index 0000000..0dfb2fd --- /dev/null +++ b/docs/web_docs/append.html @@ -0,0 +1,188 @@ + + + + Climate Prediction Center - wgrib2: -append, -no_append + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-append +
 
+ +

wgrib2: -append, -no_append

+
+ + +

Introduction

+ +

+The -append and -no_append options +sets/clears the append flag. The out options are +expected to respect this flag when opening output files. So an -append option +before writing (-text, -bin, etc) should append to a currently existing file. +The -no_append directs the file to be created before use which is the default. + +

+$ wgrib2 grb2 -d 1 -append -text all.txt -no_append -text rec.txt
+
+ +The above line will append record #1 to all.txt and write record #1 to new file rec.txt + +

Usage

+

+ +

+-append
+      append to output files
+
+-no_append
+      over-write the output files
+
+ +See also: +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/ave.html b/docs/web_docs/ave.html new file mode 100644 index 0000000..218c38b --- /dev/null +++ b/docs/web_docs/ave.html @@ -0,0 +1,518 @@ + + + + Climate Prediction Center - wgrib2: -ave, -fcst_ave + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ncep_norm +
 
+ +

wgrib2: -ave, -fcst_ave

+
+ +News +

+With wgrib2 v2.0.7, +the -ave and -fcst_ave +now call the -time_processing option. +This option handles more statistical operations and more +Product Definition Templates (PDT). + +The old -ave and -fcst_ave options will available as +-ave0 and -fcst_ave0. I expect that +these two options will be eliminated within a year of the release of v2.0.7. + + +

Introduction

+ +

+The -ave +and -fcst_ave options are very similar; +they both make temporal averages. +The -fcst_ave option assumes that the +reference (initial) time is constant and the verification time +is increasing. +The +-ave option assumes the reference time +is increasing and the difference between the verification and +reference time is constant. + +

+ +You would use -fcst_ave to temporally average +a single forecast run. For example, you have a 3 week forecast with +output every 6 hours. You could use -fcst_ave +to find the forecast for the second week. + +

+You would use -ave to temporally average +several analyses. Suppose you have +analyses every 6 hours and you want to find the analysis for the month. + +

+The input grib file has to be processed in a special order. Don't worry, +a grib file can be ordered very easily with the sort command. wgrib2 reads the data +sequentially and when ever it encounters a new variable/level/chemical-type, +it starts the averaging process. The length of the averaging depends on +how many records it finds to average. For example, to make a daily +average, a file has to be in the following order. + +

+U500 2000-01-02 00Z             start ave
+U500 2000-01-02 06Z
+U500 2000-01-02 12Z
+U500 2000-01-02 18Z             end ave
+V500 2000-01-02 00Z             start ave
+V500 2000-01-02 06Z
+V500 2000-01-02 12Z
+V500 2000-01-02 18Z             end ave
+Z500 2000-01-02 00Z             start ave
+Z500 2000-01-02 06Z
+Z500 2000-01-02 12Z
+Z500 2000-01-02 18Z             end ave
+
+ +To make a daily average of the above file, you need to specify the +output file and the time interval between samples. The time +units are the same as used by GrADS (hr, dy, mo, yr). + +
+$ wgrib2 input.grb -ave 6hr out.grb
+
+ + +If the file is not sorted, you can use the unix sort by, + +
+$ wgrib2 input.grb | sort -t: -k4,4 -k5,5 -k6,6 -k3,3 | \
+   wgrib2 -i input.grb -set_grib_type c3 -ave 6hr output.grb
+
+ +If you want to make daily means from 4x daily monthly files +and assuming that more than one variable/level is in the monthly file. + +
+$ wgrib2 input.grb |  sed 's/\(:d=........\)/\1:/' | \
+  sort -t: -k3,3 -k5,5 -k6,6 -k7,7 -k4,4 | \
+  wgrib2 input.grb -i -set_grib_type c3 -ave 6hr daily.ave.grb
+
+ +

+Using -fcst_ave is like using +-ave except you use the verification +time instead of the reference time. To make an inventory that +use the verification time instead of the reference time, you type, + +

+$ wgrib2 input.grb -vt -var -lev -misc 
+1:0:vt=2011040101:PRATE:surface:
+2:592224:vt=2011040102:PRATE:surface:
+3:1233694:vt=2011040103:PRATE:surface:
+4:1909322:vt=2011040104:PRATE:surface:
+5:2612620:vt=2011040105:PRATE:surface:
+
+ +The sed command will be alterered very slightly when making the +sort (:d=) -> (:st=). + +

Averaging several files using gmerge

+ +

If want to average several grib files, and the files have the +following properties: + +

    +
  1. No submessages. +
  2. No non-grib data between the grib messages. +
  3. Each file is for a different time. +
  4. Each file has corresponding grib messages in the same order +
+
+Conditions 1 and 2 can be met using 
+
+      wgrib2 IN.grb -grib OUT.grb
+
+Condition 4 can be met using 
+      wgrib2 IN.grb | sort -k3 -t: | wgrib2 -i IN.grb -grib OUT.grb
+
+ +

+Then you can use the gmerge program to produce a file in +the correct order. The program gmerge is included with the +wgrib2 distribution under grib2/aux_progs/. + +

+$ ls pgb.20170107??
+pgb.2017010700	pgb.2017010706	pgb.2017010712	pgb.2017010718
+
+$ gmerge - pgb.20170107?? | wgrib2 - -ave 6hr /tmp/daily.grb
+1:0:d=2017010700:APCP:surface:0-6 hour acc fcst:
+2:92905:d=2017010706:APCP:surface:0-6 hour acc fcst:
+3:185445:d=2017010712:APCP:surface:0-6 hour acc fcst:
+4:278666:d=2017010718:APCP:surface:0-6 hour acc fcst:
+5:371535:d=2017010700:ACPCP:surface:0-6 hour acc fcst:
+6:442127:d=2017010706:ACPCP:surface:0-6 hour acc fcst:
+7:514343:d=2017010712:ACPCP:surface:0-6 hour acc fcst:
+8:588096:d=2017010718:ACPCP:surface:0-6 hour acc fcst:
+9:661594:d=2017010700:NCPCP:surface:0-6 hour acc fcst:
+...
+
+$ wgrib2 /tmp/daily.grb 
+1:0:d=2017010700:APCP:surface:4@6 hour ave(0-6 hour acc fcst),missing=0:
+2:325115:d=2017010700:ACPCP:surface:4@6 hour ave(0-6 hour acc fcst),missing=0:
+3:715210:d=2017010700:NCPCP:surface:4@6 hour ave(0-6 hour acc fcst),missing=0:
+...
+
+ + + +

Fast Averaging several files

+

+Suppose we have a month of analyses at 3 hour intervals and want +to make a monthly mean for Nov. 2014. Using the above sorting approach, the steps +would be + +

+1.  cat narr.201411????.grb2 >tmp.grb2
+2.  wgrib2 tmp.grb2 |  \
+3.     sort -t: -k4,4 -k5,5 -k6,6 -k3,3 | \
+4.     wgrib2 tmp.grb2 -i -set_grib_type c3 -ave 3hr narr.201411
+
+The first line creates a file with all the data.
+The second line make an inventory.
+The third line sorts the inventory in the order for -ave to process.
+The fourth line makes the average by processing data in the order
+  determined by the inventory created by line 3.
+
+ +

+The above approach processes one average at a time and requires a +minimal amout of memory. However, if you count the I/O operations, +you find that there are 4 I/O operations for every field as well as +the writes of the monthly means. In addition, the read (line 4) is +random access. + +

+The gmerge approach would look like + +

+1.  gmerge - narr.201411????.grb2 | \
+2.     wgrib2 - -set_grib_type c3 -ave 3hr narr.201411
+
+The first line creates a file with all the data.
+The second line makes the average by processing data from line 1.
+
+ +

+For this to work, you would have to rewrite gmerge to that it can +large number of input files. For a monthly average of 3-hourly files, +a typical linux system wouldn't have any problems. For a 30-year +climatology, the typical linux system would complain about the +number of open files. + +

The number of I/O operations with the gmerge is quite good, +every input file is read one time. The read would behave somewhere +between a sequential read and a random read. Another drawback +is the input files much have the data in the same order. + + +

The third method takes advantage of HPC file systems which +are very fast for sequential reads of large files and terrible for +random-access reads like used in the +the sort-of-the-index method. Using this method for computing +monthly means from 3-hourly NARR data was taking three quarters of +an hour on a multi-million dollar machine. +The problem was that the file system was optimized for large +sequential reads rather than small random-access reads. +The following shows another approach. + + +

+1.  cat narr.201411????.grb2 | \
+2.     wgrib2 - \
+3.        -if_fs ":HGT:200 mb:" -ave 3hr narr.201411 \
+4.        -if_fs ":UGRD:200 mb:" -ave 3hr narr.201411 \
+5.        -if_fs ":VGRD:200 mb:" -ave 3hr narr.201411 \
+6.        -if_fs ":TMP:200 mb:" -ave 3hr narr.201411 
+
+The first line copies the data in chronological order and
+   writes it to the pipe.
+The second line has wgrib2 read the grib data from the pipe.
+The third line selects the Z200 fields and runs the averaging
+  option on it.  We are assuming the narr.* fields only have
+  one Z200 field and narr.201411???? puts the data into
+  chronological order.
+Lines 4-6 apply the averaging option to other fields.
+
+ +

+The above approach computes the mean of Z200, U200, V200 and T200 data +at the same time with the use of more memory. +The I/O consists of sequential read of all the files and the +writes of the monthly means. The above script only creates +the mean of Z200, U200, V200 and T200 but you could write a +very long command line and compute the mean of all the fields in +the file. Here are the guts of a +bash script, fast_grib2_mean.sh, which creates and runs the command line. + +

+1.  wgrib2 $1 -match_inv | cut -f4- -d: | sed -e 's/:n=.*//' >$tmp
+2.  cmd="cat $* | $wgrib2 - -set_grib_type c3 "
+3.  while read line
+4.  do
+5.    cmd="$cmd -if_fs '$line' -ave $dt $out "
+6.  done <$tmp
+7.  eval $cmd
+
+1. $1 is the first file to average.
+   Line 1 creates a file with the field names (minus date codes)
+2. cmd is the command line that is being built
+3. loop over all the lines in file $tmp
+5. generate the "-if_fs/-ave" for the cmd line
+   Older versions of the web paged used -if but that caused problems when
+   $line included metacharacters such as parentheses.
+6. bash syntax to have the while loop read from $tmp
+7. run the command line
+
+ +

+Making the NARR monthly means using the above approach uses large +sequential reads which is optimal for the HPC file system. The run +time went from 3/4 of an hour to maybe a minute. + +

Fast Forecast Averaging

+ +

+The previous shell script was for a fast averaging of many analyses. +Sometimes one want to average several forecasts starting from +the same initial time. An example would producing a week-4 forecast. + +

+1.  $wgrib2 $1 -match_inv | cut -f4-5 -d:  >$tmp
+2.  cmd="cat $* | $wgrib2 - -set_grib_type c3 "
+3.  while read line
+4.  do
+5.    cmd="$cmd -if_fs '$line' -fcst_ave $dt $out "
+6.  done <$tmp
+7.  eval $cmd
+
+1. $1 is the first file to average.
+   Line 1 creates a file with the name and level for each field
+   It is assumed that the name and level is unique in the file.
+2. cmd is the command line that is being built
+3. loop over all the lines in file $tmp
+5. generate the "-if_fs/-fcst_ave" for the cmd line
+   Older versions of the web paged used -if but that caused problems when
+   $line included metacharacters such as parentheses.
+6. bash syntax to have the while loop read from $tmp
+7. run the command line
+
+

+Using the -merge_fcst option in a like +manner to the -fcst_ave option. in a like + + + +

Monthly Climatologies

+ +Once you can make an average, making a monthly climatology should be easy. Except +it isn't. Here are some of the problems that I encountered. + +
    +
  1. February has 28 days except when it doesn't. This causes problems because + wgrib2 -ave will not average 28 and 29 day intervals. +
  2. '116@6 hour ave(anl)' includes a regex metacharacter +
  3. the process id changed +
  4. the subcenter changed +
+ +The solutions were: + +
    +
  1. rewrite the grib file with
    + -if_fs '116@6 hour ave(anl)' -set_ftime2 '112@6 hour ave(anl)' -fi \
    + -if_fs '116@6 hour ave(6 hour fcst)' -set_ftime2 '112@6 hour ave(6 hour fcst)' -fi \
    + -if_fs '116@6 hour ave(3-6 hour acc fcst)' -set_ftime2 '112@6 hour ave(3-6 hour acc fcst)' -fi \
    +
  2. Use -if_fs instead of -if +
  3. rewrite the file with -set analysis_or_forecast_process_id 180 +
  4. rewrite the file with -set subcenter 0 +
+ +

+Finding items 3 and 4 was a pain. Using undocumented option v98 helps. However, the mismatches can +now be uncoverted by using a verbose mode (>0) and wgrib v2.0.6. + + +

Limitations by wgrib2 version

+

+There is a limit in the maximum number of -if_fs/-ave clauses. +Wgrib2 v2.0.6 can process up to 2000 -if and 2000 -if_fs options and +accept 10000 words on the command line. Since each -if_fs/-ave clause takes 5 +words on the command line and you need to include the name of the +input file, you get a limit of 999 -if_fs/-ave clauses. To speed up +the code, the evaluation of the -if_fs options is done in parallel. + + +

Usage

+

+ +

+-ave (time interval)  (output grib file)
+-fcst_ave (time interval)  (output grib file)
+
+   wgrib2 prior to v2.0.7 only works with PDT=4.0, 4.1 and 4.8
+    support for PDT 4.2 and 4.12 by -ave added 7.2016
+   wgrib2 v2.0.7 is limited by the -time_processing option
+
+ +

+See also: +-merge_fcst, +-time_processing +

+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: Feb 12, 2018, July 26, 2018 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/ave0.html b/docs/web_docs/ave0.html new file mode 100644 index 0000000..676218f --- /dev/null +++ b/docs/web_docs/ave0.html @@ -0,0 +1,175 @@ + + + + Climate Prediction Center - wgrib2: -ave0, -fcst_ave0 + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ncep_norm +
 
+ +

wgrib2: -ave0, -fcst_ave0

+
+ + +

Introduction

+ + +The -ave0 and +and -fcst_ave0 options are the old +(wgrib2 v2.0.6) versions of +The -ave and +and -fcst_ave. + + +

+See also: +-ave, +-fcst_ave +

+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: Sept 13, 2017 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/ave_fcst_ave_merge_fcst.html b/docs/web_docs/ave_fcst_ave_merge_fcst.html new file mode 100644 index 0000000..1c40417 --- /dev/null +++ b/docs/web_docs/ave_fcst_ave_merge_fcst.html @@ -0,0 +1,223 @@ + + + + Climate Prediction Center - wgrib2: ave vs fcst_ave vs merge_fcst + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -ave vs -fcst_ave vs -merge_fcst +
 
+ +

wgrib2: -ave vs -fcst_ave vs -merge_fcst

+
+ + +

Introduction

+ +

+The -ave, + -fcst_ave, and + -merge_fcst options all sound like +they do similar things; thus, the comfusion follows. + +

+The -ave option makes averages of +time series of fields. The fields have to identical except +for the reference time (initial time) is increasing by dt. +Typical use is the daily temperature (average of 00Z,08Z,12Z,18Z +analyses). You can use the +-ave to find the daily average 6 hour +forecasted winds (00Z,06Z,12Z,18Z runs). In this case, +you use -ave even though they +are forecasts. +

+The -fcst_ave option is for making averages +from one forecast run. The items being averaged must be identical +excep that the forecast time must increase by dt. For example, you +may compute the day-2 zonal wind from the average of the 24, 30, 36, +and 42 hour forecasts. + + + +

+ + + +Changing the time stamp is more complicated than necessary. +Depending on the type of time stamp, the options needed differ, and +the options have some arbitary limitions. It's all on how +wgrib2 evolved. Originally there was PDT 4.0 and -set_ftime and +-set_ave were written to modify the time stamp. Next came an +option to support PDT 4.8, -set_ave. The -set_ave option allowed +conversion of PDT 4.0 to 4.8. + +

+Original: :d=2014113018:6 hour fcst:
+New:      :d=2014122500:12 hour fcst:
+   options: -set_date 2014122500 -set_ftime "12 hour fcst"
+
+Original: :d=2014113018:6 hour fcst:
+New:      :d=2014122500:0-6 hour ave fcst:
+   options: -set_date 2014122500 -set_ave "0-6 hour ave fcst"
+
+Original: :d=2014113018:6 hour fcst:
+New:      :d=2014122500:124@6 hour ave(0-6 hour ave fcst),missing=0:
+   options: -set_date 2014122500 -set_ave "124@6 hour ave(0-6 hour ave fcst),missing=0"
+
+ +The options, -set_ave and -set_ftime may have to convert between PDTs. Only +a subset of the conversions are supported. + +

It was noted that the old ftime had problems with the more complicated time stamps and +ftime2 was developed to be an eventual replacement. Similarily set_ftime2 was developed +to replace the old set_ftime/set_ave options. +

+ +See also: +

+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/ave_var.html b/docs/web_docs/ave_var.html new file mode 100644 index 0000000..eab7b0c --- /dev/null +++ b/docs/web_docs/ave_var.html @@ -0,0 +1,232 @@ + + + + Climate Prediction Center - wgrib2: -ave_var + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ncep_norm +
 
+ +

wgrib2: -ave_var

+
+ + +

Introduction

+ +

+The -ave_var option is based on +the -ave option. In addition to +computing the mean, the -ave_var option +computes the sample standard deviation, minimum and maximum +values for each grid point. Welford's method for computing +the mean and variance was used because it is a +one-pass scheme with the accuracy of a two-pass algorithm. + +

+The options and expected sequence of fields is the same as +with the -ave option. + + +

Usage

+

+ +

+-ave_var (time interval)  (output grib file)
+   time interval = (integer)(units)
+   (units) = hr, dy, mo, yr
+
+ +

Example

+

+

+$ wgrib2 pgblnl.gdas.201302 -match ":UGRD:200 mb:" -ave_var 6hr out
+141:1170314:d=2013020100:UGRD:200 mb:anl:
+659:5936420:d=2013020106:UGRD:200 mb:anl:
+1177:10703131:d=2013020112:UGRD:200 mb:anl:
+1695:15432277:d=2013020118:UGRD:200 mb:anl:
+...
+$ wgrib2 out
+1:0:d=2013020100:UGRD:200 mb:112@6 hour ave(anl),missing=0:
+2:13343:d=2013020100:UGRD:200 mb:112@6 hour StdDev(anl),missing=0:
+3:24058:d=2013020100:UGRD:200 mb:112@6 hour min(anl),missing=0:
+4:37401:d=2013020100:UGRD:200 mb:112@6 hour max(anl),missing=0:
+
+Making a GrADS control for "out" requires editing the ctl file to shorten +the names of variables. +
+$ alt_g2ctl -0t out > out.ctl
+$ vi out.ctl
+.. edit out.ctl so the last 6 lines look like this
+vars 4
+UGRDdev 0 0 "UGRD:112@6 hour StdDev(anl),missing=0:200 mb" * 200 mb U stddev
+UGRDave 0 0 "UGRD:112@6 hour ave(anl),missing=0:200 mb" * 200 mb U ave
+UGRDmax 0 0 "UGRD:112@6 hour max(anl),missing=0:200 mb" * 200 mb U max
+UGRDmin 0 0 "UGRD:112@6 hour min(anl),missing=0:200 mb" * 200 mb U min
+endvars
+$ alt_gmp out.ctl
+wgrib2_flags=-npts -set_ext_name 1 -T -ext_name -ftime -lev
+wgrib2_inv=.invd02
+dtype:  dtype grib2
+tdef:  nt=1 start=00Z01feb2013 by=1mo
+zdef: nlevel=1
+resolve_dsets dset=out inctime=1mo
+resolve_dsets: no template
+scanning out (process=0)
+merge index files
+writing out index
+/export/cpc-lw-webisuzak/wd51we/bin/alt_gmp v0.0.5 finished ctl=out.ctl records matched=4, not matched=0 ctl_defn=4
+
+ +

+See also: +-ave
+ +https://jonisalonen.com/2013/deriving-welfords-method-for-computing-variance/ +

+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: Jan 25, 2017 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/big_endian.html b/docs/web_docs/big_endian.html new file mode 100644 index 0000000..74b8418 --- /dev/null +++ b/docs/web_docs/big_endian.html @@ -0,0 +1,187 @@ + + + + Climate Prediction Center - wgrib2: -big_endian, -little_endian + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -big_endian -little_endian +
 
+

+ +

wgrib2: -big_endian -little_endian + +

+ + +

Introduction

+ +

+The -big_endian and the +-little_endian +options changes the order that IEEE numbers are read and written. This +does not affect the order in which binary numbers are read/written. + + +

Usage

+

+ +

+-big_endian
+   or
+-little_endian
+
+ + +See also: +-ieee, +-import_ieee, +-header, +-no_header, +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: Aug, 2011 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/bin.html b/docs/web_docs/bin.html new file mode 100644 index 0000000..20c5458 --- /dev/null +++ b/docs/web_docs/bin.html @@ -0,0 +1,226 @@ + + + + Climate Prediction Center - wgrib2: -bin + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-bin +
 
+ +

wgrib2: -bin

+
+ + +

Introduction

+ +

+The -bin option writes the grid values to a specified +file in binary format (C: float, Fortran: real). The default order is +WE:SN (see -order option) with f77 header/trailer (see -no_header). +The undefined value is 9.999e20. The file format remains unchanged from +wgrib except the order of grid points can now be specified. + +

+When the header flag is on (default, or by the option -header), +, the header consists of an integer with the byte count of +the data. The size of the integer (4 or 8 bytes) depends on the native size +of the integer. Usually this size is compile time option. This is different +from the f77 header which is generated by -ieee which is always a 4 byte +integer. + +

When the header flag if off (by the option -no_header), the binary +grid points are written with no header. To read the data, you need to +know the size of the grid. + +

The default order of the grid point data is WE:SN. The order of +the grid point data can be changed to raw and WE:NS by use of the +-order option. + + +

On most machines, the binary format is either big or little-endian single +precision IEEE. + +

Usage

+

+ +

+-bin file_name
+     "-" sends the output to the terminal/stdout (results are unpredicatable in Windows)
+
+ + +

Example

+

+ +

+$ wgrib2 test.grb2 -s | grep ":RH:2 m" | wgrib2 -i test.grb2 -bin data.bin
+285:36796469:d=2005090200:RH:2 m above ground:60 hour fcst
+
+ +
+
+      wgrib               ==>                 wgrib2
+
+      -header -bin -o out.bin                 -header -order raw -bin out.bin
+      -bin -o out.bin                         -order raw -bin out.bin
+
+
+ +The above line extracts the 2 meter RH from file test.grb2 and writes it in data.bin + +

+See also: -text, +-netcdf, +-spread, +-ieee +-no_header +-header +-order +

+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005, March 2, 2021. +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/bin_ieee_text_format.html b/docs/web_docs/bin_ieee_text_format.html new file mode 100644 index 0000000..8fbafbe --- /dev/null +++ b/docs/web_docs/bin_ieee_text_format.html @@ -0,0 +1,262 @@ + + + + Climate Prediction Center - wgrib2: bin, text, ieee formats + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 format +
 
+ +

wgrib2: bin, ieee, text formats

+
+ + +

The bin, text and ieee formats

+ +

+The -bin, -text, -ieee +and -lola options create bin/text/ieee format files. The +format doesn't change from that used by wgrib. The difference between bin and ieee +is that bin writes the numbers in the machine's native format and ieee writes +the numbers in big_endian ieee format. + +

+
+			Text Format, with header
+
+
+(grid 1)	(nx) (ny)		grid dimensions
+		(grid value)
+		(grid value)
+		...
+		(grid value)		nx*ny values
+(grid 2)	(nx) (ny)		grid dimensions
+		(grid value)
+		(grid value)
+		...
+		(grid value)		nx*ny values
+(grid 3)	...
+
+
+
+		        Text Format, with no header
+
+(grid 1)	(grid value)
+		(grid value)
+		...
+		(grid value)		nx*ny values
+(grid 2)	(grid value)
+		(grid value)
+		...
+		(grid value)		nx*ny values
+(grid 3)	...
+
+
+	This format is not a recommended format because your code
+could easily read too many or few grid points.
+
+
+
+			Binary and IEEE, no header
+
+(grid 1)	(binary float value)		grid value
+		(binary float value)
+		...
+		(binary float value)		nx*ny values
+
+(grid 2)	(binary float value)
+		(binary float value)
+		...
+		(binary float value)		nx*ny values
+		etc
+
+	The no-header format is not a recommended format to use.  
+The format does not indicate the size of the grid. If your program 
+makes a mistake on the grid dimension, you could get interesting results.  
+However, some fortran compilers require this format for binary files (Cray, 
+ABSoft under AmigaOS).  In addition, this is the default GrADs binary format.
+
+
+
+			Binary and IEEE, with header
+
+
+(grid 1)	(binary integer)	nx*ny*sizeof(float)
+		(binary float value)
+		...
+		(binary float value)	nx*ny values
+		(binary integer)	nx*ny*sizeof(float)
+
+(grid 2)	(binary integer)	nx*ny*sizeof(float)
+		(binary float value)
+		...
+		(binary float value)	nx*ny values
+		(binary integer)	nx*ny*sizeof(float)
+
+
+    The binary-with-header format is commonly used by UNIX 
+fortrans for their binary files.  Some MS-DOS fortran compilers
+also support this format.  You can use this format with GrADS
+with the "options sequential" line in the control file.
+
+
+ +

+Note, the order of the numbers is controled by the +-order option. + + +

+See also: -text, +-bin, +-ieee, +-lola, +-order, +

+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: May 15, 2005 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/bitmap.html b/docs/web_docs/bitmap.html new file mode 100644 index 0000000..6eaa074 --- /dev/null +++ b/docs/web_docs/bitmap.html @@ -0,0 +1,205 @@ + + + + Climate Prediction Center - wgrib2: -bitmap + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-bitmap +
 
+ +

wgrib2: -bitmap

+
+ + +

Introduction

+ +

+GRIB2 has 3 ways to specify undefined values. If the grid point +data is stored as IEEE format numbers, then the IEEE format has NaN (not +a number). NaN values can considered to be a undefined value. For +complex packing, values that are outside the range of normal +values are undefined. Decoders can give these undefined values a +special value. All the packing methods support a bitmap for specifying +undefined values. + +

+The -bitmap option prints whether the record has a bitmap +and the number of undefined points as specified by the bitmap. It is possible +for an IEEE format packing to defined undefined by both NaN and a bitmap. So +in this case the number of undefined values will be larger than specified by +the bitmap. The same is true for complex packing where a bitmap could be +combined with special values undefineds. Combining two methods of specifying +undefineds would increase the file size, so it is not recommended. + +

Note that using a bitmap to specify undefined values is not as efficient +as using special-value undefineds. The file size is significantly bigger and +decoding can be slower (wgrib2's code is parallelized for special values). + +

Note that wgrib2 uses 9.999e20 for all undefined values including +special value undefineds. (The special value is ignored.) + +

Usage

+

+ +

+-bitmap
+
+ +

Example

+

+ +

+$ wgrib2 grib2.polar -bitmap
+1.1:0:no bitmap
+1.2:0:no bitmap
+
+ +See also: +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: Jan 4, 2017 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/box_ave.html b/docs/web_docs/box_ave.html new file mode 100644 index 0000000..02848ae --- /dev/null +++ b/docs/web_docs/box_ave.html @@ -0,0 +1,206 @@ + + + + Climate Prediction Center - wgrib2: -box_ave + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-box_ave +
 
+ +

wgrib2: -box_ave

+
+ + +

Introduction

+ +

+The -box_ave option does a spatial smoothing +by doing a simple box average of the data field. Amount of smoothing +can be controlled by the size of the box. +The -box_ave option can be used on regional +and global fields. To identify global fields, you can use +the option -cyclic. + +

Usage

+
+-box_ave DX DY CRITICAL_WEIGHT
+   DX=width of box (in grid points), DX has to be an odd positive integer
+   DY=height of box (in grid points), DY has to be an odd positive integer
+
+   The box average is the mean value for a box of DX x DY centered on
+   the grid point.
+
+   CRITICAL_WEIGHT
+      -1: grid(i,j) = UNDEFINED    if original grid(i,j) is undefined
+                    = box average  if original grid(i,j) is defined
+       not -1: let wt = number of grid points that are defined in the box
+            grid(i,j) = UNDEFINED     if wt <= WT
+                      = box average   if wt > WT
+
+The speed of -box_ave is O(NX*NY*DY). The O(NX*NY) method was slower
+because of poor cache utilization and false sharing.
+
+ + +

Example

+ +

+I had a high-resolution Gaussian grid and wanted to convert it to a 1x1 degree grid. +There were about 81 grid points in a 1 degree cell. The budget interpolation +in -new_grid worked but it was slow and worked by taking 25 bilinear interpolations +and averaging them to make the budget interpolation. So the pre-existing solution +was slow and slighly inaccurate. To interpolate scalars to the 1x1 grid, you can +run a box_average with 9x9 grid and then use -new_grid to get the cell average values. +This method is, as expected, slightly smoother than the budget interpolation of +-new_grid. For vectors, you have to use the budget interpolation of the -new_grid option. +

+ +See also: -new_grid, +

+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page created March 8, 2018, Page last modified: March 9, 2018 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/c_grb2_inq.html b/docs/web_docs/c_grb2_inq.html new file mode 100644 index 0000000..783ea68 --- /dev/null +++ b/docs/web_docs/c_grb2_inq.html @@ -0,0 +1,242 @@ + + + + Climate Prediction Center - c_wgrib2api: grb2_mk_inq + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > c_wgrib2api: grb2_inq +
 
+ +

c_wgrib2api: grb2_inq(..)

+
+ + +

Introduction

+ +

+To read grib using c_wgrib2api, you first need to an +index or inventory file. +Then you call grb2_inq(..) with the appropriate search terms +and the data and metadata that you want. + +

Usage

+
+    iret = grb2_inq(GRB2, INV, OPTION, (list of search terms))
+    iret:  integer
+           number of matchs to the search term
+           -1 if some error
+    GRB2: character (len=*) grib2 file
+    INV:  character (len=*) index file
+                            created by grb2_mk_inv(..)
+                                    or wgrib2 GRB -Match_inv >INV
+                            If you use an index file created by wgrib2 GRB > INV
+                             then the search terms will be appropriate to that index file.
+                             The *_date and *_edate optional arguments may not work.
+    OPTION:  unsigned integer
+ 
+    search term: character (len=*)
+                 search term matches "wgrib2 GRB2 -Match_inv"
+                 you are allowed 0 to 20 search terms
+                 Normally the search is a straight text match.  You
+                 can enable regex searches.
+    IN Optional Arguments:
+               debug: integer
+                      0      - no debug statements
+                      /= 0   - debug statements
+
+               end_date: integer (kind=8) YYYYMMDDHH search
+               end_edate: integer (kind=8) YYYYMMDDHHmmss search
+               ref_date: integer (kind=8) YYYYMMDDHH search
+               ref_edate: integer (kind=8) YYYYMMDDHHmmss search
+               start_date: integer (kind=8) YYYYMMDDHH search
+               start_edate: integer (kind=8) YYYYMMDDHHmmss search
+               verf_date: integer (kind=8) YYYYMMDDHH search
+               verf_edate: integer (kind=8) YYYYMMDDHHmmss search
+
+               lastuse: integer
+                        0    - nothing (default)
+                        /= 0 - close GRB and INV files after use
+               sequential: integer
+                           0    - rewind INV before reading, stop after 1st match
+                           /= 0 - do not rewind INV before reading, stop after 1st match
+               regex: integer
+                      0      - fixed string search (default)
+                      /= 0   - regex search
+               copy: character (len=*) filename
+                     copies matches to file
+               order: character (len=*) scan order of grid
+                      'we:sn'   - grid will be in we:sn order (default)
+                      'we:ns'   - grid will be in we:ns order
+                      'raw'     - grid will be in raw order
+                                  order as encoded in grib
+                      note: lat, lon only work with we:sn order
+    OUT Optional Arguments:
+               grid: real allocatable (:,:)
+                     grid point values
+               lat:  real allocatable (:,:)
+                     latitude values for the grid
+               lon:  real allocatable (:,:)
+                     longitude values for the grid
+               nx:   integer, grid(nx,ny)
+               ny:   integer, grid(nx,ny)
+               npts: integer, number of grid points (nx*ny)
+               nmatch: integer
+                       number of matches                     
+               msgno: integer
+                      grib message of last match
+               submsg: integer
+                       submessage number of last match
+               desc: character, (len=*)
+                     "wgrib2 -S" minus the record number and byte location
+               grid_desc: character, (len=*)
+                          "wgrib2 -grid" 
+
+ +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: Feb 21, 2017 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/c_grb2_mk_inv.html b/docs/web_docs/c_grb2_mk_inv.html new file mode 100644 index 0000000..d1876dd --- /dev/null +++ b/docs/web_docs/c_grb2_mk_inv.html @@ -0,0 +1,219 @@ + + + + Climate Prediction Center - wgrib2api: grb2_mk_inv + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > c_wgrib2api: grb2_mk_inv +
 
+ +

c_wgrib2api: grb2_mk_inv(..)

+
+ + +

Introduction

+ +

+To read grib using c_wgrib2api, you need to have an index or inventory file. +The index file is used for searching and it is quick to create. The +format of the index file keeps expanding as needed. For example, +chemical tracers were added to the grib format, so naturally the index +file had to include the possibility of a chemical type. + +

+The index file created by grb2_mk_inv('file.grb2', 'file.inv') is the same as created by + +

+  wgrib2 file.grb2 -Match_inv > file.inv
+
+ +

The inv file can be created before the C program is run. +This may be more efficient if multiple programs need to create +the inv of the same file. + +

Usage

+
+    iret = grb2_mk_inv(GRB2, INV)
+    iret:  integer
+           0 if index file created
+           1 if index file not created
+    GRB2: character (len=*) existing grib2 file
+    INV:  character (len=*) index file that is created
+          Note: special files are supported
+              @tmp:string   temporary disk file
+              @mem:N        memory file, N=0..8
+                            registers 9..19 are reserved by wgrib2api
+
+ +

Advanced Usage: pre-existing wgrib2 inventories

+ +

+Pre-existing index files (wgrib2 inventories) can be used +to save processing time. However, there are two issues. +First, the typical inventory will be smaller and contain fewer +valid search terms. Second, the C API reference +date is YYYYMMDDHHmmss rather than the YYYYMMDDHH and assumed +zero minutes and seconds. So the C-API inventory +replaces the "d=YYYYMMDDHH" by "D=YYYYMMDDHHmmss". It's +not a big deal and both formats are accepted by the grb2_wrt +routine. The difference would be apparent in a search term +that of the form, + +

+  mk_inv: ":D=YYYYMMDDHHmmss:HGT:200 mb:"
+  std inv: ":d=YYYYMMDDHH:HGT:200 mb:"
+
+ +Since the C api has added minutes and seconds to the +time stamp. Being consistent is nice. By the way, the +reference time has to be stored in a 64 bit integer when +passing to grb2_wrt. + +
+ + + + + + + + + +

+ NOAA/ + National Weather Service
+ National Centers for Environmental Prediction
+ Climate Prediction Center
+ 5830 University Research Court
+ College Park, Maryland 20740
+ Climate Prediction Center Web Team
+ Page last modified: Oct 3, 2017 +
+ Disclaimer + + Privacy Policy +
+
+
+ + + diff --git a/docs/web_docs/c_wgrib2api.html b/docs/web_docs/c_wgrib2api.html new file mode 100644 index 0000000..7123d27 --- /dev/null +++ b/docs/web_docs/c_wgrib2api.html @@ -0,0 +1,319 @@ + + + + Climate Prediction Center - c_wgrib2api + + + + + + + + + + +
+ Skip Navigation Links + www.nws.noaa.gov 
+ + + + + + + + + + +
+ NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
Climate Prediction Center
+ + + + + + + + + + + +
+
+  
+ + + + + +  
+ + + + + +

+ + + + + + + + + +
+
+ + + + + +   + +
+ About Us
+    Our Mission
+    Who We Are

+ Contact Us
+    CPC Information
+    CPC Web Team

+
+
+ + + + + + + + + + + + + + + + + + + +
 
+ HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > c_wgrib2api +
 
+ +

c_wgrib2api

+

The Easy Way of Reading and Writing Grib2 Using C

+
+ + +

Introduction

+ +

+Can a set of C make reading and writing grib2 easy? +Is it possible? +Can you read grib2 without referring to a the WMO grib standard? +Can you write grib2 without becoming an grib2 expert? Is reading and +writing grib now easier than other popular file formats? + +

+The c wgrib2api is light-weight set of routines that calls +the wgrib2 subroutine to do all the heavy work. The advantage +of this approach is that c_wgrib2api is small (fewer bugs, ease +of development) and the hard work is done by pre-existing code. +The API is modelled after the ftn_wgrib2api which useful +for both the application and library developer. + + +

Status

+

+

    +
  1. ftn_wgrib2api has been released and is being used +
  2. c_wgrib2api is in pre-release development +
  3. python_wgrib2api is in preplanning. +
+ + + +
+#include <stdio.h>>
+#include <stdlib.h>
+#include "c_wgrib2api.h"
+
+int main() {                  /* simple program to read grib2 */
+    long long int ndata;
+    int ierr;
+    float *data, *lat, *lon;
+    char meta[200], gridmeta[1000];
+
+    ierr = grb2_mk_inv("merc.g2", "merc.inv");     /* make inv/index file */
+    if (ierr) exit(1);
+
+    /* inquire - using 3 wgrib2 match strings, read data,lat,lon,metadata,gridmetadata */
+    ndata = grb2_inq("merc.g2", "merc.inv", DATA|LATLON|META|GRIDMETA,
+          ":TMP:",":d=2014050600:",":surface:");
+    if (ndata <= 0) exit(2);
+
+    /* allocate data */
+    data = (float *) malloc(ndata * sizeof(float));
+    lat = (float *) malloc(ndata * sizeof(float));
+    lon = (float *) malloc(ndata * sizeof(float));
+    if (data == NULL | lat == NULL || lon == NULL) exit(3);
+
+    ierr = grb2_get_data(data,ndata);		/* get grid */
+    if (ierr) exit(4);
+    ierr = grb2_get_lonlat(lon,lat,ndata);	/* get lat-lon */
+    if (ierr) exit(5);
+    ierr = grb2_get_meta(meta, sizeof(meta));	/* get metadata */
+    if (ierr) exit(6);
+    ierr = grb2_get_gridmeta(gridmeta, sizeof(gridmeta));	/*get grid info */
+    if (ierr) exit(7);
+
+    printf("That was easy: data[0[=%lf, lon[0]=%lf lat[0]=%lf ndata=%d\n",
+      data[0],lon[0],lat[0],ndata);
+    printf("meta=%s\n", meta);
+    printf("gridmeta=%s\n", gridmeta);
+    exit(0);
+}
+
+
+ +

+Reading doesn't get much easier than that. You are allowed an arbitrary number of +search term that are based on the wgrib2 inventory. You need to specify the +fields that you want. The above example selected "DATA|LATLON|META|GRIDMETA" to read. + +

+Writing grib2 is also easy. First you need a template which is a sample grib2 file. The +template has the correct grid and unchanging metadata such as the center and grid definition. +The writing process consists of adding +the gridded data, the new variable name, level, reference date and forecast information +such as analysis, or 12 hour forecast and perhaps some ensemble information or some similar +changing metadata. + +

Finding a template has gotten easier as grib2 has become more common. There are tools +to change the grid information (wgrib2) and change specific metadata information (wgrib2). +Suppose we already have a template. Writing a grib2 file is as easy as + + +

+#include <stdio.h>>
+#include <stdlib.h>
+#include "c_wgrib2api.h"
+#define GRIDSIZE 1679
+
+int main() {                    /* simple program write grib2 file */
+        float data[GRIDSIZE];
+        char *template;
+        int i;
+
+        /* define data[0..npnts-1] */
+        for (i = 0; i < GRIDSIZE; i++) data[i] = 10.0;
+        data[0] = 0.0;
+        template="merc.g2";
+
+        i = grb2_wrt("new.grb", template, 2, data, GRIDSIZE,"lev", "201 mb","grib_type","s",
+              "ftime", "0-1 hour ave fcst","var","UFLX","bin_prec",7,"date",20880112010259LL);
+
+        printf("writing new.grb err=%d\n", i);
+        return i;
+}
+

+Writing grib is eavn easier than reading grib. +Reading and writing is based on text strings rather numbers in a table, so you don't have to +refer to the WMO documentation. All the text strings are based on the wgrib2 inventories, +so there should be no surprises as long as you are familiar with the wgrib2 inventories. + + +

Tested Systems

+

+

  • RH6 icc + + + +

    Source Code

    +

    +The source code is included with wgrib2. Please use the +newest version of wgrib2 because c_wgrib2api is a new addition to wgrib2. To compile +and link with c_wgrib2api, you will have to use similar options that was used to +compile c_wgrib2api such as OpenMP, instruction set (32 vs 64 bits, SSE3 vs no SSE3, etc). + + + +

    +compiling (making the ftn_api)
    +Sample Code + +

    The default wgrib2/wgrib2api build includes the ipolates and netcdf3 libraries. If your fortran +code uses a different ipolates or netcdf libraries, you will have to configure the wgrib2's makefile +and rebuild the wgrib2 library without the ipolates and netcdf options. Removing the two libraries +will not have an effect on the grb2_*(..) routines. However, if the missing libraries would adversely +affect calls to wgrib2a(..) and wgrib2c(..) that use the -new_grid or -netcdf options. + + +

    +

    Documentation

    +
      +
    1. Making an index file, in order to read grib: grb2_mk_inv(..) +
    2. Reading grib: grb2_inq(..) +
    3. Writing grib: grb2_wrt(..) +
    4. Freeing files: grb2_free_file(..) +
    5. undefined grid points +
    6. HPC: introduction +
    7. HPC: reading/writing memory buffers/files +
    8. Sample fortran code: merge 2000 small grids +
    9. Example: calculating the average surface to 700 mb relative humidity. +
    +
  • + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: January 25, 2018 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/callable_wgrib2.html b/docs/web_docs/callable_wgrib2.html new file mode 100644 index 0000000..6783d2a --- /dev/null +++ b/docs/web_docs/callable_wgrib2.html @@ -0,0 +1,246 @@ + + + + Climate Prediction Center - wgrib2: callable wgrib2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > callable wgrib2 +
     
    + +

    wgrib2: callable wgrib2

    +
    + + +

    Introduction

    + +

    +Usually wgrib2 is used as a command-line utility; however, wgrib2 can called +as a subroutine. The subroutine has the same arguments as an ordinary +C main program. + +

    +   int wgrib2(int argc, char **argv);
    +
    + +Making the wgrib2 library is similar to compiling wgrib2 but the +target of the makefile is "lib". + +
    +   tar -xzvf wgrib2.tgz
    +   cd grib2
    +   export CC=gcc
    +   export FC=gfortran
    +   make
    +   make lib
    +   library is in grib2lib/
    +
    + +

    +The above wgrib2 subroutine is the lowest level interface. The next stage +is to write a fortran API for reading and writing grib. + + + +

    FTN API

    + +

    The primary way of using callable_wgrib2 is through Fortran calls. +See the web pages wgrib2api. + +

    The equivalent calls are given by, + +

    +F95:   i = grb2_mk_inv(file, inv) 
    +C:     i = wgrib2a(file,"-rewind_init", file, "-inv", inv, "-Match_inv", NULL);
    +
    + +
    +F95: i = grb2_inq(file, inv, search1, search2, grid=data, npts=ndata)
    +C:   i = wgrib2a(file,"-i_file",inv,"-rewind_init",inv,
    +            "-inv","/dev/null",     /* unix/linux */
    +            "-fgrep", search1,
    +            "-fgrep", search2,
    +            "-rpn_sto", "19",
    +            "-ftn_api_fn0","-last0","@mem:19", NULL);
    +      /* check i */
    +      ndata = wgrib2_get_reg_size(19);
    +      /* check ndata */
    +      data = (float *) malloc(ndata * sizeof(float));
    +      /* check data */
    +      i = wgrib2_get_reg_data(data, size, 19);
    +      /* check i */
    +
    + +
    +F75:  i = grb2_wrt:(file, template, tmpno, data2=grid, meta=metadata)
    +C:    i = wgrib2_set_reg(grid, ndata, 19)
    +      /* check i */
    +      sprintf(number,"%d", ndata);
    +      i = wgrib2a(template,"-rewind_init",template,
    +          "-d",number,"-rpn_rcl","19","-set_metadata_str", metadata,
    +          "-set_grib_type", "c2", 
    +          "-grib_out", file)
    +
    +

    +The Fortran interface is much nicer than the C interface. + + +

    +9/2015: The write API was tested by converting a simple GFS post-processer +to grib2. + +

    +8/2016: After a hiatus of a year, I found need to do some analyses of grib +files. To make life easier, I converted converted all the files +into grib2 and started using the ftn api to read 10s of thousands +of grib files. It's convenient to use. + +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Sep 20, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/calling_wgrib2.html b/docs/web_docs/calling_wgrib2.html new file mode 100644 index 0000000..0c4c271 --- /dev/null +++ b/docs/web_docs/calling_wgrib2.html @@ -0,0 +1,254 @@ + + + + Climate Prediction Center - wgrib2: calling wgrib2 from C + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 calling wgrib2 from C +
     
    + +

    wgrib2: Calling wgrib2 from C

    +
    + + +

    Introduction

    + +

    +There 3 basic ways to call wgrib2 from a C program. The simpler way is to call +wgrib2 and when wgrib2 finishes execution, control is returned to the calling +program. A more complicated way to run wgrib2 in another process and communicate +between the two processes. + +

    Simple: system call

    + +

    +Calling wgrib2 from C can be as simple as calling the system function + +

    +    system("wgrib2 IN.grb -match ":TMP:2 m above ground:anl:" -csv tmp2m.csv"); 
    +
    + +This approach is simple but there is overhead of initializing and running wgrib2 +as well as opening and closing of the files for every call to wgrib2. All +the communication with wgrib2 is through the file system. + +

    Wgrib2 as a subroutine, CW2

    + +

    +Wgrib2 v2.0.2 introduced the ability to call wgrib2 as a subroutine (CW2). This avoids +the overhead of loading wgrib2 into memory every time you run wgrib2. Time is +also saved by keeping the files open between calls. Memory files were introduced to +wgrib2, so that the calling program can encode and decode buffers and avoid using +the disk to communicate with wgrib2. +

    + +
    +    int argc;
    +    char argv[MAX_ARGC][MAX_STRLEN];
    +    ...
    +    ierr = wgrib2(argc, argv);
    +
    +More information is given in callable_wgrib2. This +facility was used to create a fortran api to read and write grib2. +

    + +

    Wgrib2 as a Process (Filter)

    + +A program can run wgrib2 as a process and communicate to wgrib2 by +a pipe. In this example, the main program has grib +data and it wants the data regridded or converted into netcdf. + +
    +#include <stdio.h>
    +#include <stdlib.h>
    +
    +/*
    + * how to call wgrib2 from a C program.
    + *
    + * in this example, the main program writes grib data to a pipe, 
    + * wgrib2 reads from the pipe, regrids the data and saves in a file.
    + *
    + * This example shows how to call wgrib2 from a C program
    + *
    + */
    +
    +#define INPUT_FILE  "../examples/gep19.t00z.pgrb2af180"
    +
    +
    +int main() {
    +
    +   FILE  *input, *wgrib2_input;
    +   int c,err;
    +
    +   /* open a file with "test" data */
    +   input = fopen(INPUT_FILE,"rb");
    +   if (input == NULL) exit(1);
    +
    +   /* run wgrib2 to read from stdin and interpolate to a new grid */
    +
    +   wgrib2_input = popen("wgrib2 - -new_grid_winds earth -new_grid ncep grid 221 out.221.grb","w");
    +   if (wgrib2_input == NULL) exit(2);
    +
    +   while ( (c = fgetc(input))  != EOF) {
    +	fputc(c, wgrib2_input);
    +   }
    +
    +   /* close the wgrib2 program */
    +   err=pclose(wgrib2_input);
    +   printf("all done, err=%d\n",err);
    +
    +   return 0;
    +}
    +
    +A grib encoder was developed using wgrib2 as a process. The main program would write +data to a pipe and wgrib2 would read the pipe and write a grib file. The advantage +of this approach is the the writing is multitasking. The disadvantage is that +it was difficult to develop a grib reader using this approach. Eventually CW2 was +developed to solve the grib reader problem and CW2 became the appropriate approach +for writing grib. + + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Oct 25, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/center.html b/docs/web_docs/center.html new file mode 100644 index 0000000..d6e9e99 --- /dev/null +++ b/docs/web_docs/center.html @@ -0,0 +1,191 @@ + + + + Climate Prediction Center - wgrib2: -center + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-center +
     
    + +

    wgrib2: -center

    +
    + + +

    Introduction

    + +

    +The -center option prints out the center (ex. NCEP, ECMWF) that created +the grib file. If your center is printed as a number rather than a name, feel welcome to send +an email requesting an update to the tables. + +

    Usage

    +

    + +

    +-center
    +
    + + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -center
    +1:0:center=US National Weather Service - NCEP (WMC)
    +2:46042:center=US National Weather Service - NCEP (WMC)
    +3:63079:center=US National Weather Service - NCEP (WMC)
    +...
    +
    + + See also: -set_center, + -set, + -subcenter + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/check_pdt_size.html b/docs/web_docs/check_pdt_size.html new file mode 100644 index 0000000..709cea0 --- /dev/null +++ b/docs/web_docs/check_pdt_size.html @@ -0,0 +1,192 @@ + + + + Climate Prediction Center - wgrib2: -check_pdt_size + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -check_pdt_size +
     
    + +

    wgrib2: -check_pdt_size

    +
    + + +

    Introduction

    + +

    +Wgrib2 v3.0.1 will check the size of the Product Definition Template (PDT, Section 4). +If the PDT is wrong size, wgrib2 will exit with a delayed fatal error. The fatal +error is delayed so the user can investigate the contents of the bad grib message. +Note that it is possible to seg fault because Section 4 is a different size than +expected, and the rest of the grib message may be corrupted. + +

    +You may skip the pdt size check using the option -check_pdt_size 0. +You would use this option if wgrib2 calculates the incorrect size of Section 4. + +

    Usage

    +

    + +

    +-check_pdt_size    0 disable PDT size check
    +                   1 enable  PDT size check
    +
    + +

    Example

    +

    +

    +$ wgrib2 png.grb2 -check_pdt_size 0
    +1:4:YY=2009
    +
    + + + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page created: Nov 24, 2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/checksum.html b/docs/web_docs/checksum.html new file mode 100644 index 0000000..9495609 --- /dev/null +++ b/docs/web_docs/checksum.html @@ -0,0 +1,270 @@ + + + + Climate Prediction Center - wgrib2: -checksum + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-checksum +
     
    + +

    wgrib2: -checksum

    +
    + + +

    Introduction

    + +

    +The -checksum option writes the checksum (32 bit CRC) +for the entire grib message, the decoded grid-point data or any +specified section. Two sections or messages with the same checksum are +very probably the same. If the grid-point data has the same +checksum, they are very probably bitwise identical. This option +can be used to check the integrity of a grib message or to check for +for identical sections. Note that decoded grid-point values may +not be unique. Wgrib2 is compiled with the "fast" option which may +sacrifice some precision for speed or uniqueness. For example, +A*B*C should be calculated by (A*B)*C. However A*(B*C) will be +faster if B*C was previously calculated. While +mathematically the expressions are the same, the final results may +be slightly different. +

    + +

    Usage

    +

    + +

    +-checksum N
    +1..8 for the checksum of section N
    +-1 for the checksum of the entire message
    +data for the checksum of the decoded gridded data
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -checksum 3
    +1:0:sec3_cksum=4006285726
    +2:4786:sec3_cksum=4006285726
    +3:9572:sec3_cksum=4006285726
    +4:13335:sec3_cksum=4006285726
    +5:17098:sec3_cksum=4006285726
    +
    +Section 3 is the Grid Definition Section (GDS).
    +All 5 grib messages have the same GDS
    +
    +$ wgrib2 png.grb2 -checksum -1
    +1:4:msg_cksum=827378178
    +
    +
    +
    +
    +
    +$ wgrib2 test.grb2 -checksum 3 | cut -f3 -d: | sort -u | wc -l
    + 1
    +
    +The above example prints out the number of grid defintion sections in the +file by (1) creating the checksum for the GDS, (2) extracting the GDS checksum, +(3) finding the unique checksums and finally counting them. + +

    +Space can be saved by putting combining like grib messages. For example, +if a 100 messages share the same bitmap and discipline, then the +100 messages could be combined into one message with a hundred +submessages. By combining the message, only one copy of the +bitmap is needed. This saves 99 copies of the bitmap. +

    +$ wgrib2 test.grb2 -checksum 6 | sort -k3,3 -t: | wgrib2 test.grib -i -tosubmsg new.grb2
    +1:0:d=2008120200:TMP:800 mb:anl:
    +2:4786:d=2008120200:TMP:750 mb:anl:
    +3:9572:d=2008120200:RH:800 mb:anl:
    +4:13335:d=2008120200:RH:750 mb:anl:
    +5:17098:d=2008120200:TMP:2743 m above mean sea level:anl:
    +
    +Submessage statistics:
    +- # submessages written  : 5
    +- Kbytes saved           : 0
    +- Kbytes written         : 20
    +
    + + + +

    +See also: +

    + + + + + + + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + + + +

    +See also: -undefine +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: August 15, 2014, July 2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/code_table.html b/docs/web_docs/code_table.html new file mode 100644 index 0000000..dbb6040 --- /dev/null +++ b/docs/web_docs/code_table.html @@ -0,0 +1,197 @@ + + + + Climate Prediction Center - wgrib2: -code_table + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-code_table +
     
    + +

    wgrib2: -code_table

    +
    + + +

    Introduction

    + +

    +The -code_table_X.Y option shows the value of code table X.Y in +the inventory. Code tables are parts of the nuts and bolts of the grib2 format. +To see which code tables are supported , type wgrib2 -help "code table". + +

    +wgrib2 beta 0.1.3 wesley ebisuzaki 9/2006
    +  -code_table_0.0 inv         code table 0.0 discipline
    +  -code_table_1.0 inv         code table 1.0 master table version
    +  -code_table_1.1 inv         code table 1.1 local table version
    +  -code_table_1.2 inv         code table 1.2 significance of reference time
    +  -code_table_1.3 inv         code table 1.3 production status of processed data
    +  -code_table_1.4 inv         code table 1.4 type of processed data
    +  -code_table_3.0 inv         code table 3.0 Source of grid definition
    +  -code_table_3.1 inv         code table 3.1 Grid definition template number
    +  -code_table_3.2 inv         code table 3.2 Size and Shape of Earth
    +  -code_table_3.6 inv         code table 3.6 Spectral data representation type
    +  -code_table_3.7 inv         code table 3.7 Spectral data representation mode
    +  -code_table_4.0 inv         code table 4.0 Product Definition Template Number
    +  -code_table_4.1 inv         code table 4.1
    +  -code_table_4.2 inv         code table 4.2
    +  -code_table_4.3 inv         code table 4.3 Type of Generating Process
    +  -code_table_4.4 inv         code table 4.4
    +  -code_table_5.0 inv         code table 5.0 data representation number
    +
    + +

    Usage

    +

    + +

    +-code_table_X.Y
    +      X.Y has to be one of the supported code tables
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/colon.html b/docs/web_docs/colon.html new file mode 100644 index 0000000..9d0498c --- /dev/null +++ b/docs/web_docs/colon.html @@ -0,0 +1,196 @@ + + + + Climate Prediction Center - wgrib2: -colon + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -colon +
     
    + +

    wgrib2: -colon

    +
    + + +

    Introduction:

    + +

    +The wgrib2 inventory consists of many fields separated by a colon (:). For example, + +

    +    $ wgrib2 small.grb2
    +    1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +
    + +You can change the field separator from a colon to any string. For example, + +
    +    $ wgrib2 -colon "[--]" small.grb2
    +    1:0[--]d=2009060500[--]HGT[--]200 mb[--]180 hour fcst[--]ENS=+19
    +

    +

    +You may want to use the -colon option because +you are going to be parsing the inventory with another program that uses +a different field separator. (CSV file?). + +

    Usage

    +

    + +

    +-colon string
    +
    +

    Example

    +
    +    $ wgrib2 small.grb2  -colon ':,"' -t  -colon '","'  -var -lev -ftime -misc -colon '' -print '"'
    +    1:0:,"d=2009060500","HGT","200 mb","180 hour fcst","ENS=+19"
    +
    + +See also: +-print, +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: September 27, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/compile_questions.html b/docs/web_docs/compile_questions.html new file mode 100644 index 0000000..8283b9f --- /dev/null +++ b/docs/web_docs/compile_questions.html @@ -0,0 +1,664 @@ + + + + Climate Prediction Center - wgrib2: how to compile + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 questions +
     
    + + +

    Compiling wgrib2 v3.0.2+

    +
    + +
    1) Download ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz 
    +        or https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz
    +2) remove pre-existing grib2 directory if exists: rm -r grib2
    +3) untar wgrib2.tgz:  tar -xzvf wgrib2.tgz   (use gnu tar)
    +4) cd to main directory:  cd grib2
    +
    +  For wgrib2 upto v3.1.2 .. add AEC support for ECMWF files
    +
    +5) edit makefile
    +6) change USE_AEC=0 to USE_AEC=1
    +
    +The makefile uses two and one optional environment variables that have to be set.
    +  With wgrib2 v3.0.2, you need to set $CC and $FC, and the makefile tries to identify
    +    $COMP_SYS from "uname -a".  However, if the makefile cannot identify your system,
    +    $COMP_SYS will not be set.  If your compilers are gcc and gfortran, you can
    +    try compiling wgrib2 with COMP_SYS=gnu_linux.
    +
    +
    +  linux, bsd-type OS, gcc/gfortran compilers:  COMP_SYS=gnu_linux
    +                                               CC=gcc
    +                                               FC=gfortran
    +  linux, AOCC:                                 COMP_SYS=clang_linux
    +                                               CC=clang
    +                                               FC=flang
    +  linux, icc and ifort:                        COMP_SYS=intel_linux
    +                                               CC=icc
    +                                               FC=ifort
    +  linux, icx and ifx: requires wgrib2 v3.1.2   COMP_SYS=oneapi_linux
    +    (needs src code bug fix)                   CC=icx
    +                                               FC=ifx
    +  linux, Nvidia HPC SDK                        COMP_SYS=nvidia_linux
    +                                               CC=nvc
    +                                               FC=nvfortran
    +
    +  Windows, cygwin gcc and gfortran:            COMP_SYS=cygwin_win
    +                                               CC=gcc
    +                                               FC=gfortran
    +
    +  MacOS, real gcc and gfortran:                COMP_SYS=gnu_mac
    +                                               CC=gcc
    +
    +
    +
    +  not recently tested AIX, gnu_linux_g95, open64
    +  If COMP_SYS is not defined, the makefile will attempt to determine the COMP_SYS.
    +
    +8) set environment variables and make, example
    +
    +   export CC=gcc                    (bash version)
    +   export FC=gfortran
    +   export COMP_SYS=gnu_linux        (optional in linux)
    +   make                             (to make wgrib2)
    +   make lib                         (to make wgrib2 library) 
    +
    +   For NCEP's WCOSS-2.  see the question on lib64, and WCOSS-2.
    +
    + + +

    AEC and ECMWF files

    +ECMWF started using AEC compression (type 42) June 2023. The default wgrib2 v3.1.2 and earlier +did not include AEC compression in the default build because building it requires a +recent version of CMake. Some sites, like my workplace, do not provide CMake. So I +cannot (June 2023) build the AEC library at work. +Now that ECMWCF is distributing files with AEC compression, wgrib2 v3.1.3 will include +AEC compression as default. + + +

    Intel Compilers

    + +The Intel C compiler will not compile the Jasper library (jpeg2000 support). +To get jpeg2000 support, you will either have to use OpenJPEG or compile +Jasper with the gnu compiler. The makefile will automatically use gcc when +trying to build the Jasper library when the classic Intel compilers are used. +Compiling wgrib2 using the Intel compilers on Windows is possible but is +not supported. (Grib files will be limited to 2 GB, and I have no way to test.) +

    +To compile with the intel compilers on linux, + +

    +Classic compilers
    +   export CC=icc
    +   export FC=ifort
    +   export COMP_SYS=intel_linux
    +   make
    +
    +LLVM compilers (wgrib2 v3.1.2+)
    +   need to use OpenJPEG instead of Jasper
    +   export CC=icx
    +   export FC=ifx
    +   export COMP_SYS=oneapi_linux
    +   make
    +
    + +

    Compiling with Cygwin (Windows)

    + +

    The only Windows C compiler supported is Cygwin's gcc. +The other Windows C compilers follow Microsoft's lead where +a "long int" is 32-bits on a 64 bit operating system. Wgrib2 +will work with a 32-bit long int but will limit a grib file +to barely acceptable 2GB size. Cygwin's gcc also supports POSIX +which means that you don't have to turn off features that require POSIX. + +

    Compiling in MacOS

    + +

    You need to use compile with gcc and gfortran. The default MacOS +installation has gcc pointing to clang. You can get the real deal +from homebrew. + +

    With wgrib2 v3.0.0, MacOS support is now builtin. For prior +releases, there have been nice pages which detail the compiling process. + +

    With wgrib2 v3.1.2, you have to turn off proj support. + +

    Compiling with other compilers

    + +

    +There is no support for other compilers. At one time, AIX was +supported until our machines were scraped (2012). Use to support +gcc/g95 and the open64 compilers until development was stopped on +g95 and open64. I haven't tried the Cray compilers because +the Crays are already well supported by gcc/gfortran, icc/ifort +and clang/flang. + +

    While there is no support for other compilers, the wgrib2 source +code was written to be operating system, compiler and hardware independant. The only +limitation is that integers need to be 32+ bits long. The only compiler/hardware +feature is an optional optimization to replace a loop with a __builtin_clz() +which works when GNUC >= 4. The main difficulties with porting to another +system should be in the libraries and disabling POSIX features. + + + +

    Makefile Options

    + + + +

    There are many options that are documented in the makefile (grib2/makefile). +There are options to remove features that require POSIX support. There are +options to remove libraries that are not public domain or not under a GNU license. +There are options for code that may be difficult to cross-compile. + +

    Python Support, make a shared library

    + +

    +Python support requires a shared wgrib2 library. This option +only works for gnu/linux, gnu/MacOS, gnu/Windows, nvidia/linux AOCC/linux, icx/ifx. + +

    +  MAKE_SHARED_LIB=1
    +   note: to make the shared library $ make clean
    +                                    $ make lib
    +                                    shared library will be in lib/
    +
    + + +

    Grib names

    +

    +With wgrib2 v3.0.2, the grib variable names are shown using the +DWD, ECMWF or NCEP tables. The locally defined variable names are +shown by the table of the local center. This option sets the default +grib table. +

    +Not all names could be +accommadated because some of the names had level, timing information +This feature is more beta because of the difficulty with level +and timing information in the variable names. +

    +  USE_NAMES=NCEP          use NCEP name (default)
    +  USE_NAMES=ECMWF         use ECMWF names
    +  USE_NAMES=DWD1          use DWD names, DWD has two center ids.
    +
    + + +

    NetCDF

    + +
      +
    • Option 1: No NetCDF support +
        +
      • fastest compile +
      • small executable (3.9 MB as of 2014) +
      • compile works on 32+ bit machines +
      • cannot read nor write NetCDF files +
      • no library conflicts in wgrib2lib when calling program + uses netcdf or hdf +
      • makefile configuration: USE_NETCDF3=0, USE_NETCDF4=0 +
      + + +
    • Option 2: NetCDF3 support (default in makefile) +
        +
      • fast compile +
      • modest increase in executable size (5.7 MB vs 3.9 MB as of 2014) +
      • compile may fail on 32-bit machines +
      • library conflict in wgrib2lib when calling program that uses netcdf +
      • makefile configuration: USE_NETCDF3=1, USE_NETCDF4=0 +
      +
    • Option 3: NetCDF4 compile libraries +
        +
      • slow compile time (hours on an Intel Apollo Lake) +
      • 3.5x increase in executable size (13.5 MB vs 3.9 MB as of 2014) +
      • makefile configuration: before wgrib2 v3.1.2 USE_NETCDF3=0, USE_NETCDF4=1 +
      • makefile configuration: wgrib2 v3.1.2+ USE_NETCDF3=0, USE_NETCDF4=compile, USE_HDF5=compile +
      • may or may not work +
      • User is resonsible for validating the results using the netcdf4/hdf5 libraries. +
      • library conflict in wgrib2lib when calling program also uses netcdf +
      • prompts for downloading netcdf4/hdf5 libraries +
      +
    • Option 4: NetCDF4 and HDF5 system libraries (v3.1.2+) +
        +
      • In some systems, the netcdf4 and hdf5 libraries are automatically found +
      • makefile configuration: wgrib2 v3.1.2+ USE_NETCDF3=0, USE_NETCDF4=system, USE_HDF5=system +
      • User is resonsible for validating the results using the netcdf4/hdf5 libraries. +
      +
    • Option 5: NetCDF4 and HDF5 libraries installed (v3.1.2+) +
        +
      • makefile configuration: wgrib2 v3.1.2+ USE_NETCDF3=, USE_NETCDF4=A:B, USE_HDF5=C:D +
      • A=directory of the NetCDF4 includes +
      • B=directory of the NetCDF4 libraries +
      • C=directory of the HDF5 includes +
      • D=directory of the HDF5 libraries +
      • User is resonsible for validating the results using the netcdf4/hdf5 libraries. +
      +
    + +

    +The NetCDF4 option is currently unsupported (10/2020). Compiling +NetCDF/HDF5 is strongly dependent on the compiler and linux distribution. +Testing has been a pain as some errors only occur in specific situations. +The user needs verify that NetCDF/HDF5 is working. + + +

    JPEG2000: Jasper, OpenJPEG

    + +

    With wgrib2 v3.0.0, jpeg2000 compression can be handled by either the +Jasper or OpenJPEG library. Both libraries are equally slow and files are +roughly the same size. (I haven't tried compiling OpenJPEG with AVX2.) +The advantages with the Jasper library is that the last problem with the Jasper library was fixed +may years ago. The disadvantage with Jasper is that support may be lacking and +it doesn't compile with several C compilers. +The advantage with OpenJPEG is the support is ongoing. The disadvantage is that it requires +cmake to build. Consequently I cannot build and test the OpenJPEG version on my linux +workstation at work. Eventually OpenJPEG will be the default option. + + +

    Some libraries are being created in grib2/lib64

    + +

    Normally the libraries created by the wgrib2 build are stored in +grib2/lib. However, I found one weird machine that put some libraries in grib2/lib64. +One builds many of the libraries by first configuring the build by running +the "./configure" program. The "./configure -help" command says the libraries +will be saved in (whatever)/lib. However, in the weird machine, the +$CONFIG_SITE script changes it ti (whatever)/lib64. In my case, you can +work around this $CONFIG_SITE by + +

    +$ make
    +  (crash)
    +$ cp -r lib64/* lib/
    +
    +if you want the wgrib2 program
    +$ make
    +
    +if you want the wgrib2 library
    +$ make lib
    +
    +
    +
    +
    +

    Missing zlib.h

    +
    +

    +I haven't been able to reproduce this compiling problem. The png compression requires +both the zlib library and the zlib.h include. I suspect that the libpng configure program +is using the system zlib because it finds the system zlib library. Perhaps the fix is +to install the zlib.h files by installing the "zlib-develop" package. Another fix +is to remove the system zlib and let libpng use the wgrib2-supplied zlib. The third +fix is to diable png compression in the make file. PNG compression +is not very good and I have only seen it used by RADAR files from ESRL. + + +

    wgrib2 compile questions

    + +

    +

    Question: Warnings about parameter type mismatch in fftpack.f"?
    +
    +Answer:
    +   The file fftpack.f is was written to an old fortran standard
    +before you had an allocatable array and memory was at a premium.
    +To save space, a real work array was defined and used in some parts 
    +of the code.  The same array was used in other parts of the code 
    +which needed an integer work array.  You save memory by using the 
    +same array in both places.  It was common practice and the old 
    +compilers didn't complain.  Ignore the warnings.
    +
    +

    +

    Question: Why do you not support "make install"?
    +
    +Answer:
    +
    +  "Make install" is not supported by the makefile because
    +installation is just copying the executable to another location.
    +There is no obvious default for all systems.
    +
    + +

    +

    Question: Why do you build japser with the following flags?
    +
    +     --disable-libjpeg --disable-opengl
    +
    +Answer:
    +
    +Libjpeg is not needed by wgrib2.  The makefile should work when
    +the system doesn't have libjpeg installed.
    +
    +Opengl is not needed by wgrib2. Makefile should still work when the 
    +system doesn't have opengl installed.
    +
    +The wgrib2 makefile compiles the libraries in a manner optimized for wgrib2.
    +The libraries are not meant for general use.  For example, the netcdf library
    +doesn't have a fortran interface because I want the makefile to
    +work if a user lacks a fortran compiler. 
    +
    + +

    +

    +
    +Question: Why do build zlib and libpng?
    +
    +Answer:  Not all linux distributions include libpng or they give it a 
    +different name.  Some linux distributions may have different versions 
    +of libpng and zlib.
    +
    + +

    +

    Question: Why don't you make netcdf4 the default netcdf package?
    +
    +Answer:
    +
    +The Netcdf4/hdf5 libraries are very big and the end result is a long
    +download time and a large executable. If you decide to compile with
    +Netcdf4, the make will fail with the commands needed to download
    +the netcdf4 and hdf5 libraries.  After you have download the libraries,
    +the make should work. 
    +
    +At the current time (9/2020), compiling with the netcdf4 option has been 
    +unsupported for a few years.  (Classes of users will have problems and nothing
    +can be done.) Until recently, the hdf5 library had problems being compiled 
    +with the newer versions of gcc.  The latest version will compile with the 
    +gcc included with Ubuntu.  However the newest version breaks the -import_netcdf
    +option with a uninformative hdf5 error message. 
    +
    + +

    +

    Question: Why don't you automatically download the netcdf and hdf5 packages?
    +Answer:
    +
    +   People concerned about security would not like that action.
    +
    + +

    +

    Question: I get the error messagee: /bin/sh: ./configure: Permission denied
    +
    +Answer:
    +
    +It is possible to configure a filesystem so that the execute bit is
    +set to zero. Programs and scripts will not execute when they reside
    +on that filesystem.  Try compiling on another filesystem.  If that doesn't
    +work, you are probably not allowed to download programs.  The solution
    +is to ask that your sys admin to compile the program for you.  But if
    +your sys admin will compile code for you, why are you reading this page?
    +Let him read this page.
    +
    +

    +

    Question: Why the options to turn off aec, jpeg2000 and png compression
    +
    +Answer:
    +
    +Some HPC machines use one type of cpu and/or OS to compile and
    +another type of cpu and/or OS to run (cross-compile).  Using configure
    +scripts can be a challenge when cross-compiling.  I wanted a reasonable
    +wgrib2-subset that can be cross-compiled.  Consequently all libraries that
    +that require a configure script are optional.
    +
    +The configure programs of various libraries may not handle certain
    +machines or compilers.  For example an ARM user had to turn off the
    +jasper library.  Clang on the MacOS may be a problem for the AEC
    +library.
    +
    + +

    +

    Question: Why does compiling wgrib2 with the Netcdf option fail?
    +
    +Answer:
    +
    +This frequently happens with 32-bit machines.  This problem goes away
    +on a 64-bit platform or if netcdf-4 is used instead of netcdf-3. This
    +problem is not being addressed because of a lack of 32-bit machines.
    +
    +Some versions of hdf5 will not compile with modern C compilers.
    +
    + +

    +

    Question: Why the option to turn off g2clib?
    +
    +Answer: g2clib is not needed but it can be installed for testing at NCEP.
    +
    +

    +

    Question: Why gctpc and proj4? Why not proj4 without gctpc?
    +
    +Answer: Gctpc and proj4 are both projection libraries and only one is
    +really needed.  Proj4 has more functionality, is modern and has an
    +active support group.  Gctpc is old and is more-or-less unsupported.
    +On the other hand, gctpc is simpler, works and supports OpenMP like the
    +rest of wgrib2.  Proj4 supports a different threading model.  As
    +grids get larger, you want the speed of gctpc. Both libraries are being 
    +supported in order to help debugging and in the case that a future
    +grid requires Proj4 support.
    +
    +

    +

    Question: Why so many compile options?
    +
    +Answer:  
    +  Some systems or compilers do not support certain POSIX features
    +  Some functionality is not needed by most systems.
    +  Not all systems have fortran, MySQL, or support NetCDF/HDF5.
    +  The code that calls IPOLATES is not using a standard interface.
    +  Some systems do not handle cross-compiling easily.
    +  Some uses of wgrib2 may require a small RAM usage.
    +  Same makefile is used to compile the wgrib2 library.
    +  Some compilers may not support C99 or C11 (future).
    +
    + +
     Problem: I compiled wgrib2 and when I run it, it complains about 
    +      missing libraries.
    +
    +Answer:
    +  I have the same problem with our Cray.  If you compile with the Intel 
    +  compilers, you have to load the Intel environment before running the
    +  executables.  If you compile with the GNU compilers, you have to load 
    +  the GNU environment before running.  The way to get around this
    +  problem is to compile wgrib2 with the same compiler that was used
    +  to compile the system commands.  (An old version of gcc/gfortran.)
    +
    + +
    Question: I am compiling with Intel Compilers and amd getting undefined references.
    +
    +Answer:
    +  If you get an error message to a "ompc" routine like
    +
    +      Ncpu.c:(.text+0x24): undefined reference to `ompc_set_num_threads'
    +
    +  This is because you are using an old Intel compiler.  The makefile uses the 
    +current option to enable OpenMP rather than the old option.  
    +
    + +
    Question: Why don't the get_*.sh work?
    +
    +Answer:
    +   The get_*.sh scripts download tables from the WMO github servers,
    +and local tables from various centers.  My work machine has wget v1.14,
    +and gets this error.
    +
    +    wget: unable to resolve host address ‘-o-’
    +
    +My home machine has wget v1.20 and works.  The created *.dat file can
    +be used on machines with an old wget.
    +
    + +
      Question: how to compile on RedHat 6? 
    +
    +RedHat 6 uses an old version of gcc (v4.4) which doesn't fully support 
    +OpenMP v3.1.  You can compile wgrib2 v2.0.8.  For a more modern version
    +of wgrib2, you will have to turn off OpenMP and Proj4 by changeing grib2/makefile
    +
    +   USE_OPENMP=0
    +   USE_PROJ4=0
    +
    +Of course, moving to a newer version of Redhat means that you getting
    +more wgrib2 testing.  Testing building wgrib2 was tested on RH8 but
    +not RH6. Future testing will include building on RH7, RH8, Ubuntu v20.04LTS,
    +and Ubuntu v22.04LTS.  
    +
    +
    + + +
      Question: how to compile on WCOSS-2 using icc/ifort? 
    +
    +   module install intel/19.1.3.304    module load the intel compiler
    +   export CC=icc
    +   export FC=ifort
    +   make                               this will fail because of missing libraries
    +   cp lib64/*a lib/                   they changed configure to write the libraries to lib64 instead of lib
    +   to make wgrib2: make
    +   to make libwgrib2: make lib
    +
    +   OpenJPEG will not compile on WCOSS-2.  OpenJPEG requires the png, tiff, lcms, z libraries
    +   and the WCOSS2 build complains about missing libjbig and liblzma.  I see them in /usr/lib64.
    +
    +   Icc/ifort will compile OpenJPEG on my personal machine. I spent enough time with compiling 
    +   wgrib2 on this weird machine.
    +
    + + + + + + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page modified: Dec 29, 2017, Oct 13, 2019, Sep 30, 2020, Oct 2020, Feb 2021, Oct 2021, Jan 2023. Feb 2023 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/config.html b/docs/web_docs/config.html new file mode 100644 index 0000000..3711cd2 --- /dev/null +++ b/docs/web_docs/config.html @@ -0,0 +1,224 @@ + + + + Climate Prediction Center - wgrib2: -config + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-config +
     
    + +

    wgrib2: -config

    +
    + + +

    Introduction

    + +

    +The -config option shows the configuration of wgrib2 +and then ends the program. + +

    Usage

    +

    + +

    +-config
    +
    + +

    Example

    +

    +

    +$ wgrib2 -config
    +wgrib2 v0.1.7.8h 4/2009 Wesley Ebisuzaki, Jaakko Hyvätti, Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Arlindo da Silva, Niklas Sondell, Sergey Varlamov
    +
    +Compiled on 10:54:05 Apr 24 2009
    +
    +Netcdf3 package is installed
    +Netcdf4 package is not installed
    +mysql package is not installed
    +regex package is installed
    +tigge package is installed
    +maximum nunber of arguments on command line: 300
    +stdout buffer length: 30000
    +g2clib is the default decoder
    +
    +

    +Here is the config four years later. +

    + +
    +$ wgrib2 -config
    +bash-4.1$ wgrib2 -config
    +wgrib2 v0.1.9.9beta3 8/2013 Wesley Ebisuzaki, Reinoud Bokhorst, Jaakko Hyvätti, Dusan Jovic, Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Arlindo da Silva, Niklas Sondell, Sergey Varlamov
    +
    +Compiled on 12:09:10 Sep  3 2013
    +
    +Netcdf package: "3.6.3" of Sep  3 2013 12:01:28 $ is installed
    +mysql package is not installed
    +regex package is installed
    +tigge package is installed
    +interpolation package is installed
    +gptpc interface: experimental v0.1
    +UDF package is not installed
    +maximum number of arguments on command line: 5000
    +maximum number of -match,-not,-if, and -not_if arguments: 1000
    +stdout buffer length: 30000
    +default decoding: g2clib emulation
    +g2clib decoders are installed
    +user gribtable: (none)
    +C compiler: gcc
    +Fortran compiler: gfortran
    +OpenMP: control number of threads with environment variable OMP_NUM_THREADS
    +INT_MAX:   2147483647
    +ULONG_MAX: 18446744073709551615
    +
    + +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/convert_wgrib2.html b/docs/web_docs/convert_wgrib2.html new file mode 100644 index 0000000..391a48d --- /dev/null +++ b/docs/web_docs/convert_wgrib2.html @@ -0,0 +1,293 @@ + + + + Climate Prediction Center - wgrib2: wgrib -> wgrib2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib -> wgrib2 +
     
    + +

    wgrib -> wgrib2

    +
    + + +

    Changed options

    + +

    +Converting scripts that use wgrib to wgrib2 should be straight forward. + + +

    +       wgrib                             wgrib2
    +
    +       -d all                            (no option needed)
    +       -d N                              -d N or -d N.M (for grib2 submessages)
    +       -bin -o FILE.BIN                  -bin FILE.BIN
    +       -text -o FILE.TXT                 -text FILE.TXT
    +       -ieee -o FILE.BIN                 -ieee FILE.BIN
    +       -grib -o FILE.GRIB                -grib FILE.GRIB
    +       -nh                               -no_header
    +       -h                                -header
    +       -verf (sets verf time flag)       -verf (write inventory with verf time)
    +       -s -verf                          -verf
    +       -PDS/-PDS10                       n/a, use -get_bytes
    +       -GDS/-GDS10                       n/a, use -get_bytes
    +       -ncep_opn/-ncep_rean              not needed
    +       -4yr                              not needed, -4yr is always set
    +       -ncep_ens                         n/a, not needed
    +       -p                                n/a
    +       -dwdgrib                          n/a, not needed
    +       -H                                n/a
    +       -o                                not needed, syntax change
    +       -----                             -order ???? (grids are converted to we:sn order by default)
    +                                         use -order we:ns for GFS, nothing for NAM.
    +
    + + +

    Changed inventory format, different searches

    + +

    +The wgrib2 inventory has changed. The various grep/egreps will have to be +changed to see if they are compatible with new inventory format + +

    +works:
    +            wgrib  FILE | grep ":HGT:" | wgrib -i  FILE -bin -o FILE.BIN
    +            wgrib2 FILE | grep ":HGT:" | wgrib2 -i FILE -bin FILE.BIN
    +            wgrib2 FILE -bin FILE.BIN -match ":HGT:"
    +
    +works:
    +            wgrib -4yr FILE | grep ":d=2006081712:" | wgrib -i  FILE -bin -o FILE.BIN
    +            wgrib2 FILE | grep ":d=2006081712:" | wgrib2 -i  FILE -bin -o FILE.BIN
    +            wgrib2 -match ":d=2006081712:" FILE -bin -o FILE.BIN
    +
    +wgrib2 uses a 4 digit year code.  Scripts using 2 digit years need to modified.
    +
    +convert:
    +            wgrib  FILE | grep ":d=06081712:" | wgrib -i  FILE -bin -o FILE.BIN
    +            wgrib2 FILE | grep ":d=2006081712:" | wgrib2 -i  FILE -bin -o FILE.BIN
    +            wgrib2 -match ":d=2006081712:" FILE -bin FILE.BIN
    +
    +wgrib2 doesn't print out kdps5 .. kpds7 which are not applicable to grib2.
    +
    +convert:
    +            wgrib  FILE | grep "kpds5=7:kpds6=100:kpds7=500:" | wgrib -i  FILE -bin -o FILE.BIN
    +            wgrib2 -match ":HGT:" -match ":500 mb:" -bin FILE.BIN FILE
    +
    +            Note: kpds5/6/7 are table dependent so using HGT/500 mb was more reliable.
    +
    + + + + + +

    grep/egrep

    + +

    When you use wgrib, you end up using lots of greps. Many +of the greps will have to be rewritten because the text has +been altered (ex. "10 m above gnd" -> "10 m above ground"), +are gone ("kpds5=6"), or replaced by a new format. GRIB2 is +big compared with GRIB1 so things had to change. Generally +the wgrib2 version use fewer abbreviations because it is +easier to understand and line length is less of an issue +with a flexiable inventory format. + +

    grep versus egrep

    + +

    Sometimes you want grep (pattern matching) rather than egrep (regular expressions, REGEX). +This can happen when your search string could have metacharacters. You can alter +the type of search used by the various options by the "-set_regex N" option. +With the default value (N=0), extended REGEXs are used (egrep). N=1 gives a pattern +match like grep and N=2 gives and extended regex with a need to quote the metacharacters. + + + + +

    Scan, Order of the Data

    + +In wgrib, files were decoded in the "raw" order; i.e., the order that they were +written. For most files the order was we:ns or we:sn. With GRIB2, the complexity +of the order was increased. In order to make life easier for the user, wgrib2, +by default, put the data in a we:sn order. (There is an option to put the data +in a we:ns order.) + +

    Command line: order of options

    + +With wgrib, option processing was simple. You didn't care where +the option went and if you had conflicting options, the last one +was used. With wgrib, the flags changed the configuration before +the processing of the grib data. + +

    +Wgrib2 is a much more dynamic program. Each option now runs +a subroutine. As with subroutines, the order is important +and the subroutine can be called multiple times. These +subroutines are run in following order. + +

    +Initialize:
    +
    +1) In command-line order with the mode set to Initialize.  This
    +stage is used to open files, initialize arrays and can be used
    +to parse the arguments.
    +
    +Processing:
    +
    +2) In command-line order with mode set to Process and a copy of 
    +the data and latitudes and longitudes (if requested).  This is
    +repeated for each field.
    +
    +Finalize:
    +3) Each called routine is executed with the mode set to Finalize.
    +This allows the routines to complete any pending operations
    +(example, averaging) and free up arrays.
    +
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: April 1, 2011 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + diff --git a/docs/web_docs/count.html b/docs/web_docs/count.html new file mode 100644 index 0000000..089e621 --- /dev/null +++ b/docs/web_docs/count.html @@ -0,0 +1,200 @@ + + + + Climate Prediction Center - wgrib2: -count + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-cout +
     
    + +

    wgrib2: -count

    +
    + + +

    Introduction

    + +

    +The -count option just counts the number +of fields. It is very similar to the piping the output of +wgrib to the "wc -l". The advantage of using +-count is that the inventory is displayed +and the count goes to stderr. By retaining stderr, one +could make sure the expected number of records were processed. + +

    Usage

    +

    + +

    +-count
    +
    + +

    Example

    +

    + +

    +$ wgrib2 fcst.grb2 -count
    +-sh-3.00$ wgrib2 fcst.grb2 -count
    +1:4:d=2007032600:HGT:1000 mb:anl:
    +2:422561:d=2007032600:HGT:1000 mb:3 hour fcst:
    +number of records: 2
    +
    + +The above example shows that there were two records in the file. + +
    +$ wgrib2 fcst.grb2 -count -match fcst
    +2:422561:d=2007032600:HGT:1000 mb:3 hour fcst:
    +number of records: 1
    +
    + +The above example shows that only 1 record had the string fcst in it. + +See also: -grid_changes +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/cress_lola.html b/docs/web_docs/cress_lola.html new file mode 100644 index 0000000..f0b4187 --- /dev/null +++ b/docs/web_docs/cress_lola.html @@ -0,0 +1,231 @@ + + + + Climate Prediction Center - wgrib2: -cress_lola + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -cress_lola +
     
    + +

    wgrib2: -cress_lola

    +
    + + +

    Introduction

    + +

    +The -cress_lola option is similar to the +-lola option in that it creates a regular LOngitude-LAtitude grid. +The former uses a Cressman analysis and the latter option uses a nearest-neighbor interpolation. + +

    You need to specify the lower +left corner of the grid, the number of points in the zonal and meridional directions +and the latitude/longitude increments. Finally you need to specify the output file +and the format. WARNING: winds and other vector fields will not be +rotated. If the vector fields use a grid relative orientation, +then your interpolated winds will be using the original grid. + + +

    Interpolation scheme

    +

    +The interpolation to the lola grid is by a Cressman analysis. The Cressman analysis +is a multipass system which uses a user-specified "radius" for each pass. +A Cressman analysis can be computationally expensive so you may want to explore +multiprocessing techniques. + + +

    Usage

    +

    + +

    +-cress_lola LonSW:#lon:dlon LatSW:#lat:dlat file radius1:radius2:..:radiusN
    +
    +LonSW        Longitude of the South-West point, values from 0 .. 360
    +#lon         number of longitude points
    +dlon         spacing of the points in the zonal direction in degrees
    +
    +LatSW        Latitude of the South-West point, values from -90 .. 90
    +#lat         number of latitude points
    +dlat         spacing of the points in the meridional direction in degrees
    +
    +file         name of the output grib file
    +
    +radiusM      The radius in km for M-th pass.
    +
    +
    + +

    Prelim - Cressman Analysis

    + +
    +defintion: input grid = observations = grid from the input grib file
    +           output grid = grid as defined by  LonSW:#lon:dlon LatSW:#lat:dlat
    +
    +(1) compute mean of observations,save mean on background grid (output)
    +    background(i,j) = average(observation)
    +
    +(2) Repeat N times:  PASS-M
    +
    +   (a) find background value for observations by bilinear interpolation of background grid
    +   (b) remove the background from the observations: obs' = obs - interpolated_background
    +   (c) inc'(i,j)  = weighted average of obs'
    +           inc'(i,j) is increment on output grid
    +           weighted average of obs' depends on the distance between grid point and obsservation
    +   (d) new background = background + inc'
    +
    + +

    +Warning, this scheme doesn't handle handle rotated winds in a useful manner. +There will also be problem with analyzing winds near the poles. + +

    +See alse: +-lon +-lola +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Nov 2011 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/crlf.html b/docs/web_docs/crlf.html new file mode 100644 index 0000000..28de7a3 --- /dev/null +++ b/docs/web_docs/crlf.html @@ -0,0 +1,180 @@ + + + + Climate Prediction Center - wgrib2: -crlf + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -crlf +
     
    + +

    wgrib2: -crlf

    +
    + + +

    Introduction

    + +

    +On unix/linux machines, wgrib2 terminates the end of a inventory line by a LF (newline or "\n"). +On Windows machines, wgrib2 terminates the end of a inventory line by a CRLF. +The -crlf option is for unix/linux machine so that they terminate +the line by CRLF. This will make the inventory Windows compatible. +

    + +

    Usage

    +

    + +

    +-crlf
    +
    + + + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/csv.html b/docs/web_docs/csv.html new file mode 100644 index 0000000..d718bbe --- /dev/null +++ b/docs/web_docs/csv.html @@ -0,0 +1,344 @@ + + + + Climate Prediction Center - wgrib2: -csv + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-csv +
     
    + +

    wgrib2: -csv (comma separated values)

    +
    + + +

    Introduction

    + +

    +The -csv option writes the grid values to a specified +file as a comma separated values (text) which can be imported into a +spread sheet. This function is similar to -spread +and -csv_long with a different output format. + +

    +   "time0","time1","field","level",longitude,latitude,grid-value
    +
    + +

    +For an analysis that is valid at a specific time, time0 and time1 +will have the same value. For a temporal average or accumulation +of analyses, time0 will be the start and time1 will be end of +the average or accumulation. + +

    +For a forecast, time0 will be the start of the forecast (i.e, date +of the initial conditions). For a forecast for a specific time, +then time1 will be time that the forecast is valid. For a forecast +of a temporal average or accumulation, time1 wll be the end of the +average or accumulation. + +

    In grib speak, time0 is the reference time and time1 is +the verification time. Here are some examples, + +

    +1:0:d=2009062900:TMP:surface:anl:     (default inventory)
    +
    +   This an analysis (anl) of the surface temperature.
    +   This analysis is valid for 2009062900.
    +   Time0 = 2009062900    Time1 = 2009062900
    +   field=TMP             level=surface
    +
    +29:1155322:d=2009060500:UGRD:925 mb:180 hour fcst:ENS+19     (default inventory)
    +   This is a 180 hour forecast of the 925 hPa zonal wind.
    +   The forecast run uses initial conditions at 2009060500
    +   and verifies 180 hours laster at 2009061212.  
    +   Time0 = 2009060500    Time1 = 2009060500
    +   field=UGRD            level = 925 mb
    +
    +43:1844451:d=2009060500:APCP:surface:174-180 hour acc fcst:ENS=+19     (default inventory)
    +   This is a forecast of accumulated precipitation from 174 to 180 hours.
    +   The forecast run uses initial conditions at 2009060500 and 
    +   accumulates the precip from 2009061206 to 2009061212.  The
    +   verification time is defined as the end of the accumulation period
    +   Time0 = 2009060500    Time1 = 2009060500
    +   field= APCP           level= surface
    +
    + +

    +The -csv option only works on the grids +for which wgrib2 can derive latitude and longitudes values. +Otherwise no output is generated. The undefined value is 9.999e20. + +

    +The size of a CSV file can be overwhelming. One technique is to +only generate the CSV for variables that you need. This can be +done with the -match option. Even with +the -match option, the high-resolution +models can stil generate huge files. The next technique is +to undefine the grid points that you don't want. For example, +you are only interested in Hawaii (its 0C outside as I write +this). Then you can use the the -undefine option +to set the grid points outside of the Hawaii domain to undefined. +Since -csv doesn't print undefined +grid points, the CSV files is much smaller. + +

    Extended Variable Names

    + +

    The default field value (see above) is the grib name such as TMP or HGT. +However, the grib name may not be unique. For example, the field could be +the HGT from the 19th ensemble member. A better field name may be +"HGT.ENS=+19". You enable the extended variable name by adding the option +-set_ext_name 1. + + +

    Usage

    +
    +-csv output_file_name
    +   the field is the grib name
    +   output_file_name cannot be a memory file
    +-set_ext_name 1 -csv output_file_name
    +   the field is the extended grib name
    +   output_file_name cannot be a memory file
    +
    +

    Example 1

    +

    +

    +$ wgrib2 fcst.grb2 -csv junk 
    +1:0:d=2007032600:HGT:1000 mb:anl:
    +2:125535:d=2007032600:HGT:1000 mb:3 hour fcst:
    +$ cat junk 
    +"2007-03-26 00:00:00","2007-03-26 00:00:00","HGT","1000 mb",0,-90,164.1
    +"2007-03-26 00:00:00","2007-03-26 00:00:00","HGT","1000 mb",0.5,-90,164.1
    +"2007-03-26 00:00:00","2007-03-26 00:00:00","HGT","1000 mb",1,-90,164.1
    +"2007-03-26 00:00:00","2007-03-26 00:00:00","HGT","1000 mb",1.5,-90,164.1
    +...
    +"2007-03-26 00:00:00","2007-03-26 03:00:00","HGT","1000 mb",-1.5,90,-91.7
    +"2007-03-26 00:00:00","2007-03-26 03:00:00","HGT","1000 mb",-1,90,-91.7
    +"2007-03-26 00:00:00","2007-03-26 03:00:00","HGT","1000 mb",-0.5,90,-91.7
    +
    + +

    Example 2: CSV for one point

    + +

    +Suppose we want a CSV for one point. You use the -undefine option +to set the to undefined except for the selected point. Suppose we have a 1x1 grid. + +

    +$ wgrib2 gep19.aec   -undefine out-box .9:1.1 10.9:11.1 -csv  1E11N.csv
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +2:70707:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    +3:96843:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    +...
    +$ cat 1E11N.csv 
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",1,11,12440.8
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","TMP","200 mb",1,11,219.6
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","RH","200 mb",1,11,100
    +...
    +
    + +

    Example 3: CSV for two points

    + +The simple way is do the previous example twice. There is a computationally +faster method. + +
    +$ wgrib2 gep19.aec -rpn sto_1 -undefine out-box .9:1.1 10.9:11.1 -csv junk -rpn rcl_1 -undefine out-box 1.9:2.1 19.9:20.1 -csv junk
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +2:70707:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    +3:96843:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    +...
    +$ cat junk
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",1,11,12440.8
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",2,20,12360.8
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","TMP","200 mb",1,11,219.6
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","TMP","200 mb",2,20,218.8
    +...
    +
    + + + + +

    Warning #1

    + +

    +The options -csv, +-csv_long, +-spread and +-text do not support memory files. +You can blame sloth or lack of need. I like to think that +text files with grid point values are are insanely large +and shouldn't be saved in memory. + + +

    Warning #2

    + +

    It may be tempting to take a grib file, convert it into a CSV file +and then deal with the CSV file. After all, everybody can read +a CSV file. Sure there is a litte overhead of reading a CSV file +but who cares. Suppose you want to read some GFS forecasts files +(20 forecast times, 5 days every 6 hours) at 0.25 x 0.25 degree global resolution. +Your CSV file is going to be about 720 GBs. Suppose that our hard +drive can write/read at 70 MB/s. Then we are talking about 3 hours to +write the CSV file and 3 hours to read the CSV file not including CPU time +which will slow down the process. Converting grib into CSV is a +viable strategy if the conversion is limited. You need to restrict +the number of fields converted and should consider only converting +a regional domain. Note, I wrote "viable" and not optimal. + + +

    +See also: +-spread, +-csv_long, +-text, +-bin, +-ieee, +-set_ext_name, +-undefine +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Oct 25, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/csv_long.html b/docs/web_docs/csv_long.html new file mode 100644 index 0000000..e432ce5 --- /dev/null +++ b/docs/web_docs/csv_long.html @@ -0,0 +1,310 @@ + + + + Climate Prediction Center - wgrib2: -csv_long + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-csv_long +
     
    + +

    wgrib2: -csv_long (comma separated values)

    +
    + + +

    Introduction

    + +

    +The -csv_long option writes the grid values to a specified +file as a comma separated values (text) which can be imported into a +spread sheet. This function is similar to +-spread and -csv +with a different output format. The format is + +

    +   "time0","time1","time2","field","ftime","level",longitude,latitude,grid-value
    +
    + +

    +Some programs have a simple data model: x, y, z and time. Forecast models +need a more complicated data model. Most forecasts only need +3 time coordinates. Some examples that need 1 to 3 times are, + +

    +  time0: reference time
    +         ex. temperature analysis for 00Z, June 2, 2014
    +
    +  time0, time1: reference time, forecast time
    +         ex. temperature forecast started with initial conditions at 00Z, June 2, 2014
    +             and verifing at 00Z, June 3, 2014
    +
    +  time0, time1, time2: reference time, start of forecasting period, end of forecasting period
    +         ex. precipitation forecast started with initial conditions at 00Z, June 2, 2014
    +             and for the average precipitation from 00Z June 2, 2014 to 00Z June 3, 2014.
    +
    + +

    You can define quantities that require more than 3 times but they are +relatively rare. + + +

    +  Examples of quantities that need more than 3 times to describe
    +   a) climatology of 6-12 hour forecasts (start time of climatology, end time of the
    +         climatology, 6 hour, 12 hour)
    +   b) forecast of the monthly mean of the average 00Z-01Z temperature. (starting time
    +      of the monthly average, ending time of the monthly average, starting time of 
    +      the diuranl average, ending time of the diurnal average)
    +
    + +

    +For an analysis that is valid at a time0, time1 and time2 will +have the same value as time0. For a forecast valid at a +specific time, time0 will be the start of the forecast and +time1 will be the valid time. Time2 will have the same value +as time1. Finally for a forecast that is an average, accumulation, +minimum value or maximum value of a time interval, time0 +will be the start of the forecast, time1 will be the start +of the time interval and time2 will the end of the interval. +For more complicated quantities, see the ftime value. + +

    In wgrib2 speak, +

    +   time0 is -T in a different format
    +   time1 is -start_FT in a different format
    +   time2 is -end_FT in a different format
    +   field is -var in a different format
    +   ftime is -ftime
    +   level is -lev
    +   longitude is in degrees with values between -180 and 180 
    +   latitude is in degrees values between -90 and 90 (south = -ve, north = +ve)
    +
    + +

    +The -csv_long option only works on the grids +for which wgrib2 can derive latitude and longitudes values. +Otherwise no output is generated. The undefined value is 9.999e20. + +

    +The size of a CSV file can be overwhelming. One technique is to +only generate the CSV for variables that you need. This can be +done with the -match option. Even with +the -match option, the high-resolution +models can stil generate huge files. The next technique is +to undefine the grid points that you don't want. For example, +you are only interested in Hawaii (its 0C outside as I write +this). Then you can use the the -undefine option +to set the grid points outside of the Hawaii domain to undefined. +Since -csv_long doesn't print undefined +grid points, the CSV files is much smaller. + + +

    Extended Variable Names

    + +

    The default field value (see above) is the grib name such as TMP or HGT. +However, the grib name may not be unique. For example, the field could be +the HGT from the 19th ensemble member. A better field name may be +"HGT.ENS=+19". You enable the extended variable name by adding the option +-set_ext_name 1. + + +

    Usage

    +
    +-csv_long output_file_name
    +   The CSV is written to output_file_name, note output_file_name cannot be a memory file
    +-set_ext_name 1 -csv output_file_name
    +   the field is the extended grib name
    +
    + + +

    Warning #1

    + +

    +The options -csv, +-csv_long, +-spread and +-text do not support memory files. +You can blame sloth or lack of need. I like to think that +text files with grid point values are insanely large +and shouldn't be saved in memory. + + + +

    Warning #2

    + +

    It may be tempting to take a grib file, convert it into a CSV file +and then deal with the CSV file. After all, everybody can read +a CSV file. Sure there is a litte overhead of reading a CSV file +but who cares. Suppose you want to read some GFS forecasts files +(20 forecast times, 5 days every 6 hours) at 0.25 x 0.25 degree global resolution. +Your CSV file is going to be about 720 GBs. Suppose that our hard +drive can write/read at 70 MB/s. Then we are talking about 3 hours to +write the CSV file and 3 hours to read the CSV file not including CPU time +which will slow down the process. Converting grib into CSV is a +viable strategy if the conversion is limited. You need to restrict +the number of fields converted and should consider only converting +a regional domain. Note, I wrote "viable" and not optimal. + + + + + + + + +

    +See also: +-spread, +-csv, +-text, +-bin, +-ieee, +-match, +-set_ext_name, +-undefine +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Nov 19, 2015 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ctl_ens.html b/docs/web_docs/ctl_ens.html new file mode 100644 index 0000000..6b7e613 --- /dev/null +++ b/docs/web_docs/ctl_ens.html @@ -0,0 +1,168 @@ + + + + Climate Prediction Center - wgrib2: -ctl_ens + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ctl_ens +
     
    + +

    wgrib2: -ctl_ens

    +
    + + +

    Warning

    + +

    +The -ctl_ens option is used by the script g2ctl +to generate control files for GrADS. The output of this option is +determined by the needs of g2ctl. + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ctl_inv.html b/docs/web_docs/ctl_inv.html new file mode 100644 index 0000000..161eacd --- /dev/null +++ b/docs/web_docs/ctl_inv.html @@ -0,0 +1,168 @@ + + + + Climate Prediction Center - wgrib2: -ctl_inv + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ctl_inv +
     
    + +

    wgrib2: -ctl_inv

    +
    + + +

    Warning

    + +

    +The -ctl_inv option is used by the script g2ctl +to generate control files for GrADS. The output of this option is +determined by the needs of g2ctl. + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/cyclic.html b/docs/web_docs/cyclic.html new file mode 100644 index 0000000..8d44d14 --- /dev/null +++ b/docs/web_docs/cyclic.html @@ -0,0 +1,210 @@ + + + + Climate Prediction Center - wgrib2: -cyclic + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -cyclic +
     
    + +

    wgrib2: -cyclic

    +
    + + +

    Introduction

    + +

    +Sometimes it is useful to know whether the domain is cyclic. +For example, the large domain goes from 0E to 359W by steps +of 1 degree. Now there is a request for a subdomain that goes +from 350E (left) to 10E (right). Knowing that the domain is cyclic +is useful in this case. The -small_grib option +calls the cyclic code. + +

    The -cyclic option will only detect cyclic +grids that are either lat-lon, Gaussian or Mercator. All other +grids will return a not-cyclic response. In addition, +staggered and thinned grids will also return a not-cyclic response. +The test for cyclic is a bit loose because NCEP grib2 files often +have the lon(gitude) and dlon(gitude) to the nearest millidegree rather than the +nearest microdegree. (Reason 1: grib1 only stored the lon and dlon to the +nearest millidegree. Reason 2: most NCEP codes use single precision +for the longitudes and latitudes.) + +

    Usage

    +
    +-cyclic
    +
    + + +

    Example

    +

    +

    +$ wgrib2 gdt140.g2 -cyclic -nl -grid
    +1:0:not cyclic:
    +:grid_template=140:winds(N/S):
    +	Lambert Azimuthal Equal Area grid: (1050 x 1050) input WE:NS output WE:SN res 48
    +	Lat1 18.876988 Lon1 225.000000 Cen Lon 0.000000 Std Par 90.000000
    +	Dx 10000.000000 m Dy 10000.000000 m mode 48
    +
    +$ wgrib2 gep19.t00z.pgrb2af180 -cyclic -nl -grid
    +1:0:cyclic:
    +:grid_template=0:winds(N/S):
    +	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output WE:SN res 48
    +	lat 90.000000 to -90.000000 by 1.000000
    +	lon 0.000000 to 359.000000 by 1.000000 #points=65160
    +...
    +
    + + +

    +See also: +-small_grib, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 15, 2015 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/d.html b/docs/web_docs/d.html new file mode 100644 index 0000000..e033d9a --- /dev/null +++ b/docs/web_docs/d.html @@ -0,0 +1,236 @@ + + + + Climate Prediction Center - wgrib2: -d + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-d +
     
    + +

    wgrib2: -d

    +
    + + +

    Introduction

    + +

    +The -d N option specifies the grib message number (N) to +process. (The -d N option comes from wgrib where "d" stood fom "dump".) +If Nth message has submessage, then the first submessage is chosen (N.1). +For messages with submessages, use -d N.M to select the +Mth submessage of the Nth message. If M is missing, only the first submessage is selected. + +

    +With wgrib2 v3.0.0, you can add an optional offset. For example, -d N:OFFSET +will skip OFFSET bytes (must be positive), find the next grib message, give it a label N, and dump it. +The other form, -d N.M:OFFSET will skip OFFSET bytes (must be positive), +find the next grib message and dump the Mth submessage of that grib message. +Using the offset option can be faster for large files, and can be used to skip sections of a grib +file that stop wgrib2 processing. +The -d option works for files and pipes. + +

    +If there are more than one -d on a command line, only +the last one is used. + +

    The form, -d all, is not valid in wgrib2. This +is the default action. + +

    +The -d should be used with caution. The order of +messages records within grib files can change without notice (ex. today's forecast +may have a different order from tomorrow's forecast). I use +-d interactively but this option should not be used +in scripts unless you are 100% certain of the order of the records. + +

    Usage

    +

    + +

    +-d N
    +-d N.M
    +-d N:OFFSET
    +-d N.M:OFFSET
    +where N is an integer larger than 0, M is an positive integer, OFFSET is a positive integer
    +
    + + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -s -d 1 -bin data.bin
    +1:0:d=2005090200:HGT:1000 mb:60 hour fcst
    +The above command writes the first record to a binary file data.bin
    +
    +
    +$ wgrib2 test.grb2 -s -d 287.2 -bin data.bin
    +287.2:37032193:d=2005090200:VGRD:10 m above ground:60 hour fcst
    +The above command dumps the second submessage of record 287.
    +
    +$ cat gfs.t00z.master.grb2f048 | wgrib2 - | head -n 4
    +1:0:d=2018030400:PRES:mean sea level:48 hour fcst:
    +2:3565800:d=2018030400:REFC:entire atmosphere:48 hour fcst:
    +3:4748163:d=2018030400:VIS:surface:48 hour fcst:
    +4:5462029:d=2018030400:UGRD:planetary boundary layer:48 hour fcst:
    +$ cat gfs.t00z.master.grb2f048 | wgrib2 - -d 3:4748163
    +3:4748163:d=2018030400:VIS:surface:48 hour fcst:
    +$ cat gfs.t00z.master.grb2f048 | wgrib2 - -d 1:4748163
    +1:4748163:d=2018030400:VIS:surface:48 hour fcst:
    +
    +Using the offset option on a pipe
    +
    + + +

    +See also: +-for, +-i, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page modified: Aug 27, 2014, March 19, 2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/default_inv.html b/docs/web_docs/default_inv.html new file mode 100644 index 0000000..7ce6821 --- /dev/null +++ b/docs/web_docs/default_inv.html @@ -0,0 +1,267 @@ + + + + Climate Prediction Center - wgrib2: default inventory format + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: default inventory format +
     
    + +

    wgrib2: default inventory format

    +
    + + +

    Introduction

    + +

    +One of wgrib2 functions is to inventory grib2 files. The inventory +format is very customizable; at present there are 120 options +to modify the inventory. However the default inventory (-s) +is most often used and understanding this format will help you to +understand the structure of the inventory. +

    +

    Format

    + +

    +The format for the wgrib2 invetory is relatively simple. There is one line +for each gridded field. Usually each grid is in its own grib message +or record. However, is is possible to store related grids in into +a single grib message. Below are some examples. + + +

    +Example 1:  1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev
    +Example 2:  1:0:d=2010032900:TMP:2 m above ground:anl:
    +Example 3:  1:40:d=2011062206:ICAHT:cumulonimbus base:6 hour fcst:
    +Example 4:  1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +Example 5:  34.1:1464607:d=2009060500:UGRD:10 m above ground:180 hour fcst:ENS=+19
    +            34.2:1464607:d=2009060500:VGRD:10 m above ground:180 hour fcst:ENS=+19
    +
    +Output Format:
    +
    +  (msg|msg.submsg):(byte location):d=(YYYYMMDDHH):(variable):(level):(ftime):(optional attr)
    +
    +  msg = message/record number starting from 1
    +  submsg = submessage number starting from 1 (optional)
    +  byte location: byte location of the start of the message starting from 0
    +  YYYYMMDDHH = reference time of the grib message, YYYY = year, MM = month (01..12), DD = day, HH = hour
    +  level = level/layer attributes, ex. "500 mb", "ground", "2 m above ground"
    +  ftime = time attributes, ex. "12 hour fcst", "anl", "0-6 hr ave fcst"
    +  optional attr: optional attributes that are needed to define the field such as ensemble memeber,
    +                 chemical type (for concentration), probability range
    +
    + + + +

    NOMADS: point value (text)

    +
    + +

    +The Nomads g2subset/grib-filter software can download point-value text files. +These text files are simply wgrib2 inventories created with the following options. +

    + +
    +   wgrib2 IN.grb -crlf -v -s v0 -start_ft -lon (LON) (LAT)
    +
    +   -crlf adds a cr-lf at the end of each line instead of the default lf or newline.
    +          (for windows users)
    +   -v turn on verbose mode
    +   -s is the standard inventory in verbose mode
    +   -v0 turn off verbose mode
    +   -start_ft adds the forecast or verification time or the start of the verification time
    +             if a forecast for a period of time (ex. 3-4 month forecast).
    +   -lon adds the point value to the inventory
    +
    +
    +Output Format:
    +
    +  (msg|msg.submsg):(byte location):d=(YYYYMMDDHH):(verbose variable):(level):(ftime):(optional attr):
    +         start_ft=(YYYYMMDDHH):lon=(lon),lat=(lat),val=(value)
    +
    +  msg = message/record number starting from 1
    +  submsg = submessage number starting from 1 (optional)
    +  byte location: byte location of the start of the message starting from 0
    +  YYYYMMDDHH = reference time of the grib message, YYYY = year, MM = month (01..12), DD = day, HH = hour
    +  verbose variable = variable name, description and units
    +  level = level/layer attributes, ex. "500 mb", "ground", "2 m above ground"
    +  ftime = time attributes, ex. "12 hour fcst", "anl", "0-6 hr ave fcst"
    +  optional attr: optional attributes that are needed to define the field such as ensemble memeber,
    +                 chemical type (for concentration), probability range
    +  start_ft = start of the forecast/verification time
    +  val = value of the grid point at (lat) and (lon).
    +
    + + + +

    +In example 1, the optional attributes is "std dev". In this case, the field is the standard deviation +of an ensemble. The field cannot be a temporal std dev because the ftime field is "300 hour fcst". +(A temporal std dev would have been encoded in the ftime field.). +

    +

    +In example 5, we have the first field beind 34.1 and 34.2. In this example, message number 34 has +two submessages. Notice that the byte location is the same for both sub messages. +

    +

    +The inventory consists of one line per field. The first two fields (record number and byte location) are +fixed and the other fields will depend on the inventory options that are used. For example, the +default option (-s) is a macro that runs the -t, -var, -lev -ftime and -misc options. +

    +

    +In the future, the date codes in the nomads point-value text files may be extended to include minutes. +

    + +

    +The default option gives the starting but not the ending location of each grib message. The ending +location is one less than the starting location of the next grib message (assuming no junk bytes). +The -range option will print out the starting and ending location of each record. Using the range, +a grib message can be extracted from a grib file. However, submessages are different. It is much +more difficult to extract a submessage from a grib message. +

    + + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/disc.html b/docs/web_docs/disc.html new file mode 100644 index 0000000..8bb7315 --- /dev/null +++ b/docs/web_docs/disc.html @@ -0,0 +1,190 @@ + + + + Climate Prediction Center - wgrib2: -disc + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-disc +
     
    + +

    wgrib2: -disc

    +
    + + +

    Introduction

    + +

    +The -disc option prints the discipline. Use the +-v option to get the name of the discipline. + +

    Usage

    +

    + +

    +-disc
    +
    + +

    Example

    +

    + +

    +$ wgrib2 grib2.polar -disc
    +1.1:0:disciple=0
    +1.2:0:disciple=0
    +
    + +
    +$ wgrib2 grib2.polar -v -disc
    +1.1:0:disciple=0 Meteorlogy
    +1.2:0:disciple=0 Meteorlogy
    +
    + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/domain.html b/docs/web_docs/domain.html new file mode 100644 index 0000000..f49bed2 --- /dev/null +++ b/docs/web_docs/domain.html @@ -0,0 +1,175 @@ + + + + Climate Prediction Center - wgrib2: -domain + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -domain +
     
    + +

    wgrib2: -domain

    +
    + + +

    Introduction

    + +

    +The -options option finds a rectangular box that +encompasses the grid. This option does not print out the vertices of +the grid. Requirements for this option are determined by g2ctl. + +

    Usage

    +

    + +

    +-domain
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/egrep.html b/docs/web_docs/egrep.html new file mode 100644 index 0000000..cef5fcf --- /dev/null +++ b/docs/web_docs/egrep.html @@ -0,0 +1,260 @@ + + + + Climate Prediction Center - wgrib2: -grep (various) + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grep (various) +
     
    + +

    wgrib2: -egrep, -egrep_v, -fgrep, -fgrep_v

    +
    + + +

    Introduction

    + +

    +When you use wgrib2 extensively, common sequences keep occuring, such as, + +

    +   1:  wgrib2 A.grb >A.inv
    +   2:  cat A.inv | fgrep ":HGT:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib hgt500.grb
    +   3:  cat A.inv | fgrep ":TMP:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib tmp500.grb
    +   4:  cat A.inv | egrep ":(UGRD|VGRD):" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib wind500.grb
    +
    + +Using the various -grep, -inv and the -i_file option, the above example can +be written as + +
    +   1:  wgrib2 A.grb -inv A.inv
    +   2:  wgrib2 -fgrep ":HGT:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib hgt500.grb
    +   3:  wgrib2 -fgrep ":TMP:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib tmp500.grb
    +   4:  wgrib2 -egrep ":(UGRD|VGRD):" -fgrep ":500 mb:" -i_file A.inv A.grb -grib wind500.grb
    +
    + +The first version is easier to read. So why were the extra options added? + +
      +
    1. Some shells have problems with pipes. +
        +
      • Some versions of Windows dos-prompt have problems with pipes. +
      • RNomads: solved Windows 7 problem by using these options +
      +
    2. More efficient when you avoid multiple processes and pipes. +
        +
      • Every millisecond and K byte of RAM usage counts! +
      +
    3. Used by callable wgrib2. +
        +
      • A subroutine (wgrib2) can read a field using the index file! +
      +
    + +The options were added for the third reason, but one and two are some +nice side effects. The 4 examples can be coded in fortran as, + +
    +   include wgrib2api
    +   ...
    +   i = wgrib2a('A.grb','-inv','A.inv')
    +   i = wgrib2a('-fgrep',':HGT:','-fgrep',':500 mb:','-i_file,'A.inv','A.grb','-grib','hgt500.grb')
    +   i = wgrib2a('-fgrep',':TMP:','-fgrep',':500 mb:','-i_file','A.inv','A.grb','-grib','tmp500.grb')
    +   i = wgrib2a('-egrep',':(UGRD|VGRD):','-fgrep',':500','mb:','-i_file','A.inv','A.grb','-grib','wind500.grb')
    +
    + +

    The -grep options are used in wgrib2api's grb2_inq(..) function. + +

    +Definition of grep options:
    +
    +    (...) | wgrib2 -OP1 X (...)
    +      behaves like
    +    (...) | OP2 X | wgrib2 (...) 
    +
    +      if OP1 == egrep       then OP2 = egrep
    +      if OP1 == fgrep       then OP2 = fgrep
    +      if OP1 == egrep_v     then OP2 = egrep -v
    +      if OP1 == fgrep_v     then OP2 = fgrep -v
    +
    +    X is a posix extended regular expression (egrep, egrep_v)
    +    or a fixed string (fgrep, fgrep_v)
    +
    +   The number of -fgrep and -fgrep_v options is limited to 200.
    +   The number of -egrep and -egrep_v options is limited to 200.
    +   The wgrib2 option -set_regex does not affect the -grep options.
    +
    + + +

    Usage

    +

    + +

    +-egrep X
    +-egrep_v X
    +-fgrep Y
    +-fgrep_v Y
    +
    +X is a posix extended regular expression
    +Y is a fixed string (not a regular expression)
    +Note: -set_regex does not modify the type of regex for these options
    +
    + +

    +See also: +-match, +-not, +-match_inv, +-end, +-if, +-i_file, +-not_if, +-set_regex. +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page modified: Feb 3, 2017, 7/2019. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/egrep_v.html b/docs/web_docs/egrep_v.html new file mode 100644 index 0000000..cef5fcf --- /dev/null +++ b/docs/web_docs/egrep_v.html @@ -0,0 +1,260 @@ + + + + Climate Prediction Center - wgrib2: -grep (various) + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grep (various) +
     
    + +

    wgrib2: -egrep, -egrep_v, -fgrep, -fgrep_v

    +
    + + +

    Introduction

    + +

    +When you use wgrib2 extensively, common sequences keep occuring, such as, + +

    +   1:  wgrib2 A.grb >A.inv
    +   2:  cat A.inv | fgrep ":HGT:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib hgt500.grb
    +   3:  cat A.inv | fgrep ":TMP:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib tmp500.grb
    +   4:  cat A.inv | egrep ":(UGRD|VGRD):" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib wind500.grb
    +
    + +Using the various -grep, -inv and the -i_file option, the above example can +be written as + +
    +   1:  wgrib2 A.grb -inv A.inv
    +   2:  wgrib2 -fgrep ":HGT:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib hgt500.grb
    +   3:  wgrib2 -fgrep ":TMP:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib tmp500.grb
    +   4:  wgrib2 -egrep ":(UGRD|VGRD):" -fgrep ":500 mb:" -i_file A.inv A.grb -grib wind500.grb
    +
    + +The first version is easier to read. So why were the extra options added? + +
      +
    1. Some shells have problems with pipes. +
        +
      • Some versions of Windows dos-prompt have problems with pipes. +
      • RNomads: solved Windows 7 problem by using these options +
      +
    2. More efficient when you avoid multiple processes and pipes. +
        +
      • Every millisecond and K byte of RAM usage counts! +
      +
    3. Used by callable wgrib2. +
        +
      • A subroutine (wgrib2) can read a field using the index file! +
      +
    + +The options were added for the third reason, but one and two are some +nice side effects. The 4 examples can be coded in fortran as, + +
    +   include wgrib2api
    +   ...
    +   i = wgrib2a('A.grb','-inv','A.inv')
    +   i = wgrib2a('-fgrep',':HGT:','-fgrep',':500 mb:','-i_file,'A.inv','A.grb','-grib','hgt500.grb')
    +   i = wgrib2a('-fgrep',':TMP:','-fgrep',':500 mb:','-i_file','A.inv','A.grb','-grib','tmp500.grb')
    +   i = wgrib2a('-egrep',':(UGRD|VGRD):','-fgrep',':500','mb:','-i_file','A.inv','A.grb','-grib','wind500.grb')
    +
    + +

    The -grep options are used in wgrib2api's grb2_inq(..) function. + +

    +Definition of grep options:
    +
    +    (...) | wgrib2 -OP1 X (...)
    +      behaves like
    +    (...) | OP2 X | wgrib2 (...) 
    +
    +      if OP1 == egrep       then OP2 = egrep
    +      if OP1 == fgrep       then OP2 = fgrep
    +      if OP1 == egrep_v     then OP2 = egrep -v
    +      if OP1 == fgrep_v     then OP2 = fgrep -v
    +
    +    X is a posix extended regular expression (egrep, egrep_v)
    +    or a fixed string (fgrep, fgrep_v)
    +
    +   The number of -fgrep and -fgrep_v options is limited to 200.
    +   The number of -egrep and -egrep_v options is limited to 200.
    +   The wgrib2 option -set_regex does not affect the -grep options.
    +
    + + +

    Usage

    +

    + +

    +-egrep X
    +-egrep_v X
    +-fgrep Y
    +-fgrep_v Y
    +
    +X is a posix extended regular expression
    +Y is a fixed string (not a regular expression)
    +Note: -set_regex does not modify the type of regex for these options
    +
    + +

    +See also: +-match, +-not, +-match_inv, +-end, +-if, +-i_file, +-not_if, +-set_regex. +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page modified: Feb 3, 2017, 7/2019. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/else.html b/docs/web_docs/else.html new file mode 100644 index 0000000..4d74e82 --- /dev/null +++ b/docs/web_docs/else.html @@ -0,0 +1,177 @@ + + + + Climate Prediction Center - wgrib2: -else + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -else +
     
    + +

    wgrib2: -else

    +
    + + +

    Introduction

    + +

    +The -else option is part of the + -if, + -else, + -endif structure for conditional execution of wgrib2 options. +More details are in the -if documentation. +The -else option was introduced with wgrib2 v3.0.0 to replace +the older version 1 IF structure. + +

    +See also: +-if, +-endif, +-match, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page: March 16, 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/elseif.html b/docs/web_docs/elseif.html new file mode 100644 index 0000000..536aeee --- /dev/null +++ b/docs/web_docs/elseif.html @@ -0,0 +1,189 @@ + + + + Climate Prediction Center - wgrib2: -elseif + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -elseif +
     
    + +

    wgrib2: -elseif

    +
    + + +

    Introduction

    + +

    +The -elseif option is part of the + -if, + -else, + -endif structure for conditional execution of wgrib2 options. +The -elseif option must follow an + -if or -elseif type option, and it must preceed either the next + -elseif-type, + -else or + -endif option. +

    +The -elseif option is a test for a regular expression. +For a non-regex string, use the -elseif_fs option. + +More details are in the -if documentation. +The -else option was introduced with wgrib2 v3.0.0 to replace +the older version 1 IF structure. + +

    +See also: +-if, +-if_fs, +-else, +-elseif_fs, +-endif, +-match, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page: March 16, 2021, 6/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/elseif_fs.html b/docs/web_docs/elseif_fs.html new file mode 100644 index 0000000..7854bdd --- /dev/null +++ b/docs/web_docs/elseif_fs.html @@ -0,0 +1,192 @@ + + + + Climate Prediction Center - wgrib2: -elseif_fs + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -elseif +
     
    + +

    wgrib2: -elseif_fs

    +
    + + +

    Introduction

    + +

    +The -elseif_fs option is part of the + -if, + -else, + -endif structure for conditional execution of wgrib2 options. +The -elseif* option must follow an + -if or -elseif type option, and it must preceed either the next + -elseif type, + -else or + -endif option. + +

    +The -elseif_fs is an +-elseif* options and +does a comparison with a fixed string (fs) instead +of a regular expression as done by the -else_if. +

    +More details are in the -if documentation. +The -else option was introduced with wgrib2 v3.0.0 to replace +the older version 1 IF structure. + +

    +See also: +-if, +-if_fs, +-else, +-elseif, +-endif, +-match, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page: 6/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/elseif_n.html b/docs/web_docs/elseif_n.html new file mode 100644 index 0000000..b6a672f --- /dev/null +++ b/docs/web_docs/elseif_n.html @@ -0,0 +1,193 @@ + + + + Climate Prediction Center - wgrib2: -elseif_n + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -elseif_n +
     
    + +

    wgrib2: -elseif_n

    +
    + + +

    Introduction

    + +

    +The -elseif_n option is part of the + -if, + -else, + -endif structure for conditional execution of wgrib2 options. +The -elseif type option must follow an + -if or -elseif type option, and it must preceed either the next + -elseif type, + -else or + -endif option. + +

    +The -elseif_n is the +-elseif equivalent of the +-if_n option. + +More details are in the -if documentation. +The -else option was introduced with wgrib2 v3.0.0 to replace +the older version 1 IF structure. + +

    +See also: +-if, +-if_fs, +-if_n, +-else, +-elseif, +-elseif_fs, +-endif, +-match, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page: 6/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/elseif_rec.html b/docs/web_docs/elseif_rec.html new file mode 100644 index 0000000..28a4c06 --- /dev/null +++ b/docs/web_docs/elseif_rec.html @@ -0,0 +1,195 @@ + + + + Climate Prediction Center - wgrib2: -elseif_rec + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -elseif_rec +
     
    + +

    wgrib2: -elseif_rec

    +
    + + +

    Introduction

    + +

    +The -elseif_rec option is part of the + -if, + -else, + -endif structure for conditional execution of wgrib2 options. +The -elseif type option must follow an + -if or -elseif type option, and it must preceed either the next + -elseif type, + -else or + -endif option. + +

    +The -elseif_rec is the +-elseif equivalent of the +-if_rec option. + +More details are in the -if documentation. +The -else option was introduced with wgrib2 v3.0.0 to replace +the older version 1 IF structure. + +

    +See also: +-if, +-if_fs, +-if_n, +-if_rec, +-else, +-elseif, +-elseif_fs, +-elseif_n, +-endif, +-match, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page: 6/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/elseif_reg.html b/docs/web_docs/elseif_reg.html new file mode 100644 index 0000000..0ceffc9 --- /dev/null +++ b/docs/web_docs/elseif_reg.html @@ -0,0 +1,197 @@ + + + + Climate Prediction Center - wgrib2: -elseif_reg + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -elseif_reg +
     
    + +

    wgrib2: -elseif_reg

    +
    + + +

    Introduction

    + +

    +The -elseif_reg option is part of the + -if, + -else, + -endif structure for conditional execution of wgrib2 options. +The -elseif type option must follow an + -if or -elseif type option, and it must preceed either the next + -elseif type, + -else or + -endif option. + +

    +The -elseif_reg is the +-elseif equivalent of the +-if_reg option. + +More details are in the -if documentation. +The -else option was introduced with wgrib2 v3.0.0 to replace +the older version 1 IF structure. + +

    +See also: +-if, +-if_fs, +-if_n, +-if_rec, +-if_reg, +-else, +-elseif, +-elseif_fs, +-elseif_n, +-elseif_rec, +-endif, +-match, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page: 6/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/end.html b/docs/web_docs/end.html new file mode 100644 index 0000000..5180b19 --- /dev/null +++ b/docs/web_docs/end.html @@ -0,0 +1,195 @@ + + + + Climate Prediction Center - wgrib2: -ftim + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end +
     
    + +

    wgrib2: -end

    +
    + + +

    Introduction

    + +

    +The -end option stops the processing of the grib file after +one line of the inventory has been written. The -end option +is designed to improve speed when used with the -match option + + +

    Usage

    +

    + +

    +-end
    +
    + +

    Example

    +

    + +

    +$ wgrib2 ../example/eta.t00z.awphys18.grb2 -match "HGT:500 mb" -text hgt.txt -end 
    +
    +The above line writes out the first 500 mb HGT field to the file hgt.txt and stops 
    +reading the file.
    +
    +$ wgrib2 ../example/eta.t00z.awphys18.grb2 -match "HGT:500 mb" -text hgt.txt -end 
    +
    +The above line writes out all 500 mb HGT fields to the file hgt.txt.  This wastes 
    +time if you only have one matching field.
    +
    +
    + + +See also: -match, +-not +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/end_FT.html b/docs/web_docs/end_FT.html new file mode 100644 index 0000000..3ea3ded --- /dev/null +++ b/docs/web_docs/end_FT.html @@ -0,0 +1,200 @@ + + + + Climate Prediction Center - wgrib2: -start_ft, start_FT, -end_ft, -end_FT + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -start_ft, -start_FT, -end_ft, -end_FT +
     
    + +

    wgrib2: -start_ft, -start_FT, -end_ft, -end_FT

    +
    + + +

    Introduction

    + +

    +Suppose you make a forecast starting from initial conditions of 00Z January 1 for the average +conditions from the month of February. In this forecast, there are three time stamps. + +

    +   Name                        date           YYYYMMDDHH option  (HH)Z(DD)(MON)YYYY option      with minutes and seconds
    +
    +   reference time              00Z Jan 1     -t                  -v2 -t                         -T
    +   start of forecast period    00Z Feb 1     -start_ft           -v2 -start_ft                  -start_FT
    +   end of forecast period      00Z Mar 1     -end_ft             -v2 -end_ft                    -end_FT
    +
    + +For common ftimes, + +
    +
    +analysis:                      reference time == start_ft == end_ft
    +6 hour forecast:               reference time + 6 == start_ft == end_ft
    +30 year monthly climatology:   reference time = start_ft = start of 1st month used to make climatology
    +                               end_ft = end of the last month used to make the climatology
    +

    Usage

    +
    +-start_ft
    +-end_ft
    +-start_FT
    +-end_FT
    +
    + +

    Example

    +

    + +

    +$ wgrib2 a.grb -start_ft
    +1:0:start_FT=20111101000000
    +
    + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/end_ft.html b/docs/web_docs/end_ft.html new file mode 100644 index 0000000..3ea3ded --- /dev/null +++ b/docs/web_docs/end_ft.html @@ -0,0 +1,200 @@ + + + + Climate Prediction Center - wgrib2: -start_ft, start_FT, -end_ft, -end_FT + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -start_ft, -start_FT, -end_ft, -end_FT +
     
    + +

    wgrib2: -start_ft, -start_FT, -end_ft, -end_FT

    +
    + + +

    Introduction

    + +

    +Suppose you make a forecast starting from initial conditions of 00Z January 1 for the average +conditions from the month of February. In this forecast, there are three time stamps. + +

    +   Name                        date           YYYYMMDDHH option  (HH)Z(DD)(MON)YYYY option      with minutes and seconds
    +
    +   reference time              00Z Jan 1     -t                  -v2 -t                         -T
    +   start of forecast period    00Z Feb 1     -start_ft           -v2 -start_ft                  -start_FT
    +   end of forecast period      00Z Mar 1     -end_ft             -v2 -end_ft                    -end_FT
    +
    + +For common ftimes, + +
    +
    +analysis:                      reference time == start_ft == end_ft
    +6 hour forecast:               reference time + 6 == start_ft == end_ft
    +30 year monthly climatology:   reference time = start_ft = start of 1st month used to make climatology
    +                               end_ft = end of the last month used to make the climatology
    +

    Usage

    +
    +-start_ft
    +-end_ft
    +-start_FT
    +-end_FT
    +
    + +

    Example

    +

    + +

    +$ wgrib2 a.grb -start_ft
    +1:0:start_FT=20111101000000
    +
    + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/endif.html b/docs/web_docs/endif.html new file mode 100644 index 0000000..0b214a4 --- /dev/null +++ b/docs/web_docs/endif.html @@ -0,0 +1,177 @@ + + + + Climate Prediction Center - wgrib2: -endif + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -endif +
     
    + +

    wgrib2: -endif

    +
    + + +

    Introduction

    + +

    +The -endif option is part of the + -if, + -else, + -endif structure for conditional execution of wgrib2 options. +More details are in the -if documentation. +The -endif option was introduced with wgrib2 v3.0.0 to replace +the older version 1 IF structure. + +

    +See also: +-if, +-else, +-match, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page: March 16, 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ens.html b/docs/web_docs/ens.html new file mode 100644 index 0000000..677e1cc --- /dev/null +++ b/docs/web_docs/ens.html @@ -0,0 +1,193 @@ + + + + Climate Prediction Center - wgrib2: -ens + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ens +
     
    + +

    wgrib2: -ens

    +
    + + +

    Introduction

    + +

    +The -ens option prints the ensemble information. + +

    Usage

    +

    + +

    +-ens
    +
    + +

    Example

    +

    + +

    +$ wgrib2 -var-ens ens.grb
    +1:0:HGT:ENS=+1
    +2:45932:SPFH:ENS=+1
    +3:89724:SPFH:ENS=+1
    +4:144624:HGT:ENS=+1
    +5:198928:TMP:ENS=+1
    +6:219134:SPFH:ENS=+1
    +7.1:258504:UGRD:ENS=+1
    +7.2:258504:VGRD:ENS=+1
    +8:380298:SPFH:ENS=+1
    +9:441918:SPFH:ENS=+1
    +
    + +See also: +-N_ens.html +-set_ens_num.html +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ens_processing.html b/docs/web_docs/ens_processing.html new file mode 100644 index 0000000..32996b0 --- /dev/null +++ b/docs/web_docs/ens_processing.html @@ -0,0 +1,480 @@ + + + + Climate Prediction Center - wgrib2: -ens_processing + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ens_processing +
     
    + +

    wgrib2: -ens_processing

    +
    + + +

    Introduction (wgrib2 v3.0.0)

    + +

    +Please don't use -ens_processing with +wgrib2 v2.0.8 because you get the wrong results if the number of threads +is not one when using a newer gcc compiler. In addtion, +75% is inaccuracte, precip trace +amounts (option = 1) is bad, and a possible seg fault could occur. +(An out-of-bounds +array value is multipled by zero, so it doesn't affect the calculation.) +So you need to use wgrib2 v3.0.0+. + +

    +The -ens_processing option takes +the ensemble member data and creates a pre-defined set of ensemble statistics. +If you want find the probability that a certain field has +values exceeding a limit, you should look at trick 65 in +the +wgrib2 tricks page. + +

    +The -ens_processing option is used +to create various ensemble statistics such as +minimum, maximum, average, spread, and various percentiles in order to describe the PDF. +The values are calculated with respect +to all the ensemble members. The calculations are different from the calculations +used by the operational ensemble forecasts done at NCEP. So fields like the various percentiles +and spread will have different values from the NCEP operational products. +The results from the -ens_processing option should not +be considered to be replacements for the official products because of the different +algorithms used. (The exception will be the future climate reanalysis produced by CPC/NCEP.) + +

    The percentiles values were chosen because the future CPC/NCEP climate reanalysis (CORe) +will be using 80 ensemble members. + +

    The calculated variables are +

    +1) ensemble mean,  em = sum(x(i))/n,  i=1..n
    +2) ensemble spread, RMSE = sqrt(sum((x(i)-em)**2)/n)  note: n is used rather than n-1
    +3) minimum = minimum value over all ensemble members (for each grid point)
    +4) maximum = maximum value over all ensemble members (for each grid point)
    +5) 10 percentile
    +6) 25 percentile
    +7) 50 percentile (median)
    +8) 75 percentile
    +9) 90 percentile
    +
    +Note: these calculations done when all the ensemble members have
    +values.  This will affect parameters like the cloud-top temperature
    +when some of the ensemble members are cloud free and have no cloud-
    +top temperatures. The -enq_qc calculates the ensemble mean and spread
    +ignoring the undefined values.
    +
    +There are a few common ways to compute the percentile, wgrib2 uses a method
    +  recommended by NIST:
    +
    +    https://www.itl.nist.gov/div898/handbook/prc/section2/prc262.htm
    +
    +    percentile: sort values (1..N), p=percentile/100
    +           x(1) if p ≤ 1/(N+1)
    +           x(p*(N+1)) if 1/(N+1) ≤ p &le N/(N+1)
    +           x(N) if N/(N+1) ≤ p ≤ 1
    +
    +           x(r) = x(floor(r))(1-(r-floor(r)) + x(floor(r)+1)(r-floor(r))
    +              for non-integral r
    +
    +For the probabilities, a count is used to determine them.
    +
    +As previously mentioned, the above calculations may differ from those used
    +in deriving the operational products.
    +
    + +

    +The -ens_processing option was developed for the +future CORe reanalysis. For this reanalysis, additional fields +are enabled by the second parameter set to "1". However, users are warned +that these fields are expected to change. Generation of additional +fields can be enabled by setting the second parameter to special values. + +

    +10) probability of precipitation > 0 *
    +11) probability of more than a trace of precipitation (trace=TBD) *
    +12) probability of 2m temperature greater than 273.15K *
    +13) 95 percentile for WIND at 10m above ground *
    +
    +* optional, the definition of trace of precipitation is ad hoc
    +     trace can mean precipitation that will get the rain gauge wet but register as zero
    +     trace can mean less than 0.01 inches
    +     trace can mean less than 0.1 mm
    +     for wgrib2, trace = accumulated precip < 0.xxx mm, or a rate < 0.xxx mm/day.
    +
    + +

    +The -ens_processing is unlike most wgrib2 +options in that this option can use large amounts of memory. Suppose +that you have an 80 member ensemble and are processing the tmp500 field. +In order to calculate the percentiles of the tmp500, you need keep +all 80 tmp500 fields in memory. As the size of the grid and the number +of ensemble member increases, the required memory will increase. + +

    Code Table 4.3, Type of Generating Process

    +

    Grib contains metadata, and one piece is the "generating process". +Wgrib2 tries its best to describe how the fields were created. This +is documented in detail because if varies between PDT and center that +created the grib file. + +

    +Ensemble mean, ensemble spread, ensemble minimum, ensemble maximum:
    +  Code Table 4.3 is preserved from the input file.
    +
    +Percentiles, Probabilities:
    +  NCEP: code table 4.3 = 199,  Ensemble forecast based on counting
    +  Other centers: code table 4.3 = 4, Ensemble forecast
    +
    +The NCEP files are more descriptive because an entry in a local table was
    +specially created for wgrib2.
    +
    + + +

    Definition of an Ensemble Member

    + +

    +Wgrib2 v3.0.0 defined an ensemble as having the same Product Definition Template (PDT=0, 1, 8, 11) +except for perturbation number. The initial time and forecast times could be different as long +as the verification time was the same. This allows lagged averge forecast (LAF) ensembles. +With wgrib2 v3.0.0, the type of ensemble forecast can be different. +(code table 4.6) +This means that -ens_processing can now work with a +combination of perturbed and control runs. +

    +Limiting the PDTs to 0, 1, 8 and 11 is unnecessarily restrictive. As a result, +-ens_processing does not work on aerosols, chemical +tracers and simulated satellite data from ensemble members. + +

    Order of Fields

    + +The -ens_processing requires fields +to be in a specific order. The data has to be processed +sequentially. If the +-ens_processing finds a field that is +unlike the previous fields (except for ensemble member id), it +writes out the summary fields and starts processing a new variable. +The number id of the ensemble members is ignored, and is not +even necessary. + +
    +bash-4.1$ wgrib2 all.grb | head -n 60
    +1:0:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+1
    +2:83628:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+2
    +3:164290:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+3
    +4:248531:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+4
    +..
    +19:1494083:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+19
    +20:1574514:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+20
    +21:1657406:d=2018020600:VIS:surface:84 hour fcst:ENS=+1
    +22:1703817:d=2018020600:VIS:surface:84 hour fcst:ENS=+2
    +..
    +39:2488331:d=2018020600:VIS:surface:84 hour fcst:ENS=+19
    +40:2533546:d=2018020600:VIS:surface:84 hour fcst:ENS=+20
    +41:2579586:d=2018020600:UGRD:planetary boundary layer:84 hour fcst:ENS=+1
    +42:2629955:d=2018020600:UGRD:planetary boundary layer:84 hour fcst:ENS=+2
    +..
    +
    +

    Order of Fields: gmerge to the rescue

    + +

    The -ens_processing requires the +fields to be in a specific order (or processed in a specific order). +Suppose we have forecasts from 3 ensemble members in files fcst1, fcst2 +and fcst3. Now we are going to require that the fields have the +same order in these files, and the files have no submessages. +Then we can combine these files using gmerge, the resulting file +will be in the correct order. (Gmerge has been included with wgrib2 +source code for many years.) There is a minor restriction, gmerge +doesn't handle grib files which includes non-grib data. + +

    +gmerge output fcst1 fcst2 fcst3
    +
    + +The requirements for output to be in the right order. + +
      +
    1. fcstX must have fields in the same order +
    2. number of forecasts &le 200 for wgrib2 v2.0.8 distribution +
    3. fcstX must not use submessages +
    4. the like forecasts must have same PDT except for ensemble number +
    5. the ensemble number is optional +
    6. no non-grib data in grib file +
    + +You can find gmerge in the wgrib2 public distrbution under the aux_progs directory. +If your initial files are not in identical order, you could combine the forecasts +and sort the fields so that like fields are adjacent. However, sorting the individual +forecasts and then running gmerge would probably be faster. + + +

    Now that "output" has the data in the correct order, the +option -ens_processing can be used to +create the min/max/ave/spread of the ensemble. + +

    +gmerge  output1 fcst1 fcst2 fcst3
    +wgrib2  output1 -ens_processing output2 x
    +  note: x is a dummy argument, it may be used in the future
    +
    +For faster processing, we can replace the disk file "output" by a pipe.
    +This method may or may not work under Windows.
    +
    +
    +gmerge - fcst1 fcst2 fcst3 | wgrib2 - -ens_processing output x
    +
    +    gmerge - A B C   writes the output to stdout (denoted by the -)
    +    wgrib2 - (..)    reads the input grib data from stdin (denoted by the -)
    +
    +NOTE 1: must use a recent version of gmerge.  Old versions of gmerge
    +only accepted a small number of input files and did not allow
    +output to the pipe by "-".
    +
    +NOTE 2: a common unix convention is that the "-" instead of a file name
    +represents either stdin or stdout.  By knowing the program arguements, 
    +one can determine whether the dash is stdin or stdout.  Wgrib2 uses
    +this convention in most places that require a file name.
    +
    + +

    Fast Processing at the expense of Large Memory

    + +

    +Using gmerge, and sending the output to wgrib2 is simple. However, it +can be I/O inefficient especially for large ensembles. Consider a +small system that has 80 ensemble member data on one drive. For the 1st +field, the system has to read field-1 of file-1. For the second field, +the system has to read field-1 from file-2. For the 81st field, the +system has to read field-2 from file-1. Hopefully the disk cache was +big enough that the field-2 of file-1 was still cached. The speed of +processing depends on the size of disk cache. This example is for +a small system, what would happen on a HPC system? Disk cache is +much larger but so is the block size. If one job takes a large fraction +of the disk cache, the other jobs will be much more disk inefficient. + +

    A better approach is to adopt the technique used in +fast averaging. You may be +limited by the amount of physical memory on the system. + +

    +cat fcst.2018122600.mem* | wgrib2 - -set_grib_type c3 \
    +  -if (xxx1) -ens_processing out 0 -fi \
    +  -if (xxx2) -ens_proceesing out 0 -fi \
    +  ...
    +  -if (xxxN) -ens_proceesing out 0 -fi
    +
    + +This approach only has two open files at any one time, and +the files are read and written sequentially. This approach is +harder to program but is much more I/O friendly for both workstations +and HPCs. The drawback is that this approach needs to keep all +the fields in memory. (#ensemble members x #fields/file x NX x NY x 4 bytes). + + +

    Usage

    +

    + +

    +-ens_processing FILE Option
    +   FILE = output file, grib2 format
    +   Option = 0   default
    +            1   include probabilities (TMP2m, precip)
    +                note: option 1 is intended for use by the future
    +		Conventional Observation REanalysis
    +		(CORe).  The output will be determined the needs of this
    +                reanalysis. 
    +            2   for future use or different output.
    +
    +  If you would like to add more output from -ens_processing, it
    +  needs to be enabled by an option number.  Ask me (WNE) for
    +  a number.
    +
    + +

    Example

    +

    +

    +$ wgrib2 input -ens_processing output 0 
    +1:0:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+1
    +2:83628:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+2
    +3:164290:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+3
    +4:248531:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+4
    +5:331723:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+5
    +6:412226:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+6
    +..
    +$ wgrib2 output
    +1:0:d=2018020600:PRES:mean sea level:84 hour fcst:min all members
    +2:130501:d=2018020600:PRES:mean sea level:84 hour fcst:max all members
    +3:261002:d=2018020600:PRES:mean sea level:84 hour fcst:ens mean
    +4:391503:d=2018020600:PRES:mean sea level:84 hour fcst:ens spread
    +5:497569:d=2018020600:PRES:mean sea level:84 hour fcst:25%-75% range
    +6:611780:d=2018020600:PRES:mean sea level:84 hour fcst:10% all members
    +7:742281:d=2018020600:PRES:mean sea level:84 hour fcst:90% all members
    +8:872782:d=2018020600:VIS:surface:84 hour fcst:min all members
    +9:938123:d=2018020600:VIS:surface:84 hour fcst:max all members
    +...
    +
    + +

    GrADS

    + +

    At the time of writing (1/2018), the files that +are produced by + -ens_processing cannot be displayed +using the g2ctl/gribmap/GrADS set of programs. However, they +can be displayed by atl_g2ctl/alt_gmp/GrADS set of programs. + +

    +  alt_g2ctl -short output >output.ctl
    +  alt_gmp output.ctl
    +  grads
    +
    + +

    +See also: +-ens_qc + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan 18, 2018, Aug 29, 2018, June 21, 2019, Sep 24, 2019. Jan 2021, Jan 2022, July 2023 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ens_qc.html b/docs/web_docs/ens_qc.html new file mode 100644 index 0000000..96f6c1d --- /dev/null +++ b/docs/web_docs/ens_qc.html @@ -0,0 +1,338 @@ + + + + Climate Prediction Center - wgrib2: -ens_qc + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ens_qc +
     
    + +

    wgrib2: -ens_qc

    +
    + + +

    Introduction (wgrib2 v3.1.1)

    + +

    +The option -ens_qc tests the +ensemble members looking for extreme values, values that +are extreme relative the spread of the ensemble members. +This test is done for each grid point. An unreasonable +scaled extreme value provides a simple quality control +for an egregiously bad ensemble member. +

    +During the production of the Conventional Observations REanalsyis (CORe), +a glitch was found where the upper-level ozone was two orders of magnitude +larger than expected. The problem was caused by a single ensemble +member which had an irreproducible problem which showed up in a single layer +of a tracer. The -ens_qc option was written to +detect extreme values of the ensemble members for quality control. +In addition, -ens_qc +can be used to calculate the ensemble mean and spread faster +than -ens_processing. + +

    +The option -ens_qc will QC ensemble +members which limits this option to PDTs of 0, 1, 8, and 11. +PDTs of 1 and 11 are explicity ensemble members. PDTs of 0 and +8 are often used by the control runs. The code should be updated +to include other ensemble PDTs. + +

    The contents of the output files will vary depending the qc_version. +As of 1/2022, only qc_version 1 has been defined. + +

    +1) ens_mean,  sum(x(i))/n,  i=1..n where n is the number of ensemble members
    +2) ens_spread, sqrt(sum((x(i)-em)**2)/n)  note: n is used rather than n-1
    +3) ens_min = minimum value over all ensemble members (for each grid point)
    +4) ens_max = maximum value over all ensemble members (for each grid point)
    +5) scaled extreme value, max((ens_max-ens_mean),(ens_mean-ens_min))/ens_spread
    +6) grid maximum of the scaled extreme value (single number)
    +
    +(1)-(4) are written to arg1, order: (3), (4), (1), (2)
    +(5) is written to arg2
    +(6) is written to arg3
    +
    +Note: the calculations are done grid point by grid point. If all the
    +members have UNDEFINED values for a particular grid point, then variables
    +1-5 are set to UNDEFINED for that grid point.  If the ensemble spread
    +is zero, then the scaled extreme value is set to zero.  The calculation
    +differs from -ens_processing which requires no missing values for all
    +the ensemble members before calculating the various products. This
    +will affect the calculation of the mean cloud top temperature some
    +ensemble members are missing clouds.
    +
    + +

    +The -ens_qc is unlike most wgrib2 +options in that this option can use large amounts of memory. Suppose +that you have an 80 member ensemble and are processing the tmp500 field. +This option stores all 80 tmp500 fields in memory. As the size of the grid and the number +of ensemble member increases, the required memory will increase. + +

    Code Table 4.7

    +

    Grib Code Table 4.7 is used to specify whether the field +is the ensemble mean, spread, min, max or scaled extreme value. +The ensemble mean, spread, min and max are WMO defined values. +For the scaled extreme value, wgrib2 is using the locally defined NCEP +"extreme forecast index". Since the NCEP documentation doesn't define +the index, wgrib2 will be using the scaled extreme value. So +other uses of the "extreme forecast index" will differ. + +

    +The scaled extreme values are stored in 8 bits precision (two digits), +and can only be written if the original file is from NCEP because +there is no equivalent WMO code for extreme value (1/2022). + + +

    Definition of an Ensemble Member

    + +

    +The -ens_qc option uses the same defintion of ensemble member as +-ens_processing. Any grib message which is +not identified as an ensemble member is ignored by -ens_qc. +So you cannot use -ens_qc on the ensemble-mean. +The wgrib2 code [ed. written 3/2022 v3.1.1] that identifies ensemble member +is unreasonably simplistic. Ensemble members are identified by having a PDT +of 0, 1, 8 and 11. As a result, aerosols, chemical tracers, simulated satellite data, +and post-processing of ensemble members are ignored. + +

    Order of Fields

    + +The -ens_qc requires fields to be in a specific order, +the same order as in -ens_processing. Please +see the documentation for -ens_processing. + + + +

    Usage

    +

    + +

    +-ens_qc FILE1 FILE2 FILE3 QC_VERSION
    +   FILE1 = ensemble min, ensemble max, ensemble mean, ensemble spread
    +           output in grib2 format
    +   FILE2 = if center == NCEP, (ensemble) scaled extreme value
    +           output in grib2 format
    +           if center != NCEP, no output is written
    +   FILE3 = grid maximum of the (ensemble) scaled extreme value
    +           text, single line per field
    +   QC_VERSION = the type of QC to be run
    +           1  only acceptable value (1/2021)
    +
    + +

    Example

    +
    +$ gmerge - sfg_2014060500_fhr06_mem0* | wgrib2 - -ens_qc out1 out2 out3 1
    +1:0:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:ENS=+1
    +2:183334:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:ENS=+2
    +3:366283:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:ENS=+3
    +4:549841:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:ENS=+4
    +5:733631:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:ENS=+5
    +...
    +  gmerge - (list of ensemble members)
    +           The output file is "-" which is a convention for stdin/stdout depending 
    +             on the expectation. Since we expecting an output file, the "-" is stdout.
    +           Takes the 1st grib message from each ensemble member and writes it to stdout.
    +           Takes the 2nd grib message from each ensemble member and writes it to stdout.
    +           etc
    +           The gmerge step puts the data into proper order assuming,
    +              the grib file contains no sub-messages,
    +              the indivdual grib files are in the same order.
    +           gmerge is not Windows compatilble.
    +
    +  wgrib2 - -ens_qc out1 out2 out3 1
    +           The input file is "-" which is a convention for stdin/stdout depending 
    +             on the expectation. Since we expecting an input file, the "-" is stdin.
    +           writes min, max, mean and spread to out1
    +           writes scaled extreme values to out2
    +           writes grid maximum scale extreme value to out3
    +
    +  Note: piping grib data to stdout and from stdin should not work in Windows.
    +  I have seen it work, and I have seen it fail. My standard practice is to
    +  avoid pipes in Windows.
    +
    +$ wgrib2 out1
    +1:0:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:min all members
    +2:262325:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:max all members
    +3:524650:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:ens mean
    +4:786975:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:ens spread
    +5:1000148:d=2014060412:UGRD:1-2 hybrid pressure layer:12 hour fcst:min all members
    +...
    +
    +$ wgrib2 out2
    +1:0:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:extreme forecast index
    +2:131253:d=2014060412:UGRD:1-2 hybrid pressure layer:12 hour fcst:extreme forecast index
    +3:262506:d=2014060412:UGRD:2-3 hybrid pressure layer:12 hour fcst:extreme forecast index
    +...
    +
    +$ cat out3
    +UGRD:0-1 hybrid pressure layer:max scaled extreme=7.454012
    +UGRD:1-2 hybrid pressure layer:max scaled extreme=8.029185
    +UGRD:2-3 hybrid pressure layer:max scaled extreme=7.936052
    +...
    +
    +

    GrADS

    + +

    At the time of writing (1/2021), the files that +are produced by + -ens_qc cannot be displayed +using the g2ctl/gribmap/GrADS set of programs. However, they +can be displayed by atl_g2ctl/alt_gmp/GrADS set of programs. + +

    +  alt_g2ctl -short output >output.ctl
    +  alt_gmp output.ctl
    +  grads
    +
    + +

    +See also: +-ens_processing, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: 1/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + diff --git a/docs/web_docs/eof_bin.html b/docs/web_docs/eof_bin.html new file mode 100644 index 0000000..ff54c68 --- /dev/null +++ b/docs/web_docs/eof_bin.html @@ -0,0 +1,203 @@ + + + + Climate Prediction Center - wgrib2: -lon + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-err_bin, err_string, eof_bin, eof_string, +
     
    + +

    wgrib2: -err_bin, -err_string, -eof_bin, -eof_string

    +
    + + +

    Introduction

    + +

    +When you want your want to embed wgrib2 in your program, you want to run wgrib2 and +have ways to talk with wgrib2. For example, we set up a pipe between the main program +and wgrib2. Wgrib2 was suppose to send the a decoded grid to the main program. However, +the grid didn't exist (EOF) or something was wrong (ERR). Consequently wgrib2 didn't +send the grid over the pipe and the main program just waited for data that would never +come. One method is to send an EOF or ERR message so that the main program would +realize something was wrong. For the case that started this, sending a binary 0 +was enough to alert the main program. (The main program was expecting a fortran +sequential file and a record size of 0 is not a reasonable value.) + +

    +The -err_bin, -eof_bin, -err_string, +and -eof_string options are setup options. Like all setup options, they +are only evaluated before processing of the file and in the case of duplicate options, +only the last applies. +The -err_bin and -eof_bin options write integer +to the specified file. The size of the integer will be determined by the size of the native +integer (often a compile option on 64 bit machines). The endian properties will depend +whether the code is compiled a big or little endian machine. + +

    +The -err_* options will write output when a "FATAL ERROR" message is triggered. +The -eof_* options will write output when wgrib2 ends with out a "FATAL ERROR" +message. However, if wgrib2 fails in an abnormal way (example: segmentation fault), +none of these routines will write output. + + +

    Usage

    + +
    +-err_bin file integer
    +-err_string file string
    +-eof_bin file integer
    +-eof_string file string
    +
    + + + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/eof_string.html b/docs/web_docs/eof_string.html new file mode 100644 index 0000000..ff54c68 --- /dev/null +++ b/docs/web_docs/eof_string.html @@ -0,0 +1,203 @@ + + + + Climate Prediction Center - wgrib2: -lon + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-err_bin, err_string, eof_bin, eof_string, +
     
    + +

    wgrib2: -err_bin, -err_string, -eof_bin, -eof_string

    +
    + + +

    Introduction

    + +

    +When you want your want to embed wgrib2 in your program, you want to run wgrib2 and +have ways to talk with wgrib2. For example, we set up a pipe between the main program +and wgrib2. Wgrib2 was suppose to send the a decoded grid to the main program. However, +the grid didn't exist (EOF) or something was wrong (ERR). Consequently wgrib2 didn't +send the grid over the pipe and the main program just waited for data that would never +come. One method is to send an EOF or ERR message so that the main program would +realize something was wrong. For the case that started this, sending a binary 0 +was enough to alert the main program. (The main program was expecting a fortran +sequential file and a record size of 0 is not a reasonable value.) + +

    +The -err_bin, -eof_bin, -err_string, +and -eof_string options are setup options. Like all setup options, they +are only evaluated before processing of the file and in the case of duplicate options, +only the last applies. +The -err_bin and -eof_bin options write integer +to the specified file. The size of the integer will be determined by the size of the native +integer (often a compile option on 64 bit machines). The endian properties will depend +whether the code is compiled a big or little endian machine. + +

    +The -err_* options will write output when a "FATAL ERROR" message is triggered. +The -eof_* options will write output when wgrib2 ends with out a "FATAL ERROR" +message. However, if wgrib2 fails in an abnormal way (example: segmentation fault), +none of these routines will write output. + + +

    Usage

    + +
    +-err_bin file integer
    +-err_string file string
    +-eof_bin file integer
    +-eof_string file string
    +
    + + + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/err_bin.html b/docs/web_docs/err_bin.html new file mode 100644 index 0000000..6cf4851 --- /dev/null +++ b/docs/web_docs/err_bin.html @@ -0,0 +1,214 @@ + + + + Climate Prediction Center - wgrib2: -lon + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-err_bin, err_string, eof_bin, eof_string, +
     
    + +

    wgrib2: -err_bin, -err_string, -eof_bin, -eof_string

    +
    + + +

    Introduction

    + +

    +When you want your want to embed wgrib2 in your program, you want to run wgrib2 and +have ways to talk with wgrib2. For example, we set up a pipe between the main program +and wgrib2. Wgrib2 was suppose to send the a decoded grid to the main program. However, +the grid didn't exist (EOF) or something was wrong (ERR). Consequently wgrib2 didn't +send the grid over the pipe and the main program just waited for data that would never +come. One method is to send an EOF or ERR message so that the main program would +realize something was wrong. For the case that started this, sending a binary 0 +was enough to alert the main program. (The main program was expecting a fortran +sequential file and a record size of 0 is not a reasonable value.) + +

    +The -err_bin, -eof_bin, -err_string, +and -eof_string options are setup options. Like all setup options, they +are only evaluated before processing of the file and in the case of duplicate options, +only the last applies. +The -err_bin and -eof_bin options write integer +to the specified file. The size of the integer will be determined by the size of the native +integer (often a compile option on 64 bit machines). The endian properties will depend +whether the code is compiled a big or little endian machine. + +

    +The -err_* options will write output when a "FATAL ERROR" message is triggered. +The -eof_* options will write output when wgrib2 ends without a "FATAL ERROR" +message. However, if wgrib2 fails in an abnormal way (example: segmentation fault), +none of these routines will write output. + +

    +If a "FATAL ERROR" occurs before the The -err_* option is initialized, there will +be no error file written. This can occur when the command line options are wrong +(option expects 3 arguments and you supply a different number). It can also +occur when the initialization of an earlier option failed. (Ex. read from a +non-existant file.) Consequently the -err_* options should be in front of the +comamand line arguments. +right. + + + + +

    Usage

    + +
    +-err_bin file integer
    +-err_string file string
    +-eof_bin file integer
    +-eof_string file string
    +
    + + + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/err_string.html b/docs/web_docs/err_string.html new file mode 100644 index 0000000..6cf4851 --- /dev/null +++ b/docs/web_docs/err_string.html @@ -0,0 +1,214 @@ + + + + Climate Prediction Center - wgrib2: -lon + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-err_bin, err_string, eof_bin, eof_string, +
     
    + +

    wgrib2: -err_bin, -err_string, -eof_bin, -eof_string

    +
    + + +

    Introduction

    + +

    +When you want your want to embed wgrib2 in your program, you want to run wgrib2 and +have ways to talk with wgrib2. For example, we set up a pipe between the main program +and wgrib2. Wgrib2 was suppose to send the a decoded grid to the main program. However, +the grid didn't exist (EOF) or something was wrong (ERR). Consequently wgrib2 didn't +send the grid over the pipe and the main program just waited for data that would never +come. One method is to send an EOF or ERR message so that the main program would +realize something was wrong. For the case that started this, sending a binary 0 +was enough to alert the main program. (The main program was expecting a fortran +sequential file and a record size of 0 is not a reasonable value.) + +

    +The -err_bin, -eof_bin, -err_string, +and -eof_string options are setup options. Like all setup options, they +are only evaluated before processing of the file and in the case of duplicate options, +only the last applies. +The -err_bin and -eof_bin options write integer +to the specified file. The size of the integer will be determined by the size of the native +integer (often a compile option on 64 bit machines). The endian properties will depend +whether the code is compiled a big or little endian machine. + +

    +The -err_* options will write output when a "FATAL ERROR" message is triggered. +The -eof_* options will write output when wgrib2 ends without a "FATAL ERROR" +message. However, if wgrib2 fails in an abnormal way (example: segmentation fault), +none of these routines will write output. + +

    +If a "FATAL ERROR" occurs before the The -err_* option is initialized, there will +be no error file written. This can occur when the command line options are wrong +(option expects 3 arguments and you supply a different number). It can also +occur when the initialization of an earlier option failed. (Ex. read from a +non-existant file.) Consequently the -err_* options should be in front of the +comamand line arguments. +right. + + + + +

    Usage

    + +
    +-err_bin file integer
    +-err_string file string
    +-eof_bin file integer
    +-eof_string file string
    +
    + + + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/error_final.html b/docs/web_docs/error_final.html new file mode 100644 index 0000000..399cc4f --- /dev/null +++ b/docs/web_docs/error_final.html @@ -0,0 +1,223 @@ + + + + Climate Prediction Center - wgrib2: -error_final + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-error_final +
     
    + +

    wgrib2: -error_final

    +
    + + +

    Introduction

    + +

    +The -error_final tests the final value +and can raise an error condition when wgrib2 returns. +For version 1, the only value that can be tested is the count +of the number time the option is called in the grib-processing phase. + +

    +When -error_final is intialized, the count is set to zero. +Then -error_final increments the count whenever it processes +a grib message. +Finally when -error_final is run after processing all the grib +messages, it tests count to a specified integer and sets the error return. + +

    Usage

    + +
    +-error_final count TEST INTEGER
    +   TEST = eq, ne, lt, gt, le, ge
    +   INTEGER integer
    +   sets return error to one if "count TEST INTEGER" is true
    +
    + +

    Example

    + +
    +-sh-4.2$ wgrib2 LIS.c3 
    +1:0:d=2014030500:SPRATE:surface:anl:
    +2:661778:d=2014030500:RPRATE:surface:anl:
    +3:903352:d=2014030500:SKINT:surface:anl:
    +4:4108932:d=2014030500:SDWE:surface:anl:
    +5:9512902:d=2014030500:SNOD:surface:anl:
    +6:14281104:d=2014030500:PRATE:surface:anl:
    +7:14925511:d=2014030500:TMP:surface:anl:
    +-sh-4.2$ wgrib2 LIS.c3  -error_final count ne 7 -if ':TMP:' -error_final count ne 1 -endif
    +1:0:d=2014030500:SPRATE:surface:anl:
    +2:661778:d=2014030500:RPRATE:surface:anl:
    +3:903352:d=2014030500:SKINT:surface:anl:
    +4:4108932:d=2014030500:SDWE:surface:anl:
    +5:9512902:d=2014030500:SNOD:surface:anl:
    +6:14281104:d=2014030500:PRATE:surface:anl:
    +7:14925511:d=2014030500:TMP:surface:anl:
    +-sh-4.2$ echo $?
    +0
    +-sh-4.2$ wgrib2 LIS.c3  -error_final count ne 7 -if ':TMP:' -error_final count ne 3 -endif
    +1:0:d=2014030500:SPRATE:surface:anl:
    +2:661778:d=2014030500:RPRATE:surface:anl:
    +3:903352:d=2014030500:SKINT:surface:anl:
    +4:4108932:d=2014030500:SDWE:surface:anl:
    +5:9512902:d=2014030500:SNOD:surface:anl:
    +6:14281104:d=2014030500:PRATE:surface:anl:
    +7:14925511:d=2014030500:TMP:surface:anl:
    +-sh-4.2$ echo $?
    +1
    +
    + + + +See also: +-if +-endif +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page: 7/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/example_merra_2_grib2.html b/docs/web_docs/example_merra_2_grib2.html new file mode 100644 index 0000000..6b522f7 --- /dev/null +++ b/docs/web_docs/example_merra_2_grib2.html @@ -0,0 +1,225 @@ + + + + Climate Prediction Center - wgrib2: converting MERRA HDF file to grib2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 - example converting MERRA HDF to grib2 +
     
    + +

    wgrib2: Converting MERRA HDF file to GRIB-2

    +
    + + +

    Introduction

    + +

    +MERRA is a NASA reanalysis project that has created reanalyses in HDF format. +For some people, grib is a more convenient format. Here is our first attempt +to convert a MERRA HDF file into grib-2. + +

    Surveying the situation we see that Lats or the simpler to use Lats4d can +convert HDF into grib-1. Grib-1 can be converted into grib-2 by the +cnvgrib utility except that lats creates a custom grib table. Therefore a +program would have to be written that converts the grib-1 file with the +custom grib table into a grib table using the standard NCEP table. Doable +but the program wouldn't be very generic. In addition the process would +take 3 steps (convert to grib1, translate grib1, convert to grib2). +Can we do better? + +

    Looking at the programs that can read HDF, we see a familiar face, GrADS. +GrADS can read the HDF and write it out as a binary file. wgrib2 can then +read the binary file, a grib-2 template and metadata and then create a grib-2 +file. + +

    1: The template

    +Grib-2 files include much metadata that is constant such as grid, center that created the +data, the process that created the data, etc. Making a template takes some knowledge +and we'll assume it has already been done. For the MERRA template, I used copygb/cnvgrib +to create a grib2 file with the proper grid definition and then used wgrib2 to fill +in some of the metadata (center). Probably should have filled in more of the metadata +but I didn't. + +

    2: Writing the binary and meta data

    +The script g2write takes three arguments, the GrADS variable/expression, +the output file and some metadata (variable:level:forecast/analysis). +The script then creates the binary and metadata for one or more grids +depending whether t is varying. These two files along with the +template can be used to make a grib2 file. + +

    3: All together

    + + +
  • Start gradshdf. +
  • open the HDF file, sdfopen hdf-file +
  • run the script, merra2grb2.gs + + +

    4: What does merra2grb2 do?

    + +
  • set the grid .. grads often uses an extra column .. 0..360 degrees +
  • set the time +
  • writes out ps with the metadata PRES:surface:anl +
  • writes out slp with the metadata PRES:mean sea level:anl +
  • loops over subset of available pressure levels +
  • writes out h with the metadata HGT:xx mb:anl +
  • writes out t with the metadata TMP:xx mb:anl +
  • writes out u with the metadata UGRD:xx mb:anl +
  • writes out v with the metadata VGRD:xx mb:anl +
  • writes out qv with the metadata SPFH:xx mb:anl +
  • writes out o3 with the metadata O3MR:xx mb:anl +
  • after finishing looping over the vertical levels, the binary file are closed +
  • the binary data is stored in test +
  • the metadata is stored in test.inv, one line per field +
  • finally wgrib2 is run which takes the binary data (test), inventory (test.inv) and template (hires-merra.template.grb) + and creates a grib2 file (test.grb2) + + +
  • + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/export_lonlat.html b/docs/web_docs/export_lonlat.html new file mode 100644 index 0000000..20a0108 --- /dev/null +++ b/docs/web_docs/export_lonlat.html @@ -0,0 +1,206 @@ + + + + Climate Prediction Center - wgrib2: -export_lonlat + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -export_lonlat +
     
    + +

    wgrib2: -export_lonlat

    +
    + + +

    Writing longitudes and latitudes to a file

    + +

    +By default grib2 saves the latitude and longitude in micro-degrees. This +is more precision than the standard single-precision floating point variable +can hold. So wgrib2 uses double precision variables for its angles. +However, the -rpn facility is single precision, so it cannot be use for +angles without losing precision. +The -export_lonlat and +-import_lonlat options allow you to write +and read double-precision longitude and latitudes. + + +

    File format

    +

    +The -export_lonlat option writes the +longitudes and latitudes in the following format. + +

    +8 bytes:                        'wgrib2ll'       text
    +(sizeof unsigned int) bytes      ndata           unsigned integer with number of grid points
    +(sizeof unsigned int) bytes      0               unsigned integer with value of zero
    +ndata*(sizeof double)            longitudes      ndata values of double precision longitudes
    +ndata*(sizeof double)            latitudes       ndata values of double precision latitudes
    +
    +(sizeof unsigned int) is usually 4.  By wgrib2 requirements, the value must be 4 or greater.
    +(sizeof double) is usually 8.
    +
    + +

    Usage

    +

    +

    +-export_lonlat FILE
    +    FILE = file that is written with the binary data
    +
    + +

    Example

    +
    +   $ wgrib2 IN.grb -ncpu 3 -new_grid_winds grid -new_grid ncep grid 221 - | wgrib2 - -ncpu 1 -set_grib_type j -ncep_uv OUT.grb
    +
    +

    +The above line uses 3 threads for regridding and one thread for jpeg2000 compression. The jpeg2000 +compression routines can't take advantage of more than one thread. +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page created: 6/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ext_name.html b/docs/web_docs/ext_name.html new file mode 100644 index 0000000..d24d8cd --- /dev/null +++ b/docs/web_docs/ext_name.html @@ -0,0 +1,284 @@ + + + + Climate Prediction Center - wgrib2: -ext_name= + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: -ext_name +
     
    + +

    wgrib2: -ext_name

    +
    + + +

    Introduction

    + +

    In the beginning, grib fields were identified by a name, a level +and some timing information, like temperature, surface, 12 hour forecast +from January 1, 2021. Eventually that wasn't good enough. The field +has modifiers such as ensemble member number or median forecast. +So the concept of "extended name" was introduced into wgrib2. +So by setting a flag, some options would use the extended name +instead of the normal name (-aaig, -csv, -csv_long, -netcdf, +and macros that call -ext_name). + + +

    Old Extended Names, up to wgrib2 3.0.2

    + +The original extended name included the grib name and modifiers like ensemble and +tracer information (misc info). The individual items were separated by +a period, and spaces were converted into underscore. The option -set_ext_name N +was documented to accept N being 0 and 1. (The wgrib2 would accept any integer, +and would test for zero and not zero.) The option, -ext_name would print +out the extend name (name.misc-info). + + +

    Extended Name for wgrib2 3.0.2+

    + +

    +Wgrib2 can write netcdf files, and -netcdf concatinates the level information +to the extended name to produce the netcdf name for the field. For some +of the newer NCEP forecast files, this name wasn't unique. So the extended +name was expanded to be name.misc-info.level-info.forecast-time.info +where the last 3 field were optional. + +

    +  $ wgrib2.v3.0.1 FCST.grb -set_ext_num 1 -netcdf FCST.nc
    +     lost fields because the field names were not unque
    +
    +  $ wgrib2.v3.0.1 FCST.grb -set_ext_num 5 -netcdf FCST.nc
    +     extended name include misc-info and forecast-time-info.
    +
    + +

    +The final modification to the extended name, was to make the field and space +character a run-time parameter by the option, -set_ext_name_chars. The default +values are '.' and '_' for backwards compatibilty. The modification was needed +we now are seeing level-info and misc-info with periods in them like "0.5 mb". + + + + +The -var option prints the VARIABLE name of +the grib message. Common names would be HGT and TMP for the geopotential +height and the temperature. For most knowing the variable name, +the level and the timimg information is all you need. Then things +became more complicated. Eventually a file came along which had only +one variable type (MASSDEN, mass density) but had a couple of +important qualifier chemical type (H2O/O3/N02) and ensemble member ID. +The -AAIG output was useless because its output +used the variable name. + +

    +To fix the -AAIG output, an extended name +was introduced. You can see the extended name by +the -ext_name option. + + +

    +$  wgrib2 chem.grb2 
    +1:0:d=2009012600:MASSDEN:surface:anl:ENS=hi-res ctl chemical=Water Vapour
    +$- wgrib2 chem.grb2 -ext_name
    +1:0:MASSDEN.hi-res_ctl.Water_Vapour
    +$ wgrib2 chem.grb2 -misc 
    +1:0:ENS=hi-res ctl:chemical=Water Vapour
    +
    + +The extended name takes the output of -misc, +changes the colons to periods, spaces to underscores and removes the +text up to the equal size and appends it to the variable name. As of +wgrib2 v1.9.0, the extended name is used with +-AAIGc, -csv, and -netcdf. +To stop using the extended name in -AAIG, -csv and -netcdf, use the option +-set_ext_name 0. + +

    +The -ext_name prints the extended name when the extended name type +is not zero. (The -set_ext_name option sets the extended name type.) + + +

    Extended Name when the extended name type is 0

    + +

    +The -ext_name always prints an extended name. +If the ext_name type is 0 which is the default value, -ext_name prints +out an extended name with the misc information. One sets the extended +name type using -set_ext_name. + +

    Usage

    + +
    +-set_ext_name N
    +       N = 0..1  wgrib2 upto v3.0.1
    +       N = 0..7  wgrib2 v3.0.2+
    +       N = 0     default value
    +-ext_name
    +       prints extended name type N if N > 0
    +       prints extended name type 1 if N == 0
    +
    + +

    Several options such as -netcdf use the +extended name type differently. If the extend name type is 0, they +use the regular name (-var). + +

    Examples

    + +
    +-sh-2.05b$ ./wgrib2 chem.grb2 -var
    +1:0:MASSDEN
    +-sh-2.05b$ ./wgrib2 chem.grb2 -ext_name
    +1:0:MASSDEN.hi-res_ctl.Water_Vapour
    +
    + + +See also: -s, +-set_ext_name +-set_ext_name_chars +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005, 2/26/2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/fcst_ave.html b/docs/web_docs/fcst_ave.html new file mode 100644 index 0000000..218c38b --- /dev/null +++ b/docs/web_docs/fcst_ave.html @@ -0,0 +1,518 @@ + + + + Climate Prediction Center - wgrib2: -ave, -fcst_ave + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ncep_norm +
     
    + +

    wgrib2: -ave, -fcst_ave

    +
    + +News +

    +With wgrib2 v2.0.7, +the -ave and -fcst_ave +now call the -time_processing option. +This option handles more statistical operations and more +Product Definition Templates (PDT). + +The old -ave and -fcst_ave options will available as +-ave0 and -fcst_ave0. I expect that +these two options will be eliminated within a year of the release of v2.0.7. + + +

    Introduction

    + +

    +The -ave +and -fcst_ave options are very similar; +they both make temporal averages. +The -fcst_ave option assumes that the +reference (initial) time is constant and the verification time +is increasing. +The +-ave option assumes the reference time +is increasing and the difference between the verification and +reference time is constant. + +

    + +You would use -fcst_ave to temporally average +a single forecast run. For example, you have a 3 week forecast with +output every 6 hours. You could use -fcst_ave +to find the forecast for the second week. + +

    +You would use -ave to temporally average +several analyses. Suppose you have +analyses every 6 hours and you want to find the analysis for the month. + +

    +The input grib file has to be processed in a special order. Don't worry, +a grib file can be ordered very easily with the sort command. wgrib2 reads the data +sequentially and when ever it encounters a new variable/level/chemical-type, +it starts the averaging process. The length of the averaging depends on +how many records it finds to average. For example, to make a daily +average, a file has to be in the following order. + +

    +U500 2000-01-02 00Z             start ave
    +U500 2000-01-02 06Z
    +U500 2000-01-02 12Z
    +U500 2000-01-02 18Z             end ave
    +V500 2000-01-02 00Z             start ave
    +V500 2000-01-02 06Z
    +V500 2000-01-02 12Z
    +V500 2000-01-02 18Z             end ave
    +Z500 2000-01-02 00Z             start ave
    +Z500 2000-01-02 06Z
    +Z500 2000-01-02 12Z
    +Z500 2000-01-02 18Z             end ave
    +
    + +To make a daily average of the above file, you need to specify the +output file and the time interval between samples. The time +units are the same as used by GrADS (hr, dy, mo, yr). + +
    +$ wgrib2 input.grb -ave 6hr out.grb
    +
    + + +If the file is not sorted, you can use the unix sort by, + +
    +$ wgrib2 input.grb | sort -t: -k4,4 -k5,5 -k6,6 -k3,3 | \
    +   wgrib2 -i input.grb -set_grib_type c3 -ave 6hr output.grb
    +
    + +If you want to make daily means from 4x daily monthly files +and assuming that more than one variable/level is in the monthly file. + +
    +$ wgrib2 input.grb |  sed 's/\(:d=........\)/\1:/' | \
    +  sort -t: -k3,3 -k5,5 -k6,6 -k7,7 -k4,4 | \
    +  wgrib2 input.grb -i -set_grib_type c3 -ave 6hr daily.ave.grb
    +
    + +

    +Using -fcst_ave is like using +-ave except you use the verification +time instead of the reference time. To make an inventory that +use the verification time instead of the reference time, you type, + +

    +$ wgrib2 input.grb -vt -var -lev -misc 
    +1:0:vt=2011040101:PRATE:surface:
    +2:592224:vt=2011040102:PRATE:surface:
    +3:1233694:vt=2011040103:PRATE:surface:
    +4:1909322:vt=2011040104:PRATE:surface:
    +5:2612620:vt=2011040105:PRATE:surface:
    +
    + +The sed command will be alterered very slightly when making the +sort (:d=) -> (:st=). + +

    Averaging several files using gmerge

    + +

    If want to average several grib files, and the files have the +following properties: + +

      +
    1. No submessages. +
    2. No non-grib data between the grib messages. +
    3. Each file is for a different time. +
    4. Each file has corresponding grib messages in the same order +
    +
    +Conditions 1 and 2 can be met using 
    +
    +      wgrib2 IN.grb -grib OUT.grb
    +
    +Condition 4 can be met using 
    +      wgrib2 IN.grb | sort -k3 -t: | wgrib2 -i IN.grb -grib OUT.grb
    +
    + +

    +Then you can use the gmerge program to produce a file in +the correct order. The program gmerge is included with the +wgrib2 distribution under grib2/aux_progs/. + +

    +$ ls pgb.20170107??
    +pgb.2017010700	pgb.2017010706	pgb.2017010712	pgb.2017010718
    +
    +$ gmerge - pgb.20170107?? | wgrib2 - -ave 6hr /tmp/daily.grb
    +1:0:d=2017010700:APCP:surface:0-6 hour acc fcst:
    +2:92905:d=2017010706:APCP:surface:0-6 hour acc fcst:
    +3:185445:d=2017010712:APCP:surface:0-6 hour acc fcst:
    +4:278666:d=2017010718:APCP:surface:0-6 hour acc fcst:
    +5:371535:d=2017010700:ACPCP:surface:0-6 hour acc fcst:
    +6:442127:d=2017010706:ACPCP:surface:0-6 hour acc fcst:
    +7:514343:d=2017010712:ACPCP:surface:0-6 hour acc fcst:
    +8:588096:d=2017010718:ACPCP:surface:0-6 hour acc fcst:
    +9:661594:d=2017010700:NCPCP:surface:0-6 hour acc fcst:
    +...
    +
    +$ wgrib2 /tmp/daily.grb 
    +1:0:d=2017010700:APCP:surface:4@6 hour ave(0-6 hour acc fcst),missing=0:
    +2:325115:d=2017010700:ACPCP:surface:4@6 hour ave(0-6 hour acc fcst),missing=0:
    +3:715210:d=2017010700:NCPCP:surface:4@6 hour ave(0-6 hour acc fcst),missing=0:
    +...
    +
    + + + +

    Fast Averaging several files

    +

    +Suppose we have a month of analyses at 3 hour intervals and want +to make a monthly mean for Nov. 2014. Using the above sorting approach, the steps +would be + +

    +1.  cat narr.201411????.grb2 >tmp.grb2
    +2.  wgrib2 tmp.grb2 |  \
    +3.     sort -t: -k4,4 -k5,5 -k6,6 -k3,3 | \
    +4.     wgrib2 tmp.grb2 -i -set_grib_type c3 -ave 3hr narr.201411
    +
    +The first line creates a file with all the data.
    +The second line make an inventory.
    +The third line sorts the inventory in the order for -ave to process.
    +The fourth line makes the average by processing data in the order
    +  determined by the inventory created by line 3.
    +
    + +

    +The above approach processes one average at a time and requires a +minimal amout of memory. However, if you count the I/O operations, +you find that there are 4 I/O operations for every field as well as +the writes of the monthly means. In addition, the read (line 4) is +random access. + +

    +The gmerge approach would look like + +

    +1.  gmerge - narr.201411????.grb2 | \
    +2.     wgrib2 - -set_grib_type c3 -ave 3hr narr.201411
    +
    +The first line creates a file with all the data.
    +The second line makes the average by processing data from line 1.
    +
    + +

    +For this to work, you would have to rewrite gmerge to that it can +large number of input files. For a monthly average of 3-hourly files, +a typical linux system wouldn't have any problems. For a 30-year +climatology, the typical linux system would complain about the +number of open files. + +

    The number of I/O operations with the gmerge is quite good, +every input file is read one time. The read would behave somewhere +between a sequential read and a random read. Another drawback +is the input files much have the data in the same order. + + +

    The third method takes advantage of HPC file systems which +are very fast for sequential reads of large files and terrible for +random-access reads like used in the +the sort-of-the-index method. Using this method for computing +monthly means from 3-hourly NARR data was taking three quarters of +an hour on a multi-million dollar machine. +The problem was that the file system was optimized for large +sequential reads rather than small random-access reads. +The following shows another approach. + + +

    +1.  cat narr.201411????.grb2 | \
    +2.     wgrib2 - \
    +3.        -if_fs ":HGT:200 mb:" -ave 3hr narr.201411 \
    +4.        -if_fs ":UGRD:200 mb:" -ave 3hr narr.201411 \
    +5.        -if_fs ":VGRD:200 mb:" -ave 3hr narr.201411 \
    +6.        -if_fs ":TMP:200 mb:" -ave 3hr narr.201411 
    +
    +The first line copies the data in chronological order and
    +   writes it to the pipe.
    +The second line has wgrib2 read the grib data from the pipe.
    +The third line selects the Z200 fields and runs the averaging
    +  option on it.  We are assuming the narr.* fields only have
    +  one Z200 field and narr.201411???? puts the data into
    +  chronological order.
    +Lines 4-6 apply the averaging option to other fields.
    +
    + +

    +The above approach computes the mean of Z200, U200, V200 and T200 data +at the same time with the use of more memory. +The I/O consists of sequential read of all the files and the +writes of the monthly means. The above script only creates +the mean of Z200, U200, V200 and T200 but you could write a +very long command line and compute the mean of all the fields in +the file. Here are the guts of a +bash script, fast_grib2_mean.sh, which creates and runs the command line. + +

    +1.  wgrib2 $1 -match_inv | cut -f4- -d: | sed -e 's/:n=.*//' >$tmp
    +2.  cmd="cat $* | $wgrib2 - -set_grib_type c3 "
    +3.  while read line
    +4.  do
    +5.    cmd="$cmd -if_fs '$line' -ave $dt $out "
    +6.  done <$tmp
    +7.  eval $cmd
    +
    +1. $1 is the first file to average.
    +   Line 1 creates a file with the field names (minus date codes)
    +2. cmd is the command line that is being built
    +3. loop over all the lines in file $tmp
    +5. generate the "-if_fs/-ave" for the cmd line
    +   Older versions of the web paged used -if but that caused problems when
    +   $line included metacharacters such as parentheses.
    +6. bash syntax to have the while loop read from $tmp
    +7. run the command line
    +
    + +

    +Making the NARR monthly means using the above approach uses large +sequential reads which is optimal for the HPC file system. The run +time went from 3/4 of an hour to maybe a minute. + +

    Fast Forecast Averaging

    + +

    +The previous shell script was for a fast averaging of many analyses. +Sometimes one want to average several forecasts starting from +the same initial time. An example would producing a week-4 forecast. + +

    +1.  $wgrib2 $1 -match_inv | cut -f4-5 -d:  >$tmp
    +2.  cmd="cat $* | $wgrib2 - -set_grib_type c3 "
    +3.  while read line
    +4.  do
    +5.    cmd="$cmd -if_fs '$line' -fcst_ave $dt $out "
    +6.  done <$tmp
    +7.  eval $cmd
    +
    +1. $1 is the first file to average.
    +   Line 1 creates a file with the name and level for each field
    +   It is assumed that the name and level is unique in the file.
    +2. cmd is the command line that is being built
    +3. loop over all the lines in file $tmp
    +5. generate the "-if_fs/-fcst_ave" for the cmd line
    +   Older versions of the web paged used -if but that caused problems when
    +   $line included metacharacters such as parentheses.
    +6. bash syntax to have the while loop read from $tmp
    +7. run the command line
    +
    +

    +Using the -merge_fcst option in a like +manner to the -fcst_ave option. in a like + + + +

    Monthly Climatologies

    + +Once you can make an average, making a monthly climatology should be easy. Except +it isn't. Here are some of the problems that I encountered. + +
      +
    1. February has 28 days except when it doesn't. This causes problems because + wgrib2 -ave will not average 28 and 29 day intervals. +
    2. '116@6 hour ave(anl)' includes a regex metacharacter +
    3. the process id changed +
    4. the subcenter changed +
    + +The solutions were: + +
      +
    1. rewrite the grib file with
      + -if_fs '116@6 hour ave(anl)' -set_ftime2 '112@6 hour ave(anl)' -fi \
      + -if_fs '116@6 hour ave(6 hour fcst)' -set_ftime2 '112@6 hour ave(6 hour fcst)' -fi \
      + -if_fs '116@6 hour ave(3-6 hour acc fcst)' -set_ftime2 '112@6 hour ave(3-6 hour acc fcst)' -fi \
      +
    2. Use -if_fs instead of -if +
    3. rewrite the file with -set analysis_or_forecast_process_id 180 +
    4. rewrite the file with -set subcenter 0 +
    + +

    +Finding items 3 and 4 was a pain. Using undocumented option v98 helps. However, the mismatches can +now be uncoverted by using a verbose mode (>0) and wgrib v2.0.6. + + +

    Limitations by wgrib2 version

    +

    +There is a limit in the maximum number of -if_fs/-ave clauses. +Wgrib2 v2.0.6 can process up to 2000 -if and 2000 -if_fs options and +accept 10000 words on the command line. Since each -if_fs/-ave clause takes 5 +words on the command line and you need to include the name of the +input file, you get a limit of 999 -if_fs/-ave clauses. To speed up +the code, the evaluation of the -if_fs options is done in parallel. + + +

    Usage

    +

    + +

    +-ave (time interval)  (output grib file)
    +-fcst_ave (time interval)  (output grib file)
    +
    +   wgrib2 prior to v2.0.7 only works with PDT=4.0, 4.1 and 4.8
    +    support for PDT 4.2 and 4.12 by -ave added 7.2016
    +   wgrib2 v2.0.7 is limited by the -time_processing option
    +
    + +

    +See also: +-merge_fcst, +-time_processing +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Feb 12, 2018, July 26, 2018 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/fgrep.html b/docs/web_docs/fgrep.html new file mode 100644 index 0000000..cef5fcf --- /dev/null +++ b/docs/web_docs/fgrep.html @@ -0,0 +1,260 @@ + + + + Climate Prediction Center - wgrib2: -grep (various) + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grep (various) +
     
    + +

    wgrib2: -egrep, -egrep_v, -fgrep, -fgrep_v

    +
    + + +

    Introduction

    + +

    +When you use wgrib2 extensively, common sequences keep occuring, such as, + +

    +   1:  wgrib2 A.grb >A.inv
    +   2:  cat A.inv | fgrep ":HGT:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib hgt500.grb
    +   3:  cat A.inv | fgrep ":TMP:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib tmp500.grb
    +   4:  cat A.inv | egrep ":(UGRD|VGRD):" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib wind500.grb
    +
    + +Using the various -grep, -inv and the -i_file option, the above example can +be written as + +
    +   1:  wgrib2 A.grb -inv A.inv
    +   2:  wgrib2 -fgrep ":HGT:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib hgt500.grb
    +   3:  wgrib2 -fgrep ":TMP:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib tmp500.grb
    +   4:  wgrib2 -egrep ":(UGRD|VGRD):" -fgrep ":500 mb:" -i_file A.inv A.grb -grib wind500.grb
    +
    + +The first version is easier to read. So why were the extra options added? + +
      +
    1. Some shells have problems with pipes. +
        +
      • Some versions of Windows dos-prompt have problems with pipes. +
      • RNomads: solved Windows 7 problem by using these options +
      +
    2. More efficient when you avoid multiple processes and pipes. +
        +
      • Every millisecond and K byte of RAM usage counts! +
      +
    3. Used by callable wgrib2. +
        +
      • A subroutine (wgrib2) can read a field using the index file! +
      +
    + +The options were added for the third reason, but one and two are some +nice side effects. The 4 examples can be coded in fortran as, + +
    +   include wgrib2api
    +   ...
    +   i = wgrib2a('A.grb','-inv','A.inv')
    +   i = wgrib2a('-fgrep',':HGT:','-fgrep',':500 mb:','-i_file,'A.inv','A.grb','-grib','hgt500.grb')
    +   i = wgrib2a('-fgrep',':TMP:','-fgrep',':500 mb:','-i_file','A.inv','A.grb','-grib','tmp500.grb')
    +   i = wgrib2a('-egrep',':(UGRD|VGRD):','-fgrep',':500','mb:','-i_file','A.inv','A.grb','-grib','wind500.grb')
    +
    + +

    The -grep options are used in wgrib2api's grb2_inq(..) function. + +

    +Definition of grep options:
    +
    +    (...) | wgrib2 -OP1 X (...)
    +      behaves like
    +    (...) | OP2 X | wgrib2 (...) 
    +
    +      if OP1 == egrep       then OP2 = egrep
    +      if OP1 == fgrep       then OP2 = fgrep
    +      if OP1 == egrep_v     then OP2 = egrep -v
    +      if OP1 == fgrep_v     then OP2 = fgrep -v
    +
    +    X is a posix extended regular expression (egrep, egrep_v)
    +    or a fixed string (fgrep, fgrep_v)
    +
    +   The number of -fgrep and -fgrep_v options is limited to 200.
    +   The number of -egrep and -egrep_v options is limited to 200.
    +   The wgrib2 option -set_regex does not affect the -grep options.
    +
    + + +

    Usage

    +

    + +

    +-egrep X
    +-egrep_v X
    +-fgrep Y
    +-fgrep_v Y
    +
    +X is a posix extended regular expression
    +Y is a fixed string (not a regular expression)
    +Note: -set_regex does not modify the type of regex for these options
    +
    + +

    +See also: +-match, +-not, +-match_inv, +-end, +-if, +-i_file, +-not_if, +-set_regex. +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page modified: Feb 3, 2017, 7/2019. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/fgrep_v.html b/docs/web_docs/fgrep_v.html new file mode 100644 index 0000000..cef5fcf --- /dev/null +++ b/docs/web_docs/fgrep_v.html @@ -0,0 +1,260 @@ + + + + Climate Prediction Center - wgrib2: -grep (various) + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grep (various) +
     
    + +

    wgrib2: -egrep, -egrep_v, -fgrep, -fgrep_v

    +
    + + +

    Introduction

    + +

    +When you use wgrib2 extensively, common sequences keep occuring, such as, + +

    +   1:  wgrib2 A.grb >A.inv
    +   2:  cat A.inv | fgrep ":HGT:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib hgt500.grb
    +   3:  cat A.inv | fgrep ":TMP:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib tmp500.grb
    +   4:  cat A.inv | egrep ":(UGRD|VGRD):" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib wind500.grb
    +
    + +Using the various -grep, -inv and the -i_file option, the above example can +be written as + +
    +   1:  wgrib2 A.grb -inv A.inv
    +   2:  wgrib2 -fgrep ":HGT:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib hgt500.grb
    +   3:  wgrib2 -fgrep ":TMP:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib tmp500.grb
    +   4:  wgrib2 -egrep ":(UGRD|VGRD):" -fgrep ":500 mb:" -i_file A.inv A.grb -grib wind500.grb
    +
    + +The first version is easier to read. So why were the extra options added? + +
      +
    1. Some shells have problems with pipes. +
        +
      • Some versions of Windows dos-prompt have problems with pipes. +
      • RNomads: solved Windows 7 problem by using these options +
      +
    2. More efficient when you avoid multiple processes and pipes. +
        +
      • Every millisecond and K byte of RAM usage counts! +
      +
    3. Used by callable wgrib2. +
        +
      • A subroutine (wgrib2) can read a field using the index file! +
      +
    + +The options were added for the third reason, but one and two are some +nice side effects. The 4 examples can be coded in fortran as, + +
    +   include wgrib2api
    +   ...
    +   i = wgrib2a('A.grb','-inv','A.inv')
    +   i = wgrib2a('-fgrep',':HGT:','-fgrep',':500 mb:','-i_file,'A.inv','A.grb','-grib','hgt500.grb')
    +   i = wgrib2a('-fgrep',':TMP:','-fgrep',':500 mb:','-i_file','A.inv','A.grb','-grib','tmp500.grb')
    +   i = wgrib2a('-egrep',':(UGRD|VGRD):','-fgrep',':500','mb:','-i_file','A.inv','A.grb','-grib','wind500.grb')
    +
    + +

    The -grep options are used in wgrib2api's grb2_inq(..) function. + +

    +Definition of grep options:
    +
    +    (...) | wgrib2 -OP1 X (...)
    +      behaves like
    +    (...) | OP2 X | wgrib2 (...) 
    +
    +      if OP1 == egrep       then OP2 = egrep
    +      if OP1 == fgrep       then OP2 = fgrep
    +      if OP1 == egrep_v     then OP2 = egrep -v
    +      if OP1 == fgrep_v     then OP2 = fgrep -v
    +
    +    X is a posix extended regular expression (egrep, egrep_v)
    +    or a fixed string (fgrep, fgrep_v)
    +
    +   The number of -fgrep and -fgrep_v options is limited to 200.
    +   The number of -egrep and -egrep_v options is limited to 200.
    +   The wgrib2 option -set_regex does not affect the -grep options.
    +
    + + +

    Usage

    +

    + +

    +-egrep X
    +-egrep_v X
    +-fgrep Y
    +-fgrep_v Y
    +
    +X is a posix extended regular expression
    +Y is a fixed string (not a regular expression)
    +Note: -set_regex does not modify the type of regex for these options
    +
    + +

    +See also: +-match, +-not, +-match_inv, +-end, +-if, +-i_file, +-not_if, +-set_regex. +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page modified: Feb 3, 2017, 7/2019. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/fi.html b/docs/web_docs/fi.html new file mode 100644 index 0000000..ee11016 --- /dev/null +++ b/docs/web_docs/fi.html @@ -0,0 +1,208 @@ + + + + Climate Prediction Center - wgrib2: -fi + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-fi +
     
    + +

    wgrib2: -fi

    +
    + + +

    Introduction

    + +

    +The -fi option is used by the version 1 IF block. +It is recommened that version 2 of the IF block be used and +-fi no longer be used. + + +

    +Version 1 IF structure:  
    +
    +  -if TEST (non-output options) (output option)
    +
    +   If the test is false, all the options up to and including
    +   the next output option are not executed.  The -fi
    +   option is a null output option.
    +
    +   If the test is true, the following options are executed
    +
    +
    +Version 2 IF block:  (wgrib2 v3.0.0+)
    +
    +  -if TEST (options) -endif
    +  -if TEST (options) -else (options) -endif
    +  -if TEST (options) -elseif TEST (options) -endif
    +  -if TEST (options) -elseif TEST (options) -elseif TEST (options) -endif
    +  -if TEST (options) -elseif TEST (options) -else (options) -endif
    +
    +  The "-else (options)" is optional.
    +  The "-elseif TEST (options)" is optional, and can be repeated may times.
    +
    +
    +  The new structure can include nested IF blocks.
    +
    + +The -endif option is tne new way to close +an IF block (wgrib2 v3.0.0+). Wgrib2 v3.0.0 handles both +the old and new IF blocks. While there is no plans to +remove the old IF blocks, it is recommended that the new IF +blocks be used because the scripts will be easier to read by future +users. Note that the old and new IF blocks cannot be mixed. + + +

    +See also: +-if, +-endif, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005, March 13, 2019, March 18, 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/fix_CFSv2_fcst.html b/docs/web_docs/fix_CFSv2_fcst.html new file mode 100644 index 0000000..a71a36b --- /dev/null +++ b/docs/web_docs/fix_CFSv2_fcst.html @@ -0,0 +1,469 @@ + + + + Climate Prediction Center - wgrib2: -fix_CFSv2_fcst + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-fix_CFSv2_fcst +
     
    + +

    wgrib2: -fix_CFSv2_fcst

    +
    + + +

    Introduction

    + +

    +The Climate Forecast System version 2 (CFSv2) is a coupled atmosphere/ocean +forecast system that was developed at NCEP. CFSv2 produces analyses (CFSR) +and daily to seasonal forecats. The seasonal forecasts consists of hindcasts +(CFSRR) and the real-time forecasts (CFSv2 forecasts). + +

    The monthly-mean forecasts from the CFSRR and CFSv2 are originally +written in grib1 format and later converted to grib2 format for public +distribution. In this process, the resulting grib2 files are mangled +and the metadata no longer correctly describes the contents of the file. +The -fix_CFSv2_fcst option alters the metadata of the +CFSRR/CFSv2 monthly forecasts files to make them grib2 compliant and to +fix the metadata. After the data has been fixed, the files can +then be read with grib2 decoders such as GrADS. + + +

    CFSRR/CFSv2 Monthly Forecast File Names

    + +The CFSv2 monthly forecasts have a naming convengtiion. + +
    +(NAME)(DATE0).(EN).(DATE1).avrg[.(HH)Z].grb2
    +
    +NAME=type of file
    +     flxf       forecast (f) data on special levels (flx)
    +     ipvf       forecast (f) data on isentropic surfaces (ipv)
    +     ocnf       forecast (f) data for the oceans (ocn)
    +     pgbf       forecast (f) data for pressure (p) levels grib (gb)
    +
    +DATE0=starting time of the forecasts
    +      YYYYMMDDHH
    +
    +EN=ensemble member number
    +
    +DATE1=target month of the forecast
    +      YYYYMM
    +
    +[..] = contents in the square brackets are optional
    +
    +Case 1: contents of [] are missing or null
    +        The forecast system produces daily forecasts ending at 00Z, 06Z, 12Z and 18Z.
    +        All these forecasts are included in the forecast of the monthly mean.
    +
    +Case 2: contents of [] are present, i.e., .(HH)Z
    +       HH = 00, 06, 12, 18
    +       The monthly forecast is for a specific cycle of the day.
    +       For example the 00Z cycle.  For instantaneous quantities,
    +       the monthly forecast will be consist of the mean of all daily forecasts 
    +       that verify on the 00Z hour.  For quantities that are 6 hour
    +       averages or accumulations, they will be the average of all the
    +       forecasts with averages/accumulations that end at 00Z hour
    +       (18Z-24Z average/accumulations).
    +
    +       Unfortunately the original file doesn't contain any metadata
    +       concerning the hour or the type of quantity, so the hour
    +       has to be entered as an argument and the forecasts are
    +       assumed to be the average of instantaneous fields.
    +
    + + +

    Fixing the CFSRR/CFSv2 monthly forecasts format

    + +A filter was added to wgrib2 that fixes the metadata in +the CFSv2 monthly forecasts. To fix the metadata, + +
    +wgrib2 IN -fix_CFSv2_fcst TIME EN N_ENS -grib OUT
    +
    +IN=name of input grib file, ex. flxf2009010100.01.200901.avrg.06Z.grb2
    +
    +TIME=daily, 00, 06, 12, 18
    +    use daily if .(HH)Z is missing from the input filename
    +    use 00 if .00Z is part of the input filename
    +    use 06 if .06Z is part of the input filename
    +    use 12 if .12Z is part of the input filename
    +    use 18 if .18Z is part of the input filename
    +
    +EN=ensemble member number, suggested that EN from the filename is used but value is arbitrary.
    +
    +N_ENS=number of ensemble members, use max of (EN).  Value is arbitrary.
    +
    +OUT=name of the output grib file
    +
    + +

    Example of Fixing the CFSRR monthly forecast

    + +
    +bash-3.2$ wgrib2 flxf2009010100.01.200903.avrg.06Z.grb2 -for 1:3 -fix_CFSv2_fcst 06 1 1  -grib out.grb
    +1:0:d=2009010100:UFLX:surface:1422 hour-(1422 hour+30 day) ave@(fcst,dt=1 day),missing=0:ENS=+1
    +2:66720:d=2009010100:VFLX:surface:1422 hour-(1422 hour+30 day) ave@(fcst,dt=1 day),missing=0:ENS=+1
    +3:133122:d=2009010100:SHTFL:surface:1422 hour-(1422 hour+30 day) ave@(fcst,dt=1 day),missing=0:ENS=+1
    +
    +flxf2009010100.01.200903.avrg.06Z.grb2   input file
    +-for 1:3                                 process records 1..3
    +-fix_CFSv2_fcst 06 1 1                   fix metadata for 06Z type file, 
    +-grib out.grb                            save corrected file in out.grb
    +
    + +

    Examining our corrected file

    + +The default wgrib2 inventory looks like + +
    +bash-3.2$ wgrib2 out.grb 
    +1:0:d=2009010100:UFLX:surface:1422 hour-(1422 hour+30 day) ave@(23 hour fcst)++,missing=0:ENS=+1
    +2:66719:d=2009010100:VFLX:surface:1422 hour-(1422 hour+30 day) ave@(23 hour fcst)++,missing=0:ENS=+1
    +3:133120:d=2009010100:SHTFL:surface:1422 hour-(1422 hour+30 day) ave@(23 hour fcst)++,missing=0:ENS=+1
    +
    +d=2009010100                             initial time of the forecast
    +UFLX                                     zonal wind stress
    +1422 hour-(1422 hour+30 day) ave         average for 1422 hour to (1422 hours + 30 day)
    +(fcst,dt=1 day)                          average the forecast at 1 day intervales
    +missing=0                                no missing fields in the average
    +
    + +Now I can't figure out 1422 hours in my head, so I can print out the start and and of the +forecast time interval by, + +
    +bash-3.2$ wgrib2 out.grb -start_ft -end_ft
    +1:0:start_ft=2009030106:end_ft=2009033106
    +2:66719:start_ft=2009030106:end_ft=2009033106
    +3:133120:start_ft=2009030106:end_ft=2009033106
    +
    + +Notice the start_ft has a 06 hour as you would have expected from the original file, +flxf2009010100.01.200903.avrg.06Z.grb2. + +

    Adding Ocean Metadata

    + +

    In the NCDC archives, the DBSS variable has bad level information. +For example, the time series of N degree isotherm is not encoded correctly + +

    +bash-3.2$ wgrib2 dt5c.ensm.apr.cfsv2.data.grb2
    +1:0:d=1982040618:DBSS:0C ocean isotherm:0-1 month ave fcst:
    +2:42547:d=1982040618:DBSS:0C ocean isotherm:1-2 month ave fcst:
    +3:85611:d=1982040618:DBSS:0C ocean isotherm:2-3 month ave fcst:
    +4:128757:d=1982040618:DBSS:0C ocean isotherm:3-4 month ave fcst:
    +...
    +
    +The level should be 5C ocean isotherm as indicated by the file name.
    +
    +
    +To fix this time series, you need to rewrite the level information.
    +
    +
    +bash-3.2$ wgrib2 dt5c.ensm.apr.cfsv2.data.grb2 -set_lev "5C ocean isotherm" -grib dt5c.ensm.apr.cfsv2.data.grb2.new
    +1:0:d=1982040618:DBSS:5C ocean isotherm:0-1 month ave fcst:
    +2:42547:d=1982040618:DBSS:5C ocean isotherm:1-2 month ave fcst:
    +3:85611:d=1982040618:DBSS:5C ocean isotherm:2-3 month ave fcst:
    +4:128757:d=1982040618:DBSS:5C ocean isotherm:3-4 month ave fcst:
    +...
    +
    + +In monthly ocean forecasts @ NCDC, we can find bad level data. For example, +one file had bad level metadata for messages 216-222. +
    +216:11232042:d=1999052200:DBSS:0C ocean isotherm:2-3 month ave fcst:
    +217:11278152:d=1999052200:DBSS:0C ocean isotherm:2-3 month ave fcst:
    +218:11322088:d=1999052200:DBSS:0C ocean isotherm:2-3 month ave fcst:
    +219:11360222:d=1999052200:DBSS:0C ocean isotherm:2-3 month ave fcst:
    +220:11392818:d=1999052200:DBSS:0C ocean isotherm:2-3 month ave fcst:
    +221:11419935:d=1999052200:DBSS:0C ocean isotherm:2-3 month ave fcst:
    +222:11440970:d=1999052200:DBSS:0C ocean isotherm:2-3 month ave fcst: 
    +
    + +The following code snippet will fix the level data for the above file. +
    +wgrib2 $f \
    + -if "^216:" -set_lev "2.5C ocean isotherm"  -fi \
    + -if "^217:" -set_lev "5C ocean isotherm"  -fi \
    + -if "^218:" -set_lev "10C ocean isotherm"  -fi \
    + -if "^219:" -set_lev "15C ocean isotherm"  -fi \
    + -if "^220:" -set_lev "20C ocean isotherm"  -fi \
    + -if "^221:" -set_lev "25C ocean isotherm"  -fi \
    + -if "^222:" -set_lev "28C ocean isotherm"  -fi  \
    + -grib $f.fixed
    +
    + + + +

    Making GrADS control files

    + +Once you have converted the files using the -fix_CFSv2_fcst option, +you have to use the -b option in g2ctl/gribmap to get the target times to line up correctly. +The -b option sets the start of the target month as the GrADS time. If you use the default option, +you will get the end of the forecast period. For the ordinary forecast files, that will be +at 18Z of the last month. Definately not as friendly. + +
    +bash-3.2$ g2ctl -b out.grb >out.ctl
    +bash-3.2$ gribmap -b -i out.ctl
    +grib2map: scanning GRIB2 file: out.grb
    +grib2map: Writing out the index file 
    +
    + + +

    A Real Example

    + +

    +The previous examples were the conversion, inventory and display of a single file. +Most of the time, people would want to examine the entire forecast run. In this +followring example, we look at a forecast run. Here we cannot include +the file with the target month which is the same as the starting month +because this file does not start on the 1st of the month like the other files. + +

    +CFSRR files:
    +
    +    (do not include this file) -->   pgbf2009081500.01.200908.avrg.grb2
    +    pgbf2009081500.01.200909.avrg.grb2
    +    pgbf2009081500.01.200910.avrg.grb2
    +    pgbf2009081500.01.200911.avrg.grb2
    +
    + +Fixing the metadata in the bash shell on a linux box. + +
    +bash-3.2$ for f in pgbf2009081500.01.2009??.avrg.grb2
    +>do
    +> wgrib2 $f -fix_CFSv2_fcst_daily 1 1 -grib $f.new >/dev/null
    +>done
    +fix_CFSRv2_fcst 524 fields fixed
    +fix_CFSRv2_fcst 524 fields fixed
    +fix_CFSRv2_fcst 524 fields fixed
    +
    + +Making the GrADS ctl and idx files. Note the -b options to both g2ctl and gribmap. +Note that gribmap v2 and grads v2 have to be used. Note the use of the template (%m2) in +the g2ctl line. + + +
    +bash-3.2$ g2ctl -b pgbf2009081500.01.2009%m2.avrg.grb2.new >pgb.ctl
    +bash-3.2$ gribmap -b -i pgb.ctl
    +grib2map: scanning GRIB2 file: pgbf2009081500.01.200909.avrg.grb2.new 
    +grib2map: scanning GRIB2 file: pgbf2009081500.01.200910.avrg.grb2.new 
    +grib2map: scanning GRIB2 file: pgbf2009081500.01.200911.avrg.grb2.new 
    +grib2map: reached end of files
    +grib2map: Writing out the index file 
    +
    + +Running grads v2 with the new ctl/idx file. + +
    +bash-3.2$ grads
    +
    +Grid Analysis and Display System (GrADS) Version 2.0.a9
    +Copyright (c) 1988-2010 by Brian Doty and the
    +Institute for Global Environment and Society (IGES)
    +GrADS comes with ABSOLUTELY NO WARRANTY
    +See file COPYRIGHT for more information
    +
    +Config: v2.0.a9 little-endian readline printim grib2 netcdf hdf4-sds hdf5 opendap-grids,stn geotiff shapefile
    +Issue 'q config' command for more detailed configuration information
    +Landscape mode? ('n' for portrait):
    +GX Package Initialization: Size = 11 8.5 
    +ga-> open pgb.ctl
    +Scanning description file:  pgb.ctl
    +Data file pgbf2009081500.01.2009%m2.avrg.grb2.new is open as file 1
    +LON set to 0 360 
    +LAT set to -90 90 
    +LEV set to 1000 1000 
    +Time values set: 2009:8:15:0 2009:8:15:0 
    +E set to 1 1 
    +ga-> set lev 500
    +LEV set to 500 500 
    +ga-> d hgtprs
    +Contouring: 4900 to 5900 interval 100 
    +ga-> 
    +
    + +

    Encoding the Ensemble Information

    +

    +The -fix_CFSv2_fcst option adds enesemble information. The directions +suggest that you number the runs using the same numbers as suggested by the CFSv2 filename convention. +That will minimize confusion. However, you are allowed to give any ensemble number +up to 254. Usiog unique ensemble member numbers would be useful GrADS. +

    + +

    Caveats

    +

    +The filtering action of -fix_CFSv2_fcst assumes that the fields +that were averaged were instantaneous fields (ex. Z500 at a specific time). This +is not true as some fields are 6-hour accumulations or averages. Grib2 can describe +averages of accumulations/averages. However, this nuance was ignored. + +

    +The instructions suggest that you encode the CFSRR enemble member number as 1 to be consistent +with the CFSv2 file name convention. For CFSRR, there is only one ensemble member (01) which +by would be considered the high-resolution control run. + +

    Usage

    +

    + +

    +-fix_CFSv2_fcst X Y Z
    +X=daily, 00, 06, 12, 18
    +Y=Ensemble member number (perturbation number)
    +Z=number of ensemble members
    +
    + + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Nov 2, 2011 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/fix_ncep.html b/docs/web_docs/fix_ncep.html new file mode 100644 index 0000000..e681b7e --- /dev/null +++ b/docs/web_docs/fix_ncep.html @@ -0,0 +1,198 @@ + + + + Climate Prediction Center - wgrib2: -fix_ncep + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-fix_ncep +
     
    + +

    wgrib2: -fix_ncep

    +
    + + +

    Introduction

    + +

    +-fix_ncep is a "set" option that replaces +certain NCEP-defined time ranges by the WMO equivalents. The current (7/2008) +wgrib2 needs this option in order to correctly print out the +time ranges for NCEP-defined time ranges. + +

    The -fix_ncep option changes +the memory image of the grib message. Therefore, if you +want the NCEP time range, you must have the +-grib or -grib_out option +before the -fix_ncep option. Otherwise +you will get the WMO time range. + +

    +Caution: expect this option to change as more NCEP time ranges +are added + +

    Usage

    +

    + +

    +-fix_ncep
    +
    + +

    Example

    +

    + +

    +wgrib2 -fix_ncep in_grib -grib out_grib
    +
    +The above line replaces NCEP time ranges by the WMO equivalents +and writes out the new grib data into out_grib. + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/flush.html b/docs/web_docs/flush.html new file mode 100644 index 0000000..fae3c44 --- /dev/null +++ b/docs/web_docs/flush.html @@ -0,0 +1,192 @@ + + + + Climate Prediction Center - wgrib2: -flush -no_flush + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-flush +
     
    + +

    wgrib2: -flush

    +
    + + +

    Introduction

    + +

    +When the flush mode is off, output is buffered. Than means the output +is saved to a memory buffer and is only flushed (written out) when +the buffer is full or the program ends. This mode speeds up the output. +However, this mode fails when writting to a pipe or file and another program +is reading from that pipe or file while wgrib2 is executing. + +

    +The -flush option causes wgrib2 to flush the +output buffers after every write. This option is now rarely used +because wgrib2 internally sets the flush option on when detects a +write to a pipe. The only current need for the +-flush option is when another program +is reading the disk file while wgrib2 is writting that file. + In this case, you would use this option to ensure that the +disk file is written as soon as possible. + + +

    +In systems that do not have a POSIX-compatible stat() function, the flush +mode is turned on. + +

    Usage

    +

    + +

    +-flush
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Oct 6, 2017, Aug 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/for.html b/docs/web_docs/for.html new file mode 100644 index 0000000..7d72e09 --- /dev/null +++ b/docs/web_docs/for.html @@ -0,0 +1,202 @@ + + + + Climate Prediction Center - wgrib2: -for + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-for +
     
    + +

    wgrib2: -for

    +
    + + +

    Introduction

    + +

    +The -for option selects the range of record numbers +upon which to operate using the "for" syntax. If you want to operate on +records 10 to 20, you would use the parameter 10:20. +If you want to operate on all the even records from 10 to 20, you would +use 10:20:2. The restrictions are the start value must be less than +the ending value and the step has to be greater than zero. +

    +

    +The -for option ignores the submessage number when +selecting the fields. +

    + + +

    Usage

    +

    + +

    +-for I:J:K        same as for n = I to J by K
    +-for I:J          same as for n = I to J by 1
    +-for I::K         same as for n = I to MAX_INTEGER by K
    +-for I            same as for n = I to MAX_INTEGER by 1
    +
    + + + +

    Example

    +

    + +

    + $ wgrib2 file.grb2  -for 4:5
    +4:13335:d=2008120200:RH:750 mb:anl:
    +5:17098:d=2008120200:TMP:2743 m above mean sea level:anl:
    +
    + +See also: +-if_rec +-match +-for_n +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/for_n.html b/docs/web_docs/for_n.html new file mode 100644 index 0000000..af8d968 --- /dev/null +++ b/docs/web_docs/for_n.html @@ -0,0 +1,337 @@ + + + + Climate Prediction Center - wgrib2: -for_n + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-for_n, wgrib2-n +
     
    + + +

    wgrib2: -for_n

    +
    +

    +A grib file has set of grids and you can reference the field by its grib message number and submessage number. +You can also reference the field by its inventory number which starts at 1. +The -for_n option allows you to process a subset of the +grib file using a for-loop syntax on the inventory number. Suppose you want to process +grids 10 through 20 by 2, you can add the option -for_n 10:20:2. + +

    Usage

    +

    + +

    +-for_n I:J:K        same as for n = I to J by K
    +-for_n I:J          same as for n = I to J by 1
    +-for_n I::K         same as for n = I to MAX_INTEGER by K
    +-for_n I            same as for n = I to MAX_INTEGER by 1
    +
    + + + + + +

    wgrib2: multi-processing with -for_n and -n

    +
    + + +

    Introduction

    + +

    There are two ways to parallize wgrib2, one way is +the thread the loops and another is to run multiple copies +of wgrib2. Threading the loops is great but there is +so much serial code that the speed up is limited. The +biggest speed up can come from running multiple copies +of wgrib2. a Rather than pull out the MPI textbook, +we'll show some script-level multiprocessing. + +

    Assumptions

    + +
      +
    • CPU time is longer than the I/O time +
    • each record can be handled independantly +
    • multiple cpus are available on the same machine/node +
    • a two cpu version is sufficient documentation +
    + +

    The inventory number, -n

    + +

    Our first step is to understand the inventory number. +You can see the inventory number by the -n option. +Once we have add the inventory number, we can have one copy of wgrib2 +process the even numbered and another process the odd numbered records. + +

    Note that the inventory number is not the same as the +record number for many reason such as the order of processing +may be read from standard input by -i, +some messages may have submessages and some records could +be skipped by the -match and other options. + +

    Even and Odd, -for_n

    +

    +The -for_n option is like the +-for option except that it uses the inventory +number rather than the record number. + +

    +To select the odd records to process, you use the +option -for_n 1:99999:2. Here, 99999 is just +a large number greater than the number of records. +You could also use -for_n 1::2. +To process the even fields, use -for_n 2::2. + + +

    Pipes, fifo (Unix/Linux)

    +

    +Now that we can run wgrib2 on the even and odd records, how +do we make the output. Here is a simple way in Unix/Linux. +

    + + +
    +# bad example: slow, output in different order
    +# input=grib file, output=grib file, makes regional subset using two copies of wgrib2
    +f=input
    +wgrib2 $f -ijsmall_grib 1:10 1:10 /tmp/p1 -for_n 1:99999:2 >/dev/null
    +wgrib2 $f -ijsmall_grib 1:10 1:10 /tmp/p2 -for_n 2:99999:2 >/dev/null
    +cat /tmp/p1 /tmp/p2 >output
    +rm /tmp/p1 /tmp/p2
    +
    + +

    +The above method is not optimal as it uses temporary files, +rearranges the order of the records and is limited to 99999 records. A better method is to use +pipes and a simple program that reads the pipes and writes out +a merged output file. +

    + +
    +# input=grib file, output=grib file, makes regional subset using two copies of wgrib2
    +# uses named pipes for speedup, keeps order of records
    +f=input
    +mkfifo /tmp/p1.$$
    +mkfifo /tmp/p2.$$
    +wgrib2 $f -ijsmall_grib 1:10 1:10 /tmp/p1.$$ -for_n 1::2 >/dev/null &
    +wgrib2 $f -ijsmall_grib 1:10 1:10 /tmp/p2.$$ -for_n 2::2 >/dev/null &
    +gmerge output /tmp/p1.$$ /tmp/p2.$$
    +rm /tmp/p1.$$ /tmp/p2.$$
    +
    + +

    +The program, gmerge, simply reads a grib message from p1.$$ and +writes the output to "output". +Then it reads a grib message from p2.$$ and writes +it to "output". This is repeated until there is no data left (pipes are closed). +gmerge is part of the wgrib2 distribtution. +

    + +

    +The program amerge is like gmerge except it reads one line from p1 +and writes it to the output. Then it reads one line from p2 and +writes it to output. This is repeated until there is no data left +(pipes are closed). The amerge program can be used to run +inventories on mutiple cpus. +

    + +
    +# input=grib file, run 2 copies of wgrib2 and writes inventory on stdout
    +f=input
    +mkfifo /tmp/p1.$$
    +mkfifo /tmp/p2.$$
    +wgrib2 -for_n 1::2 $file -s -lon 0 0 >/tmp/p1.$$ &
    +wgrib2 -for_n 2::2 $file -s -lon 0 0 >/tmp/p2.$$ &
    +amerge /tmp/p1.$$ /tmp/p2.$$
    +rm /tmp/p1.$$ /tmp/p2.$$
    +
    + +

    More than 2 CPUs

    +

    +The previous examples split the work into two processes. This +works well for a dual core system. On systems with 4 cores, +you may want to split the work into 4 jobs. The current versions +of gmerge and amerge allow input for upto 32 different inputs. +

    + +
    +# same as 2nd example but with 3 cpus
    +f=input
    +mkfifo /tmp/p1.$$ /tmp/p2.$$ /tmp/p3.$$
    +wgrib2 $f -ijsmall_grib 1:10 1:10 /tmp/p1.$$ -for_n 1::3 >/dev/null &
    +wgrib2 $f -ijsmall_grib 1:10 1:10 /tmp/p2.$$ -for_n 2::3 >/dev/null &
    +wgrib2 $f -ijsmall_grib 1:10 1:10 /tmp/p3.$$ -for_n 3::3 >/dev/null &
    +gmerge output /tmp/p1.$$ /tmp/p2.$$ /tmp/p3.$$
    +rm /tmp/p1.$$ /tmp/p2.$$ /tmp/p3.$$
    +
    + + +

    Source code for gmerge and amerge

    + +gmerge: merge grib files (1 grib message at a time)
    +amerge: merge ascii files (1 line at a time)
    + + +

    Usage

    +
    +-n                  prints the inventory number
    +-for_n I:J:K        same as for n = I to J by K
    +-for_n I:J          same as for n = I to J by 1
    +-for_n I::K         same as for n = I to MAX_INTEGER by K
    +-for_n I            same as for n = I to MAX_INTEGER by 1
    +
    + + + +See also: +-if_n, +-for, +-flush, +-n, +using pipes, +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 31, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ftime.html b/docs/web_docs/ftime.html new file mode 100644 index 0000000..e5930ef --- /dev/null +++ b/docs/web_docs/ftime.html @@ -0,0 +1,275 @@ + + + Climate Prediction Center - wgrib2: -ftime + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ftime +
     
    + +

    wgrib2: -ftime

    +
    + + +

    Introduction

    + +

    +The -ftime option prints the forecast time stamp +such as the forecast hour, accumulation period, etc. This option is used +by many other inventory options. +The -set_ftime option does the inverse of the +-ftime option. +The -set_ftime option takes the forecast time stamp +in text format, and alters the grib metadata. + +

    Types of time stamps

    +The simplest forecast time stamps are for an analysis and a forecast at a point in time. +Note that wgrib2 considers a "0 hour forecast" to be an "analysis". In theory, code table +4.3 could be used to determine whether the field is a "0 hour forecast" or "analysis". +In practice, models like the GFS will use an analysis for the initial conditions, and +the "0 hour forecast" will be the same as the analysis. So code table 4.3 is ignored. + + +
      Single analysis or single forecast +
    • anl analysis +
    • 12 hr fcst 12 hour forecast +
    + + +The next simplest time stamp involves an statistical operator and single time period +from a forecast. Processing is done continously or at a high frequency. + +
      Single forecast, examples of common statiistical operators (Code Table 4.10) +
    • 174-180 hour acc fcst: accumulated forecast between 174-180 hours +
    • 174-180 hour ave fcst: average forecast between 174-180 hours +
    • 174-180 hour max fcst: maximum forecast between 174-180 hours +
    • 174-180 hour min fcst: minmum forecast between 174-180 hours +
    • 174-180 hour OPR fcst: operator of forecast between 174-180 hours, OPR from Code Table 4.10 +
    + +Grib allows for processed sets of data. For example, you have +have analyses from May 1, .., May 31. You can create a grib message which is +the May mean. You can then combine the May means from 1991..2020, and +produce a 1991-2020 climatology. Another example is the take the forecasts +from a single forecast run. You can take days 7..14, and create the 2nd week forecast. +

    + +

      Multiple analyses(forecasts), constant time between analyses (forecast start times) +
    • 240@3 hour ave(anl),missing=0 average of 240 analyses with 3 hour interval between analyses, no missing analyses +
    • 248@3 hour ave(6 hour fcst),missing=0 average of 240 6-hour fcsts with 3 hour interval of forecast start times +
    • 248@3 hour ave(0-3 hour ave fcst),missing=0, average of 240 "0-3 hour ave forecasts", with 3 hour interval + between forecast start times +
    + + +The next type of forecast time stamp is used for processing forecast from a single forecast run. +The "(xxx)++" notation means that xxx is incremented to the next forecast time. + + +
      Multiple forecasts from a single forecast run +
    • 9@1 hour max(0-1 hour max fcst)++,missing=0: max(0-1 hour max fcst, 1-2 hour max fcst, .., 8-9 hour max fcst)
      + Note: this can be encoded as "0-9 hour max fcst" +
    + +LAF (Lagged Average Forecasts) which are forecasts with different forecast start times and +the same verification time. This is the easiest to produce ensemble forecast. + + +
      Lagged Average Forecasts, old to new forecasts +
    • LAF[..]++ reference time++, fcst_time-- (verification time does not change) +
    + + +
      Lagged Average Forecasts, new to old forecasts +
    • LAF[..]-- reference time--, fcst_time++ (verification time does not change) +
    + +Grib allows fields that are produced by multiple statistical operators. +This is how you can generate climatologies. + +
      Climatology +
    • 30@1 year ave(124@6 hour ave(anl)),missing=0: reference time is 1981050100
      + "124@6 hour ave(anl)" is the average of (00Z May 1, 06Z May2, .., 18Z May 31), month average
      + "30@1 year ave(X)" is the 30 year average of the X
      + So a 1981-2010 May climatology has been precisely defined +
    • 30@1 year ave(31@24 hour ave(anl)),missing=0: reference time is 1981050100
      + This is the 1981-2020 climatology of the May 00Z analyses +
    + + +

    It was noted that the old ftime had problems with the more complicated time stamps and +ftime2 was developed as the replacement. Currently (5/2021), you can use the +old ftime by -ftime1 and the new ftime by -ftime2 . +The default -ftime will use -ftime2. +The -config option will tell which version is the default. + +

    Usage

    +

    + +

    +-ftime
    +
    +Note: -ftime is called by many other options like -s and -S.
    +
    + +

    Example

    +

    + +

    +$ wgrib2 grib2.polar -ftime
    +1.1:0:24 hour fcst
    +1.2:0:24 hour fcst
    +
    + + +See also: +-set_ftime +-vt + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005, updated 4/2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ftime1.html b/docs/web_docs/ftime1.html new file mode 100644 index 0000000..72c3f47 --- /dev/null +++ b/docs/web_docs/ftime1.html @@ -0,0 +1,190 @@ + + + + Climate Prediction Center - wgrib2: -ftime1 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ftime2 +
     
    + +

    wgrib2: -ftime1

    +
    + + +

    Introduction

    + +

    +The -ftime1 option calls the old ftime1 routine. +The ftime1 routines have been replace by the ftime2 routine because they +could not handle more complicated time stamps correctly. One should +not use -ftime1. The ftime2 routines will work with +more complicated time stamps and are more powerful. + +

    Usage

    +

    + +

    +-ftime1
    +
    + +

    Example

    +

    + +

    +$ wgrib2 grib2.polar -ftime1
    +1.1:0:24 hour fcst
    +1.2:0:24 hour fcst
    +
    + + +See also: +-ftime + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 12, 2017, modified 6/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ftime2.html b/docs/web_docs/ftime2.html new file mode 100644 index 0000000..7f0010b --- /dev/null +++ b/docs/web_docs/ftime2.html @@ -0,0 +1,198 @@ + + + + Climate Prediction Center - wgrib2: -ftime2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ftime2 +
     
    + +

    wgrib2: -ftime2

    +
    + + +

    Introduction

    + +

    +The -ftime option calls either + -ftime1 or -ftime2 options. +The -ftime2 option is newer and will become the +default in newer versions of wgrib2. The -ftime2 option +fixes some problems in describing climatologies of monthly means (averages of averages) +or any nested statistical processing operators. The +-ftime2 option is fully recursize while the older +-ftime1 attempted and failed to bypass the recursion. +

    Along with the change to -ftime2, the +The -set_ftime, -set_ave options are being replaced +by -set_ftime2. + + +

    Usage

    +

    + +

    +-ftime2
    +
    + +

    Example

    +

    + +

    +$ wgrib2 grib2.polar -ftime2
    +1.1:0:24 hour fcst
    +1.2:0:24 hour fcst
    +
    + + +See also: +-set_ftime +-vt + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 12, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ftn_api_fn0.html b/docs/web_docs/ftn_api_fn0.html new file mode 100644 index 0000000..bc656d9 --- /dev/null +++ b/docs/web_docs/ftn_api_fn0.html @@ -0,0 +1,175 @@ + + + + Climate Prediction Center - wgrib2: -ftn_api_fn0 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -ftn_api_fn0 +
     
    + +

    wgrib2: -ftn_api_fn0

    +
    + + +

    Introduction:

    + +

    +The option, -ftn_api_fn0, is used by the ftn_api for +reading grib. Since the ftn_api and wgrib2 are part of the same package, there +is no need for compatibility between versions of wgrib2. Use of this +option is not recommended. The current output is by this C statement. + +

    +sprintf(inv_out, "%8d %8u %8u %8u %8d %8d",inv_no,npnts,nx_,ny_,msg_no, submsg)
    +
    + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 29, 2016. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/full_name.html b/docs/web_docs/full_name.html new file mode 100644 index 0000000..ec72a35 --- /dev/null +++ b/docs/web_docs/full_name.html @@ -0,0 +1,177 @@ + + + + Climate Prediction Center - wgrib2: -full_name + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-var +
     
    + +

    wgrib2: full_name is idepreciated for wgrib2 3.0.2+

    +
    + + +

    Introduction

    + +

    With the expansion of "Extended Names", the full name is now +a subset of the new Extended Names. + + +

    +
    +old:    -full_name
    +new:    -set_ext_name 3 -ext_name
    +
    +
    + + +See also: -ext_name, + -set_ext_name +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Feb , 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/function.html b/docs/web_docs/function.html new file mode 100644 index 0000000..f81ccb3 --- /dev/null +++ b/docs/web_docs/function.html @@ -0,0 +1,230 @@ + + + + Climate Prediction Center - wgrib2: functions + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > +wgrib2 +
     
    + +

    wgrib2: a sample function

    + + + +

    Introduction

    + +Wgrib2 is "function" driven. Options on the command line corresponds to a function call. +When wgrib2 is started, each option-function is initialized by calling it with mode=-1. +For each grib record processed, the option-function is called with mode=verbosity index (verbosity ≥ 0). +After all grib records have been processed, the option-functions are told to clean up by calling +them with mode=-2. +Here is a sample function. + +
    +
    +
    +
    +#include <stdio.h>
    +#include "grb2.h"
    +#include "wgrib2.h"
    +#include "fnlist.h"
    +
    +extern int decode;
    +extern int need_output_file;
    +
    +/*
    + * HEADER:100:min:inv:0:print minimum value
    + * the above line is needed by each command line option
    + * HEADER:sort-order:type-of-function:number-of-arguments:description
    + */
    +
    +int f_min(int mode, unsigned char **sec, float *data, int ndata, char *inv_out, void **local) {
    +   + double mn;
    +   + int ok, i;
    +
    +   + if (mode == -1) decode = 1; // decode=1 so wgrib2 will unpack grib data
    +   + else {
    +     + mn = ok = 0;
    +     + for (i = 0; i < ndata; i++) {
    +       + if (!UNDEFINED_VAL(data[i])) {
    +         + if (ok) mn = mn < data[i] ? mn : data[i];
    +         + else { ok = 1; mn = data[i]; }
    +       + }
    +     + }
    +     + if (ok) sprintf(inv_out, "min=%lg",mn);
    +     + else sprintf(inv_out, "min=undefined");
    +   + }
    +   + return 0;
    +}
    +
    +
    +The arguments to f_min() are the standard for options that do not require an argument
    +  mode = -1: initialization  -2: cleanup  O+: processing verbosity index
    +  sec = sections of the grib (sub) message
    +  *data = decoded grid point values
    +  ndata = number of grid points
    +  *inv_out = string that written to the inventory
    +  **local = unique pointer, used for "static" variables.
    +
    + + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 27, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/g2clib.html b/docs/web_docs/g2clib.html new file mode 100644 index 0000000..5b7f86c --- /dev/null +++ b/docs/web_docs/g2clib.html @@ -0,0 +1,269 @@ + + + + Climate Prediction Center - wgrib2: -g2clib + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-g2clib +
     
    + +

    wgrib2: -g2clib

    +
    + + +

    Introduction

    + +

    Originally wgrib2 used the g2clib library for unpacking the grid point data (GDS). +The first break from a complete dependence on the g2clib was adding support +for ieee-type grib files. Then the optimized grib1-style unpacking from wgrib +was added to the internal routines. Then jpeg, png and complex packing were added +to the internal decoder. Finally more packing schemes that were not in g2lib/g2clib +were added (run-length and log scaling). +

    + +

    +As of wgrib2 v1.9.8, a third option was added, use the internal decoder in g2clib +emulation mode. The options were also relabeled. The new default is to use +the internal decoder in g2clib emulation mode (-g2clib 1). +To use use the internal decoder you still use -g2clib 0. +To get the g2clib decoder, use -g2clib 2 which is now +a compile-time option. The changes were made because +

    + +
      +
    1. internal routines are faster for complex packing (1 cpu) +
    2. some internal routines were parallelized for decoding (complex and simple packing) +
    3. some distributions were linking the official g2clib rather than the patched + version included with the wgrib2 sources. This caused seg faults. +
    + + +

    Wgrib2 has always used its own routines for encoding grib files. The +encoding follows the WMO standard but are compatible with the NCEP libraries +(g2clib and g2lib). + +

    Differences as of October 2008

    + +

    The NCEP encoding/decoding routines have a problem +with constant fields. The routines ignore the decimal scaling +and assume it is zero (decimal scaling = multiplication by one). +The packing and unpacking routines are are consistent +with themselves so the problem wasn't noticed for many years. +As of 6/2014 this situation hasn't changed. This same bug +has been found in routine in other software packages. Some +are consistently ignore the decimal scaling for all packing modes, +whereas others only have the bug for certain packing modes. +By the use of "-g2clib 0" and "-g2clib 1", you can handle +grib files without/with this bug. + +

    +

    +The wgrib2 internal decode routines do not have a decimal scaling +problem and follow the WMO standard. The wgrib2 encode routines +will automatically use a decimal scaling = 0 for constant fields +and consequently be compatible with the WMO standard and will +decode correcty with g2clib/g2lib. +

    + +

    +The g2clib emulation (default, -g2clib 1) are recommend when +

      +
    1. The files were created by using g2clib/g2lib libraries (NCEP) and have the bug
      + The files must must have the center set to NCEP +
    2. files that were encoded using wgrib2 (more than simple subsetting) +
    3. WMO-compliant files from centers other than NCEP +
    + +Turning off the g2clib emulation (-g2clib 0) is recommend when + +
      +
    1. grib files that follow WMO standard for constant fields +
    + +Finally one potentially compile wgrib2 to include g2clib. +This is useful for testing and +for cases where g2clib supports a packing that is not supported by the +internal decoder. The disadvantages of the g2clib routines are + +
      +
    1. Single precision routines +
    2. The routines are slower for large grids and they are not threaded +
    3. The g2clib routines "fail" when they finds an undefined template. +
    4. Decoding problems with certain fields (6/2016). +
    5. Problems with seg faults when linked with the official g2clib (Fedora/Redhat rpms) +
    + +

    -g2clib

    + +

    +The -g2clib option allows you to select the internal/g2clib +decoder. If X is 0, then internal routines are selected. +If X is 1, then the internal decoder with g2clib emulation is selected (g2clib is used with older wgrib2 versions). +When X is 2, then the g2clib decoder is used if the g2clib decoder were compiled into the executable. +Note that g2clib doesn't support ieee, RLE, AEC and irregular structured grids. + +

    Usage

    +

    + +

    +-g2clib N   N = 0, 1 or 2
    +            0 = WMO standard (for all files)
    +            1 = default
    +	        emulate NCEP g2/g2c bug for decoding constant values fields for
    +	        files from NCEP (center=NCEP (7))
    +		Files not from NCEP are unaffected
    +            2 = use g2clib, only available if compiled with g2clib
    +                This option should only be used for testing.
    +                Some distributions will seg fault using this option.
    +		Files from non-NCEP sources may have the wrong constant values
    +
    + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Aug 19, 2016, July 2024 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/gctpc.html b/docs/web_docs/gctpc.html new file mode 100644 index 0000000..a54fe94 --- /dev/null +++ b/docs/web_docs/gctpc.html @@ -0,0 +1,310 @@ + + + + Climate Prediction Center - wgrib2: -gctpc, -proj4 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -gctpc,-proj4 +
     
    + +

    wgrib2: -gctpc, -proj4

    +
    + + +

    Introduction

    + +

    +Wgrib2 has 3 sets of geolocation routines. Geolocation routines +are used to find the locations of the grid points by a (i,j) -> (lon,lat) +transformation. Some geolocation routines can calculate (i,j) from (lon,lat). +There is no "best" set of routines, so up to 3 sets can be used. + +

    +Internal Routines +

      +
    1. Spherical Earth only +
    2. Very fast and multithreaded, 3.5/12.7 sec on test case 1* +
    3. Very fast and multithreaded, 3.5/12.7 sec on test case 2* +
    4. Needed for NWP grids such as Gaussian grids and rotated lat-lon +
    5. Common projections +
    6. C, no configure file needed +
    7. Can transform (i,j) to (lon,lat) +
    8. Many of the codes trace their origins to operational codes at NCEP +
    + + +

    +GCTPC library +

      +
    1. Handles ellipsoidal Earth +
    2. Slow and multithreaded (OpenMP), 5.5/19.5 sec on test case 1* +
    3. Slow and multithreaded (OpenMP), 15.7/58.7 sec on test case 2* +
    4. More projections than internal routines +
    5. C, no configure file needed +
    6. Can transform (i,j) to (lon,lat) +
    7. Can transform (X,Y) to (lon,lat) +
    8. Can transform (lon,lat) to (X, Y) +
    9. Library is old but working, no recent development +
    10. Support for library is unknown +
    +

    +Proj4 library +

      +
    1. Handles ellipsoidal Earth +
    2. Slow and no support for OpenMP, 17.8/19.7 sec on test case 1* +
    3. Slow and no support for OpenMP, 62.8/64.7 sec on test case 2* +
    4. Proj4 supports pthreads, wgrib2 uses OpenMP +
    5. More projections than GCTPC, ex. ellipsoidal Lambert Azimuthal Equal Area grid +
    6. C, requires config script +
    7. Can transform (i,j) to (lon,lat) +
    8. Can transform (X,Y) to (lon,lat) +
    9. Can transform (lon,lat) to (X, Y) +
    10. Library has active development +
    11. Support for library is good +
    12. The first choice by many people. +
    + +
    +* test case 1 - read large Lambert conformal grid (6887 x 6610) and 
    +calculate lon/lat for the entire grid and print lon/lat for 1 grid point.
    +This uses a spherical Earth.
    +
    +* test case 2 - read large Lambert conformal grid (6887 x 6610) and 
    +calculate lon/lat for the entire grid and print lon/lat for 1 grid point.
    +This uses a ellipsoidal Earth.
    +
    +The timing code is
    +
    +  time wgrib2 burned_area_20120131_12_23_1km.grib2.c0 -ijlat 4 3
    +  time wgrib2 burned_area_20120131_12_23_1km.grib2.c0 -ijlat 4 3 -gptpc 1
    +  time wgrib2 burned_area_20120131_12_23_1km.grib2.c0 -ijlat 4 3 -proj4 1
    +
    +and the two numbers correspond to the wall clock and CPU times for a 4
    +core Intel Xeon E5506 with OMP_NUM_TREADS=4.
    +
    +grid:
    +  Lambert Conformal: (6887 x 6610) input WE:NS output WE:SN res 0
    +  Lat1 64.997800 Lon1 180.492400 LoV 264.000000
    +  LatD 40.000000 Latin1 20.000000 Latin2 60.000000
    +  LatSP 0.000000 LonSP 0.000000
    +  North Pole (6887 x 6610) Dx 1000.000000 m Dy 1000.000000 m mode 0
    +
    +Earth:
    +  case 1: code3.2=0 sphere predefined radius=6367470.0 m
    +  case 2: code3.2=4 IAG-GRS80 ave radius=6367444.5 m
    +
    +Packing: grid point data - complex packing,c1 
    +
    + +

    +The internal routines are fast, multithreaded but only handle +a spherical earth and cannot transform from (lon,lat) -> (X,Y). +The internal routines include grids not included with GCTPC. + +

    +The GCTPC routines can handle an ellipsoidal Earth. They are +50% slower than the internal routines for a spherical earth and +are acceptable for NOMADs. For an ellipsoidal Earth, the speed is +probably adequate for NOMADS. The lack of support is not a major factor +because the codes are tested and relatively simple. By supporting +both GCTPC and Proj4, I am comfortable that the codes can be +adequately tested. + +

    +Proj4 is the Gold standard; it used by many projects, it has +good support and updates appear on a regular basis. Proj4 supports +more projections than GCTPC. Unfortunately Proj4 is slow. For a +spherical Earth, Proj4 is probably adequate (slower than gctpc +for a spherical earth). For an ellipsoidal Earth, Proj4 is +too slow for Nomads. There have been some efforts to make Proj4 +thread safe. Another difficulty with Proj4 is that compiling +uses a config script. Config scripts can cause problems +when cross-compiling for compute nodes (some HPC computers). +

    + +

    +Wgrib2 needs the internal routines for grids not supported by +GCTPC/Proj4. Wgrib2 needs GCTPC/Proj4 for handling ellipsoidal +Earths. The current policy is that Proj4 will be an optional +package and GCTPC will be come the default package in the +near future. Support for Proj4 is useful for debugging and +for "keeping the options open". +

    + + +

    Usage

    + +

    +

    +-gctpc 0
    +   do not use gctpc for geolocation
    +-gctpc 1
    +   enable gctpc for geolocation
    +-proj4 0
    +   do not use Proj4 for geolocation
    +-proj4 1
    +   enable Proj4 for geolocation
    +
    +   Priority:
    +     Try Proj4 if Proj4 is enabled (not default) and installed (not default)
    +     Try gctpc if gctpc is enabled (default)
    +     try internal routines  
    +
    +     note: older version of the priority was wrong.
    +
    +   Note: some grids are only  supported by the internal routines
    +
    + + + +See also: +-geolocation + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 30, 2014, April 13, 2020, 10/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/gdt.html b/docs/web_docs/gdt.html new file mode 100644 index 0000000..3013b7a --- /dev/null +++ b/docs/web_docs/gdt.html @@ -0,0 +1,192 @@ + + + + Climate Prediction Center - wgrib2: -gdt + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-gdt +
     
    + +

    wgrib2: -gdt

    +
    + + +

    Introduction

    + +

    +Section 3 contains the grid definition template (GDT) +and the -gdt option prints the +parameters used to define the grid as +used by g2clib/g2lib (NCEP libraries). This option is +only useful finding the grid parameters for later use +by g2clib/g2lib. +

    +

    +The -gdt option will only +work if g2clib is installed at compile time. +

    + +

    Usage

    + +

    +

    +-gdt
    +
    + +

    Example

    +
    +$ wgrib2 -gdt png.grb2
    +1:4:GDT Number= 0 GDT= 6 0 0 0 0 0 0 360 181 0 0 90000000 0 48 -90000000 359000000 1000000 1000000 0
    +
    + + +See also: + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 30, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/geolocation.html b/docs/web_docs/geolocation.html new file mode 100644 index 0000000..aacfffd --- /dev/null +++ b/docs/web_docs/geolocation.html @@ -0,0 +1,245 @@ + + + + Climate Prediction Center - wgrib2: -geolocation + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-geolocation +
     
    + +

    wgrib2: -geolocation

    +
    + + +

    Introduction

    + +

    +Geolocation routines are used to calculate the longitudes and latitudes +of the grid points. Wgrib2 can use Proj4, gctpc and its own internal +routines to do the geolocation. Each set of routines has advanages and +disadvantages. The routines are listed in the default order. + +

    Proj

    + +

    +The Proj library was called PROJ4 from 1994-2017. In 2018, PROJ v5 was released +and the software was renamed PROJ. Wgrib2 is still using a v4 library and +all references in the code are to PROJ4. + +

    +PROJ is the gold standard of geolocation libraries. It is commonly used +and well supported. The drawbacks are it doesn't support OpenMP and +model grids. As of wgrib2 v3.1.2, PROJ4 is installed by default in order +to suppore aspherical equal area Lambert grids. + +

    Gctpc

    + +

    +Gctpc is an older library was which has lost support of its original authors (USGS). +The advantage is that it does support OpenMP unlike Proj4. It supports fewer grids +than Proj4 but that isn't a major problem because the grib2 standard only has +support for a few grids. Gctpc supports an ellipsoidal earth and +is always compiled with wgrib2. + + +

    Internal

    + +

    The internal routines are used to support model grids (Gaussian grid, rotated lat-lon grid), +spherical earth grids, and observational grids such as the space-view grid (used by EUMETSAT) +and radar grids (angle, distance from the origin). + +

    + +

    External, wgrib2 v3.1.2+

    +

    +Wgrib2 can set or overwrite the locations of the grid points using -rpn +(sto_lat, sto_lon), reading from a grib file using -grid_def, and reading from +a double precision binary file using -import_lonlat. These methods will +set the geolocation flag to external. +

    + +

    +For wgrib2 prior to v3.1.2, the geolocation flag showed which geolocation library +generated the locations of the grid points. External methods were not considered. +

    + + +

    Usage

    + +

    +

    +-geolocation
    +    print out geolocation routines used: proj4, gctpc, internal, external, or not_used
    +      external means the lat/lon may be read or computed by an external calculation.
    +      If wgrib3 does not need the geolocation information, the geolocation routines
    +         will not be called. 
    +
    + +

    Example

    +
    +$ wgrib2 burned_area_20120131_12_23_1km.grib2 -geolocation -lon -90 30 
    +1:0:geolocation=gctpc:lon=270.004694,lat=29.997210,val=0
    +
    +	The gctpc routines were used for geolocation.
    +
    +$ wgrib2 burned_area_20120131_12_23_1km.grib2 -geolocation
    +1:0:geolocation=not_used
    +
    +	The geolocation use not used.
    +
    + + +See also: +-gctpc +-grid_def +-import_lonlat +-proj4 +-rpn +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page dates: created 4/13/2020, modified 10/2022, 1/2023 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/get_byte.html b/docs/web_docs/get_byte.html new file mode 100644 index 0000000..7730d40 --- /dev/null +++ b/docs/web_docs/get_byte.html @@ -0,0 +1,195 @@ + + + + Climate Prediction Center - wgrib2: -get_byte + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-get_byte +
     
    + +

    wgrib2: -get_byte

    +
    + + +

    Introduction

    + +

    +The -get_byte option prints the values of +selected bytes in the grib message. For example if you want to +see the 20 and 21 octet (byte in WMO speak) of section 4, you would +use -get_byte 4 20 2. The first argument +is the section number. The second is the byte (octet) number starting +from 1 (consistent with WMO documentation) and the third is the number +of octets to display. + +

    Usage

    +

    + +

    +-get_byte SECTION OCTET NUMBER
    +SECTION = section of the grib message to print
    +OCTET = starting octet to start printing, OCTET ≥ 1
    +NUMBER = number of bytes to print
    +
    + +

    Example

    +
    +$ wgrib2 f.grb2 -get_byte 0 1 16
    +1:0:0-1=71,82,73,66,0,0,0,2,0,0,0,0,0,0,18,178
    +
    + + +See also: +new grib, +-set_byte, +-get_ieee, +-get_int, +-get_hex +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/get_hex.html b/docs/web_docs/get_hex.html new file mode 100644 index 0000000..d82dcd5 --- /dev/null +++ b/docs/web_docs/get_hex.html @@ -0,0 +1,205 @@ + + + + Climate Prediction Center - wgrib2: -get_hex + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-get_hex +
     
    + +

    wgrib2: -get_hex

    +
    + + +

    Introduction

    + +

    +The -get_hex option is identical to the +-get_byte option excepts it prints the +bytes in hexidecimal format. +see the 20 and 21 octet (byte in WMO speak) of section 4, you would +use -get_byte 4 20 2. The first argument +is the section number. The second is the byte (octet) number starting +from 1 (consistent with WMO documentation) and the third is the number +of octets to display. +

    +

    +The input arguments to the option are in decimal rather than in hexidecimal because +all the grib2 documentation uses decimal numbers to specify the byte locations. +

    + + + + +

    Usage

    +

    + +

    +-get_hex SECTION OCTET NUMBER
    +SECTION = section to print
    +OCTET = starting octet to print
    +NUMBER = number of octets/bytes to print
    +
    + +

    Example

    +
    +$ wgrib2 f.grb2 -get_hex 0 1 12
    +1:0:0-1=71,52,49,42,00,00,00,02,00,00,00,00
    +2:46042:0-1=71,52,49,42,00,00,00,02,00,00,00,00
    +3:63079:0-1=71,52,49,42,00,00,00,02,00,00,00,00
    +
    + + +See also: +new grib, +-set_byte +-get_ieee +-get_int +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/get_ieee.html b/docs/web_docs/get_ieee.html new file mode 100644 index 0000000..c740a90 --- /dev/null +++ b/docs/web_docs/get_ieee.html @@ -0,0 +1,195 @@ + + + + Climate Prediction Center - wgrib2: -get_ieee + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-get_ieee +
     
    + +

    wgrib2: -get_ieee

    +
    + + +

    Introduction

    + +

    +The -get_ieee option prints +the selected parts of the grib message as an IEEE floating +point number. +

    + +

    Usage

    + +

    +

    +-get_ieee SECTION OCTET N
    +SECTION = section number of the grib message to print
    +OCTET = the octet number to print
    +N = number of IEEE float to print (4 octets per IEEE number)
    +
    + +

    Example

    +
    +$ wgrib2 rtgssthr_grb_0.083_awips.grib2
    +1:0:d=2009062900:TMP:surface:anl:
    +  : field is surface temperature, SST over water
    +$ wgrib2 rtgssthr_grb_0.083_awips.grib2 -packing -v
    +1:0:packing=grid point data - jpeg2000 compression,j val=(27133+i*2^0)*10^-2, i=0..8191 (#bits=13)
    +  : jpeg2000 packing, reference value is 27133
    +$ wgrib2 rtgssthr_grb_0.083_awips.grib2 -get_ieee 5 12 1
    +1:0:5-12=27133.000000
    +  : for jpeg2000 packing, the reference value is stored in Section 5, octet 12-15
    +
    +See also: +-get_byte +-get_byte +-get_int +
    + + + + + + + + + +

    +NOAA/ +National Weather Service
    +National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 30, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/get_int.html b/docs/web_docs/get_int.html new file mode 100644 index 0000000..76c3891 --- /dev/null +++ b/docs/web_docs/get_int.html @@ -0,0 +1,193 @@ + + + + Climate Prediction Center - wgrib2: -get_int + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-get_int +
     
    + +

    wgrib2: -get_int

    +
    + + +

    Introduction

    + +

    +The -get_int option prints the values of +selected four-byte integers in a grib message. For example if you want to +see the number of data points (section 3, octets 7-10), you could +use -get_int 3 7 1. The first argument +is the section number. The second is the octet number starting +from 1 (consistent with WMO grib documentation) and the third is the number +of integers to display. The -get_int option uses +the grib format for signed 4-octet integers. + + +

    Usage

    +

    + +

    +-set_int SECTION OCTET_NUMBER COUNT
    +
    + +

    Example

    +
    +$ wgrib2 f.grb -get_int 3 7 1  
    +1:0:3-7=65160
    +
    + + +See also: +new grib, +-get_byte +-get_int2 +-get_hex +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified Nov 19, 2015 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/get_int2.html b/docs/web_docs/get_int2.html new file mode 100644 index 0000000..4858f9d --- /dev/null +++ b/docs/web_docs/get_int2.html @@ -0,0 +1,194 @@ + + + + Climate Prediction Center - wgrib2: -get_int2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-get_int2 +
     
    + +

    wgrib2: -get_int2

    +
    + + +

    Introduction

    + +

    +The -get_int2 option prints the values of +selected two-byte integers in a grib message. For example if +you wanted to see octet N and N+1 is section M as a signed +two byte integer, you could +use -get_int2 M N 1. The first argument +is the section number. The second is the octet number starting +from 1 (consistent with WMO grib documentation) and the third is the number +of integers to display. The -get_int2 option uses +the grib format for signed 2-octet integers. + + +

    Usage

    +

    + +

    +-set_int2 SECTION OCTET_NUMBER COUNT
    +
    + +

    Example

    +
    +$ wgrib2 f.grb -get_int2 1 6 1  
    +1:0:1-6=7
    +
    + + +See also: +new grib, +-get_byte +-get_int +-get_hex +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grb2_free_file.html b/docs/web_docs/grb2_free_file.html new file mode 100644 index 0000000..16dd826 --- /dev/null +++ b/docs/web_docs/grb2_free_file.html @@ -0,0 +1,187 @@ + + + + Climate Prediction Center - wgrib2api: grb2_free_file + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api: grb2_free_file +
     
    + +

    wgrib2api: grb2_free_file(..)

    +
    + + +

    Introduction

    + +

    +When files are opened using wgrib2api, they are normally not closed until +the program ends. This +saves time in closing and then reopening files. For most programs using +wgrib2api, there is no need to close files opened using wgrib2api. +However, there are two cases. First, you use wgrib2api to write a file, and you +then want to use the file before the program that created the file ends. +Wgrib2api may buffer some of the writes in an output buffer until the program +ends or until the file is closed. For this case, you have to free the file. +Second, there are exceptional programs which open huge numbers of files. +Since we all write exceptional programs, some more frequently than others, + there is a function to close +usused files that are opened by wgrib2api. This function does not affect +the files opened by the normal fortran "open" routine. + +

    Usage

    +
    +    i = grb2_free_file(FILE)
    +    i =  0    ok
    +      /= 0   failure
    +
    +    FILE:      character (len=*) file to close
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 13, 2017, May 1, 2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grb2_inq.html b/docs/web_docs/grb2_inq.html new file mode 100644 index 0000000..b9a40f0 --- /dev/null +++ b/docs/web_docs/grb2_inq.html @@ -0,0 +1,250 @@ + + + + Climate Prediction Center - wgrib2api: grb2_mk_inq + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api: grb2_inq +
     
    + +

    wgrib2api: grb2_inq(..)

    +
    + + +

    Introduction

    + +

    +To read grib using wgrib2api, you first need to an +index or inventory file. +Then you call grb2_inq(..) with the appropriate search terms +and the data and metadata that you want. + +

    Usage

    +
    +    iret = grb2_inq(GRB2, INV, (list of search terms), (list of options))
    +    iret:  integer
    +           number of matchs to the search term
    +           -1 if some error
    +    GRB2: character (len=*) grib2 file
    +    INV:  character (len=*) index file
    +                            created by grb2_mk_inv(..)
    +                                    or wgrib2 GRB -Match_inv >INV
    +                            If you use an index file created by wgrib2 GRB > INV
    +                             then the search terms will be appropriate to that index file.
    +                             The *_date and *_edate optional arguments may not work.
    +    search term: character (len=*)
    +                 search term matches "wgrib2 GRB2 -Match_inv"
    +                 you are allowed 0 to 20 search terms
    +                 Normally the search is a straight text match.  You
    +                 can enable regex searches.
    +    IN Optional Arguments:
    +               debug: integer
    +                      0      - no debug statements
    +                      /= 0   - debug statements
    +
    +               end_date: integer (kind=8) YYYYMMDDHH search
    +               end_edate: integer (kind=8) YYYYMMDDHHmmss search
    +               ref_date: integer (kind=8) YYYYMMDDHH search
    +               ref_edate: integer (kind=8) YYYYMMDDHHmmss search
    +               start_date: integer (kind=8) YYYYMMDDHH search
    +               start_edate: integer (kind=8) YYYYMMDDHHmmss search
    +               verf_date: integer (kind=8) YYYYMMDDHH search
    +               verf_edate: integer (kind=8) YYYYMMDDHHmmss search
    +
    +               lastuse: integer
    +                        0    - nothing (default)
    +                        /= 0 - close GRB and INV files after use
    +               sequential: integer
    +                           0    - rewind INV before reading, stop after 1st match
    +                           /= 0 - do not rewind INV before reading, stop after 1st match
    +               regex: integer
    +                      0      - fixed string search (default)
    +                      /= 0   - regex search
    +               copy: character (len=*) filename
    +                     copies matches to file
    +               order: character (len=*) scan order of grid
    +                      'we:sn'   - grid will be in we:sn order (default)
    +                      'we:ns'   - grid will be in we:ns order
    +                      'raw'     - grid will be in raw order
    +                                  order as encoded in grib
    +                      note: lat, lon only work with we:sn order
    +    OUT Optional Arguments:
    +               grid: real allocatable (:,:)
    +                     grid point values
    +               lat:  real allocatable (:,:)
    +                     latitude values for the grid
    +               lon:  real allocatable (:,:)
    +                     longitude values for the grid
    +               nx:   integer, grid(nx,ny)
    +               ny:   integer, grid(nx,ny)
    +               npts: integer, number of grid points (nx*ny)
    +               nmatch: integer
    +                       number of matches                     
    +               msgno: integer
    +                      grib message of last match
    +               submsg: integer
    +                       submessage number of last match
    +
    +               The following options return a wgrib2 inventory option
    +               You are limited to 18.
    +
    +               desc: character, (len=*)
    +                          same as wgrib2 -S   (record number and byte location are not included)
    +               grid_desc: character, (len=*)
    +                          same as wgrib2 -grid
    +               get_ref_edate: integer (kind=8)
    +                          same as wgrib2 -T
    +               get_start_edate: integer (kind=8)
    +                          same as wgrib2 -start_FT
    +               get_end_edate: integer (kind=8)
    +                          same as wgrib2 -end_FT  or wgrib2 -VT
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Feb 21, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grb2_inq_scanning.html b/docs/web_docs/grb2_inq_scanning.html new file mode 100644 index 0000000..ee4dccc --- /dev/null +++ b/docs/web_docs/grb2_inq_scanning.html @@ -0,0 +1,264 @@ + + + + Climate Prediction Center - wgrib2api: grb2_mk_inq_scanning + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api: grb2_inq and scanning +
     
    + +

    wgrib2api: grb2_inq(..) and Scanning

    +
    + + +

    Introduction

    + +

    +In the page grb2_inq.html, grb2_inq(..) was used to +read individual fields. In some applications, sometimes you have to scan +to see which fields are available. To read the file in "scan" mode, you need +to read the file sequentially. The first call to grb2_inq(..) has +the option "sequential=0". By adding the optional parameter "sequential", only +one matching field is read. By setting sequential to zero, the first matching +field in the file is read. + +

    +    iret = grb2_inq(GRB2, INV, (list of search terms), (list of options),sequential=0)
    +      reads the first field that matches the search terms
    +    if iret = 0, matching field is not found
    +
    + +To read the remaining matching fields, you read the file sequentially by calls to grb2_inq(..) +using sequantial=N where N is non-zero. + +
    +    iret = grb2_inq(GRB2, INV, (list of search terms), (list of options),sequential=N)
    +      N is non-zero
    +      reads the next field that matches the search terms
    +    if iret = 0, matching field is not found
    +
    + +The sequential reads should not be mixed with non-sequential reads. It is probably +a mistake if the search terms varies in the sequential reads. + +

    Example

    +This example comes from Da Li (CMC). + +
    +use wgrib2api
    +character (len=100) :: in, out, inv
    +character (len=500) :: metadata
    +real, allocatable :: spfh(:,:), tmp(:,:), w(:,:)
    +integer :: nlevs, iret, i, j, k
    +real:: cp, grav, rgas
    +real,  allocatable :: levs(:)
    +character (len=30), allocatable :: slevs(:)
    +
    +!---- Constant for poisson's equation
    +grav = 9.80665         ! m/s**2; gravity
    +rgas = 287.058       ! J/kg/K; gas constant
    +
    +in='one.grb2'
    +inv='tt.inv'
    +out='omega.grb2'
    +
    +!  make inventory
    +iret = grb2_mk_inv(in,inv)
    +if (iret.ne.0) stop 1
    +
    +! get number of SPFH levels
    +nlevs = grb2_inq(in,inv,':SPFH:',' mb:')
    +write(*,*) 'nlevs=',nlevs
    +
    +allocate (levs(nlevs))
    +allocate (slevs(nlevs))
    +
    +! get the pressure levels, and pressure search string by sequential reads
    +
    +do i = 1,nlevs
    +   iret=grb2_inq(in,inv,':SPFH:',' mb:',sequential=i-1,desc=metadata)
    +   if (iret.ne.1) stop 2
    +   j = index(metadata,':SPFH:') + len(':SPFH:')
    +   k = index(metadata," mb:") + len(" mb:")-1
    +   read(metadata(j:),*) levs(i)
    +   slevs(i) = metadata(j-1:k)
    +   write(*,*) 'levs=',levs(i), slevs(i)
    +enddo
    +
    +! need to read the data with random access
    +! because grib messages can be in any order
    +
    +do i = 1,nlevs
    +   iret=grb2_inq(in,inv,':SPFH:',slevs(i),data2=spfh)
    +   if (iret.ne.1) stop 3
    +
    +   iret=grb2_inq(in,inv,':TMP:',slevs(i),data2=tmp)
    +   if (iret.ne.1) stop 4
    +
    +   iret=grb2_inq(in,inv,':DZDT:',slevs(i),data2=w)
    +   if (iret.ne.1) stop 5
    +
    +   w = -1.0 * w * levs(i) * 100.0 * grav / (rgas * tmp)
    +   iret=grb2_wrt(out,in,1,data2=w,meta=metadata,mb=levs(i),var='VVEL')
    +   if (iret.ne.0) stop 8
    +   write(*,*) 'omega:',w(1,1), ' level=',levs(i),' hPa'
    +
    +enddo
    +stop
    +end
    +
    + +This above example shows the basic method of scanning a file to find the +vertical levels, and processing the data in order to create new fields. +The above code is independent on the resolution of the grid and the number +of pressure levels. + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Feb 21, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grb2_mk_inv.html b/docs/web_docs/grb2_mk_inv.html new file mode 100644 index 0000000..d43a5cc --- /dev/null +++ b/docs/web_docs/grb2_mk_inv.html @@ -0,0 +1,228 @@ + + + + Climate Prediction Center - wgrib2api: grb2_mk_inv + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api: grb2_mk_inv +
     
    + +

    wgrib2api: grb2_mk_inv(..)

    +
    + + +

    Introduction

    + +

    +To read grib using wgrib2api, you need to have an index or inventory file. +The index file is used for searching and it is quick to create. The +format of the index file keeps expanding as needed. For example, +chemical tracers were added to the grib format, so naturally the index +file had to include the possibility of a chemical type. + +

    +The index file created by grb2_mk_inv('file.grb2', 'file.inv') is the same as created by + +

    +  wgrib2 file.grb2 -Match_inv > file.inv
    +
    + +

    The inv file can be created before the fortran program is run. +This may be more efficient if multiple programs need to create +the inv of the same file. + +

    Usage

    +
    +    iret = grb2_mk_inv(GRB2, INV, options)
    +    iret:  integer
    +           0 if index file created
    +           1 if index file not created
    +    GRB2: character (len=*) existing grib2 file
    +    INV:  character (len=*) index file that is created
    +          Note: special files are supported
    +           @tmp:string      temporary disk file
    +           @memN            memory file, N=0..8
    +                            registers 9..19 are reserved for wgrib2api
    +    options: optional parameters
    +          use_ncep_table=.true.            use ncep variable tables 
    +          use_ncep_table=.false.           use variable tables as determined by center encoded in the file (default)
    +
    + +

    +Some centers such as Canada and ESRL use NCEP grib2 variable tables for some of their files. +The optional argument 'use_ncep_table=.true.' can be use to read these files. (requires wgrib2api.f90 +from wgrib2 v3.0.0) + + +

    Advanced Usage: pre-existing wgrib2 inventories

    + +

    +Pre-existing index files (wgrib2 inventories) can be used +to save processing time. However, there are two issues. +First, the typical inventory will be smaller and fewer +valid search terms. Second, the fortran API reference +date is YYYYMMDDHHmmss rather than the YYYYMMDDHH and assumed +zero minutes and seconds. So the fortran-API inventory +replaces the "d=YYYYMMDDHH" by "D=YYYYMMDDHHmmss". It's +not a big deal and both formats are accepted by the grb2_wrt +routine. The difference would be apparent in a search term +that of the form, + +

    +  mk_inv: ":D=YYYYMMDDHHmmss:HGT:200 mb:"
    +  std inv: ":d=YYYYMMDDHH:HGT:200 mb:"
    +
    + +Since the ftn api has added minutes and seconds to the +time stamp. Being consistent is nice. By the way, the +reference time has to be stored in a 64 bit integer. + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page recent modifications: Oct 3, 2017, Nov 13, 2019 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grb2_undefined.html b/docs/web_docs/grb2_undefined.html new file mode 100644 index 0000000..746f1ab --- /dev/null +++ b/docs/web_docs/grb2_undefined.html @@ -0,0 +1,196 @@ + + + + Climate Prediction Center - wgrib2api: grb2_UNDEFINED, grb2_UNDEFINED_VAL(), grb2_DEFINED_VAL() + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api: undefined values +
     
    + +

    wgrib2api: undefined values

    +
    + + +

    Introduction

    + +

    In grib2, the grid points can have undefined values. Grib doesn't +doesn't use a special value to indicate an undefined but uses one +of 3 methods. + +

      +
    1. a bitmap (used by jpeg2000, simple, ieee and by complex packing) +
    2. the IEEE 754 format undefined (ieee packing) +
    3. a special bit pattern by complex packing (prefered) +
    + +

    +However, users usually find a special value the easiest method to indicate an undefined value. +Wgrib2api, like wgrib2, uses the value 9.999e20 to indicate a special value. +There are one symbolic values and two functions +in wgrib2api (v2.0.8) to handle undefined values. + +

      +
    • grb2_UNDEFINED: symbolic value for 9.999e20 +
    • grb2_UNDEFINED_VAL(x): returns true if x is the undefined values otherwise false +
    • grb2_DEFINED_VAL(x): returns true if x is a defined values otherwise false +
    + + +

    Usage

    +
    +    grid(i,j) = grb2_UNDEFINED
    +       set grid(i,j) to the special undefined values 9.999e20
    +    if (grb2_UNDEFINED(grid(i,j)) then
    +       if grid(i,j) is undefined than
    +    if (grb2_DEFINED(grid(i,j)) then
    +       if grid(i,j) is defined than
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan 25, 2018 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grb2_wrt.html b/docs/web_docs/grb2_wrt.html new file mode 100644 index 0000000..d861222 --- /dev/null +++ b/docs/web_docs/grb2_wrt.html @@ -0,0 +1,314 @@ + + + + Climate Prediction Center - wgrib2api: grb2_wrt + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api: grb2_wrt +
     
    + +

    wgrib2api: grb2_wrt(..)

    +
    + + +

    Introduction

    + +

    +Writing grib using wgrib2api is simple. You need +

      +
    1. gridded data you want to write +
    2. sample grib2 message with the same grid as (1) and unchanging + metadata such as center/subcenter/process-id +
    3. the changing metadata in a wgrib2-style string such as
      + 'd=1999123100:HGT:500 mb:anl:', 'D=20170102123000:UGRD:2 m above ground:15 minute fcst:' +
    + +

    +The grb2_wrt(..) function will +take the template, change the grid values, change the grib headers based +on the metadata string and write out the grib message. +

    + +

    +Optional parameters that are in the grb2_wrt source code that +are not documented here are to be considered to be alpha +code. + +

    A simple fortran program to write grib2

    +
    +use wgrib2api
    +real, allocatable :: grid(:,:)
    +
    +allocate (grid(360:181))
    +read(11) grid
    +i = grb2_wrt('out.grb2','tempplate.grb2',1,data2=grid,meta='D=20170102030000:HGT:500 mb:anl:')
    +write(*,*) 'error=',i
    +stop
    +end
    +
    + +

    A simple program to write out the 10 m wind speed

    +
    +use wgrib2api
    +real, allocatable :: u(:,:), v(:,:)
    +character (len=200) meta
    +
    +i=grb2_mk_inv('gep19.t00z.pgrb2af180','in.inv')                    ! make index file
    +if (i.ne.0) stop 1
    +i=grb2_inq('gep19.t00z.pgrb2af180','in.inv', ':UGRD:10 m above ground:', data2=u) ! read U
    +if (i.ne.1) stop 2                                                 ! only want one match
    +i=grb2_inq('gep19.t00z.pgrb2af180','in.inv', ':VGRD:10 m above ground:', data2=v,& ! read V
    +     desc=meta)
    +if (i.ne.1) stop 3                                                 ! only want one match
    +
    +u=sqrt(u*u+v*v)                                                    ! calculate wind speed
    +i=grb2_wrt('out.grb','gep19.t00z.pgrb2af180',1,data2=u,meta=meta,var='WIND')  ! write wind speed
    +! using grib message 1 of original file as a template
    +!  modifying the variable to WIND (wind speed
    +if (i.ne.0) stop 4
    +write(*,*) ' file : out.grb'
    +stop
    +end
    +
    + +

    Code fragment to write surface hgt from ss2grb2.f90

    + +
    +  metadata='d=' // datecode // ':HGT:surface:' // trim(ftime) // ':'
    +  iret = grb2_wrt(grib_output,grib_template,1,hgt_sfc,meta=metadata,order='raw')
    +  if (iret.ne.0) stop 1
    +  write(*,*) 'grib_write HGTsfc'
    +
    +

    The grib template, grib_template, is created on the fly by using wgrib2 +to alter the grid. + +

    In ss2grb2, the grids are stored in we:ns order and we want the output grids +to be in we:ns order. So the order parameter is set to raw. The order could +have been set to we:ns but raw is slightly faster. + +

    Code fragment to write hgt(pres) from ss2grb2.f90

    +
    +  do i = 1, n_plevs
    +     metadata='d=' // datecode // ':HGT:' // trim(plevs_txt(i)) &
    +       // ':' // trim(ftime) // ':'
    +     iret = grb2_wrt(grib_output,grib_template,1,xz(:,i),meta=metadata,order='raw')
    +     if (iret.ne.0) stop 4
    +  enddo
    +  write(*,*) 'grib_write HGT mb'
    +
    +

    The pressure levels are defined by both a numeric value (plevs(n_plevs) +and a text string (plevs_txt(n_plevs)). Note that the loop that writes +calls grb2_wrt(..) is not multithreaded (no !$OMP PARALLEL DO) because +the wgrib2api is not thread safe. + +

    You may notice that both code fragments use the old style where you modify +the metadata. The new style wasn't available for ss2grb2.f90. + + +

    Usage

    +
    +    iret =     grb2_wrt(GRB2, TEMPLATE, IMSG, data2=GRID, meta=META, (list of optional arguments))
    +               or
    +    iret =     grb2_wrt(GRB2, TEMPLATE, IMSG, data1=GRID1, meta=META, (list of optional arguments))
    +
    +    iret:      integer
    +               0 grib message written
    +               1 grib message not written
    +
    +               Necessary Parameters
    +
    +    GRB2:      character (len=*) output grib file
    +    TEMPLATE:  character (len=*) template file
    +    IMSG:      integer, grib message number to be used as template
    +    data2:     real allocatable :: grid(nx:ny)          : modern programs
    +               values of grid
    +    data1:     real grid1(nx*ny)                        : legacy programs
    +               values of grid
    +    meta:      character (len=*) metadata string, modeled on wgrib2 -S
    +
    +               Optional Parameters
    +
    +    meta:      is optional, concise form of the metadata
    +    append:    integer
    +               0     create GRB2
    +               /= 0  append to GRB2
    +    encode_bits: N, integer
    +               use ECMWF-style scaling (wgrib2 default)
    +               grid values = I * 2**M + offset, where I = 0..2^N - 1
    +               I has at most N bits
    +               wgrib2/wgrib2api supports N as large as 25.
    +    debug:     integer
    +               0     no debug information
    +               /= 0  debug information
    +    order:     character (len=*)
    +               'we:sn'             grid data is we:sn order  (DEFAULT)
    +               'we:ns'             grid data is we:ns order
    +               'raw'               grid data is raw order
    +
    +               Parameters that Override Values in Metadata String (v2.0.7)
    +
    +    var:       character (len=*)
    +               ex. 'HGT', 'TMP'
    +    date:      integer (kind=8)
    +               sets the reference date, format is YYYYMMDDHHmmss
    +    level:     character (len=*)
    +               wgrib2 style level definition, ex. '10 m above ground', '50 mb'
    +    timing:    character (len=*)
    +               wgrib2 style forecast type, ex. 12 hour fcst, 0-6 hour ave fcst
    +
    +    center:    integer, 0..255
    +               WMO defined center id, 255=undefined
    +    subcenter: integer, 0..255
    +               subcenter id, 255=undefined
    +    packing:   character (len=*)
    +               wgrib2 style packing name, ex c1, aec, simple
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: April 7, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grep.html b/docs/web_docs/grep.html new file mode 100644 index 0000000..cef5fcf --- /dev/null +++ b/docs/web_docs/grep.html @@ -0,0 +1,260 @@ + + + + Climate Prediction Center - wgrib2: -grep (various) + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grep (various) +
     
    + +

    wgrib2: -egrep, -egrep_v, -fgrep, -fgrep_v

    +
    + + +

    Introduction

    + +

    +When you use wgrib2 extensively, common sequences keep occuring, such as, + +

    +   1:  wgrib2 A.grb >A.inv
    +   2:  cat A.inv | fgrep ":HGT:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib hgt500.grb
    +   3:  cat A.inv | fgrep ":TMP:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib tmp500.grb
    +   4:  cat A.inv | egrep ":(UGRD|VGRD):" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib wind500.grb
    +
    + +Using the various -grep, -inv and the -i_file option, the above example can +be written as + +
    +   1:  wgrib2 A.grb -inv A.inv
    +   2:  wgrib2 -fgrep ":HGT:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib hgt500.grb
    +   3:  wgrib2 -fgrep ":TMP:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib tmp500.grb
    +   4:  wgrib2 -egrep ":(UGRD|VGRD):" -fgrep ":500 mb:" -i_file A.inv A.grb -grib wind500.grb
    +
    + +The first version is easier to read. So why were the extra options added? + +
      +
    1. Some shells have problems with pipes. +
        +
      • Some versions of Windows dos-prompt have problems with pipes. +
      • RNomads: solved Windows 7 problem by using these options +
      +
    2. More efficient when you avoid multiple processes and pipes. +
        +
      • Every millisecond and K byte of RAM usage counts! +
      +
    3. Used by callable wgrib2. +
        +
      • A subroutine (wgrib2) can read a field using the index file! +
      +
    + +The options were added for the third reason, but one and two are some +nice side effects. The 4 examples can be coded in fortran as, + +
    +   include wgrib2api
    +   ...
    +   i = wgrib2a('A.grb','-inv','A.inv')
    +   i = wgrib2a('-fgrep',':HGT:','-fgrep',':500 mb:','-i_file,'A.inv','A.grb','-grib','hgt500.grb')
    +   i = wgrib2a('-fgrep',':TMP:','-fgrep',':500 mb:','-i_file','A.inv','A.grb','-grib','tmp500.grb')
    +   i = wgrib2a('-egrep',':(UGRD|VGRD):','-fgrep',':500','mb:','-i_file','A.inv','A.grb','-grib','wind500.grb')
    +
    + +

    The -grep options are used in wgrib2api's grb2_inq(..) function. + +

    +Definition of grep options:
    +
    +    (...) | wgrib2 -OP1 X (...)
    +      behaves like
    +    (...) | OP2 X | wgrib2 (...) 
    +
    +      if OP1 == egrep       then OP2 = egrep
    +      if OP1 == fgrep       then OP2 = fgrep
    +      if OP1 == egrep_v     then OP2 = egrep -v
    +      if OP1 == fgrep_v     then OP2 = fgrep -v
    +
    +    X is a posix extended regular expression (egrep, egrep_v)
    +    or a fixed string (fgrep, fgrep_v)
    +
    +   The number of -fgrep and -fgrep_v options is limited to 200.
    +   The number of -egrep and -egrep_v options is limited to 200.
    +   The wgrib2 option -set_regex does not affect the -grep options.
    +
    + + +

    Usage

    +

    + +

    +-egrep X
    +-egrep_v X
    +-fgrep Y
    +-fgrep_v Y
    +
    +X is a posix extended regular expression
    +Y is a fixed string (not a regular expression)
    +Note: -set_regex does not modify the type of regex for these options
    +
    + +

    +See also: +-match, +-not, +-match_inv, +-end, +-if, +-i_file, +-not_if, +-set_regex. +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page modified: Feb 3, 2017, 7/2019. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grib.html b/docs/web_docs/grib.html new file mode 100644 index 0000000..598e0fd --- /dev/null +++ b/docs/web_docs/grib.html @@ -0,0 +1,205 @@ + + + + Climate Prediction Center - wgrib2: -grib + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grib +
     
    + +

    wgrib2: -grib

    +
    + + +

    Introduction

    + +

    +The -grib option writes the data in GRIB-2 format. This +option only writes the current field (record/submessage) if the GRIB message +contains multiple fields (records/submessages). If you want to copy the +entire GRIB-2 message, use the -GRIB option. + + +

    -grib vs. -grib_out

    +

    These two options do similar things, they write a grib message to a specified file. +The -grib writes the grib message and +-grib_out option takes the decoded grib message, +converts it back into grib2 and then writes it out. Obviously the latter option +is much slower. You only use -grib_out when you +have modified the data (grid) values. For example, you may have set many of the +points to undefined in order to the data volume. Since the data values +have changed, you have to use the -grib_out in order +to create the smaller grib file. + +

    Usage

    +

    + +

    +-grib file_name
    +
    + +

    Example

    +

    + +

    +The slow way of extracting 2 meter RH to rh.grb.  (Read test.grb2 twice.)
    +$ wgrib2 test.grb2 -s | grep ":RH:2 m above ground:" | wgrib2 -i test.grb2 -grib rh.grb
    +285:36796469:d=2005090200:RH:2 m above ground:60 hour fcst
    +
    +The fast way of extracting 2 meter RH to rh.grb.  (Read test.grb2 once.)
    +$ wgrib2 test.grb2 -match ":RH:2 m above ground:"  -grib rh.grb
    +285:36796469:d=2005090200:RH:2 m above ground:60 hour fcst
    +
    + +

    +See also: -GRIB, +-grib_out +-append +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005, updated Aug 10, 2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grib_ieee.html b/docs/web_docs/grib_ieee.html new file mode 100644 index 0000000..8a19f69 --- /dev/null +++ b/docs/web_docs/grib_ieee.html @@ -0,0 +1,168 @@ + + + + Climate Prediction Center - wgrib2: -grib_ieee + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grib_ieee +
     
    + +

    wgrib2: -grib_ieee

    +
    + + +

    Status

    + +

    +The -grib_ieee option is a very early +method of writing grib files. This method was never used +outside of testing AFAIK. This option will be deleted in +the future (2015) unless there are objections. +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 30, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grib_max_bits.html b/docs/web_docs/grib_max_bits.html new file mode 100644 index 0000000..f6e32f8 --- /dev/null +++ b/docs/web_docs/grib_max_bits.html @@ -0,0 +1,197 @@ + + + + Climate Prediction Center - wgrib2: -grib_max_bits + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grib_max_bits +
     
    + +

    wgrib2: -grib_max_bits

    +
    + + +

    Introduction

    + +

    +When wgrib2 encodes a grib message (creates a new grib message), +the grid values are usually stored as scaled integers. +The number of bits required to store the scaled integers will depend +on the precision/scaling factors. If these values are poorly +set, the scaled integers could be 100 bits long. That would +be very inconvenient for machines with 32-bit registers. +To prevent this problem, you have to limit the size of the scaled +integers. The wgrib2 default is 16 bits, and can be increased +up to 25 bits by the -set_grib_max_bits option. +Since the IEEE single precision floating point format only has +25 bits of precision, there is little need to support longer +scaled integers at this point in time (9/2017). The +-grib_max_bits option displays the current +value of the maximum binary precision. + + +

    +Grib decoders usually have a limit to the size of the scaled integers +used to store grid values. Wgrib2 has a limit of 25 bits which is determined by the minimum +size of the integer (32 bits) and the algorithm used to convert +between a bitsting and integer. I don't know the limits for +other software packages. + +

    + +

    +-grib_max_bits INTEGER
    +               INTEGER between 1 and 25
    +
    + +See also: +-scaling, +-set_grib_max_bits, +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified Feb 21, 2018 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grib_out.html b/docs/web_docs/grib_out.html new file mode 100644 index 0000000..7add8d5 --- /dev/null +++ b/docs/web_docs/grib_out.html @@ -0,0 +1,221 @@ + + + + Climate Prediction Center - wgrib2: -grib_out + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grib_out +
     
    + +

    wgrib2: -grib_out

    +
    + + +

    Introduction

    + +

    +The -grib_out option writes the decoded grid to a +specified file in grib2 format. Normally you would use the +-grib option as this option just copies the original grib (sub)message. +The -grib_out option has to repack or compress the decoded grid which +is much slower. +You would only use the +-grib_out option when you have modified +the decoded grid by +the -undefine, -import, +-rpn, or some other option that modifies the +decoded grid. +Use the -set_grib_type option +to specify the grib packing and -set_scaling to specify the scaling. +When the -set_grib_type option is not used, the packing defaults +to simple. +When the -set_scaling option is not used, the scaling is retained +from the input grib message unless a -rpn or -import +option is executed. These two options reset the scaling to the default because they +can alter the range of grid point values. + + +

    Usage

    +

    + +

    +-grib_out file_name
    +
    +

    Example

    +

    + +

    +$ wgrib2 new.grb2 -undefine out-box -10:10 20:40 -grib_out small.grb2
    +1:0:d=2005082812:HGT:1000 mb:78 hour fcst:
    +
    + +The above routine sets all the grid points outside the 10W-10E 20N-40N to +undefined and then writes the resultant field as a grib file +in small.grb2. This file will be much smaller than the original field. + +

    +Hint: by proper use of the -undefine and -grib_out options, one +should be able to send horizontal boundary conditions for +regional models very very quickly. Imagine just sending +4 lines of horizontal boundary conditions. + +

    Hint: gzip +

    +See also: -text, +-netcdf +-spread +-bin +-ieee +-import_bin, -import_grib, -import_ieee, import_grib +-grib +-rpn +-set_grib_type +-undefine +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 28, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grib_out_irr.html b/docs/web_docs/grib_out_irr.html new file mode 100644 index 0000000..eb1b5a4 --- /dev/null +++ b/docs/web_docs/grib_out_irr.html @@ -0,0 +1,219 @@ + + + + Climate Prediction Center - wgrib2: -grib_out_irr + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -grib_out_irr +
     
    + +

    wgrib2: -grib_out_irr

    +
    + + +

    Introduction

    + +

    +This option will be eliminated as template 3.130 was not added to the grib standard. + +

    +The grib2 format allows irregular grids; that is, grids that are defined by a list of latitude-longitude pairs. +This extension to the grib2 format allows you to handle models with unusual grids, +model data interpolated to a specific point and even observations. +Why would you use grib to handle point data rather than other +formats such as BUFR or netcdf? Some formats are difficult to use and converting between from grib to netcdf/BUFR +will lose metadata. Keeping the keeping the point data in grib facilitates the conversion between gridded +and collection-of-points data. For the conversion, wgrib2 can do nearest neighbor and a Cressman analysis. + +

    Space

    +

    +Each grid point has a 4-byte latitude and a 4-byte longitude value. This is an +8 * num_grid_point byte overhead. Since each grib message is independent, this +overhead has to be repeated for each grib message even if the grid is unchanged. +Howver, the grib format allows submessages so the overhead is only for the first +submessage. However, the length of any grib message has to be +less than 2 GB in order to be compatible a 32-bit machines. In practice you should +keep the message size smaller in order not to use up all the free memory. + + +

    Usage

    +
    +-irr_grid LON-LAT-LIST RADIUS OUT
    +
    +LON-LAT-LIST   = lon-lat list, lon1:lat1:lon2:lat2:...:lon-n:lat-n
    +RADIUS         = radius in km
    +OUT            = output grib file
    +
    +The -irr_grid option creates an irregular grid using nearest-neighbor interpolation.
    +If no input grid point is within RADIUS kms, the resulting grid has a undefined value.
    +
    + +

    Example: make file with grid points at (10W,20N) (30W,40N)

    +
    +$ wgrib2 flx.grb2 -irr_grid 10:20:30:40 1000 2pt.grb2
    +1:0:d=2009010100:UFLX:surface:0-1 month ave fcst:
    +$ wgrib2 -V 2pt.grb2
    +1:0:vt=2009010100:surface:0-1 month ave fcst:UFLX Momentum Flux, U-Component [N/m^2]:
    +    ndata=2:undef=0:mean=0.0129:min=0.0035:max=0.0223
    +    grid_template=130:winds(N/S):
    +        Irregular Grid:(2 x 1) units 1e-06 input raw output raw res N/A
    +        lat=20.000000 40.000000 
    +        lon=10.000000 30.000000 
    +
    +1st point lon=10W lat=20N
    +2nd point lon=30W lat=40N
    +
    + +See also: +-grib_out_irr, +-lola, +-cress_lola, + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grib_out_irr2.html b/docs/web_docs/grib_out_irr2.html new file mode 100644 index 0000000..67e6ab8 --- /dev/null +++ b/docs/web_docs/grib_out_irr2.html @@ -0,0 +1,222 @@ + + + + Climate Prediction Center - wgrib2: -grib_out_irr2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -grib_out_irr2 +
     
    + +

    wgrib2: -grib_out_irr2

    +
    + + +

    Introduction

    + +

    +The option -grib_out_irr2 replaces +-grib_out_irr. The former uses Grid +Definition Template (GDT) 101 which is part of the grib +standard. The latter uses GDT 130 which was was not adopted. +The -grib_out_irr2 allows you to define +an unstructured grids which allows the locations of the grid +points to be arbitrary. For example, you can define an +unstructured grid to be the locations of the all the US +weather observing stations. One neat feature of GDT 101 +is the grid number is a UUID (universally unique identifier) +which can be generated on the fly and is not "registered" +with the center or WMO. This feature, for example, will +allow you to generate a grid for all the ship observations +at 00Z January 1, 2017 and a different grid for any other +observation time. With the UUID feature of GDT 101, one +can store observational data in grib. + +

    +The locations of are not part of the metadata in grib message, +and the locations have to be provided another means such as +documentation at the center's web site or by including grib +mesages with the latitudes (NLAT) ane longitudes (ELON). + +

    Usage

    +
    +-grib_out_irr2 NPNTS CENTER_GRID_NUBER REF_GRID_TYPE UUID OUTFILE
    +
    +NPNTS              = number of grid points, can be differ from the size of the input grid
    +CENTER_GRID_NUMBER = use -1 unless your center has defined an appropriate grid number
    +REF_GRID_TYPE      = use -1 unless your center has defined an appropriate reference grid type
    +UUID               = universally unique identifier, use uuidgen to create a new UUID,
    +                     has a format: e1fc1f28-5024-4ff5-a04b-cf837d8574f6
    +                     0 = no UUID
    +OUTFILE            = output grib file
    +
    + +

    +The option, -grib_out_irr2, can generate a grid with any number +of grid points. The data for the new grid is taken from the DATA register which is +usually the input data. If NPNTS is less than the size of the data register (NDATA), +then the first NPNTS of DATA are written out. If NPNTS is greater or equal to NDATA, +the DATA is written out and any extra points are set to undefined. For both cases, +there is no attempt to remap the data by finding the nearest grid point, etc. (At +this point, the latitudes and longitudes have not been specified.) + +

    Is GDT 101 Useful?

    + +GDT 101 is useful! I can define a UUID, and make a grib files with 3 grib messages, +NLAT, ELON, TMP2m. Using wgrib2, I can interpolate TMP2m to a lat-lon grid. + +

    +I have a netcdf file with latitude(x,y), longitude(x,y) and TMP2m(t,latitude,longitude). +Using -import_netcdf, I can make grib message with ELON, NLAT and TMP2m. I can now +interpolate TMP2m to a lat-lon grid. + +

    +See also: + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 21, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/gribify2.html b/docs/web_docs/gribify2.html new file mode 100644 index 0000000..435312d --- /dev/null +++ b/docs/web_docs/gribify2.html @@ -0,0 +1,201 @@ + + + + Climate Prediction Center - gribify_ieee: -ftim + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > gribify2 +
     
    + +

    gribify using import and a template

    +
    + + +

    Introduction

    + +

    Here is another way of writing a grib2 file. Create a template +grib2 file. In our example, we already created one in grib1 and then +converted it to grib2 using cnvgrib. Once we have a template file, we can +replace the data using one of the import options, adjust the +date code, handle the undefined grid point and write it out using +the -grib_out option. Here is +an example script. + +

    +#!/bin/sh
    +#
    +# example of converting a binary file to grib2
    +#
    +# conustemplate.grb2 is the template
    +#  was created in grib1 using the gribw library
    +#  and converted to grib2 by cnvgrib
    +#
    +# the data file has two records but we only want to convert the 1st record
    +#
    +set -x
    +
    +# date=$1
    +# date0=`ndate -12 ${date}00`
    +date=20090414
    +date=2009041312
    +
    +# -no_header    .. read/write data without f77 header
    +# -import_bin   .. read one binary record (no header) and replace the grib data field
    +# -set_date     .. set a new reference time
    +# -undefine_val .. the binary file used -999 as the undefined flag
    +# -rpn          .. use the rpn calculator to convert to standard units (x=x/10/86400)
    +# -grib_out     .. write the data as a grib file
    +
    +wgrib2 conustemplate.grb2 -no_header -import_bin PRCP_CU_GAUGE_V1.0CONUS_0.25deg.lnx.$date.RT \
    +  -set_date $date0 -undefine_val -999 -rpn 10:/:86400:/ -grib_out precip$date0.grb2
    +
    + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: June 1, 2009 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/gribify_cmorph.html b/docs/web_docs/gribify_cmorph.html new file mode 100644 index 0000000..cf014d0 --- /dev/null +++ b/docs/web_docs/gribify_cmorph.html @@ -0,0 +1,615 @@ + + + + Climate Prediction Center - wgrib2: example, converting CMORPH into GRIB + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > Converting CMORPH into GRIB + +
     
    + +

    Converting CMORPH into GRIB

    +
    + +

    Introduction

    + +

    +Converting a binary file into GRIB is a common operation. Once the +data in grib, using the data is easier and safer. I remember someone +who stored data in a simple binary file. Every day, he would get the Z500 +and tack it onto the file as a simple (nx,ny) array. So the first record +was January 1, 20XX Z500, the second record was January 2, 20XX Z500 and so on. +Suppose the computer that updated the archive was down one day, his archive would +be out of sync, and he may never know it. Not safe. Once the data +are stored in a "descriptive" format, you can never get out of sync and other +programs can read the data. + +

    +CPC produces CMORPH which is a high temporal estimate of the precipitation. +Making 30 minute estimates of the precip is hard because satellites that +"see" the precip are polar orbiters. To make a "movie", you really want +to use a geostationary satellite. So CMORPH uses the polar orbiters to +get the precip when available. For the other times, it assumes that +the precip from a cloud system is similar to the precip from that cloud system +when observed by a polar orbiter in a previous and future time. Identification +of cloud systems can be done using imagery from geostationary satellites. + +

    +A sample binary CMORPH file is described by the following GrADS control file. + +

    +DSET ^CMORPH2_3Phase_0.25deg-30min_%y4%m2%d2%h2
    +OPTIONS template little_endian
    +UNDEF -999.0
    +TITLE CMORPH-2 3-Phase 0.25deg-30min precip rate
    +XDEF 1440 LINEAR   0.125 0.25
    +YDEF  720 LINEAR -89.875 0.25
    +ZDEF    1 LEVELS   1
    +TDEF 9999 LINEAR 00:00Z13Sep2018 30mn
    +VARS 4
    +cmorph  1  99  total precip rate  [mm/hr]
    +liquid  1  99  liquid precip rate [mm/hr]
    +mixed   1  99  mixed precip rate  [mm/hr]
    +solid   1  99  solid precip rate  [mm/hr]
    +
    +name = CMORPH2_3Phase_0.25deg-30min_YYYYMMDDHH
    +format: little endian ieee
    +        fortran direct access
    +        undefined grid values have the value -999.0
    +grid:   1440 x 720 we:sn
    +        0.125W to 359.885W by 0.25 degrees
    +        89.875S to 89.875N by 0.25 degrees
    +fields: 4
    +        #1 CMORPH (total precip) unit mm/hr
    +        #2 liquid precip
    +        #3 mixed precip
    +        #4 solid precip
    +
    + + +

    Making a Template File

    + +

    +We are going to show two ways to gribify the CMORPH data. One is +by using a fortran program and the second by the wgrib2 utility. + + + +

    + +The -netcdf option writes the grid values to a specified +file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator +and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic +projection grids. Other grid templates and projections are not supported yet. + +

    +Default the grid values are written as 4 bytes float having {TIME,LAT,LON} +dimension shape (3D data) and possible vertical LEV information added to the name of variables. +For example, V wind component defined at 10 m level in atmosphere will have default name +VGRD_10maboveground. +With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data +with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical +structure analysis etc. +

    +3D and 4D data could be mixed in the same netcdf file if both have the same horizontal +grid shapes. Practically any number of variables could be placed in to the single netcdf file +as well as time dimension can be almost arbitrary extended. For these purposes +please use the wgrib2 -append option. +All missing values in data are replaced by the _FillValue defined in wgrib2 as +9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. + + + +

    Simple usage

    +

    + +

    +-netcdf file_name
    +
    + +

    Example 1

    +

    + +

    +$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    +
    +The above line converts the grib2 file into a netcdf file.
    +
    +
    + +

    Sub-options for -netcdf

    + +

    +Next sub-options could help to customize created netcdf file(s). +All sub-options must preceed the -netcdf option as it is the wgrib2 rule. +More then one -netcdf option could be given on the wgrib2 command line, +please read the documentation for wgrib2. +Almost all sub-options have -no_... version that annulates previous +assignment. +For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table +with the -nc_table sub-option or combine the command line options +with instructions in the -nc_table conversion file. + +

    +The -append option makes possible to create single +large data set for long time series of gridded data. Time dimension of data in the netcdf file +is "unlimited", it could be extended "forward" when adding new data but not "backward" before +the first defined time value. If data for the same time step already exist in the updated +netcdf file these will be silently overwritten. + +

    +The -nc_nlev option is needed to export data to netcdf +as 4D data defined in {TIME,LEV,LAT,LON} space. +It must be followed by integer max_number_of_vertical_levels +which defines the vertical dimension size of 4D data exported to the netcdf file. +This value can not be found from each single grib2 message or sub-message, +usually it has to be scanned the entire grib2 file or even number of files. +It is the reason why the max_number_of_vertical_levels +value must be provided by user. +

    +Grib2 types of vertical levels eligible for export to the netcdf as 4D data +are defined in the wgrib2 internal table and now include next types of GRIB2 levels: +

    +
    +
    20:K level +
    100:pressure level +
    104:sigma level +
    105:hybrid level +
    107:K isentropic level +
    160:ocean depth below sea level +
    +
    +

    +Data for the first found eligible level type are treated as 4D and vertical level +information is not added to the variable names. +Error is generetad if data for other then first found eligible level type +are met in the input stream. +Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space +with the possible level information included into the variable names or with the user-specified names +(see -nc_table option description below for how to do it). +

    +The -nc_nlev option has not -no_... option, +please use instead the max_number_of_vertical_levels equal to 0. +In this case all data from the input stream will be threated as 3D. +

    +When existing netcdf file is updated in the -append mode +the value of max_number_of_vertical_levels must not exceed +initial value provided when the netcdf file was first created (defined). +By default when first creating the netcdf file, vertical level values are not fixed +(are undefined) and these are defined one-by-one when data at new level are added +to the netcdf file, up to the max_number_of_vertical_levels. +To overcome this feature please use the -nc_table option. + +

    +The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is +default and do not assume data packing, only data range is checked. Data outside of +specified range are replaced by missing value code for all types of packing. +This replacement is done in the local copy of unpacked data, so main data array +stays unchanged. +Values of min and max could be any +signed float. Packing is applied to all new variables in the input stream. +If some variable was already defined in the netcdf file and now is appended to it +in the -append mode the initially defined and fixed in the netcdf file +valid range and packing parameters are used. +

    +The packing is possible to the short (2 bytes) +or byte (1 byte) values with potential loss of precision. +Both zero values of min and max +packing parameters for the short or +byte packing activate 'auto' packing when +min and max +values are defined from the first entered field. + +

    +PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file +is open with 'sdfopen' command. But by some reasons using the GrADS +data description file (catalog) for the same netcdf file helps in this situation. + +

    +The -nc_grads option activates some tests for the created +netcdf file to be GrADS (version 1.9b4) compatible, +or to be open by sdfopen in gradsnc or gradsdods. +The GrADS support only COARDS convention netcdf files; +it do not support non-constant data time stepping +and silently generates wrong time stamps for such netcdf files. +Packing to byte also is not directly recognized by GrADS v1.9b4. +With this option an error is raised and processing stops +if any of criterias above is determined. + +

    +The -nc_table option followed by the file_name is most usefull for the advanced users +as it specifies the file where user can customize many features of created netcdf file. +Next examples demonstrate which directives and conversion rules could be given +in the -nc_table file. +Almost all of them are optional with exception of $nlev for the case +when user explicitly specifies the vertical level values $levs. +

    +$lev_type 100:pressure:pressure level:mb:0.01 +

    This directive explicitly defines the type of vertical level +in the grib2 file that becomes eligible for treating data at these levels as 4D data +and some it attributes for netcdf file. +Default, first found level type listed in the wgrib2 build-in table +of eligible levels is selected if no $lev_type directive found. +

    Fields here include: +

    +
    +
    100-the grib2 level type code number +for treating data as 4D. In this example it is the code number for pressure levels, integer +
    pressure- +short_name for the vertical axis in the netcdf file, string +
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces +
    mb-vertical axis units as written in the netcdf file, string +
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file +
    +
    + +$nlev X +

    This directive is an equivalent of the -nc_nlev command line option +but value in the -nc_table file has precedence over the command line option if both are found. +It is required if next $levs directive is specified. +

    + +
    $levs lev(1) lev(2) lev(3)... +
    ...lev(I-1) lev(I) lev(I+1)... +
    ...lev(X-1) lev(X) +
    +

    +This directive explicitly specifies the vertical level values to be exported +to the netcdf file, in the netcdf units. +If this directive exists in the -nc_table file and there is found the grib2 data +eligible for the 4D presentation but defined on other then listed level - +these data are skipped from export and work is silently continued. +All data conversion parameters are checked before the $levs is checked. +List of level values could consist of multiple lines; +max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); +use space, ',', ';' or ':' as lev(i) fields separator. +

    +Impact of $nlev and $levs directives is different depending on +does the netcdf file is first created or it is updated. +When the netcdf file is first created these values are written +to the netcdf file fixing 4D data vertical structure. +When updating an existing netcdf file in the -append mode +these parameters will work like filter limiting possible +updates of 4D data by these that satisfy to the given $levs only and +ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. +

    +The $nlev and $levs directives could be necessary if records +in the grib2 file have randomly changing vertical level values +that makes it impossible sequentionally define valid order of vertical levels. + +

    +$grads 1 +

    This directive is an equivalent of the -nc_grads command line option +if passed value is 1 or to the -no_nc_grads if value is 0. +Directive in the -nc_table file has precedence over the command line option. + +

    +wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] +

    +All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' +are treated as grib2 to netcdf conversion rules for the specified variables. +In these strings the wgib2_name and wgrib2_level +are strings as returned by the wgrib2 inventory; +* used as the wgrib2_level will apply +to all levels not given explicitly. +The valid range and packing information is optional but it overwrites common +packing rule if such is specified by the -nc_pack command line option. +Absence of packing information means no packing for this variable. +Min and max values are any signed float values. Both could be omitted or put to zero. +Last case means that automatic scaling will be estimated from the first entered +wgib2_name field at the wgrib2_level +or at the first level in case of * as level value. +

    +If the keyword ignore is found as a netcdf variable name or +as a packing type value, the corresponding data are ignored +and do not written to the netcdf file. +Impact from this keyword is similar to the wgrib2 -not option +or filtering data with the grep utility. +

    +The ignore keyword is recommended if the data from the same +grib2 file are exported in number of output files (netcdf or other) +by the same wgrib2 process. Then the same decoded data could be passed +for the output in other file of any supported type. +Doing export to the single netcdf file it is not recommended to use the +ignore keyword +as corresponding data are first decoded and after that skipped from writing +to the netcdf file. +

    +In the next example two lines from the -nc_table file instruct +the wgrib2 utility export to the netcdf file the geopotential height changing name +from HGT (wgrib2) to +geopotential in the netcdf file, +at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: +

    +
    +HGT:*:geopotential
    +HGT:975 mb:ignore
    +
    +
    +All other variables not listed in the -nc_table file but found in the input stream +are processed as regular 3D data. + + +

    Example 2

    +

    +Next example shows the content of user-defined -nc_table file +for one special case of Japan Meteorological Agency MSM system grib2 data conversion. +Same -nc_table file includes the rules for +conversion of both 'surface' and upper air data although +the input grib2 files are different. + +

    +
    +#
    +# File name: jma_msm_g2nc.table
    +# Description: Specifies parameters for conversion to Netcdf format
    +# hourly analyses and forecasts of JMA MSM system as best suited to
    +# my purposes: forcing of ocean model and reference data for analysis
    +# of meteorological conditions with GrADS-based visualization tools.
    +# Sergey Varlamov, July 2007
    +#
    +$lev_type  100:p:pressure level:mb:0.01
    +$nlev      16
    +$levs  1000 975 950 925 900 850 800 700 600 500
    +        400 300 250 200 150 100
    +$grads 1
    +#
    +# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    +#
    +UGRD:*:u
    +VGRD:*:v
    +#UGRD:*:u:ignore
    +#VGRD:*:v:ignore
    +TMP:*:temp
    +#write HGT at any level as hgtprs:
    +HGT:*:hgtprs
    +#but skip HGT at 100 mb, now commented - example and test
    +#HGT:100 mb:hgtprs:ignore
    +RH:*:rh:short:-2:110
    +VVEL:*:omega
    +#
    +# JMA MSM model surface data conversion rules
    +#
    +PRMSL:mean sea level:prmsl
    +PRES:surface:prsfc
    +UGRD:10 m above ground:u10m
    +VGRD:10 m above ground:v10m
    +TMP:1.5 m above ground:t2m
    +RH:1.5 m above ground:rh2m:short:-5:110
    +TCDC:surface:ncld:short:-5:110
    +LCDC:surface:ncld_low:short:-5:110
    +MCDC:surface:ncld_mid:short:-5:110
    +HCDC:surface:ncld_upper:short:-5:110
    +APCP:surface:r1h
    +# End of file
    +
    +
    +Using above file we could create the daily file with 3h analyses
    +at the 'surface' layers from the input grib2 files
    +with the next simple shell script:
    +
    +
    +date=20070715
    +for (( j=0; j<=21; j+=3 )) #hour of day loop
    +do
    +  if [ $j -lt  10 ]
    +  then
    +    h=0$j
    +  else
    +    h=$j
    +  fi
    +  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    +
    +  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    +  code=$?
    +  if [ $code -eq 0 ]
    +  then
    +    echo ${date}${h}': created/added to Netcdf'
    +  else
    +    echo ${date}${h}': wgrib2 failed...'
    +    exit $code
    +  fi
    +done
    +
    +
    +Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    +
    +gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    +
    +and change the name for the output file:
    +
    +./msm_s_${date}.nc to the ./msm_p_${date}.nc
    +
    +Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    +utility for data visualization and analyses.
    +
    + +

    Example 3

    + +In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, +convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf +option doesn't support appending, the netcdf conversion cannot be in a loop. + +
    +Version 1, using loops and a temporary file
    +
    +rm tempfile
    +for f in gfs.t00z.pgrb2f[01]?
    +do
    +   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    +done
    +wgrib2 tempfile -netcdf ~/myfile.nc
    +rm tempfile
    +
    +Version 2, data-flow 
    +
    +1:   cat gfs.t00z.pgrb2f[01]? | \
    +2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    +3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    +4:   wgrib2 - -netcdf ~/myfile.nc
    +
    +
    +Line 1 (cat), takes all the desired grib files and writes to stdout
    +Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    +Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    +Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    +
    +

    +See also: +-bin, +-ieee +-text +-spread + +-append +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan. 27, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/gribify_ieee.html b/docs/web_docs/gribify_ieee.html new file mode 100644 index 0000000..b6300cb --- /dev/null +++ b/docs/web_docs/gribify_ieee.html @@ -0,0 +1,421 @@ + + + + Climate Prediction Center - gribify_ieee: -ftim + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > gribify_ieee +
     
    + +

    gribify using ieee

    +
    + + +

    Introduction

    + +

    Writing grib-2 files can be quite painful with all the libraries +involved. However, there is a type of grib which is relatively easy +to write. In this format, a single grib2 record looks like + +

    +     (binary header)           variable number of bytes
    +     (big endian ieee data)    4*ndata bytes
    +     (binary trailer)          4 bytes, ascii '7777'
    +
    + +You can obtain the header/trailer using the -grib_ieee +option. + +
    +   $ wgrib2 -order raw -d 1 in.grb2 -grib_ieee out
    +   1:0:d=2008022101:APCP:surface:1 month fcst:
    +   $ ls out*
    +   out.grb  out.h  out.head  out.tail
    +
    + +

    The first line takes the first record of the file and creates +

    +   out.grb        ieee grib2 file (one record)
    +   out.head       binary file with the header
    +   out.tail       binary file with the trailer
    +   out.h          C header
    +
    + +

    Making a simple grib file

    + +Continuing our example, we need some big endian binary data (ieee.bin). +We extract the ieee data (ieee.bin) using wgrib2. Normally you +would create the ieee data by another program. + +
    +   $ wgrib2 -d 1 in.grb2 -no_header -ieee ieee.bin
    +   1:0:d=2008022101:APCP:surface:1 month fcst:
    +
    + +Once we have the field in big-endian ieee, we can make +the grib file. + +
    +   $ cat out.head ieee.bin out.tail > first.grb
    +   $ wgrib2 first.grb -grib_out second.grb
    +   1:0:d=2008022101:APCP:surface:1 month fcst:
    +
    + +The "cat" combines the header, data and trailer. The file, +first.grb is a valid grib2 if there were no undefined values +in "ieee.bin" (see the following section, "Undefined grid points"). +The wgrib2 converts any undefined grid points to a bit +mask and uses a more common compression scheme. +Of course the example is pretty lame as it has the same date and +variable as the original file. However that can be changed. + +
    +   $ wgrib2 second.grb -set_date 2008010100 -set_var SNOD -grib_out third.grb
    +   1:0:d=2008010100:SNOD:surface:1 month fcst:
    +
    + + +

    Making a grib file with C

    + +The header file may looks like this, + +
    +unsigned char head[] = {
    + 71, 82, 73, 66, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 164, 234, 0, 0, 0, 21,
    + 1, 0, 7, 0, 1, 2, 1, 1, 7, 216, 4, 14, 0, 0, 0, 0, 1, 0, 0, 0,
    + 72, 3, 0, 0, 0, 41, 16, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0,
    + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 144, 0, 0, 0, 73, 0, 0, 0, 0, 0,
    + 0, 0, 0, 5, 93, 74, 128, 0, 0, 0, 0, 48, 133, 93, 74, 128, 21, 79, 4, 96,
    + 0, 38, 37, 160, 0, 38, 37, 160, 0, 0, 0, 0, 34, 4, 0, 0, 0, 0, 3, 5,
    + 2, 0, 180, 0, 0, 0, 1, 0, 0, 0, 0, 100, 0, 0, 1, 134, 160, 255, 0, 0,
    + 0, 0, 0, 0, 0, 0, 12, 5, 0, 0, 41, 16, 0, 4, 1, 0, 0, 0, 6, 6,
    + 255, 0, 0, 164, 69, 7,};
    +
    +unsigned char tail[4] = {55, 55, 55, 55};
    +
    +#define NDATA 10512
    +#define SEC0 0
    +#define DISCIPLINE 6
    +#define EDITION 7
    +#define SEC1 16
    +#define CENTER 21
    +#define SUBCENTER 23
    +#define MASTERTABLE 25
    +#define LOCALTABLE 25
    +#define YEAR 28
    +#define MONTH 30
    +#define DAY 31
    +#define HOUR 32
    +#define MINUTE 33
    +#define SECOND 34
    +#define SEC3 37
    +#define SEC4 109
    +#define PRODUCTDEFTEMPLATENUM 116
    +#define PRODUCTDEFTEMPLATE 118
    +#define PRODUCTCATEGORY 118
    +#define PRODUCTNUMBER 118
    +#define SEC5 143
    +#define SEC6 155
    +#define SEC7 161
    +
    + +The header has definition of the header and trailer and +the location of selected elements in the header. Here +is an example that uses the above header (g2.6.h) + +
    +#include <stdio.h>
    +#include <stdlib.h>
    +#include "g2.5.h"
    +
    +// Method #2 of writing a grib file
    +//
    +//  sample program to create a grib2 ieee file
    +//  to convert to jpeg file, type wgrib2 in_file -grib_out out_file
    +//
    +// can also use wgrib2 to change the variable name, level and time
    +//   by the set_* commands
    +//
    +// 4/2008 Wesley Ebisuzaki
    +
    +int main() {
    +        FILE *grib;
    +        float r;
    +        char s[4], *t;
    +        int i;
    +
    +        grib = fopen("test.grb", "wb");
    +
    +// to change octet N of section 4 to the value of K
    +// add the following line:
    +//      head[SEC4+(N-1)] = K;
    +// the grib documentation starts numbering octets at 1
    +// C uses 0 as the base
    +
    +        head[YEAR] = 2008 / 256;
    +        head[YEAR+1] = 2008 % 256;
    +        head[MONTH] = 2;
    +        head[DAY] = 3;
    +        head[HOUR] = 4;
    +
    +        head[DISCIPLINE] = 0;
    +        head[PRODUCTCATEGORY] = 1;
    +        head[PRODUCTNUMBER] = 2;
    +
    +        // write grib header
    +
    +        i = fwrite(head, 1, sizeof(head), grib);
    +        printf("size of head = %d\n",i);
    +
    +        // for missing values, use the value NaN
    +        // note: wgrib2 will convert 9.999e20 to missing
    +        // write out IEEE big-endian data (NDATA)
    +
    +        // silly array -- needs to be in big-endian
    +
    +        r = 1.0;
    +        t = (char *) &r;
    +        // byte swap on a little endian machine
    +        s[0] = t[3];
    +        s[1] = t[2];
    +        s[2] = t[1];
    +        s[3] = t[0];
    +        for (i = 0; i < NDATA; i++) {
    +            fwrite(s,1,4,grib);
    +        }
    +
    +        // write grib trailer
    +
    +        fwrite(tail,1,sizeof(tail),grib);
    +        return 0;
    +}
    +
    + +

    +As with the first example, one should convert undefined grid points and the ieee packing +to a more commonly used packing using "wgrib2 in.grb -grib_out out.grb". + +

    +In this example, in.grb2 happens to have the correct grid +but wrong the center. If you examine in.grb2, you see that it comes from +NCEP and you happen to be working in in Kiribati (196 in WMO table). That can be easily fixed. + +

    +   $ wgrib2 in.grb2 -center
    +   1:0:center=US National Weather Service - NCEP (WMC)
    +   $ wgrib2 in.grb2 -set_center 196  -grib_out third.grb2
    +   1:0:d=2008022101:APCP:surface:1 month fcst:
    +   $ wgrib2 third.grb2 -center
    +   1:0:center=Kiribati (NMC)
    +
    + +Are all the necessary -set_* options available? +Probably not as this this procedure for making grib file is +a work in progress. Send comments to wesley.ebisuzaki@noaa.gov. + +

    Getting the "template" grib2 file

    + +

    The procedure depends on having a grib2 file with the +correct grid. For common grids, you can often find a +such a grib file. Sometimes you can find a grib1 file +and then you can use +cnvgrib to convert the file into grib2. As a last +resort, one could take a grib1 file, convert it to +the correct domain by the program copygb and then use +cnvgrib. +Of course, the last resort is the hardest because it requires +knowing the grid description in the arcane "GDS" format. +(You'll have to read the fortran code and know a bit about grib1.) + +

    5/2010: wgrib2 can make regular lat-lon template files +by the -lola option. + +

    Undefined grid points

    +

    +In grib, undefined grid points are usually specified by a +bit mask. However, ieee floating point numbers can have a +value of NaN or "not a number". The current WMO documentation +doesn't specify how to interpret a NaN, so wgrib2 interprets +a NaN as undefined. Seems logical, doesn't? Anyways I'll assume +logic holds until WMO defines otherwise. However, +writing a NaN can be difficult in some languages. So +one can use a special number as the undefined value. If +you use 9.999e20, you can fix the file by + +

    +   wgrib2 in.grb2 -grib_out out.grb2
    +
    + +If for some reason, you decided to use -999 as the undefined value, +you can fix the file by + +
    +   wgrib2 in.grb2 -undefine_val -999 -grib_out out.grb2
    +
    + + +

    Other grib decoders

    + +The ieee variation of grib2 is not supported by the NCEP fortran and C +libraries and programs based on those libraries. You can convert to +a more standard packing by using wgrib2. + +
    +   wgrib2 in.grb2 -grib_out out.grb2
    +
    + + +

    Warning

    +Please check the results of gribifying your data. This +facility is very new and variations of grib files is many. +Please plot the results. + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Oct 30, 2008 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/gribtable_used.html b/docs/web_docs/gribtable_used.html new file mode 100644 index 0000000..8a56dcf --- /dev/null +++ b/docs/web_docs/gribtable_used.html @@ -0,0 +1,227 @@ + + + + Climate Prediction Center - wgrib2: -gribtable_used + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -gribtable_used +
     
    + +

    wgrib2: -gribtable_used

    +
    + + +

    Introduction

    + +

    +The grib variable table that is built in to wgrib2 is based on the NCEP table +and entries from other centers. For the WMO-defined entries, NCEP +names are used. You may want to change the grib table because + +

      +
    1. grib table is incomplete +
    2. you want to use names that make sense +
    3. the center's names for locally defined fields are not included in wgrib2 +
    4. you want to use an unofficial table +
    + +To solve this problem, you can set up user grib tables. + +

    + +https://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/user_grib2tables.html + +

    +Now the -gribtable_used option helps you set up the user +grib table. The option writes grib table entries used by a file. + +

    Usage

    +

    + +

    +-gribtable_used OUTPUT
    +     OUTPUT is a file with the grib table entries for each field
    +
    + + +

    Example

    +

    + +

    +$ wgrib2 gep19.t00z.pgrb2af180 -gribtable_used junk
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +2:46042:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    +3:63079:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    +..
    +
    +$ sort -u junk > grbtbl     (get rid of duplicate entries)
    +edit grbtbl, change UGRD to U, VGRD to V and TMP to T
    +
    +$ export grib2table=`pwd`/grbtbl      (define a user grib table)
    +
    +$ wgrib2 gep19.t00z.pgrb2af180 -match '(U|V|T)'
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +2:46042:d=2009060500:T:200 mb:180 hour fcst:ENS=+19
    +3:63079:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    +4.1:86046:d=2009060500:U:200 mb:180 hour fcst:ENS=+19
    +4.2:86046:d=2009060500:V:200 mb:180 hour fcst:ENS=+19
    +5:137483:d=2009060500:HGT:250 mb:180 hour fcst:ENS=+19
    +6:184669:d=2009060500:T:250 mb:180 hour fcst:ENS=+19
    +..
    +
    +Note: U and V will not be treated as vectors in -new_grid.  You have
    +to use -new_grid_vectors to get U and V to be vectors.
    +
    + +

    +See also: -new_grid, +-new_grid_vectors, + user_grib2tables +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + created 10/27/2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grid.html b/docs/web_docs/grid.html new file mode 100644 index 0000000..07b7cba --- /dev/null +++ b/docs/web_docs/grid.html @@ -0,0 +1,298 @@ + + + + Climate Prediction Center - wgrib2: -grid + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grid +
     
    + +

    wgrib2: -grid

    +
    + + +

    Introduction

    + +

    +The -grid option prints out the grid information. + + +

    +$ wgrib2 gep19.t00z.pgb2af180 -grid -d 1
    +1:0:grid_template=0:winds(N/S):
    +	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output WE:SN res 48
    +	lat 90.000000 to -90.000000 by 1.000000
    +	lon 0.000000 to 359.000000 by 1.000000 #points=65160
    +
    + +
    +$ wgrib2 nam.683 -grid
    +1:0:grid_template=30:winds(grid):
    +	Lambert Conformal: (1473 x 1025) input WE:SN output WE:SN res 8
    +	Lat1 12.190000 Lon1 226.541000 LoV 265.000000
    +	LatD 25.000000 Latin1 25.000000 Latin2 25.000000
    +	LatSP 0.000000 LonSP 0.000000
    +
    + +
    +$ wgrib2 .t00z.master.grb2f048 -grid -d 1
    +ebis@landing2:~/grib2_examples$ wgrib2 gfs.t00z.master.grb2f048 -grid | more
    +1:0:grid_template=40:winds(N/S):
    +	Gaussian grid: (3072 x 1536) units 1e-06 input WE:NS output WE:SN
    +	number of latitudes between pole-equator=768 #points=4718592
    +	lat 89.909340 to -89.909340
    +	lon 0.000000 to 359.882813 by 0.117188
    +
    + +
    +$ wgrib2 merc.g2 -grid -d 1
    +1:0:grid_template=10:winds(N/S):
    +	Mercator grid: (73 x 23) LatD 22.500000 input WE:SN output WE:SN res 48
    +	lat -48.090000 to 48.090000 by 513669.000000 m
    +	lon 0.000000 to 0.000000 by 513669.000000 m
    +	orientation 0.000000
    +
    + +

    +The four previous examples are for a grid definitions of a lat-lon, Lambert Conformal, +Gaussian and Mercator grids. These are the most common grids that are commonly distributed +from NCEP. Other commonly used grids are: polar stereographic, rotated lat-lon and +thinned Gaussian. Radar and satellites often use different grids. + +

    Understanding the grid definitions

    +

    +The grid definitions are based on the grib grib defintions as published +by the WMO and copied by the NCEP's grib documentation. For example, the +lat-lon grid defintion is given by + +https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-0.shtml. +Wgrib2's version of the lat-lon grid is given by +

    +$ wgrib2 gep19.t00z.pgb2af180 -grid -d 1
    +1:0:grid_template=0:winds(N/S):
    +	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output WE:SN res 48
    +	lat 90.000000 to -90.000000 by 1.000000
    +	lon 0.000000 to 359.000000 by 1.000000 #points=65160
    +
    +template=N      .. grid defintion template 3.N
    +winds(N/S)      .. winds are earth relative
    +winds(grid)     .. winds are grid relative
    +(NX x NY)       .. grid dimensions (for rectangular grid)
    +units 1e-06     .. scaling of angles, scaled angles are stored as 4-byte integers
    +input WE:NS     .. grib has the data in WE:NS scan order
    +output WE:SN    .. wgrib2 internally has the data is in WE:SN scan order
    +                   if wgrib2 writes a bin/ieee/text file, it will be in the output scan order
    +                   The output scan order has to be WE:SN for geolocation to work.
    +                   The default output scan order is WE:SN.
    +output WE:NS    .. wgrib2 internally has the data is in WE:NS scan order
    +                   The is enabled by -order we:ns, and is used for writing binary data
    +                   in WE:NS order.
    +output raw      .. wgrib2 internally has the data in the input scan order
    +                   This scan order is needed for -new_grid to work.  
    +res N           .. value of the resolution and component flags octet (byte)
    +lat X to Y by Z .. latitudes start at X goes to Y by steps of Z
    +lon X to Y by Z .. longitudes start at X goes to Y by steps of Z
    +                   note: grib2 uses longitude is in [0,360) model
    +#points N       .. number of points in the grid including grid points with undefined values
    +
    + + +

    dlat and dlon in lat-lon grids

    +An above example showed the dlat and dlon for lat-lon grids. The dlat and dlon were +saved to the nearest 1e-6 of a degree. For calculating the lat/lon of the grid points, +wgrib2 calculates a more accurate version of dlat and dlon from the end points +of the grid. For all the angle calculations, wgrib2 uses double precision. The only +exceptions is when angles are saved to rpn registers which are single precision, and if +wgrib2 is configured to call the old (single precision) iplib library. + +

    Staggered Grids, wgrib2 2.0.8+

    + +

    Staggered grids are often used in grid point (as opposed to spectral) +atmospheric models. (Arakawa, A.; Lamb, V.R. (1977). "Computational design of the +basic dynamical processes of the UCLA general circulation model". Methods in Computational Physics: +Advances in Research and Applications. 17: 173–265.) There are advantages in +storing the model grids in grib for both the modeler and the user. The advantages +are compactness, and a standard format. The user also has the advantage of +eliminating an extra interpolation step. The staggering information is stored +in the last 4 bits of flag table 3.4. If these bits are all zero, there is no +staggering. + +

    Staggered grids in GRIB work by +

      +
    1. A "fundamental" grid is defined +
    2. staggered grid could have an 0 dx offset in the X direction +
    3. or staggered grid could have an 1/2 dx offset in the X direction +
    4. or staggered grid could have 0 dx offset for odd rows and 1/2 dx for even rows (all in the X direction) +
    5. staggered grid could have an 0 dy offset in the Y direction +
    6. or staggered grid could have an 1/2 dy offset in the Y direction +
    7. staggered grid could have fewer points in the row or column if the offset is non-zero +
    + +This scheme allows encoding the Arakawa A-E Egrids. The wgrib2 -grid will show +the staggering. The storage description was updated in v2.0.8 to be +
      +
    1. nx*ny: length of the row is nx, there are ny rows +
    2. nx*(ny-1): length of the row is nx, there are ny-1 rows +
    3. trim-x*ny: length of the row is either nx or nx-1, there are ny rows +
    4. trim-x*(ny-1): length of the is either nx or nx-1, there are ny-1 rows +
    + + +

    Usage

    +

    + +

    +-grid
    +
    + +See also: +-nxny, +-nlons +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005, updated Nov 29, 2018, 5-2021, June 2024 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grid_101.html b/docs/web_docs/grid_101.html new file mode 100644 index 0000000..11c60fc --- /dev/null +++ b/docs/web_docs/grid_101.html @@ -0,0 +1,253 @@ + + + + Climate Prediction Center - wgrib2: unstructured grids (GDT=101) + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > unstructured grids (GDT=101) +
     
    + +

    Unstructured grids (GDT=101)

    +
    + + +

    Introduction

    + +

    +The grib2 standard supports unstructured grids using Grid Definition Template 101. With +unstructured grids, you can have grid points at arbitrary locations (latitude, longitude). +Each grid is uniquely identified by a Universally Unique IDentifier (UUID). (The UUID +is generated by the producer rather than being assigned by the WMO.) To save space, +the locations of the grid points are not specified in each grib message. Common +methods of specifying the locations is to create two grib message which contain +the latitude and longitude of the grid points. By using the same UUID, the user +knows the locations correpond to any (unstructured) grid identified by the same UUID. +The locations in grib format can be stored in another file or by prepending +grib locations to the various files. + +

    Latitude/Longitude prepended to the data file

    + +
    +  Consider a file, junk, created by (grid point 1: 1E, 2N), (grid point 2: 40E, 41N)
    +$ wgrib2 gep19.t00z.pgrb2af180 -new_grid location 1:2:40:41 junk
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +2:46042:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    +3:63079:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    +4.1:86046:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    +4.2:86046:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    +..
    +
    +  The file, junk, now has two fields prepended, the GEOLON and GEOLAT.
    +bash-4.1$ wgrib2  junk
    +1:0:d=2009060500:GEOLON:surface:anl:
    +2:172:d=2009060500:GEOLAT:surface:anl:
    +3:344:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +4:493:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    +5:639:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    +6:785:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    +7:931:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    +..
    +
    +The file is using GDT=101, an unstructured grid with 2 grid points
    +bash-4.1$ wgrib2 junk -grid -v2
    +1:0:grid_template=101:
    +	General Unstructured Grid grid=0 ref_grid=0 uuid=00000000-0000-0000-0000-000000000000 #points=2
    +
    +2:172:grid_template=101:
    +	General Unstructured Grid grid=0 ref_grid=0 uuid=00000000-0000-0000-0000-000000000000 #points=2
    +
    + +

    Using GDT=101 and prepended location

    + +Wgrib2 can handle the unstructured grid with a prepended location by using +the -grid_def option. The +-grid_def option associates the GEOLAT and GEOLON with +the grid locations. To see the values of the first grid point, you can do, + +
    +  To see the first grid point:
    +bash-4.1$ wgrib2 junk -if "^(1|2):" -grid_def else -s -ilat 1 -endif
    +1:0
    +2:172
    +3:344:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19:grid pt 1,lon=1.000000,lat=2.000000,val=12429.8
    +4:493:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19:grid pt 1,lon=1.000000,lat=2.000000,val=219
    +5:639:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19:grid pt 1,lon=1.000000,lat=2.000000,val=45
    +6:785:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19:grid pt 1,lon=1.000000,lat=2.000000,val=3.6
    +7:931:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19:grid pt 1,lon=1.000000,lat=2.000000,val=-4.7
    +..
    +
    +  To see the second grid point:
    +bash-4.1$ wgrib2 junk -if "^(1|2):" -grid_def -else -s -ilat 2 -endif
    +1:0
    +2:172
    +3:344:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19:grid pt 2,lon=40.000000,lat=41.000000,val=12130.2
    +4:493:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19:grid pt 2,lon=40.000000,lat=41.000000,val=218
    +5:639:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19:grid pt 2,lon=40.000000,lat=41.000000,val=32
    +6:785:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19:grid pt 2,lon=40.000000,lat=41.000000,val=4.3
    +7:931:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19:grid pt 2,lon=40.000000,lat=41.000000,val=7.2
    +..
    +
    +
    + +Uses of -new_grid location (location_list) UUID out + +The -new_grid option is usually used to transform +from one grid to another. +The -new_grid location option can be used to interpolate +from a regular grid to an arbitrary set of locations. With this option, you +can choose nearest neighbor, bilinear and under special circumstances spectral +interpolation. This new feature allows you to efficiently transform to +arbitrary locations. + +

    +See also: +-grid_def, + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grid_changes.html b/docs/web_docs/grid_changes.html new file mode 100644 index 0000000..d2938b1 --- /dev/null +++ b/docs/web_docs/grid_changes.html @@ -0,0 +1,200 @@ + + + + Climate Prediction Center - wgrib2: -grid_changes + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + count + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-cout +
     
    + +

    wgrib2: -grid_changes

    +
    + + +

    Introduction

    + +

    +The -grid_changes option is a safety option. +Normally we don't expect the grid to change within a grib file, and many +programs would fail if the grid did change. Wgrib2 will work if the +grid changes but it would work much slower. (Each grid change would +require a recalculation of the grid parameters such as the the +grid point locations if needed.) +The -grid_changes option prints +to stderr, the number of times the grid changed during processing +of the file. Only grib (sub-)messages that were processed and not +skipped by a -match or similar option will count. + +

    Usage

    +

    + +

    +-grid_changes
    +
    + +

    Example

    +

    + +

    +$ wgrib2 fcst.grb2 -bin fcst.bin -grid_changes -count
    +-sh-3.00$ wgrib2 fcst.grb2 -bin fcst.bin -grid_changes
    +1:4:d=2007032600:HGT:1000 mb:anl:
    +2:422561:d=2007032600:HGT:1000 mb:3 hour fcst:
    +Good: only one grid
    +number of records: 2
    +
    + +In the above example, we converted the file to binary. It consisted +of a single grid and two records. + +

    +See also: +count +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Sep 13, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grid_def.html b/docs/web_docs/grid_def.html new file mode 100644 index 0000000..36fbb64 --- /dev/null +++ b/docs/web_docs/grid_def.html @@ -0,0 +1,301 @@ + + + + Climate Prediction Center - wgrib2: -grid_def + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grid_def +
     
    + +

    wgrib2: -grid_def

    +
    + + +

    Introduction

    + +

    When wgrib2 processes a field, it often calculates the longitude +and latitude (location) of each grid point. Wgrib2 doesn't do the calculation +when one of the following conditions are true +

      +
    1. the locations of the grid points are not needed by any of the options +
    2. the grid is the same as the previously processed grib message +
    3. wgrib2 does not know how to calculate the locations +
    + +

    +For some grids, wgrib2 does not know how to calculate the grid locations +and the grid locations are available from the center in the form of grib files. +Then you can use the -grid_def to add the grid +locations for wgrib2 processing. +The option, -grid_def checks to see if the grib message +is a longitude or latitude. If it is, the longitude or latitude is associated +with the longitude or latitude of the grid points. +Because of "2", wgrib2 will use these longitudes +or latitudes for the following fields until wgrib2 encountours a different +grid. + + +

    wgrib2 up to v2.0.5

    +

    Bug in the -grid_def option only allows +the option to work with grids with calculated grid locations. +(Passed testing but not that useful.) + +

    wgrib2 v2.0.6, v2.0.7

    + +
      +
    1. LOUV, LOPP or ELON will associate the data with the longitudes +
    2. LAUV, LAPP or NLAT will associate the data with the latitudes +
    + +

    wgrib2 v2.0.8+

    +
      +
    1. LOUV, LOPP, ELON or GEOLON will associate the data with the longitudes +
    2. LAUV, LAPP, NLAT or GEOLAT will associate the data with the latitudes +
    + + +

    wgrib2 v3.0.0+

    +With wgrib2 v3.0.0 can associated latitudes and longitudes using -rpn +and the "sto_lat" and "sto_lon" options. You can import double precision +lat and lons using -import_lonlat. + +

    Precision of the latitudes and longitudes

    +By default, grib2 stores angles to the millionth of a degree. This +requires the angles to be stored in double precision. Reading the +latitudes and longitudes in grib format could be done in double +precision but the current decoder is limited to 25 bits which is +basically single precision. If you need double precision lat and lon +values, use -import_lonlat. + +

    +

    Usage

    +
    +-grib_def
    +  will alter the latitude or longitudes associated with the grid points
    +  when the variable is a latitude or longitude field
    +

    + +

    Example

    + +For -grid_def to work, the latitude and longitudes have +processed prior the to remaining grids. The file, icon.grb, satifies this requirement. + +
    +$ 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:
    +
    + +An additional requirement is the grids be the same. +
    +$ wgrib2 icon.grb -grid
    +1:0:grid_template=101:
    +	General Unstructured Grid grid=26 ref_grid=1 uuid=a27b8de6-18c4-11e4-820a-b5b098c6a5c0
    +
    +2:5898409:grid_template=101:
    +	General Unstructured Grid grid=26 ref_grid=1 uuid=a27b8de6-18c4-11e4-820a-b5b098c6a5c0
    +
    +3:11796818:grid_template=101:
    +	General Unstructured Grid grid=26 ref_grid=1 uuid=a27b8de6-18c4-11e4-820a-b5b098c6a5c0
    +
    +

    +A more precise method of identifying identical grids is by + +

    +$ wgrib2 icon.grb -checksum 3     (Section 3 is the grid defininition template)
    +1:0:sec3_cksum=470959557
    +2:5898409:sec3_cksum=470959557
    +3:11796818:sec3_cksum=470959557
    +
    + +Using wgrib2 v3.0.0+, we can get a 2x2 degree lat-lon grid by, + +
    +$ wgrib2 icon.grb -grid_def -not_if ":GEO(LAT|LON):" -s -lola 0:180:2 -90:91:2 lola.grb grib -endif
    +1:0
    +2:5898409
    +3:11796818:d=2019040900:TMP:2 m above ground:0-6 hour max fcst:
    +bash-4.1$ wgrib2 lola.grb -s -grid
    +1:0:d=2019040900:TMP:2 m above ground:0-360 min max fcst::grid_template=0:winds(N/S):
    +	lat-lon grid:(180 x 91) units 1e-06 input WE:SN output WE:SN res 48
    +	lat -90.000000 to 90.000000 by 2.000000
    +	lon 0.000000 to 358.000000 by 2.000000 #points=16380
    +
    +The -not_if is used so that GEOLAT and GEOLON fields are not interpolated.
    +
    + +For wgrib2 up to v2.0.6 and, -grid_def did not recognize GEOLAT and GEOLON. +As a result, the location had to be converted to NLAT and ELON which are +recognized. NLAT and ELON are NCEP local variables, so the center has to +be changed to 7 which is NCEP by the GRIB standard. + +
    +$ 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 ":GEO(LAT|LON):" -s -lola '0:180:2' '-90:91:2' lola.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::d=2019040900:TMP:local level type 103 2:0-6 hour max fcst:
    +
    +

    With wgrib2 v3.0.0, you can also use -rpn to update the latitude and +longitudes. + +

    +$ wgrib2 icon.grb icon.grb -if ":GEOLAT:" -rpn sto_lat -endif -if ":GEOLON:" -rpn sto_lon -endif \
    +  -not_if ":GEO(LAT|LON):" -s -lola "0:180:2" "-90:91:2" lola.grb grib -endif
    +
    +
    +See also: 
    +-rpn
    +
    +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: April 10, 2019 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/grid_id.html b/docs/web_docs/grid_id.html new file mode 100644 index 0000000..9e0e0f9 --- /dev/null +++ b/docs/web_docs/grid_id.html @@ -0,0 +1,171 @@ + + + + Climate Prediction Center - wgrib2: -grid_id + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grid_id +
     
    + +

    wgrib2: -grid_id

    +
    + + +

    Introduction

    + +

    +The option, -grid_id, is for the development +of the Proj4 interface. This option may change or disappear +in future versions of wgrib2. +

    + +See also: + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 30, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/gridout.html b/docs/web_docs/gridout.html new file mode 100644 index 0000000..3491ad5 --- /dev/null +++ b/docs/web_docs/gridout.html @@ -0,0 +1,203 @@ + + + + Climate Prediction Center - wgrib2: -gridout + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-gridout +
     
    + +

    wgrib2: -gridout

    +
    + + +

    Introduction

    + +

    +Many grib message contain grids of the following form: grid_val(NX,NY), +longitude(NX,NY) and latitude(NX,NY). Common exceptions are spectral +data, thinned grids and staggered grids. If the grib message is +of the first form, then you can use the -gribout +option to print out i, j, latitude(i,j), longitude(i,j) + +

    +

    Usage

    +

    +

    +-gridout FILE
    +   FILE is an output of the command
    +   if grid is of the form: grid_val(nx,ny), lat(nx,ny), lon(nx,ny)
    +     print ((i, j, lat(i,j), lon(i,j), i=1,nx), j=1,ny)
    +     using the format "%10i,%10i, %.3f, %.3f\n"
    +
    +     FILE will be a CSV file with the latitudes and longitudes of the grid points
    +
    + + +

    Example

    +
    +$ wgrib2 small.grb2 -grid
    +1:0:grid_template=0:winds(N/S):
    +	lat-lon grid:(2 x 2) units 1e-06 input WE:SN output WE:SN res 48
    +	lat 20.000000 to 28.000000 by 8.000000
    +	lon 0.000000 to 10.000000 by 10.000000 #points=4
    +$ wgrib2 small.grb2 -gridout grid.txt
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +$ cat grid.txt
    +         1,         1, 20.000, 0.000
    +         2,         1, 20.000, 10.000
    +         1,         2, 28.000, 0.000
    +         2,         2, 28.000, 10.000
    +
    + +

    +See also: +-grid, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 27, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/h.html b/docs/web_docs/h.html new file mode 100644 index 0000000..873054d --- /dev/null +++ b/docs/web_docs/h.html @@ -0,0 +1,205 @@ + + + + Climate Prediction Center - wgrib2: -h + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-h +
     
    + +

    wgrib2: -h

    +
    + + +

    Introduction

    + +

    +The -h option lists the common options. + +

    +-sh-2.05b$ ./wgrib2 -h
    +wgrib2 v0.1.6 1/2008 wesley ebisuzaki, Jaakko Hyvätti, Karl Pfeiffer, Manfred Schwarb, Kristian Nilssen, Sergey Varlamov
    + -0xSec           inv  X      Hex dump of section X (0..8)
    + -bitmap          inv         bitmap mode
    + -center          inv         center
    + -ctl_inv         inv         ctl inventory dump (for g2ctl)
    + -disc            inv         discipline (code table 0.0)
    + -domain          inv         max limit for n/s/e/w
    + -ens             inv         ensemble information
    + -ftime           inv         forecast time
    + -grid            inv         grid definition
    + -ij              inv  X Y    value of field at grid(X,Y) X=1,..,nx Y=1,..,ny
    + -ijlat           inv  X Y    lat,lon and grid value at grid(X,Y) X=1,..,nx Y=1,..,ny
    + -ilat            inv  X      lat,lon and grid value at Xth grid point, X=1,..,npnts
    + -lev             inv         level (code table 4.5)
    + -lev0            inv         level (for g2ctl)
    + -lola            inv  X..Z,A lon-lat grid values X=lon0:nlon:dlon Y=lat0:nlat:dlat Z=file A=[bin|text|spread]
    + -lon             inv  X Y    value at grid point nearest lon=X lat=Y
    + -max             inv         print maximum value
    + -min             inv         print minimum value
    + -MM              inv         month
    + -N_ens           inv         number of ensemble members
    + -nl              inv         inserts new line into inventory
    + -nlons           inv         number of longitudes for each latitude
    + -npts            inv         number of grid points
    + -nxny            inv         nx and ny of grid
    + -packing         inv         data packing mode
    +[rest is deleted]
    +
    + + +

    Usage

    +

    + +

    +-h
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/header.html b/docs/web_docs/header.html new file mode 100644 index 0000000..14832d1 --- /dev/null +++ b/docs/web_docs/header.html @@ -0,0 +1,198 @@ + + + + Climate Prediction Center - wgrib2: -header + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-header/no_header +
     
    + +

    wgrib2: -header, -no_header

    +
    + + +

    Introduction

    + +

    +The -header and +-no_header options +sets and clears the header flag. When the +header flag is set, binary and ieee is read and written +using f77-style header and trailers. +When a text file (as opposed to spread sheet or csv) is written, +a preliminary line with the grid dimension, "nx ny", +is written. The default is -header. + + +

    Usage

    +

    + +

    +-header
    +-no_header
    +
    + +

    Example

    +

    + +

    +$ wgrib2 -ens ens.grb -header -ieee data.ieee
    +1:0:HGT:ENS=+1
    +
    + +See also: +-no_header, +-big_endian, +-little_endian, +-ieee, +-bin, +-import_ieee, +-import_bin +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/help.html b/docs/web_docs/help.html new file mode 100644 index 0000000..9b56006 --- /dev/null +++ b/docs/web_docs/help.html @@ -0,0 +1,224 @@ + + + + Climate Prediction Center - wgrib2: -help + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-help +
     
    + +

    wgrib2: -help

    +
    + + +

    Introduction

    + +

    +The -help options list the commands that match your query. For example, +suppose you want options that deal with time, then you would use the "-help time" option. +

    +$ wgrib2 -help time
    +wgrib2 v0.2.0.3beta3 10/2015 Wesley Ebisuzaki, Reinoud Bokhorst, John Howard, Jaakko Hyvätti, Dusan Jovic, 
    +Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Arlindo da Silva, Niklas Sondell, Sergey Varlamov
    +   stock build
    + -code_table_1.2  inv         code table 1.2 significance of reference time
    + -code_table_4.11 inv         code table 4.11 (first) type of time intervals
    + -code_table_4.11s inv         code table 4.11 (all) type of time intervals
    + -end_ft          inv         verf time = reference_time + forecast_time + stat. proc time (YYYYMMDDHH) (same as -vt)
    + -end_FT          inv         verf time = reference_time + forecast_time + stat. proc time (YYYYMMDDHHMMSS) (same as -VT)
    + -ftime           inv         forecast time
    + -MM              inv         reference time MM
    + -pds_fcst_time   inv         fcst_time(1) in units given by pds
    + -RT              inv         type of reference Time
    + -start_ft        inv         verf time = reference_time + forecast_time (YYYYMMDDHH) : no stat. proc time
    + -start_FT        inv         verf time = reference_time + forecast_time (YYYYMMDDHHMMSS) - no stat. proc time
    + -t               inv         reference time YYYYMMDDHH, -v2 for alt format
    + -T               inv         reference time YYYYMMDDHHMMSS
    + -unix_time       inv         print unix timestamp for rt & vt
    + -verf            inv         simple inventory using verification time
    + -vt              inv         verf time = reference_time + forecast_time, -v2 for alt format
    + -VT              inv         verf time = reference_time + forecast_time (YYYYMMDDHHMMSS)
    + -YY              inv         reference time YYYY
    + -count           misc        prints count, number times this -count was processed
    + -end             misc        stop after first (sub)message (save time)
    + -quit            misc        stop after first (sub)message (save time)
    + -set_ftime       misc X      set ftime
    + -set_ts_dates    misc X Y Z  changes date code for time series X=YYYYMMDDHH(mmss) Y=dtime Z=#msgs/date
    + -ave             out  X Y    average X=time step, Y=output grib file needs file is special order
    + -fcst_ave        out  X Y    average X=time step, Y=output grib file needs file is special order
    + -nc_grads        init        require netcdf file to be grads v1.9b4 compatible (fixed time step only)
    + -nc_nlev         init X      netcdf, X = max LEV dimension for {TIME,LEV,LAT,LON} data
    + -nc_time         init X      netcdf, [[-]yyyymmddhhnnss]:[dt{s[ec]|m[in]|h[our]|d[ay]}], [-] is for time alignment only
    + -no_nc_grads     init        netcdf file may be not grads v1.9b4 compatible, variable time step
    + -no_nc_time      init        netcdf, disable previously defined initial or relative date and time step
    +
    + + +

    Usage

    +

    +

    +-help search-term
    +-help all
    +
    + +

    Example

    +
    +$ wgrib2 -help speed
    +wgrib2 v0.2.0.5beta5 6/2016  Wesley Ebisuzaki, Reinoud Bokhorst, John Howard, Jaakko Hyvätti, Dusan Jovic, Daniel Lee, 
    +Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Gregor Schee, Arlindo da Silva, Niklas Sondell, 
    +Sam Trahan, Sergey Varlamov
    +   stock build
    + -mysql_speed     out  7 args H=[host] U=[user] P=[password] D=[db] T=[table] W=[western_lons:0|1] PV=[remove unlikely:0|1]
    + -wind_speed      out  X      calculate wind speed, X = output gribfile (U then V in datafile)
    +
    + +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 27, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/i.html b/docs/web_docs/i.html new file mode 100644 index 0000000..d0cd62e --- /dev/null +++ b/docs/web_docs/i.html @@ -0,0 +1,319 @@ + + + + Climate Prediction Center - wgrib2: -i -i_file + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-i -i_file +
     
    + +

    wgrib2: -i, -i_file

    +
    + + +

    Introduction

    + +

    +The -i option specifies that wgrib2 should read +STDIN to determine the records to be processed. +The -i_file option is similar except that +wgrib2 reads file a user-specified file to determine the records to be processed. +Some +of the common uses of -i can also be +done with the -match option. + +

    Slicing and Dicing

    +

    +Wgrib2 is a program to "slice and dice" grib2 files. Suppose you have a big grib file +but you only want the 2-meter temperature and the precipitation. Rather than fill up +your disk with big files, you can easily extract the required fields. + +

    +The first step is to figure what is in the grib file. + +

    +-sh-2.05b$ wgrib2 test.grb2 -s
    +1:0:d=2005090200:HGT:1000 mb:60 hour fcst
    +2:133907:d=2005090200:HGT:975 mb:60 hour fcst
    +3:263511:d=2005090200:HGT:950 mb:60 hour fcst
    +4:389058:d=2005090200:HGT:925 mb:60 hour fcst
    +5:511037:d=2005090200:HGT:900 mb:60 hour fcst
    +6:630256:d=2005090200:HGT:850 mb:60 hour fcst
    +7:745505:d=2005090200:HGT:800 mb:60 hour fcst
    +....
    +291:37540403:d=2005090200:GPA:1000 mb:60 hour fcst
    +292:37677072:d=2005090200:GPA:500 mb:60 hour fcst
    +293:37791941:d=2005090200:5WAVA:500 mb:60 hour fcst
    +
    + +

    +Information overload. Lets see if you can find the desired variables. + +

    +-sh-2.05b$ wgrib2 test.grb2 -s | grep ':TMP:2 m'
    +265:35107588:d=2005090200:TMP:2 m above ground:60 hour fcst
    +
    +Found the 2-m temperature, can we find the precipitation? +
    +-sh-2.05b$ wgrib2 test.grb2 -s | grep ':PRATE:'
    +260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    +
    + +Yes. we found the fields. Now we need to combine the above into a +single command using the or option of egrep; i.e., egrep '(A|B)'. + +
    +-sh-2.05b$ wgrib2 test.grb2 -s | egrep '(:TMP:2 m|:PRATE:)'
    +260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    +265:35107588:d=2005090200:TMP:2 m above ground:60 hour fcst
    +
    + +Now that we have selected the records, we can send the output (inventory) back +into wgrib2 to manipulate. + +
    +-sh-2.05b$  wgrib2 test.grb2 -s | egrep '(:TMP:2 m|:PRATE:)' | wgrib2 -i test.grb2 -grib small.grb
    +260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    +265:35107588:d=2005090200:TMP:2 m above ground:60 hour fcst
    +
    +The above command made a grib2 file consisting of the precipation (PRATE) and 2-m temperature (TMP). +
    +-sh-2.05b$ ls -l test.grb2 small.grb
    +-rw-r--r--    1 wd51we   wd5        212429 2006-10-16 15:08 small.grb
    +-rwxr-xr-x    1 wd51we   wd5      37862776 2006-05-25 15:16 test.grb2
    +
    +As you can see, the new file is much smaller than the original file. + +
    +-sh-2.05b$  wgrib2 small.grb
    +1:0:d=2005090200:PRATE:surface:54-60 hour fcst
    +2:110654:d=2005090200:TMP:2 m above ground:60 hour fcst
    +
    + +As expected, the new grib file only has the desired two fields. + +

    Decoding a Single record

    + +

    Another use of the -i option is to specify the field to decode. + +

    +-sh-2.05b$ wgrib2 test.grb2 -s | grep ':PRATE:' | wgrib2 -i test.grb2 -spread field.txt
    +260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    +-sh-2.05b$ head field.txt
    +lon,lat,PRATE surface d=2005090200 54-60 hour fcst
    +0,-90,5e-06
    +0.5,-90,5e-06
    +1,-90,5e-06
    +1.5,-90,5e-06
    +2,-90,5e-06
    +2.5,-90,5e-06
    +3,-90,5e-06
    +3.5,-90,5e-06
    +4,-90,5e-06
    +
    + +

    -i_file

    + +The -i_file MY_FILE option reads the inventory from +file, MY_FILE. The following 3 lines are equivalent. + +
    +cat FILE.inv | grep UGRD | wgrib2 -i FILE.grb -bin data.bin
    +
    +cat FILE.inv | wgrib2 -i FILE.grb -match UGRD -bin data.bin
    +
    +wgrib2 -i_file FILE.inv FILE.grb -match UGRD -bin data.bin 
    +
    + +

    Usage

    +

    + +

    +-i
    +-i_file FILE
    +
    + +

    Speed

    + +

    +The following command is very common so it incorporated +within wgrib2. This speeds up the operation by eliminating +two program executions and duplicate reads. + +

    +wgrib2 gribfile | grep "string" | wgrib2 -i gribfile (other options)
    +
    +is equivalent to 
    +
    +wgrib2 gribfile -match "string" (other options)
    +
    + +However, the -i option can be more efficient +when making multiple extractions from a file. For example, + +
    +wgrib2 gribfile >gribfile.inv
    +grep "string1" gribfile.inv | wgrib2 -i gribfile (other options)
    +grep "string2" gribfile.inv | wgrib2 -i gribfile (other options)
    +grep "string3" gribfile.inv | wgrib2 -i gribfile (other options)
    +
    +is faster than
    +
    +wgrib2 gribfile -match "string1" (other options)
    +wgrib2 gribfile -match "string2" (other options)
    +wgrib2 gribfile -match "string3" (other options)
    +
    + +

    +See also: +-match, +-not, +-d, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/i_file.html b/docs/web_docs/i_file.html new file mode 100644 index 0000000..d0cd62e --- /dev/null +++ b/docs/web_docs/i_file.html @@ -0,0 +1,319 @@ + + + + Climate Prediction Center - wgrib2: -i -i_file + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-i -i_file +
     
    + +

    wgrib2: -i, -i_file

    +
    + + +

    Introduction

    + +

    +The -i option specifies that wgrib2 should read +STDIN to determine the records to be processed. +The -i_file option is similar except that +wgrib2 reads file a user-specified file to determine the records to be processed. +Some +of the common uses of -i can also be +done with the -match option. + +

    Slicing and Dicing

    +

    +Wgrib2 is a program to "slice and dice" grib2 files. Suppose you have a big grib file +but you only want the 2-meter temperature and the precipitation. Rather than fill up +your disk with big files, you can easily extract the required fields. + +

    +The first step is to figure what is in the grib file. + +

    +-sh-2.05b$ wgrib2 test.grb2 -s
    +1:0:d=2005090200:HGT:1000 mb:60 hour fcst
    +2:133907:d=2005090200:HGT:975 mb:60 hour fcst
    +3:263511:d=2005090200:HGT:950 mb:60 hour fcst
    +4:389058:d=2005090200:HGT:925 mb:60 hour fcst
    +5:511037:d=2005090200:HGT:900 mb:60 hour fcst
    +6:630256:d=2005090200:HGT:850 mb:60 hour fcst
    +7:745505:d=2005090200:HGT:800 mb:60 hour fcst
    +....
    +291:37540403:d=2005090200:GPA:1000 mb:60 hour fcst
    +292:37677072:d=2005090200:GPA:500 mb:60 hour fcst
    +293:37791941:d=2005090200:5WAVA:500 mb:60 hour fcst
    +
    + +

    +Information overload. Lets see if you can find the desired variables. + +

    +-sh-2.05b$ wgrib2 test.grb2 -s | grep ':TMP:2 m'
    +265:35107588:d=2005090200:TMP:2 m above ground:60 hour fcst
    +
    +Found the 2-m temperature, can we find the precipitation? +
    +-sh-2.05b$ wgrib2 test.grb2 -s | grep ':PRATE:'
    +260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    +
    + +Yes. we found the fields. Now we need to combine the above into a +single command using the or option of egrep; i.e., egrep '(A|B)'. + +
    +-sh-2.05b$ wgrib2 test.grb2 -s | egrep '(:TMP:2 m|:PRATE:)'
    +260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    +265:35107588:d=2005090200:TMP:2 m above ground:60 hour fcst
    +
    + +Now that we have selected the records, we can send the output (inventory) back +into wgrib2 to manipulate. + +
    +-sh-2.05b$  wgrib2 test.grb2 -s | egrep '(:TMP:2 m|:PRATE:)' | wgrib2 -i test.grb2 -grib small.grb
    +260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    +265:35107588:d=2005090200:TMP:2 m above ground:60 hour fcst
    +
    +The above command made a grib2 file consisting of the precipation (PRATE) and 2-m temperature (TMP). +
    +-sh-2.05b$ ls -l test.grb2 small.grb
    +-rw-r--r--    1 wd51we   wd5        212429 2006-10-16 15:08 small.grb
    +-rwxr-xr-x    1 wd51we   wd5      37862776 2006-05-25 15:16 test.grb2
    +
    +As you can see, the new file is much smaller than the original file. + +
    +-sh-2.05b$  wgrib2 small.grb
    +1:0:d=2005090200:PRATE:surface:54-60 hour fcst
    +2:110654:d=2005090200:TMP:2 m above ground:60 hour fcst
    +
    + +As expected, the new grib file only has the desired two fields. + +

    Decoding a Single record

    + +

    Another use of the -i option is to specify the field to decode. + +

    +-sh-2.05b$ wgrib2 test.grb2 -s | grep ':PRATE:' | wgrib2 -i test.grb2 -spread field.txt
    +260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    +-sh-2.05b$ head field.txt
    +lon,lat,PRATE surface d=2005090200 54-60 hour fcst
    +0,-90,5e-06
    +0.5,-90,5e-06
    +1,-90,5e-06
    +1.5,-90,5e-06
    +2,-90,5e-06
    +2.5,-90,5e-06
    +3,-90,5e-06
    +3.5,-90,5e-06
    +4,-90,5e-06
    +
    + +

    -i_file

    + +The -i_file MY_FILE option reads the inventory from +file, MY_FILE. The following 3 lines are equivalent. + +
    +cat FILE.inv | grep UGRD | wgrib2 -i FILE.grb -bin data.bin
    +
    +cat FILE.inv | wgrib2 -i FILE.grb -match UGRD -bin data.bin
    +
    +wgrib2 -i_file FILE.inv FILE.grb -match UGRD -bin data.bin 
    +
    + +

    Usage

    +

    + +

    +-i
    +-i_file FILE
    +
    + +

    Speed

    + +

    +The following command is very common so it incorporated +within wgrib2. This speeds up the operation by eliminating +two program executions and duplicate reads. + +

    +wgrib2 gribfile | grep "string" | wgrib2 -i gribfile (other options)
    +
    +is equivalent to 
    +
    +wgrib2 gribfile -match "string" (other options)
    +
    + +However, the -i option can be more efficient +when making multiple extractions from a file. For example, + +
    +wgrib2 gribfile >gribfile.inv
    +grep "string1" gribfile.inv | wgrib2 -i gribfile (other options)
    +grep "string2" gribfile.inv | wgrib2 -i gribfile (other options)
    +grep "string3" gribfile.inv | wgrib2 -i gribfile (other options)
    +
    +is faster than
    +
    +wgrib2 gribfile -match "string1" (other options)
    +wgrib2 gribfile -match "string2" (other options)
    +wgrib2 gribfile -match "string3" (other options)
    +
    + +

    +See also: +-match, +-not, +-d, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ieee.html b/docs/web_docs/ieee.html new file mode 100644 index 0000000..c80f0e6 --- /dev/null +++ b/docs/web_docs/ieee.html @@ -0,0 +1,221 @@ + + + + Climate Prediction Center - wgrib2: -ieee + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ieee +
     
    +

    wgrib2: -ieee

    + +

    Introduction

    + +

    +The -ieee option writes the grid values to a specified +file in IEEE format (C: float, Fortran: real). The default endian is "big", +but that can be changed by the + -big_endian and + -little_endian options. +

    +

    +By default, the data are written out in +WE:SN order (see -order option) with f77 header/trailer (see -no_header option). The +undefined value is 9.999e20. The output format is unchanged from wgrib except +the order can now be specified. + +

    The default is to write a 4 byte header and trailer with the record size in bytes. +No header and trailer are written if the header flag is off by +the -no_header option. + +

    The default is write the grid point data in WE:SN order. The ordering of the data +can be changed to raw or WE:NS by the -order option. + +

    The default endian of the header, trailer and data are in big endian order. This can +be changed to little endian by the -little_endian option. + +

    The -ieee option is slower than the -bin option and may not be exact on an ieee +machine because all grid point data is converted from the native format into ieee format +by a software routine. + +

    Usage

    +

    + +

    +-ieee file_name
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -s | grep ":RH:2 m" | wgrib2 -i test.grb2 -ieee data.bin
    +285:36796469:d=2005090200:RH:2 m above ground:60 hour fcst
    +
    + +The above line extracts the 2 meter RH from file test.grb2 and writes it in data.bin + +
    +
    +      wgrib                ==>                 wgrib2
    +
    +      -header -ieee -o out.bin                 -header -order raw -ieee out.bin
    +      -ieee -o out.bin                         -order raw -ieee out.bin
    +
    +
    + + +

    +See also: -text, +-netcdf +-spread +-bin +-big_endian +-little_endian +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005, March 2, 2021. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/if.html b/docs/web_docs/if.html new file mode 100644 index 0000000..d10601a --- /dev/null +++ b/docs/web_docs/if.html @@ -0,0 +1,329 @@ + + + + Climate Prediction Center - wgrib2: -if, -not_if + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -if,-not_if +
     
    + +

    wgrib2: -if, -not_if

    +
    + + +

    Introduction IF block structure

    + +

    +The -if option returns either true or false. What happens +next depends on whether you are using Version 1 or Version 2 of the "If blocks". +Prior to wgrib2 v3.0.0, you only get Version 1. With wgrib2 3.0.0+, you can use +either Version 1 or 2 but not both at the same time. + +

    Version 1 If blocks

    + +

    +For Version 1 "IF blocks", the -if option returns true or false. If true, then +all the options up to and including the next "output" option are executed. If false, then +all the options up to and including the next "output" option are not executed. Options following +the output option are executed as normal.With Version 1, nesting of IF blocks is not defined. The +option -fi is a NULL output option. Note that -fi +cannot be used in Version 2 "IF blocks". +

    Definition

    +
    +    wgrib2 (...) [if] [list of non-ouput options] [output option]
    +
    +   [if] = -if, -not_if, -if_fs, -not_if_fs, -if_n, -if_rec
    +
    +   if [if] returns the value of false, the list of non-output options
    +                                       and the next output option are not executed
    +           returns the value of true, the following options are executed
    +   [output option] is the terminator of the if block
    +
    +   If blocks should not be nested. The results are undefined.
    +
    + +

    Example

    +
    +     wgrib2 gribfile -if ":(UGRD|VGRD):" -grib winds.grb \
    +                     -if ":TMP:" -grib tmp.grb \
    +                     -if ":HGT:" -grib hgt.grb \
    +                     -not_if ":(UGRD|VGRD|TMP|HGT):" -grib rest.grb
    +
    +     note: -grib is an output option
    +
    +     wgrib2 gribfile -new_grid_interpolation bilinear \
    +        -if ":SOTYP:" -new_grid_interpolation neighbor -fi \
    +        ...
    +
    +     note: -fi is an output option
    +
    + + +

    Version 2 IF blocks (introduced wgrib2 v3.0.0)

    + +

    For Version 2 of the IF blocks, wgrib2 uses +-if, -elseif, -else and +-endif options to implement a proper IF blocking structure. IF blocks +can be nested. Note, the "if" flag is reset prior to processing of a record. + +

    Definition

    + +
    +1. The if blocks can now be nested, and are terminated by an -endif.
    +2. Within the if block, you can have -else and -elseif options.
    +3. The -elseif options must proceed the -else option.
    +4. The -fi option is not allowed.
    +5. Version 1 and Version 2 if blocks cannot be mixed.
    +
    + +

    Example 1

    + +
    +     wgrib2 gribfile -if ":(UGRD|VGRD):" -grib winds.grb \
    +                     -elseif ":TMP:" -grib tmp.grb \
    +                     -elseif ":HGT:" -grib hgt.grb \
    +                     -else -grib rest.grb -endif
    +
    +     wgrib2 gribfile -new_grid_interpolation bilinear \
    +        -if ":SOTYP:" -new_grid_interpolation neighbor -endif \
    +        ...
    +
    + +

    Example 2

    + +The SNOHF and Clear Sky radienaces were converted from the nemsio file as +an instantaneous forecast rather an average. (A problem with the nemsio +file.) So I needed to change the +grib files. The new IF blocks make the code look readable. The old +IF blocks would be a mess. + +
    +# bash: fix SNOHF and CS(radiances) timing info
    +for f in *.grb
    +do
    +  wgrib2 $f \
    +    -if "(:SNOHF:|:CS)" \
    +      -if ":3 hour fcst:" -set_ftime "0-3 hour ave fcst" -endif  \
    +      -if ":6 hour fcst:" -set_ftime "3-6 hour ave fcst" -endif  \
    +      -if ":9 hour fcst:" -set_ftime "6-9 hour ave fcst" -endif \
    +      -if ":12 hour fcst:" -set_ftime "9-12 hour ave fcst" -endif \
    +      -if ":15 hour fcst:" -set_ftime "12-15 hour ave fcst" -endif \
    +    -endif \
    +    -grib ../test/$f
    +done
    +
    + +

    + +

    Limitations

    + +

    The Version 1 limits, +the maximum number of -if options on a command +line is limited by (1) system limit of open files +(2) maximum length of a command line, +(3) maximum number of regular expressions allowed MAX_MATCH (wgrib.h), +and (4) maximum number of parsed arguments N_ARGLIST (wgrib.h). + +

    The Version 2 limits include the Version 1 limits and include a limit +of the number of nested IF blocks (10). + +

    Version 1 and Version 2 IF blocks cannot be mixed. The +-fi option is restricted to Version 1 IF blocks. +There are NO plans to eliminate Version 1 IF blocks. However, +Version 2 IF blocks are recommended for future development. + +

    Introduction -if and -not_if

    + +

    Usage

    +

    + +

    +-if X
    +
    +X is a regular expression
    +sets the "run_flag" if X matches the "match inventory",
    +used to control the execution of following options
    +
    + +

    Future Changes

    +

    +The format of the "match inventory" has evolved and will continue to evolve. +The rule for future changes is that new items in the "match inventory" will be added +as the second last item. Consequently the last item in the inventory will always +be ":vt=YYYYMMDDHH:". In order to future proof your +-match, and -not selections, you +must not include any item before the ":vt=YYYYMMDD:" field. + +

    +    -match ":vt=2011111500:"                  good
    +    -not ":vt=2011111500:$"                   good (dollar sign matches the end of the line)
    +    -not ":n=10:vt=2011111500:"               bad (item before :vt=)
    +    -match ":RH:975 mb:anl::vt=2010050806:"   bad (item before :vt=)
    +
    + +Some recent changes (as of Nov 2011) to the match inventory include: + +
      +
    • adding the "extended name of the variable", ex. TMP.prob_<273 +
    • adding the inventory number, ex. n=10 +
    • adding ensemble/chemical/probability information (-misc) +
    + + +

    +See also: -not, +-end, +-match, +-i, +-if. +-if_fs. +-fi. +-set_regex. +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005, March 18, 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/if_block.html b/docs/web_docs/if_block.html new file mode 100644 index 0000000..e8ce92e --- /dev/null +++ b/docs/web_docs/if_block.html @@ -0,0 +1,216 @@ + + + + Climate Prediction Center - wgrib2: IF block structure + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 IF block structure +
     
    + +

    wgrib2: IF block structure

    + +

    Introduction IF block structure

    + +

    +Wgrib2 (v3.0.0+) has an IF block structure for conditional execution. The +block structure is + +

    +  IF-option
    +    r_options
    +  ELSE-IF-option    |   can be repeated 0-N times
    +    r_options       |
    +  ELSE-option           |   optional
    +    r_options           |
    +  ENDIF-option
    +
    +
    +IF-option: -if, -if_fs, -if_n, -if_rec, -if_reg, -not_if, -not_if_fs
    +ELSE-IF-option: -elseif, -elseif_fs, -elseif_n, -elseif_rec, -elseif_reg
    +ELSE-option: -else
    +ENDIF-option: -endif
    +r_options: may not include: -fi
    +           should not include setup (init) options
    +             setup (init) options are executed prior to reading the grib data
    +             and ignore the IF-options, ELSE-IF-options, ELSE-options and 
    +             ENDIF-options
    +           may include IF-BLOCKS 
    +
    +Maybe I should have used Backus-Naur form (BNF) to describe the IF block structure.
    +
    +The IF blocks can be nested up to 10 blocks deep.
    +
    + +

    +The version 1 of the IF block structure is even easier. + + +

    +  IF-option
    +  r_options
    +  o_option
    +
    +IF-option: -if, -if_fs, -if_n, -if_rec, -if_reg, -not_if, -not_if_fs
    +r_option: may not include: IF-option, o_option
    +           should not include setup (init) options
    +             setup (init) options are executed prior to reading the grib data
    +             and are executed ignoring the IF-options
    +o_option: an output option
    +
    + +While version 1 is compatible with wgrib2 v3.0.0+, it is recommended that you +adopt version 2 IF blocks because it is more powerful and easier to understand. + +

    +See also: +-endif, +-if. +-else. +

    + + + + + + + + +

    + + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page: March 16, 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/if_delayed_error.html b/docs/web_docs/if_delayed_error.html new file mode 100644 index 0000000..6ad34f8 --- /dev/null +++ b/docs/web_docs/if_delayed_error.html @@ -0,0 +1,217 @@ + + + + Climate Prediction Center - wgrib2: -if_delayed_error + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -if_delayed_error +
     
    + +

    wgrib2: -if_delayed_error

    +
    + + +

    Introduction

    + +

    +Wgrib2 v3.0.1 introduces delayed errors. The (-if_delayed_error) allows you +to check the delayed error flag and perhaps run a process to fixed the delayed errors. +Unlike most -if options, there isn't an equivalent +-elseif_delayed_error option. +

    +If you are interested in writting an "if" option for wgrib2, the source code, If_delayed_error.c, +is an ideal example. + +

    Example

    + + +fields with delayed errors will have the full inventory printed + +$ wgrib2 bad_n_header.grb2 -if_delayed_error -s -endif -reset_delayed_error +1:0:delayed_error=0 +2:154212:delayed_error=0 +3:308556:delayed_error=0 +4:311920:delayed_error=0 +5:312107:delayed_error=0 +6:324894:delayed_error=0 +7:325081:delayed_error=0 +8:330180:delayed_error=0 +9:345421:delayed_error=0 +10:401570:delayed_error=0 +11:401757:delayed_error=0 +12:401944:delayed_error=0 +13:477882:delayed_error=0 +14:615677:delayed_error=0 +15:803947:delayed_error=0 +16:899104:delayed_error=0 +17:1041002:delayed_error=0 +18:1190330:delayed_error=0 +19:1194054:delayed_error=0 +** ERROR bad grib message: Statistical Processing bad n=0 ** +20:1194241:d=2017041700:LRGHR:1 hybrid level:::delayed_error=18 +21:1229461:delayed_error=0 +22:1383477:delayed_error=0 +23:1383916:delayed_error=0 +24:1384103:delayed_error=0 +.. + + + +

    Usage

    +

    + +

    +-if_delayed_error   will enter if block if there is a delayed error
    +
    + +

    +See also: + -reset_delayed_error, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page created Dec 14, 2020. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/if_fs.html b/docs/web_docs/if_fs.html new file mode 100644 index 0000000..329101d --- /dev/null +++ b/docs/web_docs/if_fs.html @@ -0,0 +1,191 @@ + + + + Climate Prediction Center - wgrib2: -if_fs, -not_if_fs + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -if_fs,-not_if_fs +
     
    + +

    wgrib2: -if_fs, -not_if_fs

    +
    + + +

    Introduction

    + +

    +The -if_fs option is the same as the +the -if option except it takes "fixed strings" +rather than extended regular expressions. The +-not_if_fs is the same as the -not_if option +except it takes "fixed strings". + +

    The "fixed string" options have the advantage that matches do not use the +regex wildcards. For example, "-if 3.0" will match "300" because the period is +a wildcard character that matches any character including a zero. + + +

    Usage

    +

    + +

    +-if_fs X
    +-not_if_fs X
    +
    +X is a fixed string (not a regular expression)
    +
    + + + +

    +See also: -if, +See also: -not_if, +See also: -not_if_fs, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005, modified 3/2019 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/if_n.html b/docs/web_docs/if_n.html new file mode 100644 index 0000000..e68c442 --- /dev/null +++ b/docs/web_docs/if_n.html @@ -0,0 +1,212 @@ + + + + Climate Prediction Center - wgrib2: -if_n + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -if_n +
     
    + +

    wgrib2: -if_n

    +
    + + +

    Introduction

    + +

    +The -if_n option is an -if for a range of inventory numbers. +The -if_n option uses the same syntax as the "for_n" option. +If you want to operate on +inventory records 10 to 20, you would use the parameter 10:20. +If you want to operate on all the even inventory records from 10 to 20, you would +use 10:20:2. The restrictions are the start value must be less than +the ending value and the step has to be greater than zero. +

    + +

    +The -if_n option is similar to the +-for_n option in that they both select a range of invetory records. +The difference is that the -for_n option selects the range +of records that wgrib2 will process. With the +the -if_n option, all the records will be processed +but only the additional processing within the -if block will be only +done for the selected records. The -for_n option can be much +faster if the field has to be decoded. With the -for_n option, +only the selected records need to be docoded whereas all the records would be decoded +when using the -if_n option. The command line, however, +can have multiple -if_n options. +

    + +

    Usage

    +

    + +

    +-if_n I:J:K        same as for n = I to J by K
    +-if_n I:J          same as for n = I to J by 1
    +-if_n I::K         same as for n = I to MAX_INTEGER by K
    +-if_n I            same as for n = I to MAX_INTEGER by 1
    +
    + + + +

    Example

    +

    + +

    + $ wgrib2 file.grb2  -if_n 4:5 -s -fi
    +4:13335:d=2008120200:RH:750 mb:anl:
    +5:17098:d=2008120200:TMP:2743 m above mean sea level:anl:
    +
    + +See also: -match +-if_rec +-for +-for_n +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/if_rec.html b/docs/web_docs/if_rec.html new file mode 100644 index 0000000..2c6548b --- /dev/null +++ b/docs/web_docs/if_rec.html @@ -0,0 +1,212 @@ + + + + Climate Prediction Center - wgrib2: -if_rec + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -if_rec +
     
    + +

    wgrib2: -if_rec

    +
    + + +

    Introduction

    + +

    +The -if_rec option is an -if for a range of record numbers. +The -if_rec option uses the same syntax as the "for" option. +If you want to operate on +records 10 to 20, you would use the parameter 10:20. +If you want to operate on all the even records from 10 to 20, you would +use 10:20:2. The restrictions are the start value must be less than +the ending value and the step has to be greater than zero. +

    + +

    +The -if_rec option is similar to the +-for option in that they both select a range of records. +The difference is that the -for option selects the range +of records that wgrib2 will process. With the +the -if_rec option, all the records will be processed +but only the additional processing within the -if block will be only +done for the selected records. The -for option can be much +faster if the field has to be decoded. With the -for option, +only the selected records need to be docoded whereas all the records would be decoded +when using the -if_rec option. The command line, however, +can have multiple -if_rec options. +

    + +

    Usage

    +

    + +

    +-if_rec I:J:K        same as for n = I to J by K
    +-if_rec I:J          same as for n = I to J by 1
    +-if_rec I::K         same as for n = I to MAX_INTEGER by K
    +-if_rec I            same as for n = I to MAX_INTEGER by 1
    +
    + + + +

    Example

    +

    + +

    + $ wgrib2 file.grb2  -if_rec 4:5 -s -fi
    +4:13335:d=2008120200:RH:750 mb:anl:
    +5:17098:d=2008120200:TMP:2743 m above mean sea level:anl:
    +
    + +See also: -match +-if_n +-for +-for_n +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/if_reg.html b/docs/web_docs/if_reg.html new file mode 100644 index 0000000..e62219c --- /dev/null +++ b/docs/web_docs/if_reg.html @@ -0,0 +1,232 @@ + + + + Climate Prediction Center - wgrib2: -if_reg + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -if_reg +
     
    + +

    wgrib2: -if_reg

    +
    + + +

    Introduction

    + +

    +The reverse polish notation calculator (-rpn) allows you +to manipulate the grid values and save the results in registers. The values in +the registers are persistent until they are cleared or the program (wgrib2) ends. +The persistent registers allow you to do calculations that require multiple +fields. For example, to calculate the wind speed, you have to save the zonal +wind in a register and the meridional wind in another register. When both +registers have values (U and V), you can then proceed with the wind speed +calculation. +The -if_reg option tests to see if specified registers have +been set. If the register have been set, then the options up to and including the +next output option are executed like with an -if option. +

    + +

    +Here is an example of computing the 500 mb wind speed. +

    +
    +$ wgrib2 a.grb -match ":[UV]grd:500 mb:anl:" \
    +     -if ":UGRD:" -rpn "sto_1" -fi \
    +     -if ":VGRD:" -rpn "sto_2" -fi \
    +     -if_reg 1:2 \
    +         -rpn "rcl_1:sq:rcl_2:sq:+:sqrt:clr_1:clr_2" \
    +         -set_var WIND \
    +         -grib_out out.grb
    +
    +     line 1: only process the U and V at 500 mb
    +     line 2: store U 500mb analysis in register 1
    +     line 3: store V 500mb analysis in register 2
    +     line 4: if (register 1 and register 2 have values then
    +     line 5: calculate the wind speed: sqrt(reg_1**2 + reg_2**2)
    +     line 6: set variable time to WIND (wind speed)
    +     line 7: write out the WIND data to a grib file
    +             -grib_out is an output option and ends the -if block
    +
    +     Note: this is a very simple script and that doesn't check the matching
    +     date code, grid type, etc.
    +
    + +

    With operational NCEP files, the V field immediately follows the corresponding U field. +If we assume that this is always true, then the following computes all the wind speeds. +

    + +
    +$ wgrib2 a.grb -match ":[UV]grd:" \
    +     -if ":UGRD:" -rpn "sto_1" -fi \
    +     -if ":VGRD:" -rpn "sto_2" -fi \
    +     -if_reg 1:2 \
    +         -rpn "rcl_1:sq:rcl_2:sq:+:sqrt:clr_1:clr_2" \
    +         -set_var WIND \
    +         -grib_out out.grb
    +
    + + + +

    Usage

    +

    + +

    +-if_reg X
    +
    +X is a list of register names, ex. 1:2 or 2:4:7
    +
    + +

    +See also: + -if, +-fi. + -rpn, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/if_structure.html b/docs/web_docs/if_structure.html new file mode 100644 index 0000000..9fd65c1 --- /dev/null +++ b/docs/web_docs/if_structure.html @@ -0,0 +1,289 @@ + + + + Climate Prediction Center - wgrib2: if structure + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 if structure +
     
    + +

    wgrib2: if structure

    +
    + + +

    Introduction

    + +

    +The "if" structure has been evolving in wgrib2. Up to wgrib2 v1.6.1 (1/2009), there were no "if" statements. +From wgrib2 v1.6.2 (2/2008) to v2.0.8 (2/2009), "if" statements were terminated by output statements, "if" +blocks could not be nested and there were no "else" statements. +Wgrib2 v3.0.0 (9/2020), introduced "else", "elseif", "endif" and nested "if" blocks. +The old and new style of "if" strutcture will continue to work but cannot be mixed on the +command line. + + +

    Old Style

    + +
    +    If statement = -if, -if_fs, -if_n, -if_rec, -if_reg, -not_if, -not_if_fs
    +
    +    If block is terminated by an output statement.
    +     -fi is a no operation, output statement
    +     -fi is often used to terminate a "if" block
    +    If blocks cannot be nested
    +
    + +

    New Style

    + +
    +    If statement = -if, -if_fs, -if_n, -if_rec, -if_reg, -not_if, -not_if_fs
    +    EsleIf statement = -elseif, -elseif_fs, -elseif_n, -elseif_rec, -elseif_reg
    +    Else statement = -else
    +    Endif statement = -endif
    +
    +    If block is terminated by an endif statement.
    +    If blocks can be nested (preset limit)
    +
    +    Types of If blocks
    +
    +    If statement
    +    ..
    +    optional Elseif statement      }  this block can be repeated 0-N time
    +    ..                             }
    +    optional Else statement
    +    ..
    +    Endif statement
    +
    +
    +

    Old Style vs New Style

    + +

    Wgrib2 3.0.0+ supports both old and new "if" structures. +Wgrib2 determines the style of "if" blocks during the parsing phase by, +

      +
    1. -fi option found, old style +
    2. elseif option found, new style +
    3. else option found, new style +
    4. endif option found, new style +
    5. if now -fi, elseif, else or endif option, then old style +
    + +

    Example

    +

    +

    +In this example, we want to split a file into the height, temperature,
    +relative humidity and other fields.
    +
    +Old style                                    New style
    +
    +wgrib2 IN.grb \                              wgrib2 IN.grb \
    +-if ":HGT:" -grib hgt.grb \                  -if ":HGT:" -grb hgt.grb \
    +-if ":TMP:" -grib tmp.grb \                  -elseif ":TMP:" -grib tmp.grb \
    +-if ":RH:" -grib rh.grb \                    -elseif ":RH": -grib rh.grb \
    +-not_if ":(HGT|TMP|RH):" -grib rest.grb      -else -grib rest.grb \
    +                                             -endif
    +
    +

    +The new style is easier to read and perhaps to write. (The old style may not be +obvious to all users.) One might expect the the new style is faster because +some -elseif tests are not evaluated. However, all the -elseif and -elseif_fs +tests are evaluated in parallel. So there little time savings. + +

    + Life and "if" blocks are getting more complicated. +For example, the interpolation scheme use to be + +

    +interpolation_type = bilinear
    +if (soil type or vegatation type) interpolation_type = nearest_neighbor
    +
    + +The above translates to +
    +Old style                                    New style
    +
    +wgrib2 IN.grb \                              wgrib2 IN.grb \
    + -new_grid_interpolation bilinear \          -new_grid_interpolation bilinear \
    + -if ":(VGTYP|SOTYP):" \                     -if ":(VGTYP|SOTYP):" \
    +    -new_grid_interpolation neighbor \          -new_grid_interpolation neighbor \
    + -fi \                                       -endif \
    + ...                                         ...
    +
    + +The more that you interpolate, the more that you learn how to interpolate. For example, +when you interpolate precipitation, you almost always do a budget +interpolation because you want to preserve global or area average +precipitation. Understanding the local land surface depends on the +point values of vegatation type, soil type, soil and surface coditions. +Spectral interpolation may be more accurate but it can make the RH greater +than 100%. So a better selection of interpolation types may be, +Translating the following to a shell script using the old "if" structure +seems hard. + +
    +large_scale= new_dx/old_dx > 3
    +
    +if (soil type or vegatation type) { interpolation_type = nearest_neighbor }
    +else if (variable == precipitation) { interpolation_type = budget }
    +else if (large_scale) { interpolation = budget }
    +else if (level ≤ 10m above the surface) interpolation_type=nearest neighbor
    +else if (not humidity and pressure level) interpolation_type = spectral
    +else interpolation_type = bilinear
    +
    + + + +

    +See also: +-set_hex +-set_ieee +-set_int +-set_int2 +-set_ieee +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: June 1, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ij.html b/docs/web_docs/ij.html new file mode 100644 index 0000000..bab4064 --- /dev/null +++ b/docs/web_docs/ij.html @@ -0,0 +1,189 @@ + + + + Climate Prediction Center - wgrib2: -ij + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ij +
     
    + +

    wgrib2: -ij

    +
    + + +

    Introduction

    + +

    +The -ij option prints the value of the grid point (i,j) +where i = 1..nx and j = 1..ny. Note, by default the grid is converted to a +WE:SN order. This means that (1,1) is at the South-West corner. + +

    Usage

    +

    + +

    +-ij i j
    +      i = 1 .. nx
    +      j = 1 .. ny
    +
    + +

    Example

    +

    +

    +sh-2.05b$ wgrib2 new.grb2 -s  -ij 1 1
    +1:0:d=2005082812:HGT:1000 mb:78 hour fcst:val=162.3
    +
    + + + + + +See also: -ijlat, -ilat, -lon +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ijbox.html b/docs/web_docs/ijbox.html new file mode 100644 index 0000000..bf214b0 --- /dev/null +++ b/docs/web_docs/ijbox.html @@ -0,0 +1,207 @@ + + + + Climate Prediction Center - wgrib2: -ijbox + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ijbox +
     
    + +

    wgrib2: -ijbox

    +
    + + +

    Introduction

    + +

    +The -ijbox option takes a rectangular box +of data from a rectanular grid an writes it out in either +text, bin, or spread (sheet) format. The extracted box can +have every point or every n-th point. + +

    Usage

    +
    +-ijbox i1:i2:di j1:j2:dj output_file format
    +     format = bin, text or spread   (format of output_file)
    +
    +     The data in output_file is written out as
    +      do iy=j1, j2, dj
    +         do ix=i1, i2, di
    +            data(ix,iy)
    +         enddo
    +      enddo
    +
    +    Note: -big_endian and -little_endian have no effect the bin type output
    +
    + +

    Example

    +

    + Wgrib2 when writing binary, can make a fortran header at the +beginning of the grid and a fortran trailer at the end of +the grid. I wanted to create a file with fortran header +and trailer surrounding each row of the grid. I was +able to do it with -ijox. The grid of rtgssthr_grb2 +is 1041 x 441. + +

    +rm output
    +i=1
    +while [ $i -le 441 ] ; do
    +   wgrib2 rtgssthr_grb2 -append -header ijbox 1:1041 $i:$i output bin
    +   i=`expr $i + 1`
    +done
    +
    + +

    +See also: +-undefine, +-small_grib, +-text_col, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page modified: Dec 30, 2016, 5/8/2019 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ijlat.html b/docs/web_docs/ijlat.html new file mode 100644 index 0000000..966a82e --- /dev/null +++ b/docs/web_docs/ijlat.html @@ -0,0 +1,192 @@ + + + + Climate Prediction Center - wgrib2: -ijlat + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ijlat +
     
    + +

    wgrib2: -ijlat

    +
    + + +

    Introduction

    + +

    +The -ijlat option prints the latitude, longitude and +value of the grid point (i,j) where i = 1..nx and j = 1..ny. Note, +by default the grid is converted to a WE:SN order which puts (1,1) +in the South-West corner. Note, multiple -ijlat can be on the command line. + + +

    Usage

    +

    + +

    +-ijlat i j
    +      i = 1 .. nx
    +      j = 1 .. ny
    +
    + +

    Example

    +

    +

    +-sh-2.05b$ wgrib2 new.grb2 -s -ijlat 1 1
    +1:0:d=2005082812:HGT:1000 mb:78 hour fcst:(1,1),lon=0,lat=-90,val=162.3
    +
    +-sh-2.05b$ wgrib2 new.grb2 -s -ijlat 1 1 -ijlat 2 2
    +1:0:d=2005082812:HGT:1000 mb:78 hour fcst:(1,1),lon=0,lat=-90,val=162.3:(2,2),lon=1,lat=-89,val=183.7
    +
    +
    + + +See also: -ij, -ilat, -lon +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ijsmall_grib.html b/docs/web_docs/ijsmall_grib.html new file mode 100644 index 0000000..828358b --- /dev/null +++ b/docs/web_docs/ijsmall_grib.html @@ -0,0 +1,209 @@ + + + + Climate Prediction Center - wgrib2: -ijsmall_grib + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ijsmall_grib +
     
    + +

    wgrib2: -ijsmall_grib

    +
    + + +

    Introduction

    + +

    +The -ijsmall_grib option writes the grid values +to a grib2 file with the same grid spacing but a smaller domain. +It is similar to the -small_grib option +except it uses i,j values rather than lat-lon values. The grid point +locations are unchanged. This option is used to make a regional subset +and only works for certain grids such as the lat-lon, rotated lat-lon, Mercator and Lambert conformal. + +

    Limitations

    +
      +
    1. rotated lat-lon grid: must use WMO grid template and not the NCEP locally defined grid template +
    2. staggered grids are not supported +
    + + +

    Usage

    +

    + +

    +-ijsmall_grib ix0:ix1 iy0:iy1 file_name
    +
    +Where, 1 <= ix0 < ix1 < nx
    +Where, 1 <= iy0 < iy1 < ny
    +By default, (i,j) is the South-West corner
    +
    +File_name is the output grib2 file 
    +
    + +

    Example

    +

    + +

    +$ wgrib2 fcst.grb2 -ijsmall_grib 10:20 20:30 small.grb
    +1:0:d=2007032600:HGT:1000 mb:anl:
    +
    +$ wgrib2 small.grb -grid
    +1:0:grid_template=0:
    +        lat-lon grid:(11 x 11) units 1e-06 input WE:SN output WE:SN res 48
    +        lat -80.500000 to -75.500000 by 0.500000
    +        lon 4.500000 to 9.500000 by 0.500000 #points=121
    +
    + + +

    +See also: -undefine, +-small_grib +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Nov 20, 2015, Feb 2024 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ijundefine.html b/docs/web_docs/ijundefine.html new file mode 100644 index 0000000..4b9537b --- /dev/null +++ b/docs/web_docs/ijundefine.html @@ -0,0 +1,221 @@ + + + + Climate Prediction Center - wgrib2: -ijundefine + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ijundefine +
     
    + +

    wgrib2: -ijundefine

    +
    + + +

    Introduction

    + +

    +The -ijundefine option sets the +selected grid values to undefined. The grid points are have to be +inside or outside a user defined (i,j) box. I and j are the column +and row number of the "raw" data starting from 1. This option can be +used to limit the output when writing output. +For example, you were only interested in the UK, you could use this +option to undefine the grid points outside the of UK. Then when you write +the data in spread-sheet format, you would get a much smaller output. +This option can also be used to find the regional average using the +stat option. Note that the +-ijundefine option changes the in-memory values +of the grid points. If you want to alter the grib file, you will +have to write out the in-memory grid point values using the +the -grib_out option. + + + +

    Usage

    +

    + +

    +-ijundefine (in-box|out-box) ix0:ix1 iy0:iy1
    +
    +in-box:  decoded grid points inside the box are set to undefined
    +out-box: decoded grid points outside the box are set to undefined
    +ix0:ix1 columns limits (1 <=  ix0 <= ix1 < nx)
    +iy0:iy1 row limits (1 <= iy0 <= iy1 <  ny)
    +Note: the order of the data should be in default mode (we:sn).
    +Note: ix0, iy0 is the lower left hand corner (w/s).
    +
    +Points on the box boundary are considered to be in the box.
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -ijundefine out-box 1:1 1:10 -stats
    +
    + +The above line calculates the statistics for ix=1, iy=1..10. + +
    +$ wgrib2 test.grb2 -ijundefine out-box 10:30 20:40 -ijundefine in-box 11:29 21:39 -bin boundary.bin
    +
    + +The above line undefines the grid points outside of a box and then undefines the grid points of a smaller +box that is contained in the first box. Then it writes the data as a binary file. The data file contains +the data points for a perimeter of a box. Why would someone want to do that? Think "horizontal boundary +conditions for a regional model". For this to work well, a module to write the data out in grib-2 needs +to be written. BTW the binary file will compress to an extremely small file. + +

    +See also: +-undefine, +-spread, +-stats, +-undefine_val, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ilat.html b/docs/web_docs/ilat.html new file mode 100644 index 0000000..c7fe759 --- /dev/null +++ b/docs/web_docs/ilat.html @@ -0,0 +1,199 @@ + + + + Climate Prediction Center - wgrib2: -ilat + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ilat +
     
    + +

    wgrib2: -ilat

    +
    + + +

    Introduction

    + +

    +The -ilat option prints the latitude, longitude and +value of ith grid point. For example, you get a text output and you +were curious about the lat-lon of the fifth grid on the list. You +would use this option to get the value and its location. + +

    The -ilat option uses the Fortran convention +which has the index starting from one. In addition, the index is for the +output grid may differ from the input grid. + + + +

    Usage

    +

    + +

    +-ilat i
    +      i = 1 .. number of grid points
    +
    + +

    Example

    +

    +

    +-sh-2.05b$ wgrib2 ens.grb -ilat 5
    +1:0:grid pt 5,lon=4.000000,lat=-90.000000,val=18168.8
    +2:45932:grid pt 5,lon=4.000000,lat=-90.000000,val=8e-07
    +3:89724:grid pt 5,lon=4.000000,lat=-90.000000,val=2.6e-06
    +4:144624:grid pt 5,lon=4.000000,lat=-90.000000,val=8309.4
    +5:198928:grid pt 5,lon=4.000000,lat=-90.000000,val=205.9
    +
    + + +See also: -ijlat, +-lon +-ll2i +-scan +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan 26, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/import_bin.html b/docs/web_docs/import_bin.html new file mode 100644 index 0000000..2c0cf2e --- /dev/null +++ b/docs/web_docs/import_bin.html @@ -0,0 +1,247 @@ + + + + Climate Prediction Center - wgrib2: -import_(bin, ieee, text, grib) + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-import_(bin,ieee,text,grib) +
     
    + +

    wgrib2: -import_bin, -import_ieee, -import_text, -import_grib

    +
    + + +

    Introduction

    + +

    +Wgrib2 will decode the grib message and save the decoded +grid point values in a floating point array (DATA). The -import +options read grid point values from a specified file and replace the values of DATA. +The size of DATA and imported grid should match. The -import +options are often used to read data that is later written out as a grib message. +

    +Note that the import functions will reset the scaling and precision of the grib writing (new files) +to the default (ECMWF-style, 12 bits). Any -set_metadata should be done after the -import functions. + +

    Scan Order

    +The grib message's scan order is called the "input" scan order (wgrib2 -grid). +Wgrib2 converts this to the "output" scan order. (This is the scan order for +options like: -bin, -text, -cvs.) The import file needs to be in the "output" +scan order. Of course, you can change the output scan order using the -order +option. + +

    import Format

    +The file that you import needs to be in a special format. + +
      +
    • grib: grib2 message +
    • bin: native single point format +
    • ieee: IEEE single point format +
    • bin: may have a f77 style header depending on the -header option +
    • ieee: may have a f77 style header depending on the -header option +
    • ieee: may be little or big (default) ending depending on options +
    • text: may have a "nx ny" header depending on the -header option +(see -text option) +
    + + +

    Usage

    +
    +-import_bin data.bin              .. a binary (native format floating point) file
    +-import_ieee data.ieee            .. a big-endian 32-bit ieee file
    +                                     note that the -header and -no_header affect the data file format
    +-import_text data.txt		  .. a text file
    +                                     note that the -header and -no_header affect the data file format
    +-import_grib data.grb		  .. a grib2 file
    +                                     -g2clib 2 is not supported
    +                                     conversion to we:sn and we:ns is supported
    +                                     reads next grid (message or submessage)
    +                                     -not and -match do not affect -import_grib
    +
    +Note: grid size (if it can be determined) must match the current grid.
    +
    + +

    Example 1

    +
    +wgrib2 IN.grb -bin dump.bin              .. make a binary sequential file of the fields
    +Fix.sh dump.bin dump.bin.new             .. alter dump.bin
    +wgrib2 IN.grb -set_grib_type same -import_bin dump.bin.new -set_scaling same same -grib_out IN.new.grb
    +
    +The -import options reads the data for one field and overwrites +the current grid point values. The -grib_out option writes a new +grib message with the new grid point values. + +

    Example 2: using import to write a grib file

    + +
    +template.grb2             is a single message (field/record) grib2 file with the appropriate grid
    +                          usually a simple type like 6 hour forecast or analysis
    +new.bin                   is a binary file with a single field with th same grid as template.grb2
    +
    +
    +wgrib2 template.grb2 -import_bin new.bin -set_var GEOLAT -set_lev "surface" -set_ftime "anl" \
    +     -set_date 1999123112 -set_grib_max_bits 24 -set_bin_prec 24 -grib_out new.grb2
    +
    +This commands writes new.bin as a grib2 file as GEOLAT at 12Z Dec 31, 1999 using 24 bits precision.
    +
    + +

    +See also: +-import_grib_fs, +-import_netcdf, +-set_grib_type, +-set_scaling, +-undefine, +-grib_out, +-set_date, +-set_ftime, +-set_lev, +-set_var, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page modified: Sep 14, 2016. Sep 23, 2022. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/import_grib.html b/docs/web_docs/import_grib.html new file mode 100644 index 0000000..2c0cf2e --- /dev/null +++ b/docs/web_docs/import_grib.html @@ -0,0 +1,247 @@ + + + + Climate Prediction Center - wgrib2: -import_(bin, ieee, text, grib) + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-import_(bin,ieee,text,grib) +
     
    + +

    wgrib2: -import_bin, -import_ieee, -import_text, -import_grib

    +
    + + +

    Introduction

    + +

    +Wgrib2 will decode the grib message and save the decoded +grid point values in a floating point array (DATA). The -import +options read grid point values from a specified file and replace the values of DATA. +The size of DATA and imported grid should match. The -import +options are often used to read data that is later written out as a grib message. +

    +Note that the import functions will reset the scaling and precision of the grib writing (new files) +to the default (ECMWF-style, 12 bits). Any -set_metadata should be done after the -import functions. + +

    Scan Order

    +The grib message's scan order is called the "input" scan order (wgrib2 -grid). +Wgrib2 converts this to the "output" scan order. (This is the scan order for +options like: -bin, -text, -cvs.) The import file needs to be in the "output" +scan order. Of course, you can change the output scan order using the -order +option. + +

    import Format

    +The file that you import needs to be in a special format. + +
      +
    • grib: grib2 message +
    • bin: native single point format +
    • ieee: IEEE single point format +
    • bin: may have a f77 style header depending on the -header option +
    • ieee: may have a f77 style header depending on the -header option +
    • ieee: may be little or big (default) ending depending on options +
    • text: may have a "nx ny" header depending on the -header option +(see -text option) +
    + + +

    Usage

    +
    +-import_bin data.bin              .. a binary (native format floating point) file
    +-import_ieee data.ieee            .. a big-endian 32-bit ieee file
    +                                     note that the -header and -no_header affect the data file format
    +-import_text data.txt		  .. a text file
    +                                     note that the -header and -no_header affect the data file format
    +-import_grib data.grb		  .. a grib2 file
    +                                     -g2clib 2 is not supported
    +                                     conversion to we:sn and we:ns is supported
    +                                     reads next grid (message or submessage)
    +                                     -not and -match do not affect -import_grib
    +
    +Note: grid size (if it can be determined) must match the current grid.
    +
    + +

    Example 1

    +
    +wgrib2 IN.grb -bin dump.bin              .. make a binary sequential file of the fields
    +Fix.sh dump.bin dump.bin.new             .. alter dump.bin
    +wgrib2 IN.grb -set_grib_type same -import_bin dump.bin.new -set_scaling same same -grib_out IN.new.grb
    +
    +The -import options reads the data for one field and overwrites +the current grid point values. The -grib_out option writes a new +grib message with the new grid point values. + +

    Example 2: using import to write a grib file

    + +
    +template.grb2             is a single message (field/record) grib2 file with the appropriate grid
    +                          usually a simple type like 6 hour forecast or analysis
    +new.bin                   is a binary file with a single field with th same grid as template.grb2
    +
    +
    +wgrib2 template.grb2 -import_bin new.bin -set_var GEOLAT -set_lev "surface" -set_ftime "anl" \
    +     -set_date 1999123112 -set_grib_max_bits 24 -set_bin_prec 24 -grib_out new.grb2
    +
    +This commands writes new.bin as a grib2 file as GEOLAT at 12Z Dec 31, 1999 using 24 bits precision.
    +
    + +

    +See also: +-import_grib_fs, +-import_netcdf, +-set_grib_type, +-set_scaling, +-undefine, +-grib_out, +-set_date, +-set_ftime, +-set_lev, +-set_var, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page modified: Sep 14, 2016. Sep 23, 2022. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/import_grib_fs.html b/docs/web_docs/import_grib_fs.html new file mode 100644 index 0000000..5999519 --- /dev/null +++ b/docs/web_docs/import_grib_fs.html @@ -0,0 +1,228 @@ + + + + Climate Prediction Center - wgrib2: -import_grib_fs + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-import_grib_fs +
     
    + +

    wgrib2: -import_grib_fs (wgrib2 v3.0.0+)

    +
    + + +

    Introduction

    + +

    +The -import_grib_fs option sets the file pointer +to the beginning of the file, and reads sequentially until it finds +a record that matches the search string. It like a +-if_fs for reading a grib file. + +

    +The option -import_grib reads the input file sequentially. +The -import_grib_fs option allows you select the field to read. + +

    Usage

    +
    +-import_grib_fs STRING data.grb	     reads a grib message that matchs STRING from file data.grb
    +				     the match is by fixed string, not regular expression
    +                                     -g2clib 2 is not supported
    +                                     conversion to we:sn and we:ns is supported
    +                                     starts at the beginning of the file
    +				     reads sequentially
    +                                     -not and -match do not affect -import_grib
    +                STRING               this is a subset of the match inventory (see -match_inv)
    +		                     starting with d=YYYYMMDDHH
    +                data.grb             grib file for reading by -import_grib_fs
    +Note: grid size (if it can be determined) must match the current grid.
    +
    + +

    Example 1

    +Here is a script that reads the CORe and CFS analyses, and finds the +average 500 mh height. CORe and CFS are on different grids, so the first +step is to convert them to to same grid. + +
    +#!/bin/sh
    +#
    +# ave two Z500 fields from totally different systems (CORe, CFS)
    +#
    +# Step 1, convert to same grid
    +# Step 2, use -import_grib_fs (v3.0.0+) to read the field
    +#         use -rpn to average the two fields
    +#         change center to unknown because the metadata is not descriptive
    +#
    +# Note: for Step 2,
    +#        -match ":d=2000010100:HGT:500 mb:"  is not needed
    +#        -import_grib_fs "d=2000010100:HGT:500 mb:anl:"  file2.grb
    +#          can be replaced by -import_grib file2.grb
    +# I made the code more complicated because if file1 and file2 were already on
    +# same grid, you can avoid Step 1.
    +
    +file1=/cpc/cfsr/reanalyses/corefv3/ens_mean/3hr/pgb/2000/01/pgb_2000010100_ensmean
    +file2=/cpc/cfsr/archive/6hr_h/pgb.g2/2000/01/pgb.2000010100.g2
    +
    +# Step 1
    +wgrib2 $file1 -match ":d=2000010100:HGT:500 mb:" -new_grid_winds earth -new_grid ncep grid 3 file1.grb
    +wgrib2 $file2 -match ":d=2000010100:HGT:500 mb:" -new_grid_winds earth -new_grid ncep grid 3 file2.grb
    +echo "\n\n"
    +
    +# Step 2
    +wgrib2 file1.grb -match ":d=2000010100:HGT:500 mb:" -rpn "0.5:*:sto_0" \
    +   -import_grib_fs "d=2000010100:HGT:500 mb:anl:"  file2.grb \
    +   -rpn "0.5:*:rcl_0:+" -set_center 255 -grib_out ave.grb
    +exit 0
    +
    + +

    +See also: +-import_grib, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Sep 14, 2016. May 2024. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/import_ieee.html b/docs/web_docs/import_ieee.html new file mode 100644 index 0000000..2c0cf2e --- /dev/null +++ b/docs/web_docs/import_ieee.html @@ -0,0 +1,247 @@ + + + + Climate Prediction Center - wgrib2: -import_(bin, ieee, text, grib) + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-import_(bin,ieee,text,grib) +
     
    + +

    wgrib2: -import_bin, -import_ieee, -import_text, -import_grib

    +
    + + +

    Introduction

    + +

    +Wgrib2 will decode the grib message and save the decoded +grid point values in a floating point array (DATA). The -import +options read grid point values from a specified file and replace the values of DATA. +The size of DATA and imported grid should match. The -import +options are often used to read data that is later written out as a grib message. +

    +Note that the import functions will reset the scaling and precision of the grib writing (new files) +to the default (ECMWF-style, 12 bits). Any -set_metadata should be done after the -import functions. + +

    Scan Order

    +The grib message's scan order is called the "input" scan order (wgrib2 -grid). +Wgrib2 converts this to the "output" scan order. (This is the scan order for +options like: -bin, -text, -cvs.) The import file needs to be in the "output" +scan order. Of course, you can change the output scan order using the -order +option. + +

    import Format

    +The file that you import needs to be in a special format. + +
      +
    • grib: grib2 message +
    • bin: native single point format +
    • ieee: IEEE single point format +
    • bin: may have a f77 style header depending on the -header option +
    • ieee: may have a f77 style header depending on the -header option +
    • ieee: may be little or big (default) ending depending on options +
    • text: may have a "nx ny" header depending on the -header option +(see -text option) +
    + + +

    Usage

    +
    +-import_bin data.bin              .. a binary (native format floating point) file
    +-import_ieee data.ieee            .. a big-endian 32-bit ieee file
    +                                     note that the -header and -no_header affect the data file format
    +-import_text data.txt		  .. a text file
    +                                     note that the -header and -no_header affect the data file format
    +-import_grib data.grb		  .. a grib2 file
    +                                     -g2clib 2 is not supported
    +                                     conversion to we:sn and we:ns is supported
    +                                     reads next grid (message or submessage)
    +                                     -not and -match do not affect -import_grib
    +
    +Note: grid size (if it can be determined) must match the current grid.
    +
    + +

    Example 1

    +
    +wgrib2 IN.grb -bin dump.bin              .. make a binary sequential file of the fields
    +Fix.sh dump.bin dump.bin.new             .. alter dump.bin
    +wgrib2 IN.grb -set_grib_type same -import_bin dump.bin.new -set_scaling same same -grib_out IN.new.grb
    +
    +The -import options reads the data for one field and overwrites +the current grid point values. The -grib_out option writes a new +grib message with the new grid point values. + +

    Example 2: using import to write a grib file

    + +
    +template.grb2             is a single message (field/record) grib2 file with the appropriate grid
    +                          usually a simple type like 6 hour forecast or analysis
    +new.bin                   is a binary file with a single field with th same grid as template.grb2
    +
    +
    +wgrib2 template.grb2 -import_bin new.bin -set_var GEOLAT -set_lev "surface" -set_ftime "anl" \
    +     -set_date 1999123112 -set_grib_max_bits 24 -set_bin_prec 24 -grib_out new.grb2
    +
    +This commands writes new.bin as a grib2 file as GEOLAT at 12Z Dec 31, 1999 using 24 bits precision.
    +
    + +

    +See also: +-import_grib_fs, +-import_netcdf, +-set_grib_type, +-set_scaling, +-undefine, +-grib_out, +-set_date, +-set_ftime, +-set_lev, +-set_var, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page modified: Sep 14, 2016. Sep 23, 2022. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/import_lonlat.html b/docs/web_docs/import_lonlat.html new file mode 100644 index 0000000..5a3e32a --- /dev/null +++ b/docs/web_docs/import_lonlat.html @@ -0,0 +1,225 @@ + + + + Climate Prediction Center - wgrib2: -import_lonlat + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -import_lonlat +
     
    + +

    wgrib2: -import_lonlat

    +
    + + +

    Reading longitudes and latitudes to a file

    + +

    +By default grib2 saves the latitude and longitude in micro-degrees. This +is more precision than the standard single-precision floating point variable +can hold. So wgrib2 uses double precision variables for its angles. +However, the -rpn facility is single precision, so it cannot be use for +angles without losing precision. +The -export_lonlat and +-import_lonlat options allow you to write +and read double-precision longitude and latitudes. + + +

    File format

    +

    +The -import_lonlat option read the +longitudes and latitudes in the following format. + +

    +8 bytes:                        'wgrib2ll'       text
    +(sizeof unsigned int) bytes      ndata           unsigned integer with number of grid points
    +(sizeof unsigned int) bytes      0               unsigned integer with value of zero
    +ndata*(sizeof double)            longitudes      ndata values of double precision longitudes
    +ndata*(sizeof double)            latitudes       ndata values of double precision latitudes
    +
    +(sizeof unsigned int) is usually 4.  By wgrib2 requirements, the value must be 4 or greater.
    +(sizeof double) is usually 8.
    +
    + +

    +Prior to wgrib2 v3.1.2, -import_lonlat would always +read the first record of the input file. For wgrib2 v3.1.2+, +-import_lonlat would read the records sequentially. If +there was an EOF, then read would start at the beginning of the file. Consequently +old behavior mimicked for files with only one record. + +

    Caution

    +The -import_lonlat will change the internal values of +the longitudes and latitudes. However, wgrib2 will still use the original +grid organization. For example, the grib message was a lat-long grid, +and replaced the values for a polar stereographic grid. Some parts of wgrib2 +may still assume the grid is a lat-lon grid. +The -import_lonlat will be more useful for unstructured grids +like GDT 3.101 (General Unstructured Grid). GDT 3.101 does not include geolocation, +and -import_lonlat can add the geolocation. Consequently +the nearest neighbor interpolation will then work. + +

    Usage

    +

    +

    +-import_lonlat FILE
    +    FILE = file that has special format with longitude and latitude values.
    +    The longitude and latitudes replace the internal values.
    +
    + +

    Example

    +
    +   $ wgrib2 IN.grb -ncpu 3 -new_grid_winds grid -new_grid ncep grid 221 - | wgrib2 - -ncpu 1 -set_grib_type j -ncep_uv OUT.grb
    +
    +

    +The above line uses 3 threads for regridding and one thread for jpeg2000 compression. The jpeg2000 +compression routines can't take advantage of more than one thread. +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page created: 6/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/import_netcdf.html b/docs/web_docs/import_netcdf.html new file mode 100644 index 0000000..56fb327 --- /dev/null +++ b/docs/web_docs/import_netcdf.html @@ -0,0 +1,431 @@ + + + + Climate Prediction Center - wgrib2: -import_netcdf + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-import_netcdf +
     
    + +

    wgrib2: -import_netcdf (beta)

    +
    + +

    +The -import_netcdf option is beta code which means +that the syntax is not going to change. This option +has been in the code for a number of years but it is not a well-used +option and there may be problems with your netcdf file. Personally I +would see if CDO can convert your file from netcdf to grib before +trying -import_netcdf. + +

    My second use of this +option (wgrib2 v3.0.0) improved the code. There were bug fixes and the +ability to import values stored in bytes and integers. The second use converted +the OSTIA SST files from netcdf to grib. The grib2 file was 8% of the original size. +(92% size reduction). The grib2 compression was extremely good, using only 0.97 bits +to store each grid point value. The grib compression was good because one field +was a mask, ice concentration was mostly zero value, and the SST and SST error where +undefined over land and lakes. The grid point values were unchanged in the conversion +from netcdf to grib because both the netcdf and grib files used the same precision. + + +

    Introduction

    + +

    +Reading netcdf is easy if someone else writes the program to read the netcdf file. +Writing the code to read netcdf is something else. +The -import_netcdf option allows you to read/import arbitrary +netcdf variables into wgrib2. The netcdf data that you read replaces the +grid point values of the "grib record" that you also read in. This is the +standard operating procedure of the -import options. + +

    +A netcdf file can contain many variables. In my sample file, there is one +data varable "acpcp" and and 6 supporting variables. +variables are +

    +    variable 0: time
    +    variable 1: lat(x,y)                 latitude
    +    variable 2: lon(x,y)                 longitude
    +    variable 3: y                        integer
    +    variable 4: x                        integer
    +    variable 5: Lambert_Conformal        grid definition
    +    variable 6: acpcp(x,y,time)          accumulated convective precip
    +
    + +

    +Netcdf variables have dimensions which can +be of arbitrary units. For example the time is not stored as YYYYMMDDHHSS but +could be stored as "nanoseconds since 1981-2-23", "fortnights since 1990-11-25 12:00 EST" +or anything else you can imagine. Geopotential height can have units of +meters, metres, inches, microns, nautical miles, chains, rods or any unit of length +in any language (ncdf supports unicode). This is the joy of a standard that don't set +standards. (Netcdf is a standard but fails to standardize units of length.) + +

    +Variables in netcdf can be viewed as variable(dim-i,dim-j,..,dim-last) where +the number of dimensions differ. For example, in one dataset, +X could be one-dimensional, latitude could be two dimensional and temperature +could be 4 dimensional. + +

    +There is netcdf library code to read varaible(i0:i1, j0:j1, .. , last0:last1). +With -import_netcdf, you specifiy the netcdf file, +the netcdf variable and "i0:i1,..,last0:last1". The code reads the data +and uses it to overwrite the wgrib2's data register. For this option, you don't +specify "i0:i1" but "i0" and "n", the number of to read (i1=i0+n-1). + + +

    Tutorial: Variables in an unknown netcdf file

    + +

    +In this example, I am trying to read a NARR netcdf file produced by a 3rd party. +As a first step, I want to list the variables in the netcdf file. + +

    +acpcp.1979.nc = netcdf file
    +
    +small.grb2 = arbitary grib2 file (used so that -import_netcdf will run)
    +asd = junk name that doesn't match a variable name or dimension specification
    +
    +sh-4.1$ wgrib2  ~/grib2/examples/small.grb2 -import_netcdf acpcp.1979.nc asd asd 
    +import_netcdf: asd is not valid variable, valid variables are
    +variable 0: time
    +variable 1: lat
    +variable 2: lon
    +variable 3: y
    +variable 4: x
    +variable 5: Lambert_Conformal
    +variable 6: acpcp
    +
    +In the above line, I am importing the variable "asd" from netcdf file "apcpc.1979.nc".
    +As expected, "asd" is not a valid varaible, and I get an error message and the 
    +desired list of valid variables.
    +
    + +

    Tutorial: Unknown attributes and dimensions of a variable

    + +To get a variable description, you need to try to import a netcdf file. acpcp.1979.nc +with a valid variable, acpcp, with an invalid dimension specification, "asd". + +
    +bash-4.1$ wgrib2 ~/grib2/examples/small.grb2 -import_netcdf acpcp.1979.nc acpcp asd 
    +ndims=3 var_type=5 #var_attributes 16
    +acpcp.0 attr=GRIB_id type=3 len=1
    +acpcp.1 attr=GRIB_name: ACPCP
    +acpcp.2 attr=coordinates: lat lon
    +acpcp.3 attr=dataset: NARR 3-hourly
    +acpcp.4 attr=grid_mapping: Lambert_Conformal
    +acpcp.5 attr=level_desc: Surface
    +acpcp.6 attr=long_name: 3-hourly accumulated convective precipitation at Surface
    +acpcp.7 attr=parent_stat: Other
    +acpcp.8 attr=standard_name: convective_precipitation_amount
    +acpcp.9 attr=statistic: Individual Obs
    +acpcp.10 attr=units: kg/m^2
    +acpcp.11 attr=valid_range type=5 len=2
    +acpcp.12 attr=var_desc: convective precipitation accumulation
    +acpcp.13 attr=missing_value type=5 len=1
    +acpcp.14 attr=actual_range type=5 len=2
    +acpcp.15 attr=_FillValue type=5 len=1
    +_FillValue=9969209968386869046778552952102584320.000000 1 missing_value=-9969209968386869046778552952102584320.000000 1
    +dimension mismatch asd, netcdf file has
    +   dim 0 id=0 name=time recs=2920
    +   dim 1 id=1 name=y recs=277
    +   dim 2 id=2 name=x recs=349
    +
    +*** FATAL ERROR: import_netcdf: dimensions do not match ***
    +
    + +By using an invalid dimension, the attributes and dimensions of the +variable are listed. From the attributes, we see that the variable is +a 3 hour accumulated convective precipitation. (Don't know whether it +is the 0-3 hour accumulated forecast or n-n+3 hour hour forecast.) + +

    Wgrib2 is using the C interface to the netcdf library. So +C conventions apply. For example, indices start at zero such +as the dimension number. + +

    The dimension description shows that acpcp is is a 3 dimensional +variable, apcpcp(time, y, x). + +

    Tutorial: Grid of an unknown netcdf file

    + +We can get the description of the latitude by + +
    +1:0bash-4.1$ wgrib2 ~/grib2/examples/small.grb2 -import_netcdf acpcp.1979.nc lat asd
    +ndims=2 var_type=5 #var_attributes 5
    +lat.0 attr=axis: Y
    +lat.1 attr=coordinate_defines: point
    +lat.2 attr=long_name: Latitude
    +lat.3 attr=standard_name: latitude
    +lat.4 attr=units: degrees_north
    +_FillValue=0.000000 0 missing_value=0.000000 0
    +dimension mismatch asd, netcdf file has
    +   dim 0 id=1 name=y recs=277
    +   dim 1 id=2 name=x recs=349
    +
    +*** FATAL ERROR: import_netcdf: dimensions do not match ***
    +
    + +Similarily we can find the description of lon. We see +that lat(y,x) and lon(y, x). + + +

    Tutorial: Projection of an unknown netcdf file

    + +The NARR grid is a Lambert Conformal grid. The grid description is +stored in the Lambert_Conformal variable. + +
    +bash-4.1$ wgrib2 ~/grib2/examples/small.grb2 -import_netcdf acpcp.1979.nc Lambert_Conformal asd 
    +ndims=0 var_type=4 #var_attributes 6
    +Lambert_Conformal.0 attr=false_easting type=6 len=1
    +Lambert_Conformal.1 attr=false_northing type=6 len=1
    +Lambert_Conformal.2 attr=grid_mapping_name: lambert_conformal_conic
    +Lambert_Conformal.3 attr=latitude_of_projection_origin type=6 len=1
    +Lambert_Conformal.4 attr=longitude_of_central_meridian type=6 len=1
    +Lambert_Conformal.5 attr=standard_parallel type=6 len=2
    +_FillValue=0.000000 0 missing_value=0.000000 0
    +WARNING: import_netcdf: size mismatch grib:4 netcdf:1
    +data is padded
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +
    + +

    Tutorial: converting a netcdf field to grib2

    + +In our example, we have a NARR grid and we can find +NARR grib1 files online from NCEI. Using grb1to2.pl, we +can convert a NARR file into grib2 and make a sample +grib2 file. This template will use the same grid +as our netcdf file. The following will read the 1st field from acpcp.1979.nc +and convert it into grib2. + +
    +bash-4.1$ wgrib2 narr.grb2 -import_netcdf acpcp.1979.nc acpcp "0:1:0:277:0:349" -set_var ACPCP \
    +   -set_lev surface -set_date 1979010100 -set_ftime2 "0-3 hour acc fcst" -grib_out out.grb2
    +ndims=3 var_type=5 #var_attributes 16
    +acpcp.0 attr=GRIB_id type=3 len=1
    +acpcp.1 attr=GRIB_name: ACPCP
    +acpcp.2 attr=coordinates: lat lon
    +acpcp.3 attr=dataset: NARR 3-hourly
    +acpcp.4 attr=grid_mapping: Lambert_Conformal
    +acpcp.5 attr=level_desc: Surface
    +acpcp.6 attr=long_name: 3-hourly accumulated convective precipitation at Surface
    +acpcp.7 attr=parent_stat: Other
    +acpcp.8 attr=standard_name: convective_precipitation_amount
    +acpcp.9 attr=statistic: Individual Obs
    +acpcp.10 attr=units: kg/m^2
    +acpcp.11 attr=valid_range type=5 len=2
    +acpcp.12 attr=var_desc: convective precipitation accumulation
    +acpcp.13 attr=missing_value type=5 len=1
    +acpcp.14 attr=actual_range type=5 len=2
    +acpcp.15 attr=_FillValue type=5 len=1
    +_FillValue=9969209968386869046778552952102584320.000000 1 missing_value=-9969209968386869046778552952102584320.000000 1
    +1:0:d=1979010100:ACPCP:surface:0-3 hour acc fcst:
    +
    +-import_netcdf acpcp.1979.nc acpcp "0:1:0:277:0:349"
    +  0:1:0:277:349 = hyperslab specifier
    +           0:1   for the 1st dimension (t), start at 0 and loop 1 time
    +                  (if your file has multiple times, to get the second
    +                  time, you use "1:1".)
    +           0:277 for the 2nd dimension (y), start at 0 and loop 277 times
    +           0:349 for the 3rd dimension (x), start at 0 and loop 349 times
    +-set_var ACPCP                   change the grib variable name to ACPCP of the memory buffer
    +-set_lev surface                 change the grib level to surface of the memory buffer
    +-set_date 1979010100             change the reference data of the memory buffer
    +-set_ftime2 "0-3 hour acc fcst"  change the time stamp of the memory buffer
    +-grib_out out.grb2               write memory buffer to out.grb2
    +
    +-import_netcdf reads a hyberslab of dimension 1 x 277 x 349.  Now the narr.grb2 has
    +a grid of 349 x 277.  You can check that the grib2 scan order is compatible with
    +the netcdf scan order either by examining the lat/lon or by checking the netcdf
    +file with the grib file obtained from another source.
    +
    +

    +The -import_netcdf option is not convenient and +takes some work to setup. However, it did work and I was able to verify +that the netcdf NARR file was the same as my grib copy. For lat-lon netcdf files +that follow the coards convention, using GrADS and the g2grb.gs +script is easier to use. + +

    Warnings

    +

    +The -import_netcdf option does very little +error checking. Suppose your netcdf hyper-cube is organized WE:NS, +and your in-memory grid is WE:SN (default). The +-import_netcdf directly over-write the +in-memory grid with the netcdf hyper-cube. The user is responsible +it reordering the data (-rpn -yrev). As of 3/2022, only WE:NS can +be transformed to WE:SN. + +

    Usage

    +
    +-import_netcdf file variable "dim_list"
    +                                 file     = netcdf file
    +                                 variable = variable in the netcdf file
    +                                 dim_list    = specification of the hyperslab to read
    +                                 dim_list    = dim_spec:dim_spec:..:dim_spec
    +                                 dim_spec    = dim_start:dim_loop
    +                                 dim_start   = index for start of hyberslap starting at 0
    +                                 dim_loop    = number time to loop
    +
    + +

    More Examples

    + +See Converting OSTIA SST in netcdf to grib. + +

    +See also: +-import_bin, +-import_grib, +-import_grib_fs, +-import_text, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Sep 18, 2017. Updated 1/8/2020, 9/2023 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/import_text.html b/docs/web_docs/import_text.html new file mode 100644 index 0000000..2c0cf2e --- /dev/null +++ b/docs/web_docs/import_text.html @@ -0,0 +1,247 @@ + + + + Climate Prediction Center - wgrib2: -import_(bin, ieee, text, grib) + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-import_(bin,ieee,text,grib) +
     
    + +

    wgrib2: -import_bin, -import_ieee, -import_text, -import_grib

    +
    + + +

    Introduction

    + +

    +Wgrib2 will decode the grib message and save the decoded +grid point values in a floating point array (DATA). The -import +options read grid point values from a specified file and replace the values of DATA. +The size of DATA and imported grid should match. The -import +options are often used to read data that is later written out as a grib message. +

    +Note that the import functions will reset the scaling and precision of the grib writing (new files) +to the default (ECMWF-style, 12 bits). Any -set_metadata should be done after the -import functions. + +

    Scan Order

    +The grib message's scan order is called the "input" scan order (wgrib2 -grid). +Wgrib2 converts this to the "output" scan order. (This is the scan order for +options like: -bin, -text, -cvs.) The import file needs to be in the "output" +scan order. Of course, you can change the output scan order using the -order +option. + +

    import Format

    +The file that you import needs to be in a special format. + +
      +
    • grib: grib2 message +
    • bin: native single point format +
    • ieee: IEEE single point format +
    • bin: may have a f77 style header depending on the -header option +
    • ieee: may have a f77 style header depending on the -header option +
    • ieee: may be little or big (default) ending depending on options +
    • text: may have a "nx ny" header depending on the -header option +(see -text option) +
    + + +

    Usage

    +
    +-import_bin data.bin              .. a binary (native format floating point) file
    +-import_ieee data.ieee            .. a big-endian 32-bit ieee file
    +                                     note that the -header and -no_header affect the data file format
    +-import_text data.txt		  .. a text file
    +                                     note that the -header and -no_header affect the data file format
    +-import_grib data.grb		  .. a grib2 file
    +                                     -g2clib 2 is not supported
    +                                     conversion to we:sn and we:ns is supported
    +                                     reads next grid (message or submessage)
    +                                     -not and -match do not affect -import_grib
    +
    +Note: grid size (if it can be determined) must match the current grid.
    +
    + +

    Example 1

    +
    +wgrib2 IN.grb -bin dump.bin              .. make a binary sequential file of the fields
    +Fix.sh dump.bin dump.bin.new             .. alter dump.bin
    +wgrib2 IN.grb -set_grib_type same -import_bin dump.bin.new -set_scaling same same -grib_out IN.new.grb
    +
    +The -import options reads the data for one field and overwrites +the current grid point values. The -grib_out option writes a new +grib message with the new grid point values. + +

    Example 2: using import to write a grib file

    + +
    +template.grb2             is a single message (field/record) grib2 file with the appropriate grid
    +                          usually a simple type like 6 hour forecast or analysis
    +new.bin                   is a binary file with a single field with th same grid as template.grb2
    +
    +
    +wgrib2 template.grb2 -import_bin new.bin -set_var GEOLAT -set_lev "surface" -set_ftime "anl" \
    +     -set_date 1999123112 -set_grib_max_bits 24 -set_bin_prec 24 -grib_out new.grb2
    +
    +This commands writes new.bin as a grib2 file as GEOLAT at 12Z Dec 31, 1999 using 24 bits precision.
    +
    + +

    +See also: +-import_grib_fs, +-import_netcdf, +-set_grib_type, +-set_scaling, +-undefine, +-grib_out, +-set_date, +-set_ftime, +-set_lev, +-set_var, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page modified: Sep 14, 2016. Sep 23, 2022. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/index.html b/docs/web_docs/index.html new file mode 100644 index 0000000..9c8b4d8 --- /dev/null +++ b/docs/web_docs/index.html @@ -0,0 +1,629 @@ + + + Climate Prediction Center - wgrib2: grib2 utility + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 +
     
    + +

    wgrib2: wgrib for GRIB-2

    +

    Utility to read and write grib2 files

    + +News + +wgrib2 moved to github +
    + +

    News

    +Wgrib2 moved to github. +

    +Wgrib2 development has been transitioning from a makefile build to a github/CMake build. +This allows future wgrib2 development to be integrated into a the software build/maintanence +system that is used by NCEP and the NOAA R&D HPC systems. Wgrib2 version 3.3.0 has the +major functionality of wgrib2 v3.1.3. (Ubuntu: IP-7/18/2024?, AEC-yes, JPEG200-no, PNG-no). + +

      Different +
    1. CMake build vs gnu makefile +
    2. build does not include independent library sources +
    3. questions, bug reports go to the github site +
    4. moving development into EMC/NCEP mainstream +
    + +
      Bad +
    1. all functionality of wgrib2 v3.1.3 is not present +
    2. equal area Lambert projection on aspherical earth is not supported (to do) +
    3. creating of libraries for pywgrib2 and wgrib2api not done (to do) +
    4. -new_grid of rotated lat-lon grids using WMO templates doesn't work (to do) +
    5. many of the build options are not supported (to do) +
    6. cannot check for library compatibility +
    7. CMake support for unusual platforms vs gnu make? +
    8. moving development into EMC/NCEP mainstream: lose independent check on EMC software +
    + +
      Good +
    1. future maintenence should be easier +
    2. support by multiple people +
    3. easier to build on NOAA computers +
    4. using a maintained version of ipolates +
    5. cleanup of code +
    6. unix standard calls to fortran ipolates replaced by standard version +
    7. use local installed libraries (ex. netcdf) +
    8. moving development into EMC/NCEP mainstream: saving of resources +
    9. EMC/NCEP mainstream: EMC could start using wgrib2api
      +
    + +
      Fixed in v3.3.0 vs v3.1.3 +
    1. updated NCEP grib table +
    2. small_grib: writing the lat/lon values in the metadata used a truncate rather than a round
      + angles could be off by 1e-6 of a degree +
    + +

    +At this point, we need feedback. The install documentation is weak. +IF you find something is braken, add it to the issues so it can be +fixed and a test added. + + +

    Introduction

    + +

    Wgrib2 is a processor for grib2 files. It is a utility +and library for manipulating grib files, The utility was designed to be +used to reduce the need for custom Fortran programs to +read, write and manipulate grib files. +Wgrib2 has the following abilities. + +

      +
    • inventory and read grib2 files +
    • create subsets +
    • create regional subsets by cookie cutter or projections +
    • export to ieee, text, binary, CSV, netcdf and mysql +
    • import to ieee, text, binary, and netcdf +
    • write of new grib2 fields +
    • parallel processing by using threads (OpenMP) +
    • parallel processing by flow-based programming +
    + + +

    Wgrib2 is versatile because it's command line is a simple +language. This makes wgrib2 useful in embedding. +Some programs that embed wgrib2. + +

      +
    • g2ctl +a control maker for GraADS +
    • atl_g2ctl, alt_gmp +alternative versions of g2ctl/gribmap for for +GraADS +
    • grib-filter/g2subset cgi-bin programs for Nomads (NOAA OperationalModel Archive & Distribution System) +
    • g2grb.gs enables GrADS to write grib2 files +
    • grb1to2.pl grib1 to grib2 converter +
    • Xplane11 flight simulator +
    • rNOMADS R interface for NOAA weather data +
    + + + + + +

    OpenMP Configuration

    +
    + +

    +OpenMP is used to speed up wgrib2 by running loops over +multiple cores. OpenMP is enabled by default for most builds +and you can slow up your machine if you the wrong OpenMP +configuration. + +

    The first configuration is to set up the number of +threads that wgrib2 will use. The default configuration +is set the number of threads equal to the number of +physical cores. The default is reasonable except for +when your computer becommes becomes +unresonsive. For a 4 core CPU, I set the number of threads +to be 3, so I another core to handle other work. +

    + +
    +export OMP_NUM_THREADS=3
    +
    + +

    The next OpenMP configuration is how to handle unused threads (cores). +By setting OMP_WAIT_POLICY to PASSIVE, +unused cores are made availible to to work on other tasks. +Setting OMP_WAIT_POLICY to ACTIVE, will not share the cores. +In kindergarten, you learned the value of sharing. +

    +
    +export OMP_WAIT_POLICY=PASSIVE
    +
    + +

    News

    +

    +4/14/2022: wgrib2 v3.1.1 is released +

      Changes for wgrib2 v3.1.1 +
    • fixes check_pdt_len for some ECMWF and ICON files with vertial coordinates +
    • fixes -unix_time because of glibc +
    • more support for unix time: -set_date, -import_netcdf +
    • tested: gcc/gfortran on Ubuntu 20.04, Redhat 7 +
    • tested: icc/ifort on Redhat 7 +
    • tested: AOCC v3.2 (clang, flang) on Ubuntu 20.04 +
    • minor tested: Windows 10 using cygwin64 +
    • minor tested: gcc/gfortran on Ubuntu 18.04 +
    + +

    Usage

    + +
      +
    • each option corresponds to a subroutine call +
    • type wgrib2 to see primary options +
    • inventory format is specified on command line by options +
    • if no "inv" option is specified, -s is used +
    + + +

    Joining the development effort

    +
      +
    • Source code: knowledge of C and some grib-2 +
    • Changes to existing source code has to use the same licence as the original code +
    • New code (files) must either be GNU or public domain. +
    • Github? No. +
    • Bug reports are important +
    • Some inovations by first time contributors +
        +
      • first implementation of lat-lon of common grids +
      • write netcdf files +
      • callable wgrib2 (making wgrib2 a subroutine) +
      • write to mysql files +
      • AEC compression +
      • python interface +
      +
    • Contact wesley.ebisuzaki@noaa.gov +
    + +

    Contributions by

    +
      +
    • Wesley Ebisuzaki: many modules +
    • Reinoud Bokhorst: tosubmsg, checksum +
    • DWD (Gregor Schee, Daniel Lee and others): AEC compression +
    • Jaakko Hyvätti: gribtab +
    • John Howard: callable wgrib2 +
    • Dusan Jovic: staggered grids, proj4 code +
    • Kristian Nilssen: netcdf module +
    • Karl Pfeiffer: georeferencing +
    • Pablo Romero: unix_time +
    • Manfred Schwarb: many modules +
    • Arlindo da Silva: openGrADS, bbox +
    • Niklas Sondell: mysql module +
    • Sam Trahan: satellite tables +
    • George Trojan: python interface, improvements to wgrib2api +
    • Sergey Varlamov: netcdf module improvements, georeferencing updates +
    • thanks to the people who report the bugs and more who provide the fixes! +
    + +

    Documentation

    + +

    The options

    + + +

    Some solutions

    + + +

    Selecting Fields/Records/Message

    +

    Select/Ignore by name/level/time/etc

    +
      +
    • -match process records that match a posix extended regular expression +
    • -not process records not matching a regular expression +
    • -match_inv the inventory used by -match and -not +
    • -i reads inventory from stdin for record selection +
    + +

    Select by number (better to use previous method)

    +
      +
    • -d dump specific record +
    • -for select a range of records to process (nth message) +
    • -for_n select a range of records to process (nth message/submessage) +
    + +

    Selective Processing: if options

    +

    +After selecting the fields to process, you can refine the processing by +the "if" options. With wgrib2 v3.0.0, the IF +structure was improved. Scripts that used the older IF structure still work; +however, the new IF structure is easier to read. + +

    If possible, it is better to use the match options than the if options. +The -match/-not options prevent unwanted records from being processed which +saves time over the if options which process the fields. + +

    Individual Grid Point Data

    +
      +
    • -ij print value at grid point (i, j) +
    • -ijlat print lat, lon, value at grid point (i, j) +
    • -ilat print lat, lon, value of Nth grid point +
    • -lon prints the lat-lon, and value of the grid point nearest the specified lat-lon +
    • -max prints the maximum value +
    • -min prints the minimum value +
    • -stats prints some statistics about the fields +
    • -V verbose inventory (shows stats) +
    + + +

    Regridding, Interpolating to new grids

    + +

    Wgrib2 has the ability to convert grib files from one grid +to another. The conversion uses a user-selected interpolation +scheme: bilinear (default), bicubic, nearest neighbor, budget, and spectral. +The supported grids include lat-lon, gaussian, Lambert conformal, polar stereographic, +and WMO-defined rotated lat-lon grid. This capability uses the NCEP IPOLATES2 library +and is an optional package. + +

    Note: the interpolation uses scalar and vector interpolation +schemes. For the vector quantities the V field must immediately +follow the corresponding U field. + +

    + + +

    Exporting data to other programs

    +
      +
    • -netcdf: write data in netcdf format +
    • -mysql: export data to a mysql database +
    • -mysql_speed: export data to a mysql database +
    • -spread: write data for spreadsheets +
    • -csv: write in column separated values, another one for spreadsheets +
    • -text: data in text format +
    • -bin: data native binary floating point +
    • -ieee: data in big endian IEEE format +
    • -ijbox: write a rectangular grid of data +
    • -AAIG: arcinfo ascii grid, GIS +
    + +For a short list of options, type "wgrib -h"
    +For a complete list, type "wgrib -help all"
    +To search for an option, type "wgrib -help keyword"
    + +

    Writing grib2

    + +Wgrib2 has adopted the template approach for writing grib. You +have a sample grib2 message (template), and you modify the grid point values +and metadata to create a new grib message that you can write. +This is similar to how ECMWF's ECCodes writes grib. The other approach +is to supply many parameters to create a grib message which is used +by NCEP's g2 library. + +
      +
    1. from wgrib2 command line +
    2. from GrADS using g2grb.gs +
    3. fron python using write +
    4. from fortran using grb2_write +
    + + + +

    Machines able to run wgrib2

    + +
      64-bit with IPOLATES +
    • Redhat 7 Enterprise: gcc/gfortran (primary development system) +
    • Redhat 7 Enterprise: gcc/gfortran, icc/ifortran +
    • SUSE Enterprise: gcc/gfortran, icc/ifortran +
    • Ubuntu 20.04: gcc/gfortran (primary development system) +
    • Ubuntu 20.04: AOCC's clang and flang (development system) with OpenJPEG +
    • Ubuntu 20.04: nvidia with OpenJPEG +
    • ARM: needed to be compiled with USE_NETCDF4=1, USE_JASPER=0 (old report) +
    • Redhat linux: 32-bit with IPOLATES, not tested recently, use netcdf4 (old report) +
    • Mandriva linux (old report) +
    • AIX: use makefile, some fiddling with libraries is necessary, not tested recently +
    • Solaris, needs gnu make and gcc (old report) +
    • Solaris-10 (old report) +
    • HPUX, needs changes to makefiles (old report) +
    • Windows: using Cygwin system produces 32-bit binaries (old report) +
    • Windows: using Cygwin system produces 64-bit binaries +
    • Windows: compiled MingW (not recent), Watcom C, icc/ifort (old report) +
    • Windows/linux subsystem (ubuntu): compiled with gcc/gfortran (old report) +
    • Intel-based Mac using gcc and gfortran +
    + +The makefile works on Redhat and Ubuntu (with needed installed options). +For other systems, you may have to modify the makefile. The makefile +requires gnu make which is a common version of make. + +

    System dependencies: 32 vs 64 bit, big vs little endian, Windows vs Linux/UNIX

    + +

    +The wgrib2 source code is written to be portable; there are no +issues with big vs little endian or the size of the integer as +long as it is 32 bits or more. The source code is written in +ANSI/ISO C (C89), with optional features that require +POSIX or POSIX-2. There has been a debate about +moving the base rquirements to C99. + +

      +
    • big vs little endian: either works +
    • 32-bit machine: files limited to 2GB files, netcdf3 may not work +
    • Windows: 2GB+ files with 64-bit cygwin, 2GB with other windows C compilers +
    • Windows: only 64-bit cygwin is supported +
    • POSIX: all POSIX code is optional. Regex support is POSIX and useful. +
    • JPEG2000: OpenJPEG library or Jasper library +
    + + +

    Source Code and Compling Hints

    +

    +The wgrib2 source code is written to the POSIX-2 standard. Features requiring +POSIX2, such as regular expressions, can usually be turned off +in the makefile. The wgrib2 code can be compiled with 32 or 64 bit pointers and integers. +However, the code has to be compiled in a like manner for all the libraries. +Some packages are optional (netcdf, mysql) and enabling these options can really +increase the executable size. +

    + +

    +While compiling wgrib2, you may see warnings about unknown pragmas. Pragmas +are "comments" that are used when compiling an OpenMP version of the code. The +default is to compile with OpenMP turned on. +

    + +

    +2/2019: The HDF5 library has problems being compiled with newer gcc compilers. +The only consisten method of adding NetCDF4 to wgrib2 is by using old compilers +(RedHat 6) or using the Intel compilers. The work around to enable NetCDF3 support +and use an external utility to convert the files to Netcdf4. + +

    +NetCDF3 has problem being compiled on 32-bit machines. +

    + + + +

    Precompiled code from External Sites

    +

    +There are many sites with precompiled versions of wgrib2. This list +is neither exhaustive nor an endorsement of the sites. I have +not tested the wgrib2 executables from these sites and YMMV. + +

    + +

    Status

    +

    +The wgrib2 is used operationally in the NCEP production suite. +

    + +

    +Change logfile +

    + +

    Changes

    +

    Prior to wgrib2 v3.1.0, chemical and aerosol names were from the NCO web table for Code Table 4.30. +For wgrib2 v3.1.0+, the names are from the WMO names for CCT14. Expect differences. For example, +"Total Aerosol" became "Total aerosol", and "Carbon Monoxide" became "Carbon monoxide". If you use +for "Carbon ]mM]onoxide", it will work with both -if and -match. + + +

    Bugs

    + +

    Please report bugs to wesley.ebisuzaki@noaa.gov. When you report bugs, +try to make them reproducible on a linux machine and include sample data. + +

    The long time practice was not to port bug fixes to older versions of +wgrib2. As of June 23, 2023, the official policy is not to backport bug fixes +to older versions of wgrib2, especially versions that are over 4 year old, +and 5 public releases ago. As of June 23, 2023, a recent CMake is necessary +to compile some default library/libraries used by wgrib2. Wgrib2 can be +compiled without the libraries and avoiding the use of CMake. + +

    Distribution

    +

    + The source code modules for wgrib2 are either in the public domain or under the GNU + licence depending on the authors of the various modules. Wgrib2 uses libraries that + are in the public domain, under various GNU licences, the Image Power JPEG-2000 Public Licence*, + libpng licence*, the zlib licence*, the netcdf licence*, HDF5 licence*, MySQL licence* and perhaps others. How + about one licence to rule them all? +

    + * optional package +

    +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page modified: 12/29/2016, 10/2/2020, 4/2024 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/interpolating_NDFD.html b/docs/web_docs/interpolating_NDFD.html new file mode 100644 index 0000000..153546f --- /dev/null +++ b/docs/web_docs/interpolating_NDFD.html @@ -0,0 +1,188 @@ + + + + Climate Prediction Center - wgrib2: -i + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 interpolating NDFD grids +
     
    + +

    wgrib2: interpolating NDFD grids

    +
    + + +

    Introduction

    + +

    +Interpolation of the NDFD CONUS grid is not supported by the +-new_grid option because the IPOLATES +library was written to grib-1 standards and the NDFD grids +use a grib-2 only scanning mode. If you want to interpolate +a NDFD CONUS grid (Lambert conformal), you have to get change +the scanning mode to WE:SN by the followin line. + +

    + $ wgrib2 ds.td.bin -rpn alt_x_scan -set_byte 3 65 64 -grib_out junk
    +1:80:d=2009062918:DPT:surface:60 hour fcst:
    +2:218826:d=2009062918:DPT:surface:66 hour fcst:
    +3:434430:d=2009062918:DPT:surface:72 hour fcst:
    +..
    +
    +$ wgrib2 junk -grid -d 1
    +1:0:grid_template=30:winds(N/S):
    +        Lambert Conformal: (1073 x 689) input WE:SN output WE:SN res 0
    +        Lat1 20.191999 Lon1 238.445999 LoV 265.000000
    +        LatD 25.000000 Latin1 25.000000 Latin2 25.000000
    +        LatSP -90.000000 LonSP 0.000000
    +        North Pole (1073 x 689) Dx 5079.406000 m Dy 5079.406000 m mode 0
    +
    + +

    +The file "junk" can now be interpolated with the -new_grid option. + + + + + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/interpolation.html b/docs/web_docs/interpolation.html new file mode 100644 index 0000000..b7f9ee4 --- /dev/null +++ b/docs/web_docs/interpolation.html @@ -0,0 +1,228 @@ + + + + Climate Prediction Center - wgrib2: interpolation + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data +> wgrib2 +> longitude-latutide interpolation +
     
    + +

    wgrib2: interpolation

    + + + +

    Introduction

    + +

    +There is no universal grid for data on a sphere. It has been a long-standing +problem that people want to know the latitude/longitude of individual grid points +or to know the value at a specified latitude/longutude point. Another problem +is that many NCEP grib files have the winds specified relative a grid rather than +the Earth's North pole. Consequently one need to rotate the winds to get them +into physical space. + +

    +For wgrib2, I have added some grid specific capabilities, + + +

      +
    • display latitude-longitude of individual grid points +
    • include latitude-longitude values in "dumps" +
    • find nearest neighbor values to specified latitude-longitude points +
    • find nearest neighbor values to specified latitude-longitude array +
    + +As of 7-2006, the only supported grids are lat-lon, Gaussian, polar stereographic, +Lambert conformal and Mercator. + +

    +The limitations of the code are that the values are not interpolated and are +simply the nearest neighbor values. In addition, the winds are not corrected +if they are grid relative. + +

    +Note, multiple requests can be combined on a singe command line, + +

    +    wgrib2 GRIB_FILE -lon 0 10 -lon 20 30 +

    +The previous line prints the values at (0E, 10N) and (20E, 30N) in the inventory of GRIB_FILE. +

    +    wgrib2 GRIB_FILE -d 1 -lola 0:35:10 -90:19:10 spread txt.out \
    +         -lola 0:11:1 0:11:1 bin bin.out +

    +The previous line writes out an array (0E .. 350E by 10 degrees), (90S .. 90N by 10 degrees) +in spread(-sheet) format in file txt.out and an array (0E .. 10E by 1 degree), (0N .. 10N by +1 degree) in binary format to the file bin.out + + + + +

    Details

    + +Adding grid information is straight forward. A (i,j) -> (lat,lon) routine is used +to create arrays of the latitude, longitude and, in the future, the wind rotation +of each grid point. Using a simple brute-force search, the nearest neighbor values +are then found. In theory, a (lat-lon) -> (i,j) routine would be faster for some +operations and allow binlinear interpolation. + +

    +The input GRIB-2 file should only have a single grid-type for maximum +efficiency. Whenever a different GDS (grid specifications) is encountered, +the lat-lon and nearest neighbors are recomputed. + + +

    Status

    +The interpolation and lat-lon code is new and not well tested. + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/inv.html b/docs/web_docs/inv.html new file mode 100644 index 0000000..d4848a5 --- /dev/null +++ b/docs/web_docs/inv.html @@ -0,0 +1,217 @@ + + + + Climate Prediction Center - wgrib2: -lon + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-inv +
     
    + +

    wgrib2: -inv

    +
    + + +

    Introduction

    + +

    +The -inv option redirects the inventory to +a file. This option could be used with an option to send decoded +data to STDOUT. + +

    +$ wgrib2 file -inv my.inv -text - -no_header  -match ':HGT:500 mb:' |  JOB
    +
    +  -inv my.inv   writes the inventory to my.inv
    +  -text -       write the decoded data as a text file to stdout
    +  -no_header    no header
    +  JOB           is some program that reads the raw data from stdin
    +
    + +

    +The -inv option is similar but different from saving +stdout. + +

    +$ wgrib2 file -inv my.inv
    +$ wgrib2 file >my.inv2
    +
    +

    + +In the above example, my.inv and my2.inv will be the same. However, +wgrib2 can be used as a grib filter. In this case, grib data is read +from stdin and written to stdout. + +

    +$ cat FILE1 FILE2 | wgrib2 - -match ':HGT:500 mb:' -grib - -inv /dev/null | \
    +   wgrib2 - -new_grid_winds earth -new_grid ncep grid 3 newgrd.grb
    +
    + + +

    +The -inv option is very specialized and helps +when you want to imbed wgrib2 within another program. For example, +reading a grib2 record from within perl program is easy. + +

    +  open(DATA, "wgrib2 file -inv /dev/null -text - -no_header -match ':HGT:500 mb:' |");
    +
    + + +

    Usage

    +

    + +

    +-inv FILE
    +
    + +See also: +-text +-bin +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005, updated 11/2019 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/inv_f77.html b/docs/web_docs/inv_f77.html new file mode 100644 index 0000000..f674b8d --- /dev/null +++ b/docs/web_docs/inv_f77.html @@ -0,0 +1,206 @@ + + + + Climate Prediction Center - wgrib2: -inv_f77 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -inv_f77 +
     
    + +

    wgrib2: -inv_f77

    +
    + + +

    Introduction

    + +

    +The -inv_f77 option writes the match inventory +(see the -match_inv option) to a file +that is readable by a fortran unformatted I/O statement. The +format is more or less standand and consistes of a 4-byte integer +of number of bytes in the character string, +the character string and 4-byte integer with the length of the +character string as a trailer. If the match inventory is shorter +than the character string, it is padded with blanks. If the +match inventory is longer, it simply truncated. Not all fortran +compilers support this format. + +

    Usage

    +

    +

     -inv_f77 OPTION CLEN FILE
    +   
    +   OPTION = "ieee" or "bin"
    +      bin = native format
    +      ieee = 4-byte big_endian header/trailer (default)
    +             4-byte little_endian header/trailer (by option)
    +   CLEN = integer, the length of the character string
    +   FILE = output file
    +
    + +

    Example

    +

    +

    +  wgrib2 IN.grb -inv_f77 bin 100  inv.dat
    +
    +  character*100  m_inv
    +  open(unit=11,file='inv.dat',form='unformatted')
    +  read(11) m_inv
    +  write(*,*) 'first record:',trim(m_inv)
    +  read(11) m_inv
    +  write(*,*) 'second record:',trim(m_inv)
    +
    + +

    +The -inv_f77 option was added to facilitate the +writing of fortran codes that can read wgrib2 output. + +See also: +-match_inv +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/irr_grid.html b/docs/web_docs/irr_grid.html new file mode 100644 index 0000000..fedbbc5 --- /dev/null +++ b/docs/web_docs/irr_grid.html @@ -0,0 +1,218 @@ + + + + Climate Prediction Center - wgrib2: -irr_grid + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -irr_grid +
     
    + +

    wgrib2: -irr_grid

    +
    + + +

    Introduction

    + +

    +This option will be elimated as template 3.130 was not adopted into the grib standard. +

    +The grib2 format allows irregular grids; that is, grids that are defined by a list of latitude-longitude pairs. +This extension to the grib2 format allows you to handle models with unusual grids, +model data interpolated to a specific point and even observations. +Why would you use grib to handle point data rather than other +formats such as BUFR or netcdf? Some formats are difficult to use and converting between from grib to netcdf/BUFR +will lose metadata. Keeping the keeping the point data in grib facilitates the conversion between gridded +and collection-of-points data. For the conversion, wgrib2 can do nearest neighbor and a Cressman analysis. + +

    Space

    +

    +Each grid point has a 4-byte latitude and a 4-byte longitude value. This is an +8 * num_grid_point byte overhead. Since each grib message is independent, this +overhead has to be repeated for each grib message even if the grid is unchanged. +Howver, the grib format allows submessages so the overhead is only for the first +submessage. However, the length of any grib message has to be +less than 2 GB in order to be compatible a 32-bit machines. In practice you should +keep the message size smaller in order not to use up all the free memory. + + +

    Usage

    +
    +-irr_grid LON-LAT-LIST RADIUS OUT
    +
    +LON-LAT-LIST   = lon-lat list, lon1:lat1:lon2:lat2:...:lon-n:lat-n
    +RADIUS         = radius in km
    +OUT            = output grib file
    +
    +The -irr_grid option creates an irregular grid using nearest-neighbor interpolation.
    +If no input grid point is within RADIUS kms, the resulting grid has a undefined value.
    +
    + +

    Example: make file with grid points at (10W,20N) (30W,40N)

    +
    +$ wgrib2 flx.grb2 -irr_grid 10:20:30:40 1000 2pt.grb2
    +1:0:d=2009010100:UFLX:surface:0-1 month ave fcst:
    +$ wgrib2 -V 2pt.grb2
    +1:0:vt=2009010100:surface:0-1 month ave fcst:UFLX Momentum Flux, U-Component [N/m^2]:
    +    ndata=2:undef=0:mean=0.0129:min=0.0035:max=0.0223
    +    grid_template=130:winds(N/S):
    +        Irregular Grid:(2 x 1) units 1e-06 input raw output raw res N/A
    +        lat=20.000000 40.000000 
    +        lon=10.000000 30.000000 
    +
    +1st point lon=10W lat=20N
    +2nd point lon=30W lat=40N
    +
    + +See also: +-grib_out_irr, +-lola, +-cress_lola, + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git "a/docs/web_docs/jj\177\177\177" "b/docs/web_docs/jj\177\177\177" new file mode 100644 index 0000000..2726cea --- /dev/null +++ "b/docs/web_docs/jj\177\177\177" @@ -0,0 +1,580 @@ + + + + Climate Prediction Center - wgrib2: -rpn + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rpn +
     
    + +

    wgrib2: -rpn

    +
    + + +

    Introduction

    + +

    +The -rpn option runs a reverse polish notation +(RPN) +calculator. Having a built-in calculator is quite handy. We use it to convert +units (ex. geopotential to geopotential meters, accumulations to rates), +compute simple quantities (net flux from downward and upward fluxes), +and even compute the plant hardiness index from the 2 m temperatures. The goal +of the calculator is to reduce the need to write simple grib programs that +do simple calculations. + +

    The "hardware" of the rpn calculator consists of 20 registers +and a stack (10 entries deep). (Wgrib2 prior to 2.0.6 has 10 registers.) +Stack entries and registers are arrays rather floating point numbers on +your store-bought calculator. + +

    +The conceptual model of the >-rpn calculator is the +grid values array is the top of the stack. The calculator has +a statck that is 10 entries deep and 20 registers. When +ever you enter rpn mode, the stack is cleared except for the +top of the stack. The registers are only clears when you +"turn on" the calculator; that is start the wgrib2 utility +or the first call to wgrib2 if you are using calling wgrib2 +through wgrib2api or pywgrib2. + +

    To save the calculations, you can save them in a register +or write them out by -grib_out, -bin, -ieee, -text, etc. + + +

    Callable wgrib2, wgrib2api

    + +

    Callable Wgrib2 and wgrib2api use the -rpn registers to transfer +gridded data between the calling program and the wgrib2 subroutine. A Fortran or C +program can read and write the wgrib2's RPN registers. For example, if a program +wants to write a grib2 file, it would first place the grid values into a register. +The calling program would then call the wgrib2 subroutine with instructions to +read a template, replace the grid values with the register values, and then +write a grib message. + +

    Implementation Details

    + +

    The size of a registers may differ as the size of grids can also vary in a grib file. +However the size of the register has to match the size of the stack entry in order +"recall" the register. + +

    Wgrib2 always reads a grib message before processing it using commmands like -rpn. +This sets the size of the data array. Thus the size of the stack entries is always +the size of the grib message that is being processed. + +

    The conceptual moddel is the data array (grid values) is the +top of the stack. The implmentation is that the data array is copied +to the top of the stack when -rpn is run, and the top of the stack is +copied to the data array when -rpn is finished. An error message +will occur if the top of the stack is empty when -rpn finishes. + +

    Limitations of -rpn

    + +

    +The -rpn option was designed for +simple calculations. For more complicated calculations, you +should use a real programming language. You can do the +calculations in another step and then import the results +using one of the various -import_* options. You can +use wgrib2api (Fortran and C) to read the data into a Fortran +or C program, do the calculation and then write the data out +using wgrib2. Finally you can use python and one of the pywgrib2 +packages to do the calculation using Python, numpy and + pywgrib2. + +

    Uses

    +
      +
    • change of units when importing data (gribifying data) +
    • computations: ex, U,V -> wind speed, wind direction, potential temperature +
    • merging data +
    • complex masking of data +
    • changing units before writing text/ieee files +
    • removing extreme data values +
    • finding min and max values +
    • finding the globally averaged precipitation +
    • comparing fields +
    + + +

    Usage

    +

    + +

    +-rpn  "A:B:C:..."
    +    A,B,C,.. = number, rpn function, or rpn operator
    +
    + +

    +Operators and Functions: +

    +Pop X, Push Fn(X)
    +
      +
    • abs: absolute value +
    • acos: arc cos, [0, pi] radians +
    • alt_x_scan: changes alternate x scanning to regular x scanning and vice versa +
    • asin: arc sin, result is [-pi/2, pi/2] radians +
    • atan: arc tan, result is [-pi/2, pi/2] radians, see atan2 +
    • abs: absolute value +
    • ceil: smallest integer >= X +
    • cos: cosine, argument in radians +
    • exp: e^X +
    • floor: largest integer <= X +
    • ln: natural logorithm +
    • raw2: convert from input scan order to output scan order +
    • sin: sine, argument in radians +
    • smth9g: smth9 for global fields +
    • smth9r: snth9 for regional fields +
    • sq: X*X +
    • sqrt: square root +
    • tan: tangent, argument in radians +
    • xave: for nx-ny grids, averages in the x direction (normally zonal mean) +
    • xdev: for nx-ny grids, remove x average (normally deviation from zonal mean) +
    • yrev: for nx-ny grids, changes we:sn to we:ns and vice versa +
    • 1/x: 1/X +
    • 2raw: convert from output scan order to input scan order +
    +Pop Y, Pop X, push Fn(X,Y) +
      +
    • +: push X+Y +
    • -: push X-Y +
    • *: push X*Y +
    • /: push X/Y +
    • <: push X < Y (1/0 if true/false) +
    • <=: push X <= Y (1/0 if true/false) +
    • ==: push X == Y (1/0 if true/false) +
    • !=: push X != Y (1/0 if true/false) +
    • >=: push X >= Y (1/0 if true/false) +
    • >: push X > Y (1/0 if true/false) +
    • atan2: push arctan(X/Y), result is [-pi, pi] radians, see atan +
    • pow: push X**Y (X^Y) +
    • mask: if (Y != 0) push(X) else push(UNDEFINED) +
    • max: push max(X,Y), for logical values, max is the same as OR +
    • merge: if (Y != UNDEFINED) push(Y) else push(X) +
    • min: push min(X,Y), for logical values, min is the same as AND +
    +Note: an operation involving an UNDEFINED is UNDEFINED +
    + + + +Stack Operators: +
    +
      +
    • clr, clear the stack (stack is emptied) +
    • dup, duplicate the top of the stack +
    • pop, remove the top of the stack +
    • exc/swap, exchange the top 2 stack entries +
    +
    +Register Operators: (note: CW2 v2.0.6+ uses registers 7,8,9 prior versions 0,1,2) +
    +
      +
    • clr_I, clear register I, I=0,1..,9 (19 for v2.0.6+) +
    • rcl_I, push register I on top of stack, I=0,1..,9 (19 for v2.0.6+) +
    • sto_I, save top of stack in register I, I=0,1..,9 (19 for v2.0.6+) +
    • rcl_lat, push latitudes onto the top of the stack (degrees) +
    • rcl_lon, push longitudes onto the top of the stack (degrees) +
    • sto_lon, save top of stack as longitudes (degrees) (wgrib2 v3.0.0+) +
    • sto_lat, save top of stack as latitudes (degrees) (wgrib2 v3.0.0+) +
    • note: latitudes and longitudes are double precision values, the stack is single precision +
    +
    + +Variables and Constants: put on the top of the stack +
    +
      +
    • number number = floating point or integer number like 0, 10.1, -1.23e-4 +
    • days_in_ref_month number of days in the month for the reference date (conversion between monthly acc. and rates) +
    • days_in_verf_month number of days in the month for the verification time (conversion betwee monthly acc. and rates) +
    • pi 3.1415.... +
    • rand random number uniformly distributed between 0 and 1, each grid point has a different random number +
    +
    + +Printing Operators: +
    +
      +
    • print_corr, write cosine weighted spatial correlation, data[TOP] data[TOP-1] +
    • print_max, print_min, data[TOP] +
    • print_rms, write cosine weighted RMS, data[TOP]-data[TOP-1] +
    • print_diff, write cosine weighted difference, data[TOP-1]-data[TOP] +
    • print_ave, write cosine weighted average, grid_ave(data[TOP]*cos(grid))/grid_ave(cos(grid)) +
    • print_wt_ave, write weighted average grid_ave, data[TOP] is the weighting + print grid_ave(data[TOP]*data[TOP-1])/grid_ave(data[TOP]) +
    +
    + + +

    Example 1

    +

    +The standard units of grib temperature is K but you want the text output in Celcius. +

    +$ wgrib2 a.grb -match ":TMP:850 mb:" -rpn "273.15:-" -text C.dat
    +
    + +

    +Fahrenheit is easy too (F = (K-273.15)*9/5+32). +

    +$ wgrib2 a.grb -match ":TMP:850 mb:" -rpn "273.15:-:9:*:5:/:32:+" -text F.dat
    +
    + +

    Example 2

    +

    +Suppose you want to limit the relative humidity values to 100. This example only +affect the RH fields. All submessages will be converted into messages. +

    +$ wgrib2 a.grb -if ":RH:" -rpn "100:min" -fi -grib_out out.grb -not_if ":RH:" -grib out.grb
    +
    +
    + +

    Example 3

    +

    +Suppose that you wanted the 500 to 1000 mb thickness, and the file only contained +one field of Z1000 and one field of Z500. + +

    +$ wgrib2 IN.grb -match ":HGT:" -match ":(500|1000) mb:" \
    +     -if ":500 mb:" -rpn sto_1 -fi \
    +     -if ":1000 mb:" -rpn sto_2 -fi \
    +     -if_reg "1:2" \
    +         -rpn "rcl_1:rcl_2:-:clr_1:clr_2" \
    +         -set_var THICK -set_lev "500-1000 mb" \
    +         -set_grib_type c3 -grib_out OUT.grb
    +
    +     line 1: only process the HGT at 500 and 1000 mb which save processing time
    +     line 2: store HGT at 500mb in register 1
    +     line 3: store HGT at 1000mb in register 2
    +     line 4: if (register 1 and register 2 have values then
    +     line 5: calculate the thickness: reg_1 - reg_2
    +     line 6: set variable type to THICK, and level to "500-1000 mb"
    +     line 7: write out the WIND data to a grib file with complex compression
    +
    +     Note: this is a very simple script and that doesn't check the matching
    +     date code, grid type, etc.
    +
    +
    +

    Example 4

    +

    +Write out the 500 mb wind speed. +

    +$ wgrib2 IN.grb -match ":[UV]grd:500 mb:" \
    +     -if ":UGRD:" -rpn "sto_1" -fi \
    +     -if ":VGRD:" -rpn "sto_2" -fi \
    +     -if_reg 1:2 \
    +         -rpn "rcl_1:sq:rcl_2:sq:+:sqrt:clr_1:clr_2" \
    +         -set_var WIND \
    +         -grib_out out.grb
    +
    +     line 1: only process the U and V at 500 mb
    +     line 2: store U 500mb in register 1
    +     line 3: store V 500mb in register 2
    +     line 4: if (register 1 and register 2 have values then
    +     line 5: calculate the wind speed: sqrt(reg_1**2 + reg_2**2)
    +     line 6: set variable type to WIND (wind speed)
    +     line 7: write out the WIND data to a grib file
    +
    +     Note: this is a very simple script and that doesn't check the matching
    +     date code, grid type, etc.
    +
    +     Note: there are options to calculate wind speed and wind direction
    +
    + + +

    Example 5

    +

    +Suppose someone made a mistake and the latent heat flux (LHTFL) had the wrong sign. RPN to the rescue. + +

    +$ wgrib2 IN.grb -match ":LHTFL:" -rpn "-1:*" -grib_out new_lhtfl.grb
    +
    + +The file, new_lhtfl, only contained the LHTFL fields. You duplicate the file with the +fixed LHTFL fields by + +
    +$ wgrib2 IN.grb -if ":LHTFL:" -rpn "-1:*" -fi -grib_out new.grb
    +
    + +It would be faster if you only compressed the LHTFL fields. (-grib uses the +original compressed data and -grib_out uses the "data" register.) + +
    +$ wgrib2 a.grb -set_grib_type jpeg \
    +   -not_if ":LHTFL:" -grib new.grb -if ":LHTFL:" -grib_out new.grb
    +
    + + +If both the latent and sensible heat fluxes needed a sign reversal, you could do, + +
    +$ wgrib2 a.grb -if ":(LHTFL|SHTFL):" -rpn "-1:*" -fi -grib_out new.grb
    +
    +

    Example 6

    +If you want to set certain values to undefined, you define a mask and then +apply the mask. In this example, values below 20 are set to undefined. + +
    +$ wgrib2 a.grb -rpn "dup:20:>=:mask" -grib_out -set_grib_type c3 new.grb 
    +
    +The RPN calculator is used:
    +    dup       the data is duplicated
    +    20        20 is pushed on the stack
    +    >=        test data >= 20, top of stack is 1/0 depending on test >= 20
    +    mask      apply mask to the data
    +
    +-set_grib_type c3    sets the grib compression to complex3
    +-grib_out new.grb    writes a grib message using the decoded data
    +
    + +Don't forget to enclose the argument to rpn in quotes because the shell can do unexpect things. + +Printing operators +
    + print_corr write cosine weighted spatial correlation R(TOP-1), R(TOP)
    + print_max write max(R(TOP)) to stdout
    + print_min write min(R(TOP)) to stdout
    + print_rms write cosine weighted RMS(R(TOP-1)-R(TOP))
    +
    + +

    Example 7: Merging

    + +

    +Suppose that we have a nested model, we have a low resolution TMP2m from the +the outer model and a high-resolution TMP2m from the nested model. Now we +want a field that uses the TMP2m in the nested-model domain and the TMP2m from +the outer model elsewhere. To do this, you need to convert both fields to a +common grid. Then you use "-rpn merge". Make sure that both domains are +contained in the common grid as this is a requirement of the interpolation library. + +

    +   wgrib2 OUTER.T2m -new_grid_winds earth -new_grid A B C A1.grb
    +   wgrib2 NESTED.T2m -new_grid_winds earth -new_grid A B C A2.grb
    +   wgrib2 A2.grb -rpn sto_1 -import_grib A1.GRB -rpn "rcl_1:merge" \
    +    -grib_out MERGED.T2m
    +
    + + +

    Example 8: Land Mask

    +The file mask.grb contains the values 0 for water, 1 for land and +2 for sea ice. I wanted a small file with 0 for water+sea-ice and 1 for land. + +
    +wgrib2 mask.grb -rpn "1:==" -set_scaling 0 1 -set_grib_type c1 -grib_out land.grb
    +
    +  -rpn "1:=="        if grid value is 1, the new value is 1 else 0
    +  -set_scaling 0 1   1 bit for storing the grib values
    +  -set_grib_type c1  complex packing 1 is good for long runs of the same value.
    +   The file sizes  16 bits/point 16 bits precision simple packing (mask.grb)
    +                   0.7 bits per point 16 bits precision complex packing 1 (mask.grb)
    +                   0.2 bits per point complex packing 1 (land.grb)
    +   grid size: 131K points, land.grb is 3331 bytes
    +
    + + +

    Example 9: Total-total index

    +

    +An example of calculating the dewpoint and +total-total index is more involved. Using an on-line infix to postfix (reverse polish) +calculator is helpful. + +

    Example 10: global precipitation

    +

    The model has the precipitation in the variable PRATE +which has units of mm/sec (assuming 1 gm H2O = 1cc). Suppose +I wanted the globally averaged precip in the non-metric unit +of mm/day. It's one command away +

    +  wgrib2 gfsfile -match PRATE -s -rpn "86400:*" -stats
    +
    + +

    Changes

    + +

    Wgrib2 v3.0.0+ adds error chechking to floating point values, +

    +   wgrib2 prior to 3.0.0
    +
    +      wgrib2 IN.grb -rpn "2cars:+" -grib_out OUT.grb
    +           adds 2 to the grid point values as atof("2cars") returns 2.0
    +
    +   wgrib2 v3.0.0+
    +
    +      wgrib2 IN.grb -rpn "2cars:+" -grib_out OUT.grb
    +          will result in an error message as "2cars" is not a legal floating point value
    +
    +

    Comments

    +

    +Warning: Reverse Polish notation can cause headaches if you try something +too complicated. An infix -> postfix calculator is the suggested +remedy. Another approach is to use pywgrib2_s, pywgrib2_xy, or pywgrib2_lite. + + +

    +The -rpn option is a piece of easy to +understand and modify code (RPN.c). If you want to add +a specialized function (ex. wind chill calculation), you many +consider adding it to the RPN calculator. The another method +is to code your calculation in python and use pywgrib2_s, +pywgrib2_xy or pywgrib2_lite. + +

    +Why an RPN calculator? Well, wgrib2 is heavily influenced by the stack language Forth. +It's only natural that the calculator would be based on reverse +Polish notation. + +

    +See also: +-if, +-if_reg, +-fi, +-grib_out, +-rpn_rcl, +-rpn_sto, + + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Aug 4, 2016, Oct 10, 2018, July 11, 2020, July 11, 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/last.html b/docs/web_docs/last.html new file mode 100644 index 0000000..6505568 --- /dev/null +++ b/docs/web_docs/last.html @@ -0,0 +1,216 @@ + + + + Climate Prediction Center - wgrib2: -last + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -last +
     
    + +

    wgrib2: -last

    +
    + +

    Introduction

    + +

    The -last FILE option writes the results of the previous option +to FILE. The FILE can be a disk file, temporary file or memory file. If +the -last option preceeds any inventory options, then the +"grib message number[.submessage number:byte location" will be written to the file. + +

    The -last option was designed for callable wgrib2 to obtain +inventory information. +Note the -s_out FILE option should be replaced by the +more powerful -s -last FILE syntax. + +

    The -last option does not write to the inventory, so +if you have two consecutive -last options, the second +-last will have no output. With wgrib2 v3.0.0+, the +-last and -last0 options will +not clear the last option output buffer. +So the the second -last option will have the same output +as the immediately preceeding -last or -last0 +option. + +

    Usage

    +

    + +

    +-last FILE
    +
    + +

    Example

    + +Suppose you want a the grid values (nearest neighbor) for 1000 points. You could +do something like this, + +
    +$ wgrib2 gep19.t00z.pgrb2af180 -s -lon 0 10 > point1.txt
    +$ wgrib2 gep19.t00z.pgrb2af180 -s -lon 20 50 > point2.txt
    +...
    +$ wgrib2 gep19.t00z.pgrb2af180 -s -lon 250 40 > point1000.txt
    +
    +This would not be the fastest because you have to read and decode +the input file 1000 times. You could read and decode the file once +by using the -last option. Here how to do it using N=2. + +
    +wgrib2 gep19.t00z.pgrb2af180 -s -last point1.txt -last point2.txt \
    +    -print_out ':' point1.txt -lon 0 0 -last point1.txt -nl_out point1.txt \
    +    -print_out ':' point2.txt  -lon 10 20 -last point2.txt -nl_out point2.txt
    +
    + + +

    The -new_grid option can interpolate to set of +user defined grid points. + +See also: +-last0 +-new_grid +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 1, 2015, March 5, 2018, June 2, 2020, June 23, 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/last0.html b/docs/web_docs/last0.html new file mode 100644 index 0000000..e0b5267 --- /dev/null +++ b/docs/web_docs/last0.html @@ -0,0 +1,191 @@ + + + + Climate Prediction Center - wgrib2: -last0 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -last0 +
     
    + +

    wgrib2: -last0

    +
    + +

    Introduction

    + +

    The -last0 FILE option writes the results of the previous option +to the beginning of FILE. The FILE can be a disk file, temporary file or memory file. If +the -last option preceeds any inventory options, then the +"grib message number[.submessage number:byte location" will be written to the file. + +

    The -last0 option was designed for callable wgrib2. This +allows calls to wgrib2 to obtain inventory information. Note +the -s_out FILE option should be replaced by the +more powerful -s -last FILE syntax. + +

    The -last0 option does not write to the inventory, so +if you have two consecutive -last0 options, the second +-last0 will have zero output. With wgrib2 v3.0.0+, the +-last and -last0 options will +not clear the last option output buffer. +So the the second -last0 option will have the same output +as the immediately preceeding -last or -last0 +option. + + +

    Usage

    +

    + +

    +-last0 FILE
    +
    + +See also: +-last +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: September 12, 2017, June 2, 2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/lev.html b/docs/web_docs/lev.html new file mode 100644 index 0000000..ba22620 --- /dev/null +++ b/docs/web_docs/lev.html @@ -0,0 +1,183 @@ + + + + Climate Prediction Center - wgrib2: -lev + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-lev +
     
    + +

    wgrib2: -lev

    +
    + + +

    Introduction

    + +

    +The -lev option prints the level of the +field. +

    Usage

    +

    + +

    +-lev
    +
    + +

    Example

    +

    + +

    +$ wgrib2 grib2.polar -lev
    +1.1:0:500 mb
    +1.2:0:850 mb
    +
    + +See also: -s +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/lev0.html b/docs/web_docs/lev0.html new file mode 100644 index 0000000..e228363 --- /dev/null +++ b/docs/web_docs/lev0.html @@ -0,0 +1,168 @@ + + + + Climate Prediction Center - wgrib2: -lev0 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-lev0 +
     
    + +

    wgrib2: -lev0

    +
    + + +

    Warning

    + +

    +The -lev0 option is used by the script g2ctl +to generate control files for GrADS. The output of this option is +determined by the needs of g2ctl. + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/libwgrib2.html b/docs/web_docs/libwgrib2.html new file mode 100644 index 0000000..821fee8 --- /dev/null +++ b/docs/web_docs/libwgrib2.html @@ -0,0 +1,186 @@ + + + + Climate Prediction Center - libwgrib2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > libwgrib2 +
     
    + +

    libwgrib2

    +
    + + +

    The wgrib2 library

    + +

    +The wgrib2 library contains the callable wgrib2 routine, an +alternative method of calling the wgrib2 routine, a routine to +close files, and routines that +allow access to the rpn registers and memory files, + +

    All the nice-to-use routines used by wgrib2 are considered internal +routines and should not be called. The wgrib2 library is used by the fortran +wgrib2api, C wgrib2api, and pywgrib2. + +

      +
    1. int wgrib2(int argc, const char **argv);
      standard C interface to wgrib2, identical to the wgrib2 utility except for error handling +
    2. int wgrib2a(char *arg1, char *arg2, ...);
      NULL terminated set of text arguments +
    3. int wgrib2_free_file(const char *filename);
      close file *filename +
    4. size_t wgrib2_get_mem_buffer_size(int n);
      get size of memory buffer n in bytes +
    5. int wgrib2_get_mem_buffer(unsigned char *buffer,size_t size, int n);
      copy memory buffer n to buffer[0]:buffer[size-1] +
    6. int wgrib2_set_mem_buffer(const unsigned *buffer, size_t size, int n);
      copy buffer to memory buffer n +
    7. size_t wgrib2_get_reg_size(int reg);
      return size of register n in number of floats +
    8. int wgrib2_get_reg_data(float *data, size_t size, int reg);
      copy register n to data[0]..data[size-1] +
    9. int wgrib2_set_reg_reg(float *data, size_t size, int reg);
      copy data[0]..data[size-1] to register n +
    +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Sep 16, 2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/limit.html b/docs/web_docs/limit.html new file mode 100644 index 0000000..a1f56d7 --- /dev/null +++ b/docs/web_docs/limit.html @@ -0,0 +1,181 @@ + + + + Climate Prediction Center - wgrib2: -limit + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-limit +
     
    + +

    wgrib2: -limit

    +
    + + +

    Introduction

    + +

    +The -limit option stops the processing of the grib file after N messages/submessages have been decoded. The purpose of this function +to limit amount of CPU time that a web server may devote to an individual +request. + +

    +The newer -alarm option is better suited for stopping jobs web jobs. + +

    Usage

    +

    + +

    +-limit N    where N is an integer.
    +
    + +See also: -quit, +-alarm + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 3, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/limitations.html b/docs/web_docs/limitations.html new file mode 100644 index 0000000..4105ea8 --- /dev/null +++ b/docs/web_docs/limitations.html @@ -0,0 +1,236 @@ + + + + Climate Prediction Center - wgrib2: limitations + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 questions +
     
    + +

    wgrib2: limitations

    +
    + +
      Limitations on 32-bit computer +
    1. The maximum grib file is limited to 2GB unless the file is read sequentially.
      + i.e., cat grib_file | wgrib2 - (rest of options) +
    2. large grib messages and grids will use buffer space and exhaust physical memory. +
    3. grib message is limited to 2GB (fixed v2.0.4) +
    4. Any buffer greater than 4GB is a problem. +
    5. The maximum grib message is limited to 2GB to 4GB (depending on routine) +
    6. The maximum number of grid points varies by routine from to 2G to 4G (grib2 standard=4G).
      + The amount of addressable memory will be a limitation. +
    7. The maximum bit precision of a complex-packed file is 25. +
    + +
      Limitations on 64-bit computer +
    1. The maximum number of grid points varies by routine from to 2G to 4G (grib2 standard=4G).
      + Low priority to get the routines to 4G.
      +
    2. -new_grid is limited to 2G grid points by the fortran library. +
    3. grib message is limited to 2GB (fixed v2.0.4) +
    4. The maximum bit precision of a complex-packed file is 25. +
    + +
      Limitations on computer with 64-bit pointers and 32-bit long integers +
    1. Similar to 32-bit limitations. +
    + + +
      Supported Unpacking Schemes +
    1. simple +
    2. simple with log preprocessing +
    3. complex with bitmaps or special values +
    4. jpeg2000 +
    5. png +
    6. ieee +
    7. RLE +
    8. CCSDS/AEC +
    + +
      Supported Packing Schemes +
    1. simple +
    2. complex with bitmaps or special values +
    3. jpeg2000 +
    4. ieee +
    5. CCSDS/AEC +
    + +
      Grid Support Levels: geolocation +
    1. nothing +
    2. diagnostic inforamtion +
    3. latitude/longitude of the grid points are calculated (spherical earth) +
    4. latitude/longitude of the grid points are calculated (aspherical earth) +
    + +
      Grid Support Levels: ipolates (-new_grid) +
    1. nothing +
    2. can be an input grid for -new_grid +
    3. can be an input or output grid for -new_grid +
    + +
      Grid Support Levels: -small_grib +
    1. nothing +
    2. can be an input grid for -small_grib +
    + + +
      Grid support: +
    • lat-lon: full support +
    • Lambert conformal: full support +
    • Polar stereographic: full support +
    • Mercator: full support +
    • Gaussian: all but -small_grib +
    • thinned lat-lon grids: only geolocation +
    • rotated lat-lon grids: only geolocation +
    • space view perspective: only geolocation +
    • Albers equal area: only geolocation +
    • Lambert Azimuthal equal area: only geolocation +
    • staggering all above except for Gaussian: only geolocation +
    • irregular grid: only geolocation +
    + + + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 27, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/little_endian.html b/docs/web_docs/little_endian.html new file mode 100644 index 0000000..74b8418 --- /dev/null +++ b/docs/web_docs/little_endian.html @@ -0,0 +1,187 @@ + + + + Climate Prediction Center - wgrib2: -big_endian, -little_endian + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -big_endian -little_endian +
     
    +

    + +

    wgrib2: -big_endian -little_endian + +

    + + +

    Introduction

    + +

    +The -big_endian and the +-little_endian +options changes the order that IEEE numbers are read and written. This +does not affect the order in which binary numbers are read/written. + + +

    Usage

    +

    + +

    +-big_endian
    +   or
    +-little_endian
    +
    + + +See also: +-ieee, +-import_ieee, +-header, +-no_header, +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Aug, 2011 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ll2i.html b/docs/web_docs/ll2i.html new file mode 100644 index 0000000..fed4aa6 --- /dev/null +++ b/docs/web_docs/ll2i.html @@ -0,0 +1,228 @@ + + + + Climate Prediction Center - wgrib2: -ll2i + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ll2i +
     
    + +

    wgrib2: -ll2i

    +
    + + +

    Introduction

    + +

    +The -ll2i and + -ll2ij options are in alpha status. +

    +The -ll2i has been redefined (v2.0.5) so that it returns +the value 1..ndata. This change was to support grids from 1..2^32 - 1 grid points. +With this change, 0 denotes a lat-lon that is outside of the domain. + +

    +The -lon option uses a brute-force +method to find the closest grid point to a specified latitude +and longitude. It finds the minimum distance to each grid +point. This slow procedure is more-or-less necessary when +your geolocation routines can transfrom from (X,Y) -> (lon, lat) +but not (lon, lat) -> (X, Y). The gctpc/Proj4 geolocation +libraries have both the forward and inverse transformation so +improved geolocation routines can be added to wgrib2 such +as a fast -lon option and a +bilinear interpolation option. + +

    Some grids only have an (i,j) -> (lon,lat) transformation. +(I.e., find that lat-lon of the grid points.) Examples include: +staggered grids, thinned Gaussian grids and irregular grids. + + + +

    +The -ll2i option takes a given latitude and +longitude, finds the grid point that is closest to that specified +latitude and longitude and prints out the index of the grid point. +The -ll2i option uses the gctpc library +and only supports a grids supported by gctpc. + + +Note that updated -ll2i uses the Fortran convention +which has the index starting at one. Note that the index is for +the output grid which may be different from the input grid. +For example, the GFS usually writes the grib files in WE:NS order. +By default, wgrib2 will read a WE:NS input grid and convert it to +to a WE:SN (output) grid. This is explained in the page for the +-scan option. + +

    Usage

    +

    + +

    +-ll2i LON LAT
    +      LON is the longitude -180..360
    +      LAT is the latitude from -90..90
    +      option prints out the index,  0..number of grid points - 1
    +
    + +

    Example

    + +
    +-sh-4.1$ wgrib2 png.grb2 -ll2i 11 22
    +1:4:11.000000 22.000000 -> (40332)
    +-sh-4.1$ wgrib2 png.grb2 -ilat 40332
    +1:4:grid pt 40331,lon=10.000000,lat=22.000000,val=3.3
    +
    + + +See also: -ilat, +-scan, + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 3, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ll2ij.html b/docs/web_docs/ll2ij.html new file mode 100644 index 0000000..e8b890b --- /dev/null +++ b/docs/web_docs/ll2ij.html @@ -0,0 +1,196 @@ + + + + Climate Prediction Center - wgrib2: -ll2ij + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ll2ij +
     
    + +

    wgrib2: -ll2ij

    +
    + + +

    Introduction

    + +

    +The -ll2ij and + -ll2ij options are in alpha status. +

    +The -lon option uses a brute-force +method to find the closest grid point to a specified latitude +and longitude. It finds the minimum distance to each grid +point. This slow procedure is more-or-less necessary when +your geolocation routines can transfrom from (X,Y) -> (lon, lat) +but not (lon, lat) -> (X, Y). The gctpc/Proj4 geolocation +libraries have both the forward and inverse transformation so +improved geolocation routines can be added to wgrib2 such +as a fast -lon option and a +bilinear interpolation option. + +

    Some grids only have an (i,j) -> (lon,lat) transformation. +(I.e., find that lat-lon of the grid points.) Examples include: +staggered grids, thinned Gaussian grids and irregular grids. + + + +

    +The -ll2ij option takes a given latitude and +longitude, finds the grid point that is closest to that specified +latitude and longitude and prints out the ix and iy of the grid point. +The -ll2i option uses the gctpc library +and only supports a grids supported by gctpc. + + +

    +See also: -ijlat, +-ll2i + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan 20, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/lola.html b/docs/web_docs/lola.html new file mode 100644 index 0000000..86778f0 --- /dev/null +++ b/docs/web_docs/lola.html @@ -0,0 +1,222 @@ + + + + Climate Prediction Center - wgrib2: -lola + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-lola +
     
    + +

    wgrib2: -lola

    +
    + + +

    Introduction

    + +

    +The -lola option was not named after a girl but for extracting data +on a LOngitude-LAtitude grid. You need to specify the lower +left corner of the grid, the number of points in the zonal and meridional directions +and the latitude/longitude increments. Finally you need to specify the output file +and the format. WARNING: winds and other vector fields will not be +rotated. If the vector fields use a grid relative orientation, +then your interpolated winds will be using the original grid. + + +

    Interpolation scheme

    +

    +The interpolation to the lola grid is by nearest neighbor. Sure there are more +accurate schemes and people are welcome to do better. Warning: the interpolation +scheme simply picks up the value of the nearest neighbor. This can be very +inaccurate for winds and other vectors near the pole. + +

    Usage

    +

    + +

    +-lola LonSW:#lon:dlon LatSW:#lat:dlat file format
    +
    +LonSW        Longitude of the South-West point, values from 0 .. 360
    +#lon         number of longitude points
    +dlon         spacing of the points in the zonal direction in degrees
    +
    +LatSW        Latitude of the South-West point, values from -90 .. 90
    +#lat         number of latitude points
    +dlat         spacing of the points in the meridional direction in degrees
    +
    +file         name of the output file
    +
    +format       format of the output file: bin, text, spread
    +               bin = binary
    +               text = simple "text" format, one value per line
    +               spread = spread-sheet format, latitude, longitude and value of each grid point
    +               grib = grib2
    +
    +The order of the data points is WE:SN (wgrib2 standard).
    +
    +
    + +

    Comments

    +I dislike this routine. It is slow, uses a simplistic interpolation +scheme and doesn't handle rotated winds in a useful manner. +

    +The grib file support allows you to make lat-lon templates which is used by +g2grb.gs. As much as I dislike this routine, I keep using it for interpolations. +Keep wanting to modify it to do bilinear interpolations for interpolating from +lat-lon grids. + +

    +5/2010: interpolation from regular lat-lon grids is now handled as special case. +This speeds up the interpolation and paves the way for a bilinear interpolation +for the special cases. + +

    +See alse: -lon +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/lon.html b/docs/web_docs/lon.html new file mode 100644 index 0000000..7c515f1 --- /dev/null +++ b/docs/web_docs/lon.html @@ -0,0 +1,315 @@ + + + + Climate Prediction Center - wgrib2: -lon + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-lon +
     
    + +

    wgrib2: -lon

    +
    + + +

    Introduction

    + +

    +The -lon option prints the value of the grid point +closest to the specified longitude latitude. The latitude-longitude of the grid +point are also printed. If you use the verbose mode, the grid +coordinates (i,j) and the number of the element are also printed. +The -lon option can be repeated to save processing +time. + +

    +-sh-2.05b$ wgrib2 eta.t00z.awphys18.grb2 -d 1 -s -lon 249 39 -lon 255 33
    +1:0:d=2003090300:MSLET:mean sea level:18 hour fcst:lon=249.035,lat=38.9912,val=101685:
    +lon=254.964,lat=32.9671,val=101668
    +
    +-sh-3.00$ wgrib2 rtma.t12z.2dvaranl_ndfd.grb2.c2 -d 1 -v -lon -120 30
    +1:0:lon=240.008805,lat=29.988418,i=220037,ix=72,iy=206,val=0
    +
    + +In the latter example, the verbose mode has been set and +the inventory includes both the value, location and its +grid coordinates; i.e., the 220037th element in the array and +its coordinates are (72,206). Note that these coordinates +are after the data has been converted into a WE:SN scan order. +Both the i, ix and iy start with a value of one. + +

    Usage

    +

    + +

    +-lon LONGITUDE LATITUDE
    +      LONGITUDE = 0 .. 360
    +      LATITUDE = -90 .. 90
    +
    +      If the verbosity is 0, the print out the longitude and
    +        latitude of the nearest grid point as well as the grid value.
    +
    +      If the verbosity is 1 or higher, the prints out the longitude and
    +        latitude of the nearest grid point, the index (i) to the data,
    +        the grid coordinates (ix,iy) as well as the grid point value.
    +
    +        i = 1..number of grid points
    +        ix = 1..nx
    +        iy = 1..ny
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -s -lon -90 20
    +1:0:d=2005090200:HGT:1000 mb:60 hour fcst:lon=270,lat=20,val=121.3
    +2:133907:d=2005090200:HGT:975 mb:60 hour fcst:lon=270,lat=20,val=344.4
    +3:263511:d=2005090200:HGT:950 mb:60 hour fcst:lon=270,lat=20,val=573
    +4:389058:d=2005090200:HGT:925 mb:60 hour fcst:lon=270,lat=20,val=806.5
    +...
    +
    + +

    Old vs New

    + +

    The original code for the +-lon option used the internal geolocation package. +This package could compute the lat/lon of the grid points but +nothing else. To find the grid point closest to a specified +lat/lon, the distance to every grid point had to be calculated. +Later, a short cut was added for lat-lon grids. Finally the +geolocation packages gctpc and Proj4 have inverse functions +which allow you to find the closest grid point to specified point +for the the supported grids. For unsupported grids like the +Gaussian grid and staggered grids, the original brute force +code is used. You can turn off the new code by the +-gctpc 0 option. The old code did +not know about grid domains and would find the closest point +even if the point were outside of the grid domain. The +gctpc-based closest will return a lat=lon=999 to signal an +intial point outside of the domain. + + +

    Want Speed?

    + +

    You want extract the values for a 1000 different points. +So you call wgrib2 1000 times and complain that wgrib2 is slow. +Well decoding a jpeg2000 compressed file 1000 times does take time. +It's better to add a 1000 -lon options to the +command line and only decode the file once. + +

    The number of -lon options on a +command line is limited by a compile-time option. Try +running wgrib2 -config and look for the line +"maximum number of arguments on command line:". The current +value is 5000 which allows you 5000 words on the command line. Each +-lon option takes 3 words, so that gives +you about 1600 -lon options you can run +on one line. Of course, limitations such as the maximum line +length or maximum number of continuations may stop you first. + +

    Text, Binary and CSV Output

    + +

    The -lon option writes the grid value +to the inventory. What happens if you want the output written +to a file. You could write the output of +-lon to a file by using the +-last option. + +

    +$ wgrib2 gep19.aec -lon 10 20  -last junk -nl_out junk -for 1:3
    +1:0:lon=10.000000,lat=20.000000,val=12391.6
    +2:70707:lon=10.000000,lat=20.000000,val=219.5
    +3:96843:lon=10.000000,lat=20.000000,val=85
    +$ cat junk
    +lon=10.000000,lat=20.000000,val=12391.6
    +lon=10.000000,lat=20.000000,val=219.5
    +lon=10.000000,lat=20.000000,val=85
    +
    + +

    +You can also use the -lola option which can +write a 1x1 grid to binary, text or a grib file. + +

    +$ wgrib2 gep19.aec -no_header -lola "10:1:1" "20:1:1" out.txt text -for 1:3
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +2:70707:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    +3:96843:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    +$ cat out.txt
    +12391.6
    +219.5
    +85
    +
    + +You can make a CSV file by first converting the grib file and running wgrib2 on that +grib file. + +
    +$ wgrib2 gep19.aec -no_header -lola "10:1:1" "20:1:1" out.grb grib -for 1:3
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +2:70707:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    +3:96843:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    +$ wgrib2 out.grb -csv out.csv
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +2:182:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    +3:364:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    +$ cat out.csv
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",10,20,12391.6
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","TMP","200 mb",10,20,219.5
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","RH","200 mb",10,20,85
    +
    + + +

    +See also: -last, +-lola, +-config + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Oct 25, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/long_cmd_list.html b/docs/web_docs/long_cmd_list.html new file mode 100644 index 0000000..d6d6ef3 --- /dev/null +++ b/docs/web_docs/long_cmd_list.html @@ -0,0 +1,538 @@ + + + + Climate Prediction Center - wgrib2: + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + +
     
    +
    +wgrib2 v3.1.1rc1 4/2022  Wesley Ebisuzaki, Reinoud Bokhorst, John Howard, Jaakko Hyvätti, Dusan Jovic, Daniel Lee, Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Gregor Schee, Arlindo da Silva, Niklas Sondell, Sam Trahan, George Trojan, Sergey Varlamov
    +   stock build
    + -else            else         else, -if ... -else ... -endif
    + -elseif          elif  X      elseif X (POSIX regular expression) conditional on match, -if ... -elseif ... -endif
    + -elseif_fs       elif  X      elseif X (fixed string) conditional execution
    + -elseif_n        elif  X      elseif (inv numbers in range), X=(start:end:step)
    + -elseif_rec      elif  X      elseif (record numbers in range), X=(start:end:step)
    + -elseif_reg      elif  X      elseif rpn registers defined, X = A, A:B, A:B:C, etc A = register number
    + -endif           endif        terminates if block
    + -if              if    X      if X (POSIX regular expression), conditional execution on match
    + -if_delayed_error if           if delayed error
    + -if_fs           if    X      if X (fixed string), conditional execution on match
    + -if_n            if    X      if (inv numbers in range), X=(start:end:step)
    + -if_rec          if    X      if (record numbers in range), X=(start:end:step)
    + -if_reg          if    X      if rpn registers defined, X = A, A:B, A:B:C, etc A = register number
    + -not_if          if    X      not_if X (regular expression), conditional execution on not match
    + -not_if_fs       if    X      if X (fixed string) does not match, conditional execution up to next output/fi
    + -0xSec           inv   X      Hex dump of section X (0..8)
    + -aerosol_size    inv          optical properties of an aerosol
    + -aerosol_wavelength inv          optical properties of an aerosol
    + -bitmap          inv          bitmap mode
    + -center          inv          center
    + -checksum        inv   X      CRC checksum of section X (0..8), whole message (X = -1/message) or (X=data)
    + -cluster         inv          cluster identifier
    + -cluster_info    inv          cluster information
    + -code_table_0.0  inv          code table 0.0 discipline
    + -code_table_1.0  inv          code table 1.0 master table version
    + -code_table_1.1  inv          code table 1.1 local table version
    + -code_table_1.2  inv          code table 1.2 significance of reference time
    + -code_table_1.3  inv          code table 1.3 production status of processed data
    + -code_table_1.4  inv          code table 1.4 type of processed data
    + -code_table_1.5  inv          Identification template number
    + -code_table_1.6  inv          calendar
    + -code_table_3.0  inv          code table 3.0 Source of grid definition
    + -code_table_3.1  inv          code table 3.1 Grid definition template number
    + -code_table_3.11 inv          code table 3.11 regional/global thinned/reduced grid
    + -code_table_3.15 inv          code table 3.15 Physical meaning of vertical coordinate
    + -code_table_3.2  inv          code table 3.2 Size (radius) and Shape of Earth
    + -code_table_3.20 inv          code table 3.20 Type of Horizontal line
    + -code_table_3.21 inv          code table 3.21 Vertical Dimension coordinate values defn
    + -code_table_3.6  inv          code table 3.6 Spectral data representation type
    + -code_table_3.7  inv          code table 3.7 Spectral data representation mode
    + -code_table_3.8  inv          code table 3.8 Grid point position
    + -code_table_4.0  inv          code table 4.0 Product Definition Template Number
    + -code_table_4.1  inv          code table 4.1
    + -code_table_4.10 inv          code table 4.10 statistical processing .. first occurence
    + -code_table_4.11 inv          code table 4.11 (first) type of time intervals
    + -code_table_4.11s inv          code table 4.11 (all) type of time intervals
    + -code_table_4.15 inv          code table 4.15 type of areal statistical processing
    + -code_table_4.16 inv          code table 4.16 quality control value
    + -code_table_4.2  inv          code table 4.2
    + -code_table_4.230 inv          code table 4.230 chemical constituent type
    + -code_table_4.233 inv          code table 4.233 aerosol type
    + -code_table_4.235 inv          code table 4.235 Wind-generated wave spectral description
    + -code_table_4.240 inv          code table 4.240 Type of distribution function
    + -code_table_4.241 inv          code table 4.241 coverage attributes
    + -code_table_4.242 inv          code table 4.242 tile classification
    + -code_table_4.3  inv          code table 4.3 Type of Generating Process
    + -code_table_4.4  inv          code table 4.4 (first)
    + -code_table_4.5a inv          code table 4.5 (1st value)
    + -code_table_4.5b inv          code table 4.5 (2nd value)
    + -code_table_4.6  inv          code table 4.6 ensemble type
    + -code_table_4.7  inv          code table 4.7 derived forecast
    + -code_table_4.8  inv          code table 4.7 derived forecast
    + -code_table_4.9  inv          code table 4.9 Probability Type
    + -code_table_4.91 inv          code table 4.91 type of interval
    + -code_table_4.91b inv          code table 4.91 type of interval (2nd copy)
    + -code_table_5.0  inv          code table 5.0 data representation number
    + -code_table_5.1  inv          code table 5.1 type of original field values
    + -code_table_5.4  inv          code table 5.4 group splitting method
    + -code_table_5.5  inv          code table 5.5 missing value management for complex packing
    + -code_table_5.6  inv          code table 5.5 complex packing spatial differencing
    + -code_table_5.7  inv          code table 5.7 precision in IEEE packing
    + -code_table_6.0  inv          code table 6.0 Bitmap indicator
    + -ctl_ens         inv          ens info for g2ctl/GrADS
    + -ctl_inv         inv          ctl inventory dump for g2ctl/GrADS
    + -cyclic          inv          is grid cyclic? (not for thinned grids)
    + -disc            inv          discipline (code table 0.0)
    + -domain          inv          find rectangular domain for g2ctl/GrADS plots
    + -end_ft          inv          verf time = reference_time + forecast_time + stat. proc time (YYYYMMDDHH) (same as -vt)
    + -end_FT          inv          verf time = reference_time + forecast_time + stat. proc time (YYYYMMDDHHMMSS) (same as -VT)
    + -ens             inv          ensemble information
    + -ext_name        inv          extended name, var+qualifiers
    + -flag_table_3.10 inv          flag table 3.10 scanning mode for one diamond
    + -flag_table_3.3  inv          flag table 3.3, resolution and component flags
    + -flag_table_3.4  inv          flag table 3.4, scanning mode
    + -flag_table_3.5  inv          flag table 3.5 projection center
    + -flag_table_3.9  inv          flag table 3.9 numbering order of diamonds seen from corresponding pole
    + -ftime           inv          either ftime1 or ftime2 dep on version_ftime
    + -ftime1          inv          forecast time
    + -ftime2          inv          timestamp -- will replace -ftime in the future TESTING
    + -ftn_api_fn0     inv          n npnts nx ny msg_no submsg i11,5(1x,i11)
    + -full_name       inv          extended name, var+misc+lev (depreciated)
    + -gdt             inv          contents of Grid Definition Template (g2c)
    + -geolocation     inv          package (proj4,gctpc,internal,not_used) to get lat/lon of grid points
    + -get_byte        inv   X Y Z  get bytes in Section X, Octet Y, number of bytes Z (decimal format)
    + -get_hex         inv   X Y Z  get bytes in Section X, Octet Y, number of bytes Z (bytes in hexadecimal format)
    + -get_ieee        inv   X Y Z  get ieee float in Section X, Octet Y, number of floats Z
    + -get_int         inv   X Y Z  get 4-byte ints in Section X, Octet Y, number of ints Z
    + -get_int2        inv   X Y Z  get 2-byte ints in Section X, Octet Y, number of ints Z
    + -grib_max_bits   inv          maximum bits used in grib encoding
    + -grid            inv          grid definition
    + -grid_id         inv          show values from grid_id
    + -hybrid          inv          shows vertical coordinate parameters from Sec4 (assuming 2 var per level
    + -ij              inv   X Y    value of field at grid(X,Y) X=1,..,nx Y=1,..,ny (WxText enabled)
    + -ijlat           inv   X Y    lat,lon and grid value at grid(X,Y) X=1,..,nx Y=1,..,ny (WxText enabled)
    + -ilat            inv   X      lat,lon and grid value at Xth grid point, X=1,..,npnts (WxText enabled)
    + -JMA             inv          inventory for JMA locally defined PDT
    + -lev             inv          level (code table 4.5)
    + -lev0            inv          level for g2ctl/GrADS
    + -ll2i            inv   X Y    x=lon y=lat, converts to (i), 1..ndata
    + -ll2ij           inv   X Y    x=lon y=lat, converts lon-lat to (i,j) using gctpc
    + -lon             inv   X Y    value at grid point nearest lon=X lat=Y (WxText enabled)
    + -match_inv       inv          inventory used by -match, -not, -if and -not_if
    + -Match_inv       inv          same as -match_inv except d=YYYYMMDDHH <-> D=YYYYMMDDHHmmss
    + -max             inv          print maximum value
    + -min             inv          print minimum value
    + -misc            inv          variable name qualifiers like chemical, ensemble, probability, etc
    + -MM              inv          reference time MM
    + -model_version_date inv          prints model date code
    + -n               inv          prints out inventory number
    + -N_clusters      inv          number of clusters
    + -N_ens           inv          number of ensemble members
    + -nl              inv          inserts new line into inventory
    + -nlons           inv          number of longitudes for each latitude
    + -npts            inv          number of grid points
    + -number_of_coordinate_values_after_template inv          
    + -nxny            inv          nx and ny of grid
    + -packing         inv          shows the packing mode (use -v for more details)
    + -pds_fcst_time   inv          fcst_time(1) in units given by pds
    + -pdt             inv          Product Definition Table (Code Table 4.0)
    + -percent         inv          percentage probability
    + -post_processing inv          type of post-processing
    + -precision       inv          precision of packing
    + -print           inv   X      inserts string (X) into inventory
    + -prob            inv          probability information
    + -process         inv          Process type (code table 4.3)
    + -processid       inv          process id (locally defined)
    + -proj4_ij2ll     inv   X Y    X=x Y=y, converts to (i,j) to lon-lat using proj.4 (experimental) we:sn
    + -proj4_ll2i      inv   X Y    x=lon y=lat, converts to (i) using proj.4 (experimental) 1..ndata
    + -proj4_ll2ij     inv   X Y    x=lon y=lat, converts lon-lat (i,j) using proj.4 (experimental)
    + -pyinv           inv          miscelaneous metadata for pywgrib2_XXX (experimental)
    + -radius          inv          radius of Earth
    + -range           inv          print out location of record in bytes, 0 = first byte
    + -reset_delayed_error inv          clear reset_delayed_error flag
    + -RT              inv          type of reference Time
    + -s               inv          simple inventory
    + -S               inv          simple inventory with minutes and seconds (subject to change)
    + -s2              inv          simple inventory .. for testing ftime2
    + -scale           inv          scale for packing
    + -scaling         inv          scaling for packing (old format)
    + -scan            inv          scan order of grid
    + -Sec0            inv          contents of section0
    + -Sec3            inv          contents of section 3 (Grid Definition Section)
    + -Sec4            inv          Sec 4 values (Product definition section)
    + -Sec5            inv          Sec 5 values (Data representation section)
    + -Sec6            inv          show bit-map section
    + -Sec_len         inv          length of various grib sections
    + -spatial_proc    inv          show spacial processing, pdt=4.15
    + -spectral_bands  inv          spectral bands for satellite, pdt=4.31 or 4.32
    + -spectral_bands_extname inv          spectral bands for satellite, pdt=4.31 or 4.32, concise name for ExtName
    + -start_ft        inv          verf time = reference_time + forecast_time (YYYYMMDDHH) : no stat. proc time
    + -start_FT        inv          verf time = reference_time + forecast_time (YYYYMMDDHHMMSS) - no stat. proc time
    + -stats           inv          statistical summary of data values
    + -subcenter       inv          subcenter
    + -t               inv          reference time YYYYMMDDHH, -v2 for alt format
    + -T               inv          reference time YYYYMMDDHHMMSS
    + -table           inv          parameter table
    + -timer           inv          reads OpenMP timer
    + -unix_time       inv          print unix timestamp for rt & vt
    + -V               inv          diagnostic output
    + -var             inv          short variable name
    + -varX            inv          raw variable name - discipline mastertab localtab center parmcat parmnum
    + -vector_dir      inv          grid or earth relative winds
    + -verf            inv          simple inventory using verification time
    + -vt              inv          verf time = reference_time + forecast_time, -v2 for alt format
    + -VT              inv          verf time = reference_time + forecast_time (YYYYMMDDHHMMSS)
    + -warn_old_g2     inv          warn if old g2lib would have problem
    + -wave_partition  inv          ocean surface wave partition (pdt=4.52)
    + -YY              inv          reference time YYYY
    + -inv_f77         inv>  X Y Z  match inventory written to Z with character*(Y) and X=(bin,ieee)
    + -last            inv>  X      write last inv item to file X
    + -last0           inv>  X      write last inv item to beginning of file X
    + -nl_out          inv>  X      write new line in file X
    + -print_out       inv>  X Y    prints string (X) in file (Y)
    + -s_out           inv>  X      simple inventory written to X
    + -big_endian      misc         sets ieee output to big endian (default is big endian)
    + -box_ave         misc  X Y Z  box average X=odd integer (lon) Y=odd integer (lat) critical_weight
    + -check_pdt_size  misc  X      check pdt size X=1 enable/default, X=0 disable
    + -colon           misc  X      replace item deliminator (:) with X
    + -config          misc         shows the configuration
    + -count           misc         prints count, number times this -count was processed
    + -end             misc         stop after first (sub)message (save time)
    + -error_final     misc  X Y Z  error if at end X=count Y=ne,eq,le,lt,gt,ge Z=integer
    + -export_lonlat   misc  X      save lon-lat data in binary file
    + -fix_CFSv2_fcst  misc  X Y Z  fixes CFSv2 monthly fcst X=daily or 00/06/12/18 Y=pert no. Z=number ens fcsts v1.0
    + -fix_ncep        misc         fix ncep PDT=8 headers produced by cnvgrib
    + -gctpc           misc  X       X=0,1 use gctpc library (default=1)
    + -grid_changes    misc         prints number of grid changes
    + -grid_def        misc         read lon and lat data from grib file -- experimental
    + -h               misc         help, shows common options
    + -header          misc         f77 header or nx-ny header in text output (default)
    + -help            misc  X      help [search string|all], -help all, shows all options
    + -ijundefine      misc  X Y Z  sets grid point values to undefined X=(in-box|out-box) Y=ix0:ix1 Z=iy0:iy1 ix=(1..nx) iy=(1..ny)
    + -import_bin      misc  X      read binary file (X) for data
    + -import_grib     misc  X      read grib2 file (X) for data
    + -import_grib_fs  misc  X Y    read grib2 file (Y) sequentially for record that matches X (fixed string)
    + -import_ieee     misc  X      read ieee file (X) for data
    + -import_lonlat   misc  X      read lon-lat data from binary file
    + -import_netcdf   misc  X Y Z  alpha X=file Y=var Z=hyper-cube specification
    + -import_text     misc  X      read text file (X) for data
    + -limit           misc  X      stops after X fields decoded
    + -little_endian   misc         sets ieee output to little endian (default is big endian)
    + -mem_del         misc  X      delete mem file X
    + -mem_final       misc  X Y    write mem file X to file Y at cleanup step
    + -mem_init        misc  X Y    read mem file X from file Y (on initialization)
    + -new_grid_format misc  X      new_grid output format X=bin,ieee,grib
    + -new_grid_interpolation misc  X      new_grid interpolation X=bilinear,bicubic,neighbor,budget
    + -new_grid_ipopt  misc  X      new_grid ipopt values X=i1:i2..:iN N <= 20
    + -new_grid_vectors misc  X      change fields to vector interpolate: X=none,default,UGRD:VGRD,(U:V list)
    + -new_grid_winds  misc  X      new_grid wind orientation: X = grid, earth (no default)
    + -no_header       misc         no f77 header or nx-ny header in text output
    + -proj4           misc  X      X=0,1 use proj4 library for geolocation (testing)
    + -quit            misc         stop after first (sub)message (save time)
    + -read_sec        misc  X Y    read grib message section (0-8) X from binary file (Y)
    + -rewind_final    misc  X      rewinds file X on cleanup step if already opened, CW2
    + -rewind_proc     misc  X      rewinds file X on processing step if already opened, CW2
    + -rpn             misc  X      reverse polish notation calculator
    + -rpn_rcl         misc  X      data = register X .. same as -rpn rcl_X .. no geolocation calc needed
    + -rpn_sto         misc  X      register X = data.. same as -rpn sto_X .. no geolocation calc needed
    + -scaling_0001    misc         changes scaling testing (sample)
    + -set             misc  X Y    set X = Y, X=local_table,etc (help: -set help help)
    + -set_ave         misc  X      set ave/acc .. only use on pdt=4.0/4.8 (old code)
    + -set_bin_prec    misc  X      X use X bits and ECMWF-style grib encoding
    + -set_bitmap      misc  X      use bitmap when creating complex packed files X=1/0
    + -set_byte        misc  X Y Z  set bytes in Section X, Octet Y, bytes Z (a|a:b:c)
    + -set_center      misc  X      changes center X = C or C:S C and S are center/subcenter numbers
    + -set_date        misc  X      changes date code, X=(+|-)N(hr|dy|mo|yr), YYYYMMDDHHmmSS, u(UNIX TIME)
    + -set_ensm_derived_fcst misc  X Y    convert PDT 0,1,2 -> 2, 8,11,12 -> 12, X=code table 4.7 Y=num ens members
    + -set_ens_num     misc  X Y Z  ensemble member info, X=code table 4.6 Y=pert num Z=num ens members -1=No Change
    + -set_flag_table_3.3 misc  X      flag table 3.3 = X
    + -set_flag_table_3.4 misc  X      flag table 3.4 = X
    + -set_ftime       misc  X      either set_ftime1 or set_ftime2 dep on version_ftime
    + -set_ftime1      misc  X      set ftime
    + -set_ftime2      misc  X      set ftime2 .. will be replace -set_ftime/ave in the future -- TESTING ---
    + -set_gds         misc  X      makes new gds (section 3), X=size in bytes
    + -set_grib_max_bits misc  X      sets scaling so number of bits does not exceed N in (new) grib output
    + -set_grib_type   misc  X      set grib type = jpeg, simple, ieee, complex(1|2|3), aec, same
    + -set_hex         misc  X Y Z  set bytes in Section X, Octet Y, bytes Z (a|a:b:c|abc) in hexadecimal
    + -set_ieee        misc  X Y Z  set ieee float in Section X, Octet Y, floats Z (a|a:b:c)
    + -set_ijval       misc  X Y Z  sets grid point value X=ix Y=iy Z=val
    + -set_int         misc  X Y Z  set 4-byte ints in Section X, Octet Y, signed integers Z (a|a:b:c)
    + -set_int2        misc  X Y Z  set 2-byte ints in Section X, Octet Y, signed integers Z (a|a:b:c)
    + -set_ival        misc  X Y    sets grid point value X=i1:i2:.. Y=va1:val2:.. grid[i1] = val1,etc i>0
    + -set_lev         misc  X      changes level code .. not complete
    + -set_metadata    misc  X      read meta-data for grib writing from file X
    + -set_metadata_str misc  X      X = metadata string
    + -set_pdt         misc  X      makes new pdt, X=(+)PDT_number or X=(+)PDT_number:size of PDT in octets, +=copy metadata
    + -set_percentile  misc  X      convert PDT 0..6 -> 6, 8..15 -> 10, X=percentile (0..100)
    + -set_prob        misc  5 args X/Y forecasts Z=Code Table 4.9 A=lower limit B=upper limit
    + -set_radius      misc  X      set radius of Earth X= 0,2,4,5,6,8,9 (Code Table 3.2), X=1:radius , X=7:major:minor
    + -set_scaling     misc  X Y    set decimal scaling=X/same binary scaling=Y/same new grib messages
    + -set_sec_size    misc  X Y    resizes section , X=section number, Y=size in octets, DANGEROUS
    + -set_ts_dates    misc  X Y Z  changes date code for time series X=YYYYMMDDHH(mmss) Y=dtime Z=#msgs/date
    + -set_var         misc  X      changes variable name
    + -start_timer     misc         starts OpenMP timer
    + -status          misc  X      X X=file
    + -submsg          misc  X      process submessage X (0=process all messages)
    + -sys             misc  X      run system/shell command, X=shell command
    + -text_col        misc  X      number of columns on text output
    + -text_fmt        misc  X      format for text output (C)
    + -udf             misc  X Y    run UDF, X=program+optional_args, Y=return file
    + -udf_arg         misc  X Y    add grib-data to UDF argument file, X=file Y=name
    + -undefine        misc  X Y Z  sets grid point values to undefined X=(in-box|out-box) Y=lon0:lon1 Z=lat0:lat1
    + -undefine_val    misc  X      grid point set to undefined if X=val or X=low:high
    + -v               misc         verbose (v=1)
    + -v0              misc         not verbose (v=0)
    + -v1              misc         verbose (v=1)
    + -v2              misc         really verbose (v=2)
    + -v97             misc         verbose mode for debugging only (v=97)
    + -v98             misc         verbose mode for debugging only (v=98)
    + -v99             misc         verbose mode for debugging only (v=99)
    + -version         misc         print version
    + --version        misc         print version
    + -AAIG            out          writes Ascii ArcInfo Grid file, lat-lon grid only (alpha)
    + -AAIGlong        out          writes Ascii ArcInfo Grid file, lat-lon grid only long-name *.asc (alpha)
    + -ave             out   X Y    average X=time step Y=output v2
    + -ave0            out   X Y    average X=time step, Y=output grib file needs file is special order
    + -ave_var         out   X Y    average/std dev/min/max X=time step, Y=output
    + -bin             out   X      write binary data to X
    + -cress_lola      out   X..Z,A lon-lat grid values X=lon0:nlon:dlon Y=lat0:nlat:dlat Z=file A=radius1:radius2:..:radiusN
    + -csv             out   X      make comma separated file, X=file (WxText enabled)
    + -csv_long        out   X      make comma separated file, X=file (WxText enabled)
    + -cubeface2global out   X Y    write faces X as global cubed grid to Y: X=list of faces to exclude
    + -ens_processing  out   X Y    ave/min/max/spread X=output Y=future use
    + -ens_qc          out   X..Z,A simple qc ensemble members X=stats.grb Y=extreme.grb Z=extreme.txt A=1 (qc_version)
    + -fcst_ave        out   X Y    average X=time step Y=output v2
    + -fcst_ave0       out   X Y    average X=time step, Y=output grib file needs file is special order
    + -fi              out          depreceated, used in old IF structure
    + -grib            out   X      writes GRIB record (one submessage) to X
    + -GRIB            out   X      writes entire GRIB record (all submessages)
    + -grib_ieee       out   X      writes data[] to X.grb, X.head, X.tail, and X.h
    + -grib_out        out   X      writes decoded/modified data in grib-2 format to file X
    + -grib_out_irr    out   X Y    writes irregular grid grib (GDT=130 not adopted) X=(all|defined) Y=(output file)
    + -grib_out_irr2   out   5 args writes irregular grid grib GDT 101 X=npnts Y=grid_no Z=grid_ref A=UUID B=(output file)
    + -gribtable_used  out   X      write out sample gribtable as derived from grib file, X=file
    + -gridout         out   X      text file with grid: i j lat lon (1st record)
    + -ieee            out   X      write (default:big-endian) IEEE data to X
    + -ijbox           out   X..Z,A grid values in bounding box X=i1:i2[:di] Y=j1:j2[:dj] Z=file A=[bin|text|spread]
    + -ijsmall_grib    out   X Y Z  make small domain grib file X=ix0:ix1 Y=iy0:iy1 Z=file
    + -irr_grid        out   X Y Z  make irregular grid (GDT=130 not adopted), nearest neighbor, X=lon-lat list Y=radius (km) Z=output grib file
    + -lola            out   X..Z,A lon-lat grid values X=lon0:nlon:dlon Y=lat0:nlat:dlat Z=file A=[bin|text|spread|grib]
    + -merge_fcst      out   X Y    merge forecast ave/acc/min/max X=number to intervals to merge (0=every) Y=output grib file
    + -mysql           out   5 args H=[host] U=[user] P=[password] D=[db] T=[table]
    + -mysql_dump      out   7 args H=[host] U=[user] P=[password] D=[db] T=[table] W=[western_lons:0|1] PV=[remove unlikely:0|1]
    + -mysql_speed     out   7 args H=[host] U=[user] P=[password] D=[db] T=[table] W=[western_lons:0|1] PV=[remove unlikely:0|1]
    + -ncep_norm       out   X      normalize NCEP-type ave/acc X=output grib file
    + -ncep_uv         out   X      combine U and V fields into one message like NCEP operations
    + -netcdf          out   X      write netcdf data to X
    + -new_grid        out   X..Z,A bilinear interpolate: X=projection Y=x0:nx:dx Z=y0:ny:dy A=grib_file alpha
    + -new_grid_order  out   X Y    put in required order for -new_grid, X=out Y=out2 no matching vector
    + -reduced_gaussian_grid out   X Y Z  reduced Gaussian grid, X=outputfile Y=-1 Z=(neighbor|linear)[-extrapolate]
    + -small_grib      out   X Y Z  make small domain grib file X=lonW:lonE Y=latS:latN Z=file
    + -spread          out   X      write text - spread sheet format into X (WxText enabled)
    + -submsg_uv       out   X      combine vector fields into one message
    + -text            out   X      write text data into X
    + -time_processing out   X..Z,A average X=CodeTable 4.10 Y=CodeTable 4.11 Z=time step A=output
    + -tosubmsg        out   X      convert GRIB message to submessage and write to file X
    + -unmerge_fcst    out   X Y Z  unmerge_fcst X=output Y=fcst_time_0 Z: 0->result 1->+init 2->+all
    + -wind_dir        out   X      calculate wind direction, X = output gribfile (direction in degrees, 0=wind from north, 90=wind from east)
    + -wind_speed      out   X      calculate wind speed, X = output gribfile (U then V in datafile)
    + -wind_uv         out   X      calculate UGRD/VGRD from speed/dir, X = output gribfile
    + -write_sec       out   X Y    write grib msessage section X (0-8) to binary file Y
    + -alarm           init  X      terminate after X seconds
    + -append          init         append mode, write to existing output files
    + -crlf            init         make the end of the inventory a crlf (windows) instead of newline (unix)
    + -d               init  X      dump message X = n, n.m, n:offset, n.m:offset, only 1 -d allowed
    + -egrep           init  X      egrep X | wgrib2 (X is POSIX regular expression)
    + -egrep_v         init  X      egrep -v X | wgrib2 (X is POSIX regular expression)
    + -eof_bin         init  X Y    send (binary) integer to file upon EOF: X=file Y=integer
    + -eof_string      init  X Y    send string to file upon EOF: X=file Y=string
    + -err_bin         init  X Y    send (binary) integer to file upon err exit: X=file Y=integer
    + -err_string      init  X Y    send string to file upon err exit: X=file Y=string
    + -fgrep           init  X      fgrep X | wgrib2
    + -fgrep_v         init  X      fgrep -v X | wgrib2
    + -fix_ncep_2      init         ncep bug fix 2, probability observation < -ve number
    + -fix_ncep_3      init         sets flag to fix ncep bug 3 (constant fields)
    + -fix_ncep_4      init         fixes NCEP grib2 files where DX and DY are undefined
    + -fix_undef       init         set unused values to undef
    + -flush           init         flush output buffers after every write (interactive)
    + -for             init  X      process record numbers in range, X=(start:end:step), only one -for allowed
    + -for_n           init  X      process inv numbers in range, X=(start:end:step), only one -for allowed
    + -g2clib          init  X      X=0/1/2 0=WMO std 1=emulate g2clib 2=use g2clib
    + -i               init         read Inventory from stdin
    + -i_file          init  X      read Inventory from file
    + -inv             init  X      write inventory to X
    + -match           init  X      process data that matches X (POSIX regular expression)
    + -match_fs        init  X      process data that matches X (fixed string)
    + -match_inv_add   init  X Y Z  add new options to match_inventory
    + -names           init  X      grib name convention, X=DWD, dwd, ECMWF, ecmwf, NCEP, ncep
    + -nc3             init         use netcdf3 (classic)
    + -nc4             init         use netcdf4 (compressed, controlled endianness etc)
    + -nc_grads        init         require netcdf file to be grads v1.9b4 compatible (fixed time step only)
    + -nc_nlev         init  X      netcdf, X = max LEV dimension for {TIME,LEV,LAT,LON} data
    + -nc_pack         init  X      pack/check limits of all NEW input variables, X=min:max[:byte|short|float]
    + -ncpu            init  X      number of threads, default is environment variable OMP_NUM_THREADS/number of cpus
    + -nc_table        init  X      X is conversion_to_netcdf_table file name
    + -nc_time         init  X      netcdf, [[-]yyyymmddhhnnss]:[dt{s[ec]|m[in]|h[our]|d[ay]}], [-] is for time alignment only
    + -ndate           init  X Y    X=date Y=dt print date + dt
    + -ndates          init  X Y Z  X=date0 Y=(date1|dt1) Z=dt2 for (date=date0; date<(date1|date0+dt1); date+=dt2) print date
    + -ndates_fmt      init  X      X = C format for ndates option ex. 'date=%s'
    + -no_append       init         not append mode, write to new output files (default)
    + -no_flush        init         flush output buffers when full (default)
    + -no_nc_grads     init         netcdf file may be not grads v1.9b4 compatible, variable time step
    + -no_nc_pack      init         no packing in netcdf for NEW variables
    + -no_nc_table     init         disable previously defined conversion_to_netcdf_table
    + -no_nc_time      init         netcdf, disable previously defined initial or relative date and time step
    + -not             init  X      process data that does not match X (POSIX regular expression)
    + -not_fs          init  X      process data that does not match X (fixed string)
    + -one_line        init         puts all on one line (makes into inventory format)
    + -order           init  X      decoded data in X (raw|we:sn|we:ns) order, we:sn is default
    + -persistent      init  X      makes file X persistent if already opened (default on open), CW2
    + -rewind_init     init  X      rewinds file X on initialization if already opened, CW2
    + -set_ext_name    init  X      X=type ext_name (1*misc+2*level+4*ftime)
    + -set_ext_name_chars init  X Y    extended name characters X=field Y=space
    + -set_regex       init  X      set regex mode X = 0:extended regex (default) 1:pattern 2:extended regex & quote metacharacters
    + -set_version_ftime init  X      set version of ftime X=1, 2
    + -tigge           init         use modified-TIGGE grib table
    + -transient       init  X      make file X transient, CW2
    +
    +
    + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5200 Auth Road
    + Camp Springs, Maryland 20746
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/lvl.html b/docs/web_docs/lvl.html new file mode 100644 index 0000000..faa3e58 --- /dev/null +++ b/docs/web_docs/lvl.html @@ -0,0 +1,256 @@ + + + + Climate Prediction Center - wgrib2: -lvl + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-lvl +
     
    + +

    wgrib2: -lvl wgrib2 (introduced v3.1.4)

    +
    + + +

    Introduction: levels, should I use lev or lvl

    +

    +The standard method of displaying and altering the level/layer metadata is by the +-lev and -set_lev options. +This method is high level so you don't have to know the details of grib. +The problems with a high level interface are when you +are using a new type of level information that "-lev" don't understand. When this +happens, you can use the "lvl" options. +The "lvl" method is low level and are for cases when a high level interface doesn't work. + +

    The Problem with Ambiguity of Numbers

    + +The grib standard stores the level as a (signed 32-bit integer)*10**(signed 8-bit integer). +Nothing wrong with this format but numbers and be stored in different ways. + +
    +   500 can be stored as 5*10**2
    +   500 can be stored as 50*10**1
    +   500 can be stored as 500*10**0
    +   500 can be stored as 5000*10**-1
    +
    + +All are valid representations and libraries should treat them as equivalent. +So if you search for the wind speed at "50 meters above the ground", you +should not have to worry whether 50 is stored at 5*10**1 or 50*10**0 in +the grib file. However, there are some libraries will only match one variant +of "50". So to get your grib files to be compatible with this library, +you may have to use the "lvl" interface. (With wgrib2, you match the string +"50m above ground", so the variants don't matter.) + +

    +Another example of ambiguity is for "0.1 meters above the ground". Now 0.1 is not +a nice number when stored as a binary floating point number. You can only save an approximate +value when using a finite number of digits. It is like 1/3 when written +as a decimal number. (1/3=0.3333333333333..) +

    +  0.1 can be stored as 1*10**-1
    +  0.1 can be stored as 1000000015*10**-10
    +
    +Obviously the former is the preferred format but the latter is +the result trying to get the best scaled number for double +precision number "0.1". + +

    The "lvl" interface can be used to remove ambiguities in the level information +using -set_lvl1 and -set_lvl2. + + +

    lvl format

    + + +The "lvl" format is based on the grib standard. + +
    + 1 octet  unsigned 8-bit integer   type of first fixed surface (see Code Table 4.5) lv1l type
    + 1 octet  8-bit signed integer     scale factor of first fixed surface              lvl1 scale_factor
    + 4 octets 32-bit signed integer    scaled value of first fixed surface              lvl1 scaled_value
    +                            
    + 1 octet  unsigned 8-bit integer   type of 2nd fixed surface (see Code Table 4.5)   lvl2 type
    + 1 octet  8-bit signed integer     scale factor of 2nd surface                      lvl2 scale_factor
    + 4 octets 32-bit signed integer    scaled value of 2nd fixed surface                lvl2 scaled_value
    +
    + value = scaled_value * 10**(-scale_factor)
    + Note: missing is denoted by scale factor and scale value having all bits set to one
    +
    +lvl format   value is not missing
    +             lvl1=(type,scaled_value*10**(-scale_factor), scale_factor, scaled_value)
    +             lvl2=(type,scaled_value*10**(-scale_factor), scale_factor, scaled_value)
    +
    +lvl format   value is missing
    +             lvl1=(type,missing,missing,missing)
    +             lvl2=(type,missing,missing,missing)
    +
    +	     type = 0..255
    +
    + +

    Usage

    +

    + +

    +-lvl
    +
    + + +

    Example

    +
    +$ $ wgrib2 small.grb2 -lev
    +1:0:200 mb
    +$ $ wgrib2 small.grb2 -lvl
    +1:0:lvl1=(100,20000,0,20000):lvl2=(255,missing,missing,missing)
    +
    + + + +See also: -set_lvl1 + -set_lvl2 +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page 11/2023 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/macros.html b/docs/web_docs/macros.html new file mode 100644 index 0000000..ad31c5c --- /dev/null +++ b/docs/web_docs/macros.html @@ -0,0 +1,187 @@ + + + + Climate Prediction Center - wgrib2: -s -verf + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -s -verf +
     
    + +

    wgrib2 macros: -s -verf -V

    +
    + + +

    Introduction

    + +

    +The -s, +-verf +and -V +options are really macros +which are defined in the Macro.c file. The -s option is special because if there is no +"inv" option used, wgrib2 will add a -s option to the end of the argument list. + + +

    Usage

    +

    + +

    +-s
    +      equivalent to -t -var -lev -ftime -ens
    +
    +-verf
    +      equivalent to -vt -var -lev -ftime -ens
    +
    +-V
    +      equivalent to -vt -lev -ftime -var -ens -stats -grid
    +
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/match.html b/docs/web_docs/match.html new file mode 100644 index 0000000..c547a66 --- /dev/null +++ b/docs/web_docs/match.html @@ -0,0 +1,286 @@ + + + + Climate Prediction Center - wgrib2: -match + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-match +
     
    + +

    wgrib2: -match

    +
    + + +

    Introduction

    + +

    +The -match option selects records which should +be processed. When multiple -match options are used, all matches +must be satisfied. The -match and +-not options seem to be similar to the +-if and -if_not options. +The big difference is that the +-match and -not +options are processed before any other record processing. If +the record satisfies the -match and +-not options, then the record is +processed. This include the optional decoding and latitude-longitude +calculation and the other options. + + +

    +
    +    wgrib2 -match X (...)
    +
    +is the same as 
    +
    +    wgrib2 -match_inv file | egrep X | wgrib2 -i (...)
    +
    +
    +
    +    wgrib2 -match X -match Y -not Z (...)
    +
    +is the same as 
    +
    +    wgrib2 -match_inv file | egrep X | egrep Y | egrep -v Z | wgrib2 -i (...)
    +
    +where X, Y and Z are regular expressions. 
    +
    +If X, Y and Z are "fixed strings" rather than regular expressions, 
    +use -match_fs, and -not_fs.
    +
    + +

    Usage

    +

    + +

    +-match X
    +
    +X is a posix extended regular expression
    +
    + +

    +The -match, and -not selection +facility is more limited than the "wgrib2 | filter | wgrib2 -i" syntax. +However, it can be more efficient especially when combined with the +-end option. Note that the "match" inventory +often expands. Usually the inventory expands by adding new items +to the end of the inventory in order not the break scripts. + +

    Examples

    + +
    +wgrib2 IN.grb -match ":(UGRD|VGRD|TMP):(200|500) mb:"
    +
    +selects the UGRD, VGRD and TMP fields at the 200 and 500 mb levels
    +
    + +

    -match vs -if

    + + +

    The +-match, and -if can +be confused. +The +-match option selects the fields that are to be +processed by the command line. +The +-if option selects the fields that will be processed +and the selection ends at the next +-fi or output option. For example, + +

    +1. wgrib2 IN.grb -match ":UGRD:200 mb:anl:" -csv u200.csv
    +2. wgrib2 IN.grb -if ":UGRD:200 mb:anl:" -csv u200.csv
    +
    + +Lines 1 and 2 will produce the same CSV file. However, line 1 will only +process one field. For line 1, only only one field will be docoded +and converted to a CSV file. For line 2, all the fields will be +processed and only one field will be converted to a CSV file. The +total processing will be the docoding of all the fields in the file +and one conversion to a CSV file. + + +

    Future Changes

    +

    +The format of the "match inventory" has evolved and will continue to evolve. +The rule for future changes is that new items in the "match inventory" will be added +as the second last item. Consequently the last item in the inventory will always +be ":vt=YYYYMMDDHH:". In order to future proof your +-match, and -not selections, you +must not include any item before the ":vt=YYYYMMDD:" field. + +

    +    -match ":vt=2011111500:"                  good
    +    -not ":vt=2011111500:$"                   good (dollar sign matches the end of the line)
    +    -not ":n=10:vt=2011111500:"               bad (item before :vt=)
    +    -match ":RH:975 mb:anl::vt=2010050806:"   bad (item before :vt=)
    +

    + +Some recent changes (as of Nov 2011) to the match inventory include: + +
      +
    • adding the "extended name of the variable", ex. TMP.prob_<273 +
    • adding the inventory number, ex. n=10 +
    • adding ensemble/chemical/probability information (-misc) +
    + +

    +See also: -not, +-not_fs, +-match_fs, +-match_inv, +-end, +-i, +-if, +-not_if, +-set_regex. +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 20, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/match_fs.html b/docs/web_docs/match_fs.html new file mode 100644 index 0000000..948c0f1 --- /dev/null +++ b/docs/web_docs/match_fs.html @@ -0,0 +1,218 @@ + + + + Climate Prediction Center - wgrib2: -match_fs, .not_fs, -if_fs, -not_if_fs + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-Match_fs package +
     
    + +

    wgrib2: -match_fs, -not_fs, -if_fs, -not_if_fs

    +
    + + +

    Introduction

    + +

    +The (-match_fs, -not_fs, -if_fs, -not_if_fs) options are +similar to the +(-match, -not, -if, -not_if) options except the former +group uses fixed strings rather than regular expressions. + + +Now why would you want to use the "fs" versions? Suppose you want to to +search for the "2.5 mb" level. + +

    +bash-4.1$ wgrib2 -match ":2.5 mb:" junk
    +1:0:d=2009060500:HGT:225 mb:180 hour fcst:ENS=+19
    +2:46042:d=2009060500:HGT:2.5 mb:180 hour fcst:ENS=+19
    +
    + +What happened? The command matched the 2.5 and 225 mb level! Well the +period is regular expression metacharacter and matchs any character. To +only get "2.5 mb" either have to quote the period or change the regex mode. + +
    +bash-4.1$ wgrib2 -match ":2\.5 mb:" junk
    +2:46042:d=2009060500:HGT:2.5 mb:180 hour fcst:ENS=+19
    +
    +bash-4.1$ wgrib2 -set_regex 0 -match ":2.5 mb:" junk
    +1:0:d=2009060500:HGT:225 mb:180 hour fcst:ENS=+19
    +2:46042:d=2009060500:HGT:2.5 mb:180 hour fcst:ENS=+19
    +
    +bash-4.1$ wgrib2 -set_regex 1 -match ":2.5 mb:" junk
    +2:46042:d=2009060500:HGT:2.5 mb:180 hour fcst:ENS=+19
    +
    +bash-4.1$ wgrib2 -set_regex 2 -match ":2.5 mb:" junk
    +2:46042:d=2009060500:HGT:2.5 mb:180 hour fcst:ENS=+19
    +
    + +

    +So setting the regex mode to 1 or 2 will work. The "_fs" options +uses fixed strings with no metacharacters which is the same +as the regex mode set to 1. + +

    The "_fs" options only requires standard C support rather than POSIX-2 +so they are available on all wgrib2. Options using +regular expressions are optional and may not be available on platforms. + +

    +See also: +-if, +-if_fs, +-match, +-match_inv, +-not, +-not_fs, +-not_if, +-not_if_fs, +-set_regex. +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 15, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/match_inv.html b/docs/web_docs/match_inv.html new file mode 100644 index 0000000..883a843 --- /dev/null +++ b/docs/web_docs/match_inv.html @@ -0,0 +1,233 @@ + + + + Climate Prediction Center - wgrib2: -match_inv + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-match_inv +
     
    + +

    wgrib2: -match_inv

    +
    + + +

    Introduction

    + +

    +The -match_inv option prints out the inventory +which is used by the +-match, +-not, -if, +-not_if +-match_fs, +-not_fs, -if_fs and +-not_if_fs + options. + +

    +-sh-2.05b$ wgrib2 new.grb2 -match_inv
    +1:0:d=2007032600:HGT:1000 mb:anl:vt=2007032600
    +2:125535:d=2007032600:HGT:1000 mb:3 hour fcst:vt=2007032603
    +
    + +

    Usage

    +

    + +

    +-match_inv
    +
    + +

    Changes

    +

    +The format of the "match inventory" has evolved and will continue to evolve. +The rule for future changes is that new items in the "match inventory" will be added +as the second last item. Consequently the last item in the inventory will always +be ":vt=YYYYMMDDHH:". In order to future proof your +-match, and -not selections, you +must not include any item before the ":vt=YYYYMMDD:" field. + +

    +    -match ":vt=2011111500:"                  good
    +    -not ":vt=2011111500:$"                   good (dollar sign matches the end of the line)
    +    -not ":n=10:vt=2011111500:"               bad (item before :vt=)
    +    -match ":RH:975 mb:anl::vt=2010050806:"   bad (item before :vt=)
    +
    + +Some recent changes (as of Nov 2011) to the match inventory include: + +
      +
    • adding the "extended name of the variable", ex. TMP.prob_<273 +
    • adding the inventory number, ex. n=10 +
    • adding ensemble/chemical/probability information (-misc) +
    + +

    Changes: wgrib2 v2.0.5

    + +

    For all versions of wgrib2 up to v2.0.4, the match inventory was +dependent on the verbosity mode (0,1,2). As a results, -match ":HGT:10 mb:" +would work in default mode but would not work in the -v1 and v2 modes. +With wgrib2 v2.0.5, the match inventory is generated with default +verbosity mode (-v0). It is possible that this break a few pieces +of code. However, I think that the match facility shouldn't be +dependent on the verbosity mode. + +

    +See also: +-if, +-if_fs, +-match, +-Match_inv, +-match_fs, +-not, +-not_fs, +-not_if, +-not_if_fs, +-set_regex. +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 1, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/match_inv_add.html b/docs/web_docs/match_inv_add.html new file mode 100644 index 0000000..12a4d02 --- /dev/null +++ b/docs/web_docs/match_inv_add.html @@ -0,0 +1,224 @@ + + + + Climate Prediction Center - wgrib2: -match_inv_add + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-match_inv_add +
     
    + +

    wgrib2: -match_inv_add

    +
    + +

    Introduction !!ALPHA!!

    + +

    +Wgrib2's command line is a simple language that allows you +to process selected fields using, for example, the -if option. +The -if option is limited as it only works on +parameters that are exposed by the -match_inv option. +For example, you cannot check the diameter of the earth by using + +

    +   wgrib2 IN.grb -if "code table 3.2=6 " -print "oh no code 3.2=6" -fi
    +
    +
    +because code table 3.2 is not in the match inventory (-match_inv).  The match
    +inventory has been expanding with time.  However, there will alway be new needs
    +that need an expanded match inventory.  
    +
    +

    +You cannot add functions that depend on the grid point values (ex. -max, -min) or +the locations of the grid points because these calculations are done after the +match inventory is generated. + +

    The current status is ALPHA and the syntax may be altered. + +

    Usage

    +
    +-match_inv_add OPTION ARG1 ARG2
    +  OPTION is an inv option with no parameters
    +    note that you do not add a dash to the option
    +  ARG1 is argument 1 to the option, if option has no argument, use a dummy argument
    +  ARG2 is argument 2 to the option, if option does not need a second argument, use a dummy argument
    +
    +  As of v2.0.8, you are allowed to add upto 10 extra functions to the match inventory
    +
    +

    Example 1

    + +
    +$ wgrib2 small.grb2 -match_inv_add code_table_3.2 x x -match_inv
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19:HGT.ENS=+19:n=1:npts=4:var0_2_1_7_3_5:pdt=1: D=20090
    +605000000:start_FT=20090612120000:end_FT=20090612120000:scaling ref=1.22666e+06 dec_scale=-2 bin_scale
    +=2 nbits=12:code table 3.2=6 Earth assumed spherical with radius = 6,371,229.0 m:vt=2009061212:
    +
    +$ wgrib2 small.grb2 -match_inv_add code_table_3.2 x x -if "code table 3.2=6" -print "fount radius=6" -fi
    +1:0:fount radius=6
    +
    + + +

    +See also: +-if, +-if_fs, +-match, +-match_fs, +-match_inv, +-Match_inv, +-not, +-not_fs, +-not_if, +-not_if_fs, +-set_regex. + + + + + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Feb 1, 2019 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/match_inv_f77.html b/docs/web_docs/match_inv_f77.html new file mode 100644 index 0000000..bba197a --- /dev/null +++ b/docs/web_docs/match_inv_f77.html @@ -0,0 +1,222 @@ + + + + Climate Prediction Center - wgrib2: -match_inv_f77 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -match_inv_f77 +
     
    + +

    wgrib2: -match_inv_f77

    +
    + + +

    Introduction

    + +

    +The -match_inv_f77 option prints out the match inventory (-match_inv) to a file in f77 unformatted sequential +access format. The fortran headers and trailers can either be in 4-byte (big/little endian) or native-format integers +containing the size of the string. Note that the -match_inv_f77 option always creates a +header and ignores the -header option. +The -match_inv_f77 option was added in order to make it easier for fortran programs to read wgrib2 dumps. + +

    +Fortran program with no conversion of input data:
    +
    +-sh-2.05b$ wgrib2 new.grb2 -match_inv_f77 bin 200 dump.bin -bin dump.bin
    +
    +The Fortran code to read inv.dat will look like:
    +
    +        character*200 inventory
    +        real field1x1(360,181)
    +
    +        open(unit=2,file='dump.bin',form='unformatted')
    +!       read first record
    +        read(2) inventory
    +        read(2) field1x1
    +        (do work)
    +!       read second record
    +        read(2) inventory
    +        read(2) field1x1
    +
    +If the Fortran program which reads data in big_endian format, then dump.bin is made by
    +
    +-sh-2.05b$ wgrib2 new.grb2 -match_inv_f77 ieee 200 dump.bin -ieee dump.bin
    +
    +If the Fortran program which reads data in little_endian format, then dump.bin is made by
    +
    +-sh-2.05b$ wgrib2 new.grb2 -little_endian -match_inv_f77 ieee 200 dump.bin -ieee dump.bin
    +
    +Note the the size of the character string inventory has to be the same as the first argument to -match_inv_f77 and
    +the size of field1x1 will depend on the grid definition in the file.  Advanced users would replace
    +dump.bin by a named pipe.
    +
    + +

    Usage

    +

    + + + + +

    +-match_inv_f77 TYPE LEN FILE
    +TYPE is either bin or ieee
    +LEN is number of characters allocated for the inventory string
    +FILE is the output file
    +
    + +See also: -match_inv, +-s_out, +-inv, +-bin, +-ieee, +-big_endian, +-little_endian, +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/max.html b/docs/web_docs/max.html new file mode 100644 index 0000000..96c065d --- /dev/null +++ b/docs/web_docs/max.html @@ -0,0 +1,234 @@ + + + + Climate Prediction Center - wgrib2: -stats, max, min + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-stats, -mmax, -min +
     
    + +

    wgrib2: -stats, -max, -min

    +
    + + +

    Introduction

    + +

    +The -stats option writes a statistical summary +of the field into the inventory. +The -max option writes the maximum value and +the -min option writes the minimum. +These option are useful for quickly determining if the field has reasonable numbers. + +

    Usage

    +

    + +

    +-stats
    +-max
    +-min
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -stats
    +1:0:ndata=65160:undef=0:mean=83.8696:min=-428.1:max=317.8
    +
    +ndata = number of grid points
    +undef = number of grid points with an undefined value
    +mean = grid point average (not area weighted)
    +min = minimum value
    +max = maximum value
    +
    +$ wgrib2 test.grb2 -max
    +1:0:max=317.8
    +
    +$ wgrib2 test.grb2 -min
    +1:0:min=-428.1
    +
    +
    + +The -stats option can be combined with +the -undefine option to produce +statistics for a box.
    + +
    +$ wgrib2 test.grb2 -stats
    +1:4:ndata=10512:undef=0:mean=77.5081:min=-370:max=340.2:cos_wt_mean=97.267
    +
    +produces the global statistics. By setting grid points to undefined, +we can produce the statistics for a box.
    +
    +$ wgrib2 test.grb2 -undefine outobx 0:90 -10:10 -stats
    +1:4:ndata=10512:undef=10179:mean=79.8829:min=41:max=144:cos_wt_mean=79.8688
    +
    + +Note, if we reverse the order of the +-stats and +-undefine options, we get the global mean. +That is because the -stats option is excuted +before the -undefine options. + + +$ wgrib2 test.grb2 -stats -undefine out-box 0:10 -10:10 +1:4:ndata=10512:undef=0:mean=77.5081:min=-370:max=340.2:cos_wt_mean=97.267 + + +

    If all the data are undefined, +the -stats option will produce values +of zero for the the mean, min and max. +The -min and -max +options will yield a text string of "undefined". + + +

    +See also: -undefine +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/mem_blocks.html b/docs/web_docs/mem_blocks.html new file mode 100644 index 0000000..caef007 --- /dev/null +++ b/docs/web_docs/mem_blocks.html @@ -0,0 +1,209 @@ + + + + Climate Prediction Center - wgrib2: memory blocks, memory files, ramdisk + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 memory blocks +
     
    + +

    wgrib2: memory blocks

    +

    memory files

    +
    + + +

    Introduction

    + +

    +Memory blocks or memory files have a name like @mem:N, where N = 0..9. Memory blocks can be read and written +like ordinary files (except for text files). The advantages of memory files are + +

      +
    1. Can be initialized (read from disk) prior to processing. +
    2. Can be written to disk after processing. +
    3. Can be used to change a random access disk read to a sequential disk read. +
    4. Memory blocks Are persistant between C or fortran calls to callable wgrib2 +
    5. Memory blocks can be used HPC applicatinos where the input and output are memory and not files. +
    + +Memory blocks were added so that callable wgrib2 could be used in HPC applications. + +

    +See also: +

    + + + + + + + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + + + +

    +See also: -undefine +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/mem_del.html b/docs/web_docs/mem_del.html new file mode 100644 index 0000000..3525c51 --- /dev/null +++ b/docs/web_docs/mem_del.html @@ -0,0 +1,201 @@ + + + + Climate Prediction Center - wgrib2: -mem_del + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-mem_del +
     
    + +

    wgrib2: -mem_del CW2

    +
    + + +

    Introduction

    + +

    +Wgrib2 supports memory files. Memory files are transient and only exist +while wgrib2 is running. Memory files +can be loaded prior to grib processing by the -mem_init option, +writen to disk after grib processing by the -mem_final option +and deleted during the processing phase by the -mem_del option. +Memory files can be used with the wgrib2 utility but were designed for use by callable wgrib2 (CW2). + + +

    HPC and CW2

    + +Memory files was designed to support the read and writing of grib files using CW2 in +a HPC environment. Suppose you want to read a grib file with a 1000 grib messages. +One CPU reads the grib file, divides it into 1000 grib messages and sends one +grib message to 1000 different CPUS. Each of the CPUS is reponsible for +reading 1 grib message. Each CPU receives a message (memory buffer) with +a grib message and needs to decode that data. Rather than writing that +grib message to disk, the CPU will write the grib message to memory file +and then have wgrib2 decode the memory file, saving the metadata to another +memory file and the grid data to a rpn register. The CPU can then get the +metadata and grid from memory. + + + +

    Usage

    +
    +-mem_del N
    +                   N=0..19
    +
    + +

    Example

    +

    +The -mem_del option is intended for the use by callable wgrib2 +so that memory files can be deleted and the memory freed. + +

    +See also: -mem_final, +-mem_init, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Sep 3, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/mem_final.html b/docs/web_docs/mem_final.html new file mode 100644 index 0000000..57479c9 --- /dev/null +++ b/docs/web_docs/mem_final.html @@ -0,0 +1,202 @@ + + + + Climate Prediction Center - wgrib2: -mem_final + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-mem_final +
     
    + +

    wgrib2: -mem_final

    +
    + + +

    Introduction

    + +

    +Wgrib2 supports memory files. Memory files are transient and only exist +while wgrib2 is running. Memory files +can be loaded prior to grib processing by the -mem_init option +and writen to disk after grib processing by the -mem_final option. +Memory files are rarely used in interactive wgrib2 use. + +

    HPC and CW2

    +

    +Memory files was designed to support the reading and writing of grib files using CW2 in a HPC environment. +Suppose you want to write a grib file with a 1000 grib messages. You let 1000 CPUS encode one grib +message each. The encoding CPU may set the RPN register with the grid values. +The calling wgrib2 to encode data and write the grib2 message to a memory file. +After the call, the memory file can be read and sent to the cpus that are tasked +with writing the 1000 grib messages to disk. + +

    Usage

    +
    +-mem_final N FILE
    +                   N=0..19
    +                   FILE=file to write
    +
    + +

    Example

    +

    +

    +$ wgrib2 gep19.t00z.pgrb2af180 -mem_final 1 OUT.grb -grib @mem:1
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +2:46042:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    +..
    +
    +The above line reads the file 'gep19.t00z.pgrb2af180' and and writes it +to @mem:1. At the end of the grib processing @mem:1 is written to OUT.grb. +This example shows the contents of the memory file at the end of the grib +processing. + +

    +See also: -mem_init + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 29, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/mem_init.html b/docs/web_docs/mem_init.html new file mode 100644 index 0000000..5bfe7e6 --- /dev/null +++ b/docs/web_docs/mem_init.html @@ -0,0 +1,215 @@ + + + + Climate Prediction Center - wgrib2: -mem_init + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-mem_init +
     
    + +

    wgrib2: -mem_init CW2

    +
    + + +

    Introduction

    + +

    +Wgrib2 supports memory files. Memory files are transient and only exist +while wgrib2 is running. Memory files +can be loaded prior to grib processing by the -mem_init option +and writen to disk after grib processing by the -mem_final option. +Memory files can be used with the wgrib2 utility but were designed for use by callable wgrib2 (CW2). + + +

    HPC and CW2

    + +Memory files was designed to support the read and writing of grib files using CW2 in +a HPC environment. Suppose you want to read a grib file with a 1000 grib messages. +One CPU reads the grib file, divides it into 1000 grib messages and sends one +grib message to 1000 different CPUS. Each of the CPUS is reponsible for +reading 1 grib message. Each CPU receives a message (memory buffer) with +a grib message and needs to decode that data. Rather than writing that +grib message to disk, the CPU will write the grib message to memory file +and then have wgrib2 decode the memory file, saving the metadata to another +memory file and the grid data to a rpn register. The CPU can then get the +metadata and grid from memory. + + + +

    Usage

    +
    +-mem_init N FILE
    +                   N=0..19
    +                   FILE=file to read
    +
    + +

    Example

    +

    +

    +$ wgrib2 -mem_init 10 gep19.t00z.pgrb2af180 @mem:10
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +2:46042:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    +..
    +
    +The above line reads the file 'gep19.t00z.pgrb2af180' and save it in +memory file, @mem:10, before grib processing. Wgrib2 processes +the memory file, @mem:10. This example has no practical application; +however, the following can be used. + +
    +$ wgrib2 IN.grb | sort -t: -k3,7 | wgrib2 -i -mem_init IN.grb 0 @mem:0 -grib OUT.grb
    +
    +The above line takes the original file, IN.grb, and writes it out in sorted order. By using +a memory file, a random access read is replaced by the much faster sequential read. + +

    +See also: -mem_final, + -rpn +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 29, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/merge_fcst.html b/docs/web_docs/merge_fcst.html new file mode 100644 index 0000000..e40ea94 --- /dev/null +++ b/docs/web_docs/merge_fcst.html @@ -0,0 +1,249 @@ + + + + Climate Prediction Center - wgrib2: -merge_fcst + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-merge_fcst +
     
    + +

    wgrib2: -merge_fcst

    +
    + + +

    Introduction

    + +

    +The -merge_fcst option will try to combine +adjacent messages by increasing the time period for forecast average, +accumulation, minimum and maximum. For example, + +

    +$ wgrib2 prate.l.gdas.201404.ts -for 1:4
    +1:0:d=2014040100:PRATE:surface:0-1 hour ave fcst:
    +2:13083:d=2014040100:PRATE:surface:1-2 hour ave fcst:
    +3:26587:d=2014040100:PRATE:surface:2-3 hour ave fcst:
    +4:40437:d=2014040100:PRATE:surface:3-4 hour ave fcst:
    +
    +$ wgrib2 preas.201404.ts -for 1:4 -merge_fcst 4 /tmp/all.grb
    +(listing of input)
    +
    +$ wgrib2 /tmp/all.grb 
    +1:0:d=2014040100:PRATE:surface:0-4 hour ave fcst:
    +
    +$wgrib2 prate.l.gdas.201404.ts -for 1:4 -merge_fcst 2 /tmp/all2.grb
    +(iisting of input)
    +
    +$ wgrib2 /tmp/all2.grb 
    +1:0:d=2014040100:PRATE:surface:0-2 hour ave fcst:
    +2:29531:d=2014040100:PRATE:surface:2-4 hour ave fcst:
    +
    + +The -merge_fcst option needs the fields to be processed +in order. Fields that are not fcst averages/accumlations are ignored. In +the previous example, the input data was a time series of one varianble, and +the fields were in order. The more common case is that you have the fhr06 +(0-6 hour forecast), fhr12 (6-12 hour forecast), fhr18 (12-18 hour forecast) +and fhr24 (18-24 hour forecast) files and you want the 0-24 hour mean. Each of the +forecast files contain hundreds of fields. + +
    +$ cat fhr06 fhr12 fhr18 fhr24 | \
    +   wgrib2 - -set_grib_type c1 -set_grib_max_bits 20 -set_bin_prec 20 \
    +   -if ":PRATE:" -merge_fcst 4 OUT \
    +   -if ":APCP:" -merge_fcst 4 OUT \
    +   -if ":ACPCP:" -merge_fcst 4 OUT \
    +   -if ":BGRUN:" -merge_fcst 4 OUT
    +
    +The above command works by +
      +
    1. The first line writes the grib to stdout in chrnological order +
    2. The second line has wgrib2 read from stdin and sets the packing and precision +
    3. The third line process the PRATE, the -merge_fcst sees the data in the proper order +
    4. The 4-6 lines process the APCP, ACPCP and BGRUN fields +
    + +You can use the old and slow way which is +
    +$ cat fhr06 fhr12 fhr18 fhr24 > IN.grb
    +$ wgrib2 IN.grb | sort -t: -k4,4 -k5,5 -k6,6n | wgrib2 -i IN.grb -grib OUT.grb
    +$ wgrib2 OUT.grb -merge_fcst 4 OUT
    +
    + +

    Usage

    +

    + +

    +-merge_fcst (N=number fields to combine) (output grib file)
    +
    +When N > 0, then N fields are merged together and then written to the output grib file
    +   (requires wgrib2 v2.0.1)
    +When N == 0, then there is no limit to the number of fields to be merged
    +             and intermediate steps are written out
    +              ex. 0-1 + 1-2 + 2-3 -> 0-1, 0-2, 0-3
    +
    + +

    +The most common use would be get the 12-hour, daily, N-day average +precipation forecasts from the N hour to N+6 hour precipitation +forecasts. + +

    Restrictions

    +

    +

      +
    1. Only 1 time range specificaion is allowed in the PDS (no nested time ranges) +
    2. Forecast time units must be the same between message to be merged. +
    3. The various metadata in the grib messages to be merged must be identical except for + the averaging/accumulation interval. +
    + +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page recently modified: Sep 16, 2016, Jul 25, 2018 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/min.html b/docs/web_docs/min.html new file mode 100644 index 0000000..96c065d --- /dev/null +++ b/docs/web_docs/min.html @@ -0,0 +1,234 @@ + + + + Climate Prediction Center - wgrib2: -stats, max, min + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-stats, -mmax, -min +
     
    + +

    wgrib2: -stats, -max, -min

    +
    + + +

    Introduction

    + +

    +The -stats option writes a statistical summary +of the field into the inventory. +The -max option writes the maximum value and +the -min option writes the minimum. +These option are useful for quickly determining if the field has reasonable numbers. + +

    Usage

    +

    + +

    +-stats
    +-max
    +-min
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -stats
    +1:0:ndata=65160:undef=0:mean=83.8696:min=-428.1:max=317.8
    +
    +ndata = number of grid points
    +undef = number of grid points with an undefined value
    +mean = grid point average (not area weighted)
    +min = minimum value
    +max = maximum value
    +
    +$ wgrib2 test.grb2 -max
    +1:0:max=317.8
    +
    +$ wgrib2 test.grb2 -min
    +1:0:min=-428.1
    +
    +
    + +The -stats option can be combined with +the -undefine option to produce +statistics for a box.
    + +
    +$ wgrib2 test.grb2 -stats
    +1:4:ndata=10512:undef=0:mean=77.5081:min=-370:max=340.2:cos_wt_mean=97.267
    +
    +produces the global statistics. By setting grid points to undefined, +we can produce the statistics for a box.
    +
    +$ wgrib2 test.grb2 -undefine outobx 0:90 -10:10 -stats
    +1:4:ndata=10512:undef=10179:mean=79.8829:min=41:max=144:cos_wt_mean=79.8688
    +
    + +Note, if we reverse the order of the +-stats and +-undefine options, we get the global mean. +That is because the -stats option is excuted +before the -undefine options. + + +$ wgrib2 test.grb2 -stats -undefine out-box 0:10 -10:10 +1:4:ndata=10512:undef=0:mean=77.5081:min=-370:max=340.2:cos_wt_mean=97.267 + + +

    If all the data are undefined, +the -stats option will produce values +of zero for the the mean, min and max. +The -min and -max +options will yield a text string of "undefined". + + +

    +See also: -undefine +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/misc.html b/docs/web_docs/misc.html new file mode 100644 index 0000000..27c051b --- /dev/null +++ b/docs/web_docs/misc.html @@ -0,0 +1,203 @@ + + + + Climate Prediction Center - wgrib2: -misc + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -misc +
     
    + +

    wgrib2: -misc

    +
    + + +

    Introduction

    + +

    +We need names to identify objects and people. In the beginning, +there was variable names (ex. TMP, HGT), the level (ex. surface, 500 mb) +and a date code (ex. 2017010100, x seconds after 1 Jan. 1970). +Then there was a need for forecast time (ex. 12 hour forecast) +and accumulations/averages (0-6 hour accumulation). Life became +more complicated and wgrib2 used the -misc +option to print out the additional items necessary for identification. +The -misc will change with time as +more details are needed to identify the fields. As of 9/2017, +-misc includes ensemble information +(ex 10th member), probability (10% forecast), spatial processing, +wave_partition, JMA specific, climatology, error, confidence indicator, +chemical information and aerosol information. + +The -misc option is called by the +-s option and many other similar options. + + +

    Usage

    +

    + +

    +-misc
    +
    + +

    Example

    +

    + +

    +$ wgrib2 percentile_precip.grib2 -stats
    +1:0:75% level
    +2:315649:90% level
    +$ wgrib2 percentile_precip.grib2 -s
    +1:0:d=2014101012:TPRATE:surface:2@1 hour max(13-14 hour acc fcst)++,missing=0:75% level
    +2:315649:d=2014101012:TPRATE:surface:2@1 hour max(13-14 hour acc fcst)++,missing=0:90% level
    +
    + +

    +See also: -s +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: September 15, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/mpe.png b/docs/web_docs/mpe.png new file mode 100644 index 0000000000000000000000000000000000000000..0592901d74082c24b6fb3c341b74f2b72be49ff2 GIT binary patch literal 16091 zcmc(GL%@%bclw!f zj|=bXmpTfM>%;%N9uLT@MmT~FU+14Cja)B12Cs`Beo8)=0hY)B`2aw1aWN2ahX4Rz z02O%|9q+WgbhTKPhV&^~aNCnbbGTsBMFN&$^h80}FN^a{ou`e@>{)1^e$v&eX=ay` z;NR=jSNm#kxg6}MQW8aEg5BhI^qa_=uXPsdBhWNQ)jsq3ndoI8Br`59kvQ%sbF0(} zEu(l$$@1WT+iPo8R`z;tu=we%0)~IPBS))O|adM+(1(b z=mM6@4P(;xON4GFeBFr{{rXBEG2K(B*4MF0M8m}ZPBSh5xhE1j!>X1M-Sf-o!@V}V zqaqFFp^e^WHLNMHJ1s*c;f367-1*K@dc*U?S(>I`Se?AM;_B=|(}KNv?IquKX?0KA2uvHU|1EhEDa4_l0~?`^2LFce4A{DKM1d{ zr#UE2T!}ueMo^V`}Ij+S4 zR&)qY?fv4RLggy}{|$uqI8-1D)w7-SUfK?$e9Ky5vbU?Jw2f3(boU~#@+MyxA`uJv zx=>WS9M`10@{X#dQ=GQZ+l}#yCU{oJ#AbaG5exGxX;ebNKsI~Q7J&2bx~u!M1RNme zz=i@P`f(lHd|Ww!oW>3HAcHj=YYagF1LVt>U0CfBT~y^!)8W0Gs>(`WPp(m1D^wZ) z8$yGks?`6IcCH{n4aFYY92&9mgg?as{h%Ykmu!>5)Mq-Z$J(AJv=>YwlIZ&}QQBLy z>JHyk(bwp-QgRV~l7dk&%ba|Z#HMe$8!Z&ezXC@7#2{g5Uu-zmJH@uksXMV4Y5U}N zj`cc>qSXzOGj1Y1PkINmZrd#srww~1MJ}O}FC%_Nf^9A-_ySh@+yrA`hHz6Hc`$cO zMbo`?)#Xf~{%uD{)0AAk)7mB}g;e-;`X)z~ zYT=&OA*wa*ux(q3{@F^e2EEgkdK*=#bPpSJaft?XdSzOM6ts{+e3pR|#>h~*^7r~S zdizJBvTmX_DMVCwlcH%SN&q7O_(O=ipg^!e56ugnr|e85#0E&bZo0eI+0#}%yh?oKnpjKC`+waj z<#p1$0C8QINR)t%UK24Wez3K2WkQ#e7w?*LX<{u-g>x%S0$Nd{Z1R`p z!0SBeP0w^pMNXy=dX*|JU5WYr&kt$(v{?Gjo6X412|nBk$*`86*?+cT4hD%M?#}0`1S^ zeZiNlOY`ZB8;mOtz)si+2rKPQWrSLe=;r+{wEJD5bzt1SuD!Q}9ezP(ixsjL#`0*WZ3J`hjBcQLkHffZS@%HCV}$~!=aJy1Q7%* z%?O|&FDB$XlX!I*;ZB_awrK76_gbJffp@D8w6qMiGd}pCEkq(^9X_+rPAQuhNw1eY z0@mf8RT$%g@-N|yS6&DE3a~F_YQjQ7(X9j%zU9O*t#(=Y8|CnNZyN`tdoqJJ6(q7c z3DNH>9Dm)4SMR-_=`uk)H{s*M>EU=0Mh*pr z5LiW|oi9GbU@~O6QugK`=v+h_bjzMYHHAOCtApcLs1(^L(zEK5p@r?p|B20aB`g&3 z%U|P`cyL^hxjTjZlOeo2c}+Eu=PnlQ`%{1V#DfJ>{`xB^T#RaCT|Lv%uUANG@9aYv z+=2SqZ+BlTw%gz0UmcT0+=b|D)>Y+mn4D6AKWri|oM?43ohH6g6b5dBa8Timot$%} zeku1G*;-Zrn$wWvuiWM+QsD2FD@a{gM6v>>U;9pJU-wE&`RcP-IAhMM_h^=s`{!XD z#%g%Uz<(YPhTp9Z0U76}8(TA;<=!a6iUUd9Y7ehzehmAKH2#TI?e%!fK^QRm#$FZ2 z+EI4L*Kg3hwRu&D;vD&tTiUk`gcC)yI)sx?VEs8ItS@4&cBJpg@V6cu1^E%TUw~Dc zs9YR=LexJQx0BZajJ4oCoB2;@K%7A#cc6prktociEfna}f&ct@oXG|gTeD~bGBH1v zZnVbhS#}o3IvM)%t_s}#YUWf+OG)@5+8Td)d>Pep>I5MNg)Ais0nb`PqW;zF9x6F=`~a&?EZLp z!t0m8!SJ7QN=w^@6oj1!7S~tS5OTPa@{pcG_TqB~jThQ%o5S#&!D*n&%b81ZA8(V5 z(XG76(@62p(P&V+-z7^@+HF`FNf1C(D=JErqURw_kmowy@O8xng+D_7OSlkk&Xdiv z0gtMH)$wsGRcD5#2bGbK(i=r52H-VZ);tTh;Fj z4EKI`)xe$iN{+TIPKzM3;on$96aaKd;~~~8)5+SzYt8Sm8L0c+<5dr%2)>0ii7n;G zjK0-Z>`Xd1#Pipk^h;+6#?5`hDty>${JxV#*&vxqXe1t{fi- zRe9iS?A)yqvB6EFU0i&*iXC6Uu8`AWcU7{N&w_Z}=Sb(#C*(@Kr0Gmr~JrfWIt~lRn}ODgQ8pMW69o7 z%QOrPE(|D2){bAEF65_xTfOUJMiAcP@g_)gyNQ@WSO&jo8T`c)~#YuUDMf@Yu| zGp`x234lxV9Uz!^_a#&?ZkA;QAL{Y!JPP%(TqQm9ED!0O+oHMTR*e*olJ90frVCL( z<-aGUS1(}wCVipAc(}vEEx%&W{Fe@ONjhuzS5z!Y$yqt#RVyt+056`Ln9=v{N?0mQ zm-zdI5bA=2*4m4a<5f)w4EqR612LJL#^Ziaei4YNl1BI(n?UCdYcp_aIAQ2XENv8x6VYlcy zBE`vd60)cMDIYSahk%fq*Od_1udfkc8Js4-KSFA+0WnSKsandT${|-`p}8sA_Q;Lv zH9+>=W1ZM15QaLQOyCvu0Wc?R0))?-U8{8|uYgYfH-?znqdR+pIe& zjwN!boCetYw%G-3a3eOUpOeGIvEly3AAQ7nEp`f3jAZ9LbPCN9i}0)-B4mo6X-D6< z!P0`@%Piwj$%|z3H%>)x-zzwsX()5W0>R8LqRI0wW#^Vg&d*<$zI)fH*cv^#wL|J` zk^7mcuK~D}x{pIEXFg(+5^hjXEmf&Kjkc7vNgoN@JUO1$4Y>f8D74HGY2xGj5Flr##~*= z`6C@l?qr!-&H5XoU7i_jND;BP3oy@RYjmlttqyDcmF4@j=*WQ>tk&>sB`O$+u(f?J zXNAKF9HDGsQMV#ffp}1EY!U%ZE0`q7Rs*~Pf;pJDOvaqQjkN^(ZEM0d-j9VBwY)`L zaXmL7!Q*sY+%$6%79)MxEWa7YOZX}|0x<(V!ptAmteNQLIORXeUDdFC z0dEm0ina4HLRr7`4fCEKO@L%~6{cn4lGt)93wW(v9wB`i%jUi?FU*Q+U4Di z8-ww6#X=>8$tc(w|Hv3LkD9?^3uHDA;}}MB_m#IAYI9KGm5B_j1$* za%zR~nS^84&!?5-Z^4r(F=e72h2x$D|3TogVxgr05}PqQO7{v4Crf@^J8fih$XpCT zf4Nh6`r8_4XP;(bNi(N8Xcg0Fu%}MxFy_c^n!;qG)SfzCG}!l<_N=yx`n4zOfELsa zzEag&ETVj1qFKll%faBs?WvHR3V+i9p~1yrNw%N3Lpdn-JkyFRgTIxj9d?j(?nAK1 z#T~AZqnQ1La&I%lzy0`!EhkoC7)IPqAd zQD8jgFDxvfbCnMWyg{41J!jgUm{*mBEMOa9$Opgwj#>HM0Ef7#i{!o~YhKu%`ljE5 zcwPmDMWW6{YWtE82m8CRPU4#!WwDZlG++DlS8ZqZ^uY6UBMBYo?mENff@Zu+@&yV=HD;jsG( zA7(Wvv;%`U(wt`T1I*UwZl6BYYgNFb;wgV@)CN$g!_0rI!sp|K1mA<5;F}~r)!E*> z^)ezA(irBUf&(n&zA?l<2)ee*V0>&sVIYlar@3b3{g=IR&x-AeTFp!v^!nKQ@1kON z`8yIcP{dxDMiQViX;jDHz2L1VGH&2m+LYfctq#!T)l8qdWjZbN?d$$z6}=M7CqzN+ zr{wUkoY$5@5aWhVpeQkZ{4sU7XyLgAY zmr?`T>OJE64&AK0J9V=IaCv3^8hQJx%^qX9S05u!PkzYB`ITZjsl*My(nCy+vyqtnDwhgCYPl|ZS>I^vDdKyj^!!rE zD_I-`=f{n3BI_egYfQ?$%iwg>6|Z7rI|}LP{4%^Tmisx8`Vyk;Y@&OQ?Ve-wv$?{R z9|u{A>7(yHB`J7}K~t-sdkK6P*tl1Uo~bxDgjnqx4h;_HcZIaOqD$?FPL`&n{3K0# z9ZYy{xv(v0OcMyzGjF@RIIYVk?1~)V)NP9;WRY&AQmeG#y-|91XM9t;U!v1IW>Z;W`cEK|{T0KF$gX<>T0YcRCDV(p>kLfkjj$&?= zqxE3OE>Q9b*0W4uP9s2x<@0`UV5k}BFr57JM_f2IbUN(iuu1V#qrYTjuO7eVBw2HmiO*OA%ng$OBOlK!QdcSZw82{sh-u)Ga9HD$kpr3}1|pKA;WLwW(khE0L%iPs z?QqFwcj#EvjEzpIvoMjp1r3-|r>Hbk>J6=LIb&2A0W_)U$xg;K3j$SD<-u25?lp4- z(XM~{qs`cCh9n=e2OxH(ubUM@$GqY-u3Z(D9kVxw{KUf!AQ9riKe%fGxvc8IWskx} z4UwXP_aB_A2O}M}s~@9QaNmYSdDp=IZj_Btd_Itvb{^RbO-1#rvpybAOZ8Lh zWQ>rRjgSA4JkX(80EZ9FpCE+Up@gnEHLQ$w#toCkgZr7H!`QEh>5s&%?p6L3(Y_ZX z(vhQVWN{M&dt#YZ*=e8DzDxP2yWvq&LP8u>c?kj3bmqpiS|-1awrIb_y;$7%tWSex zcNjCj!t4WK`~BEme-{Oky&V2ysk5(vd2MzMr5>4L==;$ZtZ3$(nDdDZg3eSAW~FYbg41OSfAVEl~2y`-F zZb%~jj~zELBL?%IiCnhvH6QR1m&Ml~(tHW#a9oNXUr|dzNbkMvT)aH%CpsETwfh6+ z*6iM$@((tDuavc0dCC|2e2Vw!eYd1fKk)WT2@|FDcR@inx6q9vBN3~9qPbGAR_pJ@ zE;zicA9(dE^U3LT>7G9Pn+pe(1Hy5Ht(MD*-$dD2=IkW=x5q>m9aYMAj<&mT;8z;Y zJg$B$EhhG=EG>A*ya4S2VNJK(x|^B=<+l*ByrYhfb#=b4*n!8x4LpUAM{y{=HY`1W zjlR}rYJI)pK0#O?`i+Hw{m-|OG50S|@|Sx-SF>&F$IiZR>FYw+h5CET&C@ZTXoa~f z*QzsB&V!G(3EX~j2K=pAW+%Cm5viD9AJ2t&X>dWcP@v_to?k)Nv45_ds-#k_$+sHD z0tRyIYbJ~kr82fbj;U6c<#NZdTvjVrc=NM&zfRhG_o^Aoo%e6i!8^Q8fqUXacCbD# z?(~tC7FDTkGnlP}@Aw-(VYNz9A}Y7ljbJ?49l=Ph#}j$NbVF#i5R9P)e^ z$s^M=J6m_JaJ^-;vUqfigpd}bWT<1H8ILP!mM$l8;`fe=0V5g<$0Brm-mHVWlRLqhpgl78}?>@c_JP}@Hre!QLvMJJ{k-<1UZ*6VBg!|llnzZU$1E2G2x zabvUA%k+(Xf&yzreoD+d?>$3(_rROsEN7g{Q;pUDaI5~t=8r$ z{;@ANmlY09Djl6hg^fo|u^4bcqIw>fLX=RhY*FQf&rvv&5$aKV;xV~ik!tDVdyjMJ zmEZeW4K$)9pvU@Ad*`Zgur;Zs;chz}a!k6UcDa#U2at46AAE8^YKB- z)5(yKh@PRKZ}J50g+918gctWFUP4ym?2)t@g(ucB) z-bc0ts$snx+jf8AEIkZV4YSdO`I5vw-=(eKZ*YA*;jD~l0pA>?u{z)lzrXi-xVw8I ztZJtW7?v)iQ%2zXEza+(Yt%qGZu1FVBwlnMc}!25O{lFhD}%p zT%S?aHLv_yXN!=s7&!+=75qDzc3H|DAYR9i=k1hzcM&G-$q{1A*VL{Ecx5m>zla{# zn@0|`A3IpWOOXXoG=2W^q0T2G`F@1A%UL%sB|&HDC%Mxq5gojy&hWmXj9)XiitGD| zH`cVFFSK#NA*e`cah30JJFjTg6Wj8EaW%p-!}eSvo@SP-kcgM;Hect97Y$meVFHeT zJ9`XBF!$96G_3^yU@-pA3s6I%{Of7^2%^U~Z{js-OY z6dcrRHOkqL7g6f{g3q=i^xM1A(WRA8kuT>}-IbGjAO>+*uOS|NHUDad(YTi2V66kp z;a^beHFecuR=~;ISwthAXU}uy9{fF7_e{e8s`$@w|3NKBtQKD@!!ieDPlR+M{Ow-Y zg8#W&W9${~Xqevs-u=Fw-wziX_uRkczeD9T`HlK3A;tj*##j&+E-OmhoYbRo>^+l| z&;pjZ9ID^7zsx1}h8Xfd;cZ?YFL%jjRm?8#%#8DlJQi3Jnp}VI zEQTT-PAlU}F8pere_mY7%q4LldhL_KLy4WEhox#_U>s+H?WVb7**vz(wB$w8bC;1t zX(~8*BF9l^V&s_jVZGFKEl0ra=JG9@qd%c4{_{0tVH$jiP zLhMUzUD1p-Jgj_)@0*{9te7ZtM&3sT-%IAR=3mr2bzdA&%+!me=|M&> z)ZP7jSFjj#YU7bR9Zt4(7E#P&9s?E49}px8eq!i58su1T8<^FgJ+ryr(Tb;7%bWd3 zQ7d032+uJcn*Uw7nrD#2RJZec_Z3UEbmP}A?U|XQmopjU*5{*1P=1|JDD11AEwPib zw?xNRTPLOT^lw5bwO8lHA8hjQfP4Cpl#dklZJBe!ZT|wb&PEjxCwL^0sS`v7l+jUF zuNdyl2paPPB-)`C0_%v*4E66#XUlxAoDk12f>KFfJY;=!!_AcJvWzXl+~h)2w-y&P z&26)zACKoh-Y+qNI<-*!dQk%;%5gKZq3~TYOKG{p8b`U+(Z2?nPz68Ub8r^rqI=}& zO%wR;wCTb1!4&+f$>DC56XEY*XJ9LA*KcP)Rp)Pu4BII*Zfo!WH_Z?vp(1-6-M8Z*x^*TJgrqWP(^WL8#GxI0Ecq;LPx11*MIN{5?$w-ji= zSnK8?*2@;KFgn>uhqA=FVGW5`GBZMW zF775gQ01bK-w`iak`^IL)nFu^--UtDX)reQpn^*z!ITebgx%qGIm&(1!ml&!Y=eXu zP@A`3>{+_{IRnK`8SF7gpoFVeADd#rv8l!|6^!(WKisTkB*)Fq15p@6zq+@(I|@jW=!;}?7;OZ#B<=2i%S?09n} ziaia&QVv`+`P6gbypM8c5YNNK_5|DhaY`<=uJI`l%M$~1eg?se<8HKs8U9@S)_Aam zV*i2a3!<5*ca(8=rxR|E3qIx{M12fX7Fa#&)?>>4u7pY`8c3cj@Rqy?hdVof*$nZ6|3j$ z2<0dZ-Y*h#Zna3b!w_u^clWy6_eXOS}!X&B@Mqm}ae(%OsCeRD;iSRVhP z8t;7`D9z#Bsyz{^uo<(kWfwbh{~!~Cz_S!fnjC5_l)qOXeb3>>9#0CeyKMKIdojcc zLyE6$=t+phsUZu?RrS7Jf>NdpFE02WL`e^I+_o3CFP?$pOzqcx|6Myj#Oy(slk(A{ zzklq?@uxgVK9+|M`fz-alz&uFlKM06xoftph2QBuz211Jy*ZH-yeg?Ww?ibP1Z3c2 z2M<>XRPUZKs9bV1>9su|kDtbN1%B9!^Y*^EHD>w)PC9D-)2VH1c`4Gie9X@Vk)M*^ z*p++zqbPJyo1G?4BbsBlva!IM_Cm;@$>Zd*M^OrMb-IcK99IOCdH84I6JFgkbLlAER&dIgi ze%JQi$i09kzGc-QkrIPqE~nJQb|_&CYnXi)jw{hKtq?ddGM}NIt15a6Q*|B+2`@At zhwJYL`rl_XviiUR3l1XpIY_iwI=X)(zz@fLkof3cpx7>A&UF29m9hSnZ+J=RA36R< zboAm3_wz*h_B){ONo4v?jd@vPTgx99@6P0Rm9a^HOEu3I0ZIchC}YekBvU*8@Il1@ zrJ@=`a5RJ@;R6m*Y~H~Kp5~$d{(YorW9vpZ4F3s_3uJv_a;rNEr^y4E7hcN;Kov(D z7Dk1&UEwpGaZ@tBa5GO<)z?)wD*4<_iNV4=R87{|s*Y7;ESYTQdWzxu@$vfNE9mP} zrt5+JdTGQlC5}A>|4NQxwVYPRS%UY4nPuHrV=!4ez_N4_Mab zULxXvHWIJz2A5>QC1Rr`tD;nRTl>NAWB4OhR7 z5{w$Z9>Jq~`$?Gw8;bR29EcNkhA6b^|5l<4)55;t*!aa9d_m zPu7vw1<57CdQNV=P0aLL`6X>jU zGZot2ddE+JE$Ue#$FVX7X)UkZg|C1gh3G*~Rij|MB4vVmkz5Soy<7^&JLu9Y4g^rilf)lkE9_2&i+) zv_ucvE+&KRtfTX7@P9vv8*Lz14+C?G{as^mR0fYjJ%`ty2`uuu3R676L49zAZDy^H z{mzUBU;S4lv;j-D>%Ts!7?toXZa#hV<-{((m2k2N!%V4G=$MlP9X5&FRC;f}oVo9k zO8z+Uy;3!@XUhRU>Q7Gkjqj_jude!QrQPSR@W(ZWm{L*e_PFHC@!jNg9cdf>r*gmS(Y(vt-mQ}CIJV@alQdO zg1gA$>s>ka#@B~eQ9m!Q1zI}ZF8ms}&x)x;{Jf8^F91DKR3gx4E0Afst>rW$LEY+-y-_ zhvc#QKQnIK4;F$c*yc~7ASCoX$@xKt8gavI58`xVb5#y7KQ2mquF)c5BWRhbTSqCB z6u8>panA1laS2X%V}CKn`Fs@?@&)@*lFo+OVuU;p!voWz-Im}BJ-ietKb-Fs54$7! zByoc(`l|OxK1aJw!-sy+)%A6|Dmf{;j?Q#V*; z;}e15q}Zw*cHZuhga^5%EPwa{6~jH zJtOk)n0kUOk(m@xSpLYPX$ztCt$34H<|{kAzUBn)Cu4O|)UPPzE%xeK{_Ew9xLh%r zQa}2=0ZDicGuwh6miU>7lR*P>Ak+uIO86MpqU(T@4}4b^;pHI5wv2H&r=$!*9T)Q^ zJeHM8B0oloh56Re_fFjW{fbtf6zRJHgt&u>wG0`cvk}8fo*%Ph7Uf%qv|z;+xR+ns zgNx6HOvum~X4MkAUgNVTNt1#{b5#iR*Xm>fNM+Tx?btW;)XHz3JsObI&pVDQxOb!! zQ%+3XE;tIDhT%_ok4qs{9 zyK`!yR<#coT_xAk+Gy-R?MAq8;1f53Ao zUhx&iL4k+9tO7S(Z(BxIwr0t_853dmcN%e(i@F(g{8Qp@8G9`` z-r{UzF4hhW<@6q=%TXGA^e-Pj04V9Txxv;ILOf^&qa^5`*96zIFWIytmlRf`{y3dA zRcGOTtv*^d17>@0ZKzXziX_p(mN&|_T1ib0z+M#&Ywp7RQawzongAY6OKKEuVm{`k zk8q|)&--MC_M_^TjDLvlsYNq~$OE?w>Y1<1=uS>YvJ^fl2TgjYec`P~(TovZNCsg~ z%AXu<&uxTP{hRVgQ$-xk7$eZuGKy}2Ixwp>MDR`d=^#NF0oJi*?`VeX-fztsJrn^1 zL$0$EP_&7HARy1)@LAClqr{e~bh^d=zWaXrOES0fJA3Gnqx`Q;#IA{Lkm1PRUuGG_ z;@r9R;{cy7M||so!|4X$%nBCK8MVT_-aUI2bN>-O8scj177R$FvOekh%3$eCU#Bji z6-x3>KZ)jd@cR^9XIwqiEX~E&GF4!$a_g;x>VIaceaj+lgdNL>!Z1LILouLT9bo+t zTZ#?{QPi@4dp`G)oXbIcAolrcI!@Q>^>;RF)=w)iJ~QD54Gu&eq|8{*$ z0A14Ia<&#E2e&h@LO;JTY-)-EGvUL-fHLk%01S_)qUOA1(mT4I$FS^~)`_poDa@w2 zIEnSL93@5W_q=-67I*O&aagW&CpIEGMXY$c*&FFc2Qv=r!kE>C>2tQ^6O2X+u#Qw?E@^1wP%pxPNgsMEe3w3GoJa3yJE|flsZSlj} zM$x07Yd>J{%^kx^Kb}x0EUqyXMj>aPf5c8(r~u3k(W8yF-ZbF+{j4m8%wQQ?K&_go zmj?%XmOhL6$D2&nLeKA6+X;UrT9-aovcMe9!_8jLW9w_R_>BHbxOD#rc&tK_S{1$t zKpAiiPy0ReV{n7~+tMfEFjmCA0=2=9q;X(2q~E&nEp6NIl&52zOt})`-`rYE$jJ=Ky+k~+y^VqkCjnOFFU23#a=bZI?9+N5kdAi5-kG? z-ya4S66K%dObQuDy4S_%U3lF^sevlR+^Ly8T}o)9nRbJ}`z9C}A9x9kzh3&<`7;3d z_&JDy8p?u95UELKuF>#%+UPGf#vll?#Xk*?)CH? zcL|f+{xE^H0dlR&MGL z{`gV2jzg#bbO9RImmnvo2mAR#SmW#UFfA7W#xRza>r3N{=#+aE+K$xjd6~DZ=C+HP zGfdaOwdJjL^!`Mi6f^zKRC62K?#ufn9mG?KGqg%7m3E$uIvqK`?rUcKa5+7BCm$Tf z_wlBl>)3t8Z~Lg&6S3_-<1)PSgv)wvL*L!d*}uW!dJ~Tpm-@a#*-Fxc1(nWIkETeA zf;B!vO!uUajoVd0mP=Yn70efn{xuiHb~b$X$gQB!_UzXEf=9P%jyBR&Q7>6UE7BVVnSBnw+k7diQq=V7`NMl`c^nb~{BIAPMb6!ZgpK z@jIo2oekmDJxuMVy||8Q>+IZ5bX&AbD>S!36_DN;^wfZnDi^}Ld;JwDcJ|e|5UiA7 zYJPFruWv%0RE2DscLoQ6k7fs1+~MXeOcX~rwNlP6!KGjJ!so3D0Ak-C zP=dVr_TkFeCkrW(a=+`kKUX1OI)*?#5Ozq5u9g1p8n;>?SBoD;jyyOn>aWrHufHM7 z$L~CChFTS6{nF{)b&3>OGv-^1wKf(;TA~N0@pJ7AB&RJtKm0q2D7k*m^D(Js5qMZG-fR{s^Mc;BpssVC7%I)~p38V8I9VVzJD#!L^ zWc!&aeom}EtL~`u=Iy6?TU%bYw;LF=A;AFULWs83w%a&L%SoJhZNYIx97Po*f-Wh5 zzl5c-WRk04Y5=YGpn&(Vt0{i4@=-Zk!BDk4sWEPzG9Q-mnqem{=eB7=-y;MnuiNl< zPiKCU(2&;aH{xZXvqt}=9miE$oq^TxXBbedQ@&>N)YTu)+|`~ zse-VpXj*nG$f319Rp0nQ4M7h;?WgzKWsR)REcrwl!|9Me-$MYvkbox;tIok}(1P6S&^bB@Eho-EB|*AK(rG!-c2TH=0~d`;vV6WK$2HS8Dp1gi1E?^45S%6;^A zzM=!r$wk;z7>>)z&1JUd6PT}t>xb#Q$#7D=JL{Bir&N4)e@MPBsF51X+e=9>pZ3D# zRijH~pMhRHYJg^)MZAw50O3$>rcX}N%qHu!b(yYtGk$4lc_I43VZj-J)#7*&X)(Gg zjqNmUo2#N?80fB%N=&JM6p$ea@!ze>*A!Y3*8J4i_PwuOtnPwaSf2TE7@kH(hiqVV zk`O6(tmffd2UWsXdo0JA*q>opT#O1h%p(&XUC|O%x0BRsL*!p zb9E7jFwy=`-JP)7bY|d^G5R_5Co-Ynxif5NYjQbK8@G!D$TEGF`vxy+gJ3lx^-~u5 zHbiOQ-_K^`zwGxDD6k<0{5|H-I)T-ti$mUnV&eo*4G`nc(^+(G3>lYg)1 z>#Z)5Dl9D($TIxQg$$~Nndh!*bq~j7o8C40_r(G<5Gf8V)RynND94jtzC}D`%CXGq%e3d?zEz^M#9nFveS6)=v?@zuA!5!d}_5iaW(cu@Dc zLPw_G#W&RyZnRnMLRgxwO7n(9Mv_pmw1@4#i5kMHR#K-x%j(v&gA`NXH%p zssu1RHXf4o`@&mqY0r*+V}K00=aZ`4Fa%p6+=b7+EXQ!-fk)2zkD3#|TLbN$riB!p z5?4~ez8ID1Q6Ie2q5wf6S3WSN&Hi)JcsxG&y8Ub3KG#FeZ}3e&jp=h}4_8S_iJn#x zFvOYh=|!Jvk1XQf^Zr z_a!CG5~!wBac^k8alvlm3b84<;rnQw>6x(9B~KbWeqAQy2K%u?+}`l&+bcB_rouBlfc{#gGwM`liIkv?MMC?w4Z z^W8GhRzuVv7m!_U2;FJB$w|&>?Hr+bZGVOXyjO9Oa_M?D@alXpPAcnp`bal3!wbIm9 zY%%cX;Sz@<3~GjjI!m<8sj;d-x;7E5?d4c)Mw9lj*DU`&Ki2c!9{<4(0bPyC@tE?Z zkVX^8ONgQQ*lD!QzL55(3jAduO$Owo0qWsD>Z!jJ{?Pv753@MHS>wDN7?6faY?Jnk z0?nT>Q$Qz+1U12SbTFnT_&^G(8TcHrH6^OqKq4hHQUTBiUv-;Sm*A7MgnePQ%i?03 z^6X0+QU^jTw5tlz=uqT(*r=2)N)e+H4r(ZU6~Mv}kfsYZr$B&@M)nY*7H%18pE<)h-^W%Uj}tFnems8>JzlFNWdK>Z)nKi4UE{so*kadU_x+1*caH3)d%n*q4evi^W|rc!|4DO1$FsyS+k)3 E2kE*pIRF3v literal 0 HcmV?d00001 diff --git a/docs/web_docs/n.html b/docs/web_docs/n.html new file mode 100644 index 0000000..80da807 --- /dev/null +++ b/docs/web_docs/n.html @@ -0,0 +1,220 @@ + + + + Climate Prediction Center - wgrib2: -n + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -n +
     
    + +

    wgrib2: -n

    +
    + + +

    Introduction: message number vs inventory number

    + +

    +A grib file is made of messages and each message can contain one or more gridded fields. +If the message has two or more gridded fields, we say the message has submessages. +The wgrib2 convention for number the messages/submessages is +

    + +
    +Message/submessage numbering convention:
    +
    +   No submessage, one field
    +
    +     I     I is integer starting from 1 and is the message number
    +
    +   Submessage, multiple fields
    +
    +     I.J   I is integer starting from 1 and is the message number
    +           J is integer and is the sub-message number
    +           J = 1 for the first submessage of the Ith message
    +
    +
    +Inventory numbering convention:
    +
    +     I     I is integer starting from 1 and is the number of the field
    +
    + +

    +An alternative method for numbering the fields is the inventory number. The inventory number +is simply the grids starting from one. The inventory number is simply the line number of +the default wgrib2 inventory. The message number is the first column of the the default +wgrib2 inventory. +

    + +

    +Both the message number and the inventory number are valid ways of numbering the fields in +a grib file. The message number is the original method and reflects the structure of +the grib message/submessage structure. The inventory number is a logical numbering scheme +when trying trying to multitask wgrib2. (For example, send even fields to CPU1 and odd fields +to CPU2.) +

    + + + +
    +-sh-2.05b$ ./wgrib2 test.grb2 -s -npts -d 1
    +1:0:d=2005090200:HGT:1000 mb:60 hour fcst:npts=259920
    +
    + +

    Usage

    +

    + +

    +-n
    +
    + +See also: +-if_n, +-for_n +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/names.html b/docs/web_docs/names.html new file mode 100644 index 0000000..65e0145 --- /dev/null +++ b/docs/web_docs/names.html @@ -0,0 +1,291 @@ + + + + Climate Prediction Center - wgrib2: -names + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-names +
     
    + +

    wgrib2: -names

    +
    + + +

    Introduction (alpha)

    + +

    +WMO has defined how fields like temperature +are encoded into grib. For example, temperature has to have +(discipline, category, and parameter) to be (0, 0, 0). However, WMO never +defined a name for like "t" or "TMP" for the temperature. +Of course saying "discipline=0, category=0, and parameter=0" +is unwieldy, so the centers have adopted names for the various +fields. + +

    +The -names option changes the names of +the WMO defined fields to either the DWD, ECMWF or NCEP names or convention. +The grib format allows for locally defined fields. Centers can make extensions +to the grib table which apply to their file from that center. These fields +will use the names as defined by the originating center. The default naming +convention being set at compile time. + +

    +The -names +option is in an alpha stage of development. Our use of the ECMWF and DWD grib table +needs more work. The ECMWF and DWD names often mix the variable +(discipline, category, parameter) with other orthogonal parameters +such as + +

      +
    1. level, ex 2 meters above ground +
    2. statistical processing (in time), ex average over last 24 hours +
    3. grid, latitude on F grid +
    4. satellite information (instrument type) +
    5. aerosol type +
    6. MRMS (NSSL Mult-Radar/Multi-Sensor) adds probability to the grib name +
    + +

    +For wgrib2 v3.0.1, if the ECMWF or DWD grib name depends on any of the above parameters, the +name is not included in the wgrib2's grib table. This causes some problem because some of +the ECMWF grib names don't apply when the orthogonal parameter is not defined. +As I said before, this approach is in alpha testing. + +

    +The geometrical height has the names "dist" and "h" in the ECMWF table. Wgrib2 v3.0.1-v3.0.3 +is using "dist". Using "dist" versus "h" may change in +later versions of wgrib2, depending on which is more commonly used. (Feedback please) + +

    +The use of the ECMWF and DWD grib has not been finalized. So use -names at your own risk. + + +

    Wgrib2 has options that are dependent on the grib names such as +vector interpolation in -new_grid. At present, there is no automatic +conversion of the names. + +

    Usage

    +

    +

    +-names CENTER
    +       CENTER  =  ncep (default in the public-release makefile)
    +                  ecmwf
    +                  dwd
    +
    +       This option changes the names of the WMO defined fields to either the NCEP, DWD or
    +       ECMWF conventions.  The locally defined fields are not affected.
    +
    +The default convention is a compile-time option (USE_NAMES in the makefile).
    +To see the default, run "wgrib2 -config" and look for "default WMO names:".
    +
    + +

    Example

    +
    + wgrib2 wind.grb -names ecmwf
    +1:0:d=2009060500:wdir:200 mb:180 hour fcst:ENS=+19
    +2:97922:d=2009060500:ws:200 mb:180 hour fcst:ENS=+19
    +3:179554:d=2009060500:wdir:250 mb:180 hour fcst:ENS=+19
    +..
    + wgrib2 wind.grb -names ncep
    +1:0:d=2009060500:WDIR:200 mb:180 hour fcst:ENS=+19
    +2:97922:d=2009060500:WIND:200 mb:180 hour fcst:ENS=+19
    +3:179554:d=2009060500:WDIR:250 mb:180 hour fcst:ENS=+19
    +
    + +

    NCEP Names

    +

    +The NCEP grib names are unique, a name refers to a unique quantity. +However, the same grib name may be defined both locally and by the WMO. +Since WMO approval of a new field may take several months, NCEP usually makes +a local definition in order to speed up development. +NCEP considers duplicate names to be a mistake (same name but different quantities). +When the wgrib2 sets the variable name (ex. -set_var, -set_metadata), the WMO definition +is used if local and WMO definition exists. + + +

    DWD Names

    +The DWD grib names are unique except for a few cases (wgrib2 v3.0.1) +which were probably an oversights. There are WMO defined fields +which do not have a DWD name. +

    +Some DWD names are not orthogonal because the names include information about +the level or timing. They are not included in the wgrib2 tables. + + +

    ECMWF Names

    +The ECMWF grib names are not unique. Names may refer to +different quantities. For example, uv could have units of +m^2/s^2 or m/s^2. For decoding grib, the duplicate +names do not pose a problem. However, using +the -set_var or -set_metadata option will have problems +with names that are duplicated. Wgrib2 will use the +first definition that it finds. + +

    +Some ECMWF names are not orthogonal, they include information about +the level or timing. The some non-orthogonal variable names +are not included in the wgrib2 tables. For example, "2t" +which is the temperature two meter above the ground (or water surface). +The "2t" grib is defined as the air temperature with a level of 2 meter +above the ground. So "2t" can be thought as "t" with a level of "2 meters +above the ground". The wgrib2 script that reads the ECMWF parameter database +determines that "2t" is a non-orthogonal variable because it needs to have +a level of "2 meters above ground". As result, "2t" is not wgrib2's gribtable. +

    +Some non-orthogonal variable names are included in the wgrib2 tables. For example, +"10spg10" is defined as "10 metre wind speed probability of at least 10 m/s". The +ECMWF database indicates this parameter doesn't depend on the level or any probability +or level information. Since this variable is not conditional on the level or +probability templates, this variable is added to wgrib2's tables. + +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page created: Jan 6, 2021, July 29, 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/nc3.html b/docs/web_docs/nc3.html new file mode 100644 index 0000000..416c571 --- /dev/null +++ b/docs/web_docs/nc3.html @@ -0,0 +1,203 @@ + + + + Climate Prediction Center - wgrib2: -nc4, -nc3 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end + +
     
    + +

    wgrib2: -nc4, -nc3

    +
    + +

    Introduction

    + +

    +Wgrib2 can be compiled to use either the netCDF v3 (netCDF3) or netCDF v4 (netCDF4) libraries. If wgrib2 is +compiled with the netCDF3, you can neither read nor write netCDF4 files. However, if wgrib2 is +compiled with netCDF4, wgrib2 can read and write netCDF3 and netCDF4 files. The disadvantage of +linking in netCDF4 is that the wgrib2 executable is much larger, compiling wgrib2 can now take hours +(1.1 GHz Apollo Lake), +and problems have been encountered in compiling the latest hdf5 library with newer compilers (12/2018). + +

    +The -nc4 and +-nc3 options toggle the type of netcdf file written. The former +option will have the netcdf file be netcdf-4 format with compression turned on. The latter +will have the netcdf file be uncompressed in netcdf-3 format. + + + +

    Simple usage

    +

    + +

    +-nc3
    +-nc4
    +
    + +

    Example 1

    +

    + +

    +$ wgrib2 ../example/eta.t00z.awphys18.grb2 -nc4 -netcdf eta.nc
    +
    +The above line converts the grib2 file into a netcdf4 file assuming wgrib2 was
    +compiled with netCDF4.
    +
    +
    + +

    +See also: +-netcdf, +-nc3 +-nc4 +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan. 27, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/nc4.html b/docs/web_docs/nc4.html new file mode 100644 index 0000000..416c571 --- /dev/null +++ b/docs/web_docs/nc4.html @@ -0,0 +1,203 @@ + + + + Climate Prediction Center - wgrib2: -nc4, -nc3 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end + +
     
    + +

    wgrib2: -nc4, -nc3

    +
    + +

    Introduction

    + +

    +Wgrib2 can be compiled to use either the netCDF v3 (netCDF3) or netCDF v4 (netCDF4) libraries. If wgrib2 is +compiled with the netCDF3, you can neither read nor write netCDF4 files. However, if wgrib2 is +compiled with netCDF4, wgrib2 can read and write netCDF3 and netCDF4 files. The disadvantage of +linking in netCDF4 is that the wgrib2 executable is much larger, compiling wgrib2 can now take hours +(1.1 GHz Apollo Lake), +and problems have been encountered in compiling the latest hdf5 library with newer compilers (12/2018). + +

    +The -nc4 and +-nc3 options toggle the type of netcdf file written. The former +option will have the netcdf file be netcdf-4 format with compression turned on. The latter +will have the netcdf file be uncompressed in netcdf-3 format. + + + +

    Simple usage

    +

    + +

    +-nc3
    +-nc4
    +
    + +

    Example 1

    +

    + +

    +$ wgrib2 ../example/eta.t00z.awphys18.grb2 -nc4 -netcdf eta.nc
    +
    +The above line converts the grib2 file into a netcdf4 file assuming wgrib2 was
    +compiled with netCDF4.
    +
    +
    + +

    +See also: +-netcdf, +-nc3 +-nc4 +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan. 27, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/nc_grads.html b/docs/web_docs/nc_grads.html new file mode 100644 index 0000000..d396341 --- /dev/null +++ b/docs/web_docs/nc_grads.html @@ -0,0 +1,552 @@ + + + + Climate Prediction Center - wgrib2: -netcdf + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end + +
     
    + +

    wgrib2: -netcdf

    +
    + +

    Introduction

    + +

    +The -netcdf option writes the grid values to a specified +file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator +and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic +projection grids. Other grid templates and projections are not supported yet. + +

    +Default the grid values are written as 4 bytes float having {TIME,LAT,LON} +dimension shape (3D data) and possible vertical LEV information added to the name of variables. +For example, V wind component defined at 10 m level in atmosphere will have default name +VGRD_10maboveground. +With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data +with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical +structure analysis etc. +

    +3D and 4D data could be mixed in the same netcdf file if both have the same horizontal +grid shapes. Practically any number of variables could be placed in to the single netcdf file +as well as time dimension can be almost arbitrary extended. For these purposes +please use the wgrib2 -append option. +All missing values in data are replaced by the _FillValue defined in wgrib2 as +9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. + + + +

    Simple usage

    +

    + +

    +-netcdf file_name
    +
    + +

    Example 1

    +

    + +

    +$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    +
    +The above line converts the grib2 file into a netcdf file.
    +
    +
    + +

    Sub-options for -netcdf

    + +

    +Next sub-options could help to customize created netcdf file(s). +All sub-options must preceed the -netcdf option as it is the wgrib2 rule. +More then one -netcdf option could be given on the wgrib2 command line, +please read the documentation for wgrib2. +Almost all sub-options have -no_... version that annulates previous +assignment. +For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table +with the -nc_table sub-option or combine the command line options +with instructions in the -nc_table conversion file. + +

    +The -append option makes possible to create single +large data set for long time series of gridded data. Time dimension of data in the netcdf file +is "unlimited", it could be extended "forward" when adding new data but not "backward" before +the first defined time value. If data for the same time step already exist in the updated +netcdf file these will be silently overwritten. + +

    +The -nc_nlev option is needed to export data to netcdf +as 4D data defined in {TIME,LEV,LAT,LON} space. +It must be followed by integer max_number_of_vertical_levels +which defines the vertical dimension size of 4D data exported to the netcdf file. +This value can not be found from each single grib2 message or sub-message, +usually it has to be scanned the entire grib2 file or even number of files. +It is the reason why the max_number_of_vertical_levels +value must be provided by user. +

    +Grib2 types of vertical levels eligible for export to the netcdf as 4D data +are defined in the wgrib2 internal table and now include next types of GRIB2 levels: +

    +
    +
    20:K level +
    100:pressure level +
    104:sigma level +
    105:hybrid level +
    107:K isentropic level +
    160:ocean depth below sea level +
    +
    +

    +Data for the first found eligible level type are treated as 4D and vertical level +information is not added to the variable names. +Error is generetad if data for other then first found eligible level type +are met in the input stream. +Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space +with the possible level information included into the variable names or with the user-specified names +(see -nc_table option description below for how to do it). +

    +The -nc_nlev option has not -no_... option, +please use instead the max_number_of_vertical_levels equal to 0. +In this case all data from the input stream will be threated as 3D. +

    +When existing netcdf file is updated in the -append mode +the value of max_number_of_vertical_levels must not exceed +initial value provided when the netcdf file was first created (defined). +By default when first creating the netcdf file, vertical level values are not fixed +(are undefined) and these are defined one-by-one when data at new level are added +to the netcdf file, up to the max_number_of_vertical_levels. +To overcome this feature please use the -nc_table option. + +

    +The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is +default and do not assume data packing, only data range is checked. Data outside of +specified range are replaced by missing value code for all types of packing. +This replacement is done in the local copy of unpacked data, so main data array +stays unchanged. +Values of min and max could be any +signed float. Packing is applied to all new variables in the input stream. +If some variable was already defined in the netcdf file and now is appended to it +in the -append mode the initially defined and fixed in the netcdf file +valid range and packing parameters are used. +

    +The packing is possible to the short (2 bytes) +or byte (1 byte) values with potential loss of precision. +Both zero values of min and max +packing parameters for the short or +byte packing activate 'auto' packing when +min and max +values are defined from the first entered field. + +

    +PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file +is open with 'sdfopen' command. But by some reasons using the GrADS +data description file (catalog) for the same netcdf file helps in this situation. + +

    +The -nc_grads option activates some tests for the created +netcdf file to be GrADS (version 1.9b4) compatible, +or to be open by sdfopen in gradsnc or gradsdods. +The GrADS support only COARDS convention netcdf files; +it do not support non-constant data time stepping +and silently generates wrong time stamps for such netcdf files. +Packing to byte also is not directly recognized by GrADS v1.9b4. +With this option an error is raised and processing stops +if any of criterias above is determined. + +

    +The -nc_table option followed by the file_name is most usefull for the advanced users +as it specifies the file where user can customize many features of created netcdf file. +Next examples demonstrate which directives and conversion rules could be given +in the -nc_table file. +Almost all of them are optional with exception of $nlev for the case +when user explicitly specifies the vertical level values $levs. +

    +$lev_type 100:pressure:pressure level:mb:0.01 +

    This directive explicitly defines the type of vertical level +in the grib2 file that becomes eligible for treating data at these levels as 4D data +and some it attributes for netcdf file. +Default, first found level type listed in the wgrib2 build-in table +of eligible levels is selected if no $lev_type directive found. +

    Fields here include: +

    +
    +
    100-the grib2 level type code number +for treating data as 4D. In this example it is the code number for pressure levels, integer +
    pressure- +short_name for the vertical axis in the netcdf file, string +
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces +
    mb-vertical axis units as written in the netcdf file, string +
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file +
    +
    + +$nlev X +

    This directive is an equivalent of the -nc_nlev command line option +but value in the -nc_table file has precedence over the command line option if both are found. +It is required if next $levs directive is specified. +

    + +
    $levs lev(1) lev(2) lev(3)... +
    ...lev(I-1) lev(I) lev(I+1)... +
    ...lev(X-1) lev(X) +
    +

    +This directive explicitly specifies the vertical level values to be exported +to the netcdf file, in the netcdf units. +If this directive exists in the -nc_table file and there is found the grib2 data +eligible for the 4D presentation but defined on other then listed level - +these data are skipped from export and work is silently continued. +All data conversion parameters are checked before the $levs is checked. +List of level values could consist of multiple lines; +max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); +use space, ',', ';' or ':' as lev(i) fields separator. +

    +Impact of $nlev and $levs directives is different depending on +does the netcdf file is first created or it is updated. +When the netcdf file is first created these values are written +to the netcdf file fixing 4D data vertical structure. +When updating an existing netcdf file in the -append mode +these parameters will work like filter limiting possible +updates of 4D data by these that satisfy to the given $levs only and +ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. +

    +The $nlev and $levs directives could be necessary if records +in the grib2 file have randomly changing vertical level values +that makes it impossible sequentionally define valid order of vertical levels. + +

    +$grads 1 +

    This directive is an equivalent of the -nc_grads command line option +if passed value is 1 or to the -no_nc_grads if value is 0. +Directive in the -nc_table file has precedence over the command line option. + +

    +wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] +

    +All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' +are treated as grib2 to netcdf conversion rules for the specified variables. +In these strings the wgib2_name and wgrib2_level +are strings as returned by the wgrib2 inventory; +* used as the wgrib2_level will apply +to all levels not given explicitly. +The valid range and packing information is optional but it overwrites common +packing rule if such is specified by the -nc_pack command line option. +Absence of packing information means no packing for this variable. +Min and max values are any signed float values. Both could be omitted or put to zero. +Last case means that automatic scaling will be estimated from the first entered +wgib2_name field at the wgrib2_level +or at the first level in case of * as level value. +

    +If the keyword ignore is found as a netcdf variable name or +as a packing type value, the corresponding data are ignored +and do not written to the netcdf file. +Impact from this keyword is similar to the wgrib2 -not option +or filtering data with the grep utility. +

    +The ignore keyword is recommended if the data from the same +grib2 file are exported in number of output files (netcdf or other) +by the same wgrib2 process. Then the same decoded data could be passed +for the output in other file of any supported type. +Doing export to the single netcdf file it is not recommended to use the +ignore keyword +as corresponding data are first decoded and after that skipped from writing +to the netcdf file. +

    +In the next example two lines from the -nc_table file instruct +the wgrib2 utility export to the netcdf file the geopotential height changing name +from HGT (wgrib2) to +geopotential in the netcdf file, +at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: +

    +
    +HGT:*:geopotential
    +HGT:975 mb:ignore
    +
    +
    +All other variables not listed in the -nc_table file but found in the input stream +are processed as regular 3D data. + + +

    Example 2

    +

    +Next example shows the content of user-defined -nc_table file +for one special case of Japan Meteorological Agency MSM system grib2 data conversion. +Same -nc_table file includes the rules for +conversion of both 'surface' and upper air data although +the input grib2 files are different. + +

    +
    +#
    +# File name: jma_msm_g2nc.table
    +# Description: Specifies parameters for conversion to Netcdf format
    +# hourly analyses and forecasts of JMA MSM system as best suited to
    +# my purposes: forcing of ocean model and reference data for analysis
    +# of meteorological conditions with GrADS-based visualization tools.
    +# Sergey Varlamov, July 2007
    +#
    +$lev_type  100:p:pressure level:mb:0.01
    +$nlev      16
    +$levs  1000 975 950 925 900 850 800 700 600 500
    +        400 300 250 200 150 100
    +$grads 1
    +#
    +# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    +#
    +UGRD:*:u
    +VGRD:*:v
    +#UGRD:*:u:ignore
    +#VGRD:*:v:ignore
    +TMP:*:temp
    +#write HGT at any level as hgtprs:
    +HGT:*:hgtprs
    +#but skip HGT at 100 mb, now commented - example and test
    +#HGT:100 mb:hgtprs:ignore
    +RH:*:rh:short:-2:110
    +VVEL:*:omega
    +#
    +# JMA MSM model surface data conversion rules
    +#
    +PRMSL:mean sea level:prmsl
    +PRES:surface:prsfc
    +UGRD:10 m above ground:u10m
    +VGRD:10 m above ground:v10m
    +TMP:1.5 m above ground:t2m
    +RH:1.5 m above ground:rh2m:short:-5:110
    +TCDC:surface:ncld:short:-5:110
    +LCDC:surface:ncld_low:short:-5:110
    +MCDC:surface:ncld_mid:short:-5:110
    +HCDC:surface:ncld_upper:short:-5:110
    +APCP:surface:r1h
    +# End of file
    +
    +
    +Using above file we could create the daily file with 3h analyses
    +at the 'surface' layers from the input grib2 files
    +with the next simple shell script:
    +
    +
    +date=20070715
    +for (( j=0; j<=21; j+=3 )) #hour of day loop
    +do
    +  if [ $j -lt  10 ]
    +  then
    +    h=0$j
    +  else
    +    h=$j
    +  fi
    +  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    +
    +  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    +  code=$?
    +  if [ $code -eq 0 ]
    +  then
    +    echo ${date}${h}': created/added to Netcdf'
    +  else
    +    echo ${date}${h}': wgrib2 failed...'
    +    exit $code
    +  fi
    +done
    +
    +
    +Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    +
    +gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    +
    +and change the name for the output file:
    +
    +./msm_s_${date}.nc to the ./msm_p_${date}.nc
    +
    +Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    +utility for data visualization and analyses.
    +
    + +

    Example 3

    + +In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, +convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf +option doesn't support appending, the netcdf conversion cannot be in a loop. + +
    +Version 1, using loops and a temporary file
    +
    +rm tempfile
    +for f in gfs.t00z.pgrb2f[01]?
    +do
    +   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    +done
    +wgrib2 tempfile -netcdf ~/myfile.nc
    +rm tempfile
    +
    +Version 2, data-flow 
    +
    +1:   cat gfs.t00z.pgrb2f[01]? | \
    +2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    +3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    +4:   wgrib2 - -netcdf ~/myfile.nc
    +
    +
    +Line 1 (cat), takes all the desired grib files and writes to stdout
    +Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    +Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    +Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    +
    +

    +See also: +-bin, +-ieee +-text +-spread + +-append +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan. 27, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/nc_nlev.html b/docs/web_docs/nc_nlev.html new file mode 100644 index 0000000..d396341 --- /dev/null +++ b/docs/web_docs/nc_nlev.html @@ -0,0 +1,552 @@ + + + + Climate Prediction Center - wgrib2: -netcdf + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end + +
     
    + +

    wgrib2: -netcdf

    +
    + +

    Introduction

    + +

    +The -netcdf option writes the grid values to a specified +file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator +and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic +projection grids. Other grid templates and projections are not supported yet. + +

    +Default the grid values are written as 4 bytes float having {TIME,LAT,LON} +dimension shape (3D data) and possible vertical LEV information added to the name of variables. +For example, V wind component defined at 10 m level in atmosphere will have default name +VGRD_10maboveground. +With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data +with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical +structure analysis etc. +

    +3D and 4D data could be mixed in the same netcdf file if both have the same horizontal +grid shapes. Practically any number of variables could be placed in to the single netcdf file +as well as time dimension can be almost arbitrary extended. For these purposes +please use the wgrib2 -append option. +All missing values in data are replaced by the _FillValue defined in wgrib2 as +9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. + + + +

    Simple usage

    +

    + +

    +-netcdf file_name
    +
    + +

    Example 1

    +

    + +

    +$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    +
    +The above line converts the grib2 file into a netcdf file.
    +
    +
    + +

    Sub-options for -netcdf

    + +

    +Next sub-options could help to customize created netcdf file(s). +All sub-options must preceed the -netcdf option as it is the wgrib2 rule. +More then one -netcdf option could be given on the wgrib2 command line, +please read the documentation for wgrib2. +Almost all sub-options have -no_... version that annulates previous +assignment. +For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table +with the -nc_table sub-option or combine the command line options +with instructions in the -nc_table conversion file. + +

    +The -append option makes possible to create single +large data set for long time series of gridded data. Time dimension of data in the netcdf file +is "unlimited", it could be extended "forward" when adding new data but not "backward" before +the first defined time value. If data for the same time step already exist in the updated +netcdf file these will be silently overwritten. + +

    +The -nc_nlev option is needed to export data to netcdf +as 4D data defined in {TIME,LEV,LAT,LON} space. +It must be followed by integer max_number_of_vertical_levels +which defines the vertical dimension size of 4D data exported to the netcdf file. +This value can not be found from each single grib2 message or sub-message, +usually it has to be scanned the entire grib2 file or even number of files. +It is the reason why the max_number_of_vertical_levels +value must be provided by user. +

    +Grib2 types of vertical levels eligible for export to the netcdf as 4D data +are defined in the wgrib2 internal table and now include next types of GRIB2 levels: +

    +
    +
    20:K level +
    100:pressure level +
    104:sigma level +
    105:hybrid level +
    107:K isentropic level +
    160:ocean depth below sea level +
    +
    +

    +Data for the first found eligible level type are treated as 4D and vertical level +information is not added to the variable names. +Error is generetad if data for other then first found eligible level type +are met in the input stream. +Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space +with the possible level information included into the variable names or with the user-specified names +(see -nc_table option description below for how to do it). +

    +The -nc_nlev option has not -no_... option, +please use instead the max_number_of_vertical_levels equal to 0. +In this case all data from the input stream will be threated as 3D. +

    +When existing netcdf file is updated in the -append mode +the value of max_number_of_vertical_levels must not exceed +initial value provided when the netcdf file was first created (defined). +By default when first creating the netcdf file, vertical level values are not fixed +(are undefined) and these are defined one-by-one when data at new level are added +to the netcdf file, up to the max_number_of_vertical_levels. +To overcome this feature please use the -nc_table option. + +

    +The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is +default and do not assume data packing, only data range is checked. Data outside of +specified range are replaced by missing value code for all types of packing. +This replacement is done in the local copy of unpacked data, so main data array +stays unchanged. +Values of min and max could be any +signed float. Packing is applied to all new variables in the input stream. +If some variable was already defined in the netcdf file and now is appended to it +in the -append mode the initially defined and fixed in the netcdf file +valid range and packing parameters are used. +

    +The packing is possible to the short (2 bytes) +or byte (1 byte) values with potential loss of precision. +Both zero values of min and max +packing parameters for the short or +byte packing activate 'auto' packing when +min and max +values are defined from the first entered field. + +

    +PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file +is open with 'sdfopen' command. But by some reasons using the GrADS +data description file (catalog) for the same netcdf file helps in this situation. + +

    +The -nc_grads option activates some tests for the created +netcdf file to be GrADS (version 1.9b4) compatible, +or to be open by sdfopen in gradsnc or gradsdods. +The GrADS support only COARDS convention netcdf files; +it do not support non-constant data time stepping +and silently generates wrong time stamps for such netcdf files. +Packing to byte also is not directly recognized by GrADS v1.9b4. +With this option an error is raised and processing stops +if any of criterias above is determined. + +

    +The -nc_table option followed by the file_name is most usefull for the advanced users +as it specifies the file where user can customize many features of created netcdf file. +Next examples demonstrate which directives and conversion rules could be given +in the -nc_table file. +Almost all of them are optional with exception of $nlev for the case +when user explicitly specifies the vertical level values $levs. +

    +$lev_type 100:pressure:pressure level:mb:0.01 +

    This directive explicitly defines the type of vertical level +in the grib2 file that becomes eligible for treating data at these levels as 4D data +and some it attributes for netcdf file. +Default, first found level type listed in the wgrib2 build-in table +of eligible levels is selected if no $lev_type directive found. +

    Fields here include: +

    +
    +
    100-the grib2 level type code number +for treating data as 4D. In this example it is the code number for pressure levels, integer +
    pressure- +short_name for the vertical axis in the netcdf file, string +
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces +
    mb-vertical axis units as written in the netcdf file, string +
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file +
    +
    + +$nlev X +

    This directive is an equivalent of the -nc_nlev command line option +but value in the -nc_table file has precedence over the command line option if both are found. +It is required if next $levs directive is specified. +

    + +
    $levs lev(1) lev(2) lev(3)... +
    ...lev(I-1) lev(I) lev(I+1)... +
    ...lev(X-1) lev(X) +
    +

    +This directive explicitly specifies the vertical level values to be exported +to the netcdf file, in the netcdf units. +If this directive exists in the -nc_table file and there is found the grib2 data +eligible for the 4D presentation but defined on other then listed level - +these data are skipped from export and work is silently continued. +All data conversion parameters are checked before the $levs is checked. +List of level values could consist of multiple lines; +max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); +use space, ',', ';' or ':' as lev(i) fields separator. +

    +Impact of $nlev and $levs directives is different depending on +does the netcdf file is first created or it is updated. +When the netcdf file is first created these values are written +to the netcdf file fixing 4D data vertical structure. +When updating an existing netcdf file in the -append mode +these parameters will work like filter limiting possible +updates of 4D data by these that satisfy to the given $levs only and +ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. +

    +The $nlev and $levs directives could be necessary if records +in the grib2 file have randomly changing vertical level values +that makes it impossible sequentionally define valid order of vertical levels. + +

    +$grads 1 +

    This directive is an equivalent of the -nc_grads command line option +if passed value is 1 or to the -no_nc_grads if value is 0. +Directive in the -nc_table file has precedence over the command line option. + +

    +wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] +

    +All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' +are treated as grib2 to netcdf conversion rules for the specified variables. +In these strings the wgib2_name and wgrib2_level +are strings as returned by the wgrib2 inventory; +* used as the wgrib2_level will apply +to all levels not given explicitly. +The valid range and packing information is optional but it overwrites common +packing rule if such is specified by the -nc_pack command line option. +Absence of packing information means no packing for this variable. +Min and max values are any signed float values. Both could be omitted or put to zero. +Last case means that automatic scaling will be estimated from the first entered +wgib2_name field at the wgrib2_level +or at the first level in case of * as level value. +

    +If the keyword ignore is found as a netcdf variable name or +as a packing type value, the corresponding data are ignored +and do not written to the netcdf file. +Impact from this keyword is similar to the wgrib2 -not option +or filtering data with the grep utility. +

    +The ignore keyword is recommended if the data from the same +grib2 file are exported in number of output files (netcdf or other) +by the same wgrib2 process. Then the same decoded data could be passed +for the output in other file of any supported type. +Doing export to the single netcdf file it is not recommended to use the +ignore keyword +as corresponding data are first decoded and after that skipped from writing +to the netcdf file. +

    +In the next example two lines from the -nc_table file instruct +the wgrib2 utility export to the netcdf file the geopotential height changing name +from HGT (wgrib2) to +geopotential in the netcdf file, +at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: +

    +
    +HGT:*:geopotential
    +HGT:975 mb:ignore
    +
    +
    +All other variables not listed in the -nc_table file but found in the input stream +are processed as regular 3D data. + + +

    Example 2

    +

    +Next example shows the content of user-defined -nc_table file +for one special case of Japan Meteorological Agency MSM system grib2 data conversion. +Same -nc_table file includes the rules for +conversion of both 'surface' and upper air data although +the input grib2 files are different. + +

    +
    +#
    +# File name: jma_msm_g2nc.table
    +# Description: Specifies parameters for conversion to Netcdf format
    +# hourly analyses and forecasts of JMA MSM system as best suited to
    +# my purposes: forcing of ocean model and reference data for analysis
    +# of meteorological conditions with GrADS-based visualization tools.
    +# Sergey Varlamov, July 2007
    +#
    +$lev_type  100:p:pressure level:mb:0.01
    +$nlev      16
    +$levs  1000 975 950 925 900 850 800 700 600 500
    +        400 300 250 200 150 100
    +$grads 1
    +#
    +# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    +#
    +UGRD:*:u
    +VGRD:*:v
    +#UGRD:*:u:ignore
    +#VGRD:*:v:ignore
    +TMP:*:temp
    +#write HGT at any level as hgtprs:
    +HGT:*:hgtprs
    +#but skip HGT at 100 mb, now commented - example and test
    +#HGT:100 mb:hgtprs:ignore
    +RH:*:rh:short:-2:110
    +VVEL:*:omega
    +#
    +# JMA MSM model surface data conversion rules
    +#
    +PRMSL:mean sea level:prmsl
    +PRES:surface:prsfc
    +UGRD:10 m above ground:u10m
    +VGRD:10 m above ground:v10m
    +TMP:1.5 m above ground:t2m
    +RH:1.5 m above ground:rh2m:short:-5:110
    +TCDC:surface:ncld:short:-5:110
    +LCDC:surface:ncld_low:short:-5:110
    +MCDC:surface:ncld_mid:short:-5:110
    +HCDC:surface:ncld_upper:short:-5:110
    +APCP:surface:r1h
    +# End of file
    +
    +
    +Using above file we could create the daily file with 3h analyses
    +at the 'surface' layers from the input grib2 files
    +with the next simple shell script:
    +
    +
    +date=20070715
    +for (( j=0; j<=21; j+=3 )) #hour of day loop
    +do
    +  if [ $j -lt  10 ]
    +  then
    +    h=0$j
    +  else
    +    h=$j
    +  fi
    +  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    +
    +  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    +  code=$?
    +  if [ $code -eq 0 ]
    +  then
    +    echo ${date}${h}': created/added to Netcdf'
    +  else
    +    echo ${date}${h}': wgrib2 failed...'
    +    exit $code
    +  fi
    +done
    +
    +
    +Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    +
    +gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    +
    +and change the name for the output file:
    +
    +./msm_s_${date}.nc to the ./msm_p_${date}.nc
    +
    +Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    +utility for data visualization and analyses.
    +
    + +

    Example 3

    + +In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, +convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf +option doesn't support appending, the netcdf conversion cannot be in a loop. + +
    +Version 1, using loops and a temporary file
    +
    +rm tempfile
    +for f in gfs.t00z.pgrb2f[01]?
    +do
    +   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    +done
    +wgrib2 tempfile -netcdf ~/myfile.nc
    +rm tempfile
    +
    +Version 2, data-flow 
    +
    +1:   cat gfs.t00z.pgrb2f[01]? | \
    +2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    +3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    +4:   wgrib2 - -netcdf ~/myfile.nc
    +
    +
    +Line 1 (cat), takes all the desired grib files and writes to stdout
    +Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    +Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    +Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    +
    +

    +See also: +-bin, +-ieee +-text +-spread + +-append +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan. 27, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/nc_pack.html b/docs/web_docs/nc_pack.html new file mode 100644 index 0000000..d396341 --- /dev/null +++ b/docs/web_docs/nc_pack.html @@ -0,0 +1,552 @@ + + + + Climate Prediction Center - wgrib2: -netcdf + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end + +
     
    + +

    wgrib2: -netcdf

    +
    + +

    Introduction

    + +

    +The -netcdf option writes the grid values to a specified +file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator +and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic +projection grids. Other grid templates and projections are not supported yet. + +

    +Default the grid values are written as 4 bytes float having {TIME,LAT,LON} +dimension shape (3D data) and possible vertical LEV information added to the name of variables. +For example, V wind component defined at 10 m level in atmosphere will have default name +VGRD_10maboveground. +With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data +with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical +structure analysis etc. +

    +3D and 4D data could be mixed in the same netcdf file if both have the same horizontal +grid shapes. Practically any number of variables could be placed in to the single netcdf file +as well as time dimension can be almost arbitrary extended. For these purposes +please use the wgrib2 -append option. +All missing values in data are replaced by the _FillValue defined in wgrib2 as +9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. + + + +

    Simple usage

    +

    + +

    +-netcdf file_name
    +
    + +

    Example 1

    +

    + +

    +$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    +
    +The above line converts the grib2 file into a netcdf file.
    +
    +
    + +

    Sub-options for -netcdf

    + +

    +Next sub-options could help to customize created netcdf file(s). +All sub-options must preceed the -netcdf option as it is the wgrib2 rule. +More then one -netcdf option could be given on the wgrib2 command line, +please read the documentation for wgrib2. +Almost all sub-options have -no_... version that annulates previous +assignment. +For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table +with the -nc_table sub-option or combine the command line options +with instructions in the -nc_table conversion file. + +

    +The -append option makes possible to create single +large data set for long time series of gridded data. Time dimension of data in the netcdf file +is "unlimited", it could be extended "forward" when adding new data but not "backward" before +the first defined time value. If data for the same time step already exist in the updated +netcdf file these will be silently overwritten. + +

    +The -nc_nlev option is needed to export data to netcdf +as 4D data defined in {TIME,LEV,LAT,LON} space. +It must be followed by integer max_number_of_vertical_levels +which defines the vertical dimension size of 4D data exported to the netcdf file. +This value can not be found from each single grib2 message or sub-message, +usually it has to be scanned the entire grib2 file or even number of files. +It is the reason why the max_number_of_vertical_levels +value must be provided by user. +

    +Grib2 types of vertical levels eligible for export to the netcdf as 4D data +are defined in the wgrib2 internal table and now include next types of GRIB2 levels: +

    +
    +
    20:K level +
    100:pressure level +
    104:sigma level +
    105:hybrid level +
    107:K isentropic level +
    160:ocean depth below sea level +
    +
    +

    +Data for the first found eligible level type are treated as 4D and vertical level +information is not added to the variable names. +Error is generetad if data for other then first found eligible level type +are met in the input stream. +Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space +with the possible level information included into the variable names or with the user-specified names +(see -nc_table option description below for how to do it). +

    +The -nc_nlev option has not -no_... option, +please use instead the max_number_of_vertical_levels equal to 0. +In this case all data from the input stream will be threated as 3D. +

    +When existing netcdf file is updated in the -append mode +the value of max_number_of_vertical_levels must not exceed +initial value provided when the netcdf file was first created (defined). +By default when first creating the netcdf file, vertical level values are not fixed +(are undefined) and these are defined one-by-one when data at new level are added +to the netcdf file, up to the max_number_of_vertical_levels. +To overcome this feature please use the -nc_table option. + +

    +The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is +default and do not assume data packing, only data range is checked. Data outside of +specified range are replaced by missing value code for all types of packing. +This replacement is done in the local copy of unpacked data, so main data array +stays unchanged. +Values of min and max could be any +signed float. Packing is applied to all new variables in the input stream. +If some variable was already defined in the netcdf file and now is appended to it +in the -append mode the initially defined and fixed in the netcdf file +valid range and packing parameters are used. +

    +The packing is possible to the short (2 bytes) +or byte (1 byte) values with potential loss of precision. +Both zero values of min and max +packing parameters for the short or +byte packing activate 'auto' packing when +min and max +values are defined from the first entered field. + +

    +PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file +is open with 'sdfopen' command. But by some reasons using the GrADS +data description file (catalog) for the same netcdf file helps in this situation. + +

    +The -nc_grads option activates some tests for the created +netcdf file to be GrADS (version 1.9b4) compatible, +or to be open by sdfopen in gradsnc or gradsdods. +The GrADS support only COARDS convention netcdf files; +it do not support non-constant data time stepping +and silently generates wrong time stamps for such netcdf files. +Packing to byte also is not directly recognized by GrADS v1.9b4. +With this option an error is raised and processing stops +if any of criterias above is determined. + +

    +The -nc_table option followed by the file_name is most usefull for the advanced users +as it specifies the file where user can customize many features of created netcdf file. +Next examples demonstrate which directives and conversion rules could be given +in the -nc_table file. +Almost all of them are optional with exception of $nlev for the case +when user explicitly specifies the vertical level values $levs. +

    +$lev_type 100:pressure:pressure level:mb:0.01 +

    This directive explicitly defines the type of vertical level +in the grib2 file that becomes eligible for treating data at these levels as 4D data +and some it attributes for netcdf file. +Default, first found level type listed in the wgrib2 build-in table +of eligible levels is selected if no $lev_type directive found. +

    Fields here include: +

    +
    +
    100-the grib2 level type code number +for treating data as 4D. In this example it is the code number for pressure levels, integer +
    pressure- +short_name for the vertical axis in the netcdf file, string +
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces +
    mb-vertical axis units as written in the netcdf file, string +
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file +
    +
    + +$nlev X +

    This directive is an equivalent of the -nc_nlev command line option +but value in the -nc_table file has precedence over the command line option if both are found. +It is required if next $levs directive is specified. +

    + +
    $levs lev(1) lev(2) lev(3)... +
    ...lev(I-1) lev(I) lev(I+1)... +
    ...lev(X-1) lev(X) +
    +

    +This directive explicitly specifies the vertical level values to be exported +to the netcdf file, in the netcdf units. +If this directive exists in the -nc_table file and there is found the grib2 data +eligible for the 4D presentation but defined on other then listed level - +these data are skipped from export and work is silently continued. +All data conversion parameters are checked before the $levs is checked. +List of level values could consist of multiple lines; +max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); +use space, ',', ';' or ':' as lev(i) fields separator. +

    +Impact of $nlev and $levs directives is different depending on +does the netcdf file is first created or it is updated. +When the netcdf file is first created these values are written +to the netcdf file fixing 4D data vertical structure. +When updating an existing netcdf file in the -append mode +these parameters will work like filter limiting possible +updates of 4D data by these that satisfy to the given $levs only and +ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. +

    +The $nlev and $levs directives could be necessary if records +in the grib2 file have randomly changing vertical level values +that makes it impossible sequentionally define valid order of vertical levels. + +

    +$grads 1 +

    This directive is an equivalent of the -nc_grads command line option +if passed value is 1 or to the -no_nc_grads if value is 0. +Directive in the -nc_table file has precedence over the command line option. + +

    +wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] +

    +All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' +are treated as grib2 to netcdf conversion rules for the specified variables. +In these strings the wgib2_name and wgrib2_level +are strings as returned by the wgrib2 inventory; +* used as the wgrib2_level will apply +to all levels not given explicitly. +The valid range and packing information is optional but it overwrites common +packing rule if such is specified by the -nc_pack command line option. +Absence of packing information means no packing for this variable. +Min and max values are any signed float values. Both could be omitted or put to zero. +Last case means that automatic scaling will be estimated from the first entered +wgib2_name field at the wgrib2_level +or at the first level in case of * as level value. +

    +If the keyword ignore is found as a netcdf variable name or +as a packing type value, the corresponding data are ignored +and do not written to the netcdf file. +Impact from this keyword is similar to the wgrib2 -not option +or filtering data with the grep utility. +

    +The ignore keyword is recommended if the data from the same +grib2 file are exported in number of output files (netcdf or other) +by the same wgrib2 process. Then the same decoded data could be passed +for the output in other file of any supported type. +Doing export to the single netcdf file it is not recommended to use the +ignore keyword +as corresponding data are first decoded and after that skipped from writing +to the netcdf file. +

    +In the next example two lines from the -nc_table file instruct +the wgrib2 utility export to the netcdf file the geopotential height changing name +from HGT (wgrib2) to +geopotential in the netcdf file, +at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: +

    +
    +HGT:*:geopotential
    +HGT:975 mb:ignore
    +
    +
    +All other variables not listed in the -nc_table file but found in the input stream +are processed as regular 3D data. + + +

    Example 2

    +

    +Next example shows the content of user-defined -nc_table file +for one special case of Japan Meteorological Agency MSM system grib2 data conversion. +Same -nc_table file includes the rules for +conversion of both 'surface' and upper air data although +the input grib2 files are different. + +

    +
    +#
    +# File name: jma_msm_g2nc.table
    +# Description: Specifies parameters for conversion to Netcdf format
    +# hourly analyses and forecasts of JMA MSM system as best suited to
    +# my purposes: forcing of ocean model and reference data for analysis
    +# of meteorological conditions with GrADS-based visualization tools.
    +# Sergey Varlamov, July 2007
    +#
    +$lev_type  100:p:pressure level:mb:0.01
    +$nlev      16
    +$levs  1000 975 950 925 900 850 800 700 600 500
    +        400 300 250 200 150 100
    +$grads 1
    +#
    +# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    +#
    +UGRD:*:u
    +VGRD:*:v
    +#UGRD:*:u:ignore
    +#VGRD:*:v:ignore
    +TMP:*:temp
    +#write HGT at any level as hgtprs:
    +HGT:*:hgtprs
    +#but skip HGT at 100 mb, now commented - example and test
    +#HGT:100 mb:hgtprs:ignore
    +RH:*:rh:short:-2:110
    +VVEL:*:omega
    +#
    +# JMA MSM model surface data conversion rules
    +#
    +PRMSL:mean sea level:prmsl
    +PRES:surface:prsfc
    +UGRD:10 m above ground:u10m
    +VGRD:10 m above ground:v10m
    +TMP:1.5 m above ground:t2m
    +RH:1.5 m above ground:rh2m:short:-5:110
    +TCDC:surface:ncld:short:-5:110
    +LCDC:surface:ncld_low:short:-5:110
    +MCDC:surface:ncld_mid:short:-5:110
    +HCDC:surface:ncld_upper:short:-5:110
    +APCP:surface:r1h
    +# End of file
    +
    +
    +Using above file we could create the daily file with 3h analyses
    +at the 'surface' layers from the input grib2 files
    +with the next simple shell script:
    +
    +
    +date=20070715
    +for (( j=0; j<=21; j+=3 )) #hour of day loop
    +do
    +  if [ $j -lt  10 ]
    +  then
    +    h=0$j
    +  else
    +    h=$j
    +  fi
    +  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    +
    +  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    +  code=$?
    +  if [ $code -eq 0 ]
    +  then
    +    echo ${date}${h}': created/added to Netcdf'
    +  else
    +    echo ${date}${h}': wgrib2 failed...'
    +    exit $code
    +  fi
    +done
    +
    +
    +Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    +
    +gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    +
    +and change the name for the output file:
    +
    +./msm_s_${date}.nc to the ./msm_p_${date}.nc
    +
    +Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    +utility for data visualization and analyses.
    +
    + +

    Example 3

    + +In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, +convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf +option doesn't support appending, the netcdf conversion cannot be in a loop. + +
    +Version 1, using loops and a temporary file
    +
    +rm tempfile
    +for f in gfs.t00z.pgrb2f[01]?
    +do
    +   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    +done
    +wgrib2 tempfile -netcdf ~/myfile.nc
    +rm tempfile
    +
    +Version 2, data-flow 
    +
    +1:   cat gfs.t00z.pgrb2f[01]? | \
    +2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    +3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    +4:   wgrib2 - -netcdf ~/myfile.nc
    +
    +
    +Line 1 (cat), takes all the desired grib files and writes to stdout
    +Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    +Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    +Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    +
    +

    +See also: +-bin, +-ieee +-text +-spread + +-append +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan. 27, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/nc_table.html b/docs/web_docs/nc_table.html new file mode 100644 index 0000000..3b9115a --- /dev/null +++ b/docs/web_docs/nc_table.html @@ -0,0 +1,557 @@ + + + + Climate Prediction Center - wgrib2: -nc_table + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end + +
     
    + +

    wgrib2: -nc_table

    +
    + +

    Introduction

    +

    +The -nc_table option modifies how the +-netcdf option works. Look at "Example 2" +for details on using -nc_table. + + +

    +The -netcdf option writes the grid values to a specified +file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator +and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic +projection grids. Other grid templates and projections are not supported yet. + +

    +Default the grid values are written as 4 bytes float having {TIME,LAT,LON} +dimension shape (3D data) and possible vertical LEV information added to the name of variables. +For example, V wind component defined at 10 m level in atmosphere will have default name +VGRD_10maboveground. +With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data +with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical +structure analysis etc. +

    +3D and 4D data could be mixed in the same netcdf file if both have the same horizontal +grid shapes. Practically any number of variables could be placed in to the single netcdf file +as well as time dimension can be almost arbitrary extended. For these purposes +please use the wgrib2 -append option. +All missing values in data are replaced by the _FillValue defined in wgrib2 as +9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. + + + +

    Simple usage

    +

    + +

    +-netcdf file_name
    +
    + +

    Example 1

    +

    + +

    +$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    +
    +The above line converts the grib2 file into a netcdf file.
    +
    +
    + +

    Sub-options for -netcdf

    + +

    +Next sub-options could help to customize created netcdf file(s). +All sub-options must preceed the -netcdf option as it is the wgrib2 rule. +More then one -netcdf option could be given on the wgrib2 command line, +please read the documentation for wgrib2. +Almost all sub-options have -no_... version that annulates previous +assignment. +For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table +with the -nc_table sub-option or combine the command line options +with instructions in the -nc_table conversion file. + +

    +The -append option makes possible to create single +large data set for long time series of gridded data. Time dimension of data in the netcdf file +is "unlimited", it could be extended "forward" when adding new data but not "backward" before +the first defined time value. If data for the same time step already exist in the updated +netcdf file these will be silently overwritten. + +

    +The -nc_nlev option is needed to export data to netcdf +as 4D data defined in {TIME,LEV,LAT,LON} space. +It must be followed by integer max_number_of_vertical_levels +which defines the vertical dimension size of 4D data exported to the netcdf file. +This value can not be found from each single grib2 message or sub-message, +usually it has to be scanned the entire grib2 file or even number of files. +It is the reason why the max_number_of_vertical_levels +value must be provided by user. +

    +Grib2 types of vertical levels eligible for export to the netcdf as 4D data +are defined in the wgrib2 internal table and now include next types of GRIB2 levels: +

    +
    +
    20:K level +
    100:pressure level +
    104:sigma level +
    105:hybrid level +
    107:K isentropic level +
    160:ocean depth below sea level +
    +
    +

    +Data for the first found eligible level type are treated as 4D and vertical level +information is not added to the variable names. +Error is generetad if data for other then first found eligible level type +are met in the input stream. +Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space +with the possible level information included into the variable names or with the user-specified names +(see -nc_table option description below for how to do it). +

    +The -nc_nlev option has not -no_... option, +please use instead the max_number_of_vertical_levels equal to 0. +In this case all data from the input stream will be threated as 3D. +

    +When existing netcdf file is updated in the -append mode +the value of max_number_of_vertical_levels must not exceed +initial value provided when the netcdf file was first created (defined). +By default when first creating the netcdf file, vertical level values are not fixed +(are undefined) and these are defined one-by-one when data at new level are added +to the netcdf file, up to the max_number_of_vertical_levels. +To overcome this feature please use the -nc_table option. + +

    +The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is +default and do not assume data packing, only data range is checked. Data outside of +specified range are replaced by missing value code for all types of packing. +This replacement is done in the local copy of unpacked data, so main data array +stays unchanged. +Values of min and max could be any +signed float. Packing is applied to all new variables in the input stream. +If some variable was already defined in the netcdf file and now is appended to it +in the -append mode the initially defined and fixed in the netcdf file +valid range and packing parameters are used. +

    +The packing is possible to the short (2 bytes) +or byte (1 byte) values with potential loss of precision. +Both zero values of min and max +packing parameters for the short or +byte packing activate 'auto' packing when +min and max +values are defined from the first entered field. + +

    +PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file +is open with 'sdfopen' command. But by some reasons using the GrADS +data description file (catalog) for the same netcdf file helps in this situation. + +

    +The -nc_grads option activates some tests for the created +netcdf file to be GrADS (version 1.9b4) compatible, +or to be open by sdfopen in gradsnc or gradsdods. +The GrADS support only COARDS convention netcdf files; +it do not support non-constant data time stepping +and silently generates wrong time stamps for such netcdf files. +Packing to byte also is not directly recognized by GrADS v1.9b4. +With this option an error is raised and processing stops +if any of criterias above is determined. + +

    +The -nc_table option followed by the file_name is most usefull for the advanced users +as it specifies the file where user can customize many features of created netcdf file. +Next examples demonstrate which directives and conversion rules could be given +in the -nc_table file. +Almost all of them are optional with exception of $nlev for the case +when user explicitly specifies the vertical level values $levs. +

    +$lev_type 100:pressure:pressure level:mb:0.01 +

    This directive explicitly defines the type of vertical level +in the grib2 file that becomes eligible for treating data at these levels as 4D data +and some it attributes for netcdf file. +Default, first found level type listed in the wgrib2 build-in table +of eligible levels is selected if no $lev_type directive found. +

    Fields here include: +

    +
    +
    100-the grib2 level type code number +for treating data as 4D. In this example it is the code number for pressure levels, integer +
    pressure- +short_name for the vertical axis in the netcdf file, string +
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces +
    mb-vertical axis units as written in the netcdf file, string +
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file +
    +
    + +$nlev X +

    This directive is an equivalent of the -nc_nlev command line option +but value in the -nc_table file has precedence over the command line option if both are found. +It is required if next $levs directive is specified. +

    + +
    $levs lev(1) lev(2) lev(3)... +
    ...lev(I-1) lev(I) lev(I+1)... +
    ...lev(X-1) lev(X) +
    +

    +This directive explicitly specifies the vertical level values to be exported +to the netcdf file, in the netcdf units. +If this directive exists in the -nc_table file and there is found the grib2 data +eligible for the 4D presentation but defined on other then listed level - +these data are skipped from export and work is silently continued. +All data conversion parameters are checked before the $levs is checked. +List of level values could consist of multiple lines; +max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); +use space, ',', ';' or ':' as lev(i) fields separator. +

    +Impact of $nlev and $levs directives is different depending on +does the netcdf file is first created or it is updated. +When the netcdf file is first created these values are written +to the netcdf file fixing 4D data vertical structure. +When updating an existing netcdf file in the -append mode +these parameters will work like filter limiting possible +updates of 4D data by these that satisfy to the given $levs only and +ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. +

    +The $nlev and $levs directives could be necessary if records +in the grib2 file have randomly changing vertical level values +that makes it impossible sequentionally define valid order of vertical levels. + +

    +$grads 1 +

    This directive is an equivalent of the -nc_grads command line option +if passed value is 1 or to the -no_nc_grads if value is 0. +Directive in the -nc_table file has precedence over the command line option. + +

    +wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] +

    +All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' +are treated as grib2 to netcdf conversion rules for the specified variables. +In these strings the wgib2_name and wgrib2_level +are strings as returned by the wgrib2 inventory; +* used as the wgrib2_level will apply +to all levels not given explicitly. +The valid range and packing information is optional but it overwrites common +packing rule if such is specified by the -nc_pack command line option. +Absence of packing information means no packing for this variable. +Min and max values are any signed float values. Both could be omitted or put to zero. +Last case means that automatic scaling will be estimated from the first entered +wgib2_name field at the wgrib2_level +or at the first level in case of * as level value. +

    +If the keyword ignore is found as a netcdf variable name or +as a packing type value, the corresponding data are ignored +and do not written to the netcdf file. +Impact from this keyword is similar to the wgrib2 -not option +or filtering data with the grep utility. +

    +The ignore keyword is recommended if the data from the same +grib2 file are exported in number of output files (netcdf or other) +by the same wgrib2 process. Then the same decoded data could be passed +for the output in other file of any supported type. +Doing export to the single netcdf file it is not recommended to use the +ignore keyword +as corresponding data are first decoded and after that skipped from writing +to the netcdf file. +

    +In the next example two lines from the -nc_table file instruct +the wgrib2 utility export to the netcdf file the geopotential height changing name +from HGT (wgrib2) to +geopotential in the netcdf file, +at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: +

    +
    +HGT:*:geopotential
    +HGT:975 mb:ignore
    +
    +
    +All other variables not listed in the -nc_table file but found in the input stream +are processed as regular 3D data. + + +

    Example 2

    +

    +Next example shows the content of user-defined -nc_table file +for one special case of Japan Meteorological Agency MSM system grib2 data conversion. +Same -nc_table file includes the rules for +conversion of both 'surface' and upper air data although +the input grib2 files are different. + +

    +
    +#
    +# File name: jma_msm_g2nc.table
    +# Description: Specifies parameters for conversion to Netcdf format
    +# hourly analyses and forecasts of JMA MSM system as best suited to
    +# my purposes: forcing of ocean model and reference data for analysis
    +# of meteorological conditions with GrADS-based visualization tools.
    +# Sergey Varlamov, July 2007
    +#
    +$lev_type  100:p:pressure level:mb:0.01
    +$nlev      16
    +$levs  1000 975 950 925 900 850 800 700 600 500
    +        400 300 250 200 150 100
    +$grads 1
    +#
    +# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    +#
    +UGRD:*:u
    +VGRD:*:v
    +#UGRD:*:u:ignore
    +#VGRD:*:v:ignore
    +TMP:*:temp
    +#write HGT at any level as hgtprs:
    +HGT:*:hgtprs
    +#but skip HGT at 100 mb, now commented - example and test
    +#HGT:100 mb:hgtprs:ignore
    +RH:*:rh:short:-2:110
    +VVEL:*:omega
    +#
    +# JMA MSM model surface data conversion rules
    +#
    +PRMSL:mean sea level:prmsl
    +PRES:surface:prsfc
    +UGRD:10 m above ground:u10m
    +VGRD:10 m above ground:v10m
    +TMP:1.5 m above ground:t2m
    +RH:1.5 m above ground:rh2m:short:-5:110
    +TCDC:surface:ncld:short:-5:110
    +LCDC:surface:ncld_low:short:-5:110
    +MCDC:surface:ncld_mid:short:-5:110
    +HCDC:surface:ncld_upper:short:-5:110
    +APCP:surface:r1h
    +# End of file
    +
    +
    +Using above file we could create the daily file with 3h analyses
    +at the 'surface' layers from the input grib2 files
    +with the next simple shell script:
    +
    +
    +date=20070715
    +for (( j=0; j<=21; j+=3 )) #hour of day loop
    +do
    +  if [ $j -lt  10 ]
    +  then
    +    h=0$j
    +  else
    +    h=$j
    +  fi
    +  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    +
    +  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    +  code=$?
    +  if [ $code -eq 0 ]
    +  then
    +    echo ${date}${h}': created/added to Netcdf'
    +  else
    +    echo ${date}${h}': wgrib2 failed...'
    +    exit $code
    +  fi
    +done
    +
    +
    +Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    +
    +gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    +
    +and change the name for the output file:
    +
    +./msm_s_${date}.nc to the ./msm_p_${date}.nc
    +
    +Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    +utility for data visualization and analyses.
    +
    + +

    Example 3

    + +In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, +convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf +option doesn't support appending, the netcdf conversion cannot be in a loop. + +
    +Version 1, using loops and a temporary file
    +
    +rm tempfile
    +for f in gfs.t00z.pgrb2f[01]?
    +do
    +   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    +done
    +wgrib2 tempfile -netcdf ~/myfile.nc
    +rm tempfile
    +
    +Version 2, data-flow 
    +
    +1:   cat gfs.t00z.pgrb2f[01]? | \
    +2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    +3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    +4:   wgrib2 - -netcdf ~/myfile.nc
    +
    +
    +Line 1 (cat), takes all the desired grib files and writes to stdout
    +Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    +Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    +Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    +
    +

    +See also: +-bin, +-ieee +-text +-spread + +-append +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan. 27, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/nc_time.html b/docs/web_docs/nc_time.html new file mode 100644 index 0000000..d396341 --- /dev/null +++ b/docs/web_docs/nc_time.html @@ -0,0 +1,552 @@ + + + + Climate Prediction Center - wgrib2: -netcdf + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end + +
     
    + +

    wgrib2: -netcdf

    +
    + +

    Introduction

    + +

    +The -netcdf option writes the grid values to a specified +file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator +and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic +projection grids. Other grid templates and projections are not supported yet. + +

    +Default the grid values are written as 4 bytes float having {TIME,LAT,LON} +dimension shape (3D data) and possible vertical LEV information added to the name of variables. +For example, V wind component defined at 10 m level in atmosphere will have default name +VGRD_10maboveground. +With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data +with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical +structure analysis etc. +

    +3D and 4D data could be mixed in the same netcdf file if both have the same horizontal +grid shapes. Practically any number of variables could be placed in to the single netcdf file +as well as time dimension can be almost arbitrary extended. For these purposes +please use the wgrib2 -append option. +All missing values in data are replaced by the _FillValue defined in wgrib2 as +9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. + + + +

    Simple usage

    +

    + +

    +-netcdf file_name
    +
    + +

    Example 1

    +

    + +

    +$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    +
    +The above line converts the grib2 file into a netcdf file.
    +
    +
    + +

    Sub-options for -netcdf

    + +

    +Next sub-options could help to customize created netcdf file(s). +All sub-options must preceed the -netcdf option as it is the wgrib2 rule. +More then one -netcdf option could be given on the wgrib2 command line, +please read the documentation for wgrib2. +Almost all sub-options have -no_... version that annulates previous +assignment. +For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table +with the -nc_table sub-option or combine the command line options +with instructions in the -nc_table conversion file. + +

    +The -append option makes possible to create single +large data set for long time series of gridded data. Time dimension of data in the netcdf file +is "unlimited", it could be extended "forward" when adding new data but not "backward" before +the first defined time value. If data for the same time step already exist in the updated +netcdf file these will be silently overwritten. + +

    +The -nc_nlev option is needed to export data to netcdf +as 4D data defined in {TIME,LEV,LAT,LON} space. +It must be followed by integer max_number_of_vertical_levels +which defines the vertical dimension size of 4D data exported to the netcdf file. +This value can not be found from each single grib2 message or sub-message, +usually it has to be scanned the entire grib2 file or even number of files. +It is the reason why the max_number_of_vertical_levels +value must be provided by user. +

    +Grib2 types of vertical levels eligible for export to the netcdf as 4D data +are defined in the wgrib2 internal table and now include next types of GRIB2 levels: +

    +
    +
    20:K level +
    100:pressure level +
    104:sigma level +
    105:hybrid level +
    107:K isentropic level +
    160:ocean depth below sea level +
    +
    +

    +Data for the first found eligible level type are treated as 4D and vertical level +information is not added to the variable names. +Error is generetad if data for other then first found eligible level type +are met in the input stream. +Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space +with the possible level information included into the variable names or with the user-specified names +(see -nc_table option description below for how to do it). +

    +The -nc_nlev option has not -no_... option, +please use instead the max_number_of_vertical_levels equal to 0. +In this case all data from the input stream will be threated as 3D. +

    +When existing netcdf file is updated in the -append mode +the value of max_number_of_vertical_levels must not exceed +initial value provided when the netcdf file was first created (defined). +By default when first creating the netcdf file, vertical level values are not fixed +(are undefined) and these are defined one-by-one when data at new level are added +to the netcdf file, up to the max_number_of_vertical_levels. +To overcome this feature please use the -nc_table option. + +

    +The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is +default and do not assume data packing, only data range is checked. Data outside of +specified range are replaced by missing value code for all types of packing. +This replacement is done in the local copy of unpacked data, so main data array +stays unchanged. +Values of min and max could be any +signed float. Packing is applied to all new variables in the input stream. +If some variable was already defined in the netcdf file and now is appended to it +in the -append mode the initially defined and fixed in the netcdf file +valid range and packing parameters are used. +

    +The packing is possible to the short (2 bytes) +or byte (1 byte) values with potential loss of precision. +Both zero values of min and max +packing parameters for the short or +byte packing activate 'auto' packing when +min and max +values are defined from the first entered field. + +

    +PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file +is open with 'sdfopen' command. But by some reasons using the GrADS +data description file (catalog) for the same netcdf file helps in this situation. + +

    +The -nc_grads option activates some tests for the created +netcdf file to be GrADS (version 1.9b4) compatible, +or to be open by sdfopen in gradsnc or gradsdods. +The GrADS support only COARDS convention netcdf files; +it do not support non-constant data time stepping +and silently generates wrong time stamps for such netcdf files. +Packing to byte also is not directly recognized by GrADS v1.9b4. +With this option an error is raised and processing stops +if any of criterias above is determined. + +

    +The -nc_table option followed by the file_name is most usefull for the advanced users +as it specifies the file where user can customize many features of created netcdf file. +Next examples demonstrate which directives and conversion rules could be given +in the -nc_table file. +Almost all of them are optional with exception of $nlev for the case +when user explicitly specifies the vertical level values $levs. +

    +$lev_type 100:pressure:pressure level:mb:0.01 +

    This directive explicitly defines the type of vertical level +in the grib2 file that becomes eligible for treating data at these levels as 4D data +and some it attributes for netcdf file. +Default, first found level type listed in the wgrib2 build-in table +of eligible levels is selected if no $lev_type directive found. +

    Fields here include: +

    +
    +
    100-the grib2 level type code number +for treating data as 4D. In this example it is the code number for pressure levels, integer +
    pressure- +short_name for the vertical axis in the netcdf file, string +
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces +
    mb-vertical axis units as written in the netcdf file, string +
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file +
    +
    + +$nlev X +

    This directive is an equivalent of the -nc_nlev command line option +but value in the -nc_table file has precedence over the command line option if both are found. +It is required if next $levs directive is specified. +

    + +
    $levs lev(1) lev(2) lev(3)... +
    ...lev(I-1) lev(I) lev(I+1)... +
    ...lev(X-1) lev(X) +
    +

    +This directive explicitly specifies the vertical level values to be exported +to the netcdf file, in the netcdf units. +If this directive exists in the -nc_table file and there is found the grib2 data +eligible for the 4D presentation but defined on other then listed level - +these data are skipped from export and work is silently continued. +All data conversion parameters are checked before the $levs is checked. +List of level values could consist of multiple lines; +max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); +use space, ',', ';' or ':' as lev(i) fields separator. +

    +Impact of $nlev and $levs directives is different depending on +does the netcdf file is first created or it is updated. +When the netcdf file is first created these values are written +to the netcdf file fixing 4D data vertical structure. +When updating an existing netcdf file in the -append mode +these parameters will work like filter limiting possible +updates of 4D data by these that satisfy to the given $levs only and +ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. +

    +The $nlev and $levs directives could be necessary if records +in the grib2 file have randomly changing vertical level values +that makes it impossible sequentionally define valid order of vertical levels. + +

    +$grads 1 +

    This directive is an equivalent of the -nc_grads command line option +if passed value is 1 or to the -no_nc_grads if value is 0. +Directive in the -nc_table file has precedence over the command line option. + +

    +wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] +

    +All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' +are treated as grib2 to netcdf conversion rules for the specified variables. +In these strings the wgib2_name and wgrib2_level +are strings as returned by the wgrib2 inventory; +* used as the wgrib2_level will apply +to all levels not given explicitly. +The valid range and packing information is optional but it overwrites common +packing rule if such is specified by the -nc_pack command line option. +Absence of packing information means no packing for this variable. +Min and max values are any signed float values. Both could be omitted or put to zero. +Last case means that automatic scaling will be estimated from the first entered +wgib2_name field at the wgrib2_level +or at the first level in case of * as level value. +

    +If the keyword ignore is found as a netcdf variable name or +as a packing type value, the corresponding data are ignored +and do not written to the netcdf file. +Impact from this keyword is similar to the wgrib2 -not option +or filtering data with the grep utility. +

    +The ignore keyword is recommended if the data from the same +grib2 file are exported in number of output files (netcdf or other) +by the same wgrib2 process. Then the same decoded data could be passed +for the output in other file of any supported type. +Doing export to the single netcdf file it is not recommended to use the +ignore keyword +as corresponding data are first decoded and after that skipped from writing +to the netcdf file. +

    +In the next example two lines from the -nc_table file instruct +the wgrib2 utility export to the netcdf file the geopotential height changing name +from HGT (wgrib2) to +geopotential in the netcdf file, +at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: +

    +
    +HGT:*:geopotential
    +HGT:975 mb:ignore
    +
    +
    +All other variables not listed in the -nc_table file but found in the input stream +are processed as regular 3D data. + + +

    Example 2

    +

    +Next example shows the content of user-defined -nc_table file +for one special case of Japan Meteorological Agency MSM system grib2 data conversion. +Same -nc_table file includes the rules for +conversion of both 'surface' and upper air data although +the input grib2 files are different. + +

    +
    +#
    +# File name: jma_msm_g2nc.table
    +# Description: Specifies parameters for conversion to Netcdf format
    +# hourly analyses and forecasts of JMA MSM system as best suited to
    +# my purposes: forcing of ocean model and reference data for analysis
    +# of meteorological conditions with GrADS-based visualization tools.
    +# Sergey Varlamov, July 2007
    +#
    +$lev_type  100:p:pressure level:mb:0.01
    +$nlev      16
    +$levs  1000 975 950 925 900 850 800 700 600 500
    +        400 300 250 200 150 100
    +$grads 1
    +#
    +# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    +#
    +UGRD:*:u
    +VGRD:*:v
    +#UGRD:*:u:ignore
    +#VGRD:*:v:ignore
    +TMP:*:temp
    +#write HGT at any level as hgtprs:
    +HGT:*:hgtprs
    +#but skip HGT at 100 mb, now commented - example and test
    +#HGT:100 mb:hgtprs:ignore
    +RH:*:rh:short:-2:110
    +VVEL:*:omega
    +#
    +# JMA MSM model surface data conversion rules
    +#
    +PRMSL:mean sea level:prmsl
    +PRES:surface:prsfc
    +UGRD:10 m above ground:u10m
    +VGRD:10 m above ground:v10m
    +TMP:1.5 m above ground:t2m
    +RH:1.5 m above ground:rh2m:short:-5:110
    +TCDC:surface:ncld:short:-5:110
    +LCDC:surface:ncld_low:short:-5:110
    +MCDC:surface:ncld_mid:short:-5:110
    +HCDC:surface:ncld_upper:short:-5:110
    +APCP:surface:r1h
    +# End of file
    +
    +
    +Using above file we could create the daily file with 3h analyses
    +at the 'surface' layers from the input grib2 files
    +with the next simple shell script:
    +
    +
    +date=20070715
    +for (( j=0; j<=21; j+=3 )) #hour of day loop
    +do
    +  if [ $j -lt  10 ]
    +  then
    +    h=0$j
    +  else
    +    h=$j
    +  fi
    +  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    +
    +  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    +  code=$?
    +  if [ $code -eq 0 ]
    +  then
    +    echo ${date}${h}': created/added to Netcdf'
    +  else
    +    echo ${date}${h}': wgrib2 failed...'
    +    exit $code
    +  fi
    +done
    +
    +
    +Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    +
    +gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    +
    +and change the name for the output file:
    +
    +./msm_s_${date}.nc to the ./msm_p_${date}.nc
    +
    +Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    +utility for data visualization and analyses.
    +
    + +

    Example 3

    + +In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, +convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf +option doesn't support appending, the netcdf conversion cannot be in a loop. + +
    +Version 1, using loops and a temporary file
    +
    +rm tempfile
    +for f in gfs.t00z.pgrb2f[01]?
    +do
    +   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    +done
    +wgrib2 tempfile -netcdf ~/myfile.nc
    +rm tempfile
    +
    +Version 2, data-flow 
    +
    +1:   cat gfs.t00z.pgrb2f[01]? | \
    +2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    +3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    +4:   wgrib2 - -netcdf ~/myfile.nc
    +
    +
    +Line 1 (cat), takes all the desired grib files and writes to stdout
    +Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    +Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    +Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    +
    +

    +See also: +-bin, +-ieee +-text +-spread + +-append +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan. 27, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ncep_norm.html b/docs/web_docs/ncep_norm.html new file mode 100644 index 0000000..1e12ab8 --- /dev/null +++ b/docs/web_docs/ncep_norm.html @@ -0,0 +1,303 @@ + + + + Climate Prediction Center - wgrib2: -ncep_norm + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ncep_norm +
     
    + +

    wgrib2: -ncep_norm

    +
    + + +

    Introduction

    + +

    +The GFS model, for example, produces precipitation with a +hard-to-use time step. If you gathered the precip forecasts +from the GFS, it would look like, + +

    +$ wgrib2 apcp.grb
    +1:0:d=2009042400:APCP:surface:0-3 hour acc fcst:
    +2:3340:d=2009042400:APCP:surface:0-6 hour acc fcst:
    +3:5534:d=2009042400:APCP:surface:6-9 hour acc fcst:
    +4:7239:d=2009042400:APCP:surface:6-12 hour acc fcst:
    +5:9304:d=2009042400:APCP:surface:12-15 hour acc fcst:
    +6:12378:d=2009042400:APCP:surface:12-18 hour acc fcst:
    +
    + +If you obtained the 6 hourly forecasts, everthing would be +quite useful. But if you obtained the 3 hourly forecasts, you +would notice the averaging period is either 3 or 6 hours. To +create 3-hour accumulations, you can use the +-ncep_norm option. + +
    +$ wgrib2 apcp.grb -ncep_norm new_apcp.grb
    +1:0:d=2009042400:APCP:surface:0-3 hour acc fcst:
    +2:3340:d=2009042400:APCP:surface:0-6 hour acc fcst:
    +3:5534:d=2009042400:APCP:surface:6-9 hour acc fcst:
    +4:7239:d=2009042400:APCP:surface:6-12 hour acc fcst:
    +5:9304:d=2009042400:APCP:surface:12-15 hour acc fcst:
    +6:12378:d=2009042400:APCP:surface:12-18 hour acc fcst:
    +7:14396:d=2009042400:APCP:surface:18-21 hour acc fcst:
    +$
    +$ wgrib2 new_apcp.grb
    +1:0:d=2009042400:APCP:surface:0-3 hour acc fcst:
    +2:7769:d=2009042400:APCP:surface:3-6 hour acc fcst:
    +3:13271:d=2009042400:APCP:surface:6-9 hour acc fcst:
    +4:18773:d=2009042400:APCP:surface:9-12 hour acc fcst:
    +5:24275:d=2009042400:APCP:surface:12-15 hour acc fcst:
    +6:32044:d=2009042400:APCP:surface:15-18 hour acc fcst:
    +7:38301:d=2009042400:APCP:surface:18-21 hour acc fcst:
    +
    + +

    The -ncep_norm option is not limited +to 3 hour intervals. It can be used with the CFSv2 which has +1 hour intervals. Some restrictions are: + +

      +
    1. time units of forecast time and statistical processing must be the same +
    2. only works with averages and accumulations (Code Table 4.10) +
    3. the grid must be the same +
    4. the meta-data must be the same except for the forecast timing. +
    5. Does not work for CRAIN, CSNOW, CICEP, CFRZR +
    + + +

    Usage

    +

    + +

    +-ncep_norm output_file
    +
    + +

    Conditions

    +

    +The input grib file must have a very specific format. +Each field must be grouped together in time series format. +That is because the program scans the file in sequential order. +Of course, you can alter the order by the -i +option. For example, + +

    +$ wgrib2 -match ':APCP:' mixed_up -vt | sort -t: -k3,3 | \
    +   wgrib2 -i mixed_up -ncep_norm new_apcp.grb
    +1:0:d=2009042400:APCP:surface:0-0 day acc fcst:
    +6:26940:d=2009042400:APCP:surface:0-3 hour acc fcst:
    +11:56805:d=2009042400:APCP:surface:0-6 hour acc fcst:
    +16:85235:d=2009042400:APCP:surface:6-9 hour acc fcst:
    +51:281962:d=2009042400:APCP:surface:6-12 hour acc fcst:
    +61:338477:d=2009042400:APCP:surface:12-15 hour acc fcst:
    +66:367933:d=2009042400:APCP:surface:12-18 hour acc fcst:
    +71:396448:d=2009042400:APCP:surface:18-21 hour acc fcst:
    +...
    +$ wgrib2 new_apcp.grb
    +1:0:d=2009042400:APCP:surface:0-3 hour acc fcst:
    +2:7769:d=2009042400:APCP:surface:3-6 hour acc fcst:
    +3:13271:d=2009042400:APCP:surface:6-9 hour acc fcst:
    +4:18773:d=2009042400:APCP:surface:9-12 hour acc fcst:
    +5:24275:d=2009042400:APCP:surface:12-15 hour acc fcst:
    +6:32044:d=2009042400:APCP:surface:15-18 hour acc fcst:
    +7:38301:d=2009042400:APCP:surface:18-21 hour acc fcst:
    +...
    +
    + +

    Using GFS forecast files

    +

    +The typical GFS forecast file has a name like, +

    +GFS:
    +    gfs.t(HH)z.(type).(resolution).f(fhour)
    +
    +    gfs.t06z.pgrb2b.0p25.f006
    +    gfs.t18z.pgrb2.0p25.f006
    +
    +So to get the "normalized" APCP, you can do + +
    +   $ test.sh
    +
    +where test.sh is
    +
    +#!/bin/sh
    +#
    +# example of calculating GFS APCP for custom periods
    +#  want 06-09, 09-12, 12-15, 15-24, 24-48 hours
    +#  need the 06, 09, 12, 15, 24 and 48 hour forecasts
    +#
    +# the output iis in apcp.grb
    +# the calculated APCP fields may have a small negative because of
    +# finite precision is used
    +
    +dir=/gpfs/dell1/nco/ops/com/gfs/prod/gfs.20211212/00/atmos/
    +
    +cat $dir/gfs.t00z.pgrb2.0p25.f006 $dir/gfs.t00z.pgrb2.0p25.f009 \
    +      $dir/gfs.t00z.pgrb2.0p25.f012 $dir/gfs.t00z.pgrb2.0p25.f015 \
    +      $dir/gfs.t00z.pgrb2.0p25.f024 $dir/gfs.t00z.pgrb2.0p25.f048 | \
    +wgrib2 - -match ":APCP:" -match ":0-[0-9]* [a-z]* acc fcst:" -set_grib_type c1 -ncep_norm apcp.grb
    +
    +
    +The above script uses several techniques to speed up the processing.
    +
    +"cat (list of files)"   This writes the grib files to stdout.  This avoids a temporary disk file.
    +
    +"wgrib2 -"   This reads the grib file from stdin
    +
    +"-match "(regex)"    This avoids decoding grib messages that do not match 
    +             the regular expression
    +
    + + +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Feb 20, 2018, 12/2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ncep_uv.html b/docs/web_docs/ncep_uv.html new file mode 100644 index 0000000..8ee8714 --- /dev/null +++ b/docs/web_docs/ncep_uv.html @@ -0,0 +1,205 @@ + + + + Climate Prediction Center - wgrib2: -lon + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ncep_uv +
     
    + +

    wgrib2: -ncep_uv

    +
    + + +

    Introduction

    + +

    +Operatinal NCEP grib files often have the U and corresponding V fields in the same grib message. +(U and V are submessages.) Typically wgrib2 converts all the submessages into individual messages. +In order to combine the U and V fields together, you replace the -grib option +with -ncep_uv. Options like +-grib_out and -new_grid do not have the capability +to combine the U and V fields. For theses cases, you run the output through wgrib2. + +Note that -ncep_uv is more like -grib than +-grib_out. The option +-ncep_uv uses the compressed grid point values from the original file. +Neither the grid point values nor the packing is changed. + + +

    Usage

    +

    + +

    +-ncep_uv output_file
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -match ":500 mb:" -ncep_uv output.grb
    +
    +$ wgrib2 test.grb2 -inv /dev/null -new_grid_winds earth -new_grid ncep grid 221 - | wgrib2 - -ncep_uv output.grb
    +

    +In the above example, the first wgrib2 regrids the file and writes it into stdout. +The second wgrib2 reads the new grib file from stdout and combines the U and V +records together into one message. + +

    + +See also: +-tosubmsg +-submsg +-submsg_uv +-grib +-grib_out +-GRIB +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Oct 3, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ncpu.html b/docs/web_docs/ncpu.html new file mode 100644 index 0000000..336e1dd --- /dev/null +++ b/docs/web_docs/ncpu.html @@ -0,0 +1,205 @@ + + + + Climate Prediction Center - wgrib2: -ncpu + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -ncpu +
     
    + +

    wgrib2: -ncpu

    +
    + + +

    The number of threads

    + +

    +Wgrib2 can be compiled to use multiple threads. By +default, an OpenMP-enabled version of wgrib2 will use the environement +variable OMP_NUM_THREADS to control the number of threads. +If the environment variable OMP_NUM_THREADS is not +defined, the number of threads created is usually the same as the number +of cores. The -ncpu option controls the number of threads +that will be used by wgrib2. If wgrib2 is not compiled to use OpenMP, this +option is quietly ignored. The -ncpu option overrides +the OMP_NUM_THREADS environment variable. + +

    +When you run an OpenMP-enabled wgrib2 version on a shared system, the +performance may be suboptimal if you use too many threads. For example, on one of +our linux systems, we have 32 cores. The system is shared by many users and +during a busy time, there may only be a few cores free at any one time. When +using 32 threads, there is often a thread that doesn't get much time in the beginning +and is slow to finish. + +

    +The main usage of the -ncpu option is to allocate +threads/cpus when you are running multiple copies of wgrib2. + + +

    Usage

    +

    +

    +-ncpu N
    +  N = number of threads
    +
    + +

    Example

    +
    +   $ wgrib2 IN.grb -ncpu 3 -new_grid_winds grid -new_grid ncep grid 221 - | wgrib2 - -ncpu 1 -set_grib_type j -ncep_uv OUT.grb
    +
    +

    +The above line uses 3 threads for regridding and one thread for jpeg2000 compression. The jpeg2000 +compression routines can't take advantage of more than one thread. +

    +See also: +about openmp, + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 10, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ndate.html b/docs/web_docs/ndate.html new file mode 100644 index 0000000..e035ab6 --- /dev/null +++ b/docs/web_docs/ndate.html @@ -0,0 +1,230 @@ + + + + Climate Prediction Center - wgrib2: -ndate + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ndate +
     
    + +

    wgrib2: -ndate (v2.0.8)

    +
    + + +

    Introduction

    + +

    +The NCEP utility, ndate, will add or subtract hours from a date code. +Wgrib2 already has routines to do these calculations. So instead of +porting the ndate fortran code and the NCEP libraries, how about +a simple-to-write option that would allow wgrib2 to do the same +calculation (and more)? In my case, installing wgrib2 is a probably a given. +So adding -ndate saves me time. + + +

    +The ndate utility allows you to add or subtract a integer number of hours +from a YYYYMMDDHH date code, +The -ndate option allows you to add or +subtract an integer number of minutes, hours, days, months or years from +a date code. The output format has the precision necessary for the input date code +and offset. Sure you could do all this with the gnu date program but +the -ndate option is easier to use. + +

    +The feature of the ndate utility that is not in wgrib2, is the ability +to print the current UTC date code when there is no argument. Of course, you +can do the same by "date -u +%Y%m%d%H". For users of the ndate utility, note that +the order of arguments are reversed between the utility and wgrib2 option. + +

    +The -ndate option is an odd +option because it does its output in the initialization phase. +In order to to trigger an "missing input file" error, you need +to run wgrib2 on a valid file. For linux/unix systems, using +the file /dev/null is a convenient, always present file. + +

    Usage

    +

    + +

    +-ndate DATE OFFSET
    +       DATE = YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm, YYYYMMDDHHmmss
    +       OFFSET=(integer)(yr|mo|dy|hr|mn)
    +                integer can be positive or negative
    +                yr = year  (0000..9999)
    +                mo = month (01..12)
    +                dy = day   (01..31)
    +                hr = hour  (00..23)
    +                mn = minute (not to be confused with month)  (00..59)
    +
    +      The output format has the precision to reflects the maximum precision of 
    +      the date code and the offset
    +
    +     Priority of the output format of the date code
    +   output date code: YYYYMMDDHHmmss      if input date code is YYYYMMDDHHmmss
    +   output date code: YYYYMMDDHHmm        if input date code is YYYYMMDDHHmm   or OFFSET is in minutes (mn)
    +   output date code: YYYYMMDDHH          if input date code is YYYYMMDDHH     or OFFSET is in hours (hr)
    +   output date code: YYYYMMDD            if input date code is YYYYMMDD       or OFFSET is in days (dy)
    +   output date code: YYYYMM              if input date code is YYYYMM         or OFFSET is in months (mo)
    +   output date code: YYYY                if input date code is YYYY           or OFFSET is in years (yr)
    +
    + +

    Example

    +

    + +

    +$ wgrib2 /dev/null -ndate  2016010212 -6hr
    +2016010206
    +
    + +

    +See also: -ndates +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Feb 1, 2019 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ndates.html b/docs/web_docs/ndates.html new file mode 100644 index 0000000..33c2821 --- /dev/null +++ b/docs/web_docs/ndates.html @@ -0,0 +1,389 @@ + + + + Climate Prediction Center - wgrib2: -ndates + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ndates +
     
    + +

    wgrib2: -ndates

    +
    + + +

    Introduction

    + +

    +The -ndates option creates a list of date codes +using a do-loop syntax. This option has nothing to do with grib, but +adding it to wgrib2 was trivial, and this option has been so helpful +in scripting. Anyways, if a Swiss army knife can have a +bottle opener, wgrib2 can have a date code routine. Anyways one less +program to port is helpful. + +

    Note that until wgrib2 v3.0.3, the number of date codes was limited +by the stdout buffer size. (See wgrib2 -config.) Wgrib2 v3.1.4 allows +the optional equal sign option to include the terminating date code. + +

    +The -ndate and -ndates options +are initialization routines. They are run when all the options are +initialized. Therefore they are run before reading the grib file. +The -ndates_fmt option has to preceed the +-ndates option to alter the output format. + +

    The wgrib2 command line can have multple -ndates options. + +

    +-ndates DATE DATE2 DT2     lt form
    +-ndates DATE DT1 DT2       lt form
    +-ndates DATE =DATE2 DT2    le form     wgrib2 v3.1.4
    +-ndates DATE =DT1 DT2      le form     wgrib2 v3.1.4
    +
    + DATE, DATE2 = YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm, YYYYMMDDHHmmss
    + DT1, DT2 = (integer)(unit)  unit=yr,mo,dy,hr,mn   (same as GrADS)
    +            note: DT must be positive and greater than zero
    +
    +If DT1 is given, then DATE2=DATE+DT1
    +
    +lt form:
    +    C-meta:          for (date=DATE; date < DATE2; date += DT2) print date;
    +    Fortran-meta:    date=DATE
    +  		     while (date < DATE2)
    +                        print date
    +                        date=date+DT2
    +                     endwhile
    +
    +le form:
    +    C-meta:          for (date=DATE; date<= DATE2; date += DT2) print date;
    +    Fortran-meta:    date=DATE
    +                     while (date <= DATE2)
    +                        print date
    +                        date=date+DT2
    +                     endwhile
    +
    +The only differences between the lt and le forms is the do-loop test clause.
    +
    +
    +DATE=integer of the form YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm, YYYYMMDDHHmmss
    +                note: leading zeros cannot be replaced by spaces
    +                YYYY = year (0000..9999), there were changes in the calendar (ex in 1752) which are ignored
    +                MM = month (01..12)
    +                DD = day (01..31)
    +                HH = hour (00..23)
    +                mm = minute (00..59)
    +                ss = second (00..59), there are no provisions for leap seconds
    +DT = (integer)(time unit)           "time unit" follows the GrADS convention
    +               integer > 0
    +               time unit = yr (year)
    +                           mo (month)
    +                           dy (day)
    +                           hr (hour)
    +                           mn (minute)
    +                           there is no seconds time unit defined by GrADS
    +
    + +One useful feature of -ndates is the format of the output date is +appropriate for the input date code and DT2. The format has the most precision for +both the input date code and DT2. + +
    +      Priority of the output format of the date codes (high to low)
    +   output date code: YYYYMMDDHHmmss      if input date code is YYYYMMDDHHmmss
    +   output date code: YYYYMMDDHHmm        if input date code is YYYYMMDDHHmm   or DT2 is in minutes (mn)
    +   output date code: YYYYMMDDHH          if input date code is YYYYMMDDHH     or DT2 is in hours (hr)
    +   output date code: YYYYMMDD            if input date code is YYYYMMDD       or DT2 is in days (dy)
    +   output date code: YYYYMM              if input date code is YYYYMM         or DT2 is in months (mo)
    +   output date code: YYYY                if input date code is YYYY           or DT2 is in years (yr)
    +
    + +

    Examples

    + +Suppose you want a list of days for 2003. +
    +$ wgrib2 /dev/null -ndates 2003 2004 1dy
    + 20030101 20030102 ... 20231231
    +
    + You could get the same result by
    +$ wgrib2 /dev/null -ndates 2003 1yr 1dy
    +
    +Now suppose you want the output to include the hours, then
    +
    +$ wgrib2 /dev/null -ndates 2003 2004 24hr
    + 2003010100 2003010200 ... 2023123100
    +
    + +Suppose that you want the list of day from April 2000 to December 2000 inclusive. +Then you can use the inclusive form of -ndates. + +
    +$ wgrib2 /dev/null -ndates 200004 =200012 1mo
    + 200004 ... 200012
    +
    + + + +

    Usage

    +

    + +

    +  lt form
    +-ndates DATE DATE2 DT2
    +-ndates DATE DT1 DT2
    +  le form
    +-ndates DATE =DATE2 DT2
    +-ndates DATE =DT1 DT2
    +
    +Usually wgrib2 is given the null file of "/dev/null".  For windows,
    +try using NUL.
    +
    +    DATE: YYYYMMDDHH or YYYYMMDDHHmm or YYYYMMDDHHmmss
    +    DATE2: if DT1 is given, then DATE2 = DATE + DT1
    +
    +    DT1: ending dt
    +    DT2: step dt
    +    dt: (integer)Time_unit,   integer > zero
    +    Time_unit: yr (year)
    +               mo (month)
    +               dy (day)
    +               hr (hour)
    +               mn (minute)
    +
    +    prints a list of date codes
    +
    +    C-meta:    for (date=DATE; date < DATE2; date += DT2) print date;
    +    C-meta:    for (date=DATE; date <= DATE2; date += DT2) print date;
    +
    +    the output date code has the precision necessary for DATE and DT2 and 
    +    is converted into a string.  The date is printed out using the 
    +    "ndates_fmt" format.  The default format is " %s".  (C format)
    +
    + + + +

    Example

    +
    +        print date codes for 1 month, every day
    +
    +$ wgrib2 /dev/null -ndates 2019020100 1mo 1dy
    + 2019020100 2019020200 2019020300 2019020400 2019020500 2019020600 2019020700 2019020800 
    +2019020900 2019021000 2019021100 2019021200 2019021300 2019021400 2019021500 2019021600 
    +2019021700 2019021800 2019021900 2019022000 2019022100 2019022200 2019022300 2019022400 
    +2019022500 2019022600 2019022700 2019022800
    +
    +$ wgrib2 /dev/null -ndates 201902 1mo 1dy
    + 20190201 20190202 20190203 20190204 20190205 20190206 20190207 20190208 20190209 20190210 
    +20190211 20190212 20190213 20190214 20190215 20190216 20190217 20190218 20190219 20190220 
    +20190221 20190222 20190223 20190224 20190225 20190226 20190227 20190228
    +
    +        print date codes for 1 day, every 6 hours
    +
    +$ wgrib2 /dev/null -ndates 2019020100 1dy 6hr
    + 2019020100 2019020106 2019020112 2019020118
    +
    +$ wgrib2 /dev/null -ndates 20190201 1dy 6hr
    + 2019020100 2019020106 2019020112 2019020118
    +
    +$ wgrib2 /dev/null -ndates 20190201 1dy 6hr
    +2019020100 2019020106 2019020112 2019020118
    +
    +$ wgrib2 /dev/null -ndates 2019020100 1dy 6hr
    + 201902010000 201902010600 201902011200 201902011800
    +
    +      print the months from 202001 to 202012
    +
    +$ wgrib2 /dev/null -ndates 202001 202101 1mo
    + 202001 202002 202003 202004 202005 202006 202007 202008 202009 202010 202011 202012
    +$ wgrib2 /dev/null -ndates 202001 12mo 1mo
    + 202001 202002 202003 202004 202005 202006 202007 202008 202009 202010 202011 202012
    +
    + +

    Finding the Julian date (ordinal date)

    + +The ordinal date is the year and day of the year ranging +from 1 and 366. To get the day of the year from YYYYMMDD, +you can use -ndates. + +
    +wgrib2 /dev/null -ndates {YYYY-1}1231 {YYYYMMDD} 1dy | wc -w
    +wgrib2 /dev/null -ndates {YYYY} ={YYYYMMDD} 1dy | wc -w               wgrib2 v3.1.4
    +
    + +

    Date from the Julian date (ordinal date)

    + +Using wgrib2 to convert the date code to the Julian day is easy. +
    +year YYYY
    +julian_date N
    +
    +wgrib2 /dev/null -ndate {YYYY} {N-1}dy`
    +
    + + +

    Length Limitations of wgrib2 v2.8.0-v3.0.2

    + +

    +The text output of options is stored in a stdout buffer and written +after the options are finished. This speeds up processing because only +one large write is done rather than many smaller writes and allows you +to copy the output of inv options to other files by the -last and -last0 options. +This limits the output of -ndates to 30000 bytes (wgrib2 v2.0.8) and 100,000 bytes +(wgrib2 v3.0.0). Most people can live within the limitation. However, I +wanted to process years of data with hourly resolution encountered this +limitation. With wgrib2 v3.0.3+, ndates writes it output directly +to stdin. +This has no effect on -last and -last0 because this options only works when processing a +file, and -ndates works prior to processing the file. + + +

    +See also: -ndates_fmt, +-ndate +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 1, 2019, Feb 12, 2020, March 20, 2021, June 23, 2021, july 1, 2021, Nov 2023, Mar 2024 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/ndates_fmt.html b/docs/web_docs/ndates_fmt.html new file mode 100644 index 0000000..5bab73b --- /dev/null +++ b/docs/web_docs/ndates_fmt.html @@ -0,0 +1,227 @@ + + + + Climate Prediction Center - wgrib2: -ndates_fmt + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ndates_fmt +
     
    + +

    wgrib2: -ndates_fmt (v2.0.8+)

    +
    + + +

    Introduction

    + +

    +The -ndates_fmt option changes the default format +that the -ndates prints the date codes. The default +format is written in C as " %s". (The date code is converted into a string, +and a blank and the string is printed out.) + +

    The -ndates_fmt option is an initialization option, +so it runs prior to the processing of the grib file. +The -ndates_fmt option needs to preceed the +-ndates option. + +

    +Default ndates format is " %s"
    +
    +$ wgrib2 /dev/null -ndates 201802 1dy 6hr
    + 2018020100 2018020106 2018020112 2018020118$ 
    +
    +A list of files on one line
    +
    +$ wgrib2 /dev/null -ndates_fmt " pgb%s" -ndates 201802 1dy 6hr
    + pgb2018020100 pgb2018020106 pgb2018020112 pgb2018020118$ 
    +
    +A list of files, one file per line
    +
    +$ wgrib2 /dev/null -ndates_fmt "pgb%s\n" -ndates 201802 1dy 6hr
    +pgb2018020100
    +pgb2018020106
    +pgb2018020112
    +pgb2018020118
    +$ 
    +
    +Making a script to process a list of files
    +
    +bash-4.1$ wgrib2 /dev/null -ndates_fmt "cp pgb%s ~/data\n" -ndates 201802 1dy 6hr >cmd
    +bash-4.1$ cat cmd
    +cp pgb2018020100 ~/data
    +cp pgb2018020106 ~/data
    +cp pgb2018020112 ~/data
    +cp pgb2018020118 ~/data
    +bash-4.1$ 
    +
    + +

    +The -ndates_fmt option understands three back-slash characters. +

    +   \n gets converted into a new-line character
    +   \t gets converted into tab character
    +   \\ gets converted into a back-slash character
    +
    +   Windows will be addressed later with respect to the end of line termination.
    +
    + +

    Usage

    +

    + +

    +-ndates_new C_FORMAT
    +   C_FORMAT is a C-language format which includes a %s to print
    +   the date code.  The only back slash sequences allowed are \n, \t, and \\.
    +
    + + + +See also: -ndates +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 1, 2019, March 20, 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/netcdf.html b/docs/web_docs/netcdf.html new file mode 100644 index 0000000..9569a9d --- /dev/null +++ b/docs/web_docs/netcdf.html @@ -0,0 +1,642 @@ + + + + Climate Prediction Center - wgrib2: -netcdf + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end + +
     
    + +

    wgrib2: -netcdf

    +
    + +

    Introduction

    + +

    +The -netcdf option writes the grid values to a specified +file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator +and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic +projection grids. Other grid templates and projections are not supported yet. + +

    +Default the grid values are written as 4 bytes float having {TIME,LAT,LON} +dimension shape (3D data) and possible vertical LEV information added to the name of variables. +For example, V wind component defined at 10 m level in atmosphere will have default name +VGRD_10maboveground. +With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data +with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical +structure analysis etc. +

    +3D and 4D data could be mixed in the same netcdf file if both have the same horizontal +grid shapes. Practically any number of variables could be placed in to the single netcdf file +as well as time dimension can be almost arbitrary extended. For these purposes +please use the wgrib2 -append option. +All missing values in data are replaced by the _FillValue defined in wgrib2 as +9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. + + + +

    Simple usage 1

    +

    + +

    +-netcdf file_name
    +
    + +

    Example 1

    +

    + +

    +$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    +
    +The above line converts the grib2 file into a netcdf file.
    +
    + +

    Simple usage 2

    + +
    +-set_ext_name 1 -netcdf file_name
    +
    + +

    +The first simple usage was good for simple variables like HGT (geopotential height) +and TMP (temperature). Using the grib name identifies the field. However, +some grib fields cannot be identified by the grib name. For example, + +

    +$ wgrib2 massmr.grb2 -netcdf junk_simple_name.nc
    +1:0:d=2015072700:MASSMR:64 hybrid level:12 hour fcst:aerosol=Dust Dry:aerosol_size >=2e-07,<2e-06:
    +      The grib name is MASSMR (mass mixing ratio.  If you make a netcdf file with
    +      this name, you get an ambigous netcdf field.
    +$ ncdump -h junk_simple_name.nc
    +...
    +	float MASSMR_64hybridlevel(time, latitude, longitude) ;
    +		MASSMR_64hybridlevel:_FillValue = 9.999e+20f ;
    +		MASSMR_64hybridlevel:short_name = "MASSMR_64hybridlevel" ;
    +		MASSMR_64hybridlevel:long_name = "Mass Mixing Ratio (Mass Fraction in Air)" ;
    +		MASSMR_64hybridlevel:level = "64 hybrid level" ;
    +		MASSMR_64hybridlevel:units = "kg/kg" ;
    +
    + +The netcdf file, junk_simple_name.nc, contains the mass missing ratio of some unknown substance. +For this case we need to use the extend name. + +

    Example 2

    +
    +$ wgrib2 massmr.grb2 -set_ext_name 1 -netcdf junk_ext_name.nc
    +1:0:d=2015072700:MASSMR.aerosol=Dust_Dry.aerosol_size_>=2e-07,<2e-06.:64 hybrid level:12 hour fcst:
    +$ ncdump -h junk_ext_name.nc
    +...
    +	float MASSMR_aerosol_EQ_Dust_Dry_aerosol_size_GE_2eM07_LT_2eM06_64hybridlevel(time, latitude, longitude) ;
    +		MASSMR_aerosol_EQ_Dust_Dry_aerosol_size_GE_2eM07_LT_2eM06_64hybridlevel:_FillValue = 9.999e+20f ;
    +		MASSMR_aerosol_EQ_Dust_Dry_aerosol_size_GE_2eM07_LT_2eM06_64hybridlevel:short_name = "MASSMR_aerosol_EQ_Dust_Dry_aerosol_size_GE_2eM07_LT_2eM06_64hybridlevel" ;
    +		MASSMR_aerosol_EQ_Dust_Dry_aerosol_size_GE_2eM07_LT_2eM06_64hybridlevel:long_name = "Mass Mixing Ratio (Mass Fraction in Air)" ;
    +		MASSMR_aerosol_EQ_Dust_Dry_aerosol_size_GE_2eM07_LT_2eM06_64hybridlevel:level = "64 hybrid level" ;
    +		MASSMR_aerosol_EQ_Dust_Dry_aerosol_size_GE_2eM07_LT_2eM06_64hybridlevel:units = "kg/kg" ;
    +
    + +

    Sub-options for -netcdf

    + +

    +Next sub-options could help to customize created netcdf file(s). +All sub-options must preceed the -netcdf option as it is the wgrib2 rule. +More then one -netcdf option could be given on the wgrib2 command line, +please read the documentation for wgrib2. +Almost all sub-options have -no_... version that annulates previous +assignment. +For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table +with the -nc_table sub-option or combine the command line options +with instructions in the -nc_table conversion file. + +

    +The -append option makes possible to create single +large data set for long time series of gridded data. Time dimension of data in the netcdf file +is "unlimited", it could be extended "forward" when adding new data but not "backward" before +the first defined time value. If data for the same time step already exist in the updated +netcdf file these will be silently overwritten. + +

    +The -nc_nlev option is needed to export data to netcdf +as 4D data defined in {TIME,LEV,LAT,LON} space. +It must be followed by integer max_number_of_vertical_levels +which defines the vertical dimension size of 4D data exported to the netcdf file. +This value can not be found from each single grib2 message or sub-message, +usually it has to be scanned the entire grib2 file or even number of files. +It is the reason why the max_number_of_vertical_levels +value must be provided by user. +

    +Grib2 types of vertical levels eligible for export to the netcdf as 4D data +are defined in the wgrib2 internal table and now include next types of GRIB2 levels: +

    +
    +
    20:K level +
    100:pressure level +
    104:sigma level +
    105:hybrid level +
    107:K isentropic level +
    160:ocean depth below sea level +
    +
    +

    +Data for the first found eligible level type are treated as 4D and vertical level +information is not added to the variable names. +Error is generetad if data for other then first found eligible level type +are met in the input stream. +Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space +with the possible level information included into the variable names or with the user-specified names +(see -nc_table option description below for how to do it). +

    +The -nc_nlev option has not -no_... option, +please use instead the max_number_of_vertical_levels equal to 0. +In this case all data from the input stream will be threated as 3D. +

    +When existing netcdf file is updated in the -append mode +the value of max_number_of_vertical_levels must not exceed +initial value provided when the netcdf file was first created (defined). +By default when first creating the netcdf file, vertical level values are not fixed +(are undefined) and these are defined one-by-one when data at new level are added +to the netcdf file, up to the max_number_of_vertical_levels. +To overcome this feature please use the -nc_table option. + +

    +The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is +default and do not assume data packing, only data range is checked. Data outside of +specified range are replaced by missing value code for all types of packing. +This replacement is done in the local copy of unpacked data, so main data array +stays unchanged. +Values of min and max could be any +signed float. Packing is applied to all new variables in the input stream. +If some variable was already defined in the netcdf file and now is appended to it +in the -append mode the initially defined and fixed in the netcdf file +valid range and packing parameters are used. +

    +The packing is possible to the short (2 bytes) +or byte (1 byte) values with potential loss of precision. +Both zero values of min and max +packing parameters for the short or +byte packing activate 'auto' packing when +min and max +values are defined from the first entered field. + +

    +PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file +is open with 'sdfopen' command. But by some reasons using the GrADS +data description file (catalog) for the same netcdf file helps in this situation. + +

    +The -nc_grads option activates some tests for the created +netcdf file to be GrADS (version 1.9b4) compatible, +or to be open by sdfopen in gradsnc or gradsdods. +The GrADS support only COARDS convention netcdf files; +it do not support non-constant data time stepping +and silently generates wrong time stamps for such netcdf files. +Packing to byte also is not directly recognized by GrADS v1.9b4. +With this option an error is raised and processing stops +if any of criterias above is determined. + +

    +The -nc_table option followed by the file_name is most usefull for the advanced users +as it specifies the file where user can customize many features of created netcdf file. +Next examples demonstrate which directives and conversion rules could be given +in the -nc_table file. +Almost all of them are optional with exception of $nlev for the case +when user explicitly specifies the vertical level values $levs. +

    +$lev_type 100:pressure:pressure level:mb:0.01 +

    This directive explicitly defines the type of vertical level +in the grib2 file that becomes eligible for treating data at these levels as 4D data +and some it attributes for netcdf file. +Default, first found level type listed in the wgrib2 build-in table +of eligible levels is selected if no $lev_type directive found. +

    Fields here include: +

    +
    +
    100-the grib2 level type code number +for treating data as 4D. In this example it is the code number for pressure levels, integer +
    pressure- +short_name for the vertical axis in the netcdf file, string +
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces +
    mb-vertical axis units as written in the netcdf file, string +
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file +
    +
    + +$nlev X +

    This directive is an equivalent of the -nc_nlev command line option +but value in the -nc_table file has precedence over the command line option if both are found. +It is required if next $levs directive is specified. +

    + +
    $levs lev(1) lev(2) lev(3)... +
    ...lev(I-1) lev(I) lev(I+1)... +
    ...lev(X-1) lev(X) +
    +

    +This directive explicitly specifies the vertical level values to be exported +to the netcdf file, in the netcdf units. +If this directive exists in the -nc_table file and there is found the grib2 data +eligible for the 4D presentation but defined on other then listed level - +these data are skipped from export and work is silently continued. +All data conversion parameters are checked before the $levs is checked. +List of level values could consist of multiple lines; +max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); +use space, ',', ';' or ':' as lev(i) fields separator. +

    +Impact of $nlev and $levs directives is different depending on +does the netcdf file is first created or it is updated. +When the netcdf file is first created these values are written +to the netcdf file fixing 4D data vertical structure. +When updating an existing netcdf file in the -append mode +these parameters will work like filter limiting possible +updates of 4D data by these that satisfy to the given $levs only and +ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. +

    +The $nlev and $levs directives could be necessary if records +in the grib2 file have randomly changing vertical level values +that makes it impossible sequentionally define valid order of vertical levels. + +

    +$grads 1 +

    This directive is an equivalent of the -nc_grads command line option +if passed value is 1 or to the -no_nc_grads if value is 0. +Directive in the -nc_table file has precedence over the command line option. + +

    +wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] +

    +All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' +are treated as grib2 to netcdf conversion rules for the specified variables. +In these strings the wgib2_name and wgrib2_level +are strings as returned by the wgrib2 inventory; +* used as the wgrib2_level will apply +to all levels not given explicitly. +The valid range and packing information is optional but it overwrites common +packing rule if such is specified by the -nc_pack command line option. +Absence of packing information means no packing for this variable. +Min and max values are any signed float values. Both could be omitted or put to zero. +Last case means that automatic scaling will be estimated from the first entered +wgib2_name field at the wgrib2_level +or at the first level in case of * as level value. +

    +If the keyword ignore is found as a netcdf variable name or +as a packing type value, the corresponding data are ignored +and do not written to the netcdf file. +Impact from this keyword is similar to the wgrib2 -not option +or filtering data with the grep utility. +

    +The ignore keyword is recommended if the data from the same +grib2 file are exported in number of output files (netcdf or other) +by the same wgrib2 process. Then the same decoded data could be passed +for the output in other file of any supported type. +Doing export to the single netcdf file it is not recommended to use the +ignore keyword +as corresponding data are first decoded and after that skipped from writing +to the netcdf file. +

    +In the next example two lines from the -nc_table file instruct +the wgrib2 utility export to the netcdf file the geopotential height changing name +from HGT (wgrib2) to +geopotential in the netcdf file, +at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: +

    +
    +HGT:*:geopotential
    +HGT:975 mb:ignore
    +
    +
    +All other variables not listed in the -nc_table file but found in the input stream +are processed as regular 3D data. + + +

    Example 3

    +

    +Next example shows the content of user-defined -nc_table file +for one special case of Japan Meteorological Agency MSM system grib2 data conversion. +Same -nc_table file includes the rules for +conversion of both 'surface' and upper air data although +the input grib2 files are different. + +

    +
    +#
    +# File name: jma_msm_g2nc.table
    +# Description: Specifies parameters for conversion to Netcdf format
    +# hourly analyses and forecasts of JMA MSM system as best suited to
    +# my purposes: forcing of ocean model and reference data for analysis
    +# of meteorological conditions with GrADS-based visualization tools.
    +# Sergey Varlamov, July 2007
    +#
    +$lev_type  100:p:pressure level:mb:0.01
    +$nlev      16
    +$levs  1000 975 950 925 900 850 800 700 600 500
    +        400 300 250 200 150 100
    +$grads 1
    +#
    +# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    +#
    +UGRD:*:u
    +VGRD:*:v
    +#UGRD:*:u:ignore
    +#VGRD:*:v:ignore
    +TMP:*:temp
    +#write HGT at any level as hgtprs:
    +HGT:*:hgtprs
    +#but skip HGT at 100 mb, now commented - example and test
    +#HGT:100 mb:hgtprs:ignore
    +RH:*:rh:short:-2:110
    +VVEL:*:omega
    +#
    +# JMA MSM model surface data conversion rules
    +#
    +PRMSL:mean sea level:prmsl
    +PRES:surface:prsfc
    +UGRD:10 m above ground:u10m
    +VGRD:10 m above ground:v10m
    +TMP:1.5 m above ground:t2m
    +RH:1.5 m above ground:rh2m:short:-5:110
    +TCDC:surface:ncld:short:-5:110
    +LCDC:surface:ncld_low:short:-5:110
    +MCDC:surface:ncld_mid:short:-5:110
    +HCDC:surface:ncld_upper:short:-5:110
    +APCP:surface:r1h
    +# End of file
    +
    +
    +Using above file we could create the daily file with 3h analyses
    +at the 'surface' layers from the input grib2 files
    +with the next simple shell script:
    +
    +
    +date=20070715
    +for (( j=0; j<=21; j+=3 )) #hour of day loop
    +do
    +  if [ $j -lt  10 ]
    +  then
    +    h=0$j
    +  else
    +    h=$j
    +  fi
    +  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    +
    +  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    +  code=$?
    +  if [ $code -eq 0 ]
    +  then
    +    echo ${date}${h}': created/added to Netcdf'
    +  else
    +    echo ${date}${h}': wgrib2 failed...'
    +    exit $code
    +  fi
    +done
    +
    +
    +Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    +
    +gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    +
    +and change the name for the output file:
    +
    +./msm_s_${date}.nc to the ./msm_p_${date}.nc
    +
    +Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    +utility for data visualization and analyses.
    +
    + +

    Example 4

    + +In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, +convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf +option doesn't support appending, the netcdf conversion cannot be in a loop. + +
    +Version 1, using loops and a temporary file
    +
    +rm tempfile
    +for f in gfs.t00z.pgrb2f[01]?
    +do
    +   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    +done
    +wgrib2 tempfile -netcdf ~/myfile.nc
    +rm tempfile
    +
    +Version 2, data-flow 
    +
    +1:   cat gfs.t00z.pgrb2f[01]? | \
    +2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    +3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    +4:   wgrib2 - -netcdf ~/myfile.nc
    +
    +
    +Line 1 (cat), takes all the desired grib files and writes to stdout
    +Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    +Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    +Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    +
    +

    Problem 1

    +

    +The -netcdf option uses the "verification" time (-vt) as +the time coordinate in the netcdf file. Unlike in grib, the definition of +new "time" values has to go chronologically. For example, the analysis, +6-hour forecast and then the 12-hour forecast. Allocation of new time values +in a different order will result in error messages. If your grib file +doesn't follow the order, you can sort the file by the verification time. + +

    +wgrib2 FILE.old -vt -s | sort -k3,3 -t: | wgrib2 -i FILE.old -grib FILE.new
    +wgrib2 FILE.new -netcdf FILE.nc
    +
    + +

    Problem 2

    +

    +Another problem is that netcdf-3 files are limited to 4GB in size. The +grib2 format supports compression so that conversion to uncompressed netcdf3 or +the poorly compressed netcdf4 can increase the file size dramatically. +I am sure that Western Digital, Seagate, Hitachi and Toshiba all appreciate +your support. + +

    Problem 3

    +

    +The -netcdf option is limited to "normal" wens grids. +The COARDS convention only allows lat-lon, mercator and Gaussian grids. +The rotated, thinned and staggered grids are not supported. Netcdf can support +more grids than the COARDS convention but -netcdf was written to that convention. +

    +To handle thinned Gaussian grids, you must first convert it to full Gaussian grid. +

    + $ wgrib2 IN.grb -reduced_gaussian_grid OUT.grb -1 linear
    + $ wgrib2 OUT.grib -netcdf OUT.nc
    +
    + +

    +To handle rotated lat-lon grids, you must first convert the file to a lat-lon file +using -new_grid. + +

    +To handle non-wesn lat-lon/mercator/Gaussian grids, you must first convert the file +to a wens file. You can use -new_grid. The -new_grid option may not work with +thinned or staggered grids. + + +

    +See also: +-bin, +-ieee, +-new_grid, +-text, +-reduced_gaussian_grid, +-set_ext_name, +-spread, + +-append +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 26, 2017, March 2024 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/netcdf_2_grib_ostia.html b/docs/web_docs/netcdf_2_grib_ostia.html new file mode 100644 index 0000000..e3eaaa3 --- /dev/null +++ b/docs/web_docs/netcdf_2_grib_ostia.html @@ -0,0 +1,331 @@ + + + + Climate Prediction Center netcdf vs grib2: ostia to grib2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > netcdf vs grib2: ostia sst to grib2 + +
     
    + +

    Example: converting netcdf to grib

    +
    + +

    Step 1: What is in the OSTIA NetCDF file?

    +

    +The OSTIA SST are produced the the UK MetOfice. We had the need to +convert the SST files from netcdf to grib2. This page will show +how wgrib2 (v3.0.0) was used to convert the daily files into grib2. +The grib files had the same grid point values. The new files were +8% of the netcdf file sizes. The files were not 8% smaller but 8% of +the original files. Such compressions are rare but happen +when the fields are smooth and have many undefined values like sea ice. + +

    +To start off, the file + +

    +$ ncdump -h 20191201120000-UKMO-L4_GHRSST-SSTfnd-OSTIA-GLOB-v02.0-fv02.0.nc
    +netcdf \20191201120000-UKMO-L4_GHRSST-SSTfnd-OSTIA-GLOB-v02.0-fv02.0 {
    +dimensions:
    +	time = 1 ;
    +	lat = 3600 ;
    +	lon = 7200 ;
    +
    +   the file has 1 time step, with a 3600x7200 grid
    +
    +	short analysed_sst(time, lat, lon) ;
    +		analysed_sst:long_name = "analysed sea surface temperature" ;
    +		analysed_sst:standard_name = "sea_surface_foundation_temperature" ;
    +		analysed_sst:units = "kelvin" ;
    +		analysed_sst:coordinates = "lon lat" ;
    +		analysed_sst:_FillValue = -32768s ;
    +		analysed_sst:add_offset = 273.15f ;
    +		analysed_sst:scale_factor = 0.01f ;
    +		analysed_sst:valid_min = -300s ;
    +		analysed_sst:valid_max = 4500s ;
    +		analysed_sst:source = "(not shown)"
    +		analysed_sst:comment = " OSTIA foundation SST" ;
    +
    +   the sst is in Kelvin, storted as a scaled short integer (2 bytes), to 1/100 of a degree
    +
    +	short analysis_error(time, lat, lon) ;
    +		analysis_error:long_name = "estimated error standard deviation of analysed_sst" ;
    +		analysis_error:standard_name = "sea_surface_foundation_temperature standard_error" ;
    +		analysis_error:units = "kelvin" ;
    +		analysis_error:coordinates = "lon lat" ;
    +		analysis_error:_FillValue = -32768s ;
    +		analysis_error:add_offset = 0.f ;
    +		analysis_error:scale_factor = 0.01f ;
    +		analysis_error:valid_min = 0s ;
    +		analysis_error:valid_max = 32767s ;
    +		analysis_error:comment = " OSTIA foundation SST analysis standard deviation error" ;
    +
    +   the sst error is like the sst, scaled short integer, 1/100 of adegree
    +
    +	byte sea_ice_fraction(time, lat, lon) ;
    +		sea_ice_fraction:long_name = "sea ice area fraction" ;
    +		sea_ice_fraction:standard_name = "sea_ice_area_fraction" ;
    +		sea_ice_fraction:units = "1" ;
    +		sea_ice_fraction:coordinates = "lon lat" ;
    +		sea_ice_fraction:_FillValue = -128b ;
    +		sea_ice_fraction:add_offset = 0.f ;
    +		sea_ice_fraction:scale_factor = 0.01f ;
    +		sea_ice_fraction:valid_min = 0b ;
    +		sea_ice_fraction:valid_max = 100b ;
    +		sea_ice_fraction:source = "EUMETSAT OSI-SAF" ;
    +		sea_ice_fraction:comment = " Sea ice area fraction" ;
    +
    +   the sea ice fraction is stored as a scaled byte, values to 1/100.
    +
    +	byte mask(time, lat, lon) ;
    +		mask:long_name = "land sea ice lake bit mask" ;
    +		mask:coordinates = "lon lat" ;
    +		mask:_FillValue = -128b ;
    +		mask:valid_min = 1b ;
    +		mask:valid_max = 31b ;
    +		mask:flag_masks = 1b, 2b, 4b, 8b, 16b ;
    +		mask:flag_meanings = "water land optional_lake_surface sea_ice optional_river_surface" ;
    +		mask:source = "NAVOCEANO_landmask_v1.0 EUMETSAT_OSI-SAF_icemask ARCLake_lakemask" ;
    +		mask:comment = " Land/ open ocean/ sea ice /lake mask" ;
    +
    +   the mask is stored as a byte values 0..31
    +
    +   The grid definition can be obtained by using
    +
    +$ ncdump 20191201120000-UKMO-L4_GHRSST-SSTfnd-OSTIA-GLOB-v02.0-fv02.0.nc
    +
    + +

    Step 2: Making a Template File

    +

    +To convert from netcdf to grib, we will use the -import_netcdf option +in wgrib2 (v3.0.0). The first step in using wgrib2 for conversion, is +to make a template file which the same grid definition as the netcdf +fields as well as using a suitable Product Definition Template (PDT) set to +zero. Obviously you would not want an ensemble PDT, a aerosol PDT or +any other "fancy" PDT. + +

    +# making the template file
    +wgrib2 ~/grib2/examples/gep19.aec -d 1  -set_pdt +0 -set_var HGT  -new_grid_winds earth \
    +   -new_grid latlon 180.025000:7200:0.050000 -89.975000:3600:0.05 ostia.template.tmp
    +
    +# setting grid == 0 to save space
    +wgrib2 ostia.template.tmp -rpn 0 -set_lev surface -grib_out ostia.template
    +
    + + +

    Step 3: wgrib2 script

    + +

    +To convert from netcdf to grib2, we will "wgrib2 ostia.template" and use +-import_netcdf to replace the grid point values. Then +change some metadata like the variable name, +and write out the data in grib format using -grib_out. The +translation is not automatic, and you will have to script the translation for each grid. The script +fragment to translate is, + +

     (fragment of script to convert years of SST files) 
    +    19  $wgrib2 ~/home/fv3/fixed/ostia.template \
    +    20   -import_netcdf $file  \
    +    21    "sea_ice_fraction" "0:1:0:3600:0:7200" \
    +    22    -set_var ICEC -set_scaling -2 0 -set center 254 -set_grib_type c1 -set_date $date \
    +    23    -grib_out $new_file \
    +    24   -import_netcdf $file  \
    +    25    analysed_sst "0:1:0:3600:0:7200" \
    +    26    -set_var TMP -set center 74 -set center 74 -set_date $date \
    +    27     -set_scaling -2 0 -set_grib_type c3 -grib_out $new_file \
    +    28   -import_netcdf $file  \
    +    29    mask "0:1:0:3600:0:7200" \
    +    30    -set_var MASK -set center 74 -set_date $date \
    +    31     -set_scaling -2 0 -set_grib_type c1 -grib_out $new_file \
    +    32   -import_netcdf $file \
    +    33     analysis_error "0:1:0:3600:0:7200" \
    +    34    -set_var TMP -set table_4.3 7 -set center 74 -set_date $date \
    +    35     -set_scaling -2 0 -set_grib_type c3 -grib_out $new_file
    +
    +        19:     ostia.template is a grib with the same grid as the ostia sst
    +                was created using wgrib2's -new_grid option (see step 2)
    +        20-23:  read sea_ice_fraction (netcdf name) and write as grib
    +        22:     set grib name to ICEC
    +                set to 2 digits after the decimal point
    +                set center to 254
    +                set complex packing version 1 (best)
    +        23:     write grib to $new_file
    +
    +        24-27:  read analysed_sst, write as TMP:sfc
    +        27:     set scaling to 2 digits after the decimal place
    +                set to complex packing version 3  (best)
    +
    +        28:31:  read mask (netcdf name), write out MASK
    +
    +        32:35:  read analyis_error (netcdf name), write out at TMP:sfc with type set to error
    +        34:     to signify error, table 4.3 has to have the value 7
    +
    + +

    Results: Compression

    +

    +The NetCDF4 file was 15952413 bytes (20191201120000), and after +comversion to grib2, the file was 13872380 bytes. Converting +to grib reduces the size by 13%. The grib2 compression will depend +on the the program that does the encoding and which compression +method is used. The above conversion requires wgrib2 v3.0.0+. + + + +

    +See also: +-grib_out, +-import_netcdf, +-new_grid, +-set, +-set_lev, +-set_var, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page created 1/9/2020. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/new_grib.html b/docs/web_docs/new_grib.html new file mode 100644 index 0000000..3ac9d88 --- /dev/null +++ b/docs/web_docs/new_grib.html @@ -0,0 +1,208 @@ + + + + Climate Prediction Center - wgrib2: new grib + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: new grib +
     
    + +

    wgrib2: new grib

    +
    + + +

    Introduction

    + +

    +When wgrib2 is processing a field, it has a copy of the grid point values +and grib (sub-)message in memory. There are options that allow you to +change the in-memory grid point values (ex. -rpn, -undefine). After +changing the grid point values, you can write out new grib message +using the updated in-memory grid point values using the +-grib_out option. The packing/comprression +using by -grib_out option is selected by the +-set_grib_type option. + +

    +wgrib2 also has options for modifying the meta-data of the +in-memory grib (sub-)message. Options like -set_var will set +the variable name, -set_lev will change the level, -set_date will +change the date code in the in-memory grib (sub-)message. +Once you have modified the meta-data, you can write out a new grib +message using the -grib_out or +-grib options. The former will write out the +message using the in-memory grid point values and the latter will use the +in-memory grib message and original gridded values. The former +is slower because it has to pack or compress the data. + + +

    Why

    + +

    +Making grib-1 files was a pain because you had to specify much +meta-data and had to worry about the packing. Making grib-2 +files is even more painful because there is more meta-data +to specify and more libraries are needed for packing/compression. +One way to get around the meta-data problem is to use a +template (a grib file with all the common metadata) and +use some routines to modify the variable/level/date/etc codes. +You still have to put the metadata into the template but +you should be able to reuse the template. + +

    +The approach described in the first two paragraphs is a way +to make new grib2 files using the template approach. For +example, one may want to convert a data set into grib. After +making a template, one could use the + +-import options. + + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/new_grid.html b/docs/web_docs/new_grid.html new file mode 100644 index 0000000..daefd9f --- /dev/null +++ b/docs/web_docs/new_grid.html @@ -0,0 +1,671 @@ + + + + Climate Prediction Center - wgrib2: -new_grid + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid +
     
    + +

    wgrib2: -new_grid

    +
    + + +New! +

    +Recently discovered bug in IPOLATES. To avoid the bug, all grids should have a size of greater +than 1 degree longitude. For example, delta_longitude = 0.1 degree, then number of longitude points +needs to be ≥ 11 to make grid > 1 degree. +The IPOLATES library wanted to handle the case of a global grid going from +xE to (x+360)E which is be encoded as going from xE to xE. To allow for rounding errors, +a grid from xE to yE (y-x ≤ 1) was condsidered to be a grid from xE to (360+x)E. +This causes a problem when the grids are ≤ than 1 degree in longitude. This bug will occur +occur for both the input and output grids. + + +

    Introduction

    + +

    Beginners are encouraged to read the new_grid introduction. +

    +The -new_grid option interpolates the fields to a new +grid. The default interpolation is bilinear but that can be changed using the +-new_grid_interpolation option. This option uses +scalar and vector interpolation as appropriate. Vector interpolation is needed +for interpolating zonal and meridional winds near the poles. + +

    In order for the vector +interpolation to work, the vector quantities must be in a (U,V) order. +For example: Z200, U200, V200, Z500, U500, V500 is good. If the data +are not in (U,V) order, you can either convert the file to the +right order by the -new_grid_order option. +The other method is to sort the inventory into (U,V) order, +and interpolate the file using the sorted inventory. (See +"Example: Sorting the Inventory" to use this technique.) +If the vector quanties are not in (U,V) order, the vector quantites will +not be interpolated. + +

    +The option is not part of the default configuration but it included with many distributions. +The interpolation code is written +in fortran and combining fortran and C code can require some work. (gcc/gfortran and +clang/gfortran are already handled by the makefile.) Getting the C and Fortran code to cooperate +requires some system-specific knowledge and may not be possible in all cases. Consequently +you are on your own in getting the -new_grid option installed. + +

    +Operations often has to use the -new_grid option to produce a large number +of user grids. Fortunately the interpolation can be made embarrassingly parallel. A +portable single-node solution is described in here. A +multi-node solution is possible using MPI and the wgrib2 library. + +

    Caution

    + +

    The -new_grid option works in raw scan mode, so data are not +converted to sn:we order. Conequently options that only work in sn:we order cannot +work at the same time as the -new_grid option. Any option +that uses geolocation (ex. -rpn, -lon) +is incompatible with -new_grid. + +

    Winds

    + +Before you do an interpolation, you need to define the wind directions. +Most people want the the V winds to be in the direction of the North Pole. +With a verbose wgrib2 inventory, you will seee winds(N/S). However, some +meteorologists want the V winds to go from grid point (i,j) to (i,j+1). +The corresponding wgrib2 notation is "winds(grid)". See the +-new_grid_winds option for more details. + +

    Usage

    +
    +-new_grid_winds W -new_grid A B C outfile
    +    W = earth or grid
    +        earth means that the U wind goes eastward, V goes northward
    +        grid means that U wind goes from grid (i,j) to (i+1,j)
    +          which is not eastward in a Lambert-conformal or polar stereographic grids
    +    A, B, C are the output grid description
    +    outfile is an output file.  The grib2 interpolated records are written in outfile
    +
    + + +

    Grid description format

    + +

    +The nx and ny parameters are integers such that nx*ny < 2147483648. +Angles and delta-angles are in degrees, and are rounded to micro-degrees unless +otherwise specified. Dx and Dy are in meters and are usually rounded +to the nearest mm. + +

    The interpolation library does not handle non-spherical grids. The library +also has problems with grid smaller than 1 degree in longitudinal width. It assumes +that the calculations are not precise, and the grid is global. + +

    +

    General Format

    +-new_grid A B C outfile General format + + A grid name with parameters + B X or longitude description (ex lon0:nlon:dlon) + C Y or latitude description (ex lat0:nlat:dlat) + +

    Selected NCEP Grids (not in general format)

    +-new_grid ncep grid I outfile I = 2,3,4,45,98,126-129,170,173,184,194,221,230,242,249 + (NCEP grid defintions) + t62,t126,t170,t190,t254,t382,t574,t1148,t1534 + (NCEP Gaussian grids definitions) + Want more ncep grids? Modify ncep_grids.c + + +

    Latitude-Longitude Grid

    +-new_grid latlon lon0:nlon:dlon lat0:nlat:dlat outfile lat-lon grid + lat0, lon0 = degrees of lat/lon for 1st grid point + nlon = number of longitudes + nlat = number of latitudes + dlon = grid cell size in degrees of longitude + dlat = grid cell size in degrees of latitude + + +

    Rotated Latitude-Longitude Grid (requires ip2lib_d)

    +-new_grid rot-ll:sp_lon:sp_lat:sp_rot lon0:nlon:dlon lat0:nlat:dlat outfile + rotated latitude-longitude grid + sp_lon = longitude of the South pole (for rotation) + sp_lat = latitude of the South pole (for rotation) + sp_rot = angle of rotation (degrees) + The grid is defined in the rotated coordinates. + eat0, lon0 = degrees of lat/lon for 1st grid point + nlat = number of longitudes + nlon = number of latitudes + dlon = grid cell size in degrees of longitude + dlat = grid cell size in degrees of latitude + + +

    Lambert Conic Grid

    +-new_grid lambert:lov:latin1:latin2:lad lon0:nx:dx lat0:ny:dy outfile Lambert conic conformal +-new_grid lambert:lov:latin1:latin2 lon0:nx:dx lat0:ny:dy outfile lad = latin2 +-new_grid lambert:lov:latin1 lon0:nx:dx lat0:ny:dy outfile latin2 = latini lad = latin1 + lov = longitude (degrees) where y axis is parallel to meridian + latin1 = first latitude from pole which cuts the secant cone + latin2 = second latitude from pole which cuts the secant cone + lad = latitude (degrees) where dx and dy are specified + lat0, lon0 = degrees of lat/lon for 1st grid point + nx = number of grid points in X direction + ny = number of grid points in Y direction + dx = grid cell size in meters in x direction + dy = grid cell size in meters in y direction + note: if latin2 >= 0, the north pole is on proj plane + if latin2 < 0, the south pole is on proj plane + + +

    Lambert Conic Grid with Centered Location

    +-new_grid lambertc:lov:latin1:latin2:lad lonc:nx:dx latc:ny:dy outfile Lambert conic conformal with centered position +-new_grid lambertc:lov:latin1:latin2 lonc:nx:dx latc:ny:dy outfile like lambert except lonc and latc replace lon0 and lat0 +-new_grid lambertc:lov:latin1 lonc:nx:dx latc:ny:dy outfile latc, lonc = degrees of lat/lon for center of the grid + + +

    Polar Stereographic Grid

    +-new_grid nps:lov:lad lon0:nx:dx lat0:ny:dy outfile north polar stereographic +-new_grid sps:lov:lad lon0:nx:dx lat0:ny:dy outfile south polar stereographic + lov = longitude (degrees) where y axis is parallel + to meridian + lad = latitude (degrees) where dx and dy are specified + note: grib1 uses lad = 60N (nps) or 60S (sps) + lad must be 60 (nps) or -60 (sps) (library limitation) + lat0, lon0 = degrees of lat/lon for 1st grid point + nx = number of grid points in X direction + ny = number of grid points in Y direction + dx = grid cell distance meters in x direction at lad + dy = grid cell distance meters in y direction at lad + + +

    Global Gaussian Grid

    +-new_grid gaussian lon0:nx:dlon lat0:ny outfile global Gaussian grid + lat0, lon0 = degrees of lat/lon for 1st grid point + note: lon1 = -lon0, lat1 = lat0 + (nx-1)*dlon; + nx = number of grid points in X direction + ny = number of grid points in Y direction + ny must be even + dlon = degrees of longitude between adjacent grid points + + note: wgrib2 supports regional Gaussian grids, but + the interpolation library doesn't. + +

    Mercator Grid

    +-new_grid mercator:lad lon0:nx:dx:lonn lat0:ny:dy:latn outfile mercator grid + lad = latitude (degrees) where dx and dy are specified + lat0, lon0 = degrees of lat/lon for 1st grid point + latn, lonn = degrees of lat/lon for last grid point + nx = number of grid points in X direction + ny = number of grid points in Y direction + dx = grid cell distance in meters in x direction at lad (double precision) + dy = grid cell distance in meters in y direction at lad (double precision) + + see grib2 template for the Mercator grid + + note: dx and dy are in meters unlike the grib template which is in mm (integer). + note: dx and dy depend on the radius of the earth as specified by the grib message + note: interpolation library assumes that earth will be spherical + note: the mercator grid description is over specified + User must make sure (nx,dy) is consistent with lonn + as well as (ny,dy) is consistent with latn + +lambert, nps, sps, mercator only support we:sn ordering +latlon, gaussian only support we:sn and we:ns ordering + +

    Grib (wgrib 3.0.0, ip2lib_d)

    +-new_grid grib file Y grid definition from a grib file + file=grib2 file + Y (ignored) + + note: this option is only available on wgrib2 v3.0.0+ + using ip2lib_d (IPOLATES=3) + note: default wind rotation is obtained from file + note: support for grib files is limited by ip2lib_d + +

    Location (wgrib 3.0.0, ip2lib_d)

    +-new_grid location list UUID unstructured grid + list = lon1:lat1:lon2:lat2:...:lon-n:lat-n + UUID = UUID for this grid, 0 if none + + note: wind rotation is set to earth + The locations are saved to the grib file as the first + and second grib messages. (3 decimal digits precision) + +
    + +

    +Sometimes one wants to convert grib files to a common grid. You already +have a sample grib file and you have to figure out the grid format. +For common grids, you can use the perl script +grid_defn.pl +to determine the grid format. +

    +$ grid_defn.pl small.grb2
    +latlon 0.000000:2:10.000000 20.000000:2:8$ 
    +
    +grid_defn.pl does not add a newline at the end of its output.
    +Not all grids are supported.
    +
    + + +

    Examples

    +
    +  wgrib2 IN.grb -set_grib_type same -new_grid_winds earth -new_grid latlon 100:10:1 30:20:1 OUT.grb
    +    Interpolates from IN.grb to OUT.grb
    +    Uses the same grib packing as in the input file
    +    Makes a 10x20, 1x1 degree lat-lon grid, lower left corner: 100E 30N
    +
    +
    +  wgrib2 IN.grb -set_grib_type same -new_grid_winds earth -new_grid ncep grid 221 OUT.grb
    +    Interpolates from IN.grb to OUT.grb
    +    Uses the same grib packing as in the input file
    +    Interpolates to NCEP grid 221.
    +
    +  wgrib2 IN.grb -set_grib_type same -new_grid_winds earth -new_grid `grid_defn.pl OLD.grb` OUT.grb
    +    Interpolates from IN.grb to OUT.grb
    +    Uses the same grib packing as in the input file
    +    Interpolates using the grid format of OLD.grb (1st record)
    +
    +

    Example: Sorting the Inventory

    + In this example, U and V are not in the required order. This +shows a sorting to the required order for -new_grid to work. + + wgrib2 201201.A | sed -e 's/:UGRD:/:UGRDa:/' -e 's/:VGRD:/:UGRDb:/' | \ + sort -t: -k3,3 -k5,8 -k4,4 | \ + wgrib2 201201.A -i -new_grid_winds earth -new_grid ncep grid 2 201201.A.grd2 + + The first line creates an inventory with new variable names: UGRD -> UGRDa and VGRD -> UGRDb + The second line sorts the inventory so that UGRDb follows UGRDB. + The third line regrids the file, with the order of processing controlled by the inventory. +
    + +

    Type of Interpolation

    + +The IPOLATES library (either iplib or ip2lib_d) supports a number of interpolation schemes including bilinear (default), +bicubic, neighbor and budget. (In addition, ip2lib_d will support spectral.) +The interpolation method can be selected by using the -new_grid_interpolation +option before the -new_grid option. Some of the interpolation +options need numeric parameters which are set by the +-new_grid_ipopt option. IPOPT is defined in the iplib library documentation. + +

    +You can use different interpolations for different variables. For example, a +bilinear interpolation of soil or vegetation type is meaningless. So +nearest neighbor interpolation is used instead. + +

    +    wgrib2 IN.grb -new_grid_winds earth \
    +      -new_grid_interpolation bilinear \
    +      -if ":(VGTYP|SOTYP):" -new_grid_interpolation neighbor -fi \
    +      -new_grid latlon 0:360:1 90:181:-1 OUT.grb
    +
    +   line 2: set default interpolation to bilinear
    +   line 3: if VGTYP or SOTYP then set the interpolation to nearest neighbor
    +   line 4: do the interpolation
    +
    +

    +Comments (4/2018): When you convert from a high resolution grid +to a lower resolution grid, you have to be consider changing from +the default interpolation (bilinear) to a budget interpolation. +The budget gives a better estimate of the cell average (the default +is 25 bilinear interpolations). + +

    Changing from grid-relative to Earth-relative winds and vice versa

    + +

    +Most NCEP grib files use grid-relative winds. If you want to convert to Earth-relative winds +or grid-relative winds, you can use the -new_grid option. + +

    +   To Earth relative:
    +     wgrib2 IN.grb -set_grib_type same -new_grid_winds earth -new_grid_interpolation neighbor \
    +      -new_grid `grid_defn.pl IN.grb` OUT.grb
    +
    +   To Grid relative:
    +     wgrib2 IN.grb -set_grib_type same -new_grid_winds grid -new_grid_interpolation neighbor \
    +      -new_grid `grid_defn.pl IN.grb` OUT.grb
    +
    +"-set_grib_type same" preserves the grib packing or compression
    +"-new_grid_interpolation neighbor" should be faster than the default bilinear
    +`grid_defn.pl IN.grb` returns the grid definition of the first grib message in IN.grb
    +
    + +The limitations of the above command are +
      +
    • IN.grb can only have one grid type +
    • OUT.grb will have any submessages converted into messages +
    + + +

    Changes from copygb

    + +People may want to convert from copygb and copygb2 to wgrib2's -new_grid. Some differences +to keep in mind. +
      +
    1. copygb default vectors: UGRD/VGRD +
    2. wgrib2 default vectors: depends on version of wgrib2. See new_grid_vectors. +
    3. copygb can have vectors in any order +
    4. wgrib2 must have V follow U for vectors pairs +
    5. copygb has bilinear, bicubic, nearest neighbor, budget, neighbor budget, and spectral interpolations. +
    6. wgrib2 has bilinear, bicubic, nearest neighbor, and budget interpolations. (Spectral is in development.) +
    7. wgrib2 can select the interpolation type depending on the variable (ex soil type) +
    8. copygb uses fixed Earth's radius +
    9. wgrib2 uses Earth's radius based on grib message +
    10. wgrib2 doesn't have merging, mapthreshold or map files +
    11. copygb by default, ignores the binary scaling and preserves decimal scaling +
    12. wgrib2 by default, preserves binary and decimal scaling +
    13. copygb does grib1. +
    14. copygb2 does grib2. +
    15. wgrib2 does grib2. +
    + + +

    Speed: Interpolation Weights

    + +

    The first step of the -new_grid interpolation is +to calculate the interpolation weights. (Each grid point on the new grid +is a weighted average of a small set of the old grid points.) +To save time for future interpolations, the last set of weights is saved. +Consequently interpolation is fastest when the input and output grids remain +don't change. While one can have multiple -new_grid options on +the command line, it is not recommended because the caching of the weights +wouldn't work and weights would have to be recalculated every time. + +

    Installation

    + +
    +With wgrib2 v2.0.8+, you have an option of compiling with the old iplib or
    +the new ip2lib_d library.  With the older versions of wgrib2, you are limited
    +to the old iplib or an hwrf version of that library.  It is recommended that
    +you use the newer ip2lib_d because it support latitude and longitudes to 
    +micro-degrees and the WMO definition of rotated lat-lon grids.  However,
    +the new library doesn't suport the NCEP local grids such as 32769 as used
    +by the NAM native files.
    +
    +

    With wgrib2 v2.0.8+, you set USE_IPOLATES to 3 in the makefile +for ip2lib_d. To use the old iplib, you set USE_IPOLATES to 1. If you +don't want the -new_grid options, you can set USE_IPOLATES to 0. +

    + +

    Converting from WE:SN to WE:NS Grids

    +Many of wgrib2 grib2 writing options will write the grid +in WE:SN order. This natural because geolocation is +only enabled when the internal grids are in WE:SN order. +However, some codes need the grid in WE:NS order. To +convert a grib file from WE:SN order to WE:NS order, the +simplest way is to use -new_grid. Lat0 and lon0 need +to be lat/lon of the top left corner of the grid. Dlon +will a positive number and dlat will be negative. + +

    If you want to be tricky, you can do a variation of the +"NDFD work arounds" technique. It will be faster and +more generic. + +

    Thinned Gaussian Grids to other Grids

    +Converting from a thinned Gaussian grid is a two step process +using wgrib2. First you convert from the thinned grid to full +grid using -reduced_gaussian_grid. +Then you can use -new_grid to interpolate to your desired grid. + +

    Quilting tiles - Merging files

    + +

    Yes, it has been done using -new_grid, -import_grib -rpn/merge, and +the -grib_out options. Yes, at least 3 people have done it. The best +application combined a global oceanic and various regional oceanic forecasts. +Priority was given to the model with the highest resolution. This is convenient +for the user who is on a route that covers different model domains. + +

    Limitations of the iplib library

    + +The iplib library has its limitations. +Grids types used by NCEP get supported and others don't. The library has a grib1 interface, so +new features of grib2 are not supported and the precision of the grid parameters +are limited to the grib1 values. For example, latitude and longitude +values are limited to millidegrees instead of microdegrees. Note: during +the installation of ip2, I noticed that the longitude was reduced when +reducing the range to [0,360). (longitude = amod(longitude + 3600.0, 360.0)) +For single precision numbers, this reduces the precision to about two digits after +the decimal place. + +
      +
    1. not all grid types are supported by iplib +
    2. only common grids are supported by the wgrib2 "wrapper" for iplib +
    3. latitude, longitude values are nomially in millidegrees (affects interpolation) +
    4. Single precision reals are used. The effective precision of the + longitudes is to a hunderdth of a degree. +
    5. only grib1 scan order are supported (i.e., WE:SN and WE:NS) +
    6. NDFD/Glahn scan order is not supported (i.e., WE|EW:SN) +
    7. Earth is assumed to be spherical +
    8. Lambert conformal: LatD must follow grib1 conventions +
    9. Polar Stereographic: LatD must be 60 latitude (grib1 convention) +
    10. nx, ny, npts must be ≤ 2147483647. (Grib2 standard is 4294967295.) +
    11. Spectral interpolation is not supported. +
    12. grids should be at least 1 degree by 1 degree. +
    + +

    Limitations of the ip2lib_d library

    + +As of wgrib2 v2.0.8, ip2lib_d is the default interpolation library. +Ip2lib_d is the double-precision grib2-interface IPOLATES library. The +old ip2lib will remain a compile time option. The advantages of +ip2lib_d that it supports grib2 precision (one millionth of a degree), +at rotated lat-lon grids (Grid Definition Template 3.1). + +

    The speed of the single precision iplib was originally faster than +the double precision ip2lib_d. To remove this objection from converting +to the new library, a effort was made to increase the OpenMP threading. +Consequently the run time of ip2lib_d will be similar (bilinear) to much +faster (budget) than iplib in a multiprocessor environment. + +

    Wgrib2 v3.0.0 adds an optional spectral interpolation. + +

      +
    1. supports more grids than iplib including WMO defined rotated lat-lon. +
    2. latitude, longitude values are in microdegrees (affects interpolation) +
    3. Double precision reals are used. (Wgrib2 stores is grid point values + as single precision.) +
    4. grib1 polar stereographic projection, LaD = 60N or 60S has been removed +
    5. NDFD/Glahn scan order (i.e., WE|EW:SN) may be supported in the future. +
    6. staggering will be supported unlike iplib +
    7. Some interpolations support an ellipical earth. +
    8. Lambert conformal: LatD must follow grib1 conventions +
    9. nx, ny, npts must be ≤ 2147483647. (Grib2 standard is 4294967295.) + This is a limitation of compiling using 4 byte integers. +
    10. Does not support local NCEP grid definitions such as 32769 +
    11. Spectral interpolation is limited to global fields with no undefined values. +
    12. grids should be at least 1 degree by 1 degree. +
    + +

    NDFD work arounds

    +

    *** FATAL ERROR: mk_kgds: unsupported scan mode 80 ***

    + +The new_grid option will give the following error +
    +*** FATAL ERROR: mk_kgds: unsupported scan mode 80
    +
    +when trying to regrid a field that is written in (WE|EW):SN order. +The (WE|EW):SN order means that the odd rows +are in WE order and the even rows are EW order. +The rows go from south to north. +This scan order is commonly used by NDFD in order to make newbies +brain hurt. Try writting a program to get the lat-lon of the Nth +grid point. + +

    +The (WE|EW):SN order +is not supported by the ipolates library which does the regridding for +the -new_grid option. The simplest work around is to convert +the grid to a WE:SN order. + +

      Version 0 +
    1. for data in input=WE|EW:SN scan order (wgrib2 IN -scan) +
    2. read data, change order scan order of data, change flag table 3.4, save data +
    3. wgrib2 IN.grb -rpn alt_x_scan -set table_3.4 64 -grib_out OUT.grb +
    + +
      Version 1 +
    1. Read trick 55 in wgrib2 tricks +
    +

    +A variation of the previous trick can be used to put WE:SN data to (WE|EW):SN packing. +

    +See also: +-new_grid_format, +new_grid introduction, +-new_grid_interpolation, +new_grid order, +-new_grid_winds, +-new_grid_vectors, +-lola, +-bin, +-import_bin, +-rpn, +-grib_out, +new_grid multi-core usage, + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modifications: June 17, 2019, Nov 5, 2019, Feb 14, 2020, Feb 2, 2021, June 7, 2021. Feb 2024, april 2024, July 2024 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/new_grid_format.html b/docs/web_docs/new_grid_format.html new file mode 100644 index 0000000..142bdc3 --- /dev/null +++ b/docs/web_docs/new_grid_format.html @@ -0,0 +1,253 @@ + + + + Climate Prediction Center - wgrib2: -new_grid_formatr + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid_format +
     
    + +

    wgrib2: -new_grid_format

    +
    + + +

    Introduction

    + +

    +The option -new_grid_format specifies the output format. +for the -new_grid option. +The default is grib, with options for bin and ieee. The bin format is the +machine's native single precision floating point format. The ieee format is +single precision IEEE 754 format. The bin format can have optional f77-style +header. The ieee format be in big endian or little endian with an optional f77-style +header. The formats are the same as produced by +-bin and -ieee. +Headers are specified by +-header and -no_header. +The ieee format defaults to big endian (network order) and specified by +-little_endian and -big_endian. +The f77-style header is prepends and appends a 32-bit integer of the number +of bytes in the data field. The integer is appropriate to the endian of +the data and is stored in the native 32-bit integer format. Outputing in the +ieee format is slower than in the native bin format because there is a conversion +from the native format to ieee even if the native format happens to be ieee. + +

    The output order of the fields may differ from the input order +of the fields. The problem occurs when -new_grid encounters +a vector interpolation. To do a vector interpolation, both the U and V must +be interpolated together. (Vector interpolation is needed so that the winds near the poles remain accurate.) +In order for the input order to be the same as the output order, the V field +must follow the corresponding U field. Wgrib2 allows a +sequence of "U-any number of scalar fields-V" to work with -new_grid +even though it is undocumented. To make sure the the input order is the same +as the output order, make sure V directly follows U, and also make sure you know +which fields are specified to be vector fields. (The default vectors are version specific.) + +

    The -new_grid_format option was introduced with wgrib2 v3.0.0, +for support of the python interface. It requires the IPOLATES library to be set to ip2lib_d +rather than the older iplib library. + +

    Usage

    +

    + +

    +-new_grid_format FORMAT
    +                 FORMAT = grib, the output format of -new_grid is grib2 (default)
    +                 FORMAT = bin, the output format is in native single precision format like -bin
    +                 FORMAT = ieee, the output format is in IEEE single precision like -ieee
    +
    + +

    Example

    +

    +

    +    Creates a grib output file "new.grb"
    +
    +$ wgrib2 gep19.aec -for 1:5  -new_grid_winds earth -new_grid ncep grid 3 new.grb
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +2:70707:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    +3:96843:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    +4:125750:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    +5:166391:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    +
    +
    +    Creates a binary formated output file "new.bin", the scan order is we:ns
    +    U and V are paired, so the input order is the same as the output order
    +
    +$ wgrib2 gep19.aec -for 1:5  -new_grid_format bin -new_grid_winds earth -new_grid ncep grid 3 new.bin
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +2:70707:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    +3:96843:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    +4:125750:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    +5:166391:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    +
    +    
    +   Comparing the binary and grib output files.
    +
    +$ wgrib2 new.grb  -rpn sto_0 -import_bin new.bin -rpn 'raw2:rcl_0:print_corr'
    +1:0:rpn_corr=1:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +2:130502:rpn_corr=1:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    +3:203989:rpn_corr=1:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    +4:261186:rpn_corr=1:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    +5:350963:rpn_corr=1:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    +
    +   The binary file was written in we:ns, and -import_bin does not change 
    +   the scan order.  Therefore we have to change the order we:sn by raw2.
    +   rpn_corr=1 .. new.grb == new.bin upto a grib rounding error
    +
    + +See also: +-big_endian +-bin +-header +-ieee +-little_endian +-new_gridr +-no_header +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page: Oct 2019 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/new_grid_interpolation.html b/docs/web_docs/new_grid_interpolation.html new file mode 100644 index 0000000..d0d2f71 --- /dev/null +++ b/docs/web_docs/new_grid_interpolation.html @@ -0,0 +1,241 @@ + + + + Climate Prediction Center - wgrib2: -new_grid_interpolation + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid_interpolation +
     
    + +

    wgrib2: -new_grid_interpolation

    +
    + + +

    Introduction

    + +

    +The -new_grid_interpolation option selects the type of +interpolation used by the -new_grid option. +The possible values are bilinear, bicubic, nearest neighbor, spectral, neighbor-budget and +budget. The -new_grid_interpolation option must appear before the +-new_grid option. If the -new_grid_interpolation +option is not used, the interpolation defaults to bilinear. + +

      +
    1. bilinear, interpolate linearly in X and then linearly in Y +
    2. bicubic, +
    3. nearest neighbor, value of closest source grid point in X-Y space +
    4. budget, make 5x5 grid, find the 25 bilinear values and average +
    5. neighbor-budget, make 5x5 grid, find 25 nearest neighbor values and average +
    6. spectral, convert to spectral space (user specified) and then to grid values +
    + + + +

    Some fields may require different types of interpolation such as the soil type should +be found using a nearest neighbor interpolation. (A fractional soil type is meaningless.) +It is common practice to use -if and -fi options +to control the setting of the the interpolation type as shown by the following command. + +

    +    wgrib2 IN.grb -new_grid_winds earth -new_grid_interpolation bilinear \
    +      -if ":(VGTYP|SOTYP):" -new_grid_interpolation neighbor -fi \
    +      -new_grid latlon 0:360:1 90:181:-1 OUT.grb
    +
    + +

    Budget or neighbor-budget is often used for precipitation in order to +roughly conserve global averages. The budget interpolations are slower +because the output grid cell is covered with a 5x5 grid, and interpolations +are done for each point of the 5x5 grid. So the budget interpolations do +25 times more interpolations. + +

    +Spectral interpolation is specialized interpolation scheme. A global field +is transformed into spherical harmonics (user specified truncation), and +the grid point values are determined from the spherical harmonics. This +interpolation is unlike other interpolation scheme. For example, the +nearest neighbor is based on the 1 grid point, the bilinear internpolation +is based on 4 grid points. The spectral interpolation is based on all +the grid points. So the interpolation scheme will act as noise reduction +when projected to a fewer spherical harmonics than the number of grid points. +

    +The limiting zonal wave number is specified and should not be prime as it makes +the Fast Fourier Transform into a slow +Fourier Transform. The limiting zonal wave number should be a product +of many 2s, 3s, 5s and other small primes. The limiting zonal wave number +may need to be compatible with the Fast Fourier Transform (FFT) code used. + +

    Usage

    +
    +-new_grid_interpolation X
    +    X = bilinear, bicubic, neighbor, budget, neighbor-budget, spectral-(trun)(num)
    +         spectral-*  is alpha
    +          
    +
    +        bilinear:          linear interpolation in X and then Y.
    +        neighbor:          Values from nearest grid point.
    +        budget:            Preserves large-scale means. Good for precipitation.
    +        neighbor-budget:   Preserves large-scale means. Good for precipitation.
    +        spectral:          Converts a global field into spectral harmonics
    +                           and derives values from the spectral harmonics.
    +                           trun = 't', 'T', 'r' or 'R' for triangular or rhomboidal trunction
    +                          (num) = max zonal wave number
    +                          The input has to be a global field and contain valid values for all grid points.
    +                          If undefined values are found, bilinear interpolation is used.
    +
    + +See also: -new_grid, +-new_grid_winds +-new_grid_ipopt +-if +-fi + +Updated Nov, 2022 +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 2, 2010 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/new_grid_intro.html b/docs/web_docs/new_grid_intro.html new file mode 100644 index 0000000..de345d7 --- /dev/null +++ b/docs/web_docs/new_grid_intro.html @@ -0,0 +1,436 @@ + + + + Climate Prediction Center - wgrib2: -new_grid intro + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid intro +
     
    + +

    wgrib2: -new_grid intro

    +
    + + +

    Introduction

    + +

    The wgrib2 -new_grid option can regrid grib2 files which means it can convert from one grid +to another. For example, it can change from a global 0.25 degree grid to a +one degree regional grid, or from a Lambert conformal grid to a lat-lon grid. The -new_grid +option can change winds between earth relative and grid relative. You can use -new_grid +to get point values using bilinear interpolation rather than the simple nearest neighbor +interpolation that the -lon uses. + +

    How to Interpolate

    + +

    For many packages, interpolation is simple. You give a field and the desired output +grid. Call the routine with the right arguments and the interpolation is done. No fuss and no mess. +But was there any problems? + +

    Problem 1: Integer values

    +

    Some fields have integer values such as soil type and vegetation type. Fractional +values have no meaning. For such fields, you have to change the interpolation method to +nearest neighbor or most common value. + +

    Problem 2: Vector Fields

    +

    Near the poles, the zonal and meridional winds are discontinous. Methods such as +bilinear interpolation have problems. One method is to convert the winds to vector, +interpolate the vectors, and then convert the interpolated vectors into the zonal +and meridional components. + +

    Problem 3: Global Conservation

    + +

    When changing from one global grid to another global grid, you +don't want to change the global precipitation or other global averages. +The global precipitation is one of the more difficult fields to interpolate +because of the small scale features of the precipitation. + +

    Problem 4: Extreme Values

    + +

    Some fields have physical limatations on the extreme values. For example, +the relative humidity will never be less than 0%, and will not be greater than 100% +except in cases of super-saturation which is unexpected for large-scale fields. +Some interpolation schemes can produce non-physical extreme values in regions of +large gradients. + +

    Problem 5: Ringing

    +

    +Spectral interpolation methods can producing "ringing" because of +>Gibbs phenomenon. + +

    Problem 6: Unequal Variance

    + +

    With bilinear interpolation, the new grid point values +are weighted average of the 4 surrounding grid points. Suppose +we take a simple model: + +

    +   grid_value(i) = LS + e(i)   e(i) = Gaussian random error, mean 0, variance 1
    +      grib_value are the 4 surrouding grids point from the original grid
    +
    +   new_grid_value = LS + sum(i=1..4) (a(i)*e(i))   where a(i) > 0 and sum of a(i) = 1
    +                   = LS + a * e             e = Gaussian random error, mean 0, variance 1, '
    +                                            0.5 <= a <= 1.0
    +
    + +From this simple model, we see that the variance from the LS will vary depending whether the new grid point +is in the exact middle of 4 points (a(i) = 0.25) or coincides with one of the points . This unequal variance can +show up in some calculations. + +

    Problem 7: High to Low Resolutions: What do you want?

    + +

    Suppose your forecast model has a 0.1 degree resolution and you want +to convert it into 1x1 degree grid. Each "grid cell" of the 1x1 degree +grid will have about 100 model grid points. Do you want a grid cell +average (100 model grid points), bilinear interpolation (weighted +average of 4 model grid points) or something else. The grid cell +average will give you the large-scale field appropriate to the output grid. +The bilinear interpolation will include small scales that are not +resolved by the output grid. Some users may want the grid cell average, +some users may want the exact point values. + + +

    How problems are addressed with IPOLATES and wgrib2

    + +

    Answer 1: Integer-valued fields

    + +

    +To interpolate integer-valued fields like vegetation type and soil type, you +add code fragment to wrib2 prior to interpolation; + +

    +  -new_grid_interpolation bilinear \
    +      -if ":(VGTYP|SOTYP):" -new_grid_interpolation neighbor -fi \
    +
    +  This code fragment set the interpolation type to bilinear.  For vegitation 
    +   and soil types, the interpolation is changed to nearest neighbor.
    +
    +
    +

    Answer 2: Scalar vs Vector

    + +

    Wgrib2 has a built-in list of vector fields. This list can be changed by the +the new_grid_vectors option. The vectors +fields will be interpolated using vector interpolation routines in the IPOLATES library. + + +

    Answer 3: Global Conservation

    + +

    To conserve the global mean, the interpolation needs to be changed to "budget" by + +

    +-new_grid_interpolation budget
    +
    + +This interpolation scheme figures out the size of the grid cell and divides in to +a 5x5 grid and finds the interpolated value on the 5x5 grid using bilinear interpolation. +The average of the 25 samples becomes the budget value. As you would expect, the budget +interpolation is much slower than the default bilinear interpolation. + +

    Problem 4: Extreme Values

    +

    +To avoid extreme values with non-physical values, you should avoid spectral and +bicubic interpolation methods. + + +

    Answer 5: Ringing

    +

    +Avoid spectral interpolation. + + +

    Answer 6: Unequal Variance

    + +

    Spectral interpolation uses all the input grid points to derive any +particular output grid point. Probably a spectral interpolation with some +spectral truncation will not show this unequal variance. Of course, +answers 4 and 5 suggested that you avoid spectral interpolation, while answer 8 +says the opposite. + + +

    Answer 7: High to Low Resolutions: What do you want?

    + +The answer to problem 7 is to know what you want and choose the +appropriate interpolation method. + +

    Summary: Answers 1-7

    +

    +From answers 1-7, you learn that there is no universal interpolation method. +You need to know your problem and choose the best method for that problem. + +

    + + +

    What are Earth and Grid Relative Winds

    +

    +In school, you learn that north was the direction to the North Pole which +according to Google is a small Alaskan city near Fairbanks. (Google "North +Pole location") The non-numerical weather modellers would define a V +(meridional) wind as a wind that is in the direction of the North Pole. +This definition of North which is referred to as +earth relative. + +

    +When you do numerical modelling, you think in terms of winds into the grid box. +Here you can define north to be from point (i,j) to (i,j+1). It makes life +easier when doing the calculations in the numerical model. The conversion +between earth and grid relative winds requires a rotation of the wind vector +by a location dependant angle. For the lat-lon, Mercator and Gaussian grids, +the grid and earth relative winds are the same. For the polar stereographic, +Lambert Conformal, rotated latlon grids, there is a location dependant rotation +angle. + +

    +Grib specifies whether the vectors are earth or grid relative. To transform +to earth or grid relative winds, you use the +-new_grid_winds option. + +Strangely +the grib standard doesn't specify which fields are vectors. + + +

    Specifying Earth vs Grid Relative Winds

    + +

    +It seems obvious that the default would to be regrid should write +earth relative winds. However, I work at NCEP and the default +at NCEP is to use grid relative winds. The only solution is to make +everyone specify whether the output uses earth or grid relative winds. +See. + +

    +-new_grid_winds earth
    +-new_grid_winds grid
    +
    + +

    Example

    + +The hard part of using the -new_grid option is that meridional component of +the vector must follow the zonal component of the vector. However, + +
    +$ wgrib2 test
    +1:0:d=2015101200:UGRD:1 hybrid level:anl:
    +2:414580:d=2015101200:PRMSL:mean sea level:anl:
    +3:956558:d=2015101200:UGRD:2 hybrid level:anl:
    +4:1357519:d=2015101200:VGRD:2 hybrid level:anl:
    + Note that "UGRD:1 hybrid level" is not followed  by VGRD,
    +    so it will not be interpolated.  "UGRD:2 hybrid level" is followed by VGRD 
    +    and will be interpolated.
    +$ wgrib2 test -new_grid_winds earth -new_grid latlon 0:360:1 -90:181:1 gbl
    +    0:360:1  start at 0E, 360 longitudes at 1 degree spacing
    +    -90:181:1  start at 90S, 181 latitudes at 1 degree spacing 
    +1:0:d=2015101200:UGRD:1 hybrid level:anl:
    +2:414580:d=2015101200:PRMSL:mean sea level:anl:
    +-new_grid: missing V, UGRD not interpolated
    + VGRD:1 hybrid level was not found (previous vector)
    +3:956558:d=2015101200:UGRD:2 hybrid level:anl:
    +4:1357519:d=2015101200:VGRD:2 hybrid level:anl:
    +$ wgrib2 gbl
    +1:0:d=2015101200:PRMSL:mean sea level:anl:
    +2:41287:d=2015101200:UGRD:2 hybrid level:anl:
    +3:73163:d=2015101200:VGRD:2 hybrid level:
    + As expected UGRD 1 hybrid level is not regridded
    +$ wgrib2 gbl -d 1 -grid
    +1:0:grid_template=0:winds(N/S):
    +	lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48
    +	lat -90.000000 to 90.000000 by 1.000000
    + Worked, earth relative winds = winds(N/S) 
    +
    + +

    For of the operational NCEP model grib output, the vector fields are in +the proper order. If the vector fields are not in the correct order, +the vector fields that are not in the correct order will be ignfored +unless they are put into the right order. (See +wgrib2 tricks. If you are lucky, the vector fields that are +not in the right order is something that you don't need such as +gravity wave drag or wind stresses. + +

    Simple Command to Regrid

    +
    +
    + wgrib2 IN.grb -set_grib_type PACKING -new_grid_winds earth -new_grid latlon LON0:NLON:DLON LAT0:NLAT:DLAT
    +
    +    set grib type PACKING
    +        PACKING = s simple, fast, poor compression, very large software support
    +                = c1  complex 1, large software support
    +                = c2  complex 2, large software support
    +                = c3  complex 3, large software support
    +                = j   jpeg2000, slow, very good compression, very large software support
    +                = a   aec, fast, new, small software support
    +     -new_grid_winds earth
    +               set output vectors to earth relative
    +     -new_grid 
    +         latlon = write a lat-lon grid
    +         LON0 = left longitude, 0..360
    +         NLON = number of longitude in grid
    +         DLON = spacing of longitudes (degrees), greater than zero
    +         LAT0 = northern most or southern most latitude of grid
    +         NLAT = number of latitudes
    +         DLAT = spacing of latiudes,
    +                  if LAT0 is the northern most latitude, DLAT should be negative
    +                  if LAT0 is the northern most latitude, DLAT should be positive
    +
    + +

    +This ends this introduction. For more information, see +the regular new_grid documentation, + +

    +See also: +-new_grid, +-new_grid_interpolation, +-new_grid_winds, +-new_grid_vectors, +-lola, +-bin, +-import_bin, +-rpn, +-grib_out, +new_grid multi-core usage, + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page written April 27, 2018 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/new_grid_ipopt.html b/docs/web_docs/new_grid_ipopt.html new file mode 100644 index 0000000..3f522c7 --- /dev/null +++ b/docs/web_docs/new_grid_ipopt.html @@ -0,0 +1,236 @@ + + + + Climate Prediction Center - wgrib2: -new_grid_ipopt + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid_ipipt +
     
    + +

    wgrib2: -new_grid_ipopt

    +
    + + +

    Introduction

    + +

    +The -new_grid option interpolates from one grid into another. +The -new_grid_interpolation option selects the interpolation method. +The -new_grid_ipopt option modifies the parameters used by +the interpolation method. +The -new_grid_ipopt option MUST FOLLOW +the -new_grid_interpolation option because the latter will +overwrite the IPOPT values with the default values for that interpolation method. + +

      +
    1. bilinear: ipopt is not used +
    2. bicubic: +
        +
      1. ipopt(1) = 0: straight bicubic +
      2. ipopt(1) = 1: constrained to range of 4 neighboring points +
      3. ipopt(2) = %data converage for output point, default=50% +
      +
    3. nearest neighbor: ipopt is not used +
    4. budget: ipopt is not used +
    5. spectral: (alpha) +
        +
      1. ipopt(1) = 0: triangular truncation +
      2. ipopt(1) = 1: rhomboidal truncation +
      3. ipopt(2) = N: truncation number +
      4. ipopt(2) = -1: sensible truncation number, based on grid + (default for now, will be changed) +
      +
      +    note: should specify these values by -new_grid_interpolation
      + 
      +    when ipopt(2) == -1, sensible trunction number
      +            IROMB = ipopt(1)
      +            IDRT=4 FOR GAUSSIAN GRID
      +            IDRT=0 FOR EQUALLY-SPACED GRID INCLUDING POLES
      +            IDRT=256 FOR EQUALLY-SPACED GRID EXCLUDING POLES
      +
      +            IF(IROMB.EQ.0.AND.IDRTI.EQ.4) MAXWV=(JMAXI-1)
      +            IF(IROMB.EQ.1.AND.IDRTI.EQ.4) MAXWV=(JMAXI-1)/2
      +            IF(IROMB.EQ.0.AND.IDRTI.EQ.0) MAXWV=(JMAXI-3)/2
      +            IF(IROMB.EQ.1.AND.IDRTI.EQ.0) MAXWV=(JMAXI-3)/4
      +            IF(IROMB.EQ.0.AND.IDRTI.EQ.256) MAXWV=(JMAXI-1)/2
      +            IF(IROMB.EQ.1.AND.IDRTI.EQ.256) MAXWV=(JMAXI-1)/4
      +
      +    Note: The values are appropriate for the spectral GFS Gaussian grid
      +          because the grid values were derived from the spherical harmonics.
      +          The values are not appropriate for the FV3 GFS Gaussian grid
      +          because the grid values were derived by a bilinear interpolation
      +          (mostly) from the cubed sphere grid.
      +
      +          Since NCEP is transitioning to a FV3 model, the grid point values
      +          are not the exact representation of the model fields but rather
      +          a bilinear interpolation from the cubed sphere.  So a high-wavenumber
      +          noise is being added to the grid values.  So the appropriate spectral
      +          representation will have filter applied to the spectral represenation.
      +          The math hasn't been worked out.
      +
      + +
    6. neighbor-budget: not enabled by wgrib2 +
    + + +

    Usage

    +
    +-new_grid_ipopt X
    +    X = integer or integer:integer
    +
    + +See also: -new_grid, +-new_grid_winds +-new_grid_vectors +new_grid usage +-if +-fi +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Sept 18, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/new_grid_order.html b/docs/web_docs/new_grid_order.html new file mode 100644 index 0000000..7a87db6 --- /dev/null +++ b/docs/web_docs/new_grid_order.html @@ -0,0 +1,244 @@ + + + + Climate Prediction Center - wgrib2: -new_grid_order + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid_order +
     
    + +

    wgrib2: -new_grid_order

    +
    + + +

    Introduction

    + +

    +The option -new_grid requires that the grib +file be processed in a certain order. When vector fields are encountered, +the specifications are that the U field must be followed by the corresponding V field. +(The -new_grid implementation allows any number of scalars to in between the U and +corresponding V fields.) If you do not follow the specification, some U or V +fields may not be interpolated. + +

    +Regridding grib files by the -new_grid is very common, and +a technique have been developed to speed up this task. Basically you put scalar +fields in its own grib message, and corresponding vector fields in their own grib +message (U and V are in submessages). Then you can regrid each grib message independantly. +If you have N cores, you run N copies of wgrib2 that regrids 1/N of the file. +The -new_grid_order is designed to put the data in this structure. + + +

    +The option -new_grid_order rearranges the file so that +the fields follow the specification for use by -new_grid_order. +Note that the order depends on the fields that are specified as vectors by +the -new_grid_vector option. +The output of -new_grid_order puts the U and corresponding V +grib message into the same grib message, like -submsg_uvr. +The vector fields that cannot be pair with the corrsponding U or V fields are written +to a secondary file. + + + +

    Usage

    +

    + +

    +-new_grid_order GRIB_A GRIB_B
    +                GRIB_A is a grib output file with data in order compatible with -new_grid
    +                GRIB_B is a grib output file with data that cannot be processed by -new_grid
    +                   because corresponding U or V fields were missing
    +
    + +

    Example

    +

    + +

    +$ wgrib2 gep19.badorder -new_grid_winds earth -new_grid ncep grid 3 test.grb
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +2:70707:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    +3:111348:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    +-new_grid: VGRD doesn't pair with previous vector field, field ignored
    +4:137484:d=2009060500:VGRD:250 mb:180 hour fcst:ENS=+19
    +5:182284:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    +6:211191:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    +7:254630:d=2009060500:HGT:250 mb:180 hour fcst:ENS=+19
    +8:325988:d=2009060500:TMP:250 mb:180 hour fcst:ENS=+19
    +9:351022:d=2009060500:UGRD:250 mb:180 hour fcst:ENS=+19
    +10:393024:d=2009060500:RH:250 mb:180 hour fcst:ENS=+19
    +11:424624:d=2009060500:HGT:500 mb:180 hour fcst:ENS=+19
    +-new_grid: last field UGRD was not interpolated (missing V)
    +
    +(failed, U and V are not in the proper order)
    +
    +$ wgrib2 gep19.badorder -new_grid_order - junk | \
    +   wgrib2 - -new_grid_winds earth -new_grid ncep grid 3 test.grb
    +1:3:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +2:70820:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    +3:97067:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    +4.1:126028:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    +4.2:126028:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    +5:210051:d=2009060500:HGT:250 mb:180 hour fcst:ENS=+19
    +6:281464:d=2009060500:TMP:250 mb:180 hour fcst:ENS=+19
    +7.1:306553:d=2009060500:UGRD:250 mb:180 hour fcst:ENS=+19
    +7.2:306553:d=2009060500:VGRD:250 mb:180 hour fcst:ENS=+19
    +8:393299:d=2009060500:RH:250 mb:180 hour fcst:ENS=+19
    +9:424954:d=2009060500:HGT:500 mb:180 hour fcst:ENS=+19
    +
    +(worked)
    +
    + +See also: +-new_grid +-new_grid_vectors +-submsg_uv +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page: Oct 2019 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/new_grid_usage.html b/docs/web_docs/new_grid_usage.html new file mode 100644 index 0000000..9b68503 --- /dev/null +++ b/docs/web_docs/new_grid_usage.html @@ -0,0 +1,285 @@ + + + + Climate Prediction Center - wgrib2: -new_grid usage + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid usage +
     
    + +

    wgrib2: -new_grid usage

    +
    + + +

    Introduction

    + +

    +In an operational center, the model output has to be converted +from the model grid to the various user grids. Since the needs of +the users are diverse, there are going to be many different grids. +This page will show the steps for a fast (wall clock) interpolation. + + +

    Step 1: Combine the Vector Quantities

    + +

    +There are two basic types of interpolations, scalar and vector. +Processing can be made faster by combining the vectors into +their own grib message. The following script will +use wgrib2 to put the various vectors into their own grib message. + +

    +#!/bin/sh
    +
    +vectors="UGRD:VGRD:VUCSH:VVCSH:UFLX:VFLX:UGUST:VGUST:USTM:VSTM:VDFUA:VDFVA:MAXUV:MAXVW:UOGRD:VOGRD:UICE:VICE"
    +
    +wgrib2 $1 | sed -e 's/:UGRD:/:UGRDu:/' -e 's/:VGRD:/:UGRDv:/' \
    +     -e 's/:VUCSH:/:VUCSHu:/' -e 's/:VVCSH:/:VUCSHv:/' \
    +     -e 's/:UFLX:/:UFLXu:/' -e 's/:VFLX:/:UFLXv:/' \
    +     -e 's/:UGUST:/:UGUSTu:/' -e 's/:VGUST:/:UGUSTv:/' \
    +     -e 's/:USTM:/:USTMu:/' -e 's/:VSTM:/:USTMv:/' \
    +     -e 's/:VDFUA:/:VDFUAu:/' -e 's/:VDFVA:/:VDFUAv:/' \
    +     -e 's/:MAXUW:/:MAXUWu:/' -e 's/:MAXVW:/:MAXUVv:/' \
    +     -e 's/:UOGRD:/:UOGRDu:/' -e 's/:VOGRD:/:UOGRDv:/' \
    +     -e 's/:UICE:/:UICEu:/' -e 's/:VICE:/:UICEv:/' \
    +| sort -t: -k3,3 -k5 -k4,4 | \
    +        wgrib2 -i -mem_init 0 $1 @mem:0 -new_grid_vectors "$vectors" -submsg_uv $2.tmp
    +
    + +

    +One optimization is "-mem_init 0 $1" in the last wgrib2. This option +reads the file $1 and saves into the memory file "@mem:0". Then wgrib2 processes the memory +file which is much faster than the disk file when doing random access. + + +

    Step 2a: Slow

    + +

    +A typical, one thread, interpolation will look like this, + +

    +config="-new_grid_winds earth -new_grid_interpolation bilinear -if :(VGTYP|SOTYP): -new_grid_interpolation neighbor -fi"
    +vectors="UGRD:VGRD:VUCSH:VVCSH:UFLX:VFLX:UGUST:VGUST:USTM:VSTM:VDFUA:VDFVA:MAXUV:MAXVW:UOGRD:VOGRD:UICE:VICE"
    +grid="latlon 0:360:1 -90:181:1"
    +
    +wgrib2 $2.tmp $config -new_grid_vectors "$vectors" -new_grid $grid $2
    +
    + +

    Step 2b: Faster, Non-operational

    + +

    +Step 1 puts the vector quantities into their own grib message. After Step 1, you can interpolate +all the grib messages independently. This embarrassingy parallel job can be run using the wgrib2mv. +Wgrib2mv is an easy-to-use perl script that runs N copies of wgrib2 and combines the results. Converting +the above wgrib2 script into a parallel command is easy. + +

    +config="-new_grid_winds earth -new_grid_interpolation bilinear -if :(VGTYP|SOTYP): -new_grid_interpolation neighbor -fi "
    +vectors="UGRD:VGRD:VUCSH:VVCSH:UFLX:VFLX:UGUST:VGUST:USTM:VSTM:VDFUA:VDFVA:MAXUV:MAXVW:UOGRD:VOGRD:UICE:VICE"
    +grid="latlon 0:360:1 -90:181:1"
    +
    +wgrib2mv 2 $2.tmp $config -new_grid_vectors "$vectors" -new_grid $grid $2
    +
    + +The only difference between the two script fragments is that "wgrib2" is replaced by "wgrib2mv N". +(N is 2 for this example.) +By using wgrib2mv, you are breaking the interpolation into 2 pieces. Each wgrib2 does 50% of the +interpolations and the program "gmerge" combines the output from the 2 copies of wgrib2. +Wgrib2mv does trivial parallelism and is limited by the number of cores on the node, the speed of +the pipes and I/O speed. + +

    Step 2c: Faster, Operational

    + +

    +Step 2b works on my linux box, why isn't it ready for operations? The perl script, wgrib2mv, +creates temporary files on /tmp which aren't allowed in NCEP operational jobs. Some HPC +machines require you to run the executables on a compute node. For example, the cray machines +require you to use "aprun". Finally the output of wgrib2mv has all the vector quantities +in their own grib message. This unusual configuration will have to be changed for +operations. + +

    The first part is to modify the script from "wgrib2mv 2" to "wgrib2mv -2". (2 is used +in my example.) Now wgrib2mv will write a script fragment, + +

    +export OMP_NUM_THREADS=1
    +mkfifo /tmp/11938.pipe.1.1 /tmp/11938.pipe.1.1.b
    +wgrib2 -inv /dev/null /tmp/11938.pipe.1.1 -new_grid_vectors "UGRD:VGRD:VUCSH:VVCSH:UFLX:VFLX:UGUST:VGUST:
    + USTM:VSTM:VDFUA:VDFVA:MAXUV:MAXVW:UOGRD:VOGRD:UICE:VICE" -submsg_uv /tmp/11938.pipe.1.1.b &
    +mkfifo /tmp/11938.pipe.2.1 /tmp/11938.pipe.2.1.b
    +wgrib2 -inv /dev/null /tmp/11938.pipe.2.1 -new_grid_vectors "UGRD:VGRD:VUCSH:VVCSH:UFLX:VFLX:UGUST:VGUST:
    + USTM:VSTM:VDFUA:VDFVA:MAXUV:MAXVW:UOGRD:VOGRD:UICE:VICE" -submsg_uv /tmp/11938.pipe.2.1.b &
    +gmerge junk.mv  /tmp/11938.pipe.1.1.b /tmp/11938.pipe.2.1.b &
    +wgrib2 -for 1::2 -new_grid_vectors "UGRD:VGRD:VUCSH:VVCSH:UFLX:VFLX:UGUST:VGUST:USTM:VSTM:VDFUA:VDFVA:
    + MAXUV:MAXVW:UOGRD:VOGRD:UICE:VICE" "junk.tmp" "-new_grid_winds" "earth" "-new_grid_interpolation"
    + "bilinear" "-if" ":(VGTYP|SOTYP):" "-new_grid_interpolation" "neighbor" "-fi" "-new_grid" "latlon" "0:360:1" 
    + "-90:181:1" /tmp/11938.pipe.1.1 &
    +wgrib2 -for 2::2 -new_grid_vectors "UGRD:VGRD:VUCSH:VVCSH:UFLX:VFLX:UGUST:VGUST:USTM:VSTM:VDFUA:VDFVA:
    + MAXUV:MAXVW:UOGRD:VOGRD:UICE:VICE" "junk.tmp" "-new_grid_winds" "earth" "-new_grid_interpolation"
    + "bilinear" "-if" ":(VGTYP|SOTYP):" "-new_grid_interpolation" "neighbor" "-fi" "-new_grid" "latlon" "0:360:1" 
    + "-90:181:1" /tmp/11938.pipe.2.1 &
    +wait
    +rm  /tmp/11938.pipe.1.1 /tmp/11938.pipe.1.1.b /tmp/11938.pipe.2.1 /tmp/11938.pipe.2.1.b
    +
    +

    +The number 11938 is the PID (process ID) that ran the wgrib2mv script. The PID was +used to create a unique filename for the various pipes. However, on a multi-node +machine, the PID is no longer a unique value and a different scheme will have to +be used to create unique filenames. + +

    The script fragment should be considered a starting point to writing +a job that will run in operations. On a cray HPC, you will have to translate +the various "(wgrib2/gmerge) ... &" in to a single aprun command. + +

    +See also: -mem_final, + wgrib2mv + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: June 17, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/new_grid_v2.html b/docs/web_docs/new_grid_v2.html new file mode 100644 index 0000000..773d161 --- /dev/null +++ b/docs/web_docs/new_grid_v2.html @@ -0,0 +1,187 @@ + + + + Climate Prediction Center - wgrib2: -new_grid v2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid v2 +
     
    + +

    wgrib2: -new_grid v2

    +
    + + +

    Introduction

    + +

    +Wgrib2 has been using the interpolation library iplib (IPOLATES) in the -new_grid +option. The problem with this library is that it passes angles in millidegrees, does computations +in single precision and is purely spherical. The big problem is not the millidegree limitation +but the single precision limitation as the accuracy is limited to centidegrees in some computations. +With todays models. The next version of this library is called ip2lib and passes angles in microdegrees. +This library only supports a spherical earth. + +

    +Wgrib2 v2.0.8 introduces the compile time option to test -new_grid +with the ip2lib. Unfortunately there isn't the possibilitiy of linking both iplib and ip2lib +because of naming conflicts. So for testing purposes, you should build one version using iplib +and a second using ip2lib. + +

    Differences

    +

    +The first difference is that ip2lib is compiled using double precision math, so the angles +are more precise. The second difference is that WMO-defined rotated lat-lon grids are supported. +The third difference is the code is slower, perhaps 20% slower. + +

    +See also: +-new_grid, + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page written April 27, 2018 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/new_grid_vectors.html b/docs/web_docs/new_grid_vectors.html new file mode 100644 index 0000000..75581f2 --- /dev/null +++ b/docs/web_docs/new_grid_vectors.html @@ -0,0 +1,201 @@ + + + + Climate Prediction Center - wgrib2: -new_grid_vectors + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid_vectors +
     
    + +

    wgrib2: -new_grid_vectors

    +
    + + +

    Introduction

    + +

    +The -new_grid_winds option selects the wind rotation/orientation +for the -new_grid option. This orientation should apply to all +vector quantities. However, the grib format doesn't have a flag specifying which fields +are vector fields. Sometimes you like to treat vector quanties as scalars because it +makes interpolation easier (for example a time series of tropical U fields). Another +complication is that one often wants to duplicate the default action of copygb +which is to only treat U and V as vectors. + + +

    +The -new_grid_vectors option allows you to select which fields +will be interpolated as vectors. The options are, +

      +
    1. none              -all fields are interpolated as scalars +
    2. UGRD:VGRD  -only UGRD and VGRD are interpolated as vectors (like default copygbfault behavior) +
    3. default (2.0.1 and prior)     UGRD,VGRD,UVCSH,VVCSH,UFLX,VFLX,UGUST, +VGUST,USTM,VSTM,VDFUA,VDFVA,UOGRD,VOGRD are interpolated as vectors +
    4. default (2.0.2)         UGRD,VGRD,UVCSH,VVCSH,UFLX,VFLX,UGUST, +VGUST,USTM,VSTM,VDFUA,VDFVA,UOGRD,VOGRD,MAXUW,MAXVW are interpolated as vectors +
    5. default (2.0.3-2.0.6)         UGRD,VGRD,UVCSH,VVCSH,UFLX,VFLX,UGUST, +VGUST,USTM,VSTM,VDFUA,VDFVA,UOGRD,VOGRD,MAXUW,MAXVW,UICE,VICE,U-GWD,V-GWD +are interpolated as vectors +
    6. default (2.0.7+)         UGRD,VGRD,UVCSH,VVCSH,UFLX,VFLX,UGUST, +VGUST,USTM,VSTM,VDFUA,VDFVA,UOGRD,VOGRD,MAXUW,MAXVW,UICE,VICE,U-GWD,V-GWD,USSD,VSSD +are interpolated as vectors +
    + + +

    Usage

    +
    +-new_grid_vectors X
    +    X = none, default, UGRD:VGRD, UV list
    +    example UV list:   "UGRD:VGRD:UICE:VICE"
    +
    + +See also: -new_grid, +-new_grid_interpolation +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: June 23,2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/new_grid_winds.html b/docs/web_docs/new_grid_winds.html new file mode 100644 index 0000000..2056e7f --- /dev/null +++ b/docs/web_docs/new_grid_winds.html @@ -0,0 +1,202 @@ + + + + Climate Prediction Center - wgrib2: -new_grid_winds + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid_winds +
     
    + +

    wgrib2: -new_grid_winds

    +
    + + +

    Introduction

    + +

    +The -new_grid_winds option selects the wind rotation/orientation +for the -new_grid option. Most users will want the winds +to be oriented to the earth's north and south directions. This is done by using the +-new_grid_winds earth option. Many of NCEP grids have the +winds being rotated so that north direction is relative to the grid; i.e., +grid point (i,j) to (i,j+1). For lat-lon, Mercator and Gaussian grids, the grid +and earth relative directions are the same. For the Lambert conformal, polar +stereographic and various rotated grids, the directions are different. +

    +To make the interpolated wind fields have a earth (grid) orientation, you have +to use the -new_grid_winds earth or to use the +-new_grid_winds grid option before doing the interpolation. +The exception is the "-new_grid grib". In this case, the grid definition and default +wind rotation is read from a grib file. In this case, a -new_grid_winds option +will override the wind rotation read from the file. + + +

    +The wind orientation applies to all the identified vector fields: +"UGRD", "VGRD", "VUCSH", "VVCSH","UFLX", "VFLX", "UGUST","VGUST","USTM","VSTM","VDFUA", "VDFVA", + "UOGRD","VOGRD". + + + +

    +In the future, the wind orientation will be a part of the -new_grid option. +However, the current systax will still work. + + +

    Usage

    +
    +-new_grid_winds X
    +    X = earth, grid
    +
    + +See also: -new_grid, +-new_grid_vectors +-new_grid_interpolation +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: June 17, 2019 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/nl.html b/docs/web_docs/nl.html new file mode 100644 index 0000000..8b2ed3e --- /dev/null +++ b/docs/web_docs/nl.html @@ -0,0 +1,189 @@ + + + + Climate Prediction Center - wgrib2: -nl + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-nl +
     
    + +

    wgrib2: -nl

    +
    + + +

    Introduction

    + +

    +The -nl option prints a new-line +into the inventory. It is used to make the inventory prettier. +

    + +

    Usage

    + +

    +

    +-nl
    +
    + +

    Example

    +
    +$ wgrib2 -gdt png.grb2 -s
    +1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev
    +$ wgrib2 -gdt png.grb2 -s -stats
    +1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev:ndata=65160:undef=0:mean=6.24625:min=0:max=29.3:cos_wt_mean=6.01318
    +$ wgrib2 -gdt png.grb2 -s -nl -stats
    +1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev:
    +:ndata=65160:undef=0:mean=6.24625:min=0:max=29.3:cos_wt_mean=6.01318
    +
    + + +See also: +-print +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 30, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/nl_out.html b/docs/web_docs/nl_out.html new file mode 100644 index 0000000..8b2ed3e --- /dev/null +++ b/docs/web_docs/nl_out.html @@ -0,0 +1,189 @@ + + + + Climate Prediction Center - wgrib2: -nl + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-nl +
     
    + +

    wgrib2: -nl

    +
    + + +

    Introduction

    + +

    +The -nl option prints a new-line +into the inventory. It is used to make the inventory prettier. +

    + +

    Usage

    + +

    +

    +-nl
    +
    + +

    Example

    +
    +$ wgrib2 -gdt png.grb2 -s
    +1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev
    +$ wgrib2 -gdt png.grb2 -s -stats
    +1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev:ndata=65160:undef=0:mean=6.24625:min=0:max=29.3:cos_wt_mean=6.01318
    +$ wgrib2 -gdt png.grb2 -s -nl -stats
    +1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev:
    +:ndata=65160:undef=0:mean=6.24625:min=0:max=29.3:cos_wt_mean=6.01318
    +
    + + +See also: +-print +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 30, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/nlons.html b/docs/web_docs/nlons.html new file mode 100644 index 0000000..05241ed --- /dev/null +++ b/docs/web_docs/nlons.html @@ -0,0 +1,214 @@ + + + + Climate Prediction Center - wgrib2: -nlons + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-nlons +
     
    + +

    wgrib2: -nlons

    +
    + + +

    Introduction

    + +

    +The -nlons option prints the number +of grid points for each row of the grid. This +is necessary for a thinned grid where the number of +grid points per row decreases as you approach the poles. +

    + +

    Usage

    + +

    +

    +-nlons
    +
    + +

    Example

    +
    +png.grib is on a 360x181 grid
    +
    +$ wgrib2 -grid png.grb2
    +1:4:grid_template=0:winds(N/S):
    +	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output WE:SN res 48
    +	lat 90.000000 to -90.000000 by 1.000000
    +
    +$ wgrib2 -nlons png.grb2
    +1:4:nlon (S/N)=360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360
    +
    +Each row has 360 grid points.
    +
    +reduced_gaussian_surface_jpeg.grib2 is on a Gaussian thinned (reduced) grid.
    +
    +$ wgrib2 reduced_gaussian_surface_jpeg.grib2 -grid
    +bash-4.1$ wgrib2 reduced_gaussian_surface_jpeg.grib2 -grid
    +1:0:grid_template=40:winds(N/S):
    +	thinned global Gaussian grid: (-1 x 64) units 1e-06 input WE:NS output raw
    +:: NX = -1 because the number of grid points varies by latitude
    +	number of latitudes between pole-equator=32 #points=6114
    +	lat 87.864000 to -87.864000
    +	lon 0.000000 to 357.188000 by -2147.483647
    +	#grid points by latitude: 20 27 36 40 45 50 60 64 72 75 80 90 90
    +	 96 100 108 108 120 120 120 128 128 128 128 128 128 128 128 128 128 128 128 128
    +	 128 128 128 128 128 128 128 128 128 128 128 120 120 120 108 108 100 96 90 90
    +	 80 75 72 64 60 50 45 40 36 27 20
    +:: number of grid points varies from 20 to 128.
    +
    +$ wgrib2 reduced_gaussian_surface_jpeg.grib2 -nlons
    +1:0:nlon (S/N)=20 27 36 40 45 50 60 64 72 75 80 90 90 96 100 108 108 120 120 120 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 120 120 120 108 108 100 96 90 90 80 75 72 64 60 50 45 40 36 27 20
    +
    + +See also: +-grid +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 30, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/no_append.html b/docs/web_docs/no_append.html new file mode 100644 index 0000000..0dfb2fd --- /dev/null +++ b/docs/web_docs/no_append.html @@ -0,0 +1,188 @@ + + + + Climate Prediction Center - wgrib2: -append, -no_append + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-append +
     
    + +

    wgrib2: -append, -no_append

    +
    + + +

    Introduction

    + +

    +The -append and -no_append options +sets/clears the append flag. The out options are +expected to respect this flag when opening output files. So an -append option +before writing (-text, -bin, etc) should append to a currently existing file. +The -no_append directs the file to be created before use which is the default. + +

    +$ wgrib2 grb2 -d 1 -append -text all.txt -no_append -text rec.txt
    +
    + +The above line will append record #1 to all.txt and write record #1 to new file rec.txt + +

    Usage

    +

    + +

    +-append
    +      append to output files
    +
    +-no_append
    +      over-write the output files
    +
    + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/no_flush.html b/docs/web_docs/no_flush.html new file mode 100644 index 0000000..76feef7 --- /dev/null +++ b/docs/web_docs/no_flush.html @@ -0,0 +1,182 @@ + + + + Climate Prediction Center - wgrib2: -flush -no_flush + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-flush +
     
    + +

    wgrib2: -no_flush

    +
    + + +

    Introduction

    + +

    +The -no_flush option causes wgrib2 to flush +the output buffers when the buffers are full or the program ends. +This is the opposite of the The -flush option. + +

    The only practical use of this option would be in a non-POSIX +system where the flush mode is turned on, you are not using output +pipes, and you wanted to speed up the output. For this option +to be effective, the option has to be the last option that +uses a file. (Opening a file can update the flush mode.) + +

    Usage

    +

    + +

    +-no_flush
    +  should the last option
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/no_header.html b/docs/web_docs/no_header.html new file mode 100644 index 0000000..157c944 --- /dev/null +++ b/docs/web_docs/no_header.html @@ -0,0 +1,198 @@ + + + + Climate Prediction Center - wgrib2: -header + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-header/no_header +
     
    + +

    wgrib2: -header, -no_header

    +
    + + +

    Introduction

    + +

    +The -header and +-no_header options +sets and clears the header flag. When the +header flag is set, binary and ieee is read and written +using f77-style header and trailers. +When a text file (as opposed to spread sheet or csv) is written, +a preliminary line with the grid dimension, "nx ny", +is written. The default is -header. + + +

    Usage

    +

    + +

    +-header
    +-no_header
    +
    + +

    Example

    +

    + +

    +$ wgrib2 -ens ens.grb -header -ieee data.ieee
    +1:0:HGT:ENS=+1
    +
    + +See also: +-no_header, +-big_endian, +-little_endian, +-ieee, +-bin, +-import_ieee, +-import_bin +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/no_nc_grads.html b/docs/web_docs/no_nc_grads.html new file mode 100644 index 0000000..d396341 --- /dev/null +++ b/docs/web_docs/no_nc_grads.html @@ -0,0 +1,552 @@ + + + + Climate Prediction Center - wgrib2: -netcdf + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end + +
     
    + +

    wgrib2: -netcdf

    +
    + +

    Introduction

    + +

    +The -netcdf option writes the grid values to a specified +file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator +and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic +projection grids. Other grid templates and projections are not supported yet. + +

    +Default the grid values are written as 4 bytes float having {TIME,LAT,LON} +dimension shape (3D data) and possible vertical LEV information added to the name of variables. +For example, V wind component defined at 10 m level in atmosphere will have default name +VGRD_10maboveground. +With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data +with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical +structure analysis etc. +

    +3D and 4D data could be mixed in the same netcdf file if both have the same horizontal +grid shapes. Practically any number of variables could be placed in to the single netcdf file +as well as time dimension can be almost arbitrary extended. For these purposes +please use the wgrib2 -append option. +All missing values in data are replaced by the _FillValue defined in wgrib2 as +9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. + + + +

    Simple usage

    +

    + +

    +-netcdf file_name
    +
    + +

    Example 1

    +

    + +

    +$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    +
    +The above line converts the grib2 file into a netcdf file.
    +
    +
    + +

    Sub-options for -netcdf

    + +

    +Next sub-options could help to customize created netcdf file(s). +All sub-options must preceed the -netcdf option as it is the wgrib2 rule. +More then one -netcdf option could be given on the wgrib2 command line, +please read the documentation for wgrib2. +Almost all sub-options have -no_... version that annulates previous +assignment. +For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table +with the -nc_table sub-option or combine the command line options +with instructions in the -nc_table conversion file. + +

    +The -append option makes possible to create single +large data set for long time series of gridded data. Time dimension of data in the netcdf file +is "unlimited", it could be extended "forward" when adding new data but not "backward" before +the first defined time value. If data for the same time step already exist in the updated +netcdf file these will be silently overwritten. + +

    +The -nc_nlev option is needed to export data to netcdf +as 4D data defined in {TIME,LEV,LAT,LON} space. +It must be followed by integer max_number_of_vertical_levels +which defines the vertical dimension size of 4D data exported to the netcdf file. +This value can not be found from each single grib2 message or sub-message, +usually it has to be scanned the entire grib2 file or even number of files. +It is the reason why the max_number_of_vertical_levels +value must be provided by user. +

    +Grib2 types of vertical levels eligible for export to the netcdf as 4D data +are defined in the wgrib2 internal table and now include next types of GRIB2 levels: +

    +
    +
    20:K level +
    100:pressure level +
    104:sigma level +
    105:hybrid level +
    107:K isentropic level +
    160:ocean depth below sea level +
    +
    +

    +Data for the first found eligible level type are treated as 4D and vertical level +information is not added to the variable names. +Error is generetad if data for other then first found eligible level type +are met in the input stream. +Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space +with the possible level information included into the variable names or with the user-specified names +(see -nc_table option description below for how to do it). +

    +The -nc_nlev option has not -no_... option, +please use instead the max_number_of_vertical_levels equal to 0. +In this case all data from the input stream will be threated as 3D. +

    +When existing netcdf file is updated in the -append mode +the value of max_number_of_vertical_levels must not exceed +initial value provided when the netcdf file was first created (defined). +By default when first creating the netcdf file, vertical level values are not fixed +(are undefined) and these are defined one-by-one when data at new level are added +to the netcdf file, up to the max_number_of_vertical_levels. +To overcome this feature please use the -nc_table option. + +

    +The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is +default and do not assume data packing, only data range is checked. Data outside of +specified range are replaced by missing value code for all types of packing. +This replacement is done in the local copy of unpacked data, so main data array +stays unchanged. +Values of min and max could be any +signed float. Packing is applied to all new variables in the input stream. +If some variable was already defined in the netcdf file and now is appended to it +in the -append mode the initially defined and fixed in the netcdf file +valid range and packing parameters are used. +

    +The packing is possible to the short (2 bytes) +or byte (1 byte) values with potential loss of precision. +Both zero values of min and max +packing parameters for the short or +byte packing activate 'auto' packing when +min and max +values are defined from the first entered field. + +

    +PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file +is open with 'sdfopen' command. But by some reasons using the GrADS +data description file (catalog) for the same netcdf file helps in this situation. + +

    +The -nc_grads option activates some tests for the created +netcdf file to be GrADS (version 1.9b4) compatible, +or to be open by sdfopen in gradsnc or gradsdods. +The GrADS support only COARDS convention netcdf files; +it do not support non-constant data time stepping +and silently generates wrong time stamps for such netcdf files. +Packing to byte also is not directly recognized by GrADS v1.9b4. +With this option an error is raised and processing stops +if any of criterias above is determined. + +

    +The -nc_table option followed by the file_name is most usefull for the advanced users +as it specifies the file where user can customize many features of created netcdf file. +Next examples demonstrate which directives and conversion rules could be given +in the -nc_table file. +Almost all of them are optional with exception of $nlev for the case +when user explicitly specifies the vertical level values $levs. +

    +$lev_type 100:pressure:pressure level:mb:0.01 +

    This directive explicitly defines the type of vertical level +in the grib2 file that becomes eligible for treating data at these levels as 4D data +and some it attributes for netcdf file. +Default, first found level type listed in the wgrib2 build-in table +of eligible levels is selected if no $lev_type directive found. +

    Fields here include: +

    +
    +
    100-the grib2 level type code number +for treating data as 4D. In this example it is the code number for pressure levels, integer +
    pressure- +short_name for the vertical axis in the netcdf file, string +
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces +
    mb-vertical axis units as written in the netcdf file, string +
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file +
    +
    + +$nlev X +

    This directive is an equivalent of the -nc_nlev command line option +but value in the -nc_table file has precedence over the command line option if both are found. +It is required if next $levs directive is specified. +

    + +
    $levs lev(1) lev(2) lev(3)... +
    ...lev(I-1) lev(I) lev(I+1)... +
    ...lev(X-1) lev(X) +
    +

    +This directive explicitly specifies the vertical level values to be exported +to the netcdf file, in the netcdf units. +If this directive exists in the -nc_table file and there is found the grib2 data +eligible for the 4D presentation but defined on other then listed level - +these data are skipped from export and work is silently continued. +All data conversion parameters are checked before the $levs is checked. +List of level values could consist of multiple lines; +max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); +use space, ',', ';' or ':' as lev(i) fields separator. +

    +Impact of $nlev and $levs directives is different depending on +does the netcdf file is first created or it is updated. +When the netcdf file is first created these values are written +to the netcdf file fixing 4D data vertical structure. +When updating an existing netcdf file in the -append mode +these parameters will work like filter limiting possible +updates of 4D data by these that satisfy to the given $levs only and +ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. +

    +The $nlev and $levs directives could be necessary if records +in the grib2 file have randomly changing vertical level values +that makes it impossible sequentionally define valid order of vertical levels. + +

    +$grads 1 +

    This directive is an equivalent of the -nc_grads command line option +if passed value is 1 or to the -no_nc_grads if value is 0. +Directive in the -nc_table file has precedence over the command line option. + +

    +wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] +

    +All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' +are treated as grib2 to netcdf conversion rules for the specified variables. +In these strings the wgib2_name and wgrib2_level +are strings as returned by the wgrib2 inventory; +* used as the wgrib2_level will apply +to all levels not given explicitly. +The valid range and packing information is optional but it overwrites common +packing rule if such is specified by the -nc_pack command line option. +Absence of packing information means no packing for this variable. +Min and max values are any signed float values. Both could be omitted or put to zero. +Last case means that automatic scaling will be estimated from the first entered +wgib2_name field at the wgrib2_level +or at the first level in case of * as level value. +

    +If the keyword ignore is found as a netcdf variable name or +as a packing type value, the corresponding data are ignored +and do not written to the netcdf file. +Impact from this keyword is similar to the wgrib2 -not option +or filtering data with the grep utility. +

    +The ignore keyword is recommended if the data from the same +grib2 file are exported in number of output files (netcdf or other) +by the same wgrib2 process. Then the same decoded data could be passed +for the output in other file of any supported type. +Doing export to the single netcdf file it is not recommended to use the +ignore keyword +as corresponding data are first decoded and after that skipped from writing +to the netcdf file. +

    +In the next example two lines from the -nc_table file instruct +the wgrib2 utility export to the netcdf file the geopotential height changing name +from HGT (wgrib2) to +geopotential in the netcdf file, +at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: +

    +
    +HGT:*:geopotential
    +HGT:975 mb:ignore
    +
    +
    +All other variables not listed in the -nc_table file but found in the input stream +are processed as regular 3D data. + + +

    Example 2

    +

    +Next example shows the content of user-defined -nc_table file +for one special case of Japan Meteorological Agency MSM system grib2 data conversion. +Same -nc_table file includes the rules for +conversion of both 'surface' and upper air data although +the input grib2 files are different. + +

    +
    +#
    +# File name: jma_msm_g2nc.table
    +# Description: Specifies parameters for conversion to Netcdf format
    +# hourly analyses and forecasts of JMA MSM system as best suited to
    +# my purposes: forcing of ocean model and reference data for analysis
    +# of meteorological conditions with GrADS-based visualization tools.
    +# Sergey Varlamov, July 2007
    +#
    +$lev_type  100:p:pressure level:mb:0.01
    +$nlev      16
    +$levs  1000 975 950 925 900 850 800 700 600 500
    +        400 300 250 200 150 100
    +$grads 1
    +#
    +# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    +#
    +UGRD:*:u
    +VGRD:*:v
    +#UGRD:*:u:ignore
    +#VGRD:*:v:ignore
    +TMP:*:temp
    +#write HGT at any level as hgtprs:
    +HGT:*:hgtprs
    +#but skip HGT at 100 mb, now commented - example and test
    +#HGT:100 mb:hgtprs:ignore
    +RH:*:rh:short:-2:110
    +VVEL:*:omega
    +#
    +# JMA MSM model surface data conversion rules
    +#
    +PRMSL:mean sea level:prmsl
    +PRES:surface:prsfc
    +UGRD:10 m above ground:u10m
    +VGRD:10 m above ground:v10m
    +TMP:1.5 m above ground:t2m
    +RH:1.5 m above ground:rh2m:short:-5:110
    +TCDC:surface:ncld:short:-5:110
    +LCDC:surface:ncld_low:short:-5:110
    +MCDC:surface:ncld_mid:short:-5:110
    +HCDC:surface:ncld_upper:short:-5:110
    +APCP:surface:r1h
    +# End of file
    +
    +
    +Using above file we could create the daily file with 3h analyses
    +at the 'surface' layers from the input grib2 files
    +with the next simple shell script:
    +
    +
    +date=20070715
    +for (( j=0; j<=21; j+=3 )) #hour of day loop
    +do
    +  if [ $j -lt  10 ]
    +  then
    +    h=0$j
    +  else
    +    h=$j
    +  fi
    +  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    +
    +  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    +  code=$?
    +  if [ $code -eq 0 ]
    +  then
    +    echo ${date}${h}': created/added to Netcdf'
    +  else
    +    echo ${date}${h}': wgrib2 failed...'
    +    exit $code
    +  fi
    +done
    +
    +
    +Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    +
    +gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    +
    +and change the name for the output file:
    +
    +./msm_s_${date}.nc to the ./msm_p_${date}.nc
    +
    +Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    +utility for data visualization and analyses.
    +
    + +

    Example 3

    + +In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, +convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf +option doesn't support appending, the netcdf conversion cannot be in a loop. + +
    +Version 1, using loops and a temporary file
    +
    +rm tempfile
    +for f in gfs.t00z.pgrb2f[01]?
    +do
    +   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    +done
    +wgrib2 tempfile -netcdf ~/myfile.nc
    +rm tempfile
    +
    +Version 2, data-flow 
    +
    +1:   cat gfs.t00z.pgrb2f[01]? | \
    +2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    +3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    +4:   wgrib2 - -netcdf ~/myfile.nc
    +
    +
    +Line 1 (cat), takes all the desired grib files and writes to stdout
    +Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    +Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    +Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    +
    +

    +See also: +-bin, +-ieee +-text +-spread + +-append +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan. 27, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/no_nc_pack.html b/docs/web_docs/no_nc_pack.html new file mode 100644 index 0000000..d396341 --- /dev/null +++ b/docs/web_docs/no_nc_pack.html @@ -0,0 +1,552 @@ + + + + Climate Prediction Center - wgrib2: -netcdf + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end + +
     
    + +

    wgrib2: -netcdf

    +
    + +

    Introduction

    + +

    +The -netcdf option writes the grid values to a specified +file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator +and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic +projection grids. Other grid templates and projections are not supported yet. + +

    +Default the grid values are written as 4 bytes float having {TIME,LAT,LON} +dimension shape (3D data) and possible vertical LEV information added to the name of variables. +For example, V wind component defined at 10 m level in atmosphere will have default name +VGRD_10maboveground. +With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data +with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical +structure analysis etc. +

    +3D and 4D data could be mixed in the same netcdf file if both have the same horizontal +grid shapes. Practically any number of variables could be placed in to the single netcdf file +as well as time dimension can be almost arbitrary extended. For these purposes +please use the wgrib2 -append option. +All missing values in data are replaced by the _FillValue defined in wgrib2 as +9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. + + + +

    Simple usage

    +

    + +

    +-netcdf file_name
    +
    + +

    Example 1

    +

    + +

    +$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    +
    +The above line converts the grib2 file into a netcdf file.
    +
    +
    + +

    Sub-options for -netcdf

    + +

    +Next sub-options could help to customize created netcdf file(s). +All sub-options must preceed the -netcdf option as it is the wgrib2 rule. +More then one -netcdf option could be given on the wgrib2 command line, +please read the documentation for wgrib2. +Almost all sub-options have -no_... version that annulates previous +assignment. +For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table +with the -nc_table sub-option or combine the command line options +with instructions in the -nc_table conversion file. + +

    +The -append option makes possible to create single +large data set for long time series of gridded data. Time dimension of data in the netcdf file +is "unlimited", it could be extended "forward" when adding new data but not "backward" before +the first defined time value. If data for the same time step already exist in the updated +netcdf file these will be silently overwritten. + +

    +The -nc_nlev option is needed to export data to netcdf +as 4D data defined in {TIME,LEV,LAT,LON} space. +It must be followed by integer max_number_of_vertical_levels +which defines the vertical dimension size of 4D data exported to the netcdf file. +This value can not be found from each single grib2 message or sub-message, +usually it has to be scanned the entire grib2 file or even number of files. +It is the reason why the max_number_of_vertical_levels +value must be provided by user. +

    +Grib2 types of vertical levels eligible for export to the netcdf as 4D data +are defined in the wgrib2 internal table and now include next types of GRIB2 levels: +

    +
    +
    20:K level +
    100:pressure level +
    104:sigma level +
    105:hybrid level +
    107:K isentropic level +
    160:ocean depth below sea level +
    +
    +

    +Data for the first found eligible level type are treated as 4D and vertical level +information is not added to the variable names. +Error is generetad if data for other then first found eligible level type +are met in the input stream. +Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space +with the possible level information included into the variable names or with the user-specified names +(see -nc_table option description below for how to do it). +

    +The -nc_nlev option has not -no_... option, +please use instead the max_number_of_vertical_levels equal to 0. +In this case all data from the input stream will be threated as 3D. +

    +When existing netcdf file is updated in the -append mode +the value of max_number_of_vertical_levels must not exceed +initial value provided when the netcdf file was first created (defined). +By default when first creating the netcdf file, vertical level values are not fixed +(are undefined) and these are defined one-by-one when data at new level are added +to the netcdf file, up to the max_number_of_vertical_levels. +To overcome this feature please use the -nc_table option. + +

    +The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is +default and do not assume data packing, only data range is checked. Data outside of +specified range are replaced by missing value code for all types of packing. +This replacement is done in the local copy of unpacked data, so main data array +stays unchanged. +Values of min and max could be any +signed float. Packing is applied to all new variables in the input stream. +If some variable was already defined in the netcdf file and now is appended to it +in the -append mode the initially defined and fixed in the netcdf file +valid range and packing parameters are used. +

    +The packing is possible to the short (2 bytes) +or byte (1 byte) values with potential loss of precision. +Both zero values of min and max +packing parameters for the short or +byte packing activate 'auto' packing when +min and max +values are defined from the first entered field. + +

    +PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file +is open with 'sdfopen' command. But by some reasons using the GrADS +data description file (catalog) for the same netcdf file helps in this situation. + +

    +The -nc_grads option activates some tests for the created +netcdf file to be GrADS (version 1.9b4) compatible, +or to be open by sdfopen in gradsnc or gradsdods. +The GrADS support only COARDS convention netcdf files; +it do not support non-constant data time stepping +and silently generates wrong time stamps for such netcdf files. +Packing to byte also is not directly recognized by GrADS v1.9b4. +With this option an error is raised and processing stops +if any of criterias above is determined. + +

    +The -nc_table option followed by the file_name is most usefull for the advanced users +as it specifies the file where user can customize many features of created netcdf file. +Next examples demonstrate which directives and conversion rules could be given +in the -nc_table file. +Almost all of them are optional with exception of $nlev for the case +when user explicitly specifies the vertical level values $levs. +

    +$lev_type 100:pressure:pressure level:mb:0.01 +

    This directive explicitly defines the type of vertical level +in the grib2 file that becomes eligible for treating data at these levels as 4D data +and some it attributes for netcdf file. +Default, first found level type listed in the wgrib2 build-in table +of eligible levels is selected if no $lev_type directive found. +

    Fields here include: +

    +
    +
    100-the grib2 level type code number +for treating data as 4D. In this example it is the code number for pressure levels, integer +
    pressure- +short_name for the vertical axis in the netcdf file, string +
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces +
    mb-vertical axis units as written in the netcdf file, string +
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file +
    +
    + +$nlev X +

    This directive is an equivalent of the -nc_nlev command line option +but value in the -nc_table file has precedence over the command line option if both are found. +It is required if next $levs directive is specified. +

    + +
    $levs lev(1) lev(2) lev(3)... +
    ...lev(I-1) lev(I) lev(I+1)... +
    ...lev(X-1) lev(X) +
    +

    +This directive explicitly specifies the vertical level values to be exported +to the netcdf file, in the netcdf units. +If this directive exists in the -nc_table file and there is found the grib2 data +eligible for the 4D presentation but defined on other then listed level - +these data are skipped from export and work is silently continued. +All data conversion parameters are checked before the $levs is checked. +List of level values could consist of multiple lines; +max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); +use space, ',', ';' or ':' as lev(i) fields separator. +

    +Impact of $nlev and $levs directives is different depending on +does the netcdf file is first created or it is updated. +When the netcdf file is first created these values are written +to the netcdf file fixing 4D data vertical structure. +When updating an existing netcdf file in the -append mode +these parameters will work like filter limiting possible +updates of 4D data by these that satisfy to the given $levs only and +ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. +

    +The $nlev and $levs directives could be necessary if records +in the grib2 file have randomly changing vertical level values +that makes it impossible sequentionally define valid order of vertical levels. + +

    +$grads 1 +

    This directive is an equivalent of the -nc_grads command line option +if passed value is 1 or to the -no_nc_grads if value is 0. +Directive in the -nc_table file has precedence over the command line option. + +

    +wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] +

    +All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' +are treated as grib2 to netcdf conversion rules for the specified variables. +In these strings the wgib2_name and wgrib2_level +are strings as returned by the wgrib2 inventory; +* used as the wgrib2_level will apply +to all levels not given explicitly. +The valid range and packing information is optional but it overwrites common +packing rule if such is specified by the -nc_pack command line option. +Absence of packing information means no packing for this variable. +Min and max values are any signed float values. Both could be omitted or put to zero. +Last case means that automatic scaling will be estimated from the first entered +wgib2_name field at the wgrib2_level +or at the first level in case of * as level value. +

    +If the keyword ignore is found as a netcdf variable name or +as a packing type value, the corresponding data are ignored +and do not written to the netcdf file. +Impact from this keyword is similar to the wgrib2 -not option +or filtering data with the grep utility. +

    +The ignore keyword is recommended if the data from the same +grib2 file are exported in number of output files (netcdf or other) +by the same wgrib2 process. Then the same decoded data could be passed +for the output in other file of any supported type. +Doing export to the single netcdf file it is not recommended to use the +ignore keyword +as corresponding data are first decoded and after that skipped from writing +to the netcdf file. +

    +In the next example two lines from the -nc_table file instruct +the wgrib2 utility export to the netcdf file the geopotential height changing name +from HGT (wgrib2) to +geopotential in the netcdf file, +at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: +

    +
    +HGT:*:geopotential
    +HGT:975 mb:ignore
    +
    +
    +All other variables not listed in the -nc_table file but found in the input stream +are processed as regular 3D data. + + +

    Example 2

    +

    +Next example shows the content of user-defined -nc_table file +for one special case of Japan Meteorological Agency MSM system grib2 data conversion. +Same -nc_table file includes the rules for +conversion of both 'surface' and upper air data although +the input grib2 files are different. + +

    +
    +#
    +# File name: jma_msm_g2nc.table
    +# Description: Specifies parameters for conversion to Netcdf format
    +# hourly analyses and forecasts of JMA MSM system as best suited to
    +# my purposes: forcing of ocean model and reference data for analysis
    +# of meteorological conditions with GrADS-based visualization tools.
    +# Sergey Varlamov, July 2007
    +#
    +$lev_type  100:p:pressure level:mb:0.01
    +$nlev      16
    +$levs  1000 975 950 925 900 850 800 700 600 500
    +        400 300 250 200 150 100
    +$grads 1
    +#
    +# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    +#
    +UGRD:*:u
    +VGRD:*:v
    +#UGRD:*:u:ignore
    +#VGRD:*:v:ignore
    +TMP:*:temp
    +#write HGT at any level as hgtprs:
    +HGT:*:hgtprs
    +#but skip HGT at 100 mb, now commented - example and test
    +#HGT:100 mb:hgtprs:ignore
    +RH:*:rh:short:-2:110
    +VVEL:*:omega
    +#
    +# JMA MSM model surface data conversion rules
    +#
    +PRMSL:mean sea level:prmsl
    +PRES:surface:prsfc
    +UGRD:10 m above ground:u10m
    +VGRD:10 m above ground:v10m
    +TMP:1.5 m above ground:t2m
    +RH:1.5 m above ground:rh2m:short:-5:110
    +TCDC:surface:ncld:short:-5:110
    +LCDC:surface:ncld_low:short:-5:110
    +MCDC:surface:ncld_mid:short:-5:110
    +HCDC:surface:ncld_upper:short:-5:110
    +APCP:surface:r1h
    +# End of file
    +
    +
    +Using above file we could create the daily file with 3h analyses
    +at the 'surface' layers from the input grib2 files
    +with the next simple shell script:
    +
    +
    +date=20070715
    +for (( j=0; j<=21; j+=3 )) #hour of day loop
    +do
    +  if [ $j -lt  10 ]
    +  then
    +    h=0$j
    +  else
    +    h=$j
    +  fi
    +  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    +
    +  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    +  code=$?
    +  if [ $code -eq 0 ]
    +  then
    +    echo ${date}${h}': created/added to Netcdf'
    +  else
    +    echo ${date}${h}': wgrib2 failed...'
    +    exit $code
    +  fi
    +done
    +
    +
    +Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    +
    +gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    +
    +and change the name for the output file:
    +
    +./msm_s_${date}.nc to the ./msm_p_${date}.nc
    +
    +Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    +utility for data visualization and analyses.
    +
    + +

    Example 3

    + +In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, +convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf +option doesn't support appending, the netcdf conversion cannot be in a loop. + +
    +Version 1, using loops and a temporary file
    +
    +rm tempfile
    +for f in gfs.t00z.pgrb2f[01]?
    +do
    +   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    +done
    +wgrib2 tempfile -netcdf ~/myfile.nc
    +rm tempfile
    +
    +Version 2, data-flow 
    +
    +1:   cat gfs.t00z.pgrb2f[01]? | \
    +2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    +3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    +4:   wgrib2 - -netcdf ~/myfile.nc
    +
    +
    +Line 1 (cat), takes all the desired grib files and writes to stdout
    +Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    +Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    +Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    +
    +

    +See also: +-bin, +-ieee +-text +-spread + +-append +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan. 27, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/no_nc_table.html b/docs/web_docs/no_nc_table.html new file mode 100644 index 0000000..d396341 --- /dev/null +++ b/docs/web_docs/no_nc_table.html @@ -0,0 +1,552 @@ + + + + Climate Prediction Center - wgrib2: -netcdf + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end + +
     
    + +

    wgrib2: -netcdf

    +
    + +

    Introduction

    + +

    +The -netcdf option writes the grid values to a specified +file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator +and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic +projection grids. Other grid templates and projections are not supported yet. + +

    +Default the grid values are written as 4 bytes float having {TIME,LAT,LON} +dimension shape (3D data) and possible vertical LEV information added to the name of variables. +For example, V wind component defined at 10 m level in atmosphere will have default name +VGRD_10maboveground. +With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data +with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical +structure analysis etc. +

    +3D and 4D data could be mixed in the same netcdf file if both have the same horizontal +grid shapes. Practically any number of variables could be placed in to the single netcdf file +as well as time dimension can be almost arbitrary extended. For these purposes +please use the wgrib2 -append option. +All missing values in data are replaced by the _FillValue defined in wgrib2 as +9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. + + + +

    Simple usage

    +

    + +

    +-netcdf file_name
    +
    + +

    Example 1

    +

    + +

    +$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    +
    +The above line converts the grib2 file into a netcdf file.
    +
    +
    + +

    Sub-options for -netcdf

    + +

    +Next sub-options could help to customize created netcdf file(s). +All sub-options must preceed the -netcdf option as it is the wgrib2 rule. +More then one -netcdf option could be given on the wgrib2 command line, +please read the documentation for wgrib2. +Almost all sub-options have -no_... version that annulates previous +assignment. +For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table +with the -nc_table sub-option or combine the command line options +with instructions in the -nc_table conversion file. + +

    +The -append option makes possible to create single +large data set for long time series of gridded data. Time dimension of data in the netcdf file +is "unlimited", it could be extended "forward" when adding new data but not "backward" before +the first defined time value. If data for the same time step already exist in the updated +netcdf file these will be silently overwritten. + +

    +The -nc_nlev option is needed to export data to netcdf +as 4D data defined in {TIME,LEV,LAT,LON} space. +It must be followed by integer max_number_of_vertical_levels +which defines the vertical dimension size of 4D data exported to the netcdf file. +This value can not be found from each single grib2 message or sub-message, +usually it has to be scanned the entire grib2 file or even number of files. +It is the reason why the max_number_of_vertical_levels +value must be provided by user. +

    +Grib2 types of vertical levels eligible for export to the netcdf as 4D data +are defined in the wgrib2 internal table and now include next types of GRIB2 levels: +

    +
    +
    20:K level +
    100:pressure level +
    104:sigma level +
    105:hybrid level +
    107:K isentropic level +
    160:ocean depth below sea level +
    +
    +

    +Data for the first found eligible level type are treated as 4D and vertical level +information is not added to the variable names. +Error is generetad if data for other then first found eligible level type +are met in the input stream. +Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space +with the possible level information included into the variable names or with the user-specified names +(see -nc_table option description below for how to do it). +

    +The -nc_nlev option has not -no_... option, +please use instead the max_number_of_vertical_levels equal to 0. +In this case all data from the input stream will be threated as 3D. +

    +When existing netcdf file is updated in the -append mode +the value of max_number_of_vertical_levels must not exceed +initial value provided when the netcdf file was first created (defined). +By default when first creating the netcdf file, vertical level values are not fixed +(are undefined) and these are defined one-by-one when data at new level are added +to the netcdf file, up to the max_number_of_vertical_levels. +To overcome this feature please use the -nc_table option. + +

    +The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is +default and do not assume data packing, only data range is checked. Data outside of +specified range are replaced by missing value code for all types of packing. +This replacement is done in the local copy of unpacked data, so main data array +stays unchanged. +Values of min and max could be any +signed float. Packing is applied to all new variables in the input stream. +If some variable was already defined in the netcdf file and now is appended to it +in the -append mode the initially defined and fixed in the netcdf file +valid range and packing parameters are used. +

    +The packing is possible to the short (2 bytes) +or byte (1 byte) values with potential loss of precision. +Both zero values of min and max +packing parameters for the short or +byte packing activate 'auto' packing when +min and max +values are defined from the first entered field. + +

    +PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file +is open with 'sdfopen' command. But by some reasons using the GrADS +data description file (catalog) for the same netcdf file helps in this situation. + +

    +The -nc_grads option activates some tests for the created +netcdf file to be GrADS (version 1.9b4) compatible, +or to be open by sdfopen in gradsnc or gradsdods. +The GrADS support only COARDS convention netcdf files; +it do not support non-constant data time stepping +and silently generates wrong time stamps for such netcdf files. +Packing to byte also is not directly recognized by GrADS v1.9b4. +With this option an error is raised and processing stops +if any of criterias above is determined. + +

    +The -nc_table option followed by the file_name is most usefull for the advanced users +as it specifies the file where user can customize many features of created netcdf file. +Next examples demonstrate which directives and conversion rules could be given +in the -nc_table file. +Almost all of them are optional with exception of $nlev for the case +when user explicitly specifies the vertical level values $levs. +

    +$lev_type 100:pressure:pressure level:mb:0.01 +

    This directive explicitly defines the type of vertical level +in the grib2 file that becomes eligible for treating data at these levels as 4D data +and some it attributes for netcdf file. +Default, first found level type listed in the wgrib2 build-in table +of eligible levels is selected if no $lev_type directive found. +

    Fields here include: +

    +
    +
    100-the grib2 level type code number +for treating data as 4D. In this example it is the code number for pressure levels, integer +
    pressure- +short_name for the vertical axis in the netcdf file, string +
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces +
    mb-vertical axis units as written in the netcdf file, string +
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file +
    +
    + +$nlev X +

    This directive is an equivalent of the -nc_nlev command line option +but value in the -nc_table file has precedence over the command line option if both are found. +It is required if next $levs directive is specified. +

    + +
    $levs lev(1) lev(2) lev(3)... +
    ...lev(I-1) lev(I) lev(I+1)... +
    ...lev(X-1) lev(X) +
    +

    +This directive explicitly specifies the vertical level values to be exported +to the netcdf file, in the netcdf units. +If this directive exists in the -nc_table file and there is found the grib2 data +eligible for the 4D presentation but defined on other then listed level - +these data are skipped from export and work is silently continued. +All data conversion parameters are checked before the $levs is checked. +List of level values could consist of multiple lines; +max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); +use space, ',', ';' or ':' as lev(i) fields separator. +

    +Impact of $nlev and $levs directives is different depending on +does the netcdf file is first created or it is updated. +When the netcdf file is first created these values are written +to the netcdf file fixing 4D data vertical structure. +When updating an existing netcdf file in the -append mode +these parameters will work like filter limiting possible +updates of 4D data by these that satisfy to the given $levs only and +ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. +

    +The $nlev and $levs directives could be necessary if records +in the grib2 file have randomly changing vertical level values +that makes it impossible sequentionally define valid order of vertical levels. + +

    +$grads 1 +

    This directive is an equivalent of the -nc_grads command line option +if passed value is 1 or to the -no_nc_grads if value is 0. +Directive in the -nc_table file has precedence over the command line option. + +

    +wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] +

    +All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' +are treated as grib2 to netcdf conversion rules for the specified variables. +In these strings the wgib2_name and wgrib2_level +are strings as returned by the wgrib2 inventory; +* used as the wgrib2_level will apply +to all levels not given explicitly. +The valid range and packing information is optional but it overwrites common +packing rule if such is specified by the -nc_pack command line option. +Absence of packing information means no packing for this variable. +Min and max values are any signed float values. Both could be omitted or put to zero. +Last case means that automatic scaling will be estimated from the first entered +wgib2_name field at the wgrib2_level +or at the first level in case of * as level value. +

    +If the keyword ignore is found as a netcdf variable name or +as a packing type value, the corresponding data are ignored +and do not written to the netcdf file. +Impact from this keyword is similar to the wgrib2 -not option +or filtering data with the grep utility. +

    +The ignore keyword is recommended if the data from the same +grib2 file are exported in number of output files (netcdf or other) +by the same wgrib2 process. Then the same decoded data could be passed +for the output in other file of any supported type. +Doing export to the single netcdf file it is not recommended to use the +ignore keyword +as corresponding data are first decoded and after that skipped from writing +to the netcdf file. +

    +In the next example two lines from the -nc_table file instruct +the wgrib2 utility export to the netcdf file the geopotential height changing name +from HGT (wgrib2) to +geopotential in the netcdf file, +at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: +

    +
    +HGT:*:geopotential
    +HGT:975 mb:ignore
    +
    +
    +All other variables not listed in the -nc_table file but found in the input stream +are processed as regular 3D data. + + +

    Example 2

    +

    +Next example shows the content of user-defined -nc_table file +for one special case of Japan Meteorological Agency MSM system grib2 data conversion. +Same -nc_table file includes the rules for +conversion of both 'surface' and upper air data although +the input grib2 files are different. + +

    +
    +#
    +# File name: jma_msm_g2nc.table
    +# Description: Specifies parameters for conversion to Netcdf format
    +# hourly analyses and forecasts of JMA MSM system as best suited to
    +# my purposes: forcing of ocean model and reference data for analysis
    +# of meteorological conditions with GrADS-based visualization tools.
    +# Sergey Varlamov, July 2007
    +#
    +$lev_type  100:p:pressure level:mb:0.01
    +$nlev      16
    +$levs  1000 975 950 925 900 850 800 700 600 500
    +        400 300 250 200 150 100
    +$grads 1
    +#
    +# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    +#
    +UGRD:*:u
    +VGRD:*:v
    +#UGRD:*:u:ignore
    +#VGRD:*:v:ignore
    +TMP:*:temp
    +#write HGT at any level as hgtprs:
    +HGT:*:hgtprs
    +#but skip HGT at 100 mb, now commented - example and test
    +#HGT:100 mb:hgtprs:ignore
    +RH:*:rh:short:-2:110
    +VVEL:*:omega
    +#
    +# JMA MSM model surface data conversion rules
    +#
    +PRMSL:mean sea level:prmsl
    +PRES:surface:prsfc
    +UGRD:10 m above ground:u10m
    +VGRD:10 m above ground:v10m
    +TMP:1.5 m above ground:t2m
    +RH:1.5 m above ground:rh2m:short:-5:110
    +TCDC:surface:ncld:short:-5:110
    +LCDC:surface:ncld_low:short:-5:110
    +MCDC:surface:ncld_mid:short:-5:110
    +HCDC:surface:ncld_upper:short:-5:110
    +APCP:surface:r1h
    +# End of file
    +
    +
    +Using above file we could create the daily file with 3h analyses
    +at the 'surface' layers from the input grib2 files
    +with the next simple shell script:
    +
    +
    +date=20070715
    +for (( j=0; j<=21; j+=3 )) #hour of day loop
    +do
    +  if [ $j -lt  10 ]
    +  then
    +    h=0$j
    +  else
    +    h=$j
    +  fi
    +  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    +
    +  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    +  code=$?
    +  if [ $code -eq 0 ]
    +  then
    +    echo ${date}${h}': created/added to Netcdf'
    +  else
    +    echo ${date}${h}': wgrib2 failed...'
    +    exit $code
    +  fi
    +done
    +
    +
    +Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    +
    +gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    +
    +and change the name for the output file:
    +
    +./msm_s_${date}.nc to the ./msm_p_${date}.nc
    +
    +Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    +utility for data visualization and analyses.
    +
    + +

    Example 3

    + +In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, +convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf +option doesn't support appending, the netcdf conversion cannot be in a loop. + +
    +Version 1, using loops and a temporary file
    +
    +rm tempfile
    +for f in gfs.t00z.pgrb2f[01]?
    +do
    +   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    +done
    +wgrib2 tempfile -netcdf ~/myfile.nc
    +rm tempfile
    +
    +Version 2, data-flow 
    +
    +1:   cat gfs.t00z.pgrb2f[01]? | \
    +2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    +3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    +4:   wgrib2 - -netcdf ~/myfile.nc
    +
    +
    +Line 1 (cat), takes all the desired grib files and writes to stdout
    +Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    +Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    +Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    +
    +

    +See also: +-bin, +-ieee +-text +-spread + +-append +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan. 27, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/no_nc_time.html b/docs/web_docs/no_nc_time.html new file mode 100644 index 0000000..d396341 --- /dev/null +++ b/docs/web_docs/no_nc_time.html @@ -0,0 +1,552 @@ + + + + Climate Prediction Center - wgrib2: -netcdf + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end + +
     
    + +

    wgrib2: -netcdf

    +
    + +

    Introduction

    + +

    +The -netcdf option writes the grid values to a specified +file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator +and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic +projection grids. Other grid templates and projections are not supported yet. + +

    +Default the grid values are written as 4 bytes float having {TIME,LAT,LON} +dimension shape (3D data) and possible vertical LEV information added to the name of variables. +For example, V wind component defined at 10 m level in atmosphere will have default name +VGRD_10maboveground. +With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data +with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical +structure analysis etc. +

    +3D and 4D data could be mixed in the same netcdf file if both have the same horizontal +grid shapes. Practically any number of variables could be placed in to the single netcdf file +as well as time dimension can be almost arbitrary extended. For these purposes +please use the wgrib2 -append option. +All missing values in data are replaced by the _FillValue defined in wgrib2 as +9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. + + + +

    Simple usage

    +

    + +

    +-netcdf file_name
    +
    + +

    Example 1

    +

    + +

    +$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    +
    +The above line converts the grib2 file into a netcdf file.
    +
    +
    + +

    Sub-options for -netcdf

    + +

    +Next sub-options could help to customize created netcdf file(s). +All sub-options must preceed the -netcdf option as it is the wgrib2 rule. +More then one -netcdf option could be given on the wgrib2 command line, +please read the documentation for wgrib2. +Almost all sub-options have -no_... version that annulates previous +assignment. +For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table +with the -nc_table sub-option or combine the command line options +with instructions in the -nc_table conversion file. + +

    +The -append option makes possible to create single +large data set for long time series of gridded data. Time dimension of data in the netcdf file +is "unlimited", it could be extended "forward" when adding new data but not "backward" before +the first defined time value. If data for the same time step already exist in the updated +netcdf file these will be silently overwritten. + +

    +The -nc_nlev option is needed to export data to netcdf +as 4D data defined in {TIME,LEV,LAT,LON} space. +It must be followed by integer max_number_of_vertical_levels +which defines the vertical dimension size of 4D data exported to the netcdf file. +This value can not be found from each single grib2 message or sub-message, +usually it has to be scanned the entire grib2 file or even number of files. +It is the reason why the max_number_of_vertical_levels +value must be provided by user. +

    +Grib2 types of vertical levels eligible for export to the netcdf as 4D data +are defined in the wgrib2 internal table and now include next types of GRIB2 levels: +

    +
    +
    20:K level +
    100:pressure level +
    104:sigma level +
    105:hybrid level +
    107:K isentropic level +
    160:ocean depth below sea level +
    +
    +

    +Data for the first found eligible level type are treated as 4D and vertical level +information is not added to the variable names. +Error is generetad if data for other then first found eligible level type +are met in the input stream. +Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space +with the possible level information included into the variable names or with the user-specified names +(see -nc_table option description below for how to do it). +

    +The -nc_nlev option has not -no_... option, +please use instead the max_number_of_vertical_levels equal to 0. +In this case all data from the input stream will be threated as 3D. +

    +When existing netcdf file is updated in the -append mode +the value of max_number_of_vertical_levels must not exceed +initial value provided when the netcdf file was first created (defined). +By default when first creating the netcdf file, vertical level values are not fixed +(are undefined) and these are defined one-by-one when data at new level are added +to the netcdf file, up to the max_number_of_vertical_levels. +To overcome this feature please use the -nc_table option. + +

    +The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is +default and do not assume data packing, only data range is checked. Data outside of +specified range are replaced by missing value code for all types of packing. +This replacement is done in the local copy of unpacked data, so main data array +stays unchanged. +Values of min and max could be any +signed float. Packing is applied to all new variables in the input stream. +If some variable was already defined in the netcdf file and now is appended to it +in the -append mode the initially defined and fixed in the netcdf file +valid range and packing parameters are used. +

    +The packing is possible to the short (2 bytes) +or byte (1 byte) values with potential loss of precision. +Both zero values of min and max +packing parameters for the short or +byte packing activate 'auto' packing when +min and max +values are defined from the first entered field. + +

    +PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file +is open with 'sdfopen' command. But by some reasons using the GrADS +data description file (catalog) for the same netcdf file helps in this situation. + +

    +The -nc_grads option activates some tests for the created +netcdf file to be GrADS (version 1.9b4) compatible, +or to be open by sdfopen in gradsnc or gradsdods. +The GrADS support only COARDS convention netcdf files; +it do not support non-constant data time stepping +and silently generates wrong time stamps for such netcdf files. +Packing to byte also is not directly recognized by GrADS v1.9b4. +With this option an error is raised and processing stops +if any of criterias above is determined. + +

    +The -nc_table option followed by the file_name is most usefull for the advanced users +as it specifies the file where user can customize many features of created netcdf file. +Next examples demonstrate which directives and conversion rules could be given +in the -nc_table file. +Almost all of them are optional with exception of $nlev for the case +when user explicitly specifies the vertical level values $levs. +

    +$lev_type 100:pressure:pressure level:mb:0.01 +

    This directive explicitly defines the type of vertical level +in the grib2 file that becomes eligible for treating data at these levels as 4D data +and some it attributes for netcdf file. +Default, first found level type listed in the wgrib2 build-in table +of eligible levels is selected if no $lev_type directive found. +

    Fields here include: +

    +
    +
    100-the grib2 level type code number +for treating data as 4D. In this example it is the code number for pressure levels, integer +
    pressure- +short_name for the vertical axis in the netcdf file, string +
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces +
    mb-vertical axis units as written in the netcdf file, string +
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file +
    +
    + +$nlev X +

    This directive is an equivalent of the -nc_nlev command line option +but value in the -nc_table file has precedence over the command line option if both are found. +It is required if next $levs directive is specified. +

    + +
    $levs lev(1) lev(2) lev(3)... +
    ...lev(I-1) lev(I) lev(I+1)... +
    ...lev(X-1) lev(X) +
    +

    +This directive explicitly specifies the vertical level values to be exported +to the netcdf file, in the netcdf units. +If this directive exists in the -nc_table file and there is found the grib2 data +eligible for the 4D presentation but defined on other then listed level - +these data are skipped from export and work is silently continued. +All data conversion parameters are checked before the $levs is checked. +List of level values could consist of multiple lines; +max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); +use space, ',', ';' or ':' as lev(i) fields separator. +

    +Impact of $nlev and $levs directives is different depending on +does the netcdf file is first created or it is updated. +When the netcdf file is first created these values are written +to the netcdf file fixing 4D data vertical structure. +When updating an existing netcdf file in the -append mode +these parameters will work like filter limiting possible +updates of 4D data by these that satisfy to the given $levs only and +ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. +

    +The $nlev and $levs directives could be necessary if records +in the grib2 file have randomly changing vertical level values +that makes it impossible sequentionally define valid order of vertical levels. + +

    +$grads 1 +

    This directive is an equivalent of the -nc_grads command line option +if passed value is 1 or to the -no_nc_grads if value is 0. +Directive in the -nc_table file has precedence over the command line option. + +

    +wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] +

    +All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' +are treated as grib2 to netcdf conversion rules for the specified variables. +In these strings the wgib2_name and wgrib2_level +are strings as returned by the wgrib2 inventory; +* used as the wgrib2_level will apply +to all levels not given explicitly. +The valid range and packing information is optional but it overwrites common +packing rule if such is specified by the -nc_pack command line option. +Absence of packing information means no packing for this variable. +Min and max values are any signed float values. Both could be omitted or put to zero. +Last case means that automatic scaling will be estimated from the first entered +wgib2_name field at the wgrib2_level +or at the first level in case of * as level value. +

    +If the keyword ignore is found as a netcdf variable name or +as a packing type value, the corresponding data are ignored +and do not written to the netcdf file. +Impact from this keyword is similar to the wgrib2 -not option +or filtering data with the grep utility. +

    +The ignore keyword is recommended if the data from the same +grib2 file are exported in number of output files (netcdf or other) +by the same wgrib2 process. Then the same decoded data could be passed +for the output in other file of any supported type. +Doing export to the single netcdf file it is not recommended to use the +ignore keyword +as corresponding data are first decoded and after that skipped from writing +to the netcdf file. +

    +In the next example two lines from the -nc_table file instruct +the wgrib2 utility export to the netcdf file the geopotential height changing name +from HGT (wgrib2) to +geopotential in the netcdf file, +at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: +

    +
    +HGT:*:geopotential
    +HGT:975 mb:ignore
    +
    +
    +All other variables not listed in the -nc_table file but found in the input stream +are processed as regular 3D data. + + +

    Example 2

    +

    +Next example shows the content of user-defined -nc_table file +for one special case of Japan Meteorological Agency MSM system grib2 data conversion. +Same -nc_table file includes the rules for +conversion of both 'surface' and upper air data although +the input grib2 files are different. + +

    +
    +#
    +# File name: jma_msm_g2nc.table
    +# Description: Specifies parameters for conversion to Netcdf format
    +# hourly analyses and forecasts of JMA MSM system as best suited to
    +# my purposes: forcing of ocean model and reference data for analysis
    +# of meteorological conditions with GrADS-based visualization tools.
    +# Sergey Varlamov, July 2007
    +#
    +$lev_type  100:p:pressure level:mb:0.01
    +$nlev      16
    +$levs  1000 975 950 925 900 850 800 700 600 500
    +        400 300 250 200 150 100
    +$grads 1
    +#
    +# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    +#
    +UGRD:*:u
    +VGRD:*:v
    +#UGRD:*:u:ignore
    +#VGRD:*:v:ignore
    +TMP:*:temp
    +#write HGT at any level as hgtprs:
    +HGT:*:hgtprs
    +#but skip HGT at 100 mb, now commented - example and test
    +#HGT:100 mb:hgtprs:ignore
    +RH:*:rh:short:-2:110
    +VVEL:*:omega
    +#
    +# JMA MSM model surface data conversion rules
    +#
    +PRMSL:mean sea level:prmsl
    +PRES:surface:prsfc
    +UGRD:10 m above ground:u10m
    +VGRD:10 m above ground:v10m
    +TMP:1.5 m above ground:t2m
    +RH:1.5 m above ground:rh2m:short:-5:110
    +TCDC:surface:ncld:short:-5:110
    +LCDC:surface:ncld_low:short:-5:110
    +MCDC:surface:ncld_mid:short:-5:110
    +HCDC:surface:ncld_upper:short:-5:110
    +APCP:surface:r1h
    +# End of file
    +
    +
    +Using above file we could create the daily file with 3h analyses
    +at the 'surface' layers from the input grib2 files
    +with the next simple shell script:
    +
    +
    +date=20070715
    +for (( j=0; j<=21; j+=3 )) #hour of day loop
    +do
    +  if [ $j -lt  10 ]
    +  then
    +    h=0$j
    +  else
    +    h=$j
    +  fi
    +  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    +
    +  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    +  code=$?
    +  if [ $code -eq 0 ]
    +  then
    +    echo ${date}${h}': created/added to Netcdf'
    +  else
    +    echo ${date}${h}': wgrib2 failed...'
    +    exit $code
    +  fi
    +done
    +
    +
    +Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    +
    +gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    +
    +and change the name for the output file:
    +
    +./msm_s_${date}.nc to the ./msm_p_${date}.nc
    +
    +Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    +utility for data visualization and analyses.
    +
    + +

    Example 3

    + +In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, +convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf +option doesn't support appending, the netcdf conversion cannot be in a loop. + +
    +Version 1, using loops and a temporary file
    +
    +rm tempfile
    +for f in gfs.t00z.pgrb2f[01]?
    +do
    +   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    +done
    +wgrib2 tempfile -netcdf ~/myfile.nc
    +rm tempfile
    +
    +Version 2, data-flow 
    +
    +1:   cat gfs.t00z.pgrb2f[01]? | \
    +2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    +3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    +4:   wgrib2 - -netcdf ~/myfile.nc
    +
    +
    +Line 1 (cat), takes all the desired grib files and writes to stdout
    +Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    +Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    +Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    +
    +

    +See also: +-bin, +-ieee +-text +-spread + +-append +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan. 27, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/not.html b/docs/web_docs/not.html new file mode 100644 index 0000000..cf41e28 --- /dev/null +++ b/docs/web_docs/not.html @@ -0,0 +1,242 @@ + + + + Climate Prediction Center - wgrib2: -not + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-not +
     
    + +

    wgrib2: -not

    +
    + + +

    Introduction

    + +

    +The -not option selects records which should +be processed. The -not is a not +-match. When multiple -match/-not options are +used, all must be satisfied. + + +

    +
    +    wgrib2 -not X (...)
    +
    +is the same as 
    +
    +    wgrib2 -match_inv file | egrep -v X | wgrib2 -i (...)
    +
    +
    +
    +    wgrib2 -match X  -not Y (...)
    +
    +is the same as 
    +
    +    wgrib2 -match_inv file | egrep X | egrep -v Y | wgrib2 -i (...)
    +
    +where X, and Y are regular expressions.  Note, X and Y will not match 
    +the second (byte location) field of the short inventory.
    +
    +
    + +

    Usage

    +

    + +

    +-not X
    +
    +X is a POSIX extended regular expression
    +
    + +

    + +The -match, and -not selection +facility is more limited than the "wgrib2 | filter | wgrib2 -i" syntax. +However, it can be more efficient especially when combined with the +-end option. + +

    Future Changes

    +

    +The format of the "match inventory" has evolved and will continue to evolve. +The rule for future changes is that new items in the "match inventory" will be added +as the second last item. Consequently the last item in the inventory will always +be ":vt=YYYYMMDDHH:". In order to future proof your +-match, and -not selections, you +must not include any item before the ":vt=YYYYMMDD:" field. + +

    +    -match ":vt=2011111500:"                  good
    +    -not ":vt=2011111500:$"                   good (dollar sign matches the end of the line)
    +    -not ":n=10:vt=2011111500:"               bad (item before :vt=)
    +    -match ":RH:975 mb:anl::vt=2010050806:"   bad (item before :vt=)
    +
    + +Some recent changes (as of Nov 2011) to the match inventory include: + +
      +
    • adding the "extended name of the variable", ex. TMP.prob_<273 +
    • adding the inventory number, ex. n=10 +
    • adding ensemble/chemical/probability information (-misc) +
    + + +

    +See also: -not_if, +-not_fs, +-match, +-match_fs, +-match_inv, +-end, +-i, +-if, +-set_regex. +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Nov 16, 2011 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/not_fs.html b/docs/web_docs/not_fs.html new file mode 100644 index 0000000..5da4b94 --- /dev/null +++ b/docs/web_docs/not_fs.html @@ -0,0 +1,240 @@ + + + + Climate Prediction Center - wgrib2: -not_fs + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-not_fs +
     
    + +

    wgrib2: -not_fs

    +
    + + +

    Introduction

    + +

    +The -not option and the -not_fs option +are very similar. The -not_fs is a not +-match_fs. The difference between +-not and -not_fs is the the former +uses (extended) regular expressions and the latter uses "Fixed Strings" (fs). + +

    +
    +    wgrib2 -not_fs X (...)
    +
    +is the same as 
    +
    +    wgrib2 -match_inv file | fgrep -v X | wgrib2 -i (...)
    +
    +    wgrib2 -match_fs X  -not_fs Y (...)
    +
    +is the same as 
    +
    +    wgrib2 -match_inv file | fgrep X | fgrep -v Y | wgrib2 -i (...)
    +
    +where X, and Y are strings. Note, X and Y will not match 
    +the second (byte location) field of the short inventory.
    +
    +
    + +

    Usage

    +

    + +

    +-not_fs X
    +
    +X is string
    +
    + +

    + +The -match, and -not selection +facility is more limited than the "wgrib2 | filter | wgrib2 -i" syntax. +However, it can be more efficient especially when combined with the +-end option. + +

    Future Changes

    +

    +The format of the "match inventory" has evolved and will continue to evolve. +The rule for future changes is that new items in the "match inventory" will be added +as the second last item. Consequently the last item in the inventory will always +be ":vt=YYYYMMDDHH:". In order to future proof your +-match, and -not selections, you +must not include any item before the ":vt=YYYYMMDD:" field. + +

    +    -match ":vt=2011111500:"                  good
    +    -not ":vt=2011111500:$"                   good (dollar sign matches the end of the line)
    +    -not ":n=10:vt=2011111500:"               bad (item before :vt=)
    +    -match ":RH:975 mb:anl::vt=2010050806:"   bad (item before :vt=)
    +
    + +Some recent changes (as of Nov 2011) to the match inventory include: + +
      +
    • adding the "extended name of the variable", ex. TMP.prob_<273 +
    • adding the inventory number, ex. n=10 +
    • adding ensemble/chemical/probability information (-misc) +
    + + +

    +See also: + -not, + -not_if, +-match, +-match_inv, +-end, +-i, +-if, +-set_regex. +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 7, 2015 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/not_if.html b/docs/web_docs/not_if.html new file mode 100644 index 0000000..794540c --- /dev/null +++ b/docs/web_docs/not_if.html @@ -0,0 +1,199 @@ + + + + Climate Prediction Center - wgrib2: -not_if + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-not_if +
     
    + +

    wgrib2: -not_if

    +
    + + +

    Introduction

    + +

    +The -not_if option returns true or false and is the start of the IF +block structure. The + -not_if option is like the + -if option except the results are reversed. +For example, + -if ':HGT:' is true if the match inventory contains the string ':HGT:', and +the next block is executed. The option -not_if ':HGT:' does the opposite +and does not execute the next block. +See -if for details about the IF block structure. + + +

    Usage

    +

    + +

    +-not_if X
    +   X is a regular expression
    +   returns true if X is not in the match inventory, false otherwise
    +
    + + + +

    +See also: -not, +-end, +-i, +-if, +-if_fs, +-match, +-match_inv, +-not_if_fs, +-fi. +-endif. +-else. +-set_regex. +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 8, 2015, March 16, 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/not_if_fs.html b/docs/web_docs/not_if_fs.html new file mode 100644 index 0000000..232b1e8 --- /dev/null +++ b/docs/web_docs/not_if_fs.html @@ -0,0 +1,183 @@ + + + + Climate Prediction Center - wgrib2: -if_fs, -not_if_fs + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -if_fs,-not_if_fs +
     
    + +

    wgrib2: -if_fs, -not_if_fs

    +
    + + +

    Introduction

    + +

    +The -if_fs option is the same as the +the -if option except it takes "fixed strings" +rather than extended regular expressions. The same hold +for the -not_if_fs and -not_if options. + +

    Usage

    +

    + +

    +-if_fs X
    +-not_if_fs X
    +
    +X is a fixed string (not a regular expression)
    +
    + + + +

    +See also: -if, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/npts.html b/docs/web_docs/npts.html new file mode 100644 index 0000000..ea246c2 --- /dev/null +++ b/docs/web_docs/npts.html @@ -0,0 +1,180 @@ + + + + Climate Prediction Center - wgrib2: -npts + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-npts +
     
    + +

    wgrib2: -npts

    +
    + + +

    Introduction

    + +

    +The -npts option prints the number of grid points +in the grid. The total include both defined and undefined grid points. + +

    +-sh-2.05b$ ./wgrib2 test.grb2 -s -npts -d 1
    +1:0:d=2005090200:HGT:1000 mb:60 hour fcst:npts=259920
    +
    + +

    Usage

    +

    + +

    +-npts
    +
    + +See also: -nxny +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/number_of_coordinate_values_after_template.html b/docs/web_docs/number_of_coordinate_values_after_template.html new file mode 100644 index 0000000..3352573 --- /dev/null +++ b/docs/web_docs/number_of_coordinate_values_after_template.html @@ -0,0 +1,226 @@ + + + + Climate Prediction Center - wgrib2: -number_of_coordinate_values_after_template + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-number_of_coordinate_values_after_template +
     
    + +

    wgrib2: -number_of_coordinate_values_after_template

    +
    + + +

    Introduction

    + +

    +Vertical coordinates can be easy like "400 hPa", "2 meters above ground" or +"sigma=0.4". However, the situation is more complicated with the vertical +coordinates in the models. In these model coordinates, the +vertical are usually an integer. You need some extra information to locate +the level in physical space. This information is stored in the PDT (section +4) as the "optional list of coordinate values" at the end of the product +defintion template. +

    +The -number_of_coordinate_values_after_template option +prints the number of values (4 byte) in the "optional list of coordinate values". +The WMO documentation only specifies the hybrid coordinate values should be +in pairs of IEEE single precision floats. +

    + +

    Usage

    +

    + +

    +-number_of_coordinate_values_after_template
    +   prints section 4, octets 6-7 as an unsigned integer
    +   it is expected that each value uses 4 octets of storage a the end of Section 4.
    +
    + +

    Example

    +

    + +

    +$  wgrib2 -number_of_coordinate_values_after_template COSMO_EU_1rec.grib2 -get_byte 4 6 2
    +1:0:number_coordinates_values_in_pdt=45:4-6=0,45
    +
    +
    +

    +See also: +

    + + + + + + + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + + + +

    +See also: -undefine +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: August 15, 2014, July 2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/nxny.html b/docs/web_docs/nxny.html new file mode 100644 index 0000000..cb40b20 --- /dev/null +++ b/docs/web_docs/nxny.html @@ -0,0 +1,190 @@ + + + + Climate Prediction Center - wgrib2: -nxny + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-nxny +
     
    + +

    wgrib2: -nxny

    +
    + + +

    Introduction

    + +

    +The -nxny option prints the size of a "rectangular" grid. +Of course not all grids are rectangular. + +

    +$ ./wgrib2 test.grb2 -s -nxny -d 1
    +1:0:d=2005090200:HGT:1000 mb:60 hour fcst:(720 x 361)
    +
    +The above grid is a 0.5 x 0.5 degree global grid. + +
    +$ ./wgrib2 ../ecmwf/gaussian_reduced.grib2 -s -nxny -d 1
    +1:0:d=2006081712:var discipline=0 master_table=4 parmcat=0 parm=0:500 mb:12 hour 
    +fcst:(-1 x 800)
    +
    + +Here, the thinned Gaussian grid has 800 latitudes and a varying number +of longitude points. + +

    Usage

    +

    + +

    +-nxny
    +
    + +See also: -npts +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/one_line.html b/docs/web_docs/one_line.html new file mode 100644 index 0000000..c0b232e --- /dev/null +++ b/docs/web_docs/one_line.html @@ -0,0 +1,196 @@ + + + + Climate Prediction Center - wgrib2: -one_line + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-one_line +
     
    + +

    wgrib2: -one_line

    +
    + + +

    Introduction

    + +

    +The -one_line option changes the format of the inventory +so all the items are one line. This is useful in using -grid, for example, in +making inventories that can be grepped. + +

    +Suppose we want select fields by the grid type. +

    +-sh-2.05b$ ./wgrib2 eta.t00z.awphys18.grb2 -d 1 -s -grid
    +1:0:d=2003090300:MSLET:mean sea level:18 hour fcst:grid_template=30:
    +        Lambert Conformal: (614 x 428) scan WE:SN res 8
    +        Lat1 12.19 Lon1 226.541 Lov 265
    +        Latin1 25 Latin2 25 LatSP 0 LonSP 0
    +              North Pole (614 x 428) Dx 12.191 Dy 12.191 mode 8
    +
    +The above format doesn't work with grep. By using the -one_line option, +we can easily extract specific grids. +
    +-sh-2.05b$ ./wgrib2 eta.t00z.awphys18.grb2 -d 1 -s -grid -one_line
    +1:0:d=2003090300:MSLET:mean sea level:18 hour fcst:grid_template=30: 
    +Lambert Conformal: (614 x 428) scan WE:SN res 8 Lat1 12.19 Lon1 226.541 
    +Lov 265 Latin1 25 Latin2 25 LatSP 0 LonSP 0       North Pole (614 x 428) 
    +Dx 12.191 Dy 12.191 mode 8
    +
    + +

    Usage

    +

    + +

    +-one_line
    +      change format so that all the information/field is on one line
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/openmp.html b/docs/web_docs/openmp.html new file mode 100644 index 0000000..49b05da --- /dev/null +++ b/docs/web_docs/openmp.html @@ -0,0 +1,254 @@ + + + + Climate Prediction Center - wgrib2: all about OpenMP + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 all about OpenMP +
     
    + +

    wgrib2: all about OpenMP

    +
    + + +

    Introduction

    + +

    +Wgrib2 needs to run fast, and the only way to make wgrib2 run fast +is to use multiple cores. Wgrib2 uses "OpenMP" to multithread its +calculations. Some parts of wgrib2 are scalar (jpeg2000, +I/O) and see no speedup for using mutiple cores. While other parts +(-new_grid, -ens_processing, complex unpacking) see large speedups. +Much effort has been made to parallelize time-consuming parts +of the code. In order to use OpenMP, the compilers must support +at least OpenMP v3.1. Some additional speedups can be obtained +by compiling with AVX512 or AVX2 enabled and using a version of +OpenMP that supports SIMD. +

    +To check that your wgrib2 executable is OpenMP enabled, examine +the output of $ wgrib2 -config + +

    +ebis@landing2:~$ wgrib2 -config
    +wgrib2 v3.1.4beta1 11/2023  Wesley Ebisuzaki, Reinoud Bokhorst, John Howard, Jaakko Hyvätti, Dusan Jovic, Daniel Lee, Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Gregor Schee, Arlindo da Silva, Niklas Sondell, Sam Trahan, George Trojan, Sergey Varlamov
    +..
    +OpenMP: control number of threads with environment variable OMP_NUM_THREADS
    +..
    +
    + +If you don't have the line "OpenMP: control ..", then your copy of wgrib2 is not OpenMP enabled. + +

    Using OpenMP

    +

    +You control the number of cores that OpenMP-enabled programs will use by the +environment variable OPM_NUM_THREADS. + +

    +bash, sh
    +   $ export OMP_NUM_THREADS=4
    +csh
    +   $ setenv OMP_NUM_THREADS 4
    +
    +

    +There is no hard-and-fast rule for the optimum number of +threads to allocate to wgrib2. For example, if I am +running 4 copies of wgrib2 on a 4 core cpu, I would +set OMP_NUM_THREADS to 1. If I am running wgrib2 on +a 128 core CPU with 30 other users, I may set OMP_NUM_THREADS +to 4. Generally the wgrib2 speed up is minimal for greater +than 5 cores unless you are in heavy compute options +that are well parallelized such as -new_grid and -ens_processing. + + +

    +Wgrib2 uses 1 core in serial sections of the code and up +to OMP_NUM_THREADS in the parallel sections of the code. +Under normal situations, you want the unused cores +(up to OMP_NUM_THREADS-1) to be made available for other +jobs. You do this by + +

    +bash, sh
    +  $ export OMP_WAIT_POLICY=PASSIVE
    +csh
    +  $ setenv OMP_WAIT_POLICY PASSIVE
    +
    + +

    +On a HPC node where your jobs have sole use of the +(physical) CPU, you may want to set the OMP_WAIT_POLICY to ACTIVE. + +

    -ncpu

    +The environment variable $OMP_NUM_THREADS can be overridden by the +option -ncpu N. +

    + +

    SIMD

    +

    +OpenMP v4.0+ supports SIMD. The current wgrib2 (5/2024) prefers +multi-threading over SIMD because multi-threading can be used +in more cases and SIMD has a limited vector length. There are +a limited number of cases where the outer loop is parallelized +by multi-threading and the inner loop is parallelized by SIMD. +It is hard to generalize about speed of multi-threading vs +SIMD. Multi-threading could have speed advantages when more +than two memory controllers are present. +

    +To best take advantage of SIMD, wgrib2 should be compiled with +AVX-512 or AVX2 enabled (x86 cpus). + +

    +See also: -ncpu, +speed, + + + + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: June 2024 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/order.html b/docs/web_docs/order.html new file mode 100644 index 0000000..495d540 --- /dev/null +++ b/docs/web_docs/order.html @@ -0,0 +1,195 @@ + + + + Climate Prediction Center - wgrib2: -order + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-order +
     
    + +

    wgrib2: -order

    +
    + + +

    Introduction

    + +

    +Grids can be stored in GRIB files in one of 16 different orders. +The default configure is for wgrib2 to convert all data into WE:SN order. +That is, the first point is at the bottom left, the second point is +to the right and so on until it finishes up the row. Then the next point +is slightly north of the first point and the process repeats until +the NE point of the grid is reached. + +

    The -order raw option keeps the data in +the original order as specified the grib header. Note, latitude, +longitude is available when the data are in we:sn order. + +

    +You must use the default -order we:sn option +in order to get latitude, longitude information. + + +

    +-order raw
    +      data is the order as specified by the grib file
    +      this was the order that wgrib used
    +
    +-order we:ns
    +      data is in WE:NS order
    +
    +-order we:sn
    +      data is in WE:SN order (default)
    +
    + +See also: +-scan, + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/packing.html b/docs/web_docs/packing.html new file mode 100644 index 0000000..279a177 --- /dev/null +++ b/docs/web_docs/packing.html @@ -0,0 +1,213 @@ + + + + Climate Prediction Center - wgrib2: -packing + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-packing +
     
    + +

    wgrib2: -packing

    +
    + + +

    Introduction

    + +

    +The grib format is for storing gridded data. Usually gridded data is +stored as an scaled integer that has been packed or compressed. +Exceptions are spectral data and tabular data (data are entries to a +table). +

    + +

    +The -packing option shows how the gridded +data was packed. The most common packing methods are jpeg2000, +one of the various complex packing schemes. If you increase +the verbosity by -v -packing, you +see the packing method, scaling factors and range of possible +integers. +

    + + +

    Usage

    + +

    +

    +-packing
    +
    + +

    Example

    +
    +$ wgrib2 png.grb2 -packing
    +bash-4.1$ wgrib2 png.grb2 -packing
    +1:4:packing=grid point data - png compression,_
    +$ wgrib2 png.grb2 -v -packing
    +bash-4.1$ wgrib2 png.grb2 -v -packing
    +1:4:packing=grid point data - png compression,_ val=(0+i*2^0)*10^-1, i=0..65535 (#bits=16)
    +
    +The file, png.grb2, was packed using the obsolete png compression. The
    +grid point values can have the values (0+i*2^0)*10^-1 where i is an integer 
    +that ranges from 0..65535.
    +
    +$ wgrib2 small.grb2 -packing
    +1:0:packing=grid point data - simple packing,s
    +$ wgrib2 small.grb2 -v -packing
    +1:0:packing=grid point data - simple packing,s val=(1.22666e+06+i*2^2)*10^-2, i=0..4095 (#bits=12)
    +
    +The file small.grb2 is using simple packing, integers are stored using 
    +12 bits (#bits=12). The grid points can have values of (1.22666e+06+i*2^2)*10^-2 
    +where i is an integer that ranges from 0..4095.
    +
    + + +See also: + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 30, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/pds_fcst_time.html b/docs/web_docs/pds_fcst_time.html new file mode 100644 index 0000000..bf03c98 --- /dev/null +++ b/docs/web_docs/pds_fcst_time.html @@ -0,0 +1,208 @@ + + + + Climate Prediction Center - wgrib2: -pds_fcst_time + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-pds_fcst_time +
     
    + +

    wgrib2: -pds_fcst_time

    +
    + + +

    Introduction

    + +

    +Most grib messages include a forecast time which is stored +in the Product Definition Templates (PDT). When the PDT +has a forecast time, it stores the number as a 4 byte +integer and the units in Code Table 4.4. For example, +a 12 hour forecast could be stored with the number 12 +and the units of 1 which corresponds hour. Note that +the same forecast time can be stored in several ways. +For example, 12 hours can be stored as +

      +
    • value=720 , units = 0 (minutes) +
    • value=12 , units = 1 (hours) +
    • value=4 , units = 10 (3-hours) +
    • value=2 , units = 11 (6-hours) +
    • value=1 , units = 12 (12-hours) +
    • value=43299, units = 13 (seconds) +
    + +The unusual 3-hour, 6-hour and 12-hour time units are a legacy +of the grib version 1 standard. Note that the value is + a signed integer because the grib standard allows negative +forecast hours which can make sense in data assimilation. + +

    +The -pds_fcst_time option prints out the +value of the forecast time and the +-code_table_4.4 option prints out the +units of the forecast time. + + +

    Usage

    +
    +-pds_fcst_time
    +
    + +

    Example

    +
    +$ wgrib2 percentile_precip.grib2 -s -pds_fcst_time -code_table_4.4
    +1:0:d=2014101012:TPRATE:surface:2@1 hour max(13-14 hour acc fcst)++,missing=0:75% level:pds_fcst_time1=13:code table 4.4=1 (hour)
    +2:315649:d=2014101012:TPRATE:surface:2@1 hour max(13-14 hour acc fcst)++,missing=0:90% level:pds_fcst_time1=13:code table 4.4=1 (hour)
    +
    + + +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Oct 16, 2017. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/pdt.html b/docs/web_docs/pdt.html new file mode 100644 index 0000000..604a51e --- /dev/null +++ b/docs/web_docs/pdt.html @@ -0,0 +1,188 @@ + + + + Climate Prediction Center - wgrib2: -pdt + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-pdt +
     
    + +

    wgrib2: -pdt

    +
    + + +

    Introduction

    + +

    +Section 4 contains the product definition template (PDT) +and the -pdt option prints the PDT. +

    +

    +The -pdt option is an alias to + -code_table_4.0t. +

    + +

    Usage

    + +

    +

    +-pdt
    +
    + +

    Example

    +
    +$ wgrib2 -pdt png.grb2
    +1:4:code table 4.0=2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time.
    +
    + + +See also: +-Sec4, +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 30, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/persistent.html b/docs/web_docs/persistent.html new file mode 100644 index 0000000..52ffbf1 --- /dev/null +++ b/docs/web_docs/persistent.html @@ -0,0 +1,190 @@ + + + + Climate Prediction Center - wgrib2: -lon + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-persistent +
     
    + +

    wgrib2: -persistent

    +
    + + +

    Introduction

    + +

    +When wgrib2 opens a file, the file may be marked as persistent or +transient. If a file is marked as transient, wgrib2 will close +the file as part of its normal "finalize" procedure. If a file +is marked as persistent, the file will closed when the system +terminates the program. If you run the wgrib2 utility, it makes +no difference who closes the files. However, when you use the +C/Fortran API, it makes a major difference. When you write +C/Fortran programs that calls the wgrib2 API, you may want to +use the same file thousands of times. It is better to open +the file once rather than thousands of times. +The -persistent option marks an already +open file as persistent. +The -transient option marks an already +open file as transient. When opening a file, the default +is to mark the file as persistent. + +

    Usage

    +

    + +

    +-persistent FILE
    +  FILE must be already opened
    +
    + +See also: +-transient +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 15, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/pipes.html b/docs/web_docs/pipes.html new file mode 100644 index 0000000..7657c02 --- /dev/null +++ b/docs/web_docs/pipes.html @@ -0,0 +1,250 @@ + + + + Climate Prediction Center - wgrib2: pipes and named pipes + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: pipes and named pipes, POSIX only +
     
    + +

    wgrib2: pipes and named pipes (fifo), POSIX only

    +
    + + +

    Introduction

    + +

    This web page applies to POSIX compliant operating systems. +Linux and Unix are either fully or mostly POSIX-compliant. +Windows may or may not be POSIX compliant. To quote the POSIX Wiki, +"The UNIX Subsystem is built in to the Enterprise and Ultimate +editions of Windows Vista and 7, and cannot be added separately +to the other editions." Third-party add-ons may or may not provide +POSIX pipe support. Windows provides support for unnamed pipes, "|". +However, using these pipes for binary data will be compiler and +perhaps OS dependent. Note: prior to the 5/2011 version of wgrib2, the +-flush option was needed in the following examples. + +

    Pipes are used in the old-style selection of fields. In the +following example, the first wgrib2 creates and inventory, the grep +selects the HGT field and the second wgrib extracts the HGT based +on the input inventory. + +

    +  wgrib2 IN.grb | grep ":HGT:" | wgrib2 IN.grb -i -grib OUT.grb
    +
    + +

    A more modern example of pipes is to extract all the HGT fields +from a set of files. In the following example, the "cat" writes +all the 2016 grib files to the pipe. The wgrib2 reads the pipe (file=-) +and writes all the HGT fields to the file HGT2016.grb. + +

    +  cat pgb.2016????? | wgrib2 - -match ":HGT:" -grib HGT2016.grb
    +
    + +Pipe are great because this they avoid the slow disk I/O and allow +two processes to run at the same time. For example, the above +line could be executed as, + +
    +  cat pgb.2016????? tmpfile
    + wgrib2 tmpfile -match ":HGT:" -grib HGT2016.grb
    + rm tmpfile
    +
    + +An example where two process run at the same time is +given below. The first wgrib2 regrids the fields and writes it +to stdio. The second wgrib2 reads the regridded fields and +writes a CSV file. On a multi-core system, both processes +and be computing at the same time. + +
    +  wgrib2 IN.grb -inv processed.txt  -new_grid_winds earth -new_grid ncep grid 2  - | wgrib2 - -csv out.csv
    +
    + + +Another usage of pipes is to avoid the 2GB limit on input grib2 file when using a 32-bit machine. + +
    + cat BIGFILE | wgrib2 - -match ':HGT:' -grib HGT.grb
    +
    + +

    Named Pipes

    + +Named pipe are also useful. Consider the following line +which converts the file into jpeg2000 packing. + +
    +   wgrib2 IN.grb -set_grib_type jpeg -grib_out JPEG.grb
    +
    + +Jpeg2000 packing is slow and you can convert the file using +3 cpus and named pipes. + +
    +1  mkfifo pipe.1.$$ pipe.2.$$ pipe.3.$$
    +2  wgrib2 IN.grb -for_n 1::3 -set_grib_type jpeg -grib_out pipe.1.$$ &
    +3  wgrib2 IN.grb -for_n 2::3 -set_grib_type jpeg -grib_out pipe.2.$$ &
    +4  wgrib2 IN.grb -for_n 3::3 -set_grib_type jpeg -grib_out pipe.3.$$ &
    +5  gmerge JPEG.grb pipe.1.$$ pipe.2.$$ pipe.3.$$
    +6  rm pipe.1.$$ pipe.2.$$ pipe.3.$$
    +
    +  line 1: makes the named pipes
    +  line 2: wgrib2 command process fields 1,4,7.., writes to pipe.1.$$
    +  line 3: wgrib2 command process fields 2,5,8.., writes to pipe.2.$$
    +  line 4: wgrib2 command process fields 3,6,9.., writes to pipe.3.$$
    +  line 5: gmerge copies to JPEG.grb grib messeages from pipe.1, 
    +          pipe.2 and then pipe.3, and starts at pipe.1 again.
    +          This round robin selection preserves the order of fields.
    +  line 6: cleanup
    +
    +  * versions of wgrib2 prior to 5/2011 needed the -flush option for lines 2-4.
    +
    + +The above is a simple example of multitasking a wgrib2 job. + + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Oct 18, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/precision.html b/docs/web_docs/precision.html new file mode 100644 index 0000000..e1d2549 --- /dev/null +++ b/docs/web_docs/precision.html @@ -0,0 +1,212 @@ + + + + Climate Prediction Center - wgrib2: -precision + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -u +
     
    + +

    wgrib2: -precision

    +
    + + +

    Precision

    + +

    +Except for grid values stored in IEEE format, grid values are +stored with user-defined precision. By having a variable precision, +the space required can be reduced. For having the temperature +stored to a thousandth of a degree would be wasteful as thermometers +typically give a result to a tenth of a degree. + +

    Grid point values are stored as scaled integers, the scaling +determines the precision. + +

    +val = (base+i*2^bin_scaling)*10^dec_scaling
    +       base = real*4
    +       bin_scaling = integer from -127 .. 127
    +       dec_scaling = integer from -127 .. 127
    +
    + +

    The -precision option prints the bin_scaling +and dec_scaling values. +The -precision output can be read by +-set_metadata and +-set_metadata_str options to set the precision. + + +

    Usage

    +

    +

    +-precision
    +
    + +

    Examples

    +
    +$ wgrib2 ecmwf.tp.hc -precision
    +1:0:encode i*2^-4*10^0
    +
    +$ wgrib2 wind.grb -precision
    +1:0:encode i*2^0*10^-1
    +2:97922:encode i*2^0*10^-1
    +3:179554:encode i*2^0*10^-1
    +
    + +

    +See also: +-packing, +-scale, +-set_bin_prec, +-set_metadata, +-set_metadata_str, +-set_scale, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 10, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/print.html b/docs/web_docs/print.html new file mode 100644 index 0000000..e06e569 --- /dev/null +++ b/docs/web_docs/print.html @@ -0,0 +1,184 @@ + + + + Climate Prediction Center - wgrib2: -print + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-print +
     
    + +

    wgrib2: -print

    +
    + + +

    Introduction

    + +

    +The -print option prints a string +into the inventory. It is used to make the inventory prettier. +

    + +

    Usage

    + +

    +

    +-print "string"
    +
    + +

    Example

    +
    +$ wgrib2 png.grb2 -print "VAR is" -var -print "LEV is" -lev
    +1:4:VAR is:RH:LEV is:2 m above ground
    +
    + + +See also: +-nl +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 30, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/print_out.html b/docs/web_docs/print_out.html new file mode 100644 index 0000000..d0ab01d --- /dev/null +++ b/docs/web_docs/print_out.html @@ -0,0 +1,204 @@ + + + + Climate Prediction Center - wgrib2: -print_out + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-print_out +
     
    + +

    wgrib2: -print_out

    +
    + + +

    Introduction

    + +

    +The -print_out option prints a string +to a file. +

    + +

    Usage

    + +

    +

    +-print_out "string" FILE
    +     Writes "string" to FILE
    +
    + +

    Example

    +
    +$ wgrib2 LIS.c3 -if ':SNOD:' \
    +  -s -last junk \
    +  -print_out ' (found snod)' junk \
    +  -nl_out junk
    +1:0
    +2:661778
    +3:903352
    +4:4108932
    +5:9512902:d=2014030500:SNOD:surface:anl:d=2014030500:SNOD:surface:anl:
    +6:14281104
    +7:14925511
    +$ cat junk
    +d=2014030500:SNOD:surface:anl: (found snod)
    +
    + -s -last junk                        -last prints the output from the last option (-s) to junk
    + -print_out ' (found snod)' junk      writes string to junk
    + -nl_out junk                         writes a new-line to junk
    +
    + + +See also: +last +last0 +print +nl_out +s_out +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page: 6/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/prob.html b/docs/web_docs/prob.html new file mode 100644 index 0000000..efe315b --- /dev/null +++ b/docs/web_docs/prob.html @@ -0,0 +1,203 @@ + + + + Climate Prediction Center - wgrib2: -prob + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-prob +
     
    + +

    wgrib2: -prob

    +
    + + +

    Introduction

    + +

    +The TMP (temperature) field usually contains the temperature +in Kelvin. However, with the right options, the TMP field +could contain the probability of the temperature being + +

      +
    • below a specified value +
    • above or a specified value +
    • between a two limits (lower limit <= V < upper limit) +
    + +The -prob option prints out the probability +field, if any. + + +

    Usage

    +

    +

    +-prob
    +
    + +

    Example

    +

    +

    +sh-2.05b$ wgrib2 sref.t03z.pgrb243.prob.grib2 -prob
    +1:0:prob <273
    +2:1378:prob <273
    +3:2756:prob >500
    +4:6309:prob >1000
    +5:8800:prob >2000
    +6:9801:prob >3000
    +7:10262:prob >4000
    +
    + +Normally -prob in invoked by other +inventory functions like -misc and +-s. +

    +See also: +-set_prob +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/problems.html b/docs/web_docs/problems.html new file mode 100644 index 0000000..b0d0c72 --- /dev/null +++ b/docs/web_docs/problems.html @@ -0,0 +1,284 @@ + + + + Climate Prediction Center - wgrib2: Problems + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-Problems +
     
    + +

    wgrib2: error messages

    +
    + + +*** FATAL ERROR: unknown option -xyz *** + +
    +bash-4.1$ wgrib2 small.grb -nosuchoption
    +
    +*** FATAL ERROR: unknown option -nosuchoption ***
    +
    + +

    +In this case, there is no option, -nosuchoption, and wgrib2 rightly complains. +Sometimes options may not exist in older versions of wgrib2. +Sometimes options will be available in the next public release. To see +the list of options that are available with your installed version, type wgrib2 -help all. By the +way, the grib file must not start with a dash or minus sign otherwise +it will be confused with an option. + +

    +xyz package not installed +

    +Wgrib2 has several optional packages. You will get this error message +if you are requesting an option from a package that was not enabled +at compile time. + +

    +bash-4.1$ wgrib2 small.grb -mysql host user password db table
    +mysql package not installed
    +
    + + *** FATAL ERROR: missing arguments option=ij *** + + +Every option requires a fixed number of arguments. You will get +this error message when you last option has too few arguments. +In this case, -ij requires two arguments + +
    + bash-4.1$ wgrib2 small.grb -ij 19 
    +
    +*** FATAL ERROR: missing arguments option=ij ***
    +
    + + *** FATAL ERROR: too many grib files .. 1st=small.grb 2nd=11 *** + +

    +Every option requires a fixed number of arguments. If you have too many or +too few arguments, you can get this error message. In the following +example, -ij, requires two arguments. For the first -ij, the arguments +are 10 and -ij. The "11" doesn't start with a dash, so it is assumed to +be a grib file. Since there was already a grib file found, error message. + +

    +bash-4.1$ wgrib2 small.grb -ij 10 -ij 11 12
    +
    +*** FATAL ERROR: too many grib files .. 1st=small.grb 2nd=11 ***
    +
    + +grib1 message ignored (use wgrib) + +

    +If wgrib2 encounters a grib1 message, it will print the above warning. +Some ECMWF files will include both grib1 and grib2 data. Some +decoders can handle both formats at the same time, but wgrib2 is +not one of them. + +

    +bash-4.1$ wgrib2 z500.grib1
    +grib1 message ignored (use wgrib)
    +
    + + *** FATAL ERROR: missing input file non-existant-file *** + +

    +You get this error message you wgrib2 cannot open the grib file. + +

    +bash-4.1$ wgrib2 non-existant-file
    +
    +*** FATAL ERROR: missing input file non-existant-file ***
    +
    + +*** FATAL ERROR: no input file defined *** +

    + +You get this error message when wgrib2 cannot find the input grib file on +the command line. This usually happens when the preceeding option doesn't +have enough arguments. In this example, -ij requires two arguments. The +grib file becomes the second argument. + +

    +bash-4.1$ wgrib2 -ij 10 small.grb2
    +
    +*** FATAL ERROR: no input file defined ***
    +
    + +*** FATAL ERROR: rdieee: bad header *** +

    +Wgrib2 is trying to read a f77-style binary file (-import_ieee). + +

    +(header)		4 byte integer, 4*n
    +(ieee floating point)   grid point 1
    +(ieee floating point)   grid point 2
    +...
    +(ieee floating point)   grid point n
    +(trailer)		4 byte integer, 4*n
    +
    +

    +However, either the header is missing or the header has an unexpected value. +The size of the record (4*n) should be the same as the size of the +grib message that was read in. +

    +

    +(No Output) + +

    +bash-4.1$ wgrib2 open.gs
    +bash-4.1$ 
    +
    + +

    If wgrib2 fails to find a grib2 message, nothing is written out to stdout. +If wgrib2 finds a grib1 message, a warning is written to stderr. + + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 19, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/process.html b/docs/web_docs/process.html new file mode 100644 index 0000000..b06cf4d --- /dev/null +++ b/docs/web_docs/process.html @@ -0,0 +1,190 @@ + + + + Climate Prediction Center - wgrib2: -process + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-process +
     
    + +

    wgrib2: -process

    +
    + + +

    Introduction

    + +

    +The -process option prints out + +Code Table 4.3. Code Table 4.3 is important because it defines +the product such as analysis, forecast, or forecast error. The +table also change the units of the field as in a probabilty forecast. +You may encounter products that have identical metadata +except for this table (analysis vs analysis error). In the default +wgrib2 inventory, values of Code Table 4.3 which are not +probabiity forecasts, analysis errors or forecast errors are noted. +

    + +

    Usage

    + +

    +

    +-process
    +
    + +

    Example

    +
    +$ wgrib2 -process png.grb2
    +1:4:code table 4.3=4 ens fcst
    +
    + +See also: + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: September 5, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/processid.html b/docs/web_docs/processid.html new file mode 100644 index 0000000..e2e0d84 --- /dev/null +++ b/docs/web_docs/processid.html @@ -0,0 +1,188 @@ + + + + Climate Prediction Center - wgrib2: -processid + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-processid +
     
    + +

    wgrib2: -processid

    +
    + + +

    Introduction

    + +

    +The -processid option prints + +

    +Background generating process identifier (defined by originating centre)
    +Analysis or forecast generating process identified (see Code ON388 Table A)
    +
    + +which are octets 13 and 14 in section 4 in many of the Product Definition Templates +such 4.0. + +

    Usage

    +
    +-processid
    +
    + +

    Example

    +

    + +

    +$ wgrib2 png.grb2 -pdt
    +1:4:background generating process=0 forecast generating process=80
    +
    +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 28, 2015 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/proj4.html b/docs/web_docs/proj4.html new file mode 100644 index 0000000..24a5ded --- /dev/null +++ b/docs/web_docs/proj4.html @@ -0,0 +1,317 @@ + + + + Climate Prediction Center - wgrib2: -gctpc, -proj4 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -gctpc,-proj4 +
     
    + +

    wgrib2 geolocation: -gctpc, -proj4

    +
    + + +

    Introduction

    + +

    +Wgrib2 has 3 sets of geolocation libraries. Geolocation libraries +can convert the grid points (i,j) to (lon,lat). +Some geolocation libraries can convert (lon,lat) to (lat,lon). +There is no "best" set of routines. Some grids can only be handled +by a one library. Some calculations are a specific library. + +

    +Internal Routines +

      +
    1. Spherical Earth only +
    2. Very fast and multithreaded, 3.5/12.7 sec on test case 1* +
    3. Very fast and multithreaded, 3.5/12.7 sec on test case 2* +
    4. Needed for NWP grids such as Gaussian grids and rotated lat-lon +
    5. Common projections +
    6. C, no configure file needed +
    7. Can transform (i,j) to (lon,lat) +
    8. Many of the codes trace their origins to operational codes at NCEP +
    + + +

    +GCTPC library +

      +
    1. Handles ellipsoidal Earth +
    2. Slow and multithreaded (OpenMP), 5.5/19.5 sec on test case 1* +
    3. Slow and multithreaded (OpenMP), 15.7/58.7 sec on test case 2* +
    4. More projections than internal routines but not the NWP grids +
    5. C, no configure file needed +
    6. Can transform (i,j) to (lon,lat) +
    7. Can transform (X,Y) to (lon,lat) +
    8. Can transform (lon,lat) to (X, Y) +
    9. Library is old but working, no recent development +
    10. Support for library is unknown +
    +

    +Proj4 library +

      +
    1. Handles ellipsoidal Earth +
    2. Slow and no support for OpenMP, 17.8/19.7 sec on test case 1* +
    3. Slow and no support for OpenMP, 62.8/64.7 sec on test case 2* +
    4. Proj4 supports pthreads, wgrib2 uses OpenMP +
    5. More projections than GCTPC, ex. ellipsoidal Lambert Azimuthal Equal Area grid +
    6. C, requires config script +
    7. Can transform (i,j) to (lon,lat) +
    8. Can transform (X,Y) to (lon,lat) +
    9. Can transform (lon,lat) to (X, Y) +
    10. Library has active development +
    11. Support for library is good +
    12. The first choice by many people. +
    + +
    +* test case 1 - read large Lambert conformal grid (6887 x 6610) and 
    +calculate lon/lat for the entire grid and print lon/lat for 1 grid point.
    +This uses a spherical Earth.
    +
    +* test case 2 - read large Lambert conformal grid (6887 x 6610) and 
    +calculate lon/lat for the entire grid and print lon/lat for 1 grid point.
    +This uses a ellipsoidal Earth.
    +
    +The timing code is
    +
    +  time wgrib2 burned_area_20120131_12_23_1km.grib2.c0 -ijlat 4 3
    +  time wgrib2 burned_area_20120131_12_23_1km.grib2.c0 -ijlat 4 3 -gptpc 1
    +  time wgrib2 burned_area_20120131_12_23_1km.grib2.c0 -ijlat 4 3 -proj4 1
    +
    +and the two numbers correspond to the wall clock and CPU times for a 4
    +core Intel Xeon E5506 with OMP_NUM_TREADS=4.
    +
    +grid:
    +  Lambert Conformal: (6887 x 6610) input WE:NS output WE:SN res 0
    +  Lat1 64.997800 Lon1 180.492400 LoV 264.000000
    +  LatD 40.000000 Latin1 20.000000 Latin2 60.000000
    +  LatSP 0.000000 LonSP 0.000000
    +  North Pole (6887 x 6610) Dx 1000.000000 m Dy 1000.000000 m mode 0
    +
    +Earth:
    +  case 1: code3.2=0 sphere predefined radius=6367470.0 m
    +  case 2: code3.2=4 IAG-GRS80 ave radius=6367444.5 m
    +
    +Packing: grid point data - complex packing,c1 
    +
    + +

    +The internal routines are fast, multithreaded but only handle +a spherical earth and cannot transform from (lon,lat) -> (X,Y). +The internal routines include grids not included with GCTPC. + +

    +The GCTPC routines can handle an ellipsoidal Earth. They are +50% slower than the internal routines for a spherical earth and +are acceptable for NOMADs. For an ellipsoidal Earth, the speed is +probably adequate for NOMADS. The lack of support is not a major factor +because the codes are tested and relatively simple. By supporting +both GCTPC and Proj4, I am comfortable that the codes can be +adequately tested. + +

    +Proj4 is the Gold standard; it used by many projects, it has +good support and updates appear on a regular basis. Proj4 supports +more projections than GCTPC. Unfortunately Proj4 is slow. For a +spherical Earth, Proj4 is probably adequate (slower than gctpc +for a spherical earth). For an ellipsoidal Earth, Proj4 is +too slow for Nomads. There have been some efforts to make Proj4 +thread safe. Another difficulty with Proj4 is that compiling +uses a config script. Config scripts can cause problems +when cross-compiling for compute nodes (some HPC computers). +

    + +

    +Wgrib2 needs the internal routines for grids not supported by +GCTPC/Proj4. Wgrib2 needs GCTPC/Proj4 for handling ellipsoidal +Earths. The current policy is that Proj4 will be an optional +package and GCTPC will be come the default package in the +near future. Support for Proj4 is useful for debugging and +for "keeping the options open". +

    + + +

    Usage

    + +

    +

    +-gctpc 0
    +   do not use gctpc for geolocation
    +-gctpc 1
    +   enable gctpc for geolocation
    +-proj4 0
    +   do not use Proj4 for geolocation
    +-proj4 1
    +   enable Proj4 for geolocation
    +
    +   Priority up to wgrib2 v3.1.1:
    +     Try Proj4 if Proj4 is enabled (not default) and installed (not default)
    +     Try gctpc if gctpc is enabled (default)
    +     try internal routines  
    +
    +   Priority wgrib2 v3.1.2+:
    +     ?? Try gctpc if gctpc is enabled (default)
    +     ?? Try Proj4 if Proj4 is enabled (not default) and installed (not default)
    +     ?? try internal routines  
    +
    +
    +     note: older version of the priority was wrong.
    +
    +   Note: some grids are only  supported by the internal routines
    +
    + + + +See also: +-geolocation + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 30, 2014, April 13, 2020, 10/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/py_wgrib2api.html b/docs/web_docs/py_wgrib2api.html new file mode 100644 index 0000000..17e64d6 --- /dev/null +++ b/docs/web_docs/py_wgrib2api.html @@ -0,0 +1,206 @@ + + + + Climate Prediction Center - wgrib2: py_wgrib2api + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 py_wgrib2api +
     
    + +

    wgrib2: py_wgrib2api

    +
    + + +

    Introduction:

    + +

    +Pywgrib2_s calls the C library, wgrib2lib. It is limited to calling these wgrib2 routines +specific routines. Sure the python code could call other routines in wgrib2lib but it +is not advised. The other routines in wgrib2lib should be considered internal routines +that may change or even disappear. + +

    +Convention: pywgrib2_s only uses routines that start with wgrib2.
    +
    +
    +int wgrib2(int argc, char **argv)
    +  call to wgrib2 routine
    +
    +int wgrib2_free_file(char *filename)
    +  frees the file, filename
    +
    +
    +REGISTER
    +
    +int wgrib2_get_regsize(int i)
    +  return number of elements in register i
    +
    +int wgrib2_get_reg_data(float *data, size_t size, int i)
    +  size = number of elements of data
    +  gets contents of register i
    +
    +int wgrib2_set_reg(float *data, size_t size size, int i)
    +  size = number of elements of data
    +  sets contents of register i
    +  
    +
    +MEMORY BUFFER
    +
    +
    +int wgrib2_get_mem_buffer_size(int i)
    +  return size in bytes of buffer i
    +
    +int wgrib2_set_mem_buffer(unsigned char *buffer, size_t size, int ii)
    +  size = size of buffer (bytes)
    +  i = buffer number
    +
    +int wgrib2_get_mem_buffer(unsigned char *buffer, size_t size, int i)
    +  size = size of buffer (bytes)
    +  i = buffer number
    +
    +
    + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 29, 2016. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/pywgrib2.html b/docs/web_docs/pywgrib2.html new file mode 100644 index 0000000..96a7f99 --- /dev/null +++ b/docs/web_docs/pywgrib2.html @@ -0,0 +1,251 @@ + + + + Climate Prediction Center - pywgrib2_* + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2 +
     
    + +

    pywgrib2

    +
    + + +

    Introduction

    + +

    +The wgrib2 utility can handle many grib tasks without programming. For more +complicated tasks, wgrib2 now has IF-ELSE-ENDIF blocks. However, +for some tasks, you need to drive wgrib2 from another program. Calling +the wgrib2 utility has been done, but it requires many CPU cycles +(call shell, initialize shell, call wgrib2, free resources), and all communications have +to be done through files or pipes. Reading and writing of grib files +can be done but the performance is suboptimal. + +

    +One day, a user sent me revisions to make wgrib2 a C subroutine. He was +able to call the new wgrib2 subroutine from a C program to read and write grib files. +This development lead to a fortran API +for reading and writing grib files. This fortran API is higher level +interface than direct calls to wgrib2 and makes reading and writing grib easy. +Performance was good if the introduced memory files were used. + +

    Another day, another user sent me code for a python interface to wgrib2. +This interface also builds on the wgrib2 subroutine. Since the users/developers have +varied needs, there will different levels of the python interface. + +

      +
    1. pywgrib2_s .. s is for simple +
        +
      • simple, minimal requirements +
      • Requirements: python3.5+, numpy, and wgrib2 shared library +
      • read, write grib, based on an extension of the ftn wgrib2api +
      • Inventory file is optional for reading but can speed up processing +
      • Simple python code, guts in 1-3 weeks by person with minimal Python experience. +
      • Most of the development time was spent on learning python, polishing and documentation. +
      • See pywgrib2_s main page +
      • pywgrib2_s is in beta testing. +
      +
    2. pywgrib2_lite .. lite version +
        +
      • Requirements: python3.6+, numpy, and wgrib2 shared library +
      • more conventional python experience +
      • alpha testing started, request info to be tester +
      +
    3. pywgrib2_xr .. for xarray + + +
    4. Common Features of various versions of pywgrib2_* +
        +
      • Based on wgrib2 v3.0.0+ library. +
      • OpenMP for faster processing of large grids +
      +
    + +

    Expected Reliability

    + +

    +Software has errors because the code in the routines have a problem +or because how the routines are called have problems. Problems can +be simple coding errors to invalid assumptions. Testing is important, +and writting test code is both error prone and often covers too few cases. + +

    +The pywgrib2_s is expected to have higher reliability than expected by +its age and utility because, +

      +
    • The wgrib2 library is used by the wgrib2 utility which is widely used and operational at NCEP. +
    • Wgrib2 is open source which encourages users to find and debug errors. +
    • Only a handful of routines in the wgrib2 library are called by pywgrib2_s. +
    • Only a few routines in the wgrib2 library are called by pywgrib2_s but not by the +wgrib2 utility. Thereby + reducing the number of codes that are infrequently used. Even the infrequently used + codes are called by the fortran wgrib2api. +
    • Only a handful of routines in the wgrib2 library are directly called by pywgrib2_s reducing + the errors in "calling the routines". +
    • Much of the testing can be done by running the wgrib2 utility reducing errors in + coding testing programs. +
    • pywgrib2_s.py started small (5-13-2020: 292 lines including 51 blank lines, and 63 lines of comments) +
    • pywgrib2_s.py is still small (9-16-2020: 668 lines including 92 blank lines, and 100 lines of comments) +
    + +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Sep 16, 2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/pywgrib2_s.html b/docs/web_docs/pywgrib2_s.html new file mode 100644 index 0000000..93b5dfb --- /dev/null +++ b/docs/web_docs/pywgrib2_s.html @@ -0,0 +1,343 @@ + + + + Climate Prediction Center - pywgrib2_s: top page + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2_s: +
     
    + +

    pywgrib2_s: Home Page

    +
    + + +

    Introduction

    + +

    +Pywgrib2_s is a python package for reading and writing grib2 which is a World +Meterological Organization (WMO) format for exchanging meteorological and oceanographic +gridded data. The specifications for the grib2 (grib version 2) format are available from +the WMO, and several libraries are available for reading and writing grib2. Pywgrib2_s +is based on the fortran wgrib2api and the wgrib2 library. + +

    The design goals of pywgrib2_s are a simple interface, minimal requirements for +additional python modules/packages, and the ability to program for efficient I/O. +Since pywgrib2_s is uses the wgrib2 library, search terms are based on wgrib2 terms. +For example, searching for the 2 meter temperature is done by, var="TMP", lev="2 m above ground". + +

    8/2020: I am using the alpha pywgrib2_s in my work, with no problems. The problems +that I am using it are a bit too complicated for a wgrib2 script, and not so resource +intensive that I that I need fortran. + + +

    Basics: Grib Data Model

    + +

    The grib data model is more complicated than the data model for the natural world. +For example, the earth's temperature is defined by a location and time (x,y,z,t). Grib was developed +for forecast centers has more characteristics such as forecast time, averaging period, +ensemble member, and numerical model that created the forecast. When you consider +tracer gases, you add chemical type. Aerosols add the composition and size of the pariculate matter. +Forecasts can be deterministic or probabalistic. + + +

    Grib files often have multiple vertical coordinate systems. Meteorologists often +use pressure or isentropic coordinates. The aviation community often use height above a +constant geopotential. The people on the ground often want meters above ground. +The ocean fields and soil fields will have their own vertical coordinates. + +

    A grib file does not include an index, usually a software package includes +a mechanism for making an index file. Pywgrib2_s uses the human-readable wgrib2 +inventory. Not having a included index has its advantages and disavantages. +Having a human-readable index has been very advantageous. + +

    +A grib field has many characteristics to uniquely identify it. So pywgrib2_s has +taken the approach that characteristics of the field will be text string which +grow in time as the grib standard adds more characteristics. To find a field, +you provide search terms that compared with the inventory. + + +

    Naming Convention

    +

    +Grib is an international standard which doesn't specify a naming standard. For +example a pressure surface of 1000 Pascals, could be called "10 mb" (non-SI unit), +"10 hPa" (used in scientific literature), "1 kPa" (SI unit) or even 0.2953 inch of nercury. +At NCEP, geopotential height has the name HGT. This is a local convention. +Pywgrib2_s, like wgrib2, use the NCEP +NCEP naming convention. Grib allows locally defined tables, and pywgrib_s/wgrib2 wgrib2 +follows the recommendation of the defining site. + + + +

    Reading and Writing Grib

    + +
    + mk_inv(grib, inv_file)                   makes inventory file
    + read_inv(inv_file)                       reads inventory file, returns list
    + inq(grib,...)                            inquire about grib2 file
    +                                            read metadata, grid point data,
    +                                            calculate lat-lon of grid points for common grids
    + write(grib,...)                          write grib2
    + close(file)                              close file, used to flush, free up resources,
    +
    + +

    Memory Files

    +The above routines read and write files. Using the the filesystem would be a bottleneck for many +applications, so wgrib2 added memory files. These memory files resided in the memory space +of wgrib2 and can be accessed from python. + +
    + memory file:  @mem:N   N = 0,1,..,29   memory files 10-29 are reserved for use by pywgrib2_s
    +
    + get_bytes_mem(fileno)                    returns bytes (buffer) from from memory file number "fileno"
    + get_dbl_mem(fileno)                      reserved for future use
    + get_flt_mem(fileno)                      returns numpy.ndarray (numpy array) with float32 values
    + get_str_mem(fileno)                      returns text string from memory file number "fileno"
    + mem_size(fileno)                         returns size of memory file number "fileno" in bytes
    + set_mem(fileno,buffer)                   copy buffer to memory file number "fileno"
    +                                          buffer can be type bytes, str or numpy.ndarray
    +                                          set_mem(12,'') will empty @mem:12
    +
    +

    Multi-Threading

    +Pywgrib2_s uses the multi-threaded wgrib2 library to speed up execution. You control the number +of threads by setting the environment variable OMP_NUM_THREADS. You rarely set the number +of threads greater than 5 because the speedup becomes minor in most cases. + +

    +There are a few wgrib2 operations that can use as many cores as possible +(ex. -ensemble processing, -lola for certain grids). For calls to wgrib2(..), +the number of threads can be controlled by -ncpu option. + +

    Global Variables

    + +

    Pywgrib2_s uses global variables for the + +

      +
    1. configuration +
    2. +output of pywgrib2_s.inq(..) +
    + +

    Low level Access: wgrib2

    +

    +The pywgrib2_s is a python module that calls wgrib2. Sometimes you may +need to know the version and configuration of the wgrib2 library. +The pywgrib2_s.wgrib2(..) will let you directly call wgrib2. + + +

    + wgrib2_version()                           returns a string with the version of the
    +                                            wgrib2 library. Same as wgrib2 -version
    +
    + wgrib2_config()                            returns list of strings with the configuration 
    +                                            of the wgrib2 library. Same as wgrib2 -config
    +
    + wgrib2( [ (list of wgrib2 arguments) ] )   call wgrib2
    +
    +
    +
    + +

    Low Level Access: Registers

    +Registers are part of the reverse polish notation calculator (-rpn). They are used by the internals +of pywgrib2_s, and should only be used by programs that make direct calls to wgrib2. + +
    + reg_size(regno)                            returns size of register number "regno" in elements
    + reg_shape(regno)                           reserved for future use
    + get_flt_reg(regno)                         returns numpy.ndarray (numpy array) with floating point 32 value
    + get_dbl_reg(regno)                         reserved for future use
    + set_reg(regno, array)                      copy array (numpy.ndarray) to RPN register "regno"
    +
    + +

    Requirements:

    + +

    The requirements for pywgrib2_s are + +

      +
    1. python 3.5+, numpy +
    2. Linux (tested: Ubuntu, Redhat, SUSE), MacOS, Windows (tested: Cygwin-64) +
    3. shared wgrib2 library created using wgrib2 v3.0.2 +
    4. Linux compilers: gcc/gfortran, AOCC clang/flang, NVidia HPD sdk nvc/nvfortran +
    5. MacOS compilers: homebrew gcc/gfortran (gcc may be a wrapper for clang) +
    6. Windows compilers: cygwin gcc/gfortran +
    + +

    Cookbook

    + +

    A living cookbook of pywgrib2_s "recipes" is being maintained. +The cookbook serves as a learning tool for beginners, a simple +validation tool, testbed for testing the utility of the API, and +and starting point for writing some code. + +Li Xu of CPC has provided some documentation for the +cookbook and pywgrib2_s routines. + + + + + +

    Installation:

    + +See Installation directions + + +

    Code Timeline

    +
      +
    • wgrib2: released 2004 +
    • wgrib2 can be built as subroutine that can be called from C or Fortran, wgrib2 library (2015) +
    • alpha version of pywgrib2 using wgrib2 library by George Trojan (2/2020) +
    • wgrib2 v3.0.0 with alpha-beta pywgrib2_s (9/2020) and pywgrib2_xr afterwards +
    • wgrib2 v3.0.2 with updates for pywgrib2_* including Windows support (3/2021) +
    + +

    +See also: +pywgrib2_s conventions +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Created: Aug 11, 2020, Modified: 6/2021, 7/2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/pywgrib2_s_close.html b/docs/web_docs/pywgrib2_s_close.html new file mode 100644 index 0000000..164ecb8 --- /dev/null +++ b/docs/web_docs/pywgrib2_s_close.html @@ -0,0 +1,201 @@ + + + + Climate Prediction Center - pywgrib2: close(file) + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2: close(file) +
     
    + +

    pywgrib2: close(file)

    +
    + + +

    Introduction

    + +

    +Pywgrib_s opens a file when you use it, and automatically closes +the file when the program ends. You may want to manually close file +because + +

      +
    1. the system limits the number of open files, and you + need to close some files before reaching the system limit. +
    2. You need to flush the file buffes so a program other than pywgrib2_s + can read the file. +
    3. pywgrib2_s had an error and the file state needs to be cleaned. +
    4. free up memory used to buffer the reads or writes to a no longer used file +
    + + +

    Example

    +
    +>>> pywgrib2_s.mk_inv('a.grb','a.inv',Short=True)
    +0
    +>>> pywgrib2_s.close('a.grb')
    +0
    +>>> pywgrib2_s.close('not-a-file')
    +1
    +
    +

    Usage

    +
    +     a=pywgrib2_s.close(file)
    +         if file is a memory file, the memory file is set to zero length
    +         if file is open, it closes the file, frees the resources, and returns 0
    +                closing the file will flush any write buffers
    +         if file not open, it returns 1
    +
    + + +

    +overview +back + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 10, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/pywgrib2_s_conventions.html b/docs/web_docs/pywgrib2_s_conventions.html new file mode 100644 index 0000000..ceee73b --- /dev/null +++ b/docs/web_docs/pywgrib2_s_conventions.html @@ -0,0 +1,213 @@ + + + + Climate Prediction Center - pywgrib2_s: conventions + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2_s: conventions +
     
    + +

    pywgrib2_s: conventions

    +
    + + +

    Conventions

    + +

    +What is a convention? In the year 2020, a convention is a gathering to +decide who runs for political office. In bridge, a convention is an +understanding that certain artifical bids have special meanings. For example, +a opening 4 no trump bid asks the partner to disclose the number aces in his hand. +The pywgrib2_s conventions are more like the bridge conventions. + +

    Optional Parameter name starts with an uppercase

    +

    The optional parameter expects a logical value, and the default value is False. + +

    Optional Parameter has a default value of "" (empty string)

    + +

    The optional parameter expects a string value, and an empty string turns off +the option. + + +

    Optional Parameter has a default value of None

    + +

    The optional parameter expects something besides a string or logical value. +It may exoect a number, a numpy array, or mutiple types of input. + + + +

    Undefined Grid Values

    + +Most reasonable computers have floating values that can be NaN (not a number). +Using NaN can be a problem because "if (x == NaN)" is not the way to test +if x is a NaN. Pywgrib2_s uses the numpy.nan for the NaN. Some codes may +be based on wgrib2 scripts which use 9.999e20 as the value for undefined grid point value. +You can change pwgrib2_s to use the wgrib2 convention by setting pywgrib2_.s.use_numpy.nan to False. +Note that numpy.nan is not the same as math.nan; for example (math.nan is numpy.nan) is false. + +

    Numpy Arrays

    +The grid values, lat and lon arrays are returned as numpy arrays. The arrays +are in Fortran order, and in WE:SN order. In english, +
      +
    • a[i+1,j] is stored after a[i,j] in memory +
    • for a lat-lon grid: a[i,j] and a[i+1,j] have the same latitude +
    • for a lat-lon grid: a[i+1,j] is east of a[i,j] by delta-longitude degrees +
    • for a lat-lon grid: a[i,j] and a[i,j+1] have the same longitude +
    • for a lat-lon grid: a[i,j+1] is north of a[i,j+1] by delta-latitude degrees +
    + + +

    Debugging

    + +Change the global variable pywgrib2_s.debug to True. + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page created July 12, 2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/pywgrib2_s_global_variables.html b/docs/web_docs/pywgrib2_s_global_variables.html new file mode 100644 index 0000000..2121157 --- /dev/null +++ b/docs/web_docs/pywgrib2_s_global_variables.html @@ -0,0 +1,197 @@ + + + + Climate Prediction Center - pywgrib2: global variables + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2: global variables +
     
    + +

    pywgrib2: global variables

    +
    + + +

    Introduction

    + +

    +Pywgrib_s has two types of global variables. The first type is the +output of the pywgrib2_s.inq(..) routine, such as the size of +the grid, the grid values and grid locations. The second type +are the configuration options of pywgrib2_s. + + +

    Output global variables

    + +
      +
    1. nx: integer, size of matched grid in zonal direction +
    2. ny: integer, size of grid in meridional direction +
    3. ndata: integer, size of grid +
    4. nmatch: integer, number of matches by inq(..) +
    5. msgno: integer, grib message number +
    6. submsgno: integer, submessage message number +
    7. data: float32s, grid point values +
    8. lat: float32s, grid point latitudes +
    9. lon: float32s, grid point longitudes +
    10. secN: bytes, byte values of secN N=0..8 +
    11. matched: list of strings of matched fields +
    12. grid_defn: string of grid definition +
    + +

    Configuration global variables

    + +
      +
    1. use_numpy_nam: logical, undefined grid value is numpy.nan (true) or 9.999e20 (False) +
    2. names: string, either 'ncep', 'ecmwf' or 'dwd', convention for WMO grib names +
    3. debug: logical, print debug statements (True) +
    + +overview + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + modified: 7, 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/pywgrib2_s_inq.html b/docs/web_docs/pywgrib2_s_inq.html new file mode 100644 index 0000000..0e57c0a --- /dev/null +++ b/docs/web_docs/pywgrib2_s_inq.html @@ -0,0 +1,346 @@ + + + + Climate Prediction Center - pywgrib2: inq(..) + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2: inq(..) +
     
    + +

    pywgrib2: inq(..)

    +
    + + +

    Introduction

    + +

    +Pywgrib_s.inq(..) does an inquiry about a grib file. At its most basic level, +you give zero or more search terms, and the inquiry says how many fields matched +your search terms. You can also get the metadata and grid information for all the matched +fields. For the last match, you can get additonal information like, + +

      +
    1. nx number of grid points in longitudinal direction +
    2. ny number of grid points in latitudinal irection +
    3. ndata number of grid points in grid +
    4. msgno grib messsage number +
    5. submsgno grib submessage number +
    6. data (optional) grid point values in WE:SN order +
    7. lon (optional) longitude values of grid in WE:SN order +
    8. lat (optional) latitude values of grid in WE:SN order +
    + +

    Arguments to inq()

    + +

    File to Read: Grib file

    +

    The function, inq, has only one positional parameter, a name of a grib file. +All other parameters are optional. If you call inq with no options, then +there are no constraints of the fields that match. The call will return the +number of fields in the file. + +

    +>>> import pywgrib2_s
    +finished loading libraries
    +pywgrib2_s v0.0.10 11-9-2020 w. ebisuzaki
    +>>> pywgrib2_s.inq('a.grb')
    +9796
    +>>> 
    +
    + +

    Specifying Fields to Examine

    + +

    By Search Terms: Text Searchs

    +

    +After the grib file, you can enter any number of text search terms. +The search terms will be compared with the inventory file or automatically +generated inventory file if an inventory is not provided. + +

    Each line of the inventory file corresponds to a grib message or submessage. +For a search to be sucessful, each search term must be found in the same line. +The comparison is done as a text string unless the option Regex is set to True. +In that case, a regular expression comparison is done. + +

    By Record number, byte location: select='select string'

    + +The optional select='select string', allows one to select a specific field by grib message +number or byte location. Since a grib message may have submessages, you may have +to indicate which submessage is being selected. The byte location option is faster +because the routine doesn't have to read from the start of the file to find the selected +grib message. + +

    You can select the grib message to process by the select string option. +The format of the string is + +

  • 'N.M' where N is the grib message number and M is the submessage number +
  • 'N' where N is the grib message number (M is assumed to be one) +
  • 'N.M:byte_location where the byte location of the message starting from zero, N is unused +
  • 'N:byte_location where the byte location of the message starting from zero and M is one + + +

    Faster with inv file

    + +

    Optional: inv='inv file name'

    + +

    The inv file is a human readable index file. With experience, +the inventory becomes comprehensible. +If a inv file is specified, the inventory file will be used to find +the matching messages. This is much faster than reading the grib +file to find the matching grib messages. +

    You can use any 1-line/field wgrib2 inventory for your "inv file". +However, it is recommended that you use the inventory from the +-Match_inv option from wgrib2 because then the match results with/without +an inventory file will be the same. + +

    Inquires: What's in selected fields

    + + +

    Grid point values: Data=Logical

    +

    +If Data is True, the grid point values of the last match are saved +in pywgrib2_s.data as a numpy ndarray in WE:SN order. +The default value is Data=False. If no grid point values are saved, +the value of pywgrib2_s.data is None. Currently the ndarray uses +float32 but that will change to float64 if/when wgrib2 moves to float64 +data. + +

    Latitude, Longitude for grid points: Latlon=Logical

    +

    +If Latlon is True, the latitude and longitude values of the last match are saved +in pywgrib2_s.lat and pywgrib2_s.lon as a numpy ndarray in WE:SN order. +The default value is Latlon=False. If the locations are not requested +or cannot be calculated, the value of pywgrib2_s.lat and pywgrib2_s.lon are None. +Currently the ndarray uses float32 but that will change to float64 in the future. + +

    Contents of Grib Sections: SecN=Logical, N=0..8

    +

    +A grib message (record) consists of sections 0..8. If SecN is True, the +byte values of SecN are stored in pywgrib2_s.secN. The default value +of SecN is False. Using the data in pywgrib2_s.secN requires a knowledge +about grib. + + +

    List of the matched fields: Matched=Logical

    +

    +If Matched is True, a list of the fields matched are saved in +pywgrib2_s.matched. The number of matches is given by the +return value if pywgrib2_s.inq(..) and by len(match) when Matched is True. +The default value of Matched is False. + +

    List of the grid definitions of the matched fields: Grid_defn=Logical

    +

    +If Grid_defn is True, a list of the grid definitinos of the matched fields is +saved as a list in pywgrib2_s.grid_defn. The number of matches is given by the +return value if pywgrib2_s.inq(..) and by len(grid_defn) when Grid_defn is True. +The default value of Matched is False. + +

    Saving the matched fields

    + +

    Save matched fields in grib: grib='output grib file'

    +If grib is not '', the grib messages that are matched are copied to the 'output grib file'. +If the 'output grib file' has been not opened, the default is to create a new file. +If the input grib message has submessages, only the submessage that is matched is written +to the file grib. + +

    Open 'grib file' as append: Append_grib=Logical

    +If you wish to append grib message to an existing 'output grib file', +you need to add the parameter Append_grib=True. The default value is False. +Otherwise the initial open of 'output grib file' will create a new file. + +

    Saving matched fields in binary: bin='binary file'

    +If bin is not '', the grid point data will be written to 'binary file'. The format is the native +single precision with no headers or trailers. The data will be written in WE:SN order. +If the 'binary file' has not been opened, the default is to create a new file. + +

    Open 'binary file' as append: Append_bin=Logical

    +If you wish to append binary data to an existing 'binary file', +you need to add the parameter Append_bin=True. The default value is False, and +the initial open of 'binary file' will create a new file. + + +

    Misc

    + + +

    Text search terms are regular expressions: Regex=Logical

    +

    +By default, the text search is done using "fixed strings". The search is +done using no wildcards or metacharacters like the fgrep utility. If Regex is set to True, +the search term is a "regular" expression like the egrep utility. + +

    Read/Search sequentially: Sequential=integer

    +

    +Often you need to process a file sequentially; for example, copy all the +temperatures fields to another file. Sometimes, you want to process a file +sort of sequentially; for example, find the next zonal wind, find the +corresponding meridional wind and write both files to a file, and repeat +until there are now more zonal winds. Pywgrib2_s handles the second +set which is a superset of the first. + +

    Pywgrib2_s.write(..) can read a inventory file sequentially. To handle +the above second case, you create two inventory files. The first inventory +file is read sequentially. The second inventory file is to find the associated +fields. + +

    To start a sequential read, you add "sequential=0" in the call to pywgrib2_s.write(..). +For the remainder of the sequential reads, "sequential=N" where N is a integer greater than zero. + + + +

    + +Add more text here. + +

    + +overview +back +next + + +

  • + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: 8/2020 8/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/pywgrib2_s_install.html b/docs/web_docs/pywgrib2_s_install.html new file mode 100644 index 0000000..ae7c8c2 --- /dev/null +++ b/docs/web_docs/pywgrib2_s_install.html @@ -0,0 +1,241 @@ + + + + Climate Prediction Center - pywgrib2_s: installation + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2_s: installation +
     
    + +

    Installation

    + +

    Requirements:

    + +
      +
    1. python 3.5+, numpy +
    2. Linux (tested: Ubuntu, Redhat, SUSE), MacOS +
    3. wgrib2 v3.0.2+ shared library +
    + +

    Installation:

    + +
      Step 1: Make or obtain a wgrib2 shared library +
    1. To make the wgrib2 shared library +
    2. cd to the directory where you want to place the wgrib2 source code: cd XYZ +
    3. get the latest source code to wgrib2 (wgrib2.tgz): +
    4. $ wget "https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz" +
    5. untar the source code: $ tar -xzvf wgrib2.tgz +
    6. cd to the grib2 directory: $ cd grib2 +
    7. edit makefile, change "MAKE_SHARED_LIB=0" to "MAKE_SHARED_LIB=1" +
    8. optional edit makefile to user customizations +
    9. set the C and fortran compilers (must be gcc and gfortran), this is the bash compile +
    10. $ export CC=gcc +
    11. $ export FC=gfortran +
    12. $ make lib +
    13. check for the shared library, linux: lib/libwgrib2.so, mac: lib/libwgrib2.dylib +
    + +
      Step 2: find a directory on the python path (PYDIR) +
    1. try .local/lib/pythonN.M/site-packages/ N.M = python version N.M >= 3.5 (lowest version tested) +
      +   # .local/lib/pythonN.M/site-packages will not appear on search path unless already created
      +   cd
      +   mkdir -p .local/lib/pythonN.M/site-packages
      +
      +
    2. query python for directories +
      +   >>> import sys
      +   >>> sys.path
      +
      +
    3. The above script will not show missing directories on the path. +
    4. Choose an appropriate directory with write permission. +
    5. If you cannot find a writable directory, change the python path to create such a directory. +
    + +
      Step 3: Get pywgrib2_s.py PYDIR +
    1. download https://ftp.cpc.ncep.noaa.gov/wd51we/pywgrib2_s/pywgrib2_s.tgz +
    2. extract contents, tar -xzvf pywgrib2_s.tgz +
    + +
      Step 4: install wgrib2 shared library +
    1. shared library is named libwgrib2.so (use libwgrib2.dylib for Darwin) +
    2. for pywgrib2_s version 0.0.x, copy shared wgrib2 lib to PYDIR +
    3. pywgrib2_s 1.0.0+ has a search order for the shared library. +
        +
      1. name of shared library is given by environment varible $WGRIB2_LIB +
      2. shared library (libwgrib2.so) is saved in PYDIR +
      3. shared library (libwgrib2.so) is found in system defined library +
      +
    +
      Step 5: test using the cookbook +
    1. wget https://ftp.cpc.ncep.noaa.gov/wd51we/pywgrib2_s/pywgrib2_s_cookbook.tgz +
    2. Try running the cookbook_*.py scripts from the shell. +
    + +

    Multiple versions of shared wgrib2 library:

    +

    +The libraries used by pywgrib2_s may conflict with those used by +the calling program. In such cases, you have to compile wgrib2 without +the offending libraries. This may reduce the functionality of pywgrib2_s/wgrib2 +but you will have to work around this problem. The end result can be +multiple versions of libwgrib2.so. In such cases, +the environment variable $WGRIB2_LIB will have to be used to specify +except for the default library. + +

    System Installations

    +

    +The above instructions suggested that .local/lib/pythonN.M/site-packages +may work for PYDIR. This suggestion is for an person to install on one's account. For +a system install, you need to be root and place it in a root owned +directory on the python path. + +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Created: Aug 11, 2020, Modified: Oct 6, 2020, June 2021. 11/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/pywgrib2_s_mk_inv.html b/docs/web_docs/pywgrib2_s_mk_inv.html new file mode 100644 index 0000000..148552e --- /dev/null +++ b/docs/web_docs/pywgrib2_s_mk_inv.html @@ -0,0 +1,209 @@ + + + + Climate Prediction Center - pywgrib2_s: mk_inv + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2: read_inv(inv_file) +
     
    + +

    pywgrib2_s: mk_inv

    +
    + + +

    Introduction

    + +

    +The routine pywgrib2_s.mk_inv(grib_file, inv_file) reads a grib_file and writes +the inventory to inv_file. Both the grib_file and inv_file can be memory files. +The inventory will change with the version of wgrib2 by the addition of new fields. + +

    Example 1

    +
    +>>> pywgrib2_s.mk_inv('a.grb','a.inv')
    +0
    +>>> a=pywgrib2_s.read_inv('a.inv')
    +>>> print(a[0])
    +1:0:D=20200101000000:CDCON:high cloud layer:0-6 hour ave fcst::CDCON:n=1: ..
    +>>> print(a[1])
    +2:2808:D=20200101000000:CDCON:middle cloud layer:0-6 hour ave fcst::CDCON: ..
    +
    + +

    Example 2

    +
    +>>> pywgrib2_s.mk_inv('a.grb','a.inv',Short=True)
    +0
    +>>> a=pywgrib2_s.read_inv('a.inv')
    +>>> a[0]
    +'1:0:D=20200101000000:CDCON:high cloud layer:0-6 hour ave fcst:'
    +>>> a[1]
    +'2:2808:D=20200101000000:CDCON:middle cloud layer:0-6 hour ave fcst:'
    +
    + +

    Usage

    +
    +     err=pywgrib2_s.mk_inv(grib_file, inv_file [, optional arguments])
    +         grib_file = name of a grib file
    +         inv_file = name of the inventory file to be created
    +         err = 0 if no error
    +               non-zero for error
    +
    +     Optional arguments:
    +         Short =          False (default) make standard long inventory, wgrib2 -Match_inv
    +                          True make short inventory, wgrib2 -S
    +         Use_ncep_table = False (default) grib table as defined by center in the grib file
    +                          True, use NCEP grib tables, for centers that adopt NCEP grib tables
    +
    +

    Usage

    +

    +overview +next + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Oct 2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/pywgrib2_s_read_inv.html b/docs/web_docs/pywgrib2_s_read_inv.html new file mode 100644 index 0000000..fc9d04b --- /dev/null +++ b/docs/web_docs/pywgrib2_s_read_inv.html @@ -0,0 +1,194 @@ + + + + Climate Prediction Center - pywgrib2: read_inv(inv_file) + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2: read_inv(inv_file) +
     
    + +

    pywgrib2: read_inv

    +
    + + +

    Introduction

    + +

    +The routine pywgrib2_s.read_inv(inv) reads an inventory file, inv. It +returns a list of the entries of the inventory file. The +inventory file can be a memory file or regular file. + +

    Example

    +
    +>>> pywgrib2_s.mk_inv('a.grb','a.inv')
    +0
    +>>> a=pywgrib2_s.read_inv('a.inv')
    +>>> print(a[0])
    +1:0:D=20200101000000:CDCON:high cloud layer:0-6 hour ave fcst::CDCON:n=1:npts=18048:var0_1_0_7_6_2:pdt=8:d=2020010100:
    +start_FT=20200101000000:end_FT=20200101060000:scaling ref=0 dec_scale=0 bin_scale=0 nbits=6:vt=2020010106:
    +>>> print(a[1])
    +2:2808:D=20200101000000:CDCON:middle cloud layer:0-6 hour ave fcst::CDCON:n=2:npts=18048:var0_1_0_7_6_2:pdt=8:d=202001
    +0100:start_FT=20200101000000:end_FT=20200101060000:scaling ref=0 dec_scale=0 bin_scale=0 nbits=6:vt=2020010106:
    +
    +

    Usage

    +
    +     a=pywgrib2_s.read_inv(inv_file)
    +         if inv_file cannot be read, returns an empty list.  Otherwise 
    +         returns the inventory file as a list.  The length the list 
    +         (len(a)) is the number of lines in inv_file.
    +
    + + +

    +overview +back +next + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 10, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/pywgrib2_s_wgrib2.html b/docs/web_docs/pywgrib2_s_wgrib2.html new file mode 100644 index 0000000..88cd19c --- /dev/null +++ b/docs/web_docs/pywgrib2_s_wgrib2.html @@ -0,0 +1,286 @@ + + + + Climate Prediction Center - pywgrib2_s: calling wgrib2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2_s: calling wgrib2 routine +
     
    + +

    pywgrib2_s: calling wgrib2 subroutine

    +
    + + +

    Introduction

    + +

    +Wgrib2 is a program that can be called called using various computer languages. +This provides an easy way to read and create grib files. + +

      +
    • shell: wgrib2 GFS.grb -match ':HGT:200 mb:' -netcdf hgt200.nc +
    • C: i = system("wgrib2 GFS.grb -match ':HGT:200 mb:' -netcdf hgt200.nc"); +
    • Fortran: call execute_command_line('wgrib2 GFS.grb -match '':HGT:200 mb:'' -netcdf hgt200.nc') +
    • perl: i = system "wgrib2 GFS.grb -match ':HGT:200 mb:' -netcdf hgt200.nc" +
    • python: os.system("wgrib2 GFS.grb -match ':HGT:200 mb:' -netcdf hgt200.nc") +
    + +Calling the wgrib2 utility has much overhead (see list below); however, this is a reasonable +procedure if you are not time constrained or you are calling wgrib2 a few times. +Except for second and third items, all the following overheads involve the I/O system. Therefore, +a solution needs to address these overheads. + +
      wgrib2 utility overhead +
    1. loading the shell and wgrib2 utility for every call to wgrib2 (sometimes avoidable) +
    2. "compiling" the wgrib2 command line +
    3. initialization of wgrib2, "compiling" the wgrib2 command line +
    4. unnecessary opening and closing of files +
    5. all communication of data is through disk files +
    + +Making wgrib2 a routine can fix all these overheads except for the second. + +
      callable wgrib2 overhead +
    1. Fixed: direct subroutine call to wgrib2. No loading shell/wgrib2 utility +
    2. Reduced impact: after first call to wgrib2, initialization of wgrib2 is reduced +
    3. Not fixed: "compiling" the wgrib2 command line +
    4. Fixed: by default, files are not closed between calls to wgrib2 +
    5. Fixed: can communicate using memory files and RPN registers +
    + +The only overhead that can't be fixed is the initialization and "compiling" +by wgrib2. This overhead does not involve +the I/O system, and becomes relatively small as the grid size increases. + + +
    +#!/usr/bin/env python3
    +
    +# this version does a call to wgrib2 to netcdf files
    +# does not make or use inventory file
    +
    +import pywgrib2_s
    +in_file='gfs.t00z.master.grb2f048'
    +outa='gfs_1a.nc'
    +outb='gfs_1b.nc'
    +
    +err = pywgrib2_s.wgrib2( [in_file, '-rewind_init', in_file, '-match',':HGT:500 mb:', "-netcdf", outa] )
    +print("write netcdf-a=",err)
    +err = pywgrib2_s.wgrib2( [in_file, '-rewind_init', in_file, '-match',':TMP:850 mb:', "-netcdf", outb] )
    +print("write netcdf-b=",err)
    +
    + +

    Usage

    +
    +ierr = pywgrib2_s.wgrib2( [ (list of wgrib2 arguments) ] )
    +      note: output files remain open and may not be flushed
    +            previously opened output files will continue writing after last write
    +            input files remain open
    +            previously opened input files will continue reading after last read
    +
    +      note: you can flush the output file by closing the file by pywgrib2_s.close(file)
    +      note: you can read from the beginning of a file by '-rewind_init', file after the
    +            file has been opened
    +
    + +

    Version and Configuration of Wgrib2 Routine

    + +

    +

    +result = pywgrib2_s.wgrib2_version()
    +         result is a string with the wgrib2 version (same as wgrib2 -version)
    +
    +result = pywgrib2_s.wgrib2_configuration()
    +         result is a list of strings
    +         the same as wgrib2 -config
    +
    + +

    How it works

    + +

    +John Howard (2014) submitted changes that +optionally make wgrib2 a routine rather than a program. +The arguments to the wgrib2 routine were the same as the arguments to the wgrib2 +the program. Since wgrib2 is written in C, the arguments to +wgrib2 are the length of the array of strings followed by +an array of pointers to strings. Being a C program, the strings +are terminated by a zero. + +

    +The pywgrib2_s loads a shared wgrib2 library and calls the "wgrib2" +using the following python code. + +

    +def wgrib2(arg):
    +    #
    +    #    call wgrib2
    +    #        ex.  pywgrib2.wgrib2(["in.grb","-inv","@mem.0"])
    +    #
    +    #    uses C calling convention: 1st arg is name of program
    +    #
    +    global debug
    +    arg_length = len(arg) + 1
    +    select_type = (c_char_p * arg_length)
    +    select = select_type()
    +    item = "pywgrib2"
    +    select[0] = item.encode('utf-8')
    +
    +    for key, item in enumerate(arg):
    +        select[key + 1] = item.encode('utf-8')
    +
    +    if debug: print("wgrib2 args: ", arg)
    +    ierr = my_wgrib2.wgrib2(arg_length, select)
    +    if debug: print("wgrib2 err=", ierr)
    +    return ierr
    +
    + +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 10, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/pywgrib2_s_write.html b/docs/web_docs/pywgrib2_s_write.html new file mode 100644 index 0000000..6768364 --- /dev/null +++ b/docs/web_docs/pywgrib2_s_write.html @@ -0,0 +1,312 @@ + + + + Climate Prediction Center - pywgrib2: write(..) + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2: write(..) +
     
    + +

    pywgrib2: write

    +
    + + +

    Introduction

    + +

    +The routine pywgrib2_s.write(..) writes a grib message to a file or memory file. +To write a grib message, you need a "template", a grib message with +the correct grid and most of the metadata. Often these templates are created interactively +using wgrib2. The procedure is to take an existing grib message, and then modify it to +have the correct grid and metadata. + +

    +Once you have a template, pywgrib2_s writes grib files by modifying the template by +adding grid point data, changing the date codes, and other metadata. Pywgrib2_s can +not write a grib file from scratch, you always need a template. Templates are +quite small when you replace the grib point values with zero, with a size often less +than 200 bytes. + +

    Example

    +
    +
    +

    Usage

    +
    +     a=pywgrib2_s.write(file,template,msg_no [, optional arguments])
    +
    +     file     = output file
    +     template = file containing template
    +     msg_no   = message number of the template, the template cannot be in a submessage
    +
    +     Optional Arguments
    +
    +     new_data = None (default)
    +                ndarray          use grid point data from numpy's ndarrray
    +     Append   = False            when opening file, make a new file
    +                True             when opening file, append to the end of the file
    +     metadata = ''
    +              = 'METADATA'       sets metadata to 'METADATA', format is given by
    +                                 https://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/set_metadata.html
    +     sec0     = None (default)
    +                byte array       replace grib section 0 with byte array
    +     sec1     = None (default)
    +                byte array       replace grib section 1 with byte array
    +     sec2     = None (default)
    +                byte array       replace grib section 2 with byte array
    +     sec3     = None (default)
    +                byte array       replace grib section 3 with byte array
    +     sec4     = None (default)
    +                byte array       replace grib section 4 with byte array
    +     sec5     = None (default)
    +                byte array       replace grib section 5 with byte array
    +     sec6     = None (default)
    +                byte array       replace grib section 6 with byte array
    +     sec7     = None (default)
    +                byte array       replace grib section 7 with byte array
    +     sec8     = None (default)
    +                byte array       replace grib section 8 with byte array
    +                                 useless option, included for completeness
    +     var      = '' (default)
    +                'NAME'           set grib variable (ex, 'HGT')
    +                                   uses wgrib2 naming convention
    +     lev      = '' (default)
    +              = 'level'          set level to 'level', ex. '2 m above ground', or '500 mb'
    +                                   uses wgrib2 naming convention
    +     time0    = None (default)
    +              = YYYYMMDDHHmmSS   sets reference time to YYYYMMDDHHmmSS
    +              = YYYYMMDDHH       sets reference time to YYYYMMDDHH (mmSS=0)
    +     ftime    = '' (default)
    +              = 'FTIME'          sets the forecast time, ex '12 hour fcst'
    +                                   uses wgrib2 naming convention
    +     packing  = '' (default)     simple
    +                'same'           use same packing as template
    +                's'              simple
    +                'simple'         simple
    +                'c1'             complex type 1
    +                'complex1'       complex type 1
    +                'c2'             complex type 2
    +                'complex2'       complex type 2
    +                'c3'             complex type 3
    +                'complex3'       complex type 3
    +                'a'              AEC packing
    +                'aec'            AEC packing
    +                'j'              jpeg2000
    +                'jpeg'           jpeg2000
    +                                 Codes written using the NCEP's g2lib and g2clib do not understand AEC packing
    +
    +     var      = '' (default)
    +                'NAME'           set grib variable (ex, 'HGT')
    +                                   uses wgrib2 naming convention
    +     lev      = '' (default)
    +              = 'level'          set level to 'level', ex. '2 m above ground', or '500 mb'
    +                                   uses wgrib2 naming convention
    +     time0    = None (default)
    +              = YYYYMMDDHHmmSS   sets reference time to YYYYMMDDHHmmSS
    +              = YYYYMMDDHH       sets reference time to YYYYMMDDHH (mmSS=0)
    +     ftime    = '' (default)
    +              = 'FTIME'          sets the forecast time, ex '12 hour fcst'
    +                                   uses wgrib2 naming convention
    +     packing  = '' (default)     simple
    +                'same'           use same packing as template
    +                's'              simple
    +                'simple'         simple
    +                'c1'             complex type 1
    +                'complex1'       complex type 1
    +                'c2'             complex type 2
    +                'complex2'       complex type 2
    +                'c3'             complex type 3
    +                'complex3'       complex type 3
    +                'a'              AEC packing
    +                'aec'            AEC packing
    +                'j'              jpeg2000
    +                'jpeg'           jpeg2000
    +                                 Codes written using the NCEP's g2lib and g2clib do not
    +                                   handle AEC packing.
    +                                 Codes written using the NCEP's g2lib and g2clib will have
    +                                   problems with complex packing if they haven't been 
    +                                   programmed to handle undefined grid points without a bitmap.
    +     pdt     = None (default)
    +               integer           Product Definition Template (code table 4.0) is set to integer
    +                                 see https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-0.shtml
    +     d_scale = None (default)    decimal scaling for packing
    +               'same'
    +               (integer)
    +     b_scale = None (default)    binary scaling for packing
    +               'same'
    +               (integer)
    +                                 if d_scale and b_scale are not defined, the wgrib2 default value is used
    +                                      12 bits of binary precision (ECMWF style)
    +                                 If d_scale or b_scale is set to 'same' then
    +                                      -set_scaling same same is done.
    +                                 If d_scale or b_scale are not None
    +                                      if d_scale is None then d_scale = 0
    +                                      if b_scale is None then b_scale = 0
    +                                      -set_scaling d_scale b_scale is done.
    +                                 If d_scale and b_scale are None, then default wgrib2 scaling is used
    +                                      This is 12 bits binary in ECMWF style precision.
    +                                 See https://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/
    +                                          set_scaling.html
    +
    + +
      Order of setting values +
    1. template +
    2. secN +
    3. pdt +
    4. metadata +
    5. time0, var, lev, ftime, packing +
    + + +

    +overview +back +next + + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: 2/2023 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + diff --git a/docs/web_docs/quit.html b/docs/web_docs/quit.html new file mode 100644 index 0000000..4855a8e --- /dev/null +++ b/docs/web_docs/quit.html @@ -0,0 +1,211 @@ + + + + Climate Prediction Center - wgrib2: -quit + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-quit +
     
    + +

    wgrib2: -quit

    +
    + + +

    Introduction

    + +

    +The -quit option forces a quit and the +end of the processing of the current line. You would use +the -quit option to save time (see +2nd example). + + +

    Usage

    +

    + +

    +-quit
    +
    + +

    Examples

    +

    + +

    +$ wgrib2 /tmp/pgb.f0009031206.g2 -quit
    +1:4:d=2009031206:HGT:1000 mb:anl:
    +
    +This has the same effect as -d 1. + +

    +

    +$ wgrib2 /tmp/pgb.f0009031206.g2 -match ":RH:1000 mb:" -quit
    +64:466700:d=2009031206:RH:1000 mb:anl:
    +
    +This forces a quit after the first "RH:1000 mb" is processed. This can save time +when there is only one match. + +

    +

    +$ wgrib2 /tmp/pgb.f0009031206.g2  -if "^3:" -quit -if
    +1:4:d=2009031206:HGT:1000 mb:anl:
    +2:5399:d=2009031206:HGT:925 mb:anl:
    +3:10589:d=2009031206:HGT:850 mb:anl:
    +
    + +This forces the quit after the third line. This has the same effect as +-for 1:3. + +

    +See also: -if, +-for +-alarm +-limit + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 3, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/radius.html b/docs/web_docs/radius.html new file mode 100644 index 0000000..7de24a1 --- /dev/null +++ b/docs/web_docs/radius.html @@ -0,0 +1,188 @@ + + + + Climate Prediction Center - wgrib2: -radius + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-radius +
     
    + +

    wgrib2: -radius

    +
    + + +

    Introduction

    + +

    +Most grib2 Grid Definition Templates (PDT) include the +shape and dimensions of Earth. Such information is +necessary for finding the latitude and longitude of +the grid points in various projections. The +-radius option shows the +shape and size of Earth. +

    + +

    Usage

    + +

    +

    +-radius
    +
    + +

    Example

    +
    +$ wgrib2 -radius png.grb2
    +1:4:code3.2=6 sphere predefined radius=6371229.0 m
    +
    + + +See also: +-set_radius_inv +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 8, 2015 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/range.html b/docs/web_docs/range.html new file mode 100644 index 0000000..96db49b --- /dev/null +++ b/docs/web_docs/range.html @@ -0,0 +1,168 @@ + + + + Climate Prediction Center - wgrib2: -range + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-range +
     
    + +

    wgrib2: -range

    +
    + + +

    Introduction

    + +

    +The -range option shows the starting and ending byte of +the grib message. If the range field is used by partial http downloading +of grib files. + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/read_sec.html b/docs/web_docs/read_sec.html new file mode 100644 index 0000000..27f426d --- /dev/null +++ b/docs/web_docs/read_sec.html @@ -0,0 +1,188 @@ + + + + Climate Prediction Center - wgrib2: -read_sec + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-read_sec +
     
    + +

    wgrib2: -read_sec

    +
    + + +

    Introduction

    + +

    +The -read_sec option will replace the section (0-8) of the current grib message +with the contents from a file. The only options that applies to the file are the -header +and -no_header options. +The default -header option put a 4-byte unsigned integer header and trailer around the section data. +The header and trailer are the number of bytes of the section. + +

    +The -read_sec option is used to create grib files where you do not an appropriate template. + +

    Usage

    +
    +-read_sec N file            N = 0..8
    +                            file = file to read
    +
    + +

    Example 1

    +
    +wgrib2 IN.grb -read_sec 0 sec0.dat -read_sec 1 sec1.dat -read_sec 2 sec2.dat -read_sec 3 sec3.dat \
    +  -read_sec 4 sec4.dat -read_sec 5 sec5.dat -read_sec 6 sec6.dat -read_sec 7 sec7.dat -grib OUT.grb
    +
    + +

    +See also: +-write_sec, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page created: 12/2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/reduced_gaussian_grid.html b/docs/web_docs/reduced_gaussian_grid.html new file mode 100644 index 0000000..808a9a5 --- /dev/null +++ b/docs/web_docs/reduced_gaussian_grid.html @@ -0,0 +1,264 @@ + + + + Climate Prediction Center - wgrib2: -reduced_gaussian_grid + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-reduced_gaussian_grid +
     
    + +

    wgrib2: -reduced_gaussian_grid

    +
    + + +

    Introduction

    + +

    +Regular Gaussian grids are not space efficient because the number of grid points on a Gaussian latitude +does not vary with latitude. For example, you don't need as many points near the poles as +next to the equator to describe the same spatial scales. With a reduced Gaussian grid, the number of grid points on a Gaussian +latitude varys from large near the equator to small near the poles. This reduces the number +of grid points, reduces calculations and speeds up the model. One draw back for the users +are they often have convert the grid to a regular Gaussian grid for plotting, +interpolation to another grid or making a regional subset. + +

    +The -reduced_gaussian_grid option converts from a reduced +Gaussian grid to a regular Gaussian grid. This option has two interpolation options. +The "linear" interpolation means that the grid points are interpolated linearly +from the surrounding two points on the Gaussian latitude. "Neighbor" interpolation +will use the value from the nearest grid point on the Gaussian latutude. + +

    Interpolation

    + +The -reduced_gaussian_grid option interpolates +using points on the same Gaussian latitude. There are two basic +interpolation techniques, linear and neighbor. + +
      +
    1. linear interpolates linearly using the two surrounding grid points +on the same Gaussian latitude assuming that both grid points have +valid values. +
    2. neighbor interpolation will take the value of the nearest grid point +on the same Gaussian latitude assuming that both grid points have valid +values. +
    + +

    Some fields have undefined values. Therefore, in some cases +you may have to extrapolate a value. + +

    +         D------x-------U         (Gaussian latitude)
    +                              D=defined value, U=undefined values
    +                              x=location of value that is desired
    +
    +Option 1: no extrapolation, value at x is undefined
    +Option 2: extrapolation, value at x is the value D
    +Option 3: x has the value D if x is closer to "D" than "U"
    +          otherwise it has a undefined values
    +
    +Option 1: default, Option 2: extrapolate, Option 3: not supported
    +

    + +The supported interpolation types are + +

      +
    1. linear : linear, no extrapolation +
    2. linear-extrolate : linear, extrapolation +
    3. neighbor : nearest neighbor, no extrapolation +
    4. neighbor-extrapolate : nearest neighbor, extrapolation +
    + + +

    Example

    +
    +See that reduced_gaussian_surface_jpeg.grib2 is a reduced Gaussian grid
    +bash-4.1$ wgrib2 reduced_gaussian_surface_jpeg.grib2 -grid
    +1:0:grid_template=40:winds(N/S):
    +	thinned global Gaussian grid: (-1 x 64) units 1e-06 input WE:NS output raw
    +	number of latitudes between pole-equator=32 #points=6114
    +	lat 87.864000 to -87.864000
    +	lon 0.000000 to 357.188000 by -2147.483647
    +	#grid points by latitude: 20 27 36 40 45 50 60 64 72 75 80 90 90
    +	 96 100 108 108 120 120 120 128 128 128 128 128 128 128 128 128 128 128 128 128
    +	 128 128 128 128 128 128 128 128 128 128 128 120 120 120 108 108 100 96 90 90
    +	 80 75 72 64 60 50 45 40 36 27 20
    +
    +Write regular Gaussian grid in new.grb
    +bash-4.1$ wgrib2 reduced_gaussian_surface_jpeg.grib2 -reduced_gaussian_grid new.grb -1 linear
    +1:0:d=2007032312:TMP:surface:anl:
    +
    +Check that new.grb is a regular Gaussian grid
    +bash-4.1$ wgrib2 new.grb -grid
    +1:0:grid_template=40:winds(N/S):
    +	Gaussian grid: (128 x 64) units 1e-06 input WE:NS output WE:SN
    +	number of latitudes between pole-equator=32 #points=8192
    +	lat 87.864000 to -87.864000
    +	lon 0.000000 to 357.187500 by 2.812500
    +
    + +

    Usage

    +

    + +

    +-reduced_gaussian_grid OUT -1 INTERPOLATION
    +      OUT = output file
    +            grib2, regular Gaussian grid
    +          The interpolation is linear on the Gaussian latitude
    +          but will be made selectable in the future
    +      -1 = means interpolate to a regular Gaussian grid
    +           In the future, this parameter will extened 
    +           for convertion to a reduced Gaussian grid.
    +       INTERPOLATION = linear, neighbor, linear-extrapolate, neighbor-extrapolate
    +
    +

    +See also: -grid, + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: November, 29, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/reset_delayed_error.html b/docs/web_docs/reset_delayed_error.html new file mode 100644 index 0000000..aa978f8 --- /dev/null +++ b/docs/web_docs/reset_delayed_error.html @@ -0,0 +1,229 @@ + + + + Climate Prediction Center - wgrib2: -reset_delayed_error + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-reset_delayed_error +
     
    + +

    wgrib2: -reset_delayed_error

    +
    + + +

    Introduction

    + +

    +Wgrib2 (v3.0.1+) has two behaviors for fatal errors. The first behavior is +to quit immediately. The second behavior (delayed error) is for wgrib2 to +quit after processing the error-causing grib message. This second behavior +is useful because it allows you to examine the bad grib message, and to fix +the grib message. + +

    +The -reset_delayed_error option is an inventory +option that clears the delayed-error flags. Note that options after the +-reset_delayed_error option may also raise delayed +errors. +

    +Processing grib files with delayed errors can cause seg faults and other +errors. For example, a delayed error can be raised when Section 3 is not of the correct +size. If wgrib2 is processing Section 3 assuming it has the right size, +and the actual size is smaller than the right size, you could have seg faults. + +

    Example

    +

    +In this example, a delayed error causes processing to stop at the end of the message. + +

    +$ wgrib2 sfcu.grb 
    +
    +*** FATAL ERROR, local grib table=255, replaced by 1
    +1:0:d=2020120500:var discipline=0 center=74 local_table=1 parmcat=2 parm=192:10 m above ground:3 hour fcst:
    +
    +*** FATAL ERROR (delayed): local grib table undefined (255)
    +
    + +To see the inventory without the error messages (note -s had to be added), +
    +-sh-4.2$ wgrib2 sfcu.grb -s -reset_delayed_error 2>/dev/null
    +1:0:d=2020120500:var discipline=0 center=74 local_table=1 parmcat=2 parm=192:10 m above ground:3 hour fcst::delayed_error=4
    +2:3327157:d=2020120500:var discipline=0 center=74 local_table=1 parmcat=2 parm=192:10 m above ground:6 hour fcst::delayed_error=4
    +3:6654314:d=2020120500:var discipline=0 center=74 local_table=1 parmcat=2 parm=192:10 m above ground:9 hour fcst::delayed_error=4
    +4:9981471:d=2020120500:var discipline=0 center=74 local_table=1 parmcat=2 parm=192:10 m above ground:12 hour fcst::delayed_error=4
    +
    + +To change the locally define field to a standard WMO name which needs no local grib table. +
    +-sh-4.2$ wgrib2 sfcu.grb -if ":var0_22_1_74_2_192:" -set_var UGRD -endif -s -reset_delayed_error 2>/dev/null
    +1:0:d=2020120500:UGRD:10 m above ground:3 hour fcst::delayed_error=4
    +2:3327157:d=2020120500:UGRD:10 m above ground:6 hour fcst::delayed_error=4
    +3:6654314:d=2020120500:UGRD:10 m above ground:9 hour fcst::delayed_error=4
    +4:9981471:d=2020120500:UGRD:10 m above ground:12 hour fcst::delayed_error=4
    +
    +

    Usage

    +

    + +

    +-reset_delayed_error
    +                    delayed error flag = 0    no error
    +                                       > 0    see wgrib2.h for values
    +
    +The delayed-error flag is the sum of the following errors (12/8/2020)
    +
    +#define DELAYED_PDT_SIZE_ERR            2
    +#define DELAYED_LOCAL_GRIBTABLE_ERR     4
    +#define DELAYED_GRID_SIZE_ERR           8
    +#define DELAYED_FTIME_ERR               16
    +
    +See also: + -if_delayed_error, + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/rewind_final.html b/docs/web_docs/rewind_final.html new file mode 100644 index 0000000..18f7462 --- /dev/null +++ b/docs/web_docs/rewind_final.html @@ -0,0 +1,196 @@ + + + + Climate Prediction Center - wgrib2: -lon + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rewind_final +
     
    + +

    wgrib2: -rewind_final CW2

    +
    + + +

    Introduction

    + +

    +The wgrib2 library can either close or not close the files after +calls to the wgrib2 subroutine. Closing the file frees up resources +and helps prevent you from getting the "Too Many Files Open" error +message. However, reopening files is a slow operation and you +usually keep the files open if you plan to read/write to the file again. + + +

    If you are reading from a previously opened and not-closed file, +you will normally continue reading from where the last call to +the wgrib2 subroutine stopped. Sometimes this the preferred behavior. +Sometimes, you want the library to start reading the file from the +beginning. + +

    The -rewind_final option rewinds an +already open file in the final or after-all-processing phase. It +is commonly used rewind the inventory when searching from matching +records. + +

    Usage

    +

    + +

    +-rewind_final FILE
    +  FILE must be already opened
    +  This command is only useful in callable wgrib2
    +
    + +See also: +-persistent +-rewind_init +-rewind_proc +-transient +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Sep 9, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/rewind_init.html b/docs/web_docs/rewind_init.html new file mode 100644 index 0000000..7866157 --- /dev/null +++ b/docs/web_docs/rewind_init.html @@ -0,0 +1,196 @@ + + + + Climate Prediction Center - wgrib2: -lon + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rewind_init +
     
    + +

    wgrib2: -rewind_init CW2

    +
    + + +

    Introduction

    + +

    +The wgrib2 library can either close or not close the files after +calls to the wgrib2 subroutine. Closing the file frees up resources +and helps prevent you from getting the "Too Many Files Open" error +message. However, reopening files is a slow operation and you +usually keep the files open if you plan to read/write to the file again. + + +

    If you are reading from a previously opened and not-closed file, +you will normally continue reading from where the last call to +the wgrib2 subroutine stopped. Sometimes this is the preferred behavior. +Sometimes, you want the library to start reading the file from the +beginning. + +

    The -rewind_init option rewinds an +already open file in the setup or pre-processing phase. It +is commonly used to rewind the inventory when searching from matching +records. + +

    Usage

    +

    + +

    +-rewind_init FILE
    +  FILE must be already opened
    +  This command is only useful in callable wgrib2
    +
    + +See also: +-persistent +-rewind_final +-rewind_proc +-transient +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Sep 9, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/rewind_proc.html b/docs/web_docs/rewind_proc.html new file mode 100644 index 0000000..10a208a --- /dev/null +++ b/docs/web_docs/rewind_proc.html @@ -0,0 +1,194 @@ + + + + Climate Prediction Center - wgrib2: -lon + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rewind_proc +
     
    + +

    wgrib2: -rewind_proc CW2

    +
    + + +

    Introduction

    + +

    +The wgrib2 library can either close or not close the files after +calls to the wgrib2 subroutine. Closing the file frees up resources +and helps prevent you from getting the "Too Many Files Open" error +message. However, reopening files is a slow operation and you +usually keep the files open if you plan to read/write to the file again. + + +

    If you are reading from a previously opened and not-closed file, +you will normally continue reading from where the last call to +the wgrib2 subroutine stopped. Sometimes this the preferred behavior. +Sometimes, you want the library to start reading the file from the +beginning. + +

    The -rewind_proc option rewinds an +already open file during the processing phase. + +

    Usage

    +

    + +

    +-rewind_proc FILE
    +  FILE must be already opened
    +  This command is only useful in callable wgrib2
    +
    + +See also: +-persistent +-rewind_final +-rewind_init +-transient +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Sep 9, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/rpn.html b/docs/web_docs/rpn.html new file mode 100644 index 0000000..e2bccbd --- /dev/null +++ b/docs/web_docs/rpn.html @@ -0,0 +1,579 @@ + + + + Climate Prediction Center - wgrib2: -rpn + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rpn +
     
    + +

    wgrib2: -rpn

    +
    + + +

    Introduction

    + +

    +The -rpn option runs a reverse polish notation +(RPN) +calculator. Having a built-in calculator is quite handy. We use it to convert +units (ex. geopotential to geopotential meters, accumulations to rates), +compute simple quantities (net flux from downward and upward fluxes), +and even compute the plant hardiness index from the 2 m temperatures. The goal +of the calculator is to reduce the need to write simple grib programs that +do simple calculations. + +

    The "hardware" of the rpn calculator consists of 20 registers +and a stack (10 entries deep). (Wgrib2 prior to 2.0.6 has 10 registers.) +Stack entries and registers are arrays rather floating point numbers on +your store-bought calculator. + +

    +The conceptual model of the >-rpn calculator is the +grid values array is the top of the stack. The calculator has +a statck that is 10 entries deep and 20 registers. When +ever you enter rpn mode, the stack is cleared except for the +top of the stack. The registers are only clears when you +"turn on" the calculator; that is start the wgrib2 utility +or the first call to wgrib2 if you are using calling wgrib2 +through wgrib2api or pywgrib2. + +

    To save the calculations, you can save them in a register +or write them out by -grib_out, -bin, -ieee, -text, etc. + + +

    Callable wgrib2, wgrib2api

    + +

    Callable Wgrib2 and wgrib2api use the -rpn registers to transfer +gridded data between the calling program and the wgrib2 subroutine. A Fortran or C +program can read and write the wgrib2's RPN registers. For example, if a program +wants to write a grib2 file, it would first place the grid values into a register. +The calling program would then call the wgrib2 subroutine with instructions to +read a template, replace the grid values with the register values, and then +write a grib message. + +

    Implementation Details

    + +

    The size of a registers may differ as the size of grids can also vary in a grib file. +However the size of the register has to match the size of the stack entry in order +"recall" the register. + +

    Wgrib2 always reads a grib message before processing it using commmands like -rpn. +This sets the size of the data array. Thus the size of the stack entries is always +the size of the grib message that is being processed. + +

    The conceptual moddel is the data array (grid values) is the +top of the stack. The implmentation is that the data array is copied +to the top of the stack when -rpn is run, and the top of the stack is +copied to the data array when -rpn is finished. An error message +will occur if the top of the stack is empty when -rpn finishes. + +

    Limitations of -rpn

    + +

    +The -rpn option was designed for +simple calculations. For more complicated calculations, you +should use a real programming language. You can do the +calculations in another step and then import the results +using one of the various -import_* options. You can +use wgrib2api (Fortran and C) to read the data into a Fortran +or C program, do the calculation and then write the data out +using wgrib2. Finally you can use python and one of the pywgrib2 +packages to do the calculation using Python, numpy and + pywgrib2. + +

    Uses

    +
      +
    • change of units when importing data (gribifying data) +
    • computations: ex, U,V -> wind speed, wind direction, potential temperature +
    • merging data +
    • complex masking of data +
    • changing units before writing text/ieee files +
    • removing extreme data values +
    • finding min and max values +
    • finding the globally averaged precipitation +
    • comparing fields +
    + + +

    Usage

    +

    + +

    +-rpn  "A:B:C:..."
    +    A,B,C,.. = number, rpn function, or rpn operator
    +
    + +

    +Operators and Functions: +

    +Pop X, Push Fn(X)
    +
      +
    • abs: absolute value +
    • acos: arc cos, [0, pi] radians +
    • alt_x_scan: changes alternate x scanning to regular x scanning and vice versa +
    • asin: arc sin, result is [-pi/2, pi/2] radians +
    • atan: arc tan, result is [-pi/2, pi/2] radians, see atan2 +
    • abs: absolute value +
    • ceil: smallest integer >= X +
    • cos: cosine, argument in radians +
    • exp: e^X +
    • floor: largest integer <= X +
    • ln: natural logorithm +
    • raw2: convert from input scan order to output scan order +
    • sin: sine, argument in radians +
    • smth9g: smth9 for global fields, 9 point smoothing, undefined values adjacent to defined values are defined +
    • smth9r: snth9 for regional fields, 9 point smoothing, undefined values adjacent to defined values are defined +
    • sq: X*X +
    • sqrt: square root +
    • tan: tangent, argument in radians +
    • xave: for nx-ny grids, averages in the x direction (normally zonal mean) +
    • xdev: for nx-ny grids, remove x average (normally deviation from zonal mean) +
    • yrev: for nx-ny grids, changes we:sn to we:ns and vice versa +
    • 1/x: 1/X +
    • 2raw: convert from output scan order to input scan order +
    +Pop Y, Pop X, push Fn(X,Y) +
      +
    • +: push X+Y +
    • -: push X-Y +
    • *: push X*Y +
    • /: push X/Y +
    • <: push X < Y (1/0 if true/false) +
    • <=: push X <= Y (1/0 if true/false) +
    • ==: push X == Y (1/0 if true/false) +
    • !=: push X != Y (1/0 if true/false) +
    • >=: push X >= Y (1/0 if true/false) +
    • >: push X > Y (1/0 if true/false) +
    • atan2: push arctan(X/Y), result is [-pi, pi] radians, see atan +
    • pow: push X**Y (X^Y) +
    • mask: if (Y != 0) push(X) else push(UNDEFINED) +
    • max: push max(X,Y), for logical values, max is the same as OR +
    • merge: if (Y != UNDEFINED) push(Y) else push(X) +
    • min: push min(X,Y), for logical values, min is the same as AND +
    +Note: an operation involving an UNDEFINED is UNDEFINED +
    + + + +Stack Operators: +
    +
      +
    • clr, clear the stack (stack is emptied) +
    • dup, duplicate the top of the stack +
    • pop, remove the top of the stack +
    • exc/swap, exchange the top 2 stack entries +
    +
    +Register Operators: (note: CW2 v2.0.6+ uses registers 7,8,9 prior versions 0,1,2) +
    +
      +
    • clr_I, clear register I, I=0,1..,9 (19 for v2.0.6+) +
    • rcl_I, push register I on top of stack, I=0,1..,9 (19 for v2.0.6+) +
    • sto_I, save top of stack in register I, I=0,1..,9 (19 for v2.0.6+) +
    • rcl_lat, push latitudes onto the top of the stack (degrees) +
    • rcl_lon, push longitudes onto the top of the stack (degrees) +
    • sto_lon, save top of stack as longitudes (degrees) (wgrib2 v3.0.0+) +
    • sto_lat, save top of stack as latitudes (degrees) (wgrib2 v3.0.0+) +
    • note: latitudes and longitudes are double precision values, the stack is single precision +
    +
    + +Variables and Constants: put on the top of the stack +
    +
      +
    • number number = floating point or integer number like 0, 10.1, -1.23e-4 +
    • days_in_ref_month number of days in the month for the reference date (conversion between monthly acc. and rates) +
    • days_in_verf_month number of days in the month for the verification time (conversion betwee monthly acc. and rates) +
    • pi 3.1415.... +
    • rand random number uniformly distributed between 0 and 1, each grid point has a different random number +
    +
    + +Printing Operators: +
    +
      +
    • print_corr, write cosine weighted spatial correlation, data[TOP] data[TOP-1] +
    • print_max, print_min, data[TOP] +
    • print_rms, write cosine weighted RMS, data[TOP]-data[TOP-1] +
    • print_diff, write cosine weighted difference, data[TOP-1]-data[TOP] +
    • print_ave, write cosine weighted average, grid_ave(data[TOP]*cos(grid))/grid_ave(cos(grid)) +
    • print_wt_ave, write weighted average grid_ave, data[TOP] is the weighting + print grid_ave(data[TOP]*data[TOP-1])/grid_ave(data[TOP]) +
    +
    + + +

    Example 1

    +

    +The standard units of grib temperature is K but you want the text output in Celcius. +

    +$ wgrib2 a.grb -match ":TMP:850 mb:" -rpn "273.15:-" -text C.dat
    +
    + +

    +Fahrenheit is easy too (F = (K-273.15)*9/5+32). +

    +$ wgrib2 a.grb -match ":TMP:850 mb:" -rpn "273.15:-:9:*:5:/:32:+" -text F.dat
    +
    + +

    Example 2

    +

    +Suppose you want to limit the relative humidity values to 100. This example only +affect the RH fields. All submessages will be converted into messages. +

    +$ wgrib2 a.grb -if ":RH:" -rpn "100:min" -fi -grib_out out.grb -not_if ":RH:" -grib out.grb
    +
    + +

    Example 3

    +

    +Suppose that you wanted the 500 to 1000 mb thickness, and the file only contained +one field of Z1000 and one field of Z500. + +

    +$ wgrib2 IN.grb -match ":HGT:" -match ":(500|1000) mb:" \
    +     -if ":500 mb:" -rpn sto_1 -fi \
    +     -if ":1000 mb:" -rpn sto_2 -fi \
    +     -if_reg "1:2" \
    +         -rpn "rcl_1:rcl_2:-:clr_1:clr_2" \
    +         -set_var THICK -set_lev "500-1000 mb" \
    +         -set_grib_type c3 -grib_out OUT.grb
    +
    +     line 1: only process the HGT at 500 and 1000 mb which save processing time
    +     line 2: store HGT at 500mb in register 1
    +     line 3: store HGT at 1000mb in register 2
    +     line 4: if (register 1 and register 2 have values then
    +     line 5: calculate the thickness: reg_1 - reg_2
    +     line 6: set variable type to THICK, and level to "500-1000 mb"
    +     line 7: write out the WIND data to a grib file with complex compression
    +
    +     Note: this is a very simple script and that doesn't check the matching
    +     date code, grid type, etc.
    +
    + +

    Example 4

    +

    +Write out the 500 mb wind speed. +

    +$ wgrib2 IN.grb -match ":[UV]grd:500 mb:" \
    +     -if ":UGRD:" -rpn "sto_1" -fi \
    +     -if ":VGRD:" -rpn "sto_2" -fi \
    +     -if_reg 1:2 \
    +         -rpn "rcl_1:sq:rcl_2:sq:+:sqrt:clr_1:clr_2" \
    +         -set_var WIND \
    +         -grib_out out.grb
    +
    +     line 1: only process the U and V at 500 mb
    +     line 2: store U 500mb in register 1
    +     line 3: store V 500mb in register 2
    +     line 4: if (register 1 and register 2 have values then
    +     line 5: calculate the wind speed: sqrt(reg_1**2 + reg_2**2)
    +     line 6: set variable type to WIND (wind speed)
    +     line 7: write out the WIND data to a grib file
    +
    +     Note: this is a very simple script and that doesn't check the matching
    +     date code, grid type, etc.
    +
    +     Note: there are options to calculate wind speed and wind direction
    +
    + + +

    Example 5

    +

    +Suppose someone made a mistake and the latent heat flux (LHTFL) had the wrong sign. RPN to the rescue. + +

    +$ wgrib2 IN.grb -match ":LHTFL:" -rpn "-1:*" -grib_out new_lhtfl.grb
    +
    + +The file, new_lhtfl, only contained the LHTFL fields. You duplicate the file with the +fixed LHTFL fields by + +
    +$ wgrib2 IN.grb -if ":LHTFL:" -rpn "-1:*" -fi -grib_out new.grb
    +
    + +It would be faster if you only compressed the LHTFL fields. (-grib uses the +original compressed data and -grib_out uses the "data" register.) + +
    +$ wgrib2 IN.grb -set_grib_type jpeg \
    +   -not_if ":LHTFL:" -grib new.grb -if ":LHTFL:" -grib_out new.grb
    +
    + + +If both the latent and sensible heat fluxes needed a sign reversal, you could do, + +
    +$ wgrib2 IN.grb -if ":(LHTFL|SHTFL):" -rpn "-1:*" -fi -grib_out new.grb
    +
    +

    Example 6

    +If you want to set certain values to undefined, you define a mask and then +apply the mask. In this example, values below 20 are set to undefined. + +
    +$ wgrib2 a.grb -rpn "dup:20:>=:mask" -grib_out -set_grib_type c3 new.grb 
    +
    +The RPN calculator is used:
    +    dup       the data is duplicated
    +    20        20 is pushed on the stack
    +    >=        test data >= 20, top of stack is 1/0 depending on test >= 20
    +    mask      apply mask to the data
    +
    +-set_grib_type c3    sets the grib compression to complex3
    +-grib_out new.grb    writes a grib message using the decoded data
    +
    + +Don't forget to enclose the argument to rpn in quotes because the shell can do unexpect things. + +Printing operators +
    +   print_corr   write cosine weighted spatial correlation R(TOP-1), R(TOP)
    +   print_max    write max(R(TOP)) to stdout
    +   print_min    write min(R(TOP)) to stdout
    +   print_rms    write cosine weighted RMS(R(TOP-1)-R(TOP))
    +
    + +

    Example 7: Merging

    + +

    +Suppose that we have a nested model, we have a low resolution TMP2m from the +the outer model and a high-resolution TMP2m from the nested model. Now we +want a field that uses the TMP2m in the nested-model domain and the TMP2m from +the outer model elsewhere. To do this, you need to convert both fields to a +common grid. Then you use "-rpn merge". Make sure that both domains are +contained in the common grid as this is a requirement of the interpolation library. + +

    +   wgrib2 OUTER.T2m -new_grid_winds earth -new_grid A B C A1.grb
    +   wgrib2 NESTED.T2m -new_grid_winds earth -new_grid A B C A2.grb
    +   wgrib2 A2.grb -rpn sto_1 -import_grib A1.GRB -rpn "rcl_1:merge" \
    +    -grib_out MERGED.T2m
    +
    + + +

    Example 8: Land Mask

    +The file mask.grb contains the values 0 for water, 1 for land and +2 for sea ice. I wanted a small file with 0 for water+sea-ice and 1 for land. + +
    +wgrib2 mask.grb -rpn "1:==" -set_scaling 0 1 -set_grib_type c1 -grib_out land.grb
    +
    +  -rpn "1:=="        if grid value is 1, the new value is 1 else 0
    +  -set_scaling 0 1   1 bit for storing the grib values
    +  -set_grib_type c1  complex packing 1 is good for long runs of the same value.
    +   The file sizes  16 bits/point 16 bits precision simple packing (mask.grb)
    +                   0.7 bits per point 16 bits precision complex packing 1 (mask.grb)
    +                   0.2 bits per point complex packing 1 (land.grb)
    +   grid size: 131K points, land.grb is 3331 bytes
    +
    + + +

    Example 9: Total-total index

    +

    +An example of calculating the dewpoint and +total-total index is more involved. Using an on-line infix to postfix (reverse polish) +calculator is helpful. + +

    Example 10: global precipitation

    +

    The model has the precipitation in the variable PRATE +which has units of mm/sec (assuming 1 gm H2O = 1cc). Suppose +I wanted the globally averaged precip in the non-metric unit +of mm/day. It's one command away +

    +  wgrib2 gfsfile -match PRATE -s -rpn "86400:*" -stats
    +
    + +

    Changes

    + +

    Wgrib2 v3.0.0+ adds error chechking to floating point values, +

    +   wgrib2 prior to 3.0.0
    +
    +      wgrib2 IN.grb -rpn "2cars:+" -grib_out OUT.grb
    +           adds 2 to the grid point values as atof("2cars") returns 2.0
    +
    +   wgrib2 v3.0.0+
    +
    +      wgrib2 IN.grb -rpn "2cars:+" -grib_out OUT.grb
    +          will result in an error message as "2cars" is not a legal floating point value
    +
    +

    Comments

    +

    +Warning: Reverse Polish notation can cause headaches if you try something +too complicated. An infix -> postfix calculator is the suggested +remedy. Another approach is to use pywgrib2_s, pywgrib2_xy, or pywgrib2_lite. + + +

    +The -rpn option is a piece of easy to +understand and modify code (RPN.c). If you want to add +a specialized function (ex. wind chill calculation), you many +consider adding it to the RPN calculator. The another method +is to code your calculation in python and use pywgrib2_s, +pywgrib2_xy or pywgrib2_lite. + +

    +Why an RPN calculator? Well, wgrib2 is heavily influenced by the stack language Forth. +It's only natural that the calculator would be based on reverse +Polish notation. + +

    +See also: +-if, +-if_reg, +-fi, +-grib_out, +-rpn_rcl, +-rpn_sto, + + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Aug 4, 2016, Oct 10, 2018, July 11, 2020, July 11, 2021, April 2024 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/rpn_non-trivial_example.html b/docs/web_docs/rpn_non-trivial_example.html new file mode 100644 index 0000000..c60a11f --- /dev/null +++ b/docs/web_docs/rpn_non-trivial_example.html @@ -0,0 +1,293 @@ + + + + Climate Prediction Center - wgrib2: -rpn example + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rpn example +
     
    + +

    wgrib2: -rpn to Calculate Dewpoint and Total-Total Index

    +
    + + +

    Introduction

    + +

    +The -rpn option runs a reverse Polish notation +(RPN) +calculator. In this example, I will show how to +calculate the dewpoint and total-total index in wgrib2. The total-total index +correlates with the thunderstorm strength and coverage. + +

    + +
    +TT = (T850-T500) + (Td850 - T500)
    +
    +Td850 = dewp point temperature at 850 mb in C
    +T500 = temperature at the 500 mb level in C
    +T850 = temperature at the 850 mb level in C
    +
    + +

    +The above expression for TT can be written in reverse Polish (postfix) +notation as, + +

    + T850 T500 - Td850 T500 - +
    +
    + +The conversion to reverse Polish is not unique and can be done without electronic aids. +However, we will be doing more complicated expressions and on-line converters +are handy. In a web search, the first two sites that I found were, +

    + +https://www.mathblog.dk/tools/infix-postfix-converter/
    + + +https://scanftree.com/Data_Structure/prefix-postfix-infix-online-converter
    + +

    +To use these sites, enter the expression in the infix box and press the convert +button. By the way, this list is not a endorsement. If I had more patience, I could have found +more sites. With a different search engine, I may have found two different +sites. Anyways with the above postfix expression, the sh script to calculate +the total-total index is, + +

    +     1	#!/bin/sh
    +     2	# calculate total total index
    +     3	#
    +     4	#  file = grib2 file with T850 T500 and Td850 (DPT)
    +     5	#
    +     6	# calulate total total index by
    +     7	# TT = (T850 - T500) + (Td850 - T500)
    +     8	# TT in reverse polish is T850 T500 - Td850 T500 - +
    +     9	
    +    10	file=gdas1.t00z.pgrbanl.grib2
    +    11	
    +    12	wgrib2 $file \
    +    13	  -grib out.grb2 \
    +    14	  -if ":TMP:500 mb:" -rpn "273.15:-:sto_1" -print "saved T500 in reg1" -fi \
    +    15	  -if ":TMP:850 mb:" -rpn "273.15:-:sto_2" -print "saved T850 in reg2" -fi \
    +    16	  -if ":DPT:850 mb:" -rpn "273.15:-:sto_3" -print "saved Td850 in reg3" -fi \
    +    17	  -if_reg "1:2:3" -print ":ready to do work"  \
    +    18	      -rpn "rcl_2:rcl_1:-:rcl_3:rcl_1:-:+" \
    +    19	      -set_var TOTALX -grib_out out.grb2 \
    +    20	  -if_reg "1:2:3" -rpn "clr_1:clr_2:clr_3" -fi
    +
    +Line 13 saves each field in file out.grb2
    +Line 14 saves T500 (C) in register 1, converts from K to C.
    +Line 15 saves T850 (C) in register 2
    +Line 16 saves Td850 (C) in register 3
    +Line 17 if register 1, 2 and 3 are defined then
    +Line 18 calculates TT
    +Line 19 writes TT to out.grb2
    +Line 20 clears registers so that lines 17-19 are only done once
    +
    + +

    +The problem with using the above script with the GFS is that the standard +GFS output does not include dewpoint temperature. You have to compute the +dewpoint from the relative or specific humidity. See the comments +in the following script for the formula used. + +

    +     1	#!/bin/sh
    +     2	# calculate total total index
    +     3	#
    +     4	#  file = grib2 file with T850 T500 and RH850
    +     5	#
    +     6	# step 1: calculate 850 mb dewpoint temp
    +     7	# got formula from here: https://en.wikipedia.org/wiki/Dew_point (retrieved 12/2013)
    +     8	#
    +     9	#     gamma = (ln(RH / 100) + (b * T) / (c + T)
    +    10	#         let r3 = ln(RH/100)
    +    11	#         gamma:  r3 b T * c T + / +
    +    12	#     Td = (c*gamma) / (b-gamma)
    +    13	#       Td: c gamma * b gamma - /
    +    14	#
    +    15	#  some values of (b,c):   18.678, 257.14C  Bolton 1980 MWR
    +    16	#  some values of (b,c):   17.62, 243.12C   Sontag 1990
    +    17	#  some values of (b,c):   17.27, 2137.7C   Paroscientific
    +    18	#
    +    19	#
    +    20	# calulate total total index by
    +    21	# TT = (T850 - T500) + (Td850 - T500)
    +    22	
    +    23	file=gdas1.t00z.pgrbanl.grib2
    +    24	
    +    25	wgrib2 $file \
    +    26	  -grib out.grb2 \
    +    27	  -if ":TMP:500 mb:" -rpn "273.15:-:sto_1" -print "saved T500 in reg1" -fi \
    +    28	  -if ":TMP:850 mb:" -rpn "273.15:-:sto_2" -print "saved T850 in reg2" -fi \
    +    29	  -if ":RH:850 mb:"  -rpn "100:/:ln:sto_3" -print "saved LN(RH850/100) in reg3" -fi \
    +    30	  -if_reg "1:2:3" -print ":calc Td850"  \
    +    31	      -rpn "rcl_3:18.678:rcl_2:*:257.14:rcl_2:+:/:+:sto_4:" \
    +    32	      -rpn "257.14:rcl_4:*:18.678:rcl_4:-:/:sto_5:273.15:+" -set_var DPT -grib_out out.grb2 \
    +    33	  -if_reg "5"  -rpn "rcl_2:rcl_1:-:rcl_5:rcl_1:-:+" -set_var TOTALX -grib_out out.grb2 \
    +    34    -if_reg "5"  -rpn "clr_1:clr_2:clr_3:clr_4:clr_5" -fi
    +
    +Line 26 saves each field in file out.grb2
    +Line 27 saves T500 (C) in register 1, converts from K to C.
    +Line 28 saves T850 (C) in register 2
    +Line 29 saves ln(RH850/100) in register 3
    +Line 30-32 computes dewpoint and saves in register 5 (C) and writes to grib file (K)
    +Line 33 computes total-total index and writes it out
    +Line 34 clears registers
    +
    + +

    +Note that the above script requires wgrib2 v2.0.0 to run. Previous versions +had a problem with the ln function. In hindsight, -if should have been +always closed by -fi rather than an output or a -fi. + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 10, 2013 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/rpn_raw2_2raw.html b/docs/web_docs/rpn_raw2_2raw.html new file mode 100644 index 0000000..63ce2aa --- /dev/null +++ b/docs/web_docs/rpn_raw2_2raw.html @@ -0,0 +1,277 @@ + + + + Climate Prediction Center - wgrib2: -rpn raw2, -rpn 2raw + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -rpn raw2, -rpn 2raw +
     
    + +

    wgrib2 macros: -rpn raw2, -rpn 2raw

    +
    + + +

    Introduction

    + +

    +Mosts of the operators for -rpn are simple and need minimal explanation. +However, the raw2, and 2raw require more explanation. +

    +In grib2 files, the grid point data is stored sequentially and have to be mapped to the grid. +Grib2 defines many methods (scan orders) of mapping the grid point. There are fortran order, +C order, West to east, east to west, south to north and north to south. The rows can +have a uniform direction or the even rows have a direction and the odd rows have another +direction. Then you can add on the various Arakawa grids, and everything is messy. + +

    +To avoid this mess, the default mode in wgrib2 is to convert the internal grids to WE:SN order. +It makes life easier for the users and easier for the +developers. You are encouraged to use WE:SN order because it is a requirement for wgrib2's +geolocation routines. (I.e., wgrib2 requires WE:SN order in order to calculate the grid's +latitude and longitude.) The only exception to this rule is the -new_grid +option which requires the data to be in raw order (output order=raw). This option is +an exception because -new_grid expects that data to be in raw order. + +

    +To alter the internal scan order, you can use the -order option. + +

    +-sh-4.1$ wgrib2 gep19.t00z.pgrb2af180 -d 1 -V
    +1:0:vt=2009061212:200 mb:180 hour fcst:HGT Geopotential Height [gpm]:ENS=+19
    +    ndata=65160:undef=0:mean=11760.3:min=10393.5:max=12525
    +    grid_template=0:winds(N/S):
    +	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output WE:SN res 48
    +	lat 90.000000 to -90.000000 by 1.000000
    +	lon 0.000000 to 359.000000 by 1.000000 #points=65160
    + -- the grib files is WE:NS order (input WE:NS)
    + -- the internal grid is WE:SN order (output WE:SN)
    +
    +-sh-4.1$ wgrib2 gep19.t00z.pgrb2af180 -d 1 -V -order raw
    +1:0:vt=2009061212:200 mb:180 hour fcst:HGT Geopotential Height [gpm]:ENS=+19
    +    ndata=65160:undef=0:mean=11760.3:min=10393.5:max=12525
    +    grid_template=0:winds(N/S):
    +	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output raw res 48
    +	lat 90.000000 to -90.000000 by 1.000000
    +	lon 0.000000 to 359.000000 by 1.000000 #points=65160
    + -- the grib files is WE:NS order (input WE:NS)
    + -- the internal grid is raw order (output raw), which means the same as input scan order
    +
    +-sh-4.1$ wgrib2 gep19.t00z.pgrb2af180 -d 1 -V -order we:sn
    +1:0:vt=2009061212:200 mb:180 hour fcst:HGT Geopotential Height [gpm]:ENS=+19
    +    ndata=65160:undef=0:mean=11760.3:min=10393.5:max=12525
    +    grid_template=0:winds(N/S):
    +	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output WE:SN res 48
    +	lat 90.000000 to -90.000000 by 1.000000
    +	lon 0.000000 to 359.000000 by 1.000000 #points=65160
    + -- the grib files is WE:NS order (input WE:NS)
    + -- the internal grid is WE:SN order (output WE:SN)
    +
    +-sh-4.1$ wgrib2 gep19.t00z.pgrb2af180 -d 1 -V -order we:ns
    +1:0:vt=2009061212:200 mb:180 hour fcst:HGT Geopotential Height [gpm]:ENS=+19
    +    ndata=65160:undef=0:mean=11760.3:min=10393.5:max=12525
    +    grid_template=0:winds(N/S):
    +	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output WE:NS res 48
    +	lat 90.000000 to -90.000000 by 1.000000
    +	lon 0.000000 to 359.000000 by 1.000000 #points=65160
    + -- the grib files is WE:NS order (input WE:NS)
    + -- the internal grid is WE:SN order (output NS)
    +
    +-sh-4.1$ wgrib2 reduced_gaussian_surface_jpeg.grib2 -d 1 -V
    +1:0:vt=2007032312:surface:anl:TMP Temperature [K]:
    +    ndata=6114:undef=0:mean=285.342:min=210.255:max=317.485
    +    grid_template=40:winds(N/S):
    +	thinned global Gaussian grid: (-1 x 64) units 1e-06 input WE:NS output raw
    +	number of latitudes between pole-equator=32 #points=6114
    +	lat 87.864000 to -87.864000
    +	lon 0.000000 to 357.188000 
    +	#grid points by latitude: 20 27 36 40 45 50 60 64 72 75 80 90 90
    +	 96 100 108 108 120 120 120 128 128 128 128 128 128 128 128 128 128 128 128 128
    +	 128 128 128 128 128 128 128 128 128 128 128 120 120 120 108 108 100 96 90 90
    +	 80 75 72 64 60 50 45 40 36 27 20
    + -- in this file, the grid dimension is -1 x 64.  This is a thinned Gaussian grid, and
    +    nlongitude is variable.  The output scan order is raw.
    +
    +
    + + +

    +The raw2 operator is short for "raw scan order 2 output scanning order", and +2raw is short for "output scanning mode 2 raw scan mode". +The raw2 applies the mapping that goes from the file's scanning mode +to the interal scanning mode (default WE:SN). +The 2raw applies the inverse mapping. + + +

    Example 1

    + +
    +$ wgrib2 IN.grb -d 1 -rpn "rcl_lon:2raw" -set_var geolon -bin out \
    +   -rpn "rcl_lat:2raw" -set_var geolat -bin out 
    +
    +This write the longitude and latitude in binary format to file "out".
    +The lon/lat are written in the same format as the input file.
    +
    + +

    Example 2

    + +
    +SST0.grb - SST in grib format (template) in WE:NS order
    +SST.bin  - new SST in binary format, and WE:NS scan order
    +SST.grb  - new SST in grib format
    +
    +$ wgrib2 SST0.grb -import_bin SST.bin -rpn "raw2" -set_date 2020010100 -grib_out SST.grb
    +
    +or 
    +
    +$ wgrib2 SST0.grb -order raw -import_bin SST.bin -set_date 2020010100 -grib_out SST.grb
    +
    + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page created 3/30/2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/rpn_rcl.html b/docs/web_docs/rpn_rcl.html new file mode 100644 index 0000000..93cc876 --- /dev/null +++ b/docs/web_docs/rpn_rcl.html @@ -0,0 +1,182 @@ + + + + Climate Prediction Center - wgrib2: -rpn_rcl + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rpn_rcl +
     
    + +

    wgrib2: -rpn_rcl

    +
    + + +

    Introduction

    + +

    +The -rpn_rcl N is option that behaves like +-rpn "rcl_N". The only difference is the +the latter will automatically compute the longitudes and latitudes +of all the grid points. +The -rpn_rcl and +-rpn_sto do not initiate the geolocation +calculations which make them ideal for CW2 applications. +

    Usage

    +

    +

    +-rpn_rcl N     N=0..9
    +   replaces the memory-copy of the grid values with register N
    +
    + +

    +See also: +-rpn, +-rpn_sto, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Aug 3, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/rpn_smth9.html b/docs/web_docs/rpn_smth9.html new file mode 100644 index 0000000..88b91a6 --- /dev/null +++ b/docs/web_docs/rpn_smth9.html @@ -0,0 +1,192 @@ + + + + Climate Prediction Center - wgrib2: -rpn smth9g smth9r + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rpn smth9g smth9r +
     
    + +

    wgrib2: -rpn smth9g smth9r

    +
    + + +

    Introduction

    + +

    +The RPN operators smth9g and smth9r do a 9 point +smoothing of a spatial field. These operators are based on the GrADS's smth9 operator. There +are two differences. (1) GrADS knows whether the fields are global or regional whereas RPN +has a regional and global operator. (2) GrADS's smth9 function will not convert undefined +grid point to defined whereas RPN's smth9 will. + +

    Smth9 Weighting

    +

    +Smth9 considers a 3x3 box centered about the grid point in question (i,j). +The following weights are used. Points that are outside of the domain +or have undefined values are naturally not included. + +

    +       0.3   0.5   0.3
    +       0.5   1.0   0.5
    +       0.3   0.5   0.3
    +
    + +

    Reasons for differences from GrADS smth9

    + +

    You often want to run GCMs with observed SST and sea-ice fields. +A problem can occur when the land-water mask of the model is not the +same as for the SST or sea-ice analyses. For example, if the land +masks differ, there may be a grid point where the SST analyses considers +to be land and the model considers to be water. By using smth9g, you can +minimize this problem. + + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Sep 15, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/rpn_sto.html b/docs/web_docs/rpn_sto.html new file mode 100644 index 0000000..de7dee7 --- /dev/null +++ b/docs/web_docs/rpn_sto.html @@ -0,0 +1,183 @@ + + + + Climate Prediction Center - wgrib2: -rpn_sto + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rpn_sto +
     
    + +

    wgrib2: -rpn_sto

    +
    + + +

    Introduction

    + +

    +The -rpn_sto N is option that behaves like +-rpn "sto_N". The only difference is the +the latter will automatically compute the longitudes and latitudes +of all the grid points. +The -rpn_rcl and +-rpn_sto do not initiate the geolocation +calculations which make them ideal for CW2 applications. + +

    Usage

    +

    +

    +-rpn_sto N     N=0..9
    +   saves the memory-copy of the grid values in to register N
    +
    + +

    +See also: +-rpn, +-rpn_rcl, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Aug 3, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/rpn_wind-chill.html b/docs/web_docs/rpn_wind-chill.html new file mode 100644 index 0000000..e97f54c --- /dev/null +++ b/docs/web_docs/rpn_wind-chill.html @@ -0,0 +1,228 @@ + + + + Climate Prediction Center - wgrib2: -rpn example: wind-chill + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rpn example +
     
    + +

    wgrib2: -rpn to Calculate Wind-Chill

    +
    + + +

    Introduction

    + +

    +The -rpn option runs a reverse Polish notation +(RPN) +calculator. In this example, I will show how to calculate the +wind-chill with wgrib2. The formula for wind chill (Environment Canada) +depends on the temperature (2 m) and wind speed (10 m). +

    + +
    +# from formula from wikipedia (retrieved 12/2013)
    +#
    +# wind chill formula used by Environment Canada
    +#
    +# Twc = 13.12 + 0.6216*T - 11.37*V^0.16 + 0.3965 * T * V^0.16
    +#  Twc = wind chill in C
    +#  T = air temp in C
    +#  V = 10 m wind speed in m/s
    +
    + +Using an online infix -> postfix converter, one finds +
    +Twc is 13.12 0.6216 T * + 11.37 V 0.16 ^ * - 0.3965 T * V 0.16 ^ * +
    +
    + +Here is the script. + +
    +     1	#!/bin/sh
    +     2	#
    +     3	# from formula from wikipedia (retrieved 12/2013)
    +     4	#
    +     5	# wind chill formula used by Environment Canada
    +     6	#
    +     7	# Twc = 13.12 + 0.6216*T - 11.37*V^0.16 + 0.3965 * T * V^0.16
    +     8	#  Twc = wind chill in C
    +     9	#  T = air temp in C
    +    10	#  V = 10 m wind speed in m/s
    +    11	#
    +    12	# using online infix -> postfix converter
    +    13	#      Twc is 13.12 0.6216 T * + 11.37 V 0.16 ^ * - 0.3965 T * V 0.16 ^ * +
    +    14	#
    +    15	# for grib2 wind chill is in K
    +    16	#
    +    17	file=$1
    +    18	out=out.grb2
    +    19	
    +    20	wgrib2 $file \
    +    21	  -grib $out \
    +    22	  -if ":TMP:2 m above ground:" -rpn "273.15:-:sto_1" -print "saved T2m in reg1" -fi \
    +    23	  -if ":UGRD:10 m above ground:" -rpn "sto_2" -print "saved U10m in reg2" -fi \
    +    24	  -if ":VGRD:10 m above ground:" -rpn "sto_3" -print "saved V10m in reg3" -fi \
    +    25	  -if_reg "1:2:3" -rpn "rcl_2:rcl_2:*:rcl_3:rcl_3:*:+:sqrt:sto_4" -print "wind speed calculated" \
    +    26	      -rpn "13.12:0.6216:rcl_1:*:+:11.37:rcl_4:0.16:^:*:-:0.3965:rcl_1:*:V:0.16:^:*:+:273.15:+" \
    +    27	      -set_var WCF -grib_out $out  \
    +    28	  -if_reg "1:2:3" -rpn "clr_1:clr_2:clr_3" -fi
    +
    +Line 21 copies all fields to file $out
    +Line 22 saves 2 m temperature (C) register 1
    +Line 23 saves 10 m U (m/s) in register 2
    +Line 24 saves 10 m V (m/s) in register 3
    +Line 25 calculates and saves wind speed in register 4
    +Line 25-27 writes out WCF, wind chill (factor) in K.
    +Line 28 clears registers so that lines 24-27 are only done once
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 10, 2013 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/s.html b/docs/web_docs/s.html new file mode 100644 index 0000000..35473d3 --- /dev/null +++ b/docs/web_docs/s.html @@ -0,0 +1,196 @@ + + + + Climate Prediction Center - wgrib2: -s + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-s +
     
    + +

    wgrib2: -s

    +
    + + +

    Introduction

    + +

    +The -s option prints out a simple inventory. + +

    +-sh-2.05b$ wgrib2 new.grb2 -s 
    +1:0:d=2007032600:HGT:1000 mb:anl:
    +2:125535:d=2007032600:HGT:1000 mb:3 hour fcst:
    +
    + +

    +The -s option is coded like a macro, the option +call other options like -t, -var, -lev, -ftime, and -misc. The last option, +-misc, changes with time. For example, when chemical tracers were added, -misc +was expanded to print out the characteristics of the tracers. + +

    +The output of the options, including -s, can be saved by the -inv option. +

    Usage

    +

    + +

    +-s
    +
    + +See also: +-ftime, +-inv, +-lev, +macros, +-match_inv +-misc +-t +-var +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005, Nov, 2019 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/s_out.html b/docs/web_docs/s_out.html new file mode 100644 index 0000000..30600da --- /dev/null +++ b/docs/web_docs/s_out.html @@ -0,0 +1,193 @@ + + + + Climate Prediction Center - wgrib2: -s_out + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -s_out +
     
    + +

    wgrib2: -s_out

    +
    +

    The -s_out option is obsolete with the introduction of the +-last option. +

    +    old:  -s_out FILE
    +    new:  -s -last FILE -nl_out FILE
    +
    + + + + +

    Introduction

    + +

    +The -s_out option prints out a simple inventory (-s) to a file. + +

    +-sh-2.05b$ wgrib2 new.grb2 -s inv.dat
    +1:0:d=2007032600:HGT:1000 mb:anl:
    +2:125535:d=2007032600:HGT:1000 mb:3 hour fcst:
    +-sh-2.05b$ cat inv.dat
    +d=2007032600:HGT:1000 mb:anl:
    +d=2007032600:HGT:1000 mb:3 hour fcst:
    +
    + +

    Usage

    +

    + +

    +-s_out FILE
    +
    + +See also: -s, +-s_f77, +-inv, +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/scale.html b/docs/web_docs/scale.html new file mode 100644 index 0000000..bc37c83 --- /dev/null +++ b/docs/web_docs/scale.html @@ -0,0 +1,200 @@ + + + + Climate Prediction Center - wgrib2: -scale + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-scale +
     
    + +

    wgrib2: -scale

    +
    + + +

    Introduction

    + +

    +In grib, grid values are usually stored as + +

    +  grid_value = (ref_value + I*2**bin_scaling)) * 10**decimal_scaling.
    +    ref_value = 32-bit IEEE floating point number
    +    I is a positive integer
    +    binary_scaling = -127..127
    +    decimal_scaling = -127..127
    +
    + +This is not an absolute as the grid point values can be stored as +a spectral coefficients, IEEE floating point values and other formats. +The -scale option prints the binary and +scaling factors. + +

    Usage

    +

    +

    +-scale
    +
    + +

    Example

    +

    +

    +bash-4.1$ wgrib2 gep19.t00z.pgrb2af180  -scale -for 13:14
    +13:473374:scale=-3,4
    +14:528630:scale=-1,0
    +bash-4.1$ wgrib2 gep19.t00z.pgrb2af180  -scale -for 13:14 -v -packing
    +13:473374:scale=-3,4:packing=grid point data - jpeg2000 compression,j val=(2.32109e+06+i*2^4)*10^-3, i=0..65535 (#bits=16)
    +14:528630:scale=-1,0:packing=grid point data - jpeg2000 compression,j val=(2215+i*2^0)*10^-1, i=0..1023 (#bits=10)
    +
    + +

    +See also: +-scaling +-set_scaling +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 21, 2015 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/scaling.html b/docs/web_docs/scaling.html new file mode 100644 index 0000000..7d83039 --- /dev/null +++ b/docs/web_docs/scaling.html @@ -0,0 +1,203 @@ + + + + Climate Prediction Center - wgrib2: -scaling + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-scaling +
     
    + +

    wgrib2: -scaling

    +
    + + +

    Introduction

    + +

    +In grib, grid values are usually stored as + +

    +  grid_value = (ref_value + I*2**bin_scaling)) * 10**decimal_scaling.
    +    I is an positive integer
    +    ref_value = 32-bit IEEE floating point number
    +    binary_scaling = -127..127
    +    decimal_scaling = -127..127
    +    number_of_bits = the smallest N such that I < 2**N
    +      note: WMO does not place a maximum value of the number of bits
    +            however, implementations do have limits.  The limits will
    +            vary by software package and procedure.  
    +
    + +This is not an absolute as the grid point values can be stored as +a spectral coefficients, IEEE floating point values and other formats. +The -scaling option +prints the binary and scaling factors, the reference value and the number +of bits used for the integer I. + +

    Usage

    +

    +

    +-scaling
    +
    + +

    Example

    +

    +

    +$ wgrib2 gep19.t00z.pgrb2af180  -scaling -for 13:14 -v -packing
    +13:473374:scaling ref=2.32109e+06 dec_scale=-3 bin_scale=4 nbits=16:packing=grid point data - jpeg2000 compression,j val=(2.32109e+06+i*2^4)*10^-3, i=0..65535 (#bits=16)
    +14:528630:scaling ref=2215 dec_scale=-1 bin_scale=0 nbits=10:packing=grid point data - jpeg2000 compression,j val=(2215+i*2^0)*10^-1, i=0..1023 (#bits=10)
    +
    + +

    +See also: +-scale +-set_scaling +-grib_max_bits +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 21, 2015 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/scaling_0001.html b/docs/web_docs/scaling_0001.html new file mode 100644 index 0000000..aa9a131 --- /dev/null +++ b/docs/web_docs/scaling_0001.html @@ -0,0 +1,204 @@ + + + + Climate Prediction Center - wgrib2: -ncpu + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -scaling_0001 +
     
    + +

    wgrib2: -scaling_0001

    +
    + + +

    Scaling_0001

    + +

    +The standard NCEP post-processor uses data files that specify the +precision of every field (grid values have values of i*10^j*2^k, +where j and k are specified by the data file). Different models +may have different precisions even though they use the +same NCEP post-processor. + +

    Wgrib2, by default, writes new fields using the ECMWF-style +which specifies the binary precision, n. (grid values have values +i*2^j, where the values of i ranges from 0 to 2^(n+1) - 1) + +

    The +-scaling_0001 option converts a field from ECMWF-style +precision to NCEP-style precision. Since everybody has a different scaling, +-scaling_0001 was designed to be an example on how +to write an option that applies your precisions. I am assuming +that are creative enough that there will be no duplicate names. I will +include scaling_* to the wgrib2 distributions. + +

    Usage

    +

    +

    +-scaling_0001
    +
    + +

    Example

    +
    +wgrib2 IN.grb -scaling_0001 -set_grib_type c3 -grib_out OUT.grb
    +
    + +

    To add your own Scaling

    +
    +1) cd (wherever)/grib2/wgrib2
    +2) cp Scaling_0001.c Scaling_mymodelv1.c
    +          (note code needs to start with a capital)
    +3) edit Scaling_mymodelv1.c
    +     don't forget to change scaling_0001 to scaling_mymodelv1 everywhere
    +4) cd ..
    +(compile wgrib2 using directions)
    +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 10, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/scan.html b/docs/web_docs/scan.html new file mode 100644 index 0000000..11c59bf --- /dev/null +++ b/docs/web_docs/scan.html @@ -0,0 +1,249 @@ + + + + Climate Prediction Center - wgrib2: -scan + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -scan +
     
    + +

    wgrib2: -scan

    +
    + + +

    Introduction:

    + +

    +A grib message contains the grid point values. If you are a C programmer, the grid would +naturally be in "C" order. A fortran programmer would have the grid in fortran order. +Some people would start from the NW corner and others would start from the SW corner. +In grib1, all these scan orders are possible. The grib1 scan orders are, + +

      +
    1. WE:SN +
    2. WE:NS +
    3. EW:SN +
    4. EW:NS +
    5. SN:WE +
    6. NS:WE +
    7. SN:EW +
    8. NS:EW +
    + +You read the above notation (WE:SN) by first go from W to E then go from S to N. + +
    +AB:CD
    +   do i = C to D
    +     do j = A to B
    +       data
    +     enddo
    +   enddo
    +
    + +Grib2, includes the above 8 scan orders and adds 4 more useful +scan orders. + +
      +
    1. WE|EW:SN +
    2. WE|EW:NS +
    3. EW|WE:SN +
    4. EW|WE:NS +
    + +
    +AB|BA:CD
    +   odd_row=true
    +   do i = C to D
    +     if (odd_row) {
    +       do j = A to B
    +         data
    +       enddo
    +     }
    +     else {
    +       do j = B to A
    +         data
    +       enddo
    +     }
    +     odd_row = not odd_row
    +   enddo
    +
    +

    +This "plow the field" order reduces the file size when using +regional grids and saving the increments. +

    + +

    +Grib2 has 16 scan orders of which 3 are common: WE:SN, WE:NS and WE|EW:SN. +Wgrib2 simplfies life by internally converting fields to WE:SN by default. + +

    Usage

    +

    + +

    +-scan
    +
    +

    Example

    +

    +

    +-$ wgrib2 ds_ens.grb -scan
    +1:0:scan=5 input=WE|EW:SN output=WE:SN
    +2:218709:scan=5 input=WE|EW:SN output=WE:SN
    +3:434276:scan=5 input=WE|EW:SN output=WE:SN
    +...
    +input=WE|EW:SN   the grib file is in WE|EW:SN scan order
    +output=WE:SN     the internal registers and output files except for grib
    +                 will be in WE:SN order, use the -order option to change
    +                 the output scan order
    +
    + +See also: +-order, +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/selecting_messages.html b/docs/web_docs/selecting_messages.html new file mode 100644 index 0000000..ff4b0db --- /dev/null +++ b/docs/web_docs/selecting_messages.html @@ -0,0 +1,189 @@ + + + + Climate Prediction Center - wgrib2: -lola + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 selecting messages +
     
    + +

    wgrib2: selecting messages

    +
    + + +

    Introduction

    + +

    +

    + +Grib files contain many grib messages (records, fields). Often you only want to +process selected fields. With wgrib, you could process all "-d all", specific +message number, "-d N", or by using "grep" and the "-i" option. + +

    +   wgrib -d all grb                            writes all records to binary file to "dump"
    +   wgrib -d 10  grb                            write record 10 to binary file "dump"
    +   wgrib grb | grep ":HGT:" | wgrib -i grb     write HGT fields to "dump"
    +
    + +

    +Wgrib2 is very similar. The differences is that "-d all" is gone and writing +to binary file is not a default option. + +

    +

    +   wgrib2 -bin dump grb                       write all records to binary file "dump"
    +   wgrib2 -d 10   -bin dump grb               write record 10 to binary file "dump"
    +   wgrib2 -d 10.1 -bin dump grb               write record 10.1 to binary file "dump"
    +   wgrib2 grb | grep ":HGT:" | wgrib2 -i grb -bin dump    write HGT fields to "dump"
    +   wgrib2 -match ":HGT:" grb -bin dump        new syntax: write HGT fields to "dump"
    +
    + +One difference is record numbers may have a "decimal point". With grib2, for example, +the U and V winds may be in the same grib2 record. In the wgrib2 notation, +the first submessage would be N.1 (or N) and the second submessage would be N.2. + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set.html b/docs/web_docs/set.html new file mode 100644 index 0000000..3e59053 --- /dev/null +++ b/docs/web_docs/set.html @@ -0,0 +1,261 @@ + + + + Climate Prediction Center - wgrib2: -set + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set +
     
    + +

    wgrib2: -set

    +
    + + +

    Introduction

    + +

    +Please see new grib for the basic +concepts of making new grib files. + + +

    +The -set option changes specific metadata +of the in-memory grib (sub-)message. Expect the list of +supported fields to expand as needed. At present, the +-set option only changes fields +within the grib file. There is some overlap between various +-set_* options and the -set option. (Ex. -set_center N, and -set center N.) +The -set option is the newer method. +

    + +

    Parameters that can be set

    +

    The available parameters that can be set will depend on the version of wgrib2 being used. +To see the parameter available, + +

    +$ wgrib2 grib_file -set junk junk
    +*** FATAL ERROR: set: allowed values: discipline, center, subcenter, master_table, local_table, 
    +background_process_id, analysis_or_forecast_process_id, model_version_date, chemical, table_1.2, 
    +table_1.3, table_1.4, table_3.0, table_3.1/GDT, table_3.2, table_3.3, table_3.4, table_4.0/PDT, 
    +table_4.1, table_4.2, table_4.3, table_4.5a, table_4.5b, table_4.6, table_4.7, table_4.8, 
    +table_4.10, table_4.11, table_4.230, table_5.0/DRT, table_6.0, % ***
    +
    +"grib_file" has to be a grib file, and "junk" is any non-supported parameter. +

    + +

    + +

    Usage

    +
    +-set X Y             X=field, Y=integer/float/long long int
    +                     depending on X
    +
    +                     To find the values of X, use: wgrib2 - -set help all
    +
    + +

    Fields (as of wgrib2 v2.0.1)

    + +
      +
    1. discipline or table_0.0 (fixed v2.0.5) +
    2. center +
    3. subcenter +
    4. master_table or table_1.0 +
    5. local_table or table_1.1 +
    6. background_process_id +
    7. analysis_or_forecast_process_id +
    8. model_version_date +
    9. table_1.2 +
    10. table_1.3 +
    11. table_1.4 +
    12. table_3.0 +
    13. table_3.1 or GDT +
    14. table_3.3 +
    15. table_3.4 +
    16. table_4.0 or PDT +
    17. table_4.1 +
    18. table_4.2 +
    19. table_4.3 +
    20. table_4.6 +
    21. table_4.10 +
    22. table_4.11 +
    23. table_5.0 or DRT +
    24. table_6.0 +
    + +

    Fields (as of wgrib2 v2.0.8)

    +
      +
    1. most are obvious and take an integer argument +
    2. %: integer 0..100, percentage forecast +
    3. model_version_date: YYYYMMDDHHmmss, for PDT 4.60 and 4.61 +
    + +

    Example

    +
    +$ wgrib2 -set center 99 -center
    +1:0:center=De Bilt, Netherlands
    +2:46042:center=De Bilt, Netherlands
    +3:63079:center=De Bilt, Netherlands
    +4.1:86046:center=De Bilt, Netherlands
    +...
    +
    + +The -set_var option will rename +all the fields in a grib file. If you only want to rename +specific fields, you will have to use the +-if and -fi options. +

    +See also: + +-fi, +-grib, +-grib_out, +-if +-set_metadata +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005, April 13, 2018, April 8, 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_ave.html b/docs/web_docs/set_ave.html new file mode 100644 index 0000000..0cbc6ed --- /dev/null +++ b/docs/web_docs/set_ave.html @@ -0,0 +1,179 @@ + + + + Climate Prediction Center - wgrib2: -set_ave + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_ave +
     
    + +

    wgrib2: -set_ave

    +
    + + +

    Introduction

    + +

    +Prior to 7/2016, ftime v1 was used to print the "ftime" values. +One used set_time v1 and set_ave to modify the "ftime" values. +After 7/2016, the version 1 routines because -ftime1, -set_ftime1 and -set_ave. +The version 2 routines became -ftime2 and -set_ftime2. The -set_ave was +not used. For -ftime and -set_ftime options called -ftime2 and -set_ftime2 +by default. + +

    +Eventually the version 1 routines will be removed. + +

    +See also: +-set_ftime +-set_ftime1 +-set_ftime2 +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Sept 12, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_bin_prec.html b/docs/web_docs/set_bin_prec.html new file mode 100644 index 0000000..42727a0 --- /dev/null +++ b/docs/web_docs/set_bin_prec.html @@ -0,0 +1,240 @@ + efficiently. + + + Climate Prediction Center - wgrib2: -set_bin_prec + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_bin_prec +
     
    + +

    wgrib2: -set_bin_prec

    +
    + + +

    Introduction

    + +

    +The values at the grid points points are stared in a general format, + +

    +
    +  Y = (R + i*2**B)*(10**D)
    +
    +  R = reference value (32-bit IEEE floating point number)
    +  i = integer, 0..2**N-1
    +  N = binary bit precision
    +  B = binary scaling, -127..127
    +  D = decimal scaling, -127..127
    +
    + +There are 3 sytems for storing the number which I have called + +
    +
    +ECMWF convention: D = 0, N = parameter
    +
    +  Y = R + i*2**B
    +  R = reference value
    +  i = integer, 0..2**N-1
    +  N = binary bit precision, a parameter
    +  B = binary scaling, determined by grib routines
    +
    +NCEP convention: B = parameter, D = parameter
    +
    +  R = reference value
    +  i = integer, 0..2**N-1
    +  N = binary bit precision, determined by grib routines
    +  B = binary scaling, a parameter
    +  D = decimal scaling, a parameter
    +
    +  Note, global model uses a variant: B = 0, D = parameter
    +
    + +

    +Both the ECMWF and NCEP conventions have their advantages and +disadvantages. The ECMWF method is easier to use, you just +set the binary precision to N bits (12? 16?) for all variables +and you are done. With the NCEP convention, you have to +set the scaling for each variable separately. For some variables +such as specific humidity, the scaling should be pressure +dependent. On the other hand, if you are trying to get the smallest +files, the NCEP convention is better. For example, you want to +get the RH to the nearest integer. With the NCEP method, you simply +set D = B = 0. For general use, I suggest that you use the ECMWF +convention because people time is usually more valuable than disk space. +Ok, I value my time more than a few GB. On the othe hand, I've been +involved with more than my share of projects were disk space +has been the critical issue. +

    +By the way, the wgrib2 default for encoding grib is 12-bits using +the ECMWF convention. + +

    Usage

    +The -set_bin_prec option is used to +set wgrib2 to encode data using the ECMWF convention. + +

    + +

    +-set_bin_prec N
    +  N = number of bits to encode grid point data
    +  N should be ≤ 25 for the current version of wgrib2
    +
    +  if N is > 12, you need to increase the maximum bits of allowed
    +  precision by -set_grib_max_bits
    +
    + +

    +See alse: +-scale +-scaling +-set_grib_max_bits +-set_scaling +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 21, 2015, Marcy 11, 2019 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_bitmap.html b/docs/web_docs/set_bitmap.html new file mode 100644 index 0000000..99d1367 --- /dev/null +++ b/docs/web_docs/set_bitmap.html @@ -0,0 +1,208 @@ + + + + Climate Prediction Center - wgrib2: -set_betmap + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_bitmap +
     
    + +

    wgrib2: -set_bitmap

    +
    + + +

    Introduction

    + +

    +Complex packed grib files can have undefined grid values stored in +the grib files as either a bitmap or a special value. You should use +the special value method because it results in significantly smaller +files. If software is a concern, you should use whatever is compatible +with the decoding software. Note: only complex packing allows for +using a special value for undefined grid values. + +

    Wgrib2's will store undefined grib values using a special +value when using complex packing unless the +-set_bitmap 1 option is used. +The option -set_grib_type same will not +enable the bitmap option. + +

    Software Concerns

    + +

    +NDFD (National Digital Forecast Database) which is produced by NOAA has +used complex packing with a special value since the beginning (many years ago). +Consequently many decoders will be able to handle special-value undefineds. +Many codes will handle bitmaps because bitmaps were used in +jpeg2000 packed grib2 files which have been used by NCEP for many +years. At least one organization has codes that will not read +special-value undefineds. + +

    Usage

    +

    + +

    +-set_bitmap X   X=0, 1   0=do not use bitmap (default) 1=use bitmap
    +                when packing undefined values with complex packing
    +
    + +

    Example

    +

    + +

    +$ wgrib2 in.grb -set_bitmap 1 -set_grib_type complex3 -grib_out out.grb 
    +
    +The above line rewrites a file using complex3 packing and a bitmap. +A bitmap is not used if all the grid values are defined. + +

    +See also: -grib_out, +See also: -set_grib_type, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan 14, 2015 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_byte.html b/docs/web_docs/set_byte.html new file mode 100644 index 0000000..241835a --- /dev/null +++ b/docs/web_docs/set_byte.html @@ -0,0 +1,199 @@ + + + + Climate Prediction Center - wgrib2: -set_byte + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_byte +
     
    + +

    wgrib2: -set_byte

    +
    + + +

    Introduction

    + +

    +The -set_byte option sets 1 octet (byte) to a +a specified integer value. The integer value ranges from 0 to 255. + + +

    +-set_byte I J K
    +  I = section number = 1..7
    +  J = location in the section = 1..(section length)
    +  K = 0 .. 255
    +would set 
    +  Section I, Octet J to the value K
    +
    + +

    +Multiple octets can be set by making the third argument a colon seperated list. + +

    Usage

    +

    + +

    +-set_byte  SECTION STARTING_OCTET_LOCATION I-1:I-2:..:I-N
    +SECTION=0 .. 7
    +STARTING_OCTET_LOCATION ≥ 1
    +I-M = Mth octet
    +
    + +

    Example

    + +

    +See also: +-set_hex +-set_ieee +-set_int +-set_int2 +-set_ieee +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: June 1, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_center.html b/docs/web_docs/set_center.html new file mode 100644 index 0000000..c291fbe --- /dev/null +++ b/docs/web_docs/set_center.html @@ -0,0 +1,170 @@ + efficiently. + + + Climate Prediction Center - wgrib2: -set_center + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_center +
     
    + +

    wgrib2: -set_center

    +
    + + +

    Introduction

    + +

    +The -set_center option is deprecated, please use +the -set center option. + +

    +See alse: +-set +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: August 11, 2015 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_date.html b/docs/web_docs/set_date.html new file mode 100644 index 0000000..3a3ef1d --- /dev/null +++ b/docs/web_docs/set_date.html @@ -0,0 +1,246 @@ + + + + Climate Prediction Center - wgrib2: -set_date + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_date +
     
    + +

    wgrib2: -set_date

    +
    + + +

    Introduction

    + +

    +The -set_date option changes the reference +date of the in-memory grib (sub-)message. You can write out the message +with the new date by the -grib option. If you use +-grib_out option to write out the changed grib message, you +will write the grib message with the compression method and precision that +is in effect at the time. This is slower and may lose precision. +Of course if the in-memory grid values have been modified, you have to use the +-grib_out. + +

    +The option -set_date X sets the reference time +to "date code" X, where X is +YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm or YYYYMMDDHHmmSS. +(YYYY=year, MM=month, DD=day, HH=hour, mm=minute, SS=second) +If MM/DD/HH/mm/SS is missing, the original MM/DD/mm/SS is unaltered. + + +

    +You can set the reference time to a unix time (number of seconds after +the start of January 1, 1970 by the argument "u(signed integer)". +This is convenient for converting netcdf files to grib because +netcdf files use unix time. + +

    +You can change the reference time by an offset. To change the reference time +by an offset, the argument has to start with either a negative sign or positive sign, +followed by an integer and ending with a units (yr, mo, dy, hr, or mn). Note: minutes +abreviation "mn" is easily confused as the abreviation for month and was added with wgrib2 v2.0.8. + +

    Usage

    +

    + +

    +-set_date X            X = reference time, usually starting date
    +                       X=YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm or YYYYMMDDHHmmSS
    +                       YYYY=year, MM=month, DD=day, HH=hour, mm=minute, SS=second
    +                       if MM/DD/HH/mm/SS is missing, the original MM/DD/mm/SS is unaltered
    +
    +-set_date uN           N is a signed integer containing the number of seconds after the start 
    +                       of January 1, 1970.  N follows the local OS convention of unix time such 
    +                       as ignoring leep seconds.  The limitation on N is OS dependent.
    +
    +                       Newer linux: N is signed 64 bit integer. However N is limited by the
    +                        wgrib2 implementation which stores N in a double precision variable.
    +                       Older linux: N is a signed 32 bit integer (problem in 2037)
    +                       Other OS:  varies, one OS uses N as a unsigned-32 bit integer.
    +
    +-set_date -N(units)    negative offset (wgrib2 v2.0.5+)
    +-set_date +N(units)    positive offset (wgrib2 v2.0.5+)
    +                       N = unsigned integer
    +                       units = hr, dy, mo or yr  (GrADS time units for hour, day, month and year)
    +                          mn (minutes) was added with v2.0.8.
    +
    + +

    Example

    +
    +$ wgrib2 png.grb2
    +1:4:d=2009060500:RH:2 m above ground:330 hour fcst:ens std dev
    +$ wgrib2 png.grb2 -set_date 20180101 -grib OUTFILE -s
    +:4:d=2018010100:RH:2 m above ground:330 hour fcst:ens std dev
    +$ wgrib2 png.grb2 -set_date +12hr -grib OUTFILE -s
    +1:4:d=2009060512:RH:2 m above ground:330 hour fcst:ens std dev
    +$ wgrib2 png.grb2 -set_date -12hr -grib OUTFILE -s
    +1:4:d=2009060412:RH:2 m above ground:330 hour fcst:ens std dev
    +
    +Note: wgrib2 png.grb2 -set_date -12hr -grib OUTFILE -s 
    +has a different inventory than
    +      wgrib2 png.grb2 -s -set_date -12hr -grib OUTFILE
    +because the latter prints the inventory before the date has been modified.
    +Note: wgrib2 png.grb2 -set_date -12hr -grib OUTFILE is the same as
    +      wgrib2 png.grb2 -set_date -12hr -grib OUTFILE -s 
    +because wgrib2 will add a "-s" to the command line when it detects
    +that the command line has no inventory options.
    +
    + +See also: + +-grib, +-grib_out, +-s, +-t, +-T, +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 10, 2016, July 2, 2018, March 2022. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_ens_num.html b/docs/web_docs/set_ens_num.html new file mode 100644 index 0000000..54f69e0 --- /dev/null +++ b/docs/web_docs/set_ens_num.html @@ -0,0 +1,217 @@ + + + + Climate Prediction Center - wgrib2: -set_ens_num + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_ens_num +
     
    + +

    wgrib2: -set_ens_num

    +
    + + +

    Introduction

    + +

    +The -set_ens_num option changes PDT 0,1 -> 1 and +8,11 -> 11. PDT 1 and 11 are for "forecasts from a specified member of an ensemble. +Effectively this option add an "ensemble member ID" to the forecast. + +

    With wgrib2 v3.1.1, more PDTs can be promoted to ensemble-member PDTs. + +

    Merging ensembles, Adding New Members

    + +

    When ensembles are made, each member has a unique perturbation/member +number. When you want to merge ensembles, the member numbers +may no longer be unique. You would want to renumber the forecasts +sp that they would be unique. Sometimes you would want to add a forecast +with no ensemble information; you need a way to add a ensemble member number. + + +

    Usage

    +

    + +

    +-set_ens_num X Y Z
    +X = 0..255 type of ensemble member (Code Table 4.6)
    +Y = 0..255 perturbation number
    +Z = 0..255  number of forecasts in the ensemble
    +
    + +

    Example

    +
    +$ wgrib2 ds.td.bin -set_ens_num 3 1 10 -grib ds_ens.grb
    +1:80:d=2009062918:DPT:surface:60 hour fcst:ENS=+1
    +2:218826:d=2009062918:DPT:surface:66 hour fcst:ENS=+1
    +3:434430:d=2009062918:DPT:surface:72 hour fcst:ENS=+1
    +4:652869:d=2009062918:DPT:surface:78 hour fcst:ENS=+1
    +5:871866:d=2009062918:DPT:surface:84 hour fcst:ENS=+1
    +6:1088694:d=2009062918:DPT:surface:90 hour fcst:ENS=+1
    +7:1304003:d=2009062918:DPT:surface:96 hour fcst:ENS=+1
    +8:1549304:d=2009062918:DPT:surface:102 hour fcst:ENS=+1
    +...
    +
    +-set_ens_num 3 1 10
    +    3 = positive perturbed forecast
    +    1 = perturbation number
    +   10 = number of ensemble members
    +
    +-grib ds_ens.grb
    +   save the new grib file in ds_ens.grb
    +
    + + +See also: +-set_ensm_derived_fcst, +-ens, +-N_ens + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_ensm_derived_fcst.html b/docs/web_docs/set_ensm_derived_fcst.html new file mode 100644 index 0000000..6b7a3dc --- /dev/null +++ b/docs/web_docs/set_ensm_derived_fcst.html @@ -0,0 +1,201 @@ + + + + Climate Prediction Center - wgrib2: -set_ensm_derived_fcst + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_ensm_derived_fcst +
     
    + +

    wgrib2: -set_ensm_derived_fcst

    +
    + + +

    Introduction: set ensemble mean derived forecast

    + +

    +The -set_ensm_derived_fcst option changes +Product Definition Template (PDT) 0,1,2 -> 2 or 8,11,12 -> 12. PDT 2, and 12 +are for "ensemble mean derived forecasts". Effectively this options describes the forecast +as being derived from an ensemble of forecasts. The types derived forecasts is listed in +code table 4.7. +The "cluster" derived forecast should not be used with this option as PDT 2 and 12 do not +have metadata to describe the cluster that was used. + + +

    Usage

    +

    + +

    +-set_ensm_derived_fcst X Y
    +X = code table 4.7
    +Y = 0..255  number of forecasts in the ensemble
    +
    + +

    Example

    +
    +$ wwgrib2 sst.grb2  -set_ensm_derived_fcst 1 10 -grib newsst.grb
    +1:0:d=1981110100:TMP:surface:0-1 month ave anl:wt ens-mean
    +
    +-set_ensm_derived_fcst 1 10
    +    1 = weighted mean of all members (code table 4.7)
    +   10 = number of ensemble members
    +
    +-grib newsst.grb
    +   save the new grib file in newsst.grb
    +
    + + +See also: +-set_ens_num, +-ens, +-N_ens + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_ext_name.html b/docs/web_docs/set_ext_name.html new file mode 100644 index 0000000..55fb8bf --- /dev/null +++ b/docs/web_docs/set_ext_name.html @@ -0,0 +1,264 @@ + + + + Climate Prediction Center - wgrib2: -set_ext_name + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_ext_name +
     
    + +

    wgrib2: -set_ext_name

    +
    + + +

    Introduction

    + +

    In the beginning, grib fields were identified by a name, a level +and some timing information. Life was simple and the people were +happy. This was soon to pass. A hoard of ensemble members appeared +in the distance. A dust storm rolled in from the plains. The new +power plants started putting sulfar dioxide into the air. All this +had to added to the grib format. So names had to have modifiers, +the percentile of some particulates of some chemical between size +A and B microns. So wgrib2 added "extended names". +So you could +switch beween the old simpler names and the newer extended names. + + +

    Extended Names

    + +

    +The extended name includes modifiers like the ensemble information, +dust information and probabilities. Optionally you can include +the level and forecast information (wgrib2 v3.0.2+). More details +are given here. + +

    Usage

    +To select between the regular and extended name, you use + +
    +   -set_ens_name N
    +      
    +      N == 0                 default
    +      N == 1                 add misc terms like ensemble or probability
    +                               extension for wgrib2 v3.0.2+
    +      and(N,1) == 1          add misc terms like ensemble or probability
    +      and(N,2) == 2          add level information
    +      and(N,4) == 4          add forecast information
    +      ex N == 3              misc + level information
    +      ex N == 5              misc + forecast information
    +      ex N == 6              level information + forecast information
    +      ex N == 7              misc + level information + forecast information
    +      N > 7                  for future use
    +
    + +

    Extended Extended Names

    + +

    The extended name facility was extended with wgrib2 v3.0.2 in order +to fix a problem with converting grib to netcdf with some of the newer +NCEP files. When wgrib2 writes netcdf files, the -netcdf concatinates +the level information to the extended name to produce the netcdf name +for the field. For some of the newer NCEP forecast files, this name +wasn't unique. So the extended name needs to optionally include +the forecast time information. With this extension, the level +information was added as another option field to the extended name. + + +

    +  $ wgrib2.v3.0.2 FCST.grb -set_ext_num 1 -netcdf FCST.nc
    +     lost fields because the field names were not unque
    +
    +  $ wgrib2.v3.0.2 FCST.grb -set_ext_num 5 -netcdf FCST.nc
    +     extended name include misc-info and forecast-time-info.
    +
    + +

    +The final modification to the extended name, was to make the field and space +character a run-time parameter by the option, -set_ext_name_chars. The default +values are '.' and '_' for backwards compatibilty. The modification was needed +we now are seeing level-info and misc-info with periods in them like "0.5 mb". + + + + + +

    -match, -if, and other string matches

    + +

    The extended names also applies the match inventory. So string matches will have +to be rewritten. Fortunately the process is mechanical. + +

    +  -match ":RH:"         ->     -match ":RH(:|.)"
    +  -match ":RH:500 mb:"  ->     -match ":RH(:|.)" -match ":500 mb:"
    +
    + + +Many options use the extended name if enabled by -set_ext_name. For example, the +-netcdf uses the extended name if enabled. + + + +

    Examples

    + +
    +-sh-2.05b$ ./wgrib2 chem.grb2 -var
    +1:0:MASSDEN
    +-sh-2.05b$ ./wgrib2 chem.grb2 -ext_name
    +1:0:MASSDEN.hi-res_ctl.Water_Vapour
    +-sh-2.05b$ ./wgrib2 chem.grb2 -set_ext_name 1 -ext_name
    +1:0:MASSDEN.hi-res_ctl.Water_Vapour
    +
    + + + +See also: +-ext_name +-set_ext_name_chars. +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005, July 8, 2021. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_ext_name_chars.html b/docs/web_docs/set_ext_name_chars.html new file mode 100644 index 0000000..222f902 --- /dev/null +++ b/docs/web_docs/set_ext_name_chars.html @@ -0,0 +1,213 @@ + + + + Climate Prediction Center - wgrib2: -set_ext_name_chars + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_ext_name_chars +
     
    + +

    wgrib2: -set_ext_name_chars

    +
    + + +

    Introduction

    + +

    The extended names have a simple format. Options of wgrib2 are executed, +and the fields are combined + +

    +-set_ext_name 1             -var -misc         field separator = '.', space replacement = '_'
    +
    +PRMSL.ENS=+19               PRMSL:ENS=+19
    +PRATE.90%_level             TPRATE:90% level
    +
    +-set_ext_name 2             -var -lev          field separator = '.', space replacement = '_'
    +
    +HGT.200_mb                  HGT:200 mb
    +TPRATE.surface              TPRATE:surface
    +
    +-set_ext_name 2             -var -ftime        field separator = '.', space replacement = '_'
    +
    +HGT.180_hour_fcst           HGT:180 hour fcst
    +
    + +

    +The default field separator and space replacement can may be used +in the various fields such as "1.5 mb. The -set_ext_name_chars +allows you to alter the field separator and space replacement characters. + +

    Usage

    + +
    +-set_ext_name_chars 'X' 'Y'
    +    X and Y are characters
    +    The default field separator '.' is replaced by 'X'.
    +    The default space separator '_' is replaced by 'Y'.
    +
    +
    +

    Example

    + +
    +$ wgrib2 gep19.aec -set_ext_name 3 -ext_name  -set_ext_name_chars '=' '~' -var -misc -lev
    +1:0:HGT=ENS=+19=200~mb:HGT:ENS=+19:200 mb
    +2:70707:TMP=ENS=+19=200~mb:TMP:ENS=+19:200 mb
    +3:96843:RH=ENS=+19=200~mb:RH:ENS=+19:200 mb
    +
    + The -var -misc -lev fields:  HGT:ENS=+19:200 mb
    + are converted to an extended name: HGT=ENS=+19=200~mb
    + using the field separater '=' and space replacement of '~'
    +
    + +See also: -s +-set_ext_name. +-set_ext_name_chars. +-ext_names. +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page created: July 14, 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_ftime.html b/docs/web_docs/set_ftime.html new file mode 100644 index 0000000..5cf3ff9 --- /dev/null +++ b/docs/web_docs/set_ftime.html @@ -0,0 +1,205 @@ + + + + Climate Prediction Center - wgrib2: -set_ftime + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_ftime (new version v2.0.7) +
     
    + +

    wgrib2: -set_ftime

    +
    + + +

    Introduction

    + +

    The wgrib2 inventory has a fragment that looks like + +

    +   :d=2014122500:12 hour fcst:vt=2014122512
    +
    +   d=2014122500 is the Reference time, usually the analysis or start of the forecast time.
    +   12 hour fcst is the "ftime", the time is 12 hours after the reference time
    +   vt=2014122512 is the verification time (ref time + 12 hours)
    +
    + +Wgrib2 has options to change the reference time (-set_time) and to set the ftime. +The -set_ftime v2 (introduced with wgrib2 v2.0.7) is easier to use and will +change the Product Definition Templates as needed. For compatibility, -set_ftime v1 +is still available on wgrib2 v2.0.7+. However, -set_ave and -set_ftime v1 +should not be used as they will be eventually removed. + +

    +To change the ftime, you add the option -set_ftime FTIME. What are the allowed formats +of FTIME? The formats are the same as ftimes from a wgrib2 inventory. + +

    +Original: :d=2014113018:6 hour fcst:
    +options:  -set_date 2014122500 -set_ftime "12 hour fcst"
    +New:      :d=2014122500:12 hour fcst:
    +
    +
    +Original: :d=2014113018:6 hour fcst:
    +options:  -set_date 2014122500 -set_ftime "0-6 hour ave fcst"
    +New:      :d=2014122500:0-6 hour ave fcst:
    +
    +Original: :d=2014113018:6 hour fcst:
    +options:  -set_date 2014122500 -set_ftime "124@6 hour ave(0-6 hour ave fcst),missing=0"
    +New:      :d=2014122500:124@6 hour ave(0-6 hour ave fcst),missing=0:
    +
    +After changing the time stamp, you can save the file with -grib NEW.grb
    +
    + +

    +With wgrib2 v2.0.6 or earlier, you have to use -set_ave and -set_ftime (v1). +Only a subset of PDTs were supported by -set_ave and -set_ftime (v1). + +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005, April 2020, Nov 2023 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_ftime1.html b/docs/web_docs/set_ftime1.html new file mode 100644 index 0000000..eafd9dc --- /dev/null +++ b/docs/web_docs/set_ftime1.html @@ -0,0 +1,177 @@ + + + + Climate Prediction Center - wgrib2: -set_ftime1 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_ftime1 +
     
    + +

    wgrib2: -set_ftime1

    +
    + + +

    Introduction

    + +

    +With wgrib2 v2.0.7, routines for generating started +to shift from -ftime1 to -ftime2. Since wgrib2 needs +the ability to read the time stamps, the routines +that wrote the time stamps also had to shift from +from -set_ftime1/-set_ave -> -set_ftime2. + +

    +The -set_ftime1 calls the +old routines to set time stamp. One should not +use this option because the old ftime routines could +not handle more complicated time stamps and needed a rewrite (ftime2 routines). + +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005, 6/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_ftime_mode.html b/docs/web_docs/set_ftime_mode.html new file mode 100644 index 0000000..58e579b --- /dev/null +++ b/docs/web_docs/set_ftime_mode.html @@ -0,0 +1,236 @@ + + + + Climate Prediction Center - wgrib2: -set_ftime_mode + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_date +
     
    + +

    wgrib2: -set_ftime_mode

    +
    + + +

    Introduction (wgrib2 v3.1.2)

    + +

    +The wgrib2 divides the timing information into two pieces, +the reference time and "ftime". In the following example, +the reference time is the third column (red, bold), and ftime +is the sixth column (green, italic). + +

    +$ wgrib2 small.grb2
    +1:0:d=2009060500:HGT:200 mb:24 hour fcst:ENS=+19
    +2:22346:d=2009060500:PRATE:surface:0-1 day ave fcst:ENS=+19
    +
    + +When the ftime consists of two times (ex 0-1 day ave fcst), the default mode is to +"simplfy" the ftime. For example "0-24 day ave fcst" gets simplified to "0-1 day ave fcst". + +
    + Simplifications done on ftime:
    +
    +  M*60-N*60 sec -> M-N min
    +  M*60-N*60 min -> M-N hour 
    +  M*24-N*24 min -> M-N day
    +  M*12-N*12 mon -> M-N year
    +
    + +Originally the wgrib2 inventories were designed for human readability, +so the simplifications were reasonable. Now inventories +are used as index files, and the "simplifications" can lead to complications +for programs that use the index files. + +

    Easing the problems with Simplifications (wgrib2 v3.1.2)

    +

    +Programs may want to search for "24-48 hour ave fcst" instead of the simple "1-2 day ave fcst". +Now the match_inventory includes both terms. + +

    +old:  wgrib2 file.grb -match ":1-2 day ave fcst"
    +old:  wgrib2 file.grb -if ":1-2 day" -grib day_1_2.grb -endif
    +
    +with wgrib2 v3.1.2, this also works
    +new:  wgrib2 file.grb -match ":24-48 hour ave fcst"
    +new:  wgrib2 file.grb -if ":24-48 hour" -grib day_1_2.grb -endif
    +
    +Note that: wgrib2 file.grb -match ":TMP:500 mb:24-48 hour ave fcst"
    +requires a specific order of the match_inventory.  This will require 
    +the option "-set_ftime_mode 1" (simplifications turned off).
    +
    + +

    +The simplifcations can be turned off using +the -set_ftime_mode 1 option.
    +Note: the -set_ftime_mode option is a setup option. +The option is ignored during the execution and cleanup phases. + +

    Usage

    +

    + +

    +-set_ftime_mode X            X = 0, 1       requires wgrib2 v3.1.2+
    +                                 0:  simpifications are done (default)
    +                                 1:  simpifications are not done
    +
    + +

    Example

    +
    +$ wgrib2 small.grb2
    +1:0:d=2009060500:PRATE:surface:0-1 day ave fcst:ENS=+19
    +
    +$ wgrib2 -set_ftime_mode 1 small.grb2
    +1:0:d=2009060500:PRATE:surface:0-24 hour ave fcst:ENS=+19
    +
    + +See also: + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 10, 2016, July 2, 2018, March 2022. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_grib_max_bits.html b/docs/web_docs/set_grib_max_bits.html new file mode 100644 index 0000000..d3bdd36 --- /dev/null +++ b/docs/web_docs/set_grib_max_bits.html @@ -0,0 +1,226 @@ + efficiently. + + + Climate Prediction Center - wgrib2: -set_grib_max_bits + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_grib_max_bits +
     
    + +

    wgrib2: -set_grib_max_bits

    +
    + + +

    Introduction

    + +

    +With most grib packing methods, the grid values are +usually stored as scaled integers. The grib format allows +the scaled integers to have up to 254 bits (simple packing). +This is an unreasonably high precision as wgrib2 converts +the data to a single-precision floating point number which +typically has only 25 bits of precision. To speed up +the encoding and decoding processing, wgrib2 uses 32 bit +integers which limits the maximum size of scaled integers +to 25 after accounting for the limits of the packing and +unpacking routines. + +

    Grib fields are usually stored as a scaled integers, +and usually you don't need 25 bits of precision. For +example, temperature to the nearest 0.1 degree, means +that the a temperature range of 50 C can be stored as +500 descrete values and only 7 bits are needed to store +the temperature to the nearest 0.1 degree. + +

    The problem is that people can set the scaling factors +to inappropriate values, using 25 bits of precision will +was (disk) space. Consequently wgrib2 has a resetable limit +of the precision of the scaled integers allowed. If you +exceed the limit, the scaling factors are change so +that the scaled integers are limited. + +

    +The -set_grib_max_bits option sets the maximum +number of bits that the scaled integers can have when +encoding data into grib. The value +should never be greater than 25 as that is the limit for wgrib2 encoding. +However, some grib packages may not support 25 bit precision in decoding, +so you may want to limit the precision to 24 to remain compatible with +other software packages. + +

    +The -set_grib_max_bits option does not set the +binary precision of the grib output but sets the maximum possible precision +of the numbers. + + + +

    Usage

    +

    + +

    +-set_grib_max_bits N
    +  N = maximum number of bits used to encode data
    +  the default value is 16, N = 1..25
    +
    + +

    Comments

    +

    +The -set_grib_max_bits option does not affect +grib data written using the -grib option because the +-grib option does not encode data but copies +the input grib message. + +

    +See alse: +-set_scaling +-set_bin_prec +-grib_max_bits +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Feb 21, 2018 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_grib_type.html b/docs/web_docs/set_grib_type.html new file mode 100644 index 0000000..edca145 --- /dev/null +++ b/docs/web_docs/set_grib_type.html @@ -0,0 +1,236 @@ + + + + Climate Prediction Center - wgrib2: -set_grib_type + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_grib_type +
     
    + +

    wgrib2: -set_grib_type

    +
    + + +

    Introduction

    + +

    +wgrib2 can write grib files by either copying an existing +packed grib message (-grib) or by +taking floating point values and packing them into a new grib +message. (For example, -grib_out, +-small_grib, -ij_small_grib, +and -wind_speed). +For the latter, one has a choice of packing methods. +Generally methods that are faster methods create larger files +and slower methods make smaller files. For fields with no +undefined values, the jpeg2000 produces the smallest files. +With bitmaps, one of the complex packings is usually the best +(of the supported packing). Complex3 is often the best trade off +between speed and compression for smooth fields. For other fields +complex1 is often the best trade off between speed and compression. +The (-set_grib_type) option controls the +packing method. + +

    Complex packing has the option of using special values +or bitmap for undefined grid values. Special values produce +significantly smaller files than using the bitmap. You should +only use the bitmap and complex packing when trying to remain +compatible with certain codes. (Bitmaps and special values were +part of the original grib2 specification, so it is possible that +some codes can handle special values and not bitmaps.) If you want +to alter the default (special values) to bitmaps, you +can use the option -set_bitmap. + +

    AEC is an implementation of CCSDS compression using libaec. +This new compression has very fast compression speeds and good +compression. As of 7/2016, only ecCodes (ECMWF) and wgrib2 support +AEC compression. More support is expected after it is +part of the offical standard (expected 9/2016). + +

    Usage

    +

    + +

    +-set_grib_type X   X=ieee,simple,complex1,complex2,complex3,jpeg,aec,same
    +                     s, c1, c2, c3, j, a are short for simple .. aec
    +                     v2.0.7 adds complex1-bitmap, complex2-bitmap, complex3-bitmap
    +                       with c1b, c2b and c3b being the short forms
    +                 
    +                  
    +
    +ieee = data is ieee format (4 bytes per data point)
    +simple = no compression, packed scaled integers
    +complex1 = complex packing
    +complex1-bitmap = complex and using bitmap for undefined grid points
    +complex2 = complex packing, pack increments (deltas)
    +complex2-bitmap = complex packing, pack increments (deltas) and using bitmap for undefined
    +complex3 = complex packing, pack increments after linear extrapolation
    +complex3-bitmap = complex packing, pack increments after linear extrapolation and using bitmap for undefined
    +jpeg = jpeg2000 compression
    +aec = aec/CCSDS compression
    +same = try to keep same packing type as input
    +       if input is in an unsupported output packing, complex1 is used
    +
    +note: to use bitmap for undefined values in complex packing, you can use
    + -set_bitmap 1 or you can use the complexN-bitmap.
    +
    + +

    Example

    +

    + +

    +$ wgrib2 in.grb -set_grib_type complex3 -grib_out out.grb 
    +
    +The above line rewrites a file using complex3 packing. + +

    +See also: -grib_out, +-set_bitmap, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 6, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_hex.html b/docs/web_docs/set_hex.html new file mode 100644 index 0000000..3bfb8fd --- /dev/null +++ b/docs/web_docs/set_hex.html @@ -0,0 +1,256 @@ + + + + Climate Prediction Center - wgrib2: -set_hex + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_hex +
     
    + +

    wgrib2: -set_hex

    +
    + + +

    Introduction

    + +

    +The -set_hex option sets 1 octets (byte) to a +a specified hex value. The hex value ranges from 0 to ff. + + +

    +-set_hex I J K
    +  I = section number = 1..7
    +  J = location in the section = 1..(section length)
    +  K = 00 .. ff
    +would set 
    +  Section I, Octet J to hex value K
    +
    +-set_hex I J K1:K2:K3:..KN
    +  I = section number = 1..7
    +  J = location in the section = 1..(section length)
    +  Ki = 00 .. ff
    +
    +  Sets Section I, Octet J to K1
    +  Sets Section I, Octet J+1 to K2
    +  etc
    +
    +-set_hex I J K1K2K3..KN           for v2.0.8+
    +  I = section number = 1..7
    +  J = location in the section = 1..(section length)
    +  Ki = 00 .. ff
    +  Sets Section I, Octet J to K1
    +  Sets Section I, Octet J+1 to K2
    +  etc
    +
    + +

    + + +

    Usage

    +

    + +

    +-set_hex  SECTION STARTING_OCTET_LOCATION (I-1):(I-2):..:(I-N)
    +-set_hex  SECTION STARTING_OCTET_LOCATION (I-1)(I-2)..(I-N)
    +SECTION=0 .. 7
    +OCTET_LOCATION = 1..N
    +I-M = Mth octet as 2 digit hex number
    +
    + +

    Example

    + +

    +This examples requires wgrib2 v2.0.8+ +

    +The file, template_512.grb, was converted from grib1, and the +delta-lon, and the extreme latitudes were only to the nearest +millidegree (grib1 precision). +

    +wgrib2 template_512.grb -grid
    +1:0:grid_template=40:winds(N/S):
    +	Gaussian grid: (512 x 256) units 1e-06 input WE:NS output WE:SN
    +	number of latitudes between pole-equator=128 #points=131072
    +	lat 89.463000 to -89.463000
    +	lon 0.000000 to 359.233000 by 0.703000
    +
    + +The grid with full precision can be obtained by using -new_grid, +and the contents of sec3 (grid definition) can be obtained by -0xSec 3. + +
    +-sh-4.1$ wgrib2 template_512.grb -new_grid_winds earth -new_grid ncep grid 170 junk
    ++ wgrib2 template_512.grb -new_grid_winds earth -new_grid ncep grid 170 junk
    +1:0:d=2016010109:PRES:mean sea level:2390 hour fcst:
    +-sh-4.1$ wgrib2 junk -0xSec 3
    ++ wgrib2 junk -0xSec 3
    +1:0:Sec3(1..72)=0x0000004803000002000000000028060000000000000000000000000000000000020000000
    +10000000000ffffffff05551826000000003085551826156a6f6b000aba950000008000
    +
    + +The script to change the precision of the Gaussian grid is given by + +
    +sec3='000000480300000200000000002806000000000000000000000000000000000002000000010000000000ffffffff05551826000000003085551826156a6f6b000aba950000008000'
    +wgrib2 $1 -set_hex 3 1 "$sec3" -grid -grib $1.new
    +
    + +

    +The above script assumes that the size of the original section 3 is greater or equal to the size of the new section 3. +If it isn't, you have to use the option -set_sec_size 3 72. Of course, you cannot make arbitrary changes +to the grid definition because the number of grid points has to match the grid points in the data section. + +

    +See also: +-set_byte +-set_ieee +-set_int +-set_int2 +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 22, 2016, Nov 6, 2018 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_ieee.html b/docs/web_docs/set_ieee.html new file mode 100644 index 0000000..79b546b --- /dev/null +++ b/docs/web_docs/set_ieee.html @@ -0,0 +1,196 @@ + + + + Climate Prediction Center - wgrib2: -set_ieee + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_ieee +
     
    + +

    wgrib2: -set_ieee

    +
    + + +

    Introduction

    + +

    +The -set_ieee option sets 4 octets to a +single precision IEEE floating point value. The IEEE floating point standard +is often used grib2. + +

    +-set_ieee I J X
    +  I = Section = 1..7
    +  J = 1..(section length-3)
    +  X = single precision floating point number
    +
    + +

    +Multiple floats can be set by making the third argument a colon seperated list. + +

    Usage

    +

    + +

    +-set_int  SECTION STARTING_OCTET_LOCATION I-1:I-2:..:I-N
    +SECTION=0 .. 7
    +OCTET_LOCATION = 1..N
    +I-M = Mth floating point number
    +
    + +

    Example

    + +

    +See also: +-get_int +-set_byte +-set_hex +-set_int2 +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_ijval.html b/docs/web_docs/set_ijval.html new file mode 100644 index 0000000..ae01a02 --- /dev/null +++ b/docs/web_docs/set_ijval.html @@ -0,0 +1,196 @@ + + + + Climate Prediction Center - wgrib2: -set_ijval + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_ijval +
     
    + +

    wgrib2: -set_ijval

    +
    + + +

    Introduction

    + +

    +The -set_ijval option is used to change one grid point value +of the decoded grid. After changing the grid value, one usually writes out the grid using +-grib_out FILE. +The -set_ijval option only works when the grid is +a rectangular array. For example, staggered and thinned grids are not stored an an array. + +

    Usage

    +

    +

    +-set_ijval I J VAL
    +    grid(I,J) = VAL
    +    I = 1..NX
    +    J = 1..NY
    +
    + +

    Example

    +
    +$ wgrib2 small.grb2 small.grb2 -set_ijval 1 1 91 -set_ijval 2 1 92 -set_ijval 1 2 93 -set_ijval 2 2 94 -grib_out new.grb2
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +$ wgrib2 new.grb2 -csv new.csv
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +$ cat new.csv
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",0,20,91
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",10,20,92
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",0,28,93
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",10,28,94
    +
    +

    +See also: +-csv +-grib_out +-set_ival +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 27, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_int.html b/docs/web_docs/set_int.html new file mode 100644 index 0000000..ed5aeda --- /dev/null +++ b/docs/web_docs/set_int.html @@ -0,0 +1,204 @@ + + + + Climate Prediction Center - wgrib2: -set_int + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_int +
     
    + +

    wgrib2: -set_int

    +
    + + +

    Introduction

    + +

    +The -set_int option sets 4 octets to an +signed integer value as commonly use by grib for signed integers. +The integer must range from -2147483647 to 2147483647, + +

    +-set_int I J K
    +  I = 1..7
    +  J = 1..(section length-3)
    +  K = -(2**23-1) .. (2**23-1)
    +would set 
    +  Section I, Octet J+0:  if (K >= 0) (K >> 24) & 255
    +  Section I, Octet J+0:  if (K < 0) ((abs(K) >> 24) && 255) | 128
    +  Section I, Octet J+1:  (abs(K) >> 16) & 255
    +  Section I, Octet J+2:  (abs(K) >> 8) & 255
    +  Section I, Octet J+3:   abs(K) & 255;
    + The above is using C syntax.
    +
    + +

    +Multiple integers can be set by making the third argument a colon seperated list. + +

    Usage

    +

    + +

    +-set_int  SECTION STARTING_OCTET_LOCATION I-1:I-2:..:I-N
    +SECTION=0 .. 7
    +OCTET_LOCATION = 1..N
    +I-M = Mth integer
    +
    + +

    Example

    + +

    +See also: +-get_int +-set_byte +-set_hex +-set_ieee +-set_int2 +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_int2.html b/docs/web_docs/set_int2.html new file mode 100644 index 0000000..1b78440 --- /dev/null +++ b/docs/web_docs/set_int2.html @@ -0,0 +1,203 @@ + + + + Climate Prediction Center - wgrib2: -set_int2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_int2 +
     
    + +

    wgrib2: -set_int2

    +
    + + +

    Introduction

    + +

    +The -set_int2 option sets 2 octets to a +signed integer value which is commonly used by grib. +The integer must range from -32767 to 32767. + + +

    +-set_int2 I J K
    +  I = 1..7
    +  J = 1..(section length-1)
    +  K = -(2**15-1) .. (2**15-1)
    +would set 
    +  Section I, Octet J+0:  if (K >= 0) (K >> 8) & 255
    +  Section I, Octet J+0:  if (K < 0) ((abs(K) >> 8 ) && 255) | 128
    +  Section I, Octet J+3:   abs(K) & 255;
    + The above is using C syntax.
    +
    + +

    +Multiple integers can be set by making the third argument a colon seperated list. + +

    Usage

    +

    + +

    +-set_int2  SECTION STARTING_OCTET_LOCATION I-1:I-2:..:I-N
    +SECTION=0 .. 7
    +OCTET_LOCATION = 1..N
    +I-M = Mth integer
    +
    + +

    Example

    + +

    +See also: +-get_int +-set_byte +-set_hex +-set_ieee +-set_int +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_ival.html b/docs/web_docs/set_ival.html new file mode 100644 index 0000000..bdb216f --- /dev/null +++ b/docs/web_docs/set_ival.html @@ -0,0 +1,195 @@ + + + + Climate Prediction Center - wgrib2: -set_ival + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_ival +
     
    + +

    wgrib2: -set_ival

    +
    + + +

    Introduction

    + +

    +The -set_ival option is used to change one or more the grid point values +of the decoded grid. After changing values, one usually writes out the grid using +-grib_out FILE. + +

    Usage

    +

    +

    +-set_ival I VAL
    +-set_ival I1:I2:..:In VAL1:VAL2:..:VALn
    +    I, I1, .. In is the grid point index from 1 to npnts
    +    VAL, VAL1, .. VALn are floating point values
    +
    + +

    Example

    +
    +$ wgrib2 small.grb2 -set_ival 1:2:3:4 91:92:93:94 -gribout new.grb2
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +$ wgrib2 new.grb2 -csv new.csv
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    +$ cat new.csv
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",0,20,91
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",10,20,92
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",0,28,93
    +"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",10,28,94
    +
    + +

    +See also: +-csv +-grib_out +-set_ijval +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 27, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_lev.html b/docs/web_docs/set_lev.html new file mode 100644 index 0000000..9391a67 --- /dev/null +++ b/docs/web_docs/set_lev.html @@ -0,0 +1,251 @@ + + + + Climate Prediction Center - wgrib2: -set_lev + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_lev
     
    + +

    wgrib2: -set_lev

    +
    + + +

    Introduction

    + +

    +The -set_lev option changes the level/layer + of field. By design, the level/layer used by +-set_lev option is the same level/layer as used +in the inventory. + +

    The code used to set the level/layer are used by +-set_lev, +-set_metadata, and +-set_metadata_str. So if you are unsure of the format +of the level description, you first look for a file with the same or similar level. +Failing to find such a file, you can try the +-set_lev option or look at the tables in level.c source code. + + +

    Usage

    +

    + +

    +-set_lev LEVEL
    +  LEVEL is either a level or layer description (12/2015)
    +
    + "surface",
    + "cloud base",
    + "cloud top",
    + "0C isotherm",
    + "level of adiabatic condensation from sfc",
    + "max wind",
    + "tropopause",
    + "top of atmosphere",
    + "sea bottom",
    + "entire atmosphere",
    + "cumulonimbus base",
    + "cumulonimbus top",
    + "%g K level",
    + "%g mb",
    + "mean sea level",
    + "%g m above mean sea level",
    + "%g m above ground",
    + "%g sigma level",
    + "%g hybrid level",
    + "%g m underground",
    + "%g K isentropic level",
    + "%g mb above ground",
    + "PV=%g (Km^2/kg/s) surface",
    + "%g Eta level",
    + "logarithmic hybrid level",
    + "snow level",
    + "mixed layer depth",
    + "hybrid height level",
    + "hybrid pressure level",
    + "%g generalized vertical height coordinate",
    + "%g m below sea level",
    + "%g m below water surface",
    + "lake or river bottom",
    + "bottom of sediment layer",
    + "bottom of thermally active sediment layer",
    + "bottom of sediment layer penetrated by thermal wave",
    + "maxing layer",
    + "bottom of root zone",
    + "top surface of ice on sea, lake or river",
    + "top surface of ice, und snow on sea, lake or river",
    + "bottom surface ice on sea, lake or river",
    + "deep soil",
    + "top surface of glacier ice and inland ice",
    + "deep inland or glacier ice",
    + "grid tile land fraction as a model surface",
    + "grid tile water fraction as a model surface",
    + "grid tile ice fraction on sea, lake or river as a model surface",
    + "grid tile glacier ice and inland ice fraction as a model surface",
    +   ** NCEP specific special levels are not listed **
    + "%g-%g mb above ground",
    + "%g-%g mb"
    + "%g-%g m below ground"
    + "%g-%g m above ground"
    + "%g-%g sigma layer",
    + "%g-%g m below sea level", 
    + "%gC ocean isotherm%n", NCEP only
    + "atmos col"
    +
    + +

    Example

    +
    +$ wgrib2 png.grb22 -set_lev "9.1 mb"
    +1:4:d=2009060500:RH:9.1 mb:330 hour fcst:ens std dev
    +
    + + + See also: +-lev, +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified Jan 26, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_lvl1.html b/docs/web_docs/set_lvl1.html new file mode 100644 index 0000000..6af4597 --- /dev/null +++ b/docs/web_docs/set_lvl1.html @@ -0,0 +1,265 @@ + + + + Climate Prediction Center - wgrib2: -set_lvl1 and -set_lvl2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_lvl1,-set_lvl2 +
     
    + +

    wgrib2: -set_lvl1, set-set_lvl2

    +
    + + +

    Introduction: levels, should I use lev or lvl

    +

    +The standard method of displaying and altering the level/layer metadata is by the +-lev and -set_lev options. +This method is high level and you don't need to know the details on how grib stores +the level/layer information. The problems with a high level interface are when you +are using a new type of level information. Then the +-lev and -set_lev options don't help. +The "lvl" method is low level and are for cases when a high level interface doesn't work. + +

    The Problem with Ambiguity of Numbers

    + +The grib standard stores the level as a (signed 32-bit integer)*10**(signed 8-bit integer). +Nothing wrong with this format but numbers can be stored in multiple ways. For example, + +
    +   500 can be stored as 5*10**2
    +   500 can be stored as 50*10**1
    +   500 can be stored as 500*10**0
    +   500 can be stored as 5000*10**-1
    +
    + +All are valid representations and libraries should treat them as equivalent. +So if you search for the wind speed at "50 meters above the ground", you +should not have to worry wheter 50 is stored at 50*10**0 or 5*10**1 in +the grib file. However, there are some libraries will only match one variant +of "50". So to make your grib files compatible with this library, +you may have to use the "lvl" interface. (With wgrib2, you match "50m above ground", +which independent of the internal respresentation.) + +

    +Another example of ambiguity is for "0.1 meters above the ground". Now 0.1 is not +a nice number when stored as a binary floating point number. You can only save an approximate +value when using a finite number of digits. It is like 1/3 when written +as a decimal number. (1/3=0.3333333333333..) +

    +  0.1 can be stored as 1*10**-1
    +  0.1 can be stored as 1000000015*10**-10
    +
    +Obviously the former is the preferred format but the latter is +the result trying to get the best scaled number for double +precision number "0.1". + +

    The "lvl" interface can be used to remove ambiguities in the level information +using -set_lvl1 and -set_lvl2. + + +

    lvl format

    + + +The "lvl" format is based on the grib standard. + +
    + 1 octet  unsigned 8-bit integer   type of first fixed surface (see Code Table 4.5) lv1l type
    + 1 octet  8-bit signed integer     scale factor of first fixed surface              lvl1 scale_factor
    + 4 octets 32-bit signed integer    scaled value of first fixed surface              lvl1 scaled_value
    +                            
    + 1 octet  unsigned 8-bit integer   type of 2nd fixed surface (see Code Table 4.5)   lvl2 type
    + 1 octet  8-bit signed integer     scale factor of 2nd surface                      lvl2 scale_factor
    + 4 octets 32-bit signed integer    scaled value of 2nd fixed surface                lvl2 scaled_value
    +
    + value = scaled_value * 10**(-scale_factor)
    + Note: missing is denoted by scale factor and scale value having all bits set to one
    +
    +lvl format   value is not missing
    +             lvl1=(type,scaled_value*10**(-scale_factor), scale_factor, scaled_value)
    +             lvl2=(type,scaled_value*10**(-scale_factor), scale_factor, scaled_value)
    +
    +lvl format   value is missing
    +             lvl1=(type,missing,missing,missing)
    +             lvl2=(type,missing,missing,missing)
    +
    +	     type = 0..255
    +
    + + +

    Usage

    +

    + +

    +-set_lvl1 (type,X,Y,Z)
    +	   type=0..255  Code Table 4.5
    +	   X=missing if missing values
    +	     value ignored if not missing
    +           Y=scaled value, ignored if X is 'missing'
    +	   Z=integer, ignored if X is 'missing'
    +-set_lvl2  same as -set_lvl1
    +
    + + +

    Example

    +
    +$ wgrib2 small.grb2 -s -lvl
    +[wd51we@cpc-lw-webisuzaki grib2_examples]$ wgrib2 small.grb2 -s -lvl
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19:lvl1=(100,20000,0,20000):lvl2=(255,missing,missing,missing)
    +$ wgrib2 small.grb2 -set_lvl1 "(100,0,0,12345)" -s -lvl
    +1:0:d=2009060500:HGT:123.45 mb:180 hour fcst:ENS=+19:lvl1=(100,12345,0,12345):lvl2=(255,missing,missing,missing)
    +
    + + + +See also: -lvl1, +-lev, + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page 11/2023 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_metadata.html b/docs/web_docs/set_metadata.html new file mode 100644 index 0000000..1f3b21b --- /dev/null +++ b/docs/web_docs/set_metadata.html @@ -0,0 +1,285 @@ + + + + Climate Prediction Center - wgrib2: -set_metadata + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_metadata +
     
    + +

    wgrib2: -set_metadata

    +
    + + +

    Introduction

    + +

    +Whenever -set_metadata option is "executed", one +line of the data file is read, the metadata is then applied to the current +(sub-)message. For example, your grib file has 3 messages and you +want to alter the metadata. Here is a metadata file +that could be used to alter the grib file. + +

    +0:0:d=2009010100:HGT:500 mb:anl:scale=0,0:
    +0:0:d=2009010100:TMP:2 m above ground:anl
    +0:0:d=2009010106:HGT:500 mb:12 hour forecast:scale=0,0
    +
    + +

    +The format of the metadata file resembles the wgrib2 inventory by design. +The first and second fields are ignored by by -set_metadata. +In practice, the first first is the record number and the second field +is the byte location of the template to be used. (A template file +could be a collection of templates.) The third through sixth fields +are the date code, variable name, level and ftime. Finally the remaining +fields are optional and order independent. + +

    The date field has been extended from the default d=YYYYMMDDHH. The date +field can be d=format-N or D=format-N +

    +                         Format 1
    +
    +    YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm or YYYYMMDDHHmmss
    +    where YYYY = 4 digit year
    +            MM = 2 digit month
    +            DD = 2 digit day of month
    +            mm = 2 digit minute
    +            ss = 2 digit second
    +    If MM, DD, mm, ss are missing, the values are unchanged.
    +
    +                         Format 2
    +
    +  +N(units)  N is an integer, units = hr, dy, mo or yr
    +             this adds N units to the reference time
    +             ex. +6hr, +1dy
    +
    +                         Format 3
    +
    +  -N(units)  N is an integer, units = hr, dy, mo or yr
    +             this subtracts N units to the reference time
    +             ex. -6hr, -1dy
    +
    + +
    +		Optional fields
    +
    +    scale=I,J			set decimal scaling (I) and binary scaling (J) for encoding
    +    encode i*2^J*10^I           set decimal scaling (I) and binary scaling (J) for encoding
    +                                   same as scale=I,J  v2.0.6+
    +    encode I bits               store grid values using I bits, no decimal scaling (ECMWF style) v2.0.6+
    +    grib_max_bits=I             set maximum number of bits used to store grid point data (max 25) v2.0.6+
    +    packing=S                   set compression/packing to S
    +                                S=simple,complex1,complex2,complex3,jpeg,aec (long form)
    +                                S=s,c1,c2,c3,j (short form)
    +    N%d level                   set percentile
    +    prob ...                    set probability
    +    XYZ                         XYZ=ens mean, wt ens mean, ens std dev, cluster std dev, normalized ens std dev,
    +                                normalizedd cluster std dev, ens spread, ens large anom index, wt ens mean,
    +                                unwt custer mean, 25%-75% range, min all members, max all members
    +    ENS=...                     set ensemble member info
    +                                ENS=hi-res, low-res, +N, or -N
    +    N ens members               set number of ensemble members
    +                                ex. 22 ens members
    +    code table X.Y=Z            set code table, equivalent -set table_X.Y Z   requires wgrib2 v2.0.5+
    +    flag table X.Y=Z            set flag table, equivalent -set table_X.Y Z   requires wgrib2 v2.0.5+
    +                                note: not all X.Y have been implemented
    +
    +             Following options follows -set VAR VAL and do not follow the wgrib2 inventory format
    +    disciple=
    +    local_table=
    +    master_table=
    +    center=                     set center
    +    subcenter=                  set sub-center
    +    background_process_id=
    +    analysis_or_forecast_process_id=
    +    table_M.N=                  only for selected M.N
    +
    + + + +

    +To change the metadata, you can do + +

    +wgrib2 in.grb -s >meta
    +(change meta)
    +wgrib2 in.grb -set_metadata  meta -grib out.grb
    +
    +Note: that -grib does not change the grid point data/packing.
    +
    + +

    The -set_metadata option is used for creating +grib2 files. Note that both +-set_metadata and the various +-import options will change the output +precision. Consequently the +-import option should preceed the +-set_metadatda option. + +

    Note: only a subset of levels and ftime parameters is currently implemented. +The -set_metadatda option +does not support all metadata. + +

    To format of the levels and ftime are + the same was used by wgrib2 inventories. + +

    +See also: +-set_ave, +-set_date, +-set_ftime, +-set_lev, +-set_metadata_str, +-set_scale, +set_var, + + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Nov 23, 2016. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_metadata_str.html b/docs/web_docs/set_metadata_str.html new file mode 100644 index 0000000..2cd374c --- /dev/null +++ b/docs/web_docs/set_metadata_str.html @@ -0,0 +1,191 @@ + + + + Climate Prediction Center - wgrib2: -set_metadata_str + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_metadata_str +
     
    + +

    wgrib2: -set_metadata_str

    +
    + + +

    Introduction

    +

    +The -set_metadata_str "string" option is similar to the +older -set_metadata FILE option. Instead of reading +the metadata from a file, the metadata is on the command line. The latter +option is generally more useful as each grib message can have its own +set of metadata. The former option is only useful for specifying the metadata +for a single grib message. The -set_metadata_str option +was added to facilitate the creation of an "callable wgrib2" API for writing grib2. +See -set_metadata for the format of the metadata string. + + +

    Usage:

    +
    +-set_metadata_str "metadata"
    +metadata is a string 
    +
    + +

    Example:

    +
    +sh-4.1$ wgrib2 small.grb2  -set_metadata_str "1:0:d=2001020304:TMP:10 mb:anl:"
    +1:0:d=2001020304:TMP:10 mb:anl:ENS=+19
    +
    + + + +

    +See also: +-set_metadata, + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: April 4, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_pdt.html b/docs/web_docs/set_pdt.html new file mode 100644 index 0000000..54d2640 --- /dev/null +++ b/docs/web_docs/set_pdt.html @@ -0,0 +1,229 @@ + + + + Climate Prediction Center - wgrib2: -set_pdt + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_pdt +
     
    + +

    wgrib2: -set_pdt

    +
    + + +

    Introduction

    + +

    +Section 4 of a grib message +contains the product definition and the product is +defined through the Product Definition Template (PDT). +There are many different PDTs but only some are in common usage. The +-set_pdt option changes the current PDT to +another. For example, you want to add ensemble information to a +forecast with no ensemble information. To do this, you have +to change the template to one that has ensemble information +and then fill in the various parts of the PDT. +Another use of the -set_pdt option is +when you have a PDT that is unsupported by a program such +as GrADS. You can use this option to +convert an unsupported PDT to a supported PDT. +To retain metadata, prefix the PDT with a plus sign. The amount of +metadata copied depends on the version of wgrib2. + +

    Usage

    + +

    +

    +-set_pdt X      X=product defintion template number (example 8, not 4.8), default size, PDT is cleared
    +-set_pdt +X     X=product defintion template number (example 8, not 4.8), copy metadata from current PDT
    +                  size may vary depending on current PDT
    +-set_pdt X:Y    X=product defintion template number (example 8, not 4.8), Y=byte size of PDT if variable-sized PDT
    +                  PDT is cleared
    +-set_pdt +X:Y   X=product defintion template number (example 8, not 4.8), Y=byte size of PDT if variable-sized PDT
    +                  copy metadata
    +                Note: using the wrong value of Y can produce errors
    +
    + +

    Example

    +
    +wgrib2 prior to v2.0.2
    +$ wgrib2 p.grb -set_pdt 0 -grib OUT.grb
    +1:0:d=2010111618:var discipline=0 center=7 local_table=0 parmcat=255 parm=255:no_level:-1 missing fcst:
    +$ wgrib2 p.grb -set_pdt +0 -grib OUT.grb
    +1:0:d=2010111618:PRMSL:no_level:-1 missing fcst:
    +
    +wgrib2 v2.0.2
    +$ wgrib2 png.grb -grib OUT.grb
    +1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev
    +$ wgrib2 png.grb -set_pdt 0 -grib OUT.grb
    +1:4:d=2009060500:var discipline=0 center=7 local_table=1 parmcat=255 parm=255:no_level:-1 missing fcst:
    +$ wgrib2 png.grb -set_pdt +0 -grib OUT.grb
    +1:4:d=2009060500:RH:2 m above ground:330 hour fcst:
    +
    + +Suppose a program has problems with pdt 60 and 61. Changing the pdt to +1 and 11 will solve the incompatibility with only a little loss of metadata. +
    +$ wgrib2 IN.grb -if ":pdt=60:" -set_pdt +1 -fi \
    +                -if ":pdt=61:" -set_pdt +11 -fi \
    +                -grib OUT.grb
    +  requires wgrib2 v2.0.2+
    +
    + + +See also: +-fi, +-grib, +-if, +-Sec4, +-pdt, + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 8, 2015 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_percentile.html b/docs/web_docs/set_percentile.html new file mode 100644 index 0000000..bd4e853 --- /dev/null +++ b/docs/web_docs/set_percentile.html @@ -0,0 +1,196 @@ + + + + Climate Prediction Center - wgrib2: -set_percentile + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_percentile +
     
    + +

    wgrib2: -set_percentile

    +
    + + +

    Introduction

    + +

    +Probabilistic forecasts can be presented as percentiles. For example, 10% forecast +of temperature means that 1 time out of 10, the expected temperature will less than +the forecasted temperature. +The -set_percentile option adds or changes the percentile of +a forecast. + +

    +Percentile forecasts use product definition templates (PDT) of 6 or 10 depending +whether the forecast is for a single time or a time interval. +The -set_percentile option converts pdt 0..6 -> 6 and 8..15 -> 10. + +

    Percentiles are also supported by the +-set_metadata option. +

    Usage

    +

    + +

    +-set_percentile X         X = percentile 0..100
    +
    + +

    Example

    +
    +$ wgrib p.grb -set_percentile 50 -grib_out new.grb
    +1:0:d=2010020304:PRMSL:mean sea level:6 hour fcst:50% level
    +2:17960:d=2010020304:PRES:1 hybrid level:3 hour fcst:50% level
    +
    + +See also: + +-grib, +-grib_out, +-set_metadata, +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_prob.html b/docs/web_docs/set_prob.html new file mode 100644 index 0000000..a12dafb --- /dev/null +++ b/docs/web_docs/set_prob.html @@ -0,0 +1,218 @@ + + + + Climate Prediction Center - wgrib2: -set_prob + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_prob +
     
    + +

    wgrib2: -set_prob

    +

    set values for Product Definition Templates 4.5 and 4.9

    +
    + + +

    Introduction

    + +

    +The -set_prob option converts some +common non-probability Product Definition Template (PDT) to +a probability PDT. Then it adds the metadata for the probability +part of the PDT. + +

    +Step 1:
    +  If current PDT is 0,1,2,3,4 or 6, then the PDT is converted to 6 (4.6)
    +  using the -set_pdt +5 option.
    +
    +  If current PDT is 8,10,11,12,13,14 or 15, the he PDT is converted to 9 (4.9)
    +  using the -set_pdt +9 option.
    +
    +Step 2:
    +  If the current PDT does not have Code Table 4.9 entry, print a warning
    +  and return.
    +
    +Step 3:
    +  Fill in the various probability metadata using arguments to the option.
    +
    +  X=Forecast probability number
    +  Y=Total number of forecast probabilities
    +  Z=Probability Type (see Code Table 4.9)
    +  A=lower limit
    +  B=upper limit
    +
    + +

    Usage

    +
    +-set_prob X Y Z A B
    + where X, Y, Z, A and B are defined above
    + for wgrib2 v3.0.0+, X, Y, Z, A or B can have the value "".
    +  When the value "" is used, the previous value is not changed.
    +
    +

    Example

    +

    +

    +$ wgrib2 test2.grb 
    +1:0:d=2009060500:TMP:2 m above ground:180 hour fcst:ENS=+19
    +$ wgrib2 -set_prob 10 20 2 10.1 10.4  test2.grb 
    +1:0:d=2009060500:TMP:2 m above ground:180 hour fcst:prob >=10.1 <10.4
    +
    +X=10 Forecast probabilty number
    +Y=20 Total number of forecat probabilities (Number of intervals for probability forecasts?)
    +Z=2  Code Table 4.9
    +A=10 Lower limit (may not be used depending on Code Table 4.9)
    +B=10 Upper limit (may not be used depending on Code Table 4.9)
    +
    + + +

    +See also: +-prob, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 8, 2015, Aug 23, 2019 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_radius.html b/docs/web_docs/set_radius.html new file mode 100644 index 0000000..53a2b44 --- /dev/null +++ b/docs/web_docs/set_radius.html @@ -0,0 +1,205 @@ + + + + Climate Prediction Center - wgrib2: -set_radius + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_radius +
     
    + +

    wgrib2: -set_radius

    +
    + + +

    Introduction

    + +

    +Most grib2 Grid Definition Templates (PDT) include the +shape and size of Earth. Such information is +necessary for finding the latitude and longitude of +the grid points in various projections. The +-set_radius option sets the +shape and size of Earth and the -radius option +shows the the shape and size. + +

    +The geolocation of the grid points is done prior to the execution of +the run-time options. So the +-set_radius will not affect calculations of +the lat-lon of the grid points. To get the correction locations +after using the +-set_radius option, you must write the file +with the new shape of the Earth. Then you can use this new file. + +

    Usage

    +

    +

    +-set_radius N      N=0,2,4,5,6,8,9
    +                   Code Table 3.2 is set to N
    +-set_radius 1:R    R=radius in meters (spherical)
    +                   Code Table 3.2 is set to 1
    +-set_radius 3:X:Y  X=major axis Y=minor axis (oblate spheroid), X, Y in km
    +                   Code Table 3.2 is set to 3
    +-set_radius 7:X:Y  X=major axis Y=minor axis (oblate spheroid), X, Y in m
    +                   Code Table 3.2 is set to 7
    +
    + +

    Example

    +
    +$ wgrib2 small.grb2 -set_radius 0 -radius
    +1:0:code3.2=0 sphere predefined radius=6367470.0 m
    +$ wgrib2 small.grb2 -set_radius 1:6300000 -radius
    +1:0:code3.2=1 sphere user defined radius=6300000.0 m
    +
    + + +See also: +-radius +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 8, 2015, Oct 2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_regex.html b/docs/web_docs/set_regex.html new file mode 100644 index 0000000..f6e6363 --- /dev/null +++ b/docs/web_docs/set_regex.html @@ -0,0 +1,273 @@ + + + + Climate Prediction Center - wgrib2: -set_regex + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_regex +
     
    + +

    wgrib2: -set_regex

    +
    + + +

    Introduction

    + +

    +One common feature of many Unix/Linux commands is the support of +regular expressions (regex). Several of wgrib2's options support +regex (-if, -not_if, -match, -not, -egrep, -egrep_v) which make the various string +comparisons much more versatile (compare egrep vs windows find command). +The -set_regex option changes the flavor +of regex evaluation. + +

    +NOTE: the -set_regex option MUST preceed the -match/-not/-if/-not_if/-egrep/-egrep_v options. All these +options are "setup" options and the processing the the -set_regex must occur before the +processing of the -match and other regex options. + +

    +Grib files can have hundreds of records and most people only want a few of +the records. Rather than processing everything, you can select the +specific records to process by the -match, +-not, +-if and -not if options. These options +take an extended POSIX regular expression (regex) as their sole argument. These +options check the regex with the "match inventory" (see -match_inv). +Some examples are + +

    +  wgrib2 input.grb -match ':UGRD:200 mb:' -grib u.grb
    +  wgrib2 input.grb -match ':(UGRD|VGRD|TMP):200 mb:' -grib uvt.grb
    +
    + +

    +Now regex are powerful but can produce some surprises. For example, you want +the 19th (positive perturbation) ensemble member which is denoted by +'ENS=+19' in the match inventory. You try, + +

    +  wgrib2 input.grb -match ':ENS=+19:' -grib e19.grb
    +
    + +

    +Surprise, the above line does not work. The plus sign is a regex +metacharacter indicating that the previous character would be +matched 1 or more times. Consequently the plus sign wouldn't +be matched. To get the above match to work, you can quote the plus sign +with a backslash. + +

    +  wgrib2 input.grb -match ':ENS=\+19:' -grib e19.grb
    +
    + +Alternatively you could change the regex match into fixed-string mode. +In fixed-string mode, the regex metacharacters are considered to be +ordinary characters. + +
    +  wgrib2 -set_regex 1 input.grb -match ':ENS=+19:' -grib e19.grb
    +
    + +Most of the regex options have a fs (fixed string) version, +such as -match and -match_fs. +It is better to used the fixed-string versions are equivalent to +the regex mode set to "fixed string". The fixed string versions +were added because regex library may be unavaible on non-POSIX +systems. + + +
    +  wgrib2 input.grb -match_fs ':ENS=+19:' -grib e19.grb
    +
    + + +The third mode is the metacharacters have to be quoted. +Here is an example that gets the 19th, 20th and +21th ensemble members. This mode was added because it is easier to remember +to quote the '(|)' metacharacters than to quote the ordinary characters +correspond to metacharacters. + +
    +  wgrib2 -set_regex 2 input.grb -match ':ENS=+\(19\|20\|21\):' -grib e19_20_21.grb
    +
    + +

    Usage

    +

    + +

    +-set_regex X              X=0, 1, 2
    +                            0 = extended regular expressions
    +                            1 = fixed string mode, no metacharacters
    +                            2 = metacharacters need to be quoted
    +
    + +

    Example

    +
    +$ wgrib2 gep.grb -match ':UGRD:200 mb:' -match ':ENS=+19:'
    +        (no output)
    +$ wgrib2 gep.grb -set_regex 1 -match ':UGRD:200 mb:' -match ':ENS=+19:'
    +4.1:86046:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    +
    + + +See also: + +-egrep +-egrep_v +-if +-if_fs +-match, +-match_fs, +-not, +-not_fs, +-not_if +-not_if_fs +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 10, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_scaling.html b/docs/web_docs/set_scaling.html new file mode 100644 index 0000000..a2e7b19 --- /dev/null +++ b/docs/web_docs/set_scaling.html @@ -0,0 +1,257 @@ + efficiently. + + + Climate Prediction Center - wgrib2: -set_scaling + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_scaling +
     
    + +

    wgrib2: -set_scaling

    +
    + + +

    Introduction

    + +

    +The values at the grid points points are usually stored in in this format, + +

    +
    +  Y = (R + i*2**B)*(10**D)
    +
    +  R = reference value (32-bit IEEE floating point number)
    +  i = integer, 0..2**N-1
    +  N = binary bit precision
    +  B = binary scaling, -127..127
    +  D = decimal scaling, -127..127
    +
    + +There are 3 sytems for storing the number which I call + +
    +
    +ECMWF convention: D = 0, N = parameter
    +
    +  Y = R + i*2**B
    +  R = reference value
    +  i = integer, 0..2**N-1
    +  N = binary bit precision, a parameter
    +  B = binary scaling, determined by grib routines
    +
    +NCEP convention: B = parameter, D = parameter
    +
    +  R = reference value
    +  i = integer, 0..2**N-1
    +  N = binary bit precision, determined by grib routines
    +  B = binary scaling, a parameter
    +  D = decimal scaling, a parameter
    +
    +  Note, global model uses a variant: B = 0, D = parameter
    +
    + +

    +Both the ECMWF and NCEP conventions have their advantages and +disadvantages. The ECMWF method is easier to use, you just +set the binary precision to N bits (12? 16?) for all variables +and you are done. With the NCEP convention, you have to +set the scaling for each variable separately. For some variables +such as specific humidity, the scaling should be pressure +dependent. On the other hand, if you are trying to get the smallest +files, the NCEP convention is better. For example, you want to +get the RH to the nearest integer. With the NCEP method, you simply +set D = B = 0. For general use, I suggest that you use the ECMWF +convention because people time is usually more valuable than disk space. +Ok, I value my time more than a few GB. On the othe hand, I've been +involved with more than my share of projects were disk space +has been the critical issue. +

    +By default, wgrib2 will encode using the ECMWF convention using 12 bits. +The number of bits can be changed by the -set_bin_prec option. +The -set_grib_max_bits option will have to be +used if the binary precision is set to more than 16. + +

    Default Scaling

    +

    +When you read a field, the scaling of the field (B, D) are saved as +the scaling parameter. However, Some options such as +the -rpn option can +change the magnitude of the field and scaling from the +input field may not longer be appropriate. So these +options will revert to the default scaling (ECMWF-style using +the N bits). However, in some cases such as time-interpolation +or smoothing, the original scaling is appropriate. In this +case you can set the B and D scaling to text string, same. + +

    Usage

    +The -set_scaling option is used to +change the binary and decimal scaling parameters for the next +write. (The binary and decimal scaling parameters will be +reset by reads and calls to RPN.) This will set wgrib2 to +to encode data using the NCEP convention. If you want to +encode data using the ECMWF convention, you need to use +the -set_bin_prec option perhaps with the +-set_grib_max_bits option. + +

    + +

    +-set_scaling D B
    +  D = decimal scaling or the text 'same' with no quotes
    +  B = binary scaling or the text 'same' with no quotes
    +
    + +

    +See alse: +-set_bin_prec +-set_grib_max_bits +-scale +-scaling +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 11, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_sec_size.html b/docs/web_docs/set_sec_size.html new file mode 100644 index 0000000..dcc9ae8 --- /dev/null +++ b/docs/web_docs/set_sec_size.html @@ -0,0 +1,203 @@ + + + + Climate Prediction Center - wgrib2: -set_sec_size + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_sec_size +
     
    + +

    wgrib2: -set_sec_size

    +
    + + +

    Introduction

    + +

    +The -set_sec_size option is DANGEROUS. +Grib messages are made of sections where the section number varies from +0 to 8. Suppose you want to modify a grib message by changing +section 4 (Product Definition Section). You would +use -set_sec_size to change the size of section 4 +if necessary and then use -set_byte to change the contents +of your new section 4. This is not pretty but when testing a new template, +you have to do ugly things. + +

    +After you have altered the grib message, you can save the +message by either -grib or +the -grib_out. You need to use +the latter option if the grid values were altered because the +data section needs to be updated. + +

    Usage

    +

    + +

    +-set_sec_size  SECTION SIZE
    +SECTION=0 .. 8
    +SIZE=integer, size of new section
    +     can be zero for a missing section
    +     generally greater than 5
    +
    + +

    Results

    + +

    +The -set_sec_size option expands +or contracts a section. For expansions, the new octets +are filled with 255. This option puts the size of the +new section in octets 1..4 and the section number in octet 5 +assuming the size is greater than equal to 5. Some +sections can be missing. +

    +See also: +-set_byte +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_subcenter.html b/docs/web_docs/set_subcenter.html new file mode 100644 index 0000000..545d588 --- /dev/null +++ b/docs/web_docs/set_subcenter.html @@ -0,0 +1,170 @@ + efficiently. + + + Climate Prediction Center - wgrib2: -set_subcenter + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_subcenter +
     
    + +

    wgrib2: -set_subcenter

    +
    + + +

    Introduction

    + +

    +The -set_subcenter option is deprecated, please use +the -set subcenter option. + +

    +See alse: +-set +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: August 11, 2015 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_ts_dates.html b/docs/web_docs/set_ts_dates.html new file mode 100644 index 0000000..dd37afd --- /dev/null +++ b/docs/web_docs/set_ts_dates.html @@ -0,0 +1,216 @@ + + + + Climate Prediction Center - wgrib2: -set_ts_dates + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_ts_dateis +
     
    + +

    wgrib2: -set_ts_dates

    +
    + + +

    Introduction

    + +

    +The -set_ts_dates and -set_date options +changes the reference date of the in-memory grib (sub-)message. You can write out the message +with the new date by the -grib (fast) and +-grib_out (slow) options. Of course if the in-memory +grid values have changed, you have to use the latter option. + +

    +The -set_date X option changes the date code to X. +For time series, you want the date code to increment, and you use the +-set_ts_dates X:Y:Z option. Here, X is the date code, +Y is the time increment and Z is number of fields to have the same +date code. + +

    Usage

    +

    + +

    +-set_ts_dates  X:Y:Z
    +                    X = starting date
    +                    Y = time increment
    +                    Z = block size
    +
    +                    X=YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm, YYYYMMDDHHmmSS
    +                    YYYY=year, MM=month, DD=day, HH=hour, mm=minute, SS=second
    +                    MM=01 if MM is not specified
    +                    DD=01 if DD is not specified
    +                    HH=00 if HH is not specified
    +                    mm=00 if mm is not specified
    +                    SS=00 if SS is not specified
    +
    +                    Y=IS
    +                      I = positive integer
    +                      S = year, month, day, hour, minute, second
    +
    +                    Z=# fields / date code (must be one or greater)
    +
    +
    + +

    Example

    +
    +# date code increments by 1 hour
    +$ wgrib p.grb -set_ts_dates 2010020304:1hour:1
    +1:0:d=2010020304:PRMSL:mean sea level:anl:
    +2:17960:d=2010020305:PRSML:mean sea level:anl:
    +3:34248:d=2010020306:PRMSL:mean sea level:anl:
    +4:48055:d=2010020307:PRMSL:mean sea level:anl:
    +
    + +See also: + +-grib, +-grib_out, +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/set_var.html b/docs/web_docs/set_var.html new file mode 100644 index 0000000..562a638 --- /dev/null +++ b/docs/web_docs/set_var.html @@ -0,0 +1,258 @@ + + + + Climate Prediction Center - wgrib2: -set_var + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_var +
     
    + +

    wgrib2: -set_var

    +
    + + +

    Introduction

    + +

    +Please see new grib for the basic +concepts of making new grib files. + + +

    +The -set_var option changes the variable +name of the in-memory grib (sub-)message. You can write +out the message with the new name by the +-grib (fast) and +-grib_out (slow) options. Of course +if the in-memory grid values have changed, you have to use +the latter option. + +

    You can set the name to a locally defined variable name only if +the center is set correctly. For example, you can use an NCEP-defined +variable name only if the center is already defined as NCEP. If the +center is undefined, you cannot use any locally defined names. + +

    The search order is for WMO definitions and then the locally +defined definitions. The search order has implications for NCEP +users. NCEP often have WMO and NCEP definitions for the same +variable name/type. +The -set_var option will choose +the WMO definition. This will cause problems with programs that +expect the NCEP definition. + +

    The default is to search the NCEP defined names. However, wgrib2 +will use the dwd or ecmwf names if the -set_names dwd +or -set_names ecmwf options are used. + +

    The -set_var option will alter the master table. +The grib2 standard says that variable definitions are only valid for +specified master tables. Wgrib2 keeps track of range of tables for which each +variable name is valid. In addition, there is an entry for the master table +used by the -set_var option. + +

    Usage

    +

    + +

    +-set_var X              X=valid grib variable name such
    +                        1. text name such as HGT or TMP
    +			   For WMO defined variables, either DWD, ECMWF, NCEP names are used
    +			      depending on -set_names  (default is NCEP)
    +                            local variable names have to consistent with the local center
    +                        2. varA_B_C_D_E_F
    +                        3. var discipline=A master_table=B parmcat=E parm=F
    +                        4. var discipline=A center=D local_table=C parmcat=E parm=F
    +                           use 3 for WMO defined variables, 4 for locally defined variables 
    +
    +                           A = discipline
    +                           B = version of master table
    +                           C = version of local table
    +                           D = center
    +                           E = parameter category
    +                           F = parameter
    +
    +                        formats 2-4 were introduced with wgrib2 v2.0.7
    +			they intended to allow manipulation of variables which are not
    +			in the grib table.  Format 2 is the inverse of -set_varX
    +			and formats 3 and 4 are the inverse of the verbose -set_varX
    +
    + +

    Example

    +
    +$ wgrib2 p.grb
    +1:0:d=2009072100:PRES:mean sea level:anl:
    +$ wgrib2 p.grb -set_var TMP -grib out.grb
    +1:0:d=2009072100:TMP:mean sea level:anl:
    +$ wgrib2 out.grb
    +1:0:d=2009072100:TMP:mean sea level:anl:
    +
    +You can use -set_var to change from old variable names to the new variable names
    +by the appropriate use of the -if option.
    +Convert TSOIL (old) to SOILTMP (new)
    +
    +$ wgrib2 old.grb -if ":TSOIL:" -set_var SOILTMP -fi -grib new.grb
    +
    +
    + +The -set_var option will rename +all the fields in a grib file. If you only want to rename +specific fields, you will have to use the +-if and -fi options. + +See also: + +-fi, +-grib, +-grib_out, +-if +-set_metadata +-set_var +-set_varX +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: April 28, 2017 April 12, 2018, 10/2023 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/short_cmd_list.html b/docs/web_docs/short_cmd_list.html new file mode 100644 index 0000000..0806fc2 --- /dev/null +++ b/docs/web_docs/short_cmd_list.html @@ -0,0 +1,463 @@ + + + + Climate Prediction Center - wgrib2: + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + +
     
    +
    +wgrib2 v3.1.1rc1 4/2022  Wesley Ebisuzaki, Reinoud Bokhorst, John Howard, Jaakko Hyvätti, Dusan Jovic, Daniel Lee, Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Gregor Schee, Arlindo da Silva, Niklas Sondell, Sam Trahan, George Trojan, Sergey Varlamov
    +   stock build
    + -else            else         else, -if ... -else ... -endif
    + -elseif          elif  X      elseif X (POSIX regular expression) conditional on match, -if ... -elseif ... -endif
    + -elseif_fs       elif  X      elseif X (fixed string) conditional execution
    + -elseif_n        elif  X      elseif (inv numbers in range), X=(start:end:step)
    + -elseif_rec      elif  X      elseif (record numbers in range), X=(start:end:step)
    + -elseif_reg      elif  X      elseif rpn registers defined, X = A, A:B, A:B:C, etc A = register number
    + -endif           endif        terminates if block
    + -if              if    X      if X (POSIX regular expression), conditional execution on match
    + -if_delayed_error if           if delayed error
    + -if_fs           if    X      if X (fixed string), conditional execution on match
    + -if_n            if    X      if (inv numbers in range), X=(start:end:step)
    + -if_rec          if    X      if (record numbers in range), X=(start:end:step)
    + -if_reg          if    X      if rpn registers defined, X = A, A:B, A:B:C, etc A = register number
    + -not_if          if    X      not_if X (regular expression), conditional execution on not match
    + -not_if_fs       if    X      if X (fixed string) does not match, conditional execution up to next output/fi
    + -0xSec           inv   X      Hex dump of section X (0..8)
    + -aerosol_size    inv          optical properties of an aerosol
    + -aerosol_wavelength inv          optical properties of an aerosol
    + -bitmap          inv          bitmap mode
    + -center          inv          center
    + -checksum        inv   X      CRC checksum of section X (0..8), whole message (X = -1/message) or (X=data)
    + -disc            inv          discipline (code table 0.0)
    + -domain          inv          find rectangular domain for g2ctl/GrADS plots
    + -end_ft          inv          verf time = reference_time + forecast_time + stat. proc time (YYYYMMDDHH) (same as -vt)
    + -end_FT          inv          verf time = reference_time + forecast_time + stat. proc time (YYYYMMDDHHMMSS) (same as -VT)
    + -ens             inv          ensemble information
    + -ext_name        inv          extended name, var+qualifiers
    + -ftime           inv          either ftime1 or ftime2 dep on version_ftime
    + -ftime1          inv          forecast time
    + -ftime2          inv          timestamp -- will replace -ftime in the future TESTING
    + -ftn_api_fn0     inv          n npnts nx ny msg_no submsg i11,5(1x,i11)
    + -full_name       inv          extended name, var+misc+lev (depreciated)
    + -gdt             inv          contents of Grid Definition Template (g2c)
    + -geolocation     inv          package (proj4,gctpc,internal,not_used) to get lat/lon of grid points
    + -get_byte        inv   X Y Z  get bytes in Section X, Octet Y, number of bytes Z (decimal format)
    + -get_hex         inv   X Y Z  get bytes in Section X, Octet Y, number of bytes Z (bytes in hexadecimal format)
    + -get_ieee        inv   X Y Z  get ieee float in Section X, Octet Y, number of floats Z
    + -get_int         inv   X Y Z  get 4-byte ints in Section X, Octet Y, number of ints Z
    + -get_int2        inv   X Y Z  get 2-byte ints in Section X, Octet Y, number of ints Z
    + -grib_max_bits   inv          maximum bits used in grib encoding
    + -grid            inv          grid definition
    + -grid_id         inv          show values from grid_id
    + -hybrid          inv          shows vertical coordinate parameters from Sec4 (assuming 2 var per level
    + -ij              inv   X Y    value of field at grid(X,Y) X=1,..,nx Y=1,..,ny (WxText enabled)
    + -ijlat           inv   X Y    lat,lon and grid value at grid(X,Y) X=1,..,nx Y=1,..,ny (WxText enabled)
    + -ilat            inv   X      lat,lon and grid value at Xth grid point, X=1,..,npnts (WxText enabled)
    + -JMA             inv          inventory for JMA locally defined PDT
    + -lev             inv          level (code table 4.5)
    + -ll2i            inv   X Y    x=lon y=lat, converts to (i), 1..ndata
    + -ll2ij           inv   X Y    x=lon y=lat, converts lon-lat to (i,j) using gctpc
    + -lon             inv   X Y    value at grid point nearest lon=X lat=Y (WxText enabled)
    + -match_inv       inv          inventory used by -match, -not, -if and -not_if
    + -Match_inv       inv          same as -match_inv except d=YYYYMMDDHH <-> D=YYYYMMDDHHmmss
    + -max             inv          print maximum value
    + -min             inv          print minimum value
    + -misc            inv          variable name qualifiers like chemical, ensemble, probability, etc
    + -MM              inv          reference time MM
    + -model_version_date inv          prints model date code
    + -n               inv          prints out inventory number
    + -N_ens           inv          number of ensemble members
    + -nl              inv          inserts new line into inventory
    + -nlons           inv          number of longitudes for each latitude
    + -npts            inv          number of grid points
    + -nxny            inv          nx and ny of grid
    + -packing         inv          shows the packing mode (use -v for more details)
    + -pdt             inv          Product Definition Table (Code Table 4.0)
    + -precision       inv          precision of packing
    + -print           inv   X      inserts string (X) into inventory
    + -prob            inv          probability information
    + -process         inv          Process type (code table 4.3)
    + -processid       inv          process id (locally defined)
    + -proj4_ij2ll     inv   X Y    X=x Y=y, converts to (i,j) to lon-lat using proj.4 (experimental) we:sn
    + -proj4_ll2i      inv   X Y    x=lon y=lat, converts to (i) using proj.4 (experimental) 1..ndata
    + -proj4_ll2ij     inv   X Y    x=lon y=lat, converts lon-lat (i,j) using proj.4 (experimental)
    + -pyinv           inv          miscelaneous metadata for pywgrib2_XXX (experimental)
    + -radius          inv          radius of Earth
    + -range           inv          print out location of record in bytes, 0 = first byte
    + -reset_delayed_error inv          clear reset_delayed_error flag
    + -RT              inv          type of reference Time
    + -s               inv          simple inventory
    + -S               inv          simple inventory with minutes and seconds (subject to change)
    + -s2              inv          simple inventory .. for testing ftime2
    + -scale           inv          scale for packing
    + -scaling         inv          scaling for packing (old format)
    + -scan            inv          scan order of grid
    + -Sec0            inv          contents of section0
    + -Sec3            inv          contents of section 3 (Grid Definition Section)
    + -Sec4            inv          Sec 4 values (Product definition section)
    + -Sec5            inv          Sec 5 values (Data representation section)
    + -Sec6            inv          show bit-map section
    + -Sec_len         inv          length of various grib sections
    + -spatial_proc    inv          show spacial processing, pdt=4.15
    + -spectral_bands  inv          spectral bands for satellite, pdt=4.31 or 4.32
    + -start_ft        inv          verf time = reference_time + forecast_time (YYYYMMDDHH) : no stat. proc time
    + -start_FT        inv          verf time = reference_time + forecast_time (YYYYMMDDHHMMSS) - no stat. proc time
    + -stats           inv          statistical summary of data values
    + -subcenter       inv          subcenter
    + -t               inv          reference time YYYYMMDDHH, -v2 for alt format
    + -T               inv          reference time YYYYMMDDHHMMSS
    + -table           inv          parameter table
    + -timer           inv          reads OpenMP timer
    + -unix_time       inv          print unix timestamp for rt & vt
    + -V               inv          diagnostic output
    + -var             inv          short variable name
    + -varX            inv          raw variable name - discipline mastertab localtab center parmcat parmnum
    + -vector_dir      inv          grid or earth relative winds
    + -verf            inv          simple inventory using verification time
    + -vt              inv          verf time = reference_time + forecast_time, -v2 for alt format
    + -VT              inv          verf time = reference_time + forecast_time (YYYYMMDDHHMMSS)
    + -warn_old_g2     inv          warn if old g2lib would have problem
    + -wave_partition  inv          ocean surface wave partition (pdt=4.52)
    + -YY              inv          reference time YYYY
    + -inv_f77         inv>  X Y Z  match inventory written to Z with character*(Y) and X=(bin,ieee)
    + -last            inv>  X      write last inv item to file X
    + -last0           inv>  X      write last inv item to beginning of file X
    + -nl_out          inv>  X      write new line in file X
    + -print_out       inv>  X Y    prints string (X) in file (Y)
    + -s_out           inv>  X      simple inventory written to X
    + -big_endian      misc         sets ieee output to big endian (default is big endian)
    + -box_ave         misc  X Y Z  box average X=odd integer (lon) Y=odd integer (lat) critical_weight
    + -check_pdt_size  misc  X      check pdt size X=1 enable/default, X=0 disable
    + -colon           misc  X      replace item deliminator (:) with X
    + -config          misc         shows the configuration
    + -count           misc         prints count, number times this -count was processed
    + -end             misc         stop after first (sub)message (save time)
    + -error_final     misc  X Y Z  error if at end X=count Y=ne,eq,le,lt,gt,ge Z=integer
    + -export_lonlat   misc  X      save lon-lat data in binary file
    + -fix_CFSv2_fcst  misc  X Y Z  fixes CFSv2 monthly fcst X=daily or 00/06/12/18 Y=pert no. Z=number ens fcsts v1.0
    + -fix_ncep        misc         fix ncep PDT=8 headers produced by cnvgrib
    + -gctpc           misc  X       X=0,1 use gctpc library (default=1)
    + -grid_changes    misc         prints number of grid changes
    + -grid_def        misc         read lon and lat data from grib file -- experimental
    + -h               misc         help, shows common options
    + -header          misc         f77 header or nx-ny header in text output (default)
    + -help            misc  X      help [search string|all], -help all, shows all options
    + -ijundefine      misc  X Y Z  sets grid point values to undefined X=(in-box|out-box) Y=ix0:ix1 Z=iy0:iy1 ix=(1..nx) iy=(1..ny)
    + -import_bin      misc  X      read binary file (X) for data
    + -import_grib     misc  X      read grib2 file (X) for data
    + -import_grib_fs  misc  X Y    read grib2 file (Y) sequentially for record that matches X (fixed string)
    + -import_ieee     misc  X      read ieee file (X) for data
    + -import_lonlat   misc  X      read lon-lat data from binary file
    + -import_netcdf   misc  X Y Z  alpha X=file Y=var Z=hyper-cube specification
    + -import_text     misc  X      read text file (X) for data
    + -limit           misc  X      stops after X fields decoded
    + -little_endian   misc         sets ieee output to little endian (default is big endian)
    + -mem_del         misc  X      delete mem file X
    + -mem_final       misc  X Y    write mem file X to file Y at cleanup step
    + -mem_init        misc  X Y    read mem file X from file Y (on initialization)
    + -new_grid_format misc  X      new_grid output format X=bin,ieee,grib
    + -new_grid_interpolation misc  X      new_grid interpolation X=bilinear,bicubic,neighbor,budget
    + -new_grid_ipopt  misc  X      new_grid ipopt values X=i1:i2..:iN N <= 20
    + -new_grid_vectors misc  X      change fields to vector interpolate: X=none,default,UGRD:VGRD,(U:V list)
    + -new_grid_winds  misc  X      new_grid wind orientation: X = grid, earth (no default)
    + -no_header       misc         no f77 header or nx-ny header in text output
    + -proj4           misc  X      X=0,1 use proj4 library for geolocation (testing)
    + -read_sec        misc  X Y    read grib message section (0-8) X from binary file (Y)
    + -rewind_final    misc  X      rewinds file X on cleanup step if already opened, CW2
    + -rewind_proc     misc  X      rewinds file X on processing step if already opened, CW2
    + -rpn             misc  X      reverse polish notation calculator
    + -rpn_rcl         misc  X      data = register X .. same as -rpn rcl_X .. no geolocation calc needed
    + -rpn_sto         misc  X      register X = data.. same as -rpn sto_X .. no geolocation calc needed
    + -scaling_0001    misc         changes scaling testing (sample)
    + -set             misc  X Y    set X = Y, X=local_table,etc (help: -set help help)
    + -set_ave         misc  X      set ave/acc .. only use on pdt=4.0/4.8 (old code)
    + -set_bin_prec    misc  X      X use X bits and ECMWF-style grib encoding
    + -set_bitmap      misc  X      use bitmap when creating complex packed files X=1/0
    + -set_byte        misc  X Y Z  set bytes in Section X, Octet Y, bytes Z (a|a:b:c)
    + -set_date        misc  X      changes date code, X=(+|-)N(hr|dy|mo|yr), YYYYMMDDHHmmSS, u(UNIX TIME)
    + -set_ensm_derived_fcst misc  X Y    convert PDT 0,1,2 -> 2, 8,11,12 -> 12, X=code table 4.7 Y=num ens members
    + -set_ens_num     misc  X Y Z  ensemble member info, X=code table 4.6 Y=pert num Z=num ens members -1=No Change
    + -set_ftime       misc  X      either set_ftime1 or set_ftime2 dep on version_ftime
    + -set_ftime1      misc  X      set ftime
    + -set_ftime2      misc  X      set ftime2 .. will be replace -set_ftime/ave in the future -- TESTING ---
    + -set_gds         misc  X      makes new gds (section 3), X=size in bytes
    + -set_grib_max_bits misc  X      sets scaling so number of bits does not exceed N in (new) grib output
    + -set_grib_type   misc  X      set grib type = jpeg, simple, ieee, complex(1|2|3), aec, same
    + -set_hex         misc  X Y Z  set bytes in Section X, Octet Y, bytes Z (a|a:b:c|abc) in hexadecimal
    + -set_ieee        misc  X Y Z  set ieee float in Section X, Octet Y, floats Z (a|a:b:c)
    + -set_ijval       misc  X Y Z  sets grid point value X=ix Y=iy Z=val
    + -set_int         misc  X Y Z  set 4-byte ints in Section X, Octet Y, signed integers Z (a|a:b:c)
    + -set_int2        misc  X Y Z  set 2-byte ints in Section X, Octet Y, signed integers Z (a|a:b:c)
    + -set_ival        misc  X Y    sets grid point value X=i1:i2:.. Y=va1:val2:.. grid[i1] = val1,etc i>0
    + -set_lev         misc  X      changes level code .. not complete
    + -set_metadata    misc  X      read meta-data for grib writing from file X
    + -set_metadata_str misc  X      X = metadata string
    + -set_pdt         misc  X      makes new pdt, X=(+)PDT_number or X=(+)PDT_number:size of PDT in octets, +=copy metadata
    + -set_percentile  misc  X      convert PDT 0..6 -> 6, 8..15 -> 10, X=percentile (0..100)
    + -set_prob        misc  5 args X/Y forecasts Z=Code Table 4.9 A=lower limit B=upper limit
    + -set_radius      misc  X      set radius of Earth X= 0,2,4,5,6,8,9 (Code Table 3.2), X=1:radius , X=7:major:minor
    + -set_scaling     misc  X Y    set decimal scaling=X/same binary scaling=Y/same new grib messages
    + -set_sec_size    misc  X Y    resizes section , X=section number, Y=size in octets, DANGEROUS
    + -set_ts_dates    misc  X Y Z  changes date code for time series X=YYYYMMDDHH(mmss) Y=dtime Z=#msgs/date
    + -set_var         misc  X      changes variable name
    + -start_timer     misc         starts OpenMP timer
    + -status          misc  X      X X=file
    + -submsg          misc  X      process submessage X (0=process all messages)
    + -sys             misc  X      run system/shell command, X=shell command
    + -text_col        misc  X      number of columns on text output
    + -text_fmt        misc  X      format for text output (C)
    + -udf             misc  X Y    run UDF, X=program+optional_args, Y=return file
    + -udf_arg         misc  X Y    add grib-data to UDF argument file, X=file Y=name
    + -undefine        misc  X Y Z  sets grid point values to undefined X=(in-box|out-box) Y=lon0:lon1 Z=lat0:lat1
    + -undefine_val    misc  X      grid point set to undefined if X=val or X=low:high
    + -v               misc         verbose (v=1)
    + -v0              misc         not verbose (v=0)
    + -v2              misc         really verbose (v=2)
    + -version         misc         print version
    + --version        misc         print version
    + -AAIG            out          writes Ascii ArcInfo Grid file, lat-lon grid only (alpha)
    + -AAIGlong        out          writes Ascii ArcInfo Grid file, lat-lon grid only long-name *.asc (alpha)
    + -ave             out   X Y    average X=time step Y=output v2
    + -ave0            out   X Y    average X=time step, Y=output grib file needs file is special order
    + -ave_var         out   X Y    average/std dev/min/max X=time step, Y=output
    + -bin             out   X      write binary data to X
    + -cress_lola      out   X..Z,A lon-lat grid values X=lon0:nlon:dlon Y=lat0:nlat:dlat Z=file A=radius1:radius2:..:radiusN
    + -csv             out   X      make comma separated file, X=file (WxText enabled)
    + -csv_long        out   X      make comma separated file, X=file (WxText enabled)
    + -cubeface2global out   X Y    write faces X as global cubed grid to Y: X=list of faces to exclude
    + -ens_processing  out   X Y    ave/min/max/spread X=output Y=future use
    + -ens_qc          out   X..Z,A simple qc ensemble members X=stats.grb Y=extreme.grb Z=extreme.txt A=1 (qc_version)
    + -fcst_ave        out   X Y    average X=time step Y=output v2
    + -fcst_ave0       out   X Y    average X=time step, Y=output grib file needs file is special order
    + -fi              out          depreceated, used in old IF structure
    + -grib            out   X      writes GRIB record (one submessage) to X
    + -GRIB            out   X      writes entire GRIB record (all submessages)
    + -grib_ieee       out   X      writes data[] to X.grb, X.head, X.tail, and X.h
    + -grib_out        out   X      writes decoded/modified data in grib-2 format to file X
    + -grib_out_irr    out   X Y    writes irregular grid grib (GDT=130 not adopted) X=(all|defined) Y=(output file)
    + -grib_out_irr2   out   5 args writes irregular grid grib GDT 101 X=npnts Y=grid_no Z=grid_ref A=UUID B=(output file)
    + -gribtable_used  out   X      write out sample gribtable as derived from grib file, X=file
    + -gridout         out   X      text file with grid: i j lat lon (1st record)
    + -ieee            out   X      write (default:big-endian) IEEE data to X
    + -ijbox           out   X..Z,A grid values in bounding box X=i1:i2[:di] Y=j1:j2[:dj] Z=file A=[bin|text|spread]
    + -ijsmall_grib    out   X Y Z  make small domain grib file X=ix0:ix1 Y=iy0:iy1 Z=file
    + -irr_grid        out   X Y Z  make irregular grid (GDT=130 not adopted), nearest neighbor, X=lon-lat list Y=radius (km) Z=output grib file
    + -lola            out   X..Z,A lon-lat grid values X=lon0:nlon:dlon Y=lat0:nlat:dlat Z=file A=[bin|text|spread|grib]
    + -merge_fcst      out   X Y    merge forecast ave/acc/min/max X=number to intervals to merge (0=every) Y=output grib file
    + -mysql           out   5 args H=[host] U=[user] P=[password] D=[db] T=[table]
    + -mysql_dump      out   7 args H=[host] U=[user] P=[password] D=[db] T=[table] W=[western_lons:0|1] PV=[remove unlikely:0|1]
    + -mysql_speed     out   7 args H=[host] U=[user] P=[password] D=[db] T=[table] W=[western_lons:0|1] PV=[remove unlikely:0|1]
    + -ncep_norm       out   X      normalize NCEP-type ave/acc X=output grib file
    + -ncep_uv         out   X      combine U and V fields into one message like NCEP operations
    + -netcdf          out   X      write netcdf data to X
    + -new_grid        out   X..Z,A bilinear interpolate: X=projection Y=x0:nx:dx Z=y0:ny:dy A=grib_file alpha
    + -new_grid_order  out   X Y    put in required order for -new_grid, X=out Y=out2 no matching vector
    + -reduced_gaussian_grid out   X Y Z  reduced Gaussian grid, X=outputfile Y=-1 Z=(neighbor|linear)[-extrapolate]
    + -small_grib      out   X Y Z  make small domain grib file X=lonW:lonE Y=latS:latN Z=file
    + -spread          out   X      write text - spread sheet format into X (WxText enabled)
    + -submsg_uv       out   X      combine vector fields into one message
    + -text            out   X      write text data into X
    + -time_processing out   X..Z,A average X=CodeTable 4.10 Y=CodeTable 4.11 Z=time step A=output
    + -tosubmsg        out   X      convert GRIB message to submessage and write to file X
    + -unmerge_fcst    out   X Y Z  unmerge_fcst X=output Y=fcst_time_0 Z: 0->result 1->+init 2->+all
    + -wind_dir        out   X      calculate wind direction, X = output gribfile (direction in degrees, 0=wind from north, 90=wind from east)
    + -wind_speed      out   X      calculate wind speed, X = output gribfile (U then V in datafile)
    + -wind_uv         out   X      calculate UGRD/VGRD from speed/dir, X = output gribfile
    + -write_sec       out   X Y    write grib msessage section X (0-8) to binary file Y
    + -alarm           init  X      terminate after X seconds
    + -append          init         append mode, write to existing output files
    + -crlf            init         make the end of the inventory a crlf (windows) instead of newline (unix)
    + -d               init  X      dump message X = n, n.m, n:offset, n.m:offset, only 1 -d allowed
    + -egrep           init  X      egrep X | wgrib2 (X is POSIX regular expression)
    + -egrep_v         init  X      egrep -v X | wgrib2 (X is POSIX regular expression)
    + -eof_bin         init  X Y    send (binary) integer to file upon EOF: X=file Y=integer
    + -eof_string      init  X Y    send string to file upon EOF: X=file Y=string
    + -err_bin         init  X Y    send (binary) integer to file upon err exit: X=file Y=integer
    + -err_string      init  X Y    send string to file upon err exit: X=file Y=string
    + -fgrep           init  X      fgrep X | wgrib2
    + -fgrep_v         init  X      fgrep -v X | wgrib2
    + -fix_ncep_2      init         ncep bug fix 2, probability observation < -ve number
    + -fix_ncep_3      init         sets flag to fix ncep bug 3 (constant fields)
    + -fix_ncep_4      init         fixes NCEP grib2 files where DX and DY are undefined
    + -fix_undef       init         set unused values to undef
    + -for             init  X      process record numbers in range, X=(start:end:step), only one -for allowed
    + -for_n           init  X      process inv numbers in range, X=(start:end:step), only one -for allowed
    + -g2clib          init  X      X=0/1/2 0=WMO std 1=emulate g2clib 2=use g2clib
    + -i               init         read Inventory from stdin
    + -i_file          init  X      read Inventory from file
    + -inv             init  X      write inventory to X
    + -match           init  X      process data that matches X (POSIX regular expression)
    + -match_fs        init  X      process data that matches X (fixed string)
    + -match_inv_add   init  X Y Z  add new options to match_inventory
    + -names           init  X      grib name convention, X=DWD, dwd, ECMWF, ecmwf, NCEP, ncep
    + -nc3             init         use netcdf3 (classic)
    + -nc4             init         use netcdf4 (compressed, controlled endianness etc)
    + -nc_grads        init         require netcdf file to be grads v1.9b4 compatible (fixed time step only)
    + -nc_nlev         init  X      netcdf, X = max LEV dimension for {TIME,LEV,LAT,LON} data
    + -nc_pack         init  X      pack/check limits of all NEW input variables, X=min:max[:byte|short|float]
    + -ncpu            init  X      number of threads, default is environment variable OMP_NUM_THREADS/number of cpus
    + -nc_table        init  X      X is conversion_to_netcdf_table file name
    + -nc_time         init  X      netcdf, [[-]yyyymmddhhnnss]:[dt{s[ec]|m[in]|h[our]|d[ay]}], [-] is for time alignment only
    + -ndate           init  X Y    X=date Y=dt print date + dt
    + -ndates          init  X Y Z  X=date0 Y=(date1|dt1) Z=dt2 for (date=date0; date<(date1|date0+dt1); date+=dt2) print date
    + -ndates_fmt      init  X      X = C format for ndates option ex. 'date=%s'
    + -no_append       init         not append mode, write to new output files (default)
    + -no_nc_grads     init         netcdf file may be not grads v1.9b4 compatible, variable time step
    + -no_nc_pack      init         no packing in netcdf for NEW variables
    + -no_nc_table     init         disable previously defined conversion_to_netcdf_table
    + -no_nc_time      init         netcdf, disable previously defined initial or relative date and time step
    + -not             init  X      process data that does not match X (POSIX regular expression)
    + -not_fs          init  X      process data that does not match X (fixed string)
    + -one_line        init         puts all on one line (makes into inventory format)
    + -order           init  X      decoded data in X (raw|we:sn|we:ns) order, we:sn is default
    + -persistent      init  X      makes file X persistent if already opened (default on open), CW2
    + -rewind_init     init  X      rewinds file X on initialization if already opened, CW2
    + -set_ext_name    init  X      X=type ext_name (1*misc+2*level+4*ftime)
    + -set_ext_name_chars init  X Y    extended name characters X=field Y=space
    + -set_regex       init  X      set regex mode X = 0:extended regex (default) 1:pattern 2:extended regex & quote metacharacters
    + -set_version_ftime init  X      set version of ftime X=1, 2
    + -tigge           init         use modified-TIGGE grib table
    + -transient       init  X      make file X transient, CW2
    +
    +
    +
    + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5200 Auth Road
    + Camp Springs, Maryland 20746
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/single_dual_stream.png b/docs/web_docs/single_dual_stream.png new file mode 100644 index 0000000000000000000000000000000000000000..3fc2bb7b8376ffcfd81314342c813e9a8dd725bf GIT binary patch literal 28920 zcma&Ob9iN6mo-{du~D&Y+jhlvDz@#4ZQHh;RBW?ivts-1-`nrgef#_R_H+L@$=YY_ zv(Ls_bB;O2SSL(gRvZo*3;N5KFL06)B8p$Wd>sZ}KOw<^ziqqz4nPN#orH!X(Es_* z>+4;3eb|>TcIA>Hg34~I=UHGsQN_Oxf7YR^?Gi$LB?5)KSj`86MoBRUYF3ZC5zLdX zNP4CrC|7@$hp>!(4*UimM1|}wS%dB!toK^>mG`K(YD?@TtQ>Gq*G-K8xkZm3=D|;Ny3E`)0GR|*}?|n?~X>wXf z{~RqBFtpSoj-MFEmdaNL-UOcn-`qQUyS(CPcUI`1WeS?{8rihJYPUInp;D_#H&u(r z;HkGc6sadOQ+&rpjSldY4gOJ9ZdbF82tH(TnJDXlS%k3IYQMLck>>7gx!W;V(vUoA zXla_Kd!$cUqXCYIQY4@EtzIc*hMh_DwtJpw{X*X~_Tr_|C{}_#0MkTq>ZeVf;ya567}T22lR2HQ zsu*2~{v|^>1fQ;-!)2k z3KWd`H{`>+vcha>lO|(<4S91)ly zCcC#{{AQiIal4KjUk25fCz5;1x63oCbjHJ+Uws32{J3x1m~3)mPt<>PDuN`QRrf~6 zAbK~KZnDt07Mt_kLCy*}iCn?Go3+62?(dPXu`>=}`P$sEj$Eq+LgJ{mAD__vZb(%e z=pUMo|H|yW<9m17X~d*eEiRVG2VG3;^{Rj^HJKS6hFGrAQ!{B4+iEJ+=u$2oj(O?( zzH}H2R^l&<2@3^<=YUa9}ua+v8#bbnv9cpfMd)K*MZu;j)LO?(O(?aun>&5!YRiEk?r9U{@&|5qJK}w^7O-VxmN?0vt{zs&HJIb+8E3CC}NOEBcXkA#OPD`S3T* z0#{`QonE){IgN#x+0zz0tPzvshAZH$-GOZ0ul=Ibv|`5i=I&&^RHLC7Lyz3Fb}&`v zismHo#6AYU=l3BLEem&ovW1I_%UHEDmLB=C(pHLK-(;0paDzJw8PHQ6Ks>Vl@)1LQ znJ!`KLP*Jo)NT4mz(j($LH?d#@p>Qf^@>tIfj_PDngxYAhG)t?h?^L@UODRUGhOW@ zrgu~Z{MKn{BVROPrbe$v8vl3fplPmQ>_=`0x}5IM_os!Mr(t~GT(uhAQto4X<+9Z7 zYn~=cjRUt%9$y{iv0N(0m!%P-vku#D##cv+DI(wr@yPa1m*xy?Ekh9N5*X-Ua`f&t+A7uxsHZLejPq}R|EmS?&8kFy#!Q7b%_UshqYezm4b zJn^=N&1<0*Vfm-;C4c1%P%4ofELAAj{PXcAhI{8+fu(=1%j*8hxnb_4`-1v$y)TOW zdd!)OYczF+b}w%|QBX+#Crvtk{lZWJ?mp~T&CK>eN?t`pmN__--ltm;v?Oz z?ctf`(jw0|7j@T;$qls#rt-mdxun^Op>(jJ31tB%W>e-ya->xX$p(tI{&JO8h~aRw zaXY=p(^+>%#W}`KNicSzgZ=(e7MONNa36yXQ+|w6`6wN9lG6K8ViOE zuT-cQ)Pbkf4&Z;X|8t^{n8q`gxu?Bh3@u%+joAqvva719LPA6L0g)<5vd81z0*A*9 z@%Ct1ygwL@(QaGd?d7cI>2{hwsLa;JhAx=Z=i~Y4>h`w(vgea-9o#|C=VvJ*6qcz} zSnjt%lH2#ktq2lfVRm}m&JpBMGdn?(VJKnMk+L<(L*j&ybdaS2F;uyx%(JO3^c7yx zORlE|<|VF*5x5?(dIIi`P6W}c^MU$y=s1c41?6W^k9RIaOEFd&ZDe6HBGDWFxQlIB6I_j%B*#e;32e`xh0{|@SN~#=!ouDP!;}5xR^0GeGB89 zlWTbRKaO^^2w)?W*rq-(I=tQo4caq3(RQadcT1cL=KK=8U>dg(A7clNxUJ7Rp*Kf` zi!p2RbHs+Oby?yy9;P}y?&9@MKHLE!k;jR=uKaD3B1BcLSzlq~3ST>6vZB}7Nbijz zTAxH%@R~7E$J&Lo4PQ!!7sm(EL$7b{u#Dh^d!skp%=Wolrfbh)_L$sKdX4%c{1 zTu(vP;;eiav}0k>NtAxU%#Dsh(d%`i%qO#1t^Dc_K_F&iMB?J&qR{K+sn(TYoH#h& z2fG9Az7P2?B$*T*E{B|Tw(ko1F%qSX7-C>2Lu z5wts>se(d4?1kX_$a@T`8UJ24Y`v#IoD!|lx3tc_XdA)2pFjEv2@f@Vn4{G<)b|TU zF{@Ie0bHlu32B^IEb{lm`IFbos7PnljrH3Wm$X}s7L$jgKhK2@*jYv#p5yhaPnb>8&VX}LD z3yUXNLK7(mrsfYeb(URnvH?MH_C3QcDb(?0&X#B0SeErAgW0ZlVfZ8VX(9{ zq;KXhaTb;4)LfkUuW97!p2u`=0Ypehm;oeZeTG(r2wFc3S;}|AYckxAjyt!SDTsZH zb!0ARjnL5p%MlQQ^6blda3@hQ9z;*iOjJWf*7RXME6V6OvUeJmIJlXt3F*{p3HmwQ za(sF)QN6-V-ROq%T@*cByJ~#3gI|ts7DG6gjy5DV&4)Ke+S`AtxYX|{3SEHT z>SLAB(=;ZuC{iNj;p0&%$5aK=Y8cP{wp2;GturpHxh=yM!S#Ii7@FTf??u!{P+E7zQn@Fou(Flod)uL?{;rM zk|P6@3VSZfdpOx(Jhwa%C8cB}cKqj||J$!h^*W(DLo96Uh}s)vd66p3CcD!GN=95i zuF5cQIIN$4>W$6j3d63>q#AM~P$>J5%b?cVoqx1R6R%Px!wUwLwr4>n#^Dy*T2kUcVC@7o{5}zB88%c|LJQS#_kYw-ZtAto+1KGD!q(Cf6JeRF)TNJAvVfa) z!um>5Nh8B__cu<*jL!%ZRwVC`?3fYVh>c%CIn+G}XXUwoVx$r@dkVISMz&LOP3L7E z|EMtFe#>)x3atP7;oeaF54y0I6-%SD6Cx^JBs{U&_Q=-!OzHB9bPRsyHir+kJp1_b z=mdly8gu!bRD228^UVh;$FgXxvH8)1jj?>!B0Fd6W#+vpISI)(4L9FYSKP1P zVXzrly?5k#Mq_~}T0MnKe=EnI@!WnFZ7@m7K>BFw^;q zs=1Gse7z54Re#<_Y};Axgi?G{j%>UAZy&$u8`>ru?4e55xnZLO7kwt+UL@1kPUp`w z{)M$t`ijq72F*mjr^w(wb5ZHQckxaUiTod95J*qJaQxSR3@Rmfe|!6BVggQF@Hw<7 z-%1>=b8vY{4-Suj#Uf$7Two`Sq8HIV+1S|FO0Wopx(k4J(X0A{@f7Oiwbj*d0TZC2 zM7iY{ipHfrG&Zxej5s$OibNvr8&#pO=Jx&QIP&TFC}+N_#$P+MlK6QZz(Bxk11=8T$Va$WXGEWOk>fzJ zO!_O8g!?agFjvB(JC-vJT5_AN-cT^{pQeU{-=Y;VNA9i=UF*7`rwk4z{r#B&L z|4>dd_bM@`fT9~lg8%LG(A&_sEW}?Lj!Gn7w=I9ghxDrJ=)U|T?Ma9E`iB$dt84RR zL@@-)e%wJCnvw31nrcwrito)Rd7rFwO^Ck>HUGC~P0J+f zK{}mwqjvl>NM+12W;@<;)d%IZ`wi=;nWk=R>8Otc5h@W*CmWB4vxwgkjkpbPi`1S_ zJs>B7#WLeqHc!QEEhZ91y68V$Oz*N&w-nwK?{0PHAN#w_9<)598+Vb&y_-vXl(_r7 z_uHa^gM%UA;n7g*CQGt+7v6u?b-OrUKBlv|f+!M=WOF%Uo2EEXW`d7s_34!EXb_=cb>Q5+e@7tWd5JK3u((l8EnLvxzV9FrRwWgI=FP!Zf>r+hs;vkF!~ z;CLo1Kr7bWP$Y30jgZ!iSSF-W^8Rz3vje+n6?PyR>{Gak{$=l_PKH9Y7~BSDD_oZU zBX6C*svz99`x*R43f*F)zj6zLpFgNdDaGfsO;$jYlB9y!ovV;`WTOhT3Ssf^D>Ne; z*Eedh#$Sd|_ygS6|&^>s=3cX!hExaqep3j zavUx6^Mz!>omZY_~0_>l(UC@m@CvT+v;qlhx^AVzizfZyne)do zBLkzTKH)S>{3=rjET%set3{|BMv&?8D(fv?oN+(jU?wjD^G1nH2qEQAO96HyZRKEn zc}0Dt-9xxC;i*O#3{%D5wHCRzi_I=AjZg<+XAh3GwB4NmbP9!=cT}7hswf91Il86b z)O#(@s;2l8g)R?gHxG~S z6MM&_VjIerHo3{fQ9s*$YF9E;Xbj!+Z?88-|Ak`#@g2e^~wcKC{QE<(HavHatla{20%00A8=&K z+YJ^{f@}ve#a81$;U?lSxtu6Ym#Qi<$%4{{!fzn&yfC~8~=r-9R3~df!zwVVn;cnh^HA~eKjzH!Q%BX&?JKO{fzi9 z^!4@oremU_-~e=;Vh$_Axq0|HRcEnCrQPlnhEE4WlAseA6(yRh)8TS2$r|VI1x^g&ZL`+)247rTewInvE>S{fdQ3%EEmgwOcEK` z)Wixy44eZh3N+YM7WXiM|9_o3h8QteyaB?Y+Ddz-!G93Jba!C)WE@y)(|m*X5Fc)L zT%dk}NCHf`B{Kol(QHoljd>*{A^U|S1B0XlgoFy9$OWpZ#2{eds~H7Obwp;`f54J> zt)Sm;Em*v$g@lM%U+}0~*9=as#3~6{<3=m!^@m4a?dW$1@*7P9`xanzi#cJ$ZrR|~ zJzt6>%n1p7t_BcHURKo^_7iX*LgrBn%c?E${c(lq>f0kmZyin#$e1 zYdsYyoOa%AwKL1KE~u7!+}_c2UBptaRN&}1nh9YvSWkVmwv~otXnZAh#^FVA!v)H5 zBEBfo>w+0PurKbIS@#8vek+~vKi$O#I{?6{ z0;_I^gYHrzl4Qa=*zFK%xl9RRK&eauGu@N@p4ASA%N>H>l{V*sEj&_X=CIRJ@>4p;r03c_z#J6IGqzyZ#=#WfNKMPhaR8zKz6%lH%+}pGX);c z2kC*$m3m_sfIKHDCN?)W-NK3(tarjCqA zq^718az*R9A(viV+115#X6HWPpwN^!oy@g5pP>P%CBozW6l#alZu`q>lO;Lm1;BQS zCsC;=%0Lz)K>R~qAvyfw`xb-GFLr;rXn(%SinJHN2kxM&Jbisql9LZy`mW(%t-v8> zA+GIaXPU(ZaN&vLz@7N<$bk%=w$@@>vMRR9(6u)o5hvJ}x@lj}P^=>tn;f6U9@%zK~Ro;~8X zegh;7tf49EzrEsFur62TTmrpUOHtoiOC>PnTv!1zAivagPIh_ z-8P-dL?YJs_U&8Xb{xUnuP?h5HQmTP)N0jUN11B)A=_&w9SUt;qss8H5$LWHk8g3? z<9+--{l4BM3JUhE9=C)p($+fL1sZh%Xm%#k*-?4IA<%?coo;oZ!-B*LfLutL49HCM zVmmZC?aGCbpmIqwBOHxbT_8zgDTuzy)fZK>)4xX~{L)o^P!?$DbiaHNKWyA<$p&Nc zEzbh7dY|i-cL*RPLPv=U_e*>Sm`yb^NlavE|MC)zqNU&WrMiEVC?mn*!sFRWC{$f- z`1>v}acDxom=Fl{3mG#O5QY0FSTxN_pRAWEHJYbH_q5Fs*^zK?A`4pl0~yK##FwM@ zcC%H8;D_s+dx)+M0%#ySp5H^JuNUud+qy#(HwW$C^}l#Yt<-`7qYaKl*k3V&jq~+J z3H33C{{u0KqkK<0Y^jN+_I+1UJ^hG}ZkJkeMgjxfM@rew^6Z`l8C=gnGoQR$7 z?iOz~Xy}(V1_SSB^W67!%3c%6mv`bNb*0WO@4_pRV77Ui+ zUfoUTsJE@2D+*o3F(7L|-6`hjlgBOej+f9gT53BwU2f`35RA$;brA@uILU+vWsLh6 z@rSFb*3*|!QM0egb8w~;r|G!JzH7g^(cStHL(2-I+LqC6;D@9y7^kb znaadMJGr!k_VMwd5$&Fa2^BWFV*daYt>@`CTqA^phZ=Ic!Z9#R9)1OZawDK82eFha zMxi%{CR5&;?-fQ=i3d|4u-WDa0YnW{KfW^0fK+bRYR#JKqvOv*m?25}KfgFb_}y}G zFsZ-uf=?q);i>G(%0^N(?60 zSRN7ww;X@pkl~|UsFSi3t=jF-5#aIQgP{&uktwOKRqY>Yb{; z_3kh0_>QlOD1Kq;1ZkOF%5y1MeeGqzF4Pk86!w3bi!IESF+&s3Zz^;^HDdNt;d00XE2Zc@Fu~Y*noJ-!6mezYm~18kFY|3v6`OLO0{?G-)7B1Q!C6?--fk@hzQR+-$tBGPXOMv zj4XEDYrP;^==xVjoc(%NYlX95dO}B|J?2NsWv^0^aTd5&Dg4U_CBX3s-zV!u#Pnw| zcg)y4ArnT1L0ucXcBAf*1jRGGDQannLl#Vg`5xxWz6z$3#ui?4#XK`d4a^P1`**kpM z4-A+txMzR|D0=At)Wkk&>?qSogpmu)&NH@$Z12e283`0;ns48~gEYZ1eFhjwejTfIFcWswy>0JJ_@t}w=u>;vlR z{4{g2>Qs4bHhrUt`mqmwP+J1hN~;2SPu|x9cfwo}H*500f(D9AJU_ZEP2D|ER6KRf zwmC>W*H9)=k`q0OA&^jT{9Y0C^mk_D99Wn_z~xr{{0W==VFXuX@u!ZkOIJQpet%-< z_td(Zj9DnM4W&|(l+Q17wafmoInYHa&!3B7De-x?$dYpqdxurx91IoK?XOCodu@(K zi69i&Jnr#(mI=R`DpiC?#NfVZ0NSm1{~UC{uQ@Bkn;I_f7pJ$YeuOem$EUf5(0SF+ zuV3mJ&`=tinzogi12JS>gpnuSnU!K*i$28L5aRXW(uiFyH>1*7Eum9BPAznb$Q-52 zhnu56_Gsc!z}tMx>J)Z3u7*V#F&MsA3^fKg&&EqgNeEouINLq0`?RXr{0dQvCZZ#Q z28aW*+xKtBbI$iDyRBkfLx)^3#y`-9U2miHH(l?c?_qQa62r%M(ZZ>y?}Zh9P~A($ ziD5Gu1e)m-l_{NC>3i>>gIk8Iv+G)A^CIRTJb`H)!HUI5V%J$;AbLIA8?E;^NtCOS zEy-x-FYUA72qPK^92clmAeatR!57Q6WE|Dq6=Et)r%}gN?Ez zrC@*?Y#OPutHxTyV1=j@j-t|S0SK$|I5sx#gl&kBR?=TWF>;5syYrhIBr z4LZ>_251P^S)9nGDJ-}9j|webg= zxl5J_&{vo)v8EvlC-`ru2m3GB2cSOy_Wk$v|Ah+w$L@c94A^zT6O<_}-wr^Kt8oC= zAr`E!4^$UHar){QKy?AM|9R`5c2L|X=hD&=BrGh-&JsF}dhAIzt!CqIfNNmp9R{p3 z`bI`1OYjxRoVm6!aI(7Z`53`%QJ0)17^V!l$yE8RVn9zeJfIa|)NoZIY(pOUe#v>sk z`vY1*E@0fzCZLJLr+*>D5|3n6XfEVd-IS*urzrw`85Xh7N-Pb2%g@Ax?)b~^WtyQDh3RAU4 zHwu|lsu236oXRVU%UMy(2#?!^hDxnE5{MuMKxDqm4DjK9-v54ld>m?xV$!8rr72Xv z=Wz!Ka1DKN#Nvuj%>8{M60rDu03s-Dm%2M&LkCQAs6q=}p006_LIx&S7-HaQ1MR*M0QVFB>#c&(J`Sq` zm8j|8*YhoQ`sQkMlEJLR36CTsWP3A9TsCYf_gUmgMB4UH#`ZmzKlqY9GYMM)P zOJW8>M7z7lg@*Bn_~;0?I926-j;alvAs=Z(x1DbAknm5V^;Vi|@;TK!xNzXr3G&1rP!R&_@?x7KC7l!Yx zCU%W%JN}0HG(4S9(PABS-11HF5Yn`?EFV5iO-%z`0JsDZ)2vHnuH{1~f-&qp+8now zRQFKqTnB?wQW8GV6K27#!|X6^-03sYr&)nbcLgo#(uQ`zlX6EFzdU)Z+YK4g&ZUV= z|H|p;;OaX3a(||fClvH}v1PY{mPmb;O#k=*cpOMb$$k%Zq&sZ+JB@hmmmuBflLO*T*MCf4;;SFyk?@uAFgrUln$VmNV3_cBI(F@=Pjmy8ZF~TB_T{ z_3^Za0MxLg^WHMju!|0p2mKlUV3d^>100JMY*1k(n97U=5VYng3auKrsSEXB3tGj_ z_H*q!5F+7kv-S(niMBIHi(1|RXX5O=B|dA~8z2Vf( zqYW9^fUr2b@oy22%cdd7z5n8%Fou^t!#{4L!?AtbKg(Bq^dF^^&6jSsg1_R%X{1>@ zhU72i{%Q3v%evcj8k-NPj9#g=T&i@h`BH9Ro|m0G!gUToxc%%sFg&<@mmI`US1XuO z=WBR*Q#Z4;DEf-@BWb!xwCAMN-K#>Kje&8veAar_@P@2u9U=;JY&-_{*|Uhncnl>H ziv!5N=64~^mX2uxFIEhK+3*(|v~)B#ynq}yWf_t9e@ zLwj-=;Yae8{xk96zAj(Cp`K)TaG(ONf2pc|A@*968OgerMG0jl$s6;#Wg`|3dB36a z-CeDXgIr@m_uqDpa3NEeP7hp2aR}k3&x8WZcl?3}|5$gH>OY*p)72upJ35RJHn0J`{u_*&OL7$Sk7p$M8D@{7Lrfpqa{ z+x~~|#pclrr`TykEZbn6mQ9FZBc-yuKX<~EeV45^nu_mO#wm>j{P}0M)tJ`WxoKvc@qyS5aeLKv#!o7-8 z>e<3H+h51ry~1BXi%tS#xbq8Kr{<#$N%OrG?m^bY;3076J8H1hCLP8`G+10v9b&z; z6!pL$dANPK%Y*1olWGmzlb3c)NMGzgDZJ+6XAK=X2DG6*TXDb-t4UJ>=;rR&HNV#y zC}?Q-BY$F1HX>b-A?E4Nrn2T{D;LoX2MzQ+UC$QfrAQ3KQBT)B#L{QK1obzx;x?iL ze@@+~(WAZm{?S9A-SY@;edf8HG5rJG!xaZej?GVn{tXgL%2{38ui$`k)_X7R*Gfr> z&h3a&#}FT=4AIWDN|am>-B?*u5)v2)N$)lS%%Ui=EfD$hA&);8=vL^s;t+J#Q_B8zZiEk>0Kc-xz zqPwBncB@+*;9PDlf#jbL5PX05dMtDuJm7>w~(qy@8Fq<#>bUlp!kB^>^0+3UX zU-9_7)H7=&6UfG5Anb4UB@=12RM%m2TJ(B+b}?3K%;$?kLqmU;DV5az?EMyr%`Uqy zdXEEOn0^3PSIyyQ7o#&f_ zL3${%fBch;mdmp4oqm3PZgI3UGy@L+2U$c=%v-HcAodS$8jZ)BZovyhDu^E@l|%(~ zE&(XNHaglpK01)ZqS9o?YI5{VHA;?-j)Zn3kt7q}$)pj7FV|WS{_#t^0&0|G8v3GR zEP>*=U!aP(ct}w|kivUxZX%@;c#hXi*o;#l;mh4gz&`{hoG3j3R8d7m#Z9X5c(Oh~ zWl|{Q2R;=U9-u4h>EQ!WqYog=6mjL~eKq%E4b5ZL8qE`C0?n5znA~rS6nLw3I@kan zc<{MGxs2!{tkvZ_ea5TMUIp{NgQQaRIwC-p^BWiti8~5_K-g`V=JPzlA-Qtup$Vml zbT3Cz$xBfv)@rdi!4tMWpe(bH$DCtJ3>{CQ?{WN_KrT0M8A~WEB6Z0zmtW{UU!8Ip z^;c-|v}7U(20d}S9xaJ5FG-=wrNlMn##woKwnB|Q8S=ky>;DdG>#pj7>J>bx1WEOyKsH~7rGC_LJaXVz%5{l|7_kWTlk~#HAonz@ z4w<&-{bt)Er-_!Ar5ZD z@7XD2aB%2EC;IUCwoZO)Yg)a?gPV&k&&PrGEuUAJw>gqMfNl#r0N8M2kLn_jJ#J$9K~o3y(TmZ6oQ^uK^T^=?C;3y}1X$aM==saSpmDTYK$bZiB zk2%cw!_jD4bzsHBpgW^wht_4(7)q_dd~P)`Zkq*z8*!hZi}X$l$tT6DVMbHR{$|HD z8o0RMvq2A;YcjzQEl_z5(_`%@Tm!&;uO%ml(KgqD!d&Q-8VCrKfbK)ibw2uO=0Z3r zg||2|p3&UQmYlUL?4E=CoSb6XGTjRR(3{JiAs3Mrs586EzOQb|)|uRJ=2oG8j_~@6 zF*48Rruq}ur8QT8gmS#z)_}p9fL%HsKoGNAsF0$!nxE{s{y7ZFa>0p)UHs@bO@5wN zRRHsUilx_8i3ma>6wy^VQDj}i1#1KMkPn{eQUZ>`R$jGU+pp+-aN4!%i6^9~mT$)Mg+;?`8NH4?N3e-?)#bV&cIKXlJLku!d@1|Px z08;l~9X4_%N~VL5kx;kwgT1acuJNZ7 zOo=vXQWGiT&mE{H-UdY%@Z-&UC7)ZEc!qd_rK++&dpI#U-AM&|W;o?FH8nH-<{+De zAwuO#D)!8S@3|ziL}heNPWLkaAi6ns=hVQI0L!Mh5$^Reqp{I19%HXy{lKl>vkq8N z$>Qs_pn?OJIH^-1V_XE_aSC%s`BNaHEA+N<+SZF)c+bK~xx_}kwjumnE3 z;`zcS=BuB!{j|87K2BdPf;?Qv2Esr(eqtZ)r8{0A_V%tfsexf zuN^lwOk8N%+U4F<*Ac~$D(F0EFHjE(bk? z0t%cHA|6h-(sGWWRSj1B7qtFTSx$UUseZ8c_jl15Yu%YgoJ;!k!uGj`*#r5NY+#sx>W;QO@*UeV zCC1y-(8&=^cmh-nEiKOq)PyaPtn8yA@+&QM|KbNy5rsFcEX+Uc8d#EKy0d9QDZhE@ zBCnKlJRKRa{N>YR4!lk({OU@J1qFCH%<)u_Khi!}HQ}-ocIvo1Jk;6S$XBD(p>?`4 zogrp0lpL6(WkWS67GtW?e2Uk8ESkXw`NbjD11617=U_6l(nXVB4*1W8Yk)?Q#~M`J zV6SMA^XMHZbLY%>zs7Z0IUPlS>^FUBY)+*mcF7B6XalBD)mLh36h89{{i=FVh=hn3 zHQNPEXmaUYWDIV9K3HsZ=88St?CtH@u_!`}?D6f{@VghA19oTEoa>ONBg+AnqACMR z6G{)R7~OO`c*i4(F?WiB=Vp2HaY9j<)rp|W?c(=#iRK!Z^v8^1%)Zn$Yz1_ZM3&jq zz_~wv(t;GD{-!NKM+I9WSEWCP6@`6kvE}bwwV%A*e=~A5F{a8uO!c+2DGx6OJS*wO z%obSXLguEXA;2ORvp{)8j9=Jt{&u@V)K7eH{(ABx`G$K)sJJmJt)L`iWI|dVoTY-o za&qDmW6LS!rmDrkS59>zaJHTcxAy+k(Mu3*z80f6ZTlqO^5gaO&C?&zBcX+jZP6pm zQ(UVGpLvtc3%-k~hH$V|;_;Ms30JLVvx zAzbue2BxULLc+x){@s`8yn*p==mP7uIEG{xpYMWM zLTx((h7)gRES)^zKC#>EOe`mVwAvvIZpif3eea+}BQOlEXa08l$(0;7a-477;{SYO zp7-X>qOH60jY{;Lx9hP)0I|Dxuw?v92z~(z79nO}!IE7fV_;Ry4Nc4As20N%zotIE zw@3K$Y!=dA23-^r69egzpaU^X{kSzaw!yAY<^>hycqx!R+F&#WdQ5MMC+cR0(JW*B zytzklB^QOoI?&**2U;D8Xd}ghkuqM(U_zC+@9!U24^*B)6y|&+D(1`;(M!0EUl*y| zAq5wl_S^hvhcAXcSCfS|98NqbDO4*lqH#FmcW}gj%2_WczR^fqI}x}0-N2YaP{L)Xcd?cwuyvbNCRZ{m2HT=W5gsC>r;0Yi}wW?+e-Y8%$rd%lULJmo@Sq65WapI7>giKyMT;In~(4a=sL=6BjmEW zkVRQlqSez1CGP~FJUuZ_tr(e`_42U2@g>OSXQ%n^p+#dS#wu%h0Sk&d2U04;(`>sy?|AXwe|JLS#$d-3F!xAqOqD{qjKe3K}+&QL; zWCjk_S@6PkUj0@m_mvb&^UC@4_uUdrw%XDpy1boa;FL9Q*D!aP^`ceN(f#2K4CP6H z>_Cy?`+Ckk%PP1iIhP739fJUUyT~?oc;e{0vUc#HeS=ca+>chAE|usK%QX8h;?73U zsg6->c{Q8nD}a(gpoj!D2taV zrp)!O)~5SXA7gXl2;yhr;3RQZ9Wvo=;^rF7m1ehvH^0_v1>w%NF`?OX1yfHG0gFDg zbF*RE-g;c#zdpRrC2x754ZWdD39)X&Mb#4u7N$W0W9)mhhl+QA30SyUrR#{iGi zV5Kw%sxDRYjhNvgh8Z$OGB7LP90FDPN0$f=$K%!3Hv3>9E9#Ssss4htY&H+24?5s< zTjz;qi2nBiMIGV=HOa+4l|tSw3mw4eO()P&A)c^1-=#|U`R{F8#}3I&~!auOqrXmLq^(7S|0+f=C5L{KFciS8o- zR}>!}8rjR-BmWd4(p%EXO69(qXU&U%ln|h=Poo@b>2~ufv_VKx2>kp3DjR8(C$Gny zS@o36H6gTRBqR_%*7Wv-`+>q?vni|E19~4LeqcN#BqZW{ ze9z}cM=iebBMu-vJ$(&~FE0ayGSCesHN`+1qKVJq0}RstO(^`|373D%jQ^o2{{Pzb z|5K6tA3yznikI~Sk)z0O7#P9&7{Qk1u>B0M{bRs60IDV@pn5XEQj7o7qkjO1YW)nA zIDqPj5u5}lZGh(HV1zNL4w{#;) zgMd=fD52C)dyU`uu5a(N_daKD|3j{s>t$xWYdz2X{O+PkOYreenDkzQw_o6A#e_Y($aE3d*e?JC#P%VgTZWO z%ae4qE&D=IB+Qc8;=v&F)!uXoJ3ITxwEyH)i{o-Qa3>Z3O*KQ*UvOh%W3tW7+VA#k zVK3J}M~A?~{|pakq12~vWRY2~{*k`EJ|&w*sgn3;GL7rSFC$m<60rBL0W;QOlRd%V z&!1OYrr?A5G#p)1!vfYP7`9U4f+=kT93lMlP5?(b24Cw}8KA>~EX{1(se2=0F@kBP z)&+P#T`zZZ@v#`(L`EDsl>wkRtncqL-gWt3H$!ZIZ+>FhKlX))KK*;339bJaO^J+; z9|HUmrwAX7dcAuf7%p$TdoJky5(ul(#v_6>RT=Q}j@7XB0SO5Sm^(c_SokmuaL|8V z;TX`1!$K(RfyAs$nKUOmKhv@rkZrfxsF1+SQ{M%4Z?cm&y1InV$V6koySV}rGoQ4hxAAm?)s^L|Z+-z_R@y-fAfNCw5B(;)5<%Ie&hop7Tv{US zc=X>%GwmMsNt#5Weyy)FnOO=!kVN60dN>RxDk$i|6jUK2D=T_iUOl6++mHD+d5ezA zWv$0ybr?**XFevxel}`*ZMh{_@9;Jx1e6;B=fA#H-CV=7K(@f~f1=n6Uv0E+AQ~1x zR!W^;0HncH!T)b{g0%{+?4N5D{KUgJ%tm)K_^r(O3Z*hwA=gt^xSB%jNw`@?$a_+G zj`|E+ERdq;YV1l*m96?Eq-RWO>IY%>CH8On{pr+oA7kkSWf=T>>L9eMx0v~0WatPcP)cSMGy$UJt4Ja&X zlkc|Heb{5gpY#D8G7|$H7QW8tMm!})MQT}7YNi~gj`6_Sr#v0ZV_tOU?~i)Ridkel zD$r%^aRN-?I}L+ewZQ3vm=?p}%uFo97q$$Gb zF3K#OH=7Xy@KvY$qrl`5?2G6l;;4-+V_Yr9_TQ4DRJf={t@rjGWS!4LXgWM4`2-&R zj_@19r-ARD+z8B0xOozvB%;!hC+Q{PeLo6~lA9K~QQ=e^c* zt!=4hTNxMlecu#YJuk_iH5W*%M<#LelG|Mu857;lUTW%M+BN@*0sX$kfiCSE5J>Q9 z`%@-m#m28+@nB~t0%0NaT9umdU%IdRxISI)VB2Y)FdJg93J^^yWD;B*p0}Z|F6?v> zxVld$0iPm)yZfJ7V0eetTq6lr^4_hb6-SgYY5(j%gWMCaH`PbPzkgvkt{I_+C2P3&5j!gChD=(p7XxA7kvmf^u@g4*&{_6d!>QW*GyxcXR#-Sws-T? zH$LorE z&Nn7DmtE-h-jWRS7X7RZi;Ro!sU%y@*Io{;t#uoMs}{aPD!U|E^r_~9Lq;dSE;1k$ z+SfBcdaWHBkt)dnX7)IrjZ>!_H(=1{$W@Kd$DNo*?WHf@zDfJpskR2)1T`y1z|G|w zM)w?{H!@#xMb@{qk88~Cw(&8yyqvB%ab4--xBbhax-VGC(1Ho=QO>=&+8eL=`C_W>Kqmgql<5c8wzaid8)J#5C$7$WdG6?s=5cCDVi(30x zB|F_dSpLlk)1I5>7%=t~QPIE>WBiuX^hl8HJu|_obs4 z<1?c>Fk-)3Z9-7_#ek2(AiltP&%?Le?iKA}Tla>E1($05hq1AGnvSO3dAjT6hl)$T zH6=eD{|FfoG-M{KPCp{u{8ckO22Ws&*Qp`BnP4GYHH_1U*R=0?v;I=yC$%8W zrVS{9{Jke)?za>>&LjvS;pSYweXZ-s$hpV!Z{tx1&9|$RYHsa5HqS{FE^D=!$ldJ? zQM+&480Ow}VmxK2E6l}n{dxTOPgc7YcM>bbAnj&3e zBj+zBWfcYN7Y^sFByW%N`9Qph%=l3N-tv1=!-$z|f}Vk~XUjYHs@1>We>JRU^tBym zc;ZJAj?WWA(0XCF(&|cyXLXrv@Dlo}j*}-WlQnA%JvNj9NkS^@+@tS-t4s}4*chs#xFh-yP0UB zY0rl?HBJV8SKH!c*>m=%(io5mi?V|F3w>979;l|b#iF|mELbFeGYRc zi}Y~gn?gHs@TroIO-;^X1CgIWj24J9J1yy>*dke8MH2EP=vltFgE2zI2l&cGxDlEL zPT!sN3s^8(C?78d{J|eOt5#cs5sT6O{j;e0e>~2^=H-VO_!=Ic^-o?6uWg$n8yKJk zuwO++#EJ4g?~0?%VSII8-F)*BzBd&yXr9y$gFFr_kmQl4lha?~>%6vRgNBCoDu92# zImmXSyGHaprz;^@1^=>BU*2!I6IbkSfoQ{sD)RhhrL0t!R=Vx>kK|3$(KF_WI8!^P z$6>*uV#TEN{TuV)UgwMtWZ6U{6TT=E$s)e-`v$$ng;x_A zVzsoEK@m1m=C^wfmn+JgyZSN>KDbU@Jawp!H8mMPk6KD@-QC3#9JIA8M5Z31Vx%Od zFq>*Up?}G($OqCn#&SIm3BX1Rir-L98@;Mf;Lfv8f$lU#JZ$w5dysG|aq`0>!^W<$ zDY;q&5eXMngxb~?h*Si1QTmj2(g6bWoZLD}2o8)458%ZlwkO z8zCq)3L!AgX$(VRhULHQ1O9VY@UOb-f6+?(`xjj$US3@l0OpZiufF)T(eLdEu$Ov) z3exJ@@85M3Z<-xfTCupSJ_Uh!9VI0tq*9ZC*`OI6A0J=0!Rl$d``)RV@bBVcYA;{k zO@LxfPEY$B-GPQc8jSL%8mzxKIF74wZ;8SeY!R=Vz!eNu3iI;y@i7O#hbKINb^>m` zs;dDeG59!J&|^RJLl+D+;f08VpPw+O;Uj1i(=5E61_lQH`Ss1faQJWk;`FT@J|9|a zan8GJRml^5?&|6ahJsvOcQAX9O(;(P?Z*!bTsC7;U|bJ-|K6#6fzHzH#|V}Z;CAV6 zK%W!+ivC-xE8GUw4;TVdXJ@warx+L!QBm@h*YZa`9{aPs&fT}+U``wDPt5BOY1SXU z4xjUogC{uBi!oeE^!I@Ey=4O551b zOGrozbb(Z(K42c>aNAb;ulk+=*Z;dqx}4NdID!>7?iQ(d>o(dX@t5k>nYX&EBRDuX zz}b+TTJdT+Bq}c3>0#vqznrp;0#1L%wf5e7lwh$?FF5dFEJrY<(n7BI*5 ze=fI}ljtGte9pm1+hps$p`3rt@A8sfO`WtDeWXwkqh5HAN?H4NvF0 z=9Ws4IO0tAS2ih~lt4|8P*RJPd=0w=;t^`uI_`lBkUsj>dBT(^cfL1bglSVoY~Xso z{VS?DU2{{fX;^tNX7b2(QkhEN>osQmmMT>Yr{vY=k? ziK-U0Rwd_wQBq zEq_AUwLowurG>`W2WWDN`e&-7#0>fx#N?7d^G)nT`kIBAnXrl|QD!A{Fr17m9@H)C`DA5nm`aqz)q1Ewf^fiaxj<09W?+xux2q9DT# zh3151MitLC-V4bYkPYEOMGv{o(qB~EH_#gD5{v*g=0e%a96BrAiL2w z5CugSgxXsL@@8Yym;a$vy{yh6=_=PU)Ghj}jLkk^5Uxk9*h|Thww*-R^M|{XCQ5L> z-GVL8++?4M8c9yMxRH!ON?%qv26s38ylfU^z!`pH)~C=oc#Qt;LN zxY>cDQ=||@)8k`91D8xZX%zgJ0C$@Cq!JKOrkWiMII^J7;%Zz+2L}k)wxwibHu3`R zu$F&)>nKa}MURW^Phk4IF`c7RTgNNOVQr8hH`cCCgT~t9K(EZCh?5lA!*6;zwCr_G z`M~*Y--*%k>F!ET3>hw1A~%=h<3}I?4>OH~L2Mtb)9Zw?5o;-}GA-uKJnq@o~!GKG!_)74MSYqO6aM(s$X=Kr!0BxL#pPw+B&l#Ue zLLO_{Gz*A?(Mg5eYuh0G_{tp5YUtR~+GWQUlM(8{q-l8yCQ*h$HyC5{*9hqsA7lezO90uL(pr53jXh|>6Y&Gn3OL2>XJ0o1(SiDH5!aEJ>sSgj3VqV|l9-Zks)J9@%5|E}W z7nvXl+=yx*cg(ySF;Hm$jIP!-x@%;F(X4flKP~$qzI~kjq znYqgb#Uq?hvy(}jUN{6>5Yo7;8u|FV^9&;;rKN z{CVRppAmD)sZjel0ryWXtacyNq?;G3eWH89%Ecb%P9;3sden+nuba5~2Ri})0nLR* z3~nT5FF$%3ddZ14?#fis$QjNvJrLTgr`yP_lZ@-BudnIWTkojDvoGMI?HDqSJWqan z<~T$K?V-Cz zqv)mo2x0)Q;}Z3@*tBL6C=8>D6|4|_N8A)IXiI9Z`_Q1w1pk$OUlag{8p6_3lfsoR0JD>m0>Pos1Ck5kGDBYOCMjSF;64@M(%fB} zdP{KGr9tDQZkf@k9*gRsDxlZaZ>C_q2Ph>QNf zj#qcOY%al2;MX&qhm8Z4SpMgMCQfR2@uYAix5AaAA{uC@+1!sZQc@qX8hS?_3295< zvH5b8D|+I7!F5w4-a}-uj*5gylY?Jy+S|`sQ`` zBJF4ELjtfNXJ)^q*rG_IMb+JcYmI&xSO*A>1F-NF5Ja``W``@8VLl7`inqw31s&z%i(I`KzSXvR>@&Im+CsUfWfJk`Xe0TDJ}PzeAkHjA{@6bma?_Ay*)Z;LC-dt#**K9 z{HcS`FD5-3SZzZS=I33Oni`0tLe`TeCrIHnRN$T(d)WU2`I;l4@yBP$W5W-{0GwOL zt0%zejno!IHJ+H&R4#BJ$!+Uz6ZRGE?WlyL9K!XGvrCrTE|mT`GZ;Rrl{c$>}W+H5iEYu2K{BBR=itD zTu*#`eWCPf2p31I1P8gI{?VWdF9M|tAc-R&<+gYms!U%t7q{qKJnFDirmD36&>tT$ zGALQo*(a6PotMq=9dDF$Yt~H-#&$Ic4AC;l%H&L9`YI^dmCL7~L#nzDgsU2TBI1|8CMH4%C1k!sw;R9k ze^{*lq4-b`-5aw8i8XwUFw<4@`}?h};M249X~WsZi5W0C0S22&7WELu>%hDq>z2|+kc@zSZC+w#^)r$Qc>(o`&gNs2 z1`4p;p|Bm9^a4qK@I=))NBM&I&&Sc-%Xj9sw((r)M^W2%7f%m z_=F(AtUj`?>zRakvYVgZ+Hc>!7M22M8%k(iEIdw74}UpU$;_Y{s>{n=hxvKUpsaah?rh@qmFJatskuwP_1+oI1WE^Mcy zu|Sr+c)ih%s}*b{I0ZQk&2sK`NT!vGPA5|53Dd%2I#b57O|ZDMt)Yq(|UcMofyOFV}wB zh0TfaN-xO!LfSPsIHI|PY;0{&s@Q26(F-23g|7H6*ikf34QrKtVe3d82RV%p*1v|g z#_|9$&JG!wVQYft73PVgM32KNQ0^8QWP<5C627rdd2L;CNGXgk&K4IELo%RSK$8mX z;D3#JyqO^O+8s$|)1{ef@WlK1@$wMUqUSz^g14acS1odX((H@uw6crz^ab(~o6_eA zzgvvgTEz44%adlvI?M`B#*#)2_3psKJ}RIzSDG}I0$#_a+G*a8lr1oxC4{xr83*T; zW#pkd>4+C=@EMyO9+jCH4WOT&&xcJfC&iS!_-yDOVt#H#xKbmi)Lm`3cG?q;!Za*V z!mQvC~3|-tpe%N|)$>Jo6D)rI^J*2M?6N@NfH-jI@X{c!7xbKn*x-PT(Y;6_E z5OM;=7Ju~U8z_=2EipW+u2^MuT+OWHI-s`YU=WaR)xdd%SnSv+LcxGl$8i!Fr}|RK zof$OX#g0+z+?qWrQe@gz;q>b^6f|5=Hru!AtVn_N{8#rM{jTa=yyd8vw^)Nf9G9z& zr%>Gu;LojUI-aZ&^wRHHVSsc4;>2o6SvREIkLW#LN!X@7R`3CEF|4~7T3ZA~ zHfj{`u*ykWd$hLEK+hnOdivUgzcoHKHYuQ}cvW}3ZFpu7HTC1+R7F>Zj6gdr-6a4C z0vNBJAT%F1ZAwDgmB@8dk)3{Oyf6jzxHClK9-Xhid2Th)z=%6ie6x4so!W^|KUKV zZYJUB^7P;h732~&YMh%K|CT zbh-kUl0zPy2=bptS2O;H1mRqKChH)Sdc`0AQFp%F`o5m22Q?^v_GQMifN*4 zCsb%Avi0XF$uv!A@0ghbsp%vL@1|Gv^+)BB&u3<)!g-T1Sr|6+CvB$Mj~U4khQfW0 zlNqT7Nk6GA)yQ=T`B;P6rJ7koFVv0KsQ>c}Mj{ArCa@-1#N~*1Ux(tS(D2)e2zIQo z6_otxTM)m}_aA88L8hGn&mT#KJ%cr|Mx^n??2L*)Vr5bDZ!b??foK6_03Zo1vC!Nu~d5oG%~<0f>Lvdg|O>(F+8an2G8|I`jjbukEfc~CBEEFGi6fG*kJw~c={jp_V#A*IueIJd(MardLKUw z6=`&}!g8AUyskl2wscLGg~LdsV&;lA4?w|;c>r16=6k1iS}JuI>%QpO0|`p=HH~({ zO8mODkT0^#6UwH0uR^ZHBNTJohmKCh8lr+9P-;+ z#+8_8qQ9h7z@&_(D+=Da?maiLd}`E#htYJNRt9b zVkuGK8N)^PR)yn>-T6gD5y}m)B8P8mYidn(G8U4m1;}vv-xv1KA!G99ZLGWHZ2$Cn z+$Dug^43UsI^cQwR#r&!{LeEX(X(F`z*oV+9uD1(e=dY-(PdTr@yW$T);hB1JsA$9 zeuIwwmj*Jh9AO=dMAaX)ef0W$$xEsL11ydFGdHOz5{nYuI#->}&Okg4tO9mm7zfm; z*%ky{E9(rmi@rlyX|Lt!xi6#Nn=z+)?$PLKwO+i2d6T|bXS)VWPEZ+4^aE`TJ)~g$ zm=m|f5$=#Q614n9;QgY)q`Rw@5o9?Sk)Ptdz(QoQpCAl3`R5q=#-yh#KxjZJ9F!zR zt+l>*?Kgi2J|F2PnPpH5d{WZ~PryMNl;dwpCpbZ{G+y}_+aIVrxPxfDQMH$)*T!IO z6?xDl&Kv}qc{MI?@BkM=bl1ycvvnuM_*EI4YJ+BnD3Al255$;OfY&~;mPUOIpe6Hr zJSOc(6Xjy>32bxD?x^frK#jivRcyF4CMHk3yEyEvNm-$~k0Zyh4!6;u?G zRgywKjt`Lw@5W_Ben0In8EgjC$@-sdB=)-c{`0GQoP$n#-t_7*V`44QyN3lfYW;CY ziQu-dW925Kbc8yq$ATC*EVpM-AfpcDh@Cqtk@W&D;-4o4)eg4n`!!g_Wa;G;JNCYgz z>OZlS`T>)Cb25A&16L{-m&2E2mVB$;W^=kLH~o!%_5yq9f9={W;UI-V`^^x$iVmDO`kZ&e(&fQ zCPlD#tIz$@CHIPGiW)B`PPh*Fq@Zi4F@Oz4J$Cj`Av%d!4wen$s>q9DmQye1=1hZ9 z^Nc1hv#YnhW)}6(7#x4GT-t~|zCiZabnl!51i#{b{tRLiEM+$Z2FIi@N|&Pez1Fdq zm7h*FI9WnjevSTB={WbqHKaAcAgmXpL_!fgM=H1{Y8qQw2(;>Y2elE%)#1&}MXf>_c#1L^V{%m}_7YBle6Gb%Nv&Rk!B;=Bfm(;%fy5#j92NbNjl%? zzQ@I|?cy=d7=NJ}o=!a12>9wVJA5wC0JH21F|4;hf!meASdHq`i5 z0HbwK(z5gM2Gv2$ae}BFjYeU!S8Mn-uhlux&(uRzNKoVylm-rho~#67p}#^j@@m&D zaB#K9vRN1}dBXJaA3DFKd~iI&D1?0(Sl~BKx5oP@dco&CX!8|B&7df1d`~Y;Pu!r! z5Vg=#m%0Qa-)-*{X7RDNFm?t@B=yn{-(@1pk1Ucze`63}?bzx$B*aTP7#8XhFqO21 zQtxH(S5PKKUJg*#VMr%|$w<=s9L|k-&1uilA%<~SG6HYXJPEx!WZ=^S&$J=Rw8Ew^ z3R0S|iLv;<$0BL{c%ExhO4Zft^#X2f5D5hz)4bec* z%k&|3b@%>D-P%z*%29D~aTTCfM5W=Db$55$6qf8!&NjjakLybGn~iG z6qe>Of8zah~eca++9qsOF%%dE|&Iptn_<|g0DtBg)uI?L?DGbD57YL3v3lh zW{I3VbT!Vp|9 + + + Climate Prediction Center - how to make small fast grib2 databases + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2:how-to-make-fast-small-grib2-files +
     
    + +

    How to make small fast grib2 databases

    +
    + + +

    Introduction

    + +

    +The old joke is that an engineer tells his client that he +can design a gizmo that is fast, cheap and reliable, and +the client gets to choose two. The same principle applies +to many projects including making a grib-2 database. Here, +the desired qualities are small file size, speed for the users +and effort required to set up the database. For small databases, +you probably want to minimize the set-up effort. For larger +databases, all three factors come into play. Here are some +hints for minimizing size/speed-of-use. They all require some +set-up effort. + +

    Making a smaller database

    + +
      +
    1. +Have unneeded fields?
      +Use wgrib2 to remove records
      +
    2. Smaller grids take less space
      +Use wgrib2 or some other program to make regional subsets
      +
    3. Data stored at higher than needed precision?
      +Use wgrib2 to reduce the precision
      +
    4. Better compression available?
      +Use wgrib2 or cnvgrib
      +
    5. use submessages
      +Use wgrib2 +
    + +

    Faster to read

    + +
      +
    1. Jpeg2000 compression is makes small files but very slow to read.
      +I am finding that complex packing with spatial differencing is a
      +good trade off between speed and size. If the field has undefined values
      +then complex packing is smaller than Jpeg2000 and faster to read.
      +
    2. Decode routines that have been parallelized are faster. Wgrib2 has
      +parallel packing and complex packing without bitmaps routines.
      +
    3. Smaller grids are faster
      +
    4. Reorder the records to maximize sequential access
      +Use sort and wgrib2. This is important for optical media.
      +
    5. Use an index/inventory.
      +
    6. Too many submessages can use up available memory. +
    + + +

    Minimizing Effort in Setting up the Database

    + +
      +
    1. Save grib data as provided
      +
    2. Writing grib encoding software?
      + IEEE Grib-2 is the easiest format to write. It's produces + big files and is not compatible with some grib-2 decoders. +
      + You can use wgrib2 to convert from ieee grib2 to a more common packing. +
    + +

    Effects of Compression on Sample Files

    +
    +
    +45x91 grid, 5 fields
    +
    +         simple complex1 complex2 complex3    jpeg
    +size      21884    16030    13623    13917   11514  bytes
    +read      0.001    0.001    0.001    0.001   0.012  seconds user time
    +write     0.002    0.006    0.006    0.006   0.017  seconds user time
    +
    +note: write time includes a "simple" read operation
    +note: the creating of the complex packing is heuristic
    +and different algorithms will produce different results.
    +
    +4320x2160 high resolution SST field
    +
    +         simple complex1 complex2 complex3    jpeg
    +size      11054    4076      2365     2280    3252  K bytes
    +read       0.38    0.41      0.42     0.42    2.66  seconds user time
    +write      0.78    2.06      1.76     1.68    4.20  seconds user time
    +
    +note: write time includes a "simple" read operation
    +note: the creating of the complex packing is heuristic
    +and different algorithms will produce different results.
    +
    +The commands to change the packing:
    +
    +wgrib2 in.grb -set_grib_type X -grib_out out.grb
    +X=simple, complex1, complex2, complex3, jpeg
    +
    +
    + + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Aug 7, 2009 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/small_grib.html b/docs/web_docs/small_grib.html new file mode 100644 index 0000000..b5456b2 --- /dev/null +++ b/docs/web_docs/small_grib.html @@ -0,0 +1,242 @@ + + + + Climate Prediction Center - wgrib2: -small_grib + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-small_grib +
     
    + +

    wgrib2: -small_grib

    +
    + + +

    Introduction

    + +

    +The -small_grib option writes the grid values +to a grib2 file with the same grid spacing but a smaller domain. +The grid point locations are unchanged. This option is used +to make a regional subset and only works for certain grids +such as the lat-lon, rotated lat-lon, Mercator, Lambert conformal, and polar stereographic. + + +

    +When -small_grib option has problems, the grid is not subsetted +and the original grid is written. Some reasons for problems are +

      +
    1. Unsupported grid type +
    2. Thinned grid +
    3. The bounding box is outside of the grid domain +
    4. The bounding box is too small and does not include a grid point +
    5. The bounding box definition is not right (ex. LatN < LatS) +
    + +

    +The -ijsmall_grib option is similar to the +-small_grib option except it uses the grid coordinates. The former is +faster as it doesn't have to compute the latitudes and longitudes of the grid points and find +a bounding box. + +

    +There are other ways of making a grib file which only includes the data for a +subregion. You can set the points outside of your region of interest to UNDEFINED +using the -undefine or -ijundefine options. +Once the grid points are set to UNDEFINED, many of the packing methods will reduce the +size of the new grib file. (Complex packing without bitmaps is very good.) One can also interpolate +the field to a new grid using the -new_grid option. + +

    Limitations

    +
      +
    1. rotated lat-lon grids: must use WMO grid template and not the NCEP locally defined template +
    2. rotated lat-lon grids: lat and lon values must be in the rotated coordinates +
    3. staggered grids are not supported +
    +

    Usage

    +

    + +

    +-small_grib LonW:LonE LatS:LatN file_name
    +
    + +For west longitudes and south latitudes, you can use negative values. +The file_name is the output file. LonE must have a numerical +value greater than LonW. For example for left boundary=20W and +the right boundary=60E, you can use LonE=340 and LonW=420. +You can also use LonE=-20 and LonW=60. + +

    Example

    +

    + +

    +$ wgrib2 fcst.grb2 -small_grib 10:20 -20:20 small.grb
    +1:0:d=2007032600:HGT:1000 mb:anl:
    +
    +$ wgrib2 small.grb -grid
    +1:0:grid_template=0:
    +        lat-lon grid:(21 x 81) units 1e-06 input WE:SN output WE:SN res 48
    +        lat -20.000000 to 20.000000 by 0.500000
    +        lon 10.000000 to 20.000000 by 0.500000 #points=1701
    +
    + +The first line writes a small grib file from 10E-20E and 20S-20N. Often +you want to preserve the grib compression. In this case, you would +add the option -set_grib_type same to the wgrib2 +command line. + + +

    +See also: +-ijsmall_grib +-ijundefine, +-new_grid +-set_grib_type +-undefine, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page modified: July 11, 2017, Aug 18, 2018, Feb 2024 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/spatial_proc.html b/docs/web_docs/spatial_proc.html new file mode 100644 index 0000000..8ca4b23 --- /dev/null +++ b/docs/web_docs/spatial_proc.html @@ -0,0 +1,200 @@ + + + + Climate Prediction Center - wgrib2: -spatial_proc + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-spatial_proc +
     
    + +

    wgrib2: -spatial_proc

    +
    + + +

    Introduction

    + +

    +Product Definition Template 4.15 is used to describe spatial processing +of a forecast or analysis. For example, you interpolate a model +grid to an output grid. For some fields you may use nearest neighbor +interpolation and for other fields you may use bilinear interpolation. +The North American Regional Reanalysis used both types of interpolation +for surface and near surface fields. Another use of PDT 15 is in +aviation. You might want the maximum clear air turbulence when +the interpolate from a fine grid to a coarse grid. + + + +

    +The option, -spatial_proc, prints the +spatial properties that are encoded in PDT 4.15. This output is +part of the of the standard inventory, -s. +

    + +

    Usage

    + +

    +

    +-spatial_proc
    +
    + +

    Example

    +
    +$ wgrib2 file1 -spatial_proc
    +1:0:d=2015101200:CAT:200 mb:12 hour fcst:spatial max:missing interpolation
    +
    +$ wgrib2 file2 -spatial_proc
    +1:0:d=2015101200:PRMSL:mean sea level:anl:spatial none:bilinear interpolation
    +
    + + +See also: + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 18, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/special_file_names.html b/docs/web_docs/special_file_names.html new file mode 100644 index 0000000..7791c08 --- /dev/null +++ b/docs/web_docs/special_file_names.html @@ -0,0 +1,305 @@ + + + + Climate Prediction Center - wgrib2: special files + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 special files +
     
    + +

    wgrib2: special files

    +
    + + +

    Introduction: Special Files

    + +

    Wgrib2 has some special files. They are + +

      +
    1. - (negative sign) +
    2. @tmp:STRING where STRING is a alphanumeric string +
    3. @mem:N N=0..19 +
    4. Unix/Linux: /dev/null +
    + +

    1. - (negative sign)

    + +This special file name is often used by unix/linux utilities to denote either +stdin or stdout. The context will determine whether stdin or stdout is used. +This special file name is often used to pipe data between processes. + +
    +Example:  wgrib2 IN.grb -set_grid_winds earth -set_grid ncep grid 3  - | \
    +            wgrib2 - -ncep_uv OUT.grb
    +
    +          The first wgrib2 regrids the file to ncep grid #3 and uses -
    +            to send the output to stdout.
    +          The second wgrib2 combines U and V into the same grib message.
    +            In this case, the - indicates that the input file is stdin.
    +          This form is fast because both processes run in parallel and
    +          there is no temporary disk file.
    + 
    + +

    2. @tmp:STRING (temporary files)

    + +This special file name is used for creating temporary files which will disappear +after the process is finished. Multiple wgrib2 processes can use the same +@tmp:STRING file without conflict. These files are only useful with callable wgrib2. + +
    +Example:
    +!  make a temporary inventory file
    +  i = wgrib2('ds.td.bin', '-inv', '@tmp:abc.inv')
    +! inquire how many grid point the "150 hour fcst" has
    +  i = grb2_inq('ds.td.bin', '@tmp:abc.inv', ':150 hour fcst:',npts=j)
    +  write(*,*) 'error code=',i,' number of grid points=',j
    +
    + +

    3. @mem:N (memory files) (alpha)

    + +

    @mem:N where N=0..9 are memory files which are stored in +computer's random-access memory. Memory files are fast but +are limited by the size of the computer's memory. +Memory files can be used +almost everywhere that files can be used (see below for exceptions). +Memory files are transient; whenever the wgrib2 ends, the memory files +are lost. Memory files can be read/written to disk files prior/after +processing by using the options -mem_init and -mem_final. +For callable wgrib2, the memory files are lost when the calling program finishes. + + +

    Memory files were implimented so that callable wgrib2 could be +used for HPC. For example, decoding can be done by calling a routine puts a +grib message into a memory file. The wgrib2 subroutine can then +process the memory file and writes the decoded field to either a +memory file or a RPN register. +Finally the program can call another routine +that reads the memory file or RPN register. + +

    Memory files are often used by CW2 to store grib inventories. +They are also used internally by grep Fortran API (memory file 19). + +

    +Memory files can be used to speed up processing. Suppose you +are going to re-order a grib file. Without memory files, you +would create an inventory (sequential read), sort the inventory, +and do a random-access read and a sequential write. With memory +files, you could copy the grib file into memory and then +avoid the slow random-access read. + +

    +wgrib2 IN.grb | sort -t: -k3.3 -k4,4 -k5,5 | \
    +   wgrib2 -i IN.grb -grib sorted.grb
    +
    +wgrib2 IN.grb | sort -t: -k3.3 -k4,4 -k5,5 | \
    +   wgrib2 -i -mem_init 0 IN.grb @mem:0 -grib sorted.grb
    +
    + + +

    4. /dev/null

    + +Don't ask your Linux system admin to recover data sent to /dev/null. + +

    Options that don't support memory files

    + +
      +
    1. -AAIG +
    2. -csv +
    3. -err_bin +
    4. -err_bin +
    5. -grib_ieee +
    6. -grid_out +
    7. -ijbox +
    8. -import_text +
    9. -spread +
    10. -text +
    + +

    Generic Behavior:

    + +

    When a file is opened by wgrib2, both the file handle and file name +are saved. This allows wgrib2 supports multiple opens to the same file. For example, + +

    +  wgrib2 IN.grb -if ":HGT:" -grib OUT.grb \
    +                -if ":TMP:" -grib OUT.grb \
    +                -if ":UGRD:" -grib OUT.grb \
    +                -if ":VGRD:" -grib OUT.grb
    +
    + +writes the HGT, TMP, UGRD and VGRD to OUT.grb as you would expect. Technically +the 4 -grib options use the same file handle. Now if you change the above command +so that the last -grib writes to ./OUT.grb instead of OUT.grb. + +
    +  wgrib2 IN.grb -if ":HGT:" -grib OUT.grb \
    +                -if ":TMP:" -grib OUT.grb \
    +                -if ":UGRD:" -grib OUT.grb \
    +                -if ":VGRD:" -grib ./OUT.grb
    +
    +You and I know that all 4 -grib options refer to the same file. However, wgrib2 +only does a string check and uses two file handles to refer to the same file. +Confusion occurs and the resultant OUT.grb will be corrupted. Therefore, +you must use consistent naming when referring to the same file. + +

    Persistance:

    + +By default, wgrib2 saves the file name and file handle for opened files. +This can be handy with callable wgrib2. You can save the time required +for multiple opens of the same file. However, this persistence of the +file name and file handle can require some care. Operating systems +can have a limit on the number of open files, so you may have to close files that +are no longer needed. For some operations, you may want to +rewind a file. + + +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Aug 2, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/speed.html b/docs/web_docs/speed.html new file mode 100644 index 0000000..0f65bd7 --- /dev/null +++ b/docs/web_docs/speed.html @@ -0,0 +1,306 @@ + + + + Climate Prediction Center - wgrib2: SPEED + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: SPEED +
     
    + +

    wgrib2: SPEED

    +
    + +

    Introduction

    + +

    +Here are some techniques to make wgrib2 faster. + + +

    Stop using JPEG2000 and PNG compression

    + +

    +Complex packing (c1, c2 and c3) are much faster. For fields with undefined +grid points, complex packing produces smaller files. For global fields, the +optimum complex packing is typically 20% larger than jpeg2000 compression. +Converting is easy, + +

    +    wgrib2 IN.grb -set_grib_type c2 -grib_out OUT.grb
    +      on a 4 core CPU, this is very fast
    +    wgrib2ms 4 IN.grb -set_grib_type c2 -grib_out OUT.grb
    +
    + + +

    When you make complex packed files, do not uses a bitmap to store +undefined values, use the special-value method. If you use special +value method, the resulting files will be smaller and the decoder +is very parallelized. Using bitmaps with complex packed files +will result in larger files that are slightly slower to decode. +Wgrib2 can make both flavors of complex-packed files. The comments +about parallelization apply to the wgrib2-internal decoders. + +

    The best complex packing (c1, c2, c3) depends on the field. +C3 is best for smooth fields and c1 is best for more noisy fields +like precipitation. Once in a while, c2 produces the smallest fields. +Multitasking scripts that convert the grib file int c1, c2 and c3 packing +and then choses the smallest grib message. + +

    +AEC compression is much faster than jpeg2000 and png compression. Before +you use AEC, make sure that any of your essential grib software supports +this brand new compression (9/2016). Converting is easy, +

    +    wgrib2 IN.grb -set_grib_type aec -grib_out OUT.grb
    +
    + + +

    Minimize the decoding

    +

    +Decoding the grid point values is an expensive operation especially for jpeb2000 compressed files. +It is useful to count the number of decodes, + +

    +Decodes all records:   wgrib2 IN.grb -if "HGT:200 mb:" -csv csv.txt
    +Decodes one record:    wgrib2 IN.grb -match "HGT:200 mb:" -csv csv.txt
    +
    +Decodes 3M records:    wgrib2 IN.grb -lon 0 10 >lon1.txt
    +                       wgrib2 IN.grb -lon 0 20 >lon2.txt
    +                       wgrib2 IN.grb -lon 0 30 >lon2.txt
    +Decodes  M records:    wgrib2 IN.grb -lon 0 10 -lon 0 20 -lon 0 20  >lons.txt
    +
    +note: the number of locations is limited by the number of command line 
    +arguments (5000 v1.9.8).  Other limitations include the number of
    +allowed regular expressions (1000 v1.9.8) and any system limitations
    +on the length of the command line.  (Cygwin 32K, XP=8K linux=varies 
    +but 2.5MB on RHEL 6)
    +
    + +

    Don't use the wgrib2 | egrep | wgrib2 -i syntax

    +

    +The "wgrib2 | egrep | wgrib2" syntax can be optimized. + +

    +M sequential reads + N random-access reads, N writes
    +     wgrib2 file | grep ":TMP:" | wgrib2 -i file -grib tmp.grb
    +
    +M sequential reads, N writes  
    +     wgrib2 file -match ":TMP:" -grib tmp.grb
    +
    + +

    Making an inventory/index file

    + +If you process the same grib files many times, an inventory/index file is faster. +
    +3M reads, N writes
    +     wgrib2 file -match ":TMP:" -grib tmp.grb
    +     wgrib2 file -match ":HGT:" -grib hgt.grb
    +     wgrib2 file -match ":(UGRD|VGRD):" -grib winds.grb
    +
    +M+N reads, N writes + i/o for file.inv
    +     wgrib2 file >file.inv
    +     grep <file.inv ":TMP:" | wgrib2 -i file -grib tmp.grb
    +     grep <file.inv ":HGT:" | wgrib2 -i file -grib hgt.grb
    +     grep <file.inv ":(UGRD|VGRD):" | wgrib2 -i file -grib winds.grb
    +
    +
    +

    Do alot on one line

    + +The above example can be made faster by doing it all on one command line. + +
    +M reads, N writes
    +     wgrib2 file \
    +         -if ":TMP:" -grib tmp.grb \
    +         -if ":HGT:" -grib hgt.grb \
    +         -if ":(UGRD|VGRD):" -grib winds.grb
    +
    + +

    Use -bin instead of -ieee

    + +

    +-bin writes/reads the grid values using the native floating point format.
    +-ieee writes/reads the grid values using the ieee format (big-endian is default).
    +-ieee uses software to convert from the native format to ieee even when the native +format is ieee. + +

    Fast Averaging

    +

    +If you are averaging, use +fast averaging + +

    Compile wgrib2 with OpenMP Enabled

    +

    +More cores are better for large grids. For large grids, use complex packing +without bitmaps. The decoder is parallelized for this case and runs 3x faster +for 3 km global grids on a 6-core machine. + +

    Run wgrib2 without OpenMP Enabled for Small Grids

    +

    +For small grids, OpenMP can slow the program. You can compile +with OpenMP turned off or with "OMP_NUM_THREADS" set to one. + + +

    Use multple cores

    +

    +See here +and over there + + +

    Use pipes instead of temporary files

    + +

    +Wgrib2 can read and write through pipes. This is both a programming convenience +as well as faster. + +

    +cat gfs*201201*grb2 | wgrib2 - -match ":HGT:500 mb:" -grib Z500.grb
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Aug 22, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/spread.html b/docs/web_docs/spread.html new file mode 100644 index 0000000..019c10b --- /dev/null +++ b/docs/web_docs/spread.html @@ -0,0 +1,232 @@ + + + + Climate Prediction Center - wgrib2: -spread + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-spread +
     
    + +

    wgrib2: -spread

    +
    + + +

    Introduction

    + +

    +The -spread option writes the grid values to a specified +file as a comma separated values (text) which can be imported into a spread sheet. +

    +   lon,lat,(VARIABLE DESCRIPTION)
    +   lon-1,lat-1,val-1
    +   lon-2,lat-2,val-2
    +   ...
    +   lon-N,lat-N,val-N
    +
    + +The latitudes and longitudes are only available for supported grids +and only the default WE:SN order is supported. The undefined value is 9.999e20. + +

    +Use the -undefine option to limit the output to +specified regions. + +

    +

    Usage

    +
    +-spread output_file_name
    +
    +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -s | grep ":RH:2 m" | wgrib2 -i test.grb2 -spread data.txt
    +285:36796469:d=2005090200:RH:2 m above ground:60 hour fcst
    +
    + +The above line extracts the 2 meter RH from file test.grb2 and writes it in data.txt. + +

    Warning #1

    + +

    +The options -csv, +-csv_long, +-spread and +-text do not support memory files. +You can blame sloth or lack of need. I like to think that +text files with grid point values are are insanely large +and shouldn't be saved in memory. + + +

    Warning #2

    + +

    It may be tempting to take a grib file, convert it into a CSV file +and then deal with the CSV file. After all, everybody can read +a CSV file. Sure there is a litte overhead of reading a CSV file +but who cares. Suppose you want to read some GFS forecasts files +(20 forecast times, 5 days every 6 hours) at 0.25 x 0.25 degree global resolution. +Your CSV file is going to be about 720 GBs. Suppose that our hard +drive can write/read at 70 MB/s. Then we are talking about 3 hours to +write the CSV file and 3 hours to read the CSV file not including CPU time +which will slow down the process. Converting grib into CSV is a +viable strategy if the conversion is limited. You need to restrict +the number of fields converted and should consider only converting +a regional domain. Note, I wrote "viable" and not optimal. + + +

    +See also: +-csv, +-netcdf, +-text, +-bin, +-ieee, +-undefine +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/start_FT.html b/docs/web_docs/start_FT.html new file mode 100644 index 0000000..3ea3ded --- /dev/null +++ b/docs/web_docs/start_FT.html @@ -0,0 +1,200 @@ + + + + Climate Prediction Center - wgrib2: -start_ft, start_FT, -end_ft, -end_FT + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -start_ft, -start_FT, -end_ft, -end_FT +
     
    + +

    wgrib2: -start_ft, -start_FT, -end_ft, -end_FT

    +
    + + +

    Introduction

    + +

    +Suppose you make a forecast starting from initial conditions of 00Z January 1 for the average +conditions from the month of February. In this forecast, there are three time stamps. + +

    +   Name                        date           YYYYMMDDHH option  (HH)Z(DD)(MON)YYYY option      with minutes and seconds
    +
    +   reference time              00Z Jan 1     -t                  -v2 -t                         -T
    +   start of forecast period    00Z Feb 1     -start_ft           -v2 -start_ft                  -start_FT
    +   end of forecast period      00Z Mar 1     -end_ft             -v2 -end_ft                    -end_FT
    +
    + +For common ftimes, + +
    +
    +analysis:                      reference time == start_ft == end_ft
    +6 hour forecast:               reference time + 6 == start_ft == end_ft
    +30 year monthly climatology:   reference time = start_ft = start of 1st month used to make climatology
    +                               end_ft = end of the last month used to make the climatology
    +

    Usage

    +
    +-start_ft
    +-end_ft
    +-start_FT
    +-end_FT
    +
    + +

    Example

    +

    + +

    +$ wgrib2 a.grb -start_ft
    +1:0:start_FT=20111101000000
    +
    + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/start_ft.html b/docs/web_docs/start_ft.html new file mode 100644 index 0000000..3ea3ded --- /dev/null +++ b/docs/web_docs/start_ft.html @@ -0,0 +1,200 @@ + + + + Climate Prediction Center - wgrib2: -start_ft, start_FT, -end_ft, -end_FT + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -start_ft, -start_FT, -end_ft, -end_FT +
     
    + +

    wgrib2: -start_ft, -start_FT, -end_ft, -end_FT

    +
    + + +

    Introduction

    + +

    +Suppose you make a forecast starting from initial conditions of 00Z January 1 for the average +conditions from the month of February. In this forecast, there are three time stamps. + +

    +   Name                        date           YYYYMMDDHH option  (HH)Z(DD)(MON)YYYY option      with minutes and seconds
    +
    +   reference time              00Z Jan 1     -t                  -v2 -t                         -T
    +   start of forecast period    00Z Feb 1     -start_ft           -v2 -start_ft                  -start_FT
    +   end of forecast period      00Z Mar 1     -end_ft             -v2 -end_ft                    -end_FT
    +
    + +For common ftimes, + +
    +
    +analysis:                      reference time == start_ft == end_ft
    +6 hour forecast:               reference time + 6 == start_ft == end_ft
    +30 year monthly climatology:   reference time = start_ft = start of 1st month used to make climatology
    +                               end_ft = end of the last month used to make the climatology
    +

    Usage

    +
    +-start_ft
    +-end_ft
    +-start_FT
    +-end_FT
    +
    + +

    Example

    +

    + +

    +$ wgrib2 a.grb -start_ft
    +1:0:start_FT=20111101000000
    +
    + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/stats.html b/docs/web_docs/stats.html new file mode 100644 index 0000000..96c065d --- /dev/null +++ b/docs/web_docs/stats.html @@ -0,0 +1,234 @@ + + + + Climate Prediction Center - wgrib2: -stats, max, min + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-stats, -mmax, -min +
     
    + +

    wgrib2: -stats, -max, -min

    +
    + + +

    Introduction

    + +

    +The -stats option writes a statistical summary +of the field into the inventory. +The -max option writes the maximum value and +the -min option writes the minimum. +These option are useful for quickly determining if the field has reasonable numbers. + +

    Usage

    +

    + +

    +-stats
    +-max
    +-min
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -stats
    +1:0:ndata=65160:undef=0:mean=83.8696:min=-428.1:max=317.8
    +
    +ndata = number of grid points
    +undef = number of grid points with an undefined value
    +mean = grid point average (not area weighted)
    +min = minimum value
    +max = maximum value
    +
    +$ wgrib2 test.grb2 -max
    +1:0:max=317.8
    +
    +$ wgrib2 test.grb2 -min
    +1:0:min=-428.1
    +
    +
    + +The -stats option can be combined with +the -undefine option to produce +statistics for a box.
    + +
    +$ wgrib2 test.grb2 -stats
    +1:4:ndata=10512:undef=0:mean=77.5081:min=-370:max=340.2:cos_wt_mean=97.267
    +
    +produces the global statistics. By setting grid points to undefined, +we can produce the statistics for a box.
    +
    +$ wgrib2 test.grb2 -undefine outobx 0:90 -10:10 -stats
    +1:4:ndata=10512:undef=10179:mean=79.8829:min=41:max=144:cos_wt_mean=79.8688
    +
    + +Note, if we reverse the order of the +-stats and +-undefine options, we get the global mean. +That is because the -stats option is excuted +before the -undefine options. + + +$ wgrib2 test.grb2 -stats -undefine out-box 0:10 -10:10 +1:4:ndata=10512:undef=0:mean=77.5081:min=-370:max=340.2:cos_wt_mean=97.267 + + +

    If all the data are undefined, +the -stats option will produce values +of zero for the the mean, min and max. +The -min and -max +options will yield a text string of "undefined". + + +

    +See also: -undefine +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/status.html b/docs/web_docs/status.html new file mode 100644 index 0000000..498cfe5 --- /dev/null +++ b/docs/web_docs/status.html @@ -0,0 +1,179 @@ + + + + Climate Prediction Center - wgrib2: -status + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-status +
     
    + +

    wgrib2: -status

    +
    + + +

    Introduction

    + +

    +The -status option is for developers. +It allows the developer to query the status at various +points in the processing. + +

    + +

    Usage

    +
    +-status file
    +        the status of the various opened files
    +
    + + +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: December 21, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/subcenter.html b/docs/web_docs/subcenter.html new file mode 100644 index 0000000..a27627d --- /dev/null +++ b/docs/web_docs/subcenter.html @@ -0,0 +1,191 @@ + + + + Climate Prediction Center - wgrib2: -subcenter + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -subcenter +
     
    + +

    wgrib2: -subcenter

    +
    + + +

    Introduction

    + +

    +The -subcenter option prints out the subcenter. +For example, within NCEP, the subcenters include NCO, EMC, HPC, MPC, CPC, etc. + +

    Usage

    +

    +

    +-subcenter
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -subcenter
    +1:0:subcenter=NCEP Ensemble Products
    +2:46042:subcenter=NCEP Ensemble Products
    +3:63079:subcenter=NCEP Ensemble Products
    +4.1:86046:subcenter=NCEP Ensemble Products
    +...
    +
    + +See also: -center, + -set + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Aug 19, 2011 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/submessages.html b/docs/web_docs/submessages.html new file mode 100644 index 0000000..023d818 --- /dev/null +++ b/docs/web_docs/submessages.html @@ -0,0 +1,233 @@ + + + + Climate Prediction Center - wgrib2: submessages + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > + wgrib2 > wgrib2: submessages +
     
    + +

    Submessages vs Messages in wgrib2

    + + +

    +In grib-2 format was designed for transmission of meteorologial data. So +it breaks up the information into messages. If you have a message, you +have the complete information about the field or fields. In theory, +one could save a space by having hundred of fields in one message. +However, the space savings are minor vs the cost of needing much +free memory to decode the file. So modern convention is +to put one field per message (no submessages) unless you have +multiple field need to be grouped together. For example, U and V +can be placed in the same message because you need both to know +the winds at any level. The use of submessages has become less common +because the space saving (maybe 100 bytes per field) is minor when +the models started outputing high resolution grids. + + +

    How does wgrib2 handle submessages

    + +When you want an inventory of the file, you want to see all the +fields. If you want to extract the 500 hPa heights, you doesn't care whether it is +in a submessage. The only difference when using wgrib2 is that record number +may have decimal point and the submessage number if needed. +Most of the time, one can igore whether the data are in submessages. + +

    +In this wgrib2 inventory, the data are in one message with four submessages. +

    +1.1:0:d=2000070312:HGT:500 mb:24 hour fcst
    +1.2:0:d=2000070312:TMP:850 mb:24 hour fcst
    +1.3:0:d=2000070312:UGRD:850 mb:24 hour fcst
    +1.4:0:d=2000070312:VGRD:850 mb:24 hour fcst
    +
    + +

    +In this wgrib2 inventory, the data are in four messages. +

    +1:0:d=2000070312:HGT:500 mb:24 hour fcst
    +2:114221:d=2000070312:TMP:850 mb:24 hour fcst
    +3:195862:d=2000070312:UGRD:850 mb:24 hour fcst
    +4:277503:d=2000070312:VGRD:850 mb:24 hour fcst
    +
    + +

    +For either file, we can do + +

    +wgrib2 grib2_file -match ":HGT:500 mb:" -text z500.txt
    +or
    +wgrib2 grib2_file | grep ":HGT:500 mb:" | wgrib2 grib2_file -i -text z500.txt
    +
    + +

    +Wgrib2 "ignores" the submessage feature and makes the +the file look and handle like a file without submessages. +However, there are two options that allow you to preserve +the "submessage" character of the original grib file. The +option "-GRIB" writes out the entire grib message including +all submessages. The companion option "-submsg N", only +allows inventory processing of submessage N. (Usually N is set to one.) + +

    Message mode

    +

    +Wgrib2 has a few options that work with messages. +

    +-GRIB [file]              .. write grib message that was just read to [file]
    +-if_n I:J:K               .. if message number is in do-loop I:J:K
    +-match "^[0-9]*\.1:"      .. only process first submessage
    +-match "^[0-9]*(:|\.1:)"  .. only process grib messages or first submessage
    +-ncep_uv                  .. combine ugrd, vgrd into one message
    +-submsg_uv                .. combine vectors into one message
    +-tosubmsg                 .. combine into one message
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + updated: May 15, 2005, 1/2023 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/submsg.html b/docs/web_docs/submsg.html new file mode 100644 index 0000000..59a52a8 --- /dev/null +++ b/docs/web_docs/submsg.html @@ -0,0 +1,241 @@ + + + + Climate Prediction Center - wgrib2: -submsg + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-submsg +
     
    + +

    wgrib2: -submsg

    +
    + + +

    Introduction

    + +

    +Usually wgrib2 ignores the distinction between messages and submessages; wgrib2 treats +sugmessages like messages except that the "message number" in the inventory is replaced +by a "message number.submessage number" in the inventory. If you want to work with +submessages, the following options are availble. + +

      +
    1. -GRIB FILE : copy a message to FILE +
    2. -ncep_uv FILE : combine U,V into a message like in NCEP operations +
    3. -tosubmsg FILE : create a file with submessages +
    4. -submsg N : process by submessage number +
    + + +

    +The -tosubmsg N option allows to process by submessage number. +If the N is zero, all the submessages are processed which pretty pointless +as this the default operation. If N is one, then all the messages are processed once. +(Messages with only one field are considered to have one submessage.) The following +will copy from IN.grb to OUT.grb and preserve the submessage structure. + +

    +$ wgrib2 IN.grb -submsg 1 -GRIB OUT.grb
    +
    + +This will copy all the 200 mb fields assuming U/V are in the same message and +keep U/V in the same message. + +
    +$ wgrib2 IN.grb -submsg 1 -if ":200 mb:" -GRIB 200mb.grb
    +
    + + +

    Usage

    +

    + +

    +-submsg N
    +N is an integer, usually 1
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -submsg 1 -if ":200 mb:" -GRIB 200.grb2 -if ":100 mb:" -GRIB 100.grb2
    +
    + + +

    +See also: -ncep_uv, + -GRIB, + -tosubmsg +

    + + + + + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/submsg_uv.html b/docs/web_docs/submsg_uv.html new file mode 100644 index 0000000..b398fbe --- /dev/null +++ b/docs/web_docs/submsg_uv.html @@ -0,0 +1,205 @@ + + + + Climate Prediction Center - wgrib2: -lon + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-submsg_uv +
     
    + +

    wgrib2: -submsg_uv

    +
    + + +

    Introduction

    + +

    +The option -submsg_uv is like the option +-ncep_uv. The latter option puts UGRD and VGRD into +the same grib message. The former combines all the vector fields into +their own grib message. +The option -submsg_uv may be important for +parallel processing. For example, you want to regrid from a Gaussian +grid to a polar stereographic grid that covers the North Pole. +For scalar fields, the grid can be regridded independently which +allows a possibility of parallel processing. Vector fields have +to processed together (U and V). One approach is to put the +vector fields into their own grib message (combine the corresponding +U/V fields). Then all the grib messages can be regridded independently. + +

    +The vector fields are the same as used by the +-new_grid option. The vector list can +be changed using the -new_grid_vectors option. + + + + +

    Usage

    +

    + +

    +-submsg_uv output_file
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -match ":500 mb:" -submsg_uv output.grb
    +
    + +See also: +-tosubmsg +-submsg +-submsg_uv +-ncep_uv +-new_grid_vectors +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Oct 3, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/sys.html b/docs/web_docs/sys.html new file mode 100644 index 0000000..c1a453a --- /dev/null +++ b/docs/web_docs/sys.html @@ -0,0 +1,190 @@ + + + + Climate Prediction Center - wgrib2: -sys + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-sys +
     
    + +

    wgrib2: -sys

    +
    + + +

    Introduction

    + +

    +The -sys option is only available when the UDF +(User Defined Function) extension is installed. +The -sys option runs a shell command. + + +

    Usage

    +

    + +

    +-sys STRING
    +
    +STRING is a shell command
    +
    + +

    Comments

    +

    +The UDF options may not work in windows. + +

    +The use of the UDF options is limited and the UDF options should, IMHO, +not be enabled unless the UDF options are needed. + + +

    +See alse: -udf_arg, +-udf, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/t.html b/docs/web_docs/t.html new file mode 100644 index 0000000..f39ee5a --- /dev/null +++ b/docs/web_docs/t.html @@ -0,0 +1,199 @@ + + + + Climate Prediction Center - wgrib2: -t -T -vt -VT + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -t -T -vt -VT +
     
    + +

    wgrib2: -t -T -vt -VT

    +
    + + +

    Introduction

    + +

    +The -t -T -vt -VT options prints various time flags. +The -t -T prints the reference time +and -vt -VT prints the verification time. +The capitalized versions print the time with the seconds +and the lower case options print the time with out the seconds. +In conjuntion with -v2 verbose mode, the +format of the time will change to be GrADS compatible. + +

    Usage

    +
    +-t
    +-T
    +-vt
    +-VT
    +
    + +

    Example

    +

    + +

    +$ wgrib2 g720_360.grb2 -t
    +1:4:d=2009010100
    +$ wgrib2 g720_360.grb2 -t -v2
    +1:4:00Z01jan2009
    +$ wgrib2 g720_360.grb2 -T
    +1:4:D=20090101000000
    +$ wgrib2 g720_360.grb2 -vt
    +1:4:vt=2009010600
    +$ wgrib2 g720_360.grb2 -vt -v2
    +1:4:00Z06jan2009
    +$ wgrib2 g720_360.grb2 -VT
    +1:4:vt=20090106000000
    +
    + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/table.html b/docs/web_docs/table.html new file mode 100644 index 0000000..d84f01a --- /dev/null +++ b/docs/web_docs/table.html @@ -0,0 +1,182 @@ + + + + Climate Prediction Center - wgrib2: -table + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-table +
     
    + +

    wgrib2: -table

    +
    + + +

    Introduction

    + +

    +The -table option prints the values of +discipline, master table and local table. +

    Usage

    +

    + +

    +-set_table
    +
    + +

    Example

    +
    +$ wgrib2 f.grb -table
    +1:0:discipline=0 master_table=2 local_table=1
    +
    + + + See also: +Sec0, +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified Nov 19, 2015 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/text.html b/docs/web_docs/text.html new file mode 100644 index 0000000..e854a7e --- /dev/null +++ b/docs/web_docs/text.html @@ -0,0 +1,214 @@ + + + + Climate Prediction Center - wgrib2: -text + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-text +
     
    + +

    wgrib2: -text

    +
    + + +

    Introduction

    + +

    +The -text option writes the grid values to a specified +file as a text (ascii) file. The default format (-header) is (per decoded grib message) + +

    +   NX NY
    +   val-1
    +   val-2
    +   ...
    +   val-(NX*NY)
    +
    + +Where NX and NY are the dimension of the grid and val-N is the Nth grid +point in WE:SN order. When the -no_header option is used, the format is + +
    +   val-1
    +   val-2
    +   ...
    +   val-(NX*NY)
    +
    + +The default order of the data is WE:SN which differs from +wgrib's order which is equivalent to the "-order raw" in wgrib2. +Another difference is that wgrib's -text option requires a filename. +The undefined value is 9.999e20. The format of the output is unchanged +from wgrib except the order, number of columns and precision can +be altered by the user. + +

    Usage

    +
    +-text file_name
    +      "-" sends the data to the terminal/stdout
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -s | grep ":RH:2 m" | wgrib2 -i test.grb2 -text data.txt
    +285:36796469:d=2005090200:RH:2 m above ground:60 hour fcst
    +
    + +The above line extracts the 2 meter RH from file test.grb2 and writes it in data.txt +

    + +See also: +-netcdf, +-spread, +-bin, +-ieee +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/text_col.html b/docs/web_docs/text_col.html new file mode 100644 index 0000000..c68335f --- /dev/null +++ b/docs/web_docs/text_col.html @@ -0,0 +1,197 @@ + + + + Climate Prediction Center - wgrib2: -text_col + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -text_col +
     
    + +

    wgrib2: -text_col

    +
    + + +

    Introduction

    + +

    +Wgrib2's -text and -ijbox options +will/can write text files. The default is to write one number per line of output. +By using -text_col option, you can write N numbers per line. + +

    Usage

    + +
    +-text_col N
    +          N is an integer greater than zero
    +
    + +

    Example

    +
    +$ wgrib2 cdas.t00z.sfluxgrbf06.grib2 -d 1 -text_col 3 -text junk 
    +1:0:d=2016122700:UFLX:surface:0-6 hour ave fcst:
    +$ head junk
    +192 94
    +0.037 0.035 0.034
    +0.032 0.031 0.029
    +0.028 0.026 0.025
    +0.023 0.022 0.019
    +0.016 0.015 0.014
    +0.013 0.015 0.015
    +0.013 0.012 0.011
    +0.009 0.008 0.006
    +0.005 0.003 0.002
    +
    + + +See also: +-text, +-ijbox + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 30, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/tigge.html b/docs/web_docs/tigge.html new file mode 100644 index 0000000..836cbfd --- /dev/null +++ b/docs/web_docs/tigge.html @@ -0,0 +1,174 @@ + + + + Climate Prediction Center - wgrib2: -tigge + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-tigge +
     
    + +

    wgrib2: -tigge

    +
    + + +

    Introduction

    + +

    +The -tigge option changes the names of the +variables to a table inspired by TIGGE. + +

    Usage

    +

    + +

    +-tigge
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/time.html b/docs/web_docs/time.html new file mode 100644 index 0000000..f39ee5a --- /dev/null +++ b/docs/web_docs/time.html @@ -0,0 +1,199 @@ + + + + Climate Prediction Center - wgrib2: -t -T -vt -VT + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -t -T -vt -VT +
     
    + +

    wgrib2: -t -T -vt -VT

    +
    + + +

    Introduction

    + +

    +The -t -T -vt -VT options prints various time flags. +The -t -T prints the reference time +and -vt -VT prints the verification time. +The capitalized versions print the time with the seconds +and the lower case options print the time with out the seconds. +In conjuntion with -v2 verbose mode, the +format of the time will change to be GrADS compatible. + +

    Usage

    +
    +-t
    +-T
    +-vt
    +-VT
    +
    + +

    Example

    +

    + +

    +$ wgrib2 g720_360.grb2 -t
    +1:4:d=2009010100
    +$ wgrib2 g720_360.grb2 -t -v2
    +1:4:00Z01jan2009
    +$ wgrib2 g720_360.grb2 -T
    +1:4:D=20090101000000
    +$ wgrib2 g720_360.grb2 -vt
    +1:4:vt=2009010600
    +$ wgrib2 g720_360.grb2 -vt -v2
    +1:4:00Z06jan2009
    +$ wgrib2 g720_360.grb2 -VT
    +1:4:vt=20090106000000
    +
    + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/time_interpolation.html b/docs/web_docs/time_interpolation.html new file mode 100644 index 0000000..f7a8bb0 --- /dev/null +++ b/docs/web_docs/time_interpolation.html @@ -0,0 +1,228 @@ + + + + Climate Prediction Center - wgrib2: time interpolation + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: time interpolation +
     
    + +

    wgrib2: time interpolation

    +
    + + +

    Introduction

    + + +

    +Sometime we have to do time interpolation. We may have the May 1st analysis and +the May 3rd analysis but are missing the May 2nd analysis. Or we may hourly forecasts +and want to make forecasts every 15 minutes in order to make a smooth animation. + +

    +The following shell script reads the 2 hour forecast ($1), the 3 hour forecast ($2) +and writes the 2:15, 2:30 and 2:45 hour forecast to the output file ($3). +The type of grib packing is retained by the option "-set_grib_type same". +The scaling of the numbers is retained by the option "set_scaling same same". +The latter option requires wgrib2 v2.0.5. + +

    +#!/bin/sh
    +# use wgrib2 to interpolate to time interpolate two forecast files
    +#
    +# ASSUMPTION: THE TWO FORECAST FILES MUST HAVE THE RECORDS IN THE
    +# SAME ORDER
    +#
    +# Yes, I am shouting.
    +# 
    +# $1 = 2 hour forecast
    +# $2 = 3 hour forecast
    +# $3 = output   (2:15, 2:30 and 2:45 hour forecasts)
    +#
    +# note: wgrib2 v2.0.5 is needed for the -set_scaling same same
    +#    for older versions of wgrib2, remove the "-set_scaling same same"
    +#    the output will be written in the default mode .. 12 bits
    +#
    +wgrib2=wgrib2
    +in1=$1
    +in2=$2
    +out=$3
    +
    +a="2 hour fcst"
    +b1=0.75
    +c1=0.25
    +d1="135 min fcst"
    +
    +b2=0.5
    +c2=0.5
    +d2="150 min fcst"
    +
    +b3=0.25
    +c3=0.75
    +d3="165 min fcst"
    +
    +$wgrib2 $in1 -rpn sto_1 -import_grib $in2 -rpn sto_2 -set_grib_type same \
    +  -if ":$a:" \
    +     -rpn "rcl_1:$b1:*:rcl_2:$c1:*:+" -set_ftime "$d1" -set_scaling same same -grib_out $out \
    +  -if ":$a:" \
    +     -rpn "rcl_1:$b2:*:rcl_2:$c2:*:+" -set_ftime "$d2" -set_scaling same same -grib_out $out \
    +  -if ":$a:" \
    +     -rpn "rcl_1:$b3:*:rcl_2:$c3:*:+" -set_ftime "$d3" -set_scaling same same -grib_out $out
    +
    + +

    +The script requires the the 2 and 3 hour forecast have the fields in +the same order. Otherwise you may be subtracting HGT from the TMP which +would be silly. The script only processes the fields with an inventory +line of ":2 hour fcst:". You could add lines to process accumulations and +averages. Note that the "-if" is ended by an output option which happens to be "-grib_out". + +

    +The script preserves the packing method and the scaling of the 2 hour forecast. + + + + + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 27, 2016. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/time_processing.html b/docs/web_docs/time_processing.html new file mode 100644 index 0000000..bd68f67 --- /dev/null +++ b/docs/web_docs/time_processing.html @@ -0,0 +1,526 @@ + + + + Climate Prediction Center - wgrib2: -ave, -fcst_ave + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-time_processing +
     
    + +

    wgrib2: -time_processing

    +
    + +News +The -time_processing option is being +introduced with wgrib2 v2.0.7 and has a superset of the capablities of +-ave and -fcst_ave. +The new -ave and -fcst_ave +options just call the -time_processing option. + +

    Introduction

    + +Product Definintion Templates (PDT) come in 3 variaties. Type A is an uncommon PDT +and only has a reference time with no forecast information. Typically they are for observations +such as radar or satellite data. Type B has a reference time with a forecast time. +For example, the reference time could be Januay 1, 2000 at 00Z. The forecast time +could be a 120 hour forecast. Typically the reference time is initial time of the forecast but +Table 1.2 allows you to specify the significance of the reference time. Type B specifies +a point in time. Finally Type C is similar to Type B except it is for a continous or +non-continuous time interval. Some examples of type C PDTs, + +
      +
    • average temperature of a 0-6 hour forecast +
    • maximum temperature of 00Z-24Z observations taken every hour +
    • maximum temperature of 00Z-24Z observations (as from a min-max thermometer) +
    • average 00Z temperature for the month of May (analysis) +
    • standard deviation of 00Z temperature of month of May 120 hour forecast +
    • 30 year climatalogy of average June temperature analyses +
    + +

    The interesting part of Type C PDTs is that the format is in terms of +a stackable temporal operator. For example, a simple height forecast (ex 12 hour forecast) +can be thought of as a height(time1, time2) where time1 is the intitial time of the +forecast and time2 is the forecast time. The possible temporal averaging operators +can be + +

    +    ave1 = 1/N(H(t0,t1) + H(t0+dt,t1) + ... + H(t0+(N-1)*dt,(N-1)))
    +    ave2 = 1/N(H(t0,t1) + H(t0,t1+dt) + ... + H(t0,(N-1)*dt))
    +    ave3 = 1/N(H(t0,t1) + H(t0+dt,t1-dt) + ... + H(t0+(N-1)*dt, t1-(N-1)*dt))
    +    ave4 = 1/N(H(t0,t1) + H(t0-dt,t1+dt) + ... + H(t0-(N-1)*dt, t1+(N-1)*dt))
    +
    +    the continous case is denoted by having dt == 0
    +
    + +By stacking the averaging operator, a monthly climatology can be described by a 30 year average +of a monthly average. + +

    The Type C PDTs allow 11 standard temporal operations (code table 4.10) which +include the commonly used average, accumulation, maximum, minimum, RMS and standard +deviation. + +

    +The -time_processing option will allow you to calculate the +average/minimum/maximum/standard_deviation of a time series of Type B or Type C PDTs. +Only a limited number of operators are supported. The total set is given by + +Code Table 4.10 +Only a limited number of types of time intervals as defined by +Code Table 4.11 +are supported. + +

    Usage

    +

    + +

    +-time_processing Code_Table_4.10 Code_Table_4.11 (time interval)  (output grib file)
    +  Code_Table_4.10:  0 or ave, computes average
    +                    2 or max, computes maximum
    +                    3 or min, computes minimum
    +                    5 or rms, computes the root mean square
    +                    6 or std_dev, computes sample standard deviation
    +  Code_Table_4.11:  1 or analyses,  time series of set of analyses/forecasts
    +                    2 or forecast,  time series from one (long) forecast
    +  (time interval):  (integer)(units)
    +  units:            hr, dy, mo, yr, mn (minutes, v2.0.8)
    +
    + + +

    Code Table 4.11 = 1 (analyses)

    + +When Code Table 4.1 is set to 1, the input fields have to be processed in a special order. +Suppose that you want to make a daily average from 4 analyses spaced at 6 hours. Then +you process 4 fields with reference times incrementing by 6 hours with the same forecast time, variable, +level and grid. Whenever the field is unexpected, a new average is made. Note: +the -time_processing option will handle missing fields. For example, + +
    +Code Table 4.10 = 0, Code Table 4.11 = 1
    +
    +U500 2000-01-02 00Z             start ave
    +U500 2000-01-02 06Z
    +U500 2000-01-02 12Z
    +U500 2000-01-02 18Z             end ave
    +V500 2000-01-02 00Z             start ave
    +V500 2000-01-02 06Z
    +V500 2000-01-02 12Z
    +V500 2000-01-02 18Z             end ave
    +Z500 2000-01-02 00Z             start ave
    +Z500 2000-01-02 06Z
    +Z500 2000-01-02 12Z
    +Z500 2000-01-02 18Z             end ave
    +
    + +Code Table 4.1 = 1 is good for making means of many analyses. + + +

    Code Table 4.11 = 2 (forecast)

    +

    +When Code Table 4.1 is set to 1, the input fields have to be processed in a special order. +Suppose that you want to make a daily average from one forecast with using forecast hour = +0, 6, 12 and 18. (The forecast for the first day.) + +

    +Code Table 4.10 = 0, Code Table 4.11 = 2
    +
    +U500 start 2000-01-02 00Z fhour=00 hours    start ave
    +U500 start 2000-01-02 00Z fhour=06 hours
    +U500 start 2000-01-02 00Z fhour=12 hours
    +U500 start 2000-01-02 00Z fhour=18 hours    end ave
    +V500 start 2000-01-02 00Z fhour=00 hours    start ave
    +V500 start 2000-01-02 00Z fhour=06 hours
    +V500 start 2000-01-02 00Z fhour=12 hours
    +V500 start 2000-01-02 00Z fhour=18 hours    end ave
    +T500 start 2000-01-02 00Z fhour=00 hours    start ave
    +T500 start 2000-01-02 00Z fhour=06 hours
    +T500 start 2000-01-02 00Z fhour=12 hours
    +T500 start 2000-01-02 00Z fhour=18 hours    end ave
    +
    + + +Code Table 4.11 = 2 is good for processing a single forecast run. + + +

    Code Table 4.11 = 3, 4, 5

    + +

    +These values of Code Table 4.11 are not commonly used and are not supported. + +

    Code Table 4.10 = 0 (average)

    + +Code Table 4.11 = 0 means the -time_processing option will compute the mean. +This is the most common usage. If you are trying to compute the average and some fields are missing, +then average will be computed from the available fields and the missing field value will reflect the +number of missing fields. If some grid values are undefined, then the average for the grid value +will be undefined as there is no mechanism to so show that the average was computed with fewer fields. + +

    Code Table 4.10 = 2 (maximum)

    + +Code Table 4.11 = 2 means the -time_processing option will find the maximum value. +If you are trying to find the maximum and some fields are missing, then the maximum will +be found available fields and the missing field value will reflect the number of missing fields. +If some grid values are undefined, then the maximum for the grid value +will be undefined as there is no mechanism to so show that the maximum was derived from fewer fields. + +

    Code Table 4.10 = 3 (minimum)

    + +Code Table 4.11 = 3 means the -time_processing option will find the minimum value. +If you are trying to find the minimum and some fields are missing, then the minimum will +be found available fields and the missing field value will reflect the number of missing fields. +If some grid values are undefined, then the minimum for the grid value +will be undefined as there is no mechanism to so show that the minimum was derived from fewer fields. + +

    Code Table 4.10 = 3 (root mean square)

    + +Code Table 4.11 = 3 means the -time_processing option will compute the root mean +square (rms). The mean of the square of the grid values is computed. Then the square root is +saved in the grib message. The value is marked as undefined if any of the individual values +is undefined. + +

    Code Table 4.10 = 6 (standard deviation)

    + +Code Table 4.11 = 6 means the -time_processing option will find the sample standard +devation. Welford's method for computing the mean and variance is used because it is a one-pass scheme +with the accuracy of a two-pass algorithm. + +

    Code Table 4.10 = 1, 4, 7 8, 9, ..

    + +These are not supported. Although adding support for 1, 4, 7, 8 and 11 seems easy. +However, I have not seen these values used. + +

    -ave (dt) (output)

    + +This option has been replaced by a macro that calls "-time_processing 0 1 (dt) (output)". + +

    -fcst_ave (dt) (output)

    + +This option has been replaced by a macro that calls "-time_processing 0 2 (dt) (output)". + +

    Minutes and Seconds

    + +There is no minutes time unit. Wgrib2 uses the standard GrADS +names for time units which means the "mn" is the unit for minutes. +Unfortunately it is too easy to confuse "mn" with the month time unit. +When there is a real need for minutes, then "mn" will be added. + +

    Fast Averaging

    +

    +Suppose we have a month of analyses at 3 hour intervals and want +to make a monthly mean for Nov. 2014. Using the above approach, the steps +would be + +

    +1.  cat narr.201411????.grb2 >tmp.grb2
    +2.  wgrib2 tmp.grb2 |  \
    +3.     sort -t: -k4,4 -k5,5 -k6,6 -k3,3 | \
    +4.     wgrib2 tmp.grb -i -set_grib_type c3 -ave 3hr narr.201411
    +
    +The first line creates a file with all the data.
    +The second line make an inventory.
    +The third line sorts the inventory in the order for -ave to process.
    +The fourth line makes the average by processing data in the order
    +  determined by the inventory created by line 3.
    +
    + +

    +The above approach processes one average at a time and requires a +minimal amout of memory. However, if you count the I/O operations, +you find that there are 4 I/O operations for every field as well as +the writes of the monthly means. In addition, the read (line 4) is +random access. + +

    HPC file systems are very fast for large files that are read +sequentially. On the other hand, HPC file systems are horrible for +small random access reads like in the previous example. Making +monthly means by averaging 3 hourly NARR data was taking about +three quarters of an hour on a multi-million dollar machine. +The problem was that the file system was optimized for large +sequential reads rather than small random-access reads. +The following shows another approach. + + +

    +1.  cat narr.201411????.grb2 | \
    +2.     wgrib2 - \
    +3.        -if_fs ":HGT:200 mb:" -ave 3hr narr.201411 \
    +4.        -if_fs ":UGRD:200 mb:" -ave 3hr narr.201411 \
    +5.        -if_fs ":VGRD:200 mb:" -ave 3hr narr.201411 \
    +6.        -if_fs ":TMP:200 mb:" -ave 3hr narr.201411 
    +
    +The first line copies the data in chronological order and
    +   writes it to the pipe.
    +The second line has wgrib2 read the grib data from the pipe.
    +The third line selects the Z200 fields and runs the averaging
    +  option on it.  We are assuming the narr.* fields only have
    +  one Z200 field and narr.201411???? puts the data into
    +  chronological order.
    +Lines 4-6 apply the averaging option to other fields.
    +
    + +

    +The above approach computes the mean of Z200, U200, V200 and T200 data +at the same time with the use of more memory. +The I/O consists of sequential read of all the files and the +writes of the monthly means. The above script only creates +the mean of Z200, U200, V200 and T200 but you could write a +very long command line and compute the mean of all the fields in +the file. Here are the guts of a +bash script, fast_grib2_mean.sh, which creates and runs the command line. + +

    +1.  wgrib2 $1 -match_inv | cut -f4- -d: | sed -e 's/:n=.*//' >$tmp
    +2.  cmd="cat $* | $wgrib2 - -set_grib_type c3 "
    +3.  while read line
    +4.  do
    +5.    cmd="$cmd -if_fs '$line' -ave $dt $out "
    +6.  done <$tmp
    +7.  eval $cmd
    +
    +1. $1 is the first file to average.
    +   Line 1 creates a file with the field names (minus date codes)
    +2. cmd is the command line that is being built
    +3. loop over all the lines in file $tmp
    +5. generate the "-if_fs/-ave" for the cmd line
    +   Older versions of the web paged used -if but that caused problems when
    +   $line included metacharacters such as parentheses.
    +6. bash syntax to have the while loop read from $tmp
    +7. run the command line
    +
    + +

    +Making the NARR monthly means using the above approach uses large +sequential reads which is optimal for the HPC file system. The run +time went from 3/4 of an hour to maybe a minute. + +

    Fast Forecast Averaging

    + +

    +The previous shell script was for a fast averaging of many analyses. +Sometimes one want to average several forecasts starting from +the same initial time. An example would producing a week-4 forecast. + +

    +1.  $wgrib2 $1 -match_inv | cut -f4-5 -d:  >$tmp
    +2.  cmd="cat $* | $wgrib2 - -set_grib_type c3 "
    +3.  while read line
    +4.  do
    +5.    cmd="$cmd -if_fs '$line' -fcst_ave $dt $out "
    +6.  done <$tmp
    +7.  eval $cmd
    +
    +1. $1 is the first file to average.
    +   Line 1 creates a file with the name and level for each field
    +   It is assumed that the name and level is unique in the file.
    +2. cmd is the command line that is being built
    +3. loop over all the lines in file $tmp
    +5. generate the "-if_fs/-fcst_ave" for the cmd line
    +   Older versions of the web paged used -if but that caused problems when
    +   $line included metacharacters such as parentheses.
    +6. bash syntax to have the while loop read from $tmp
    +7. run the command line
    +
    +

    +Using the -merge_fcst option in a like +manner to the -fcst_ave option. in a like + +

    Monthly Climatologies

    + +Once you can make an average, making a monthly climatology should be easy. Except +it isn't. Here are some of the problems that I encountered. + +
      +
    1. February has 28 days except when it doesn't. This causes problems because + wgrib2 -ave will not average 28 and 29 day intervals. +
    2. '116@6 hour ave(anl)' includes a regex metacharacter +
    3. the process id changed +
    4. the subcenter changed +
    + +The solutions were: + +
      +
    1. rewrite the grib file with
      + -if_fs '116@6 hour ave(anl)' -set_ftime2 '112@6 hour ave(anl)' -fi \
      + -if_fs '116@6 hour ave(6 hour fcst)' -set_ftime2 '112@6 hour ave(6 hour fcst)' -fi \
      + -if_fs '116@6 hour ave(3-6 hour acc fcst)' -set_ftime2 '112@6 hour ave(3-6 hour acc fcst)' -fi \
      +
    2. Use -if_fs instead of -if +
    3. rewrite the file with -set analysis_or_forecast_process_id 180 +
    4. rewrite the file with -set subcenter 0 +
    + +

    +Finding items 3 and 4 was a pain. Using undocumented option v98 helps. However, the mismatches can +now be uncoverted by using a verbose mode (>0) and wgrib v2.0.6. + + +

    Limitations

    +

    +Fast averaging has limits impossed by wgrib2. For example, +there is a limit in the maximum number of -if/-if_fs clauses. +Wgrib2 v2.0.6 can process up to 2000 -if and 2000 -if_fs options. +Wgrib2 v2.0.6 can +accept 10000 words on the command line. Since each -if_fs/-ave clause takes 5 +words on the command line and you need to include the name of the +input file, you get a limit of 999 -if_fs/-ave clauses. To speed up +the code, the evaluation of the -if/-if_fs options are done in parallel. + +

    +Fast averaging has limits impossed by the computer memory because +Fast averaging uses multiple calls to the time_processing option. Each +time_processing option requires computer memory. For +example, to compute the average, you need to keep arrays for the +running sum and number of times the sum was incremented. So it is +possible for the fast averaging could use up too much memory. + + +

    +See also: +-merge_fcst +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last created: April 3, 2017, modified Sep 13, 2017. May 4, 2018 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/timer.html b/docs/web_docs/timer.html new file mode 100644 index 0000000..6ff58f2 --- /dev/null +++ b/docs/web_docs/timer.html @@ -0,0 +1,215 @@ + + + + Climate Prediction Center - wgrib2: -timer + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -timer +
     
    + +

    wgrib2: -timer (requires wgrib2 v3.0.0+)

    +
    + + +

    Introduction

    + +

    +The -start_timer +and -timer options were designed for developers +and people who want to know how fast wgrib2 is running. Most users +can ignore these options. + +

    +The -timer option prints out the +time in seconds since the last -start_timer +or -timer +option was executed. The -timer option is +executed in the initialization phase (no output) and the +finalization phase (extra output). The timer is active +in the finalization phase in order to time the finialization of +options. + +

    +This option uses the OpenMP funcion omp_get_wtime(), and require +compilation with OpenMP. + +

    Usage

    +

    +

    +-start_timer
    +   sets timer_time=0
    +-timer
    +   prints timer_time in seconds.  
    +   sets timer_time = 0;
    +   at end of processing, prints the average if these results
    +
    +  note: there is only one instance of timer_time
    +        timer_time is set to 0 in the initialization of wgrib2
    +
    + +

    Example

    +

    + +

    +$ wgrib2 gep19.aec -s -start_timer -csv junk.csv -timer
    +1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19:time=0.068086
    +2:70707:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19:time=0.064850
    +3:96843:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19:time=0.055596
    +...
    +51:2278237:d=2009060500:PRMSL:mean sea level:180 hour fcst:ENS=+19:time=0.065116
    +finalize-time=0.000015:ave_time=0.061512 count=51
    +
    +Writing of the CSV is taking about 0.06 seconds per field.
    +
    + +

    +See also: +-alarm, +-start_timer, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page created: March 21, 2019 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/tosubmsg.html b/docs/web_docs/tosubmsg.html new file mode 100644 index 0000000..0512a75 --- /dev/null +++ b/docs/web_docs/tosubmsg.html @@ -0,0 +1,258 @@ + + + + Climate Prediction Center - wgrib2: -tosubmsg + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-tosubmsg +
     
    + +

    wgrib2: -tosubmsg

    +
    + + +

    Introduction

    + +

    +The -tosubmsg option writes out the current field as a +submessage in a larger grib message. This can save space as various +sections do not have to be repeated. For example, often you only +need one grid definition section for all the submessages. This +feature can save space when the bitmaps are repeated. By combining +the fields into one message, only one copy of the bitmap is needed. +The -tosubmsg option will only write out one grib message. +Fields that cannot be added to the grib message will be ignored with warning. +Fields cannot be added to the the submessage if section 0 (except the message length) +or section 1 differ. +

    +Note that the -tosubmsg is the only grib output option which cannot +write to a pipe. However, the somewhat similar -ncep_uv option +is pipe compatible. + +

    +By combining several grib messages into one big message, you can save +space. The practical drawbacks include + +

      +
    • A few codes cannot handle submessages +
    • Decoders tend to load the entire grib message into memory. + Loading a 2+ GB grib message would be a problem on 32-bit machines and + machines with limited memory. +
    • Inefficient with "partial-http downloading" (of concern to web servers) +
    + +However, submessages can be very important for some grids. One grid template stores +the latitude and longitude of each grid point. This is a large overhead per grib +message but by using submessages, the total overhead is reduced. + +

    Usage

    +

    + +

    +-tosubmsg OUTPUT_FILE
    +NOTE: OUTPUT_FILE cannot be a pipe.
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -tosubmsg new.grb2
    +
    +1:0:d=2008120200:TMP:800 mb:anl:
    +2:4786:d=2008120200:TMP:750 mb:anl:
    +3:9572:d=2008120200:RH:800 mb:anl:
    +4:13335:d=2008120200:RH:750 mb:anl:
    +5:17098:d=2008120200:TMP:2743 m above mean sea level:anl:
    +
    +Submessage statistics:
    +- # submessages written  : 5
    +- Kbytes saved           : 0
    +- Kbytes written         : 20
    +$ wgrib2  new.grb2
    +1.1:0:d=2008120200:TMP:800 mb:anl:
    +1.2:0:d=2008120200:TMP:750 mb:anl:
    +1.3:0:d=2008120200:RH:800 mb:anl:
    +1.4:0:d=2008120200:RH:750 mb:anl:
    +1.5:0:d=2008120200:TMP:2743 m above mean sea level:anl:
    +
    + + +

    +See also: +-GRIB, +-ncep_uv, +-submsg +

    + + + + + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Feb. 20, 2014. +
    + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/transient.html b/docs/web_docs/transient.html new file mode 100644 index 0000000..2024f9b --- /dev/null +++ b/docs/web_docs/transient.html @@ -0,0 +1,190 @@ + + + + Climate Prediction Center - wgrib2: -lon + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-transient +
     
    + +

    wgrib2: -transient

    +
    + + +

    Introduction

    + +

    +When wgrib2 opens a file, the file may be marked as persistent or +transient. If a file is marked as transient, wgrib2 will close +the file as part of its normal "finalize" procedure. If a file +is marked as persistent, the file will closed when the system +terminates the program. If you run the wgrib2 utility, it makes +no difference who closes the files. However, when you use the +C/Fortran API, it makes a major difference. When you write +C/Fortran programs that calls the wgrib2 API, you may want to +use the same file thousands of times. It is better to open +the file once rather than thousands of times. +The -persistent option marks an already +open file as persistent. +The -transient option marks an already +open file as transient. When opening a file, the default +is to mark the file as persistent. + +

    Usage

    +

    + +

    +-transient FILE
    +  FILE must be already opened
    +
    + +See also: +-persistent +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 15, 2016 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/type_reftime.html b/docs/web_docs/type_reftime.html new file mode 100644 index 0000000..8dacff8 --- /dev/null +++ b/docs/web_docs/type_reftime.html @@ -0,0 +1,201 @@ + + + + Climate Prediction Center - wgrib2: -type_reftime + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ndate +
     
    + +

    wgrib2: -type_reftime (v3.1.3)

    +
    + + +

    Introduction

    + +

    +The reference time in a grib message is usually the analysis (0) or the +start of forecast (1). For NCEP, the analysis as produced by the data +assimilation system is used as the initial conditions for the forecast. +(It is possible that other sites may using an initialization step.) + +

    +Grib allows the reference time to refer to other quantities such as + +

      Code Table 1.2 (entries 0 and 1 not shown)
    +  2 Verifyting Time
    +  3 Observation Time
    +  4 Local Time
    +
    + +

    +The ultraviolet index (UVI) as produced is the value that verifies at noon local time. +It is not the maximum value as the conditions may be cloudy at noon and cloud free +at 1pm. The UVI field will have a hour of 12Z with a code table 1.2 = 4, saying +the the reference time is "local time". + +

    Usage

    +

    + +

    +-type_reftime
    +
    + +

    Example

    +

    + +

    +$ wgrib2 small.grb2 -type_reftime
    +1:0:type_reftime=start of forecast
    +
    + +

    + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page: started 2/2023 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/types.html b/docs/web_docs/types.html new file mode 100644 index 0000000..a9a7f8a --- /dev/null +++ b/docs/web_docs/types.html @@ -0,0 +1,400 @@ + + + + Climate Prediction Center - wgrib2: options + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 options +
     
    + +

    Options

    +
    + + +

    Introduction

    + +

    +The wgrib2 command line consists of a list of options and a grib file +to be processed. The options like +-if, +-else, and +-endif can alter the 'run_flag' which is the basis +of the IF-ELSE-ENDIF blocks. + +

    Types of Options

    + + +
    +wgrib2:      *.c:
    +------       ---
    +if           If                For IF/ELSE/ELSEIF/ENDIF type options
    +else         Else
    +elseif       Elseif
    +endif        Endif
    +
    +init         setup             only called in the beginning, for set up
    +
    +inv          inv               print output to stdout (make an inventory)
    +inv>         inv_output        print to a file (make an inventory)
    +out          output            write to a file with a non-inventory output, ex binary
    +misc         misc              any thing else
    +
    + + +

    How "Options" are called

    +

    What is "mode"

    + +

    +Each option is associated with a subroutine. Each option is "called" +for setup (mode == -1). This allows +the option to do initialization such as setting up the flags, +checking the arguments and opening files. This is the only +time that init or setup options are called. +The -match and -d options are init options because +it sets up the grib processor to only accept certain grib messages. + +

    +The options are then called for every grib message that is processed. +In the grib-processing phase, mode ≥ 0 and the mode will indicate the +verbosity level. Mode == 0 is the lowest verbosity. and mode == 2 +is normally the highest verbosity. These verbosity modes can be set by -v, +-v1 and -v2. Modes 97, 98 and 99 are used in debugging. + +

    +When the program has finished processing the grib data, the +option subroutines are called to cleanup the processing +(mode == -2). The +cleanup step is used to finish calculations (ex. averaging), +close files and free memory. Freeing memory and closing files +may seem a wasted effort because the operating system will do that +when a program finishes. However, wgrib2 is also a subroutine so +memory recovery and closing files is a must otherwise you +may run out of memory or file handles. +By the way, if you don't want a file closed, you can mark the file as persistant. + + +

    Custom Options

    + +

    +Writing your own option can be easy. That is why there +are so many options in wgrib2 (387 in 7/2022). You just have +to follow some rules. + +

    Setup: mode = -1

    +

    +In the setup phase, you have to request services. For +example if you want the grid point values or locations, +you set at flag in this step. +

    You can also parse the arguments in the setup phase +or grib-processing step. If you process the arguments +in setup phase will save time. Processing the arguments +in the grib-processing step is necessary if the +processing depends on the grib message. In addition, +macro options can only call options that have +no setup. Here is an example of setting the options. + +

    +extern decode, latlon, save_translation;
    +..
    +    if (mode == -1) {
    +        decode = 1;             /* decode the grid point values */
    +        latlon = 1;             /* calculate the lat lon values */
    +        save_tranlation = 1;    /* save the translation from external to internal scan order */
    +        return 0;
    +    }
    +
    + +

    Setup: flags

    +

    +The following flags request a service. Set the flag to +one if you want the service. Do not set the flag to zero because +another option may want the service. + +

    +extern int decode             grid point values are decoded
    +extern int latlon             latitude and longitudes are calculated
    +extern int save_translation   save trnsalation from grib file to internal scan order
    +
    + +

    +Some flags are set by other options, and all options are expected +to obey the flag. These flags may change. +

    +file_append                    Open an file for writing in append mode 
    +ieee_little_endian             if writing ieee, use little endian
    +header                         files use write in "header" mode
    +flush_mode                     flush the output after writes (all output files)
    +
    + +

    Grib Processing: mode ≥ 0

    +

    +In this phase, the option routine is called one +time each grib (sub)message is processed. The +routine has potential access (if requested) to the grid +point data and locations. Of course, the routine +is not called if prevented by if/else/endif block. + +

    Grib Processing: mode = -2

    +

    +In the cleanup phase, calcuations, I/O are finished, +files are closed and allocated memory + +

    FILE I/O

    +

    +Wgrib2 allows multiple options to read and write to a file. + + + $ wgrib2 IN.grb -if ':TMP:' -bin OUT.bin -endif -if ':HGT:' -bin OUT.bin -endif + + +If each -bin option were allowed to open the file, the writes would +not work correctly. So opening, closing, writing, reading and fseeks +have to be done by a special set of routines. + +

    +    fopen_file(..)
    +    fclose_file(..)
    +    fread_file(..)
    +    fwrite_file(..)
    +    fseek_file(..)
    +    ftell_file(..)
    +    fflush_file(..)
    +
    +    the only difference from the normal I/O is FILE *file is replaced by struct seq_file *file
    +
    + +

    Static Variables

    +

    +An option gets called for initialization, grib-processing, and cleanup. So +the option routine needs static variables to retain information such +as the open file handles. The situation is more difficult because an +option can be used more than once on a command line. + +

    + $ wgrib2 IN.grb -if ':TMP:' -bin TMP.bin -endif -if ':HGT:' -bin HGT.bin -endif
    +
    + +So the option routine needs a set static variables for each use of the +option on the command line. + + +
    +struct static_vars {
    +    struct seq_file out;
    +    int num_run;
    +}
    +...
    +    struct  static_vars *save;
    +    if (mode == -1) {
    +        decode = 1;
    +        *local = save = (struct static_vars *) malloc( sizeof(struct static_vars));
    +        /* local is defined as the subroutine argument, the i-th option on the command line
    +           is passed local[i] */
    +        if (save == NULL) fatal_error("memory allocation in XYZ);
    +        save->num_run = 0;
    +        if (fopen_file(&(save->out), arg1, "wb") != 0) fatal_error("open file %s", arg1);
    +        return 0;
    +    }
    +    save = *local;	/* *local is passed from calling routine */
    +    if (mode == -2) {
    +        fprintf(stderr,"XYZ called %d times\n", save->num);
    +        fclose(&(save->out));
    +        free(*local);
    +    }
    +    if (mode >= 0) {
    +        fwrite_file(data, ndata, sizeof(float), &(save->out));
    +        save->num_run += 1;
    +    }
    +    return 0; 
    +
    + +

    Stdout

    +

    +Normally options do not write to stdout but write their output to a buffer. +This allows the option routines to be called by other routines and return +a string value. For example, +you wanted the name of the variable. You can call the +the -var option, and the name would be returned +in the buffer. + + +

    Adding a New Option

    +

    +Adding a new option involves updating tables with +(1) option name and corresponding subroutine name, +(2) number of arguments the option takes and the + (3) description of the option for the help command. +On a POSIX machine (has a POSIX shell and utilities), +the process is process is automatic. You need to do, + +

      +
    1. The name of the source code needs to start with a capital letter + and be written in C. +
    2. Source code file needs to be added to grib2/wgrib2/ ex. grib2/wgrib2/File.c +
    3. Each option needs a HEADER line +
        +
      • ex. * HEADER:100:text:output:1:write text data into X +
      • The line must start with '* HEADER:' +
      • then a 3 digit number which display priority +
      • then the name of the option, ex. 'text' +
      • then comes the type of option, ex. 'output' +
      • then by the number of arguments (only 0..8 are allowed) +
      • finished by a description of the option +
      +
    4. The name of the routine associated with the option is int f_OPTION(ARGN) +
    5. OPTION is replaced by the option name in the header line +
    6. N is replaced by the number of arguments in the header line +
    7. The script function.sh will read the header lines and generate fnlist.h and fnlist.c +
    + + + + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/udf.html b/docs/web_docs/udf.html new file mode 100644 index 0000000..9d8b6d9 --- /dev/null +++ b/docs/web_docs/udf.html @@ -0,0 +1,202 @@ + + + + Climate Prediction Center - wgrib2: -udf + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-udf +
     
    + +

    wgrib2: -udf

    +
    + + +

    Introduction

    + +

    +The -udf option is only available when the UDF +(User Defined Function) extension is installed. +The -udf option runs a shell command (arg1) and then +sets the grid point so to contends of a binary file (arg2). + + +

    Usage

    +

    + +

    +-udf STRING FILE
    +
    +STRING is a shell command
    +FILE is a binary file which contains the contents of grid points
    +
    + +

    +Some functions can be written in RPN and others are more +conveniently writen is a language like C for Fortran. +The idea behind UDF is that the input file to the user +define function is prepared while scanning the grib file. +When the input file is complete, the user defined function +is called. If the user defined function returns no results, then +the -sys option is used to run the user +defined function otherwise -udf is used. + +

    Comments

    +

    +The UDF options may not work in windows. + +

    +The use of the UDF options is limited and the UDF options should, IMHO, +not be enabled unless the UDF options are needed. + + +

    +See alse: -udf_arg, +-udf, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/undefine.html b/docs/web_docs/undefine.html new file mode 100644 index 0000000..b57154e --- /dev/null +++ b/docs/web_docs/undefine.html @@ -0,0 +1,213 @@ + + + + Climate Prediction Center - wgrib2: -undefine + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-undefine +
     
    + +

    wgrib2: -undefine

    +
    + + +

    Introduction

    + +

    +The -undefine option sets the selected the decoded grid +values to undefined. The grid points are have to be inside or outside +a user defined lat-lon box. This option can be used to limit the output +when writing text output. For example, you were only interested in +the UK, you could use this option to undefine the grid points outside +the of UK. Then when you write the data in spread-sheet format, you +would get a much smaller output. This option can also be used to +find the regional average using the stat option. + + +

    Usage

    +

    + +

    +-undefine (in-box|out-box) lon0:lon1 lat0:lat1
    +
    +in-box:  decoded grid points inside the box are set to undefined
    +out-box: decoded grid points outside the box are set to undefined
    +lon0:lon1  west-east longitudes of the box
    +lat0:lat1  south-north latitudes of the box
    +
    +Points on the box boundary are considered to be in the box.
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -undefine out-box 350:10 -10:10 -stats
    +1:0:ndata=65160:undef=64719:mean=94.1229:min=58.1:max=125.2
    +
    + +The above line calculates the statistics for the box -10W-10E 10S-10N + +
    +$ wgrib2 test.grb2 -undefine out-box 10:30 20:40 -undefine in-box 12:28 22:38 -bin boundary.bin
    +
    + +The above line undefines the grid points outside of a box and then undefines the grid points of a smaller +box that is contained in the first box. Then it writes the data as a binary file. The data file contains +the data points for a perimeter of a box. Why would someone want to do that? Think "horizontal boundary +conditions for a regional model". For this to work well, a module to write the data out in grib-2 needs +to be written. To work in the (i,j) coordinates, see the -ijundefine option. + +

    +See also: +-ijundefine, +-spread, +-stats, +-undefine_val, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/undefine_val.html b/docs/web_docs/undefine_val.html new file mode 100644 index 0000000..4214089 --- /dev/null +++ b/docs/web_docs/undefine_val.html @@ -0,0 +1,201 @@ + + + + Climate Prediction Center - wgrib2: -undefine_val + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-undefine_val +
     
    + +

    wgrib2: -undefine_val

    +
    + + +

    Introduction

    + +

    +The -undefine_val option sets the grid points to undefined +depending on the value of the grid point. If a single value is specified, grid +values within 0.1 percent are set to undefined. If two values are specified, +the values that are within that range are set to undefined. + +

    Note: the ability to handle ranges was always available but undocumented. +My mistake. That's what you get when you delay writing the documentation. + +

    Usage

    +

    + +

    +-undefine_val value
    +   grid values within 0.1 percent are set to undefined
    +
    +-undefine_val "value1:value2"
    +   grid value that are within the rage are set to undefined
    +   i.e.,   value1 <= grid_value <= value2
    +
    + +

    Example

    +

    +Suppose a non-standard grib file uses -999.9 as special value to +indicate an undefined grid point value. This is unfortunate as grib +readers will not know that -999.9 is a special value for undefined +values. (Grib2 uses a bitmap, NaN or out-of-range values.) +The best way to deal with these files is to convert +values of -999.9 to undefined values and then write them out. + +

    +$ wgrib2 IN.grb2 -undefine_val -999.9 -set_grib_type same -grib_out OUT.grb
    +
    + +

    +See also: +-undefine, +-ijundefine, +-rpn, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Aug 8, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/unix_time.html b/docs/web_docs/unix_time.html new file mode 100644 index 0000000..5f27b15 --- /dev/null +++ b/docs/web_docs/unix_time.html @@ -0,0 +1,218 @@ + + + + Climate Prediction Center - wgrib2: -unix_time + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-unix_time +
     
    + +

    wgrib2: -stats, -max, -min

    +
    + + +

    Introduction

    + +

    +The -unix_time option writes unix time in the inventory. +Unix time is defined by the number of seconds after 00:00 UTC Januay 1, 1970. +Unix time is used by the many operating systems, and by NetCDF files. +The -unix_time option depends on system/library functions +to calculate the unix time. It requires ansi C compatibility and it is +subject to overflows depnding on the definition of time_t. +

    +The unix time is stored in time_t integer-type variable. +If time_t is a signed 32-bit integer, the integer will overflow in 1/19/2038 +and is only valid between 12/13/1901 and 1/19/2038. +One valid solution to the year 2038 overflow problem is to define time_t as an unsigned 32-bit integer. +Then valid unix time are from 1/1/1970 to 2/7/2106. This solves the year 2038 overflow problem +but makes time prior to 1970 invalid. +The most common solution +is to make time_t a signed 64-bit integer which limits the largest year to 2,147,485,547. +That's enough time for dinosaurs to come and go. Here are the list +of systems which may have problems with unix_time. + +

      +
    • wgrib2 prior to v3.1.1, unix_time is converted to int (typically 32-bit int) +
    • 32-bit linux systems, time_t is 32-bit signed int until kernel 5.6, API needs to be fixed +
    • 32-bit QNX: 32-bit ONX use unsigned 32-bit integer for time_t +
    • old versions of BSD varients use signed 32-bit int for time_t +
    • Windows: depends on the compiler +
    + +

    Usage

    +

    + +

    +-unix_time
    +   unix_time is the number of seconds after 00:00 UTC 1/1/1970
    +   prints the unix time for the reference and verification times
    +
    +   v3.1.1+: if the code detects a problem with the reference time, a fatal error occurs
    +   prior to v3.1.1: if the code detects a problem with the time, -1 is printed
    +      if there is no forecast time (ex. radar), the verification time is -1
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -unix_time
    +1:0:unix_rt=1228176000:unix_vt=1228176000
    +
    +unix_rt is the reference time
    +unix_vt is the verification time
    +
    + +

    +See also: +-t (reference time), +-vt (verification time), +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005, Jan, 2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/unmerge_fcst.html b/docs/web_docs/unmerge_fcst.html new file mode 100644 index 0000000..e56bf4b --- /dev/null +++ b/docs/web_docs/unmerge_fcst.html @@ -0,0 +1,302 @@ + + + + Climate Prediction Center - wgrib2: -unmerge_fcst + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ncep_norm +
     
    + +

    wgrib2: -unmerge_fcst (v3.0.0+)

    +
    + + + +

    Introduction

    +Prior to GFS-FV3, the precipitation was stored in the "old-style". This style +handled 6 hour accumulations in a simple manner. + +
    +  0-6, 6-12, 12-18, 18-24, etc
    +
    + + +Eventually someone wanted to store 3 hour accumulations. However, people who had code +that read the 6 hour accumulations said that they couldn't change the code. So the +the file still had to contain the 6 hour accumulations. So the code to read the +3 hour accumulations had to a subtraction for some of the interval. They stored +the accumulations like this. + + +
    +  0-3, 0-6, 6-9, 6-12, 12-15, 12-18, 18-21, 18-24, etc
    +
    + +Now the FV3-GFS model developers agreed to store precipitation accumulations in +the easy-to-use format, + +
    +  0-3, 0-6, 0-9, 0-12, 0-15, 0-18, 0-21, 0-24, etc
    +
    + +However, people who had code that read the accumulation in the old style said that +they could not change their code. So they had put old style and new style accumulated +precipitation in the files. + +

    +To process the precip with wgrib2, you want to eliminate the old-style precip. +It is surprisingly difficult because the old style can have to same name as +the new style (ex. 3 hour forecast). You have to eliminate the old style but +not the new style even though they have the same name. + + +

    The -unmerge_fcst option helps deal with the +FV3-GFS precip problem when trying to make time series. + + +

    Example usage

    + + +
    +# make a file with the APCP from cat gfs.t00z.pgrb2.0p25.f(N) N=000..029 
    +$ cat gfs.t00z.pgrb2.0p25.f00? gfs.t00z.pgrb2.0p25.f01? gfs.t00z.pgrb2.0p25.f02? | wgrib2 - -match APCP -grib $stmp/all_apcpc.grb
    +
    +
    +# Lets see the new-style precip. in the file
    +$ cd $stmp
    +$ wgrib2 all_apcpc.grb -match ':0-'
    +1:0:d=2020101600:APCP:surface:0-1 hour acc fcst:
    +2:225707:d=2020101600:APCP:surface:0-1 hour acc fcst:
    +3:451414:d=2020101600:APCP:surface:0-2 hour acc fcst:
    +4:726257:d=2020101600:APCP:surface:0-2 hour acc fcst:
    +5:1001100:d=2020101600:APCP:surface:0-3 hour acc fcst:
    +6:1307459:d=2020101600:APCP:surface:0-3 hour acc fcst:
    +7:1613818:d=2020101600:APCP:surface:0-4 hour acc fcst:
    +8:1940346:d=2020101600:APCP:surface:0-4 hour acc fcst:
    +9:2266874:d=2020101600:APCP:surface:0-5 hour acc fcst:
    +10:2610484:d=2020101600:APCP:surface:0-5 hour acc fcst:
    +11:2954094:d=2020101600:APCP:surface:0-6 hour acc fcst:
    +12:3311989:d=2020101600:APCP:surface:0-6 hour acc fcst:
    +14:3894753:d=2020101600:APCP:surface:0-7 hour acc fcst:
    +16:4539821:d=2020101600:APCP:surface:0-8 hour acc fcst:
    +18:5222224:d=2020101600:APCP:surface:0-9 hour acc fcst:
    +20:5934324:d=2020101600:APCP:surface:0-10 hour acc fcst:
    +22:6672253:d=2020101600:APCP:surface:0-11 hour acc fcst:
    +24:7431863:d=2020101600:APCP:surface:0-12 hour acc fcst:
    +26:8071608:d=2020101600:APCP:surface:0-13 hour acc fcst:
    +28:8767119:d=2020101600:APCP:surface:0-14 hour acc fcst:
    +30:9496847:d=2020101600:APCP:surface:0-15 hour acc fcst:
    +32:10253719:d=2020101600:APCP:surface:0-16 hour acc fcst:
    +34:11034026:d=2020101600:APCP:surface:0-17 hour acc fcst:
    +36:11835057:d=2020101600:APCP:surface:0-18 hour acc fcst:
    +38:12515832:d=2020101600:APCP:surface:0-19 hour acc fcst:
    +40:13250721:d=2020101600:APCP:surface:0-20 hour acc fcst:
    +42:14017034:d=2020101600:APCP:surface:0-21 hour acc fcst:
    +44:14807995:d=2020101600:APCP:surface:0-22 hour acc fcst:
    +46:15623322:d=2020101600:APCP:surface:0-23 hour acc fcst:
    +48:16460745:d=2020101600:APCP:surface:0-1 day acc fcst:
    +50:17171481:d=2020101600:APCP:surface:0-25 hour acc fcst:
    +52:17933059:d=2020101600:APCP:surface:0-26 hour acc fcst:
    +54:18724060:d=2020101600:APCP:surface:0-27 hour acc fcst:
    +56:19538757:d=2020101600:APCP:surface:0-28 hour acc fcst:
    +58:20377109:d=2020101600:APCP:surface:0-29 hour acc fcst:
    +
    + +As you can see, 0-1, 0-2, 0-3, 0-4, 0-5 and 0-6 accumulations are duplicated. +

    +The -unmerge_fcst option is used to find the precipitation time series. + +

    +$ wgrib2 all_apcpc.grb -unmerge_fcst precip_ts.grb 0hr 1
    +1:0:d=2020101600:APCP:surface:0-1 hour acc fcst:
    +2:225707:d=2020101600:APCP:surface:0-1 hour acc fcst:
    +3:451414:d=2020101600:APCP:surface:0-2 hour acc fcst:
    +4:726257:d=2020101600:APCP:surface:0-2 hour acc fcst:
    +5:1001100:d=2020101600:APCP:surface:0-3 hour acc fcst:
    +6:1307459:d=2020101600:APCP:surface:0-3 hour acc fcst:
    +...
    +
    + +

    +The first argument is the output file. The second argument is +the start of the accumulations to start, i.e., 0hr. Finally the +third argument is 1 to include the 0-1 accumulation. The output is + +

    +$ wgrib2 precip_ts.grb 
    +1:0:d=2020101600:APCP:surface:0-1 hour acc fcst:
    +2:225707:d=2020101600:APCP:surface:1-2 hour acc fcst:
    +3:2302390:d=2020101600:APCP:surface:2-3 hour acc fcst:
    +4:2302593:d=2020101600:APCP:surface:3-4 hour acc fcst:
    +5:2302796:d=2020101600:APCP:surface:4-5 hour acc fcst:
    +,,
    +26:2307059:d=2020101600:APCP:surface:25-26 hour acc fcst:
    +27:2307262:d=2020101600:APCP:surface:26-27 hour acc fcst:
    +28:2307465:d=2020101600:APCP:surface:27-28 hour acc fcst:
    +29:2307668:d=2020101600:APCP:surface:28-29 hour acc fcst:
    +
    + + +

    Usage

    +

    + +

    +-unmerge_fcst (output file) (N)(time unit) I
    +   output file: name of output grib file
    +   N: integer,  usually 0
    +   time unit:  the forecast time unit, hr, dy, mo, etc
    +      If you want to process A-B hour acc fcst
    +      then N=1, time unit = hr
    +  I = 1 
    +
    + +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page created: Oct 16, 2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/update_2.0.8.html b/docs/web_docs/update_2.0.8.html new file mode 100644 index 0000000..0891c42 --- /dev/null +++ b/docs/web_docs/update_2.0.8.html @@ -0,0 +1,209 @@ + + + + Climate Prediction Center - wgrib2: v2.0.8 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 v2.0.8 +
     
    + +

    wgrib2: v2.0.8

    +
    + + +

    Introduction

    + +

    +Wgrib2 v2.0.8 has the typical bug fixes, updates for tables, minor enhancements. +All these can found in the change log. Here are the bigger changes. + +

    The interpolattion library has been changed from the single precision +grib1 to the newer double precision grib2 library. The newer library +is more accurate and supports rotated lat-lon grids. Both Canada and NCEP +plan to join the Europeans in making rotated lat-lon grib files. + +

    I am working with 80 member ensembles, so gmerge had to be +modified to handle 80 input files, and -ens_processing option +was written to get the ensemble statistics. + +

    Everybody has a program/script to add an offset to a date code. +Unlike other solutions, the offset can be in minutes, hours, days, +months and even years. (-ndate) + +

    The -ndate option was ok, but puting it into a do loop makes +scripting much easier when doing time loops (-ndates). I +immediately rewrote scriopts to use -ndates. It isn't the best +design to have -ndate and -ndates in wgrib2. However, it was +a low cost solution assuming wgrib2 has to be ported to the new +machine. + +

    I learned how to use the unix command "seq" to generate a +list of 80 ensemble members by changing the seq format. So I added +-ndates_fmt to generate lists of files of uniformly varying dates. + +

    The time has come to support minute units. Originally wgrib2 +did not supoort minute units because the minutes units is "mn" which +could be confused with month. (wgrib2 uses GrADS units.) + +

    +NetCDF4 is not working well. The problem is compiling the HDF5 library +with newer versions of gcc. You may use the +Intel compiler. Another option is to find the system HDF5 library +and modify the makefile. I expect the next version of HDF5 will address +the problems. + +

    +Compiling wgrib2 with LLVM worked with Ubuntu 14.04LTS. However, this +version becomes unsupported in April 2019. With Ubuntu 18.04LTS, there +is no LLVM fortran. Clang will compile wgrib2 but you will not have +the interpolation library or the fortran wgrib2api. + + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 10, 2016, July 2, 2018 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/usage_questions.html b/docs/web_docs/usage_questions.html new file mode 100644 index 0000000..9793e40 --- /dev/null +++ b/docs/web_docs/usage_questions.html @@ -0,0 +1,190 @@ + + + + Climate Prediction Center - wgrib2: -text + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 questions +
     
    + +

    wgrib2: questions

    +
    + + +

    +Question: I use -small_grib to make a smaller domain. Why is the "smaller" +file almost 3x larger? + +

    +Answer: -small_grib creates a new grib message. The default compression is "off". +You can use c3 (complex number 3) compression by "-set_grib_type c3". BTW +this is why grib_filter on the nomads.ncep.noaa.gov server can create +larger files when making a regional subset. + + +

    +Question: Why does wgrib2 create smaller complex-packed files +than cnvgrib? + +

    +Answer: Complex packing can be done in different ways. wgrib2 uses +a slower algorithm than cnvgrib and makes a smaller file. + +

    Question: I get a warning about the decode may differ from the WMO standard, why? + +

    Answer: Some software/libraries may differ from the WMO standard when encoding and decoding a constant field. +The warning is based on the center and testing of software/libraries developed by that center. +The testing was done many years ago and may no longer be appropriate. If any center +feels that the warning is inaccurate, let me know and I will remove the warning. + +

    The common bug is that when encoding a constant field, the decimal scaling +factor modifies the field reference value. Some codes ignore the decimal scaling which +was the case in the grib1 standard. To turn off +the wgrib2 warning, make sure the decimal scale factor is zero when the field is constant. + + + + + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Dec 21, 2015 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/user_grib2tables.html b/docs/web_docs/user_grib2tables.html new file mode 100644 index 0000000..89198c3 --- /dev/null +++ b/docs/web_docs/user_grib2tables.html @@ -0,0 +1,323 @@ + + + + Climate Prediction Center - wgrib2: user grib2tables + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: user grib2tables +
     
    + +

    wgrib2: user grib2tables

    +
    + + +

    Introduction

    + +

    +Grib2 messages have variable names such as HGT or TMP. The table built into wgrib2 +can be agumented using "user defined grib tables". This allows you to add locally +defined variables as well, update the grib table, and change the names of pre-existing +variables. Wgrib2 looks for the user defined gribtable in (in order of search) + +

    +   environment varible: GRIB2TABLE
    +   environment varible: grib2table
    +   file: grib2table (in current working directory)
    +
    +   Assuming your user definitions are in a file called "/home/my_name/my_grib2table"
    +
    +   for sh/bash
    +     export GRIB2TABLE=/home/my_name/my_grib2table
    +   and for people who have a broken caps lock key
    +     export grib2table=/home/my_name/my_grib2table
    +
    +   for csh
    +     setenv GRIB2TABLE /home/my_name/my_grib2table
    +   or
    +     setenv grib2table /home/my_name/my_grib2table
    +
    +   You can also always put the user defined gribtable in the "grib2table" in 
    +   the "current working directory".
    +
    + +

    +The user defined gribtable is searched before the built-in gribtable. + +

    Format of the user defined gribtable

    + +
    +   Comments
    +       start with the first column staring with #, *, !
    +       any line that is not a definition line
    +
    +   definitions:
    +       I1:I2:I3:I4:I5:I6:I7:I8:NAME:DESC:UNITS
    +       I1=discipline
    +       I2=master table set: used when using -set_var
    +       I3=master table low:
    +       I4=master table high:
    +            According to WMO, the WMO grib definitions depend on the master table 
    +          (Table 1.0).  For example, a (discipline, parameter category, parameter)
    +          triple may mean different things depending on the master table. Common
    +          sense suggests that you minimize the number of redefinitions.
    +            To conform to WMO, the grib variable definitions are valid for a
    +          range of master table values (I3 and I4).  When setting the variable
    +          name, the master table is set to I2 for that field.
    +
    +          defintion valid for low <= mastertable <= high
    +          want I3 ≤ I2 ≤ I4
    +          must have I2, I3 and I4 in the range of [0..255]
    +       I5=center  (use -1 for a wild card)
    +       I6=local table number
    +       I7=parameter category (code table 4.1)
    +       I8=parameter (code table 4.2)
    +
    +       when a field is not used, use a value of -1
    +       for locally defined fields, I5 (center) must not be -1
    +
    +   all other lines are not used.  Warnings will be given when the number of colons suggest an error. 
    +
    + +

    +For each variable, there is a master table set, low and high. The master table is a master +version number. Each definition has a range of version numbers for which it is recognized. +If you want the variable to defined for all version numbers, set "low" to zero and "high" +to some large positive integer. The "set" value is master table number used when the "-set_var" +option is used change the variable name. +

    + +

    Locally Defined Variables

    +

    The grib2 standard usually allows locally defined variable definitions. +They are defined when the Discipline, or Parameter Category or Parameter Number +ranges from 192-254. When the variable is locally defined, then the +center has to be set (not -1) in the user grib table.. The variable is only +defined for the center. Note: WMO does not not allow the local table to have +a value of zero. + +

    +Locally defined variables: a or b or c
    +  a) Discipline: 192-254
    +  b) Parameter Category: 192-254
    +  c) Parameter Number: 192-254
    +
    + + + + +

    Sample grib2table

    +
    +/*
    + * sample user grib table
    + */
    +/*
    +
    +  struct gribtable_s {
    +    int disc;   /* Section 0 Discipline                                */
    +    int mtab_set;    /* Section 1 Master Tables Version Number used by set_var      */
    +    int mtab_low;    /* Section 1 Master Tables Version Number low range of tables  */
    +    int mtab_high;   /* Section 1 Master Tables Version Number high range of tables */
    +    int cntr;   /* Section 1 originating centre, used for local tables */
    +    int ltab;   /* Section 1 Local Tables Version Number               */
    +    int pcat;   /* Section 4 Template 4.0 Parameter category           */
    +    int pnum;   /* Section 4 Template 4.0 Parameter number             */
    +    const char *name;
    +    const char *desc;
    +    const char *unit;
    +  };
    +
    +*/
    +0:1:0:10:8:0:190:190:TEST1:Critcal Fire Weather:??
    +0:1:0:10:8:0:190:191:TEST2:Dry lightning:??
    +0:1:0:10:0:0:2:2:Utest:utest:m/s
    +
    + + + + + +

    Uses

    +
      +
    1. update tables with new or local variables +
    2. convert the variable names to another convention, language +
    3. change the variable names that are produced by g2ctl +
    4. in the conversion to netcdf, you may want a different set of variable names +
    + +

    Caution

    + +

    +The user-defined grib tables allow you to use your own names for variables. +However, you have to be careful. Suppose you want to define a new variable +name and you didn'r realize the name was already defined for another variable. +Then the inventory could be confusing and the results of -set_var would be +unpredictable. + +

    The option, -ncep_uv, combines the UGRD and VGRD fields into one +grib message. This option will not work when UGRD and VGRD are renamed. + +

    The option, -new_grid, does vector interpolation of vector fields and +scalar interpolation on the other fields fields. The -new_grid option will +not identify the vector fields if their names get changed and scalar +interpolations will be used. The identification of maxx and wind fields +in the Arakawa E grid will also not work. + +

    Add a grib table to wgrib2

    + +

    +To add a grib table to the wgrib2 source code, you need to send a copy of +the grib table in the format shown above to wesley.ebisuzaki@noaa.gov. The +advantage is that you get to test the grib table as a "user defined gribtable" +before finalizing the table. You can submit that grib table as + +

      +
    1. for only the locally defined variables +
    2. for all the variables (local and WMO defined) +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Aug 25, 2015 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/v.html b/docs/web_docs/v.html new file mode 100644 index 0000000..485c11c --- /dev/null +++ b/docs/web_docs/v.html @@ -0,0 +1,196 @@ + + + + Climate Prediction Center - wgrib2: -v, v0, v2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-v +
     
    + +

    wgrib2: -v -v0 -v2

    +
    + + +

    Introduction

    + +

    +Wgrib2 has multiple levels of verbosity. The lowest level (0) is +the default and set by +-v0. The next level is 1 and is set by +-v. Really verbose is set by +-v2. Debugging is set by level 99. +Note that the verbosity can be changed multiple times on +the command line. + +

    Usage

    +

    +

    +-v0
    +-v
    +-v2
    +
    + +

    Example

    +

    +

    +-$ wgrib2 fcst.grb
    +1:4:d=2007032600:HGT:1000 mb:anl:
    +2:422561:d=2007032600:HGT:1000 mb:3 hour fcst:
    +-$ wgrib2 fcst.grb -v
    +1:4:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:anl:
    +2:422561:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:3 hour fcst:
    +-$ wgrib2 fcst.grb -v2
    +1:4:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:anl:
    +2:422561:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:3 hour fcst:
    +
    + + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/v0.html b/docs/web_docs/v0.html new file mode 100644 index 0000000..485c11c --- /dev/null +++ b/docs/web_docs/v0.html @@ -0,0 +1,196 @@ + + + + Climate Prediction Center - wgrib2: -v, v0, v2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-v +
     
    + +

    wgrib2: -v -v0 -v2

    +
    + + +

    Introduction

    + +

    +Wgrib2 has multiple levels of verbosity. The lowest level (0) is +the default and set by +-v0. The next level is 1 and is set by +-v. Really verbose is set by +-v2. Debugging is set by level 99. +Note that the verbosity can be changed multiple times on +the command line. + +

    Usage

    +

    +

    +-v0
    +-v
    +-v2
    +
    + +

    Example

    +

    +

    +-$ wgrib2 fcst.grb
    +1:4:d=2007032600:HGT:1000 mb:anl:
    +2:422561:d=2007032600:HGT:1000 mb:3 hour fcst:
    +-$ wgrib2 fcst.grb -v
    +1:4:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:anl:
    +2:422561:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:3 hour fcst:
    +-$ wgrib2 fcst.grb -v2
    +1:4:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:anl:
    +2:422561:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:3 hour fcst:
    +
    + + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/v1.html b/docs/web_docs/v1.html new file mode 100644 index 0000000..485c11c --- /dev/null +++ b/docs/web_docs/v1.html @@ -0,0 +1,196 @@ + + + + Climate Prediction Center - wgrib2: -v, v0, v2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-v +
     
    + +

    wgrib2: -v -v0 -v2

    +
    + + +

    Introduction

    + +

    +Wgrib2 has multiple levels of verbosity. The lowest level (0) is +the default and set by +-v0. The next level is 1 and is set by +-v. Really verbose is set by +-v2. Debugging is set by level 99. +Note that the verbosity can be changed multiple times on +the command line. + +

    Usage

    +

    +

    +-v0
    +-v
    +-v2
    +
    + +

    Example

    +

    +

    +-$ wgrib2 fcst.grb
    +1:4:d=2007032600:HGT:1000 mb:anl:
    +2:422561:d=2007032600:HGT:1000 mb:3 hour fcst:
    +-$ wgrib2 fcst.grb -v
    +1:4:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:anl:
    +2:422561:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:3 hour fcst:
    +-$ wgrib2 fcst.grb -v2
    +1:4:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:anl:
    +2:422561:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:3 hour fcst:
    +
    + + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/v2.html b/docs/web_docs/v2.html new file mode 100644 index 0000000..485c11c --- /dev/null +++ b/docs/web_docs/v2.html @@ -0,0 +1,196 @@ + + + + Climate Prediction Center - wgrib2: -v, v0, v2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-v +
     
    + +

    wgrib2: -v -v0 -v2

    +
    + + +

    Introduction

    + +

    +Wgrib2 has multiple levels of verbosity. The lowest level (0) is +the default and set by +-v0. The next level is 1 and is set by +-v. Really verbose is set by +-v2. Debugging is set by level 99. +Note that the verbosity can be changed multiple times on +the command line. + +

    Usage

    +

    +

    +-v0
    +-v
    +-v2
    +
    + +

    Example

    +

    +

    +-$ wgrib2 fcst.grb
    +1:4:d=2007032600:HGT:1000 mb:anl:
    +2:422561:d=2007032600:HGT:1000 mb:3 hour fcst:
    +-$ wgrib2 fcst.grb -v
    +1:4:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:anl:
    +2:422561:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:3 hour fcst:
    +-$ wgrib2 fcst.grb -v2
    +1:4:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:anl:
    +2:422561:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:3 hour fcst:
    +
    + + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/var.html b/docs/web_docs/var.html new file mode 100644 index 0000000..09e445d --- /dev/null +++ b/docs/web_docs/var.html @@ -0,0 +1,240 @@ + + + + Climate Prediction Center - wgrib2: -var + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-var +
     
    + +

    wgrib2: -var, -ext_name, -set_ext_name

    +
    + + +

    Introduction

    + +

    In the beginning, grib fields were identified by a name, a level +and some timing information. Life was simple and the people were +happy. This was soon to pass, for the ensemble people had to +specify the ensemble number and the probability of events. +The dust people needed to specify dust density by +composition and by size. Thinking big, ensembles of dust +models were in the future albeit obscured by the haze. +Consequently the old name (ex. HGT, TMP) was often no longer +a good way to specify a specific field. For example, a +TMP field could be measured in degrees K or fraction +if the TMP had a probability modifier. The + -set_ext_name and -ext_name +options are a way to help fix this problem. Using these +two options, you can get a extended name with many of the +modfiers added to the name. This option will have to be +updated when more modifiers are used to distiguish the fields. + + + +

    +The -var option prints the VARIABLE name of +the grib message. Common names would be HGT and TMP for the geopotential +height and the temperature. For most knowing the variable name, +the level and the timimg information is all you need. Then things +became more complicated. Eventually a file came along which had only +one variable type (MASSDEN, mass density) but had a couple of +important qualifier chemical type (H2O/O3/N02) and ensemble member ID. +The -AAIG output was useless because its output +used the variable name. + +

    +To fix the -AAIG output, an extended name +was introduced. You can see the extended name by +the -ext_name option. + + +

    +-sh-2.05b$ ./wgrib2 chem.grb2 
    +1:0:d=2009012600:MASSDEN:surface:anl:ENS=hi-res ctl chemical=Water Vapour
    +-sh-2.05b$ ./wgrib2 chem.grb2 -ext_name
    +1:0:MASSDEN.hi-res_ctl.Water_Vapour
    +-sh-2.05b$ ./wgrib2 chem.grb2 -misc 
    +1:0:ENS=hi-res ctl:chemical=Water Vapour
    +
    + +The extended name takes the output of -misc, +changes the colons to periods, spaces to underscores and removes the +text up to the equal size and appends it to the variable name. As of +wgrib2 v1.9.0, the extended name is used with +-AAIGc, -csv, and -netcdf. +To stop using the extended name in -AAIG, -csv and -netcdf, use the option +-set_ext_name 0. + + + +

    Usage

    + +
    +-ext_var
    +-set_ext_name 0/1
    +-var
    +
    + +

    Examples

    + +
    +-sh-2.05b$ ./wgrib2 chem.grb2 -var
    +1:0:MASSDEN
    +-sh-2.05b$ ./wgrib2 chem.grb2 -ext_name
    +1:0:MASSDEN.hi-res_ctl.Water_Vapour
    +
    + + + +See also: +-s, +-varX +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/varX.html b/docs/web_docs/varX.html new file mode 100644 index 0000000..5a031b5 --- /dev/null +++ b/docs/web_docs/varX.html @@ -0,0 +1,252 @@ + + + + Climate Prediction Center - wgrib2: -varX + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -varX +
     
    + +

    wgrib2: -varX

    +
    + + +

    Introduction

    + +

    +The -varX option writes a raw variable name. It +shows the discipline, master table, local table, center, parameter category +and parameter number. The default format is +

    + +
    +var{discipline}_{master table}_{local table}_{center}_{parameter_category}_{parameter}
    +
    +ex.  var0_10_1_57_1_51
    +       discipline = 0
    +       master table = 10
    +       local table = 1
    +       parameter category = 1
    +       parameter = 51
    +
    + +When you use verbose mode > 0 (-v, -v2, -v98, -v99), then the format +of -varX changes to + + +
    +(WMO defined variables)
    +
    +ex. var discipline=0 master_table=2 parmcat=2 parm=3
    +
    +For locally defined variables, the local table is important and the format is
    +
    +ex.  var discipline=0 local_table=1 center=7 parmcat=1 parm=195
    +
    + +One would use the -varX option when +the built-in tables have a problem. For example, suppose SGP +is a new parameter this is not in your version of wgrib2. +However, you want to write a script that will extract SGP +and work with both the +old and future versions of wgrib2. By using +-varX, your inventories will have a variable +name that is the same in both versions of wgrib2. The varX name +has been added to the match_inventory (2.0.2 3/2015) and is +understood by -set_var and -set_metadata (2.0.7 12/2017). + + +

    Usage

    + +

    +

    +-varX
    +
    + +

    Example

    +

    + +

    +$ wgrib2 test.grb2 -varX
    +1:0:var0_2_1_7_3_5
    +
    + +

    +See also: -var +

    + + + + + + + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page May 15, 2005, updated Jan 28, 2018 +
    + + + +

    +See also: -undefine +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/vector_dir.html b/docs/web_docs/vector_dir.html new file mode 100644 index 0000000..f1e1ca5 --- /dev/null +++ b/docs/web_docs/vector_dir.html @@ -0,0 +1,215 @@ + + + + Climate Prediction Center - wgrib2: -vector_dir + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-vector_dir +
     
    + +

    wgrib2: -vector_dir

    +
    + + +

    Introduction

    + +

    +Bit 5 of the flag 3.3 indicates whether vector quantities are relative to the +grid or the North/South poles. +The -vector_dir option writes out "winds(N/S)" or "winds(grids)" +depending on the value of the flag. Note there is no flag that indicates whether +the quantity is a U/V component of a vector. + + +

    Usage

    +

    + +

    +-vector_dir
    +
    + +

    Example

    +

    + +

    +$wgrib2 png.grb2 -vector_dir
    +1:4:winds(N/S)
    +
    + +

    +See also: +

    + + + + + + + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/verf.html b/docs/web_docs/verf.html new file mode 100644 index 0000000..ad31c5c --- /dev/null +++ b/docs/web_docs/verf.html @@ -0,0 +1,187 @@ + + + + Climate Prediction Center - wgrib2: -s -verf + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -s -verf +
     
    + +

    wgrib2 macros: -s -verf -V

    +
    + + +

    Introduction

    + +

    +The -s, +-verf +and -V +options are really macros +which are defined in the Macro.c file. The -s option is special because if there is no +"inv" option used, wgrib2 will add a -s option to the end of the argument list. + + +

    Usage

    +

    + +

    +-s
    +      equivalent to -t -var -lev -ftime -ens
    +
    +-verf
    +      equivalent to -vt -var -lev -ftime -ens
    +
    +-V
    +      equivalent to -vt -lev -ftime -var -ens -stats -grid
    +
    +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/version.html b/docs/web_docs/version.html new file mode 100644 index 0000000..4df5c4f --- /dev/null +++ b/docs/web_docs/version.html @@ -0,0 +1,186 @@ + + + + Climate Prediction Center - wgrib2: -version + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-version, --version +
     
    + +

    wgrib2: -version, --version

    +
    + + +

    Introduction

    + +

    +The -version option prints the version, release date +and people who contributed code. The alias, +--version, was added 5/2016. + +

    Usage

    +

    + +

    +-version
    +--version
    +
    + +

    Example

    +
    +$ wgrib2 -version
    +v0.1.7.7h-beta2 11/2008 Wesley Ebisuzaki, Jaakko Hyvätti, Kristian Nilssen
    +Karl Pfeiffer, Manfred Schwarb, Arlindo da Silva, Niklas Sondell, Sergey
    +Varlamov
    +
    + + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/vt.html b/docs/web_docs/vt.html new file mode 100644 index 0000000..f39ee5a --- /dev/null +++ b/docs/web_docs/vt.html @@ -0,0 +1,199 @@ + + + + Climate Prediction Center - wgrib2: -t -T -vt -VT + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -t -T -vt -VT +
     
    + +

    wgrib2: -t -T -vt -VT

    +
    + + +

    Introduction

    + +

    +The -t -T -vt -VT options prints various time flags. +The -t -T prints the reference time +and -vt -VT prints the verification time. +The capitalized versions print the time with the seconds +and the lower case options print the time with out the seconds. +In conjuntion with -v2 verbose mode, the +format of the time will change to be GrADS compatible. + +

    Usage

    +
    +-t
    +-T
    +-vt
    +-VT
    +
    + +

    Example

    +

    + +

    +$ wgrib2 g720_360.grb2 -t
    +1:4:d=2009010100
    +$ wgrib2 g720_360.grb2 -t -v2
    +1:4:00Z01jan2009
    +$ wgrib2 g720_360.grb2 -T
    +1:4:D=20090101000000
    +$ wgrib2 g720_360.grb2 -vt
    +1:4:vt=2009010600
    +$ wgrib2 g720_360.grb2 -vt -v2
    +1:4:00Z06jan2009
    +$ wgrib2 g720_360.grb2 -VT
    +1:4:vt=20090106000000
    +
    + +See also: +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2_dev.html b/docs/web_docs/wgrib2_dev.html new file mode 100644 index 0000000..b6488fe --- /dev/null +++ b/docs/web_docs/wgrib2_dev.html @@ -0,0 +1,204 @@ + + + + Climate Prediction Center - wgrib2 dev + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 dev +
     
    + +

    Developing wgrib2 code

    +
    + + + +

    Types of wgrib2 development

    +
    + +

    +There are 3 categories of wgrib2 development. +

      +
    1. Core development: ex grib encoders, geolocation, the "wgrib2" machine +
    2. Options: creating new wgrib2 options, can involve some core development +
    3. Interfaces for other languages to call the wgrib2 library. +
    + +

    Core Development

    + +

    +This type of development is the most critical to get right because +it can affect all uses of wgrib2. Typical changes to the core would +be a new table, new compression scheme or updating the grib variable table. +Send changes directly to wesley.ebisuzaki@noaa.gov. + +

    Options

    +Options are are not as critical as the core because problems in a +new or modified option are usually limited to that option. Consequently +options can have an alpha or beta status independant of wgrib2. + +

    Options can be added quite easy. You add the source code of the option to +the directory with the other options, and build wgrib2. The build +system integrates the option into wgrib2. +Writing options requires you to follow some rules but once you +learn the rules, it is easy. That is why wgrib2 has over 300 options. + +

    More details are given here + + +

    Allowing external programs to use wgrib2

    + +fortran: ftn_wgrib2api
    +python: pywgrib2_s
    +Developting code that uses libwgrib2 +

    + + +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Sep 16, 2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2_hello_world.html b/docs/web_docs/wgrib2_hello_world.html new file mode 100644 index 0000000..478bd7e --- /dev/null +++ b/docs/web_docs/wgrib2_hello_world.html @@ -0,0 +1,208 @@ + + + + Climate Prediction Center - wgrib2 dev - hello world + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 dev +
     
    + +

    Hello World as an option

    +
    + +

    +The file, Hello_world.c, is the source code for a wgrib2 option +that prints "hello world", the size of grid, and the contents of +a user-selected grid point. To install this option, you +copy Hello_world.c to (whatever)/grib/wgrib2/ and then build wgrib2. + + + +

    Hello_world.c

    + + +
    +#include <stdio.h>
    +#include <stdlib.h>
    +#include <string.h>
    +#include "wgrib2.h"			needed
    +#include "fnlist.h"                     needed
    +
    +/*
    + * HEADER:100:hello_world:inv:1:print hello world and data[x]   HEADER SECTION
    + */HEADER:display number:name:type:num args:description
    +
    +extern int decode;
    +
    +int f_hello_world(ARG1) {     option is hello_world with one argument
    +    long int i;
    +
    +    if (mode == -1) {
    +        // open files, allocate memory, request services
    +        decode = 1;	      have wgrib2 decode the grid values
    +    }
    +    else if (mode >= 0) {     verbosity when ≥ 0
    +        // processing phase
    +        i = atol(arg1);
    +        if (data && i < ndata && i >= 0) {
    +            sprintf(inv_out,"hello world ndata=%u data[%ld]=%f",
    +                ndata, i, data[i]);
    +        }
    +        else sprintf(inv_out,"hello world no data");
    +
    +    }
    +    else if (mode == -2) {
    +        // close files, free memory
    +    }
    +    return 0;
    +}
    +
    +Navigation: back +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page created Nov 5, 2020. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2_memory.html b/docs/web_docs/wgrib2_memory.html new file mode 100644 index 0000000..f17783b --- /dev/null +++ b/docs/web_docs/wgrib2_memory.html @@ -0,0 +1,251 @@ + + + + Climate Prediction Center - wgrib2api: grb2_free_file + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api: memory buffers/files +
     
    + +

    wgrib2api: memory buffers/files

    +
    + + +

    Introduction

    +

    +Wgrib2api can be used to read from and write to grib files which +is great for non-HPC applications. For HPC, you want to parallelize the +encoding and decoding of the grib messages. This can be done +using memory buffers (memory files in wgrib2 terminology) instead of disk files. +As a practical matter, wgrib2api does not support filelocks and only one +instance of wgrib2api should be allowed to write to any disk file. Instead +you have to use memory files where each instance of wgrib2api has its own independent +copy of the memory files. For example, +writing the inventory to memory file 0 can be done by, + + +

    +   i = grb2_mk_inv('MYDATA.GRB', '@mem:0')         ! write index/inventory memory file 0
    +
    + + +Suppose that you want to copy grib data to memory file 0, create an +inventory using memory file 1 and then read the Z500 field from memory +file 0. The code segment will go like, + + +
    +    use wgrib2api
    +    real, allocatable :: grid(:,:)
    +
    +!   character (len=1) buff(1000000)
    +!   buff contains a grib message
    +
    +!   copy buff to memory buffer/file 0
    +    i = wgrib2_set_mem_buffer(buf, 1000000, 0)
    +    if (i.ne.0) stop 1
    +
    +    i = grb2_mk_inv('@mem:0', '@mem:1')
    +    if (i.ne.0) stop 2
    +
    +    i = grb2_read('@mem:0', '@mem:1', ':HGT:500 mb:', data2=grid)
    +    if (i.ne.1) stop 3
    +
    +    write(*,*) ' read Z500 from buf(*) z(20,20)=', grid(20,20)
    +    stop
    +    end
    +
    +
    + +You can encode grib to a memory file by, + +
    +    use wgrib2api
    +    real, allocatable :: grid(:,:)
    +    character, (len=1), allocatable :: buffer(:)
    +
    +    nx=360
    +    ny=181
    +    allocate(grid(nx,ny))
    +    read(11) grid
    +    i = grb2_wrt('@mem:0','TEMPPLATE.grb',1,data2=grid,meta='D=20170102030000:HGT:500 mb:anl:')
    +    if (i .ne. 0) stop 1
    +    n = wgrib2_get_mem_buffer_size(0)
    +    allocate (buffer(n))
    +    i = wgrib2_get_mem_buffer(buffer, n, 0)
    +
    +
    + +

    Usage

    +
    +   SIZE = wgrib2_get_mem_buffer_size(FILE_NUM)
    +       returns the size of memory file '@mem:FILE_NUM'
    +       FILE_NUM:   integer, memory file number, 0..19
    +       SIZE:       integer, size of memory buffer
    +
    +   i = wgrib2_get_mem_buffer(BUFFER, SIZE, FILE_NUM)
    +       copies memory file '@mem:FILE_NUM' to BUFFER(1:SIZE)
    +       BUFFER:     character (len=1) BUFFER(1:SIZE), read from memory file
    +       SIZE:       integer size to transfer, use get_mem_buffer_size(FILE_NUM)
    +       FILE_NUM:   integer, memory file number
    +       i:          integer, return code, 0 = worked
    +
    +   i = wgrib2_set_mem_buffer(BUFFER, SIZE, FILE_NUM)
    +       copies BUFFER to memory file '@mem:FILE_NUM'
    +       BUFFER:     character (len=1) BUFFER(1:SIZE), write to memory file
    +       SIZE:       integer size to transfer
    +       FILE_NUM:   integer, memory file number
    +       i:          integer, return code, 0 = worked
    +
    +

    Wgrib2api is made of a high level (grb2_*) functions +and low_level functions. The low level routines can be +found in wgrib2lowapi and are named wgrib2_*. + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 13, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2_options.html b/docs/web_docs/wgrib2_options.html new file mode 100644 index 0000000..dff163b --- /dev/null +++ b/docs/web_docs/wgrib2_options.html @@ -0,0 +1,279 @@ + + + + Climate Prediction Center - wgrib2 dev options + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 dev +
     
    + +

    Developing wgrib2 code

    +
    + + + +

    Writing Options

    +
    + +

    +Every programming book has a "hello world" program. It's +there to give you a flavor of the language and show the +reader that writting a program is not hard. + +

    +Adding -hello_world + + +

    Ruiles

    + +
      +
    1. C source code file name must start with a capital. +
    2. Option has to have a Header section, and specific includes. +
    3. Option routine has to have a specific name and arguments. +
    4. Static variables for the option routine have to be done in a special way. +
    5. option routine is called before processing with mode == -1 for initialization. +
    6. option routine is called for each grib field with mode >= 0 (mode = verbosity) +
    7. option is called after before processing with mode == -2 for cleanup. +
    8. I/O is done differently to handle memory files and other special files. +
    9. extra processing such a decoding the grib message has to be requested by the option. +
    + +

    HEADER

    + +

    The build system uses wgrib2/function.sh to scan for +all C source files starting with an upper case. Function.sh +looks for lines starting with "/* HEADER:", can then +gnerates wgrib2/fnlist.c and wgrib2/fnlist.h which +contains a list of all the options and the prototypes. +Wgrib2, when it "compiles" the command line, will search +the list to find the number of arguments and location of +the option code. The fields in the HEADER line are + +

    +/* HEADER:NUM:OPTION:TYPE:NARGS:TXT
    +   NUM = integer for determining whether shown in -h
    +         in the future, it may be used for sorting list of options
    +   OPTION = string, the name of the option
    +            note: the option function is named f_OPTION
    +   TYPE = string, type of option    see enum fntype in wgrib2.h
    +          inv = write to inventory
    +          output = write to an output file
    +          setup = change setup (only called in the initialization phase)
    +          misc = not one of the above
    +          IF = if type option
    +          Else = Else option
    +          Elseif =  elseif type option
    +          Endif = endif option
    +          Null = nothing
    +          misc = not one of the above
    +   NARGS = integer, number of arguments the option takes
    +   TXT = string, description of the option
    +
    + +

    C option code

    + +

    +Wgrib2 assumes that the option will be + +

    +int f_OPTION(ARGN) {
    +   ...
    +   return status
    +}
    +
    +   ARGN = ARG0 (no argument)
    +          ARG1 (one argument)
    +          ..
    +          ARG8 (eight arguments)
    +   status == 0 if sucessful
    +          != 0 if error
    +
    +
    + +

    Arguments to f_OPTION

    + +

    +The argument to f_OPTION is ARGN which is defined in wgrib2.h. +ARGN provides +

    +    unsigned char **sec;   grib message
    +    float *data;           decoded grid point values (if an option requests it)
    +    unsigned int ndata     number of grid points
    +    char *inv_out          buffer that will be printed to inventory
    +    void **local           used for static variables
    +
    + + +

    Static variables

    + +

    +C and fortran allow functions to have static variables but +each static variable unique to that function. +Wgrib2 allows the same option to be repeated many times on +the command line. For example, + +

    +  wgrib2 in.grb -lon 0 0 -lon 10 12 -lon 22 -49
    +    calculate nearest neighbor once for each call to f_lon
    +  wgrib2 in.grb -if ':HGT:' -bin H.grb -else -bin rest.grb -endif
    +    open file once
    +  wgrib2 in.grb -if ":HGT:500 mb:' -fcst_ave 6hr z500.grb -elseif ":TMP:500 mb:" -fcst_ave 6hr t500.grb -endif
    +
    + +So each option on the command line may need to have its own static variables. +So the static variables provided by C are insufficient. Wgrib2 calls each +option with a unique pointer that the can be used by the option to provide +static variables. + + + +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Sep 16, 2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2_scripts.html b/docs/web_docs/wgrib2_scripts.html new file mode 100644 index 0000000..447a633 --- /dev/null +++ b/docs/web_docs/wgrib2_scripts.html @@ -0,0 +1,187 @@ + + + + Climate Prediction Center - wgrib2 script library + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 library +
     
    + +

    wgrib2 script library

    +
    + + +

    Introduction

    + +

    +Embedding wgrib2 into scripts is useful for a couple of reasons, + +

      +
    1. use wgrib2 as building block +
        +`
      • grib reader for other programs (ex matlab) +
      • grib writer for other programs (ex GrADS) +
      • extracting metadata (ex. making control files for GrADS) +
      • processing files (ex. NOMAD's g2subset) +
      +
    2. Special wgrib2 processing needs to process the grib data in a special order +
        +
      • -wnd_speed needs (U,V) (U,V) (U,V) order +
      • -ave needs (A0..An) (B0..Bn) (C0..Cn) .. order +
      • -merge_fcst needs (A0..An) (B0..Bn) (C0..Cn) .. order +
      • -ncep_norm needs (A0..An) (B0..Bn) (C0..Cn) .. order +
      • -wind_speed needs (A0..An) (B0..Bn) (C0..Cn) .. order +
      • -ncep_norm needs (A_t0, A_t1, .. A_tn) (B_t0, B_t1, .. B_tn) .. order +
      • -wind_speed needs (U,V) (U,V) (U,V) order +
      • -new_grid (U,V) (U,V) (U,V) order +
    +

    Building block scripts

    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: May 15, 2005 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2_utility_callable.html b/docs/web_docs/wgrib2_utility_callable.html new file mode 100644 index 0000000..fca3f97 --- /dev/null +++ b/docs/web_docs/wgrib2_utility_callable.html @@ -0,0 +1,244 @@ + + + + Climate Prediction Center - wgrib2: callable_wgrib2 vs utility + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 utility vs library +
     
    + +

    Callable wgrib2 vs utility

    +
    + + +

    Introduction

    + +

    +Wgrib2 can either be used as a utility or as library which can be called +by a C, Fortran or Python programs. This wgrib2 library is a high +level interface, for grib encoding and decoding based on the wgrib2 utility. +To avoid being I/O bound, the calling program can read and +write the RPN registers as well as the memory files through library +routines. There are some differences between wgrib2 the utility and +the library. The differences are based on the persistance or lifetime +of objects. + +

    Opening and Closing of files is slow

    + +Needless opening and closing of files can be time consuming. To a PC with +a SSD directly connected to the system bus, it is fast. + + +Open Files are not closed + +Suppose a Python program did the following, + +
    + err = pywgrib2_s.wgrib2( ['gfs.grb', '-match', ':HGT:500 mb:',  '-grib' , 'out.grb' ] )
    + err = pywgrib2_s.wgrib2( ['gfs.grb', '-match', ':HGT:200 mb:',  '-grib' , 'out.grb' ] )
    +
    +On the first line, the files 'gfs.grb' and 'out.grb' are opened but not closed when the
    +first line is finished. If the first line will take all messages that match ':HGT:200 mb:"
    +and write them to 'out.grb'.
    +
    +The second line, uses the already opened files 'gfs.grb' and 'out.grb'.  The intent
    +was to copy the 200 mb HGT fields to 'out.grb', but the line does nothing.  The problem
    +was the first line opened 'gfs.grb', and left the file pointer at the end of the file.
    +The correct solution is,
    +
    + err = pywgrib2_s.wgrib2( ['gfs.grb', '-match', ':HGT:500 mb:',  '-grib' , 'out.grb' ] )
    + err = pywgrib2_s.wgrib2( ['gfs.grb', '-rewind_init', 'gfs.grb', '-match', ':HGT:200 mb:',  
    +        '-grib' , 'out.grb' ] )
    +
    +The equivalent wgrib2 commands are
    +
    +   wgrib2 gfs.grb -match ':HGT:500 mb;' -grib out.grb
    +   wgrib2 gfs.grb -match ':HGT:200 mb;' -append -grib out.grb
    +
    +You can get the equivalent in python by closing the files after every call to wgrib2
    +
    + err = pywgrib2_s.wgrib2( ['gfs.grb', '-match', ':HGT:500 mb:',  '-grib' , 'out.grb' ] )
    + err = pywgrib2_s.close('gfs.grb')
    + err = pywgrib2_s.close('out.grb')
    + err = pywgrib2_s.wgrib2( ['gfs.grb', '-match', ':HGT:200 mb:',  '-append', '-grib' , 'out.grb' ] )
    + err = pywgrib2_s.close('gfs.grb')
    + err = pywgrib2_s.close('out.grb')
    +
    +This is not a recommended solution because opening and closing files is time consuming.
    +
    + + +

    +Besides "rewinding" input files by the -rewind_init option, you have to be aware +the output files are not completely written until the file is closed or the program ends. +The final writes to the output file may still be in a buffer until the file is flushed by +closing of the file. Th exception is the memory file. The write to a memory file +is not buffered, so the memory file is complete after the write. However, the +write to a memory file leaves the file pointer at the end of the file. To read +the memory file, you have to do a -rewind_init. + +

    + err = pywgrib2_s.wgrib2( ['gfs.grb', '-match', ':HGT:500 mb:',  '-grib' , 'out.grb' ] )
    + err = pywgrib2_s.close('out.grb) 
    + err = pywgrib2_s.wgrib2( ['out.grb', '-rpn', 'sto_1'] )
    +
    +line 1 write 500 mb HGT to 'out.grb'
    +line 2 closes 'out.grb' and finishes any pending writes
    +line 3 read 'out.grb' and stores the values in register 1
    +
    + err = pywgrib2_s.wgrib2( ['gfs.grb', '-match', ':HGT:500 mb:',  '-grib' , '@mem:0' ] )
    + err = pywgrib2_s.wgrib2( ['@mem:0', '-rewind_init', '@mem:0', '-rpn', 'sto_1'] )
    +
    +line 1 write 500 mb HGT to memory file 0, write is not buffered
    +line 2 reads from memory file 0, does a rewind prior to reading, stores values in register 1
    +
    +

    +See also: +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: July 10, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2_v3.0.0_changes.html b/docs/web_docs/wgrib2_v3.0.0_changes.html new file mode 100644 index 0000000..c944f4a --- /dev/null +++ b/docs/web_docs/wgrib2_v3.0.0_changes.html @@ -0,0 +1,205 @@ + + + + Climate Prediction Center - wgrib2: Changes with v3.0.0 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 Changes with v3.0.0 +
     
    + +

    wgrib2: V3.0.0

    +
    + + +

    Changes from wgrib2 v2.0.8 to v3.0.0

    + +

    +Wgrib2 gets a new numbering convention (XX.YY.ZZ). + +

    +   new wgrib2 numbering convention XX.YY.ZZ
    +
    +   XX = incremented with major source code changes (infrequently)
    +   YY = incremented with software code changes (approximately yearly releases)
    +   ZZ = incremented with minor code releases
    +
    +

    +Normally wgrib2 gets updated annually. It ususally takes +that long to get enough updates to make it worthwhile for an upgrade. Of course, +some users may need that latest feature and need the latest ZZ release. The +schedule of the annual releases can vary widely. The expected Feb 2020 release +was delayed to September 2020 to incorporate a python interface. + +

    Hightlights for v3.0.0

    + +

    The upgrade from v2.0.8 was deemed a major release because +of the new IF-block structure and the shared library for python. +Scripts written with the new IF block structure are not downward +compatible, and I think that the python interface is a big deal. + +

      +
    • A real if/elseif/else/endif structure +
    • -import_grib_fs, import grib2 that matches a text string +
    • -new_grid location, interpolate to specified locations +
    • -new_grid_format: can write interpolated fields to grib, binary or ieee +
    • support of AOCC (AMD Optimizing C Compiler), based on clang/flang +
    • updated grib variable table +
    • fixed and increased functionality of -import_netcdf +
    • -ens_processing: do not use v2.0.8, major problem with some versions of gcc +
    • added spectral interpolation to -new_grid +
    • support making shared library (gnu compilers under linux and MacOS) +
    • support for python interface (linux, MacOS) +
    + + + +Wesley Ebisuzaki, 5/4/2020, revised 9/22/2020, 11/13/2020 + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page dates: May 4, 2020, modified 9/2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2_v3.0.2_changes.html b/docs/web_docs/wgrib2_v3.0.2_changes.html new file mode 100644 index 0000000..de22fd4 --- /dev/null +++ b/docs/web_docs/wgrib2_v3.0.2_changes.html @@ -0,0 +1,216 @@ + + + + Climate Prediction Center - wgrib2: Changes with v3.0.2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 Changes with v3.0.2 +
     
    + +

    wgrib2: v3.0.2

    +
    + + +

    Changes from wgrib2 v3.0.0 to v3.0.2

    + +

    +Note that the file server (ftp.cpc.ncep.noaa.gov) had the wrong files for v3.0.1. The +source code was for a older beta version. So wgrib2 v3.0.1 has been erased +from history. Wgrib2 v3.0.2 is basically v3.0.1 plus with a minor upgrade to +"extended names". The extended names can now optionally include the level and +and forecast time information. This change allows -netcdf to produce unique +variable names for fields that previously would have had the same name. + +

    +Wgrib2 v3.0.2 is a minor upgrade to v3.0.0. Rather than accumulating +updates and new features for 12+ months, v3.0.1 is a relatively quick update +that is needed for gnu make v4.3, and for providing initial python support +on Windows (pywgrib2, cygwin). So that was the plan. + +

    I had deferred adding D Jovic's code for using the OpenJPEG +library for supporting jpeg2000 until the release of wgrib2 v3.0.0. It +is now a compile time option. + +

    M Schwarb sent me scripts that would read the ECMWF grib tables +from the web +and convert them to a format suitable for wgrib2. This lead to adding +the -names option and adding the DWD grib tables. Of course, +a wgrib2 update is not finished unless there several new options. + +

    G Trojan worked on the fatal error handler, and that +resulted in the removal of several routines, and cleaner code. + +

    Delayed fatal errors were added. This allows wgrib2 to flag an error, +and error out at the end of processing of the grib message. This +allows the user to "debug" the grib message which caused the fatal error. +In addition, delayed fatal errors can be converted to warnings. + +

    For python, wgrib2 has options to read and write grib sections. + +

    New compilers, means new warning and error messages. Fixed +an error that would be triggered if your keyboard generated characters +with the high bit (128) set and your compiler defines char as signed char. + +

    Added support for Nvidia compilers from the Nvidia HPC SDK for building +the wgrib2 executable and shared library. Previous +versions of the Nvidia compilers (old branding: Portland) had problems +compiling wgrib2. + +

    Added support for AOCC to compile a shared library for pywgrib2. + +

    Added support for cygwin (Windows) to compile a shared library for pywgrib2. +Unfortunately the shared library does not support jpeg2000 or png compression +because they use the zlib which refers to an undefined routine. + +

    Fixed -new_grid with interpolation ot user-specified locations. I +forgot to set the discpline of GEOLAT/GEOLON. + +

    An update to ncep grib tables. +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page dates: 2/17/2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2_v3.1.0_changes.html b/docs/web_docs/wgrib2_v3.1.0_changes.html new file mode 100644 index 0000000..7990396 --- /dev/null +++ b/docs/web_docs/wgrib2_v3.1.0_changes.html @@ -0,0 +1,186 @@ + + + + Climate Prediction Center - wgrib2: Changes with v3.0.3 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 FUTURE Changes with v3.0.3 +
     
    + +

    wgrib2: v3.1.0

    +
    + + +

    Future Changes from wgrib2 v3.0.2 to v3.1.0

    + +
      Big changes .. many inventory changes +
    1. wgrib2 upto v3.0.2 used NCEP web pages for table descriptions (scripts by M. Schwarb) +
    2. wgrib2 v3.1.0+ uses the WMO github for table descriptions (except field names) (scripts by M. Schwarb) +
    3. updated NCEP, ECMWF and DWD field names +
    4. old inv: :(chemical name): new inv: :chemical=(chemical name): +
    5. old inv: :process (number): new inv: :process=(number): +
    6. previous two changes are to make inventory consistent with -set_metadata +
    7. more compatibility for -set_metadata (wgrib2 file >inv; wgrib2 file -set_metadata inv) +
    + +
      Fix for PNG decoder +
    1. Can now handle PNG compressed grib files that use a bit depth of 1, 2 and 4 +
    2. previously library could only handle 8 and 16 bit depths +
    + +
      Other Changes +
    1. Public release source code, wgrib2.tgz, is now compatible with a BSD-varient tar +
    2. -reset_delayed_error: remove writes to stdout +
    3. -ndates: removed limit on size of output +
    4. nearest neighbor for global Gaussian grid is now a calculation rather than search +
    5. bug fix in -import_grib and -import_grib_fs when main input is an incorrectly encoded NCEP constant field,
      + the message read by -import_grib and -import_grib_fs will be incorrectly fixed. +
    +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page dates: 4/26/2021 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2_v3.1.1_changes.html b/docs/web_docs/wgrib2_v3.1.1_changes.html new file mode 100644 index 0000000..2f58a24 --- /dev/null +++ b/docs/web_docs/wgrib2_v3.1.1_changes.html @@ -0,0 +1,220 @@ + + + + Climate Prediction Center - wgrib2: Changes with v3.0.3 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 FUTURE Changes with v3.0.3 +
     
    + +

    wgrib2: v3.1.1

    +
    + + +

    Changes from wgrib2 v3.1.0 to v3.1.1

    + +

    Wgrib2 v3.1.1 is a minor release that addresses problems with + +

      +
    1. check_pdt_size causes fatal error for some ECMWF and ICON files
      +work around for older versions: -check_pdt_size 0 +
    2. -unix_time fails with new glibc (random failures)
      +work around for older versions: $TZ should not be UTC, or a daylight saving time +
    + +
      Highlights +
    1. fixed check_pdt_size: added more PDTs, support for vertical coordinates +
    2. fixed and updated: -unix_time failed with new glibc +
        +
      • -unix_time: converted from posix to C89 code, and no longer optional +
      • -set_date: now understands unix time (seconds after start of Jan 1, 1970) +
      • -import_netcdf: display unix time codes in YYYYMMDDHH(mmss) format +
      • many minor changes +
      +
    3. ECMWF ensemble files: if code table 4.7 undefined, set to reasonable value +
    4. -set_pdt: major changes, handles more PDTs, much better +
    5. Early testing of Netcdf4 compiled with Ubuntu 20.04LTS is promising. +
    +

    Future Changes for wgrib2 v3.1.2

    +

    +Added better support for grids up to 2**32-1 (4,294,967,295) +grid points. This endeavor started in 2016. Progress +started slowly because of the lack of large-memory machines and urgency. +However, I received my first bug report about the 4G problem. +

    +Cmake is required for latest libaec. So the makefile is now +cmake aware. You can build wgrib2 without cmake but you will not be +able to install libaec or OpenJPEG. +

    +The parallelization of the uncompressing of complex-compressed files +was improved. Decoding of the GFS master file went from 14 seconds +to 9 seconds on a 6-core ryzen 5600g cpu using a nmve drive. Unfortunately +the speed was slow and unimproved on a Luster file system. +

    +Previous versions of wgrib2 handled non-spherical Lambert Azimuthal Equal Area Projection +using a spherical earth. Now this projection is handled by proj4 which means that +proj4 is now installed by default. +

    +The geolocation tag (-geolocation) is better defined (external added). Output is +changed from "XYZ" to "geolocation=XYZ". +

    +Alpha: USE_NETCDF4 redefined and USE_HDF5 added. The change +allows linking to precompiled NetCDF/HDF5 libraries. +

    +Alpha: compiling with Intel's oneAPP icx and ifx compilers. +Icx had a problem executing one OpenMP loop. Either +the loop is incorrect and several compilers have been +accidently generating "correct" code for years, or icx is +silently generating bad code. Anyways this is why wgrib2 +compiled by icx/ifx is considered alpha status. +

    +Update for local JMA product definition templates. + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page dates: 4/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2_v3.1.2_changes.html b/docs/web_docs/wgrib2_v3.1.2_changes.html new file mode 100644 index 0000000..01efff9 --- /dev/null +++ b/docs/web_docs/wgrib2_v3.1.2_changes.html @@ -0,0 +1,262 @@ + + + + Climate Prediction Center - wgrib2: Changes with v3.1.2 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 FUTURE Changes with v3.0.3 +
     
    + +

    wgrib2: v3.1.2

    +
    + + +

    Changes from wgrib2 v3.1.1 to v3.1.2

    +

    Wgrib2 v3.1.2 is a minor release.

    + +

    +Added better support for grids up to 2**32-1 (4,294,967,295) +grid points. This endeavor started in 2016. Progress +started slowly because of the lack of large-memory machines and urgency. However, I received my first bug report about the 4G problem. +

    +The makefile is now CMake aware. Without CMake, you will not +be able to install libaec or OpenJPEG. Previously CMake was +not necessary but libaec and OpenJPEG would only work on +intel/amd machines. +

    +The parallelization of the uncompressing of complex-compressed files +was improved. Decoding of the GFS master file went from 14 seconds +to 9 seconds on a 6-core ryzen 5600g cpu using a nmve drive. Unfortunately +the speed was slow and unimproved on a Luster file system. +

    +Previous versions of wgrib2 handled non-spherical Lambert Azimuthal Equal Area Projection +using a spherical earth. Now this projection is handled by proj4 which means that +proj4 is now installed by default. +

    +The geolocation tag (-geolocation) is better defined (external value was added). Output is +changed from "XYZ" to "geolocation=XYZ". +

    +Alpha: USE_NETCDF4 redefined and USE_HDF5 added. The change +allows linking to precompiled NetCDF/HDF5 libraries. +

    +Alpha: compiling with Intel's oneAPP icx and ifx compilers. +Icx had a problem executing one OpenMP loop. Either +the loop is incorrect and several compilers have been +accidently generating "correct" code for years, or icx is +silently generating bad code. Anyways this is why wgrib2 +compiled by icx/ifx is considered alpha status. +

    +Update for local JMA product definition templates. + +

    Fixes for v3.1.2 #1

    +

    +

    +USE_SHARED_LIB=1   fails, need to modify grib2/makefile
    +
    +----- old grib2/makefile
    +${zlib}:        ${zdir}
    +        # cd ${zdir} && export CFLAGS="${wCPPFLAGS}" && ./configure --prefix=${cwd} --static && ${MAKE} install
    +        cd ${zdir} && export CFLAGS="" && ./configure --prefix=${cwd} --static && ${MAKE} install
    +----- fixed grib2/makefile
    +${zlib}:        ${zdir}
    +        cd ${zdir} && export CFLAGS="${wCPPFLAGS}" && ./configure --prefix=${cwd} --static && ${MAKE} install
    +        # removed 3/2023 cd ${zdir} && export CFLAGS="" && ./configure --prefix=${cwd} --static && ${MAKE} install
    +------
    +
    +This is plain old fashioned bug that only affects wgrib2 v3.1.2. It is +a fix that didn't fix anything. + +

    Fixes for v3.1.2 #2

    +

    +

    +Proj fails to build using gcc on MacOS. Need to compile proj4 without -ffast-math
    +
    +----- old grib2/makefile
    +ifeq (${COMP_SYS},gnu_linux)
    +   wCPPFLAGS+=-Wall -Wmissing-prototypes -Wold-style-definition -Werror=format-security -ffast-math -O3
    +----- new grib2/makefile
    +ifeq (${COMP_SYS},gnu_linux)
    +   wCPPFLAGS+=-Wall -Wmissing-prototypes -Wold-style-definition -Werror=format-security -O3
    +------
    +
    +Usually fast-math only has minor impacts on the precision. However the differences +were enough to trigger the Proj validation routines. Wgrib2 v3.1.2 turn off fast-math. + +

    Fixes for v3.1.2 #3

    +

    +

    +OpenJPEG fails to build because of missing libraries.  You need to build
    +the third party libraries which are used the OpenJPEG auxilary programs but not 
    +used by the OpenJPEG library.  However, building the
    +third party software fails on my Ubuntu system.  So I will wait for the
    +OpenJPEG build to be fixed before making the third party software the 
    +default in the wgrib2 build. (Tested using OneAPI.)
    +
    +----- old grib2/makefile
    +        cd ${openjpegdir}/build && cmake .. -DZLIB_INCLUDE_DIR=${cwd}/include -DZLIB_LIBRARY=${zlib} -DPNG_LIBRARY=${pnglib} -DPNG_PNG_INCLUDE_DIR=${cwd}/include -DCMAKE_C_COMPILER=${CC} -DCMAKE_POSITION_INDEPENDENT_CODE:bool=ON && make
    +----- new grib2/makefile
    +        cd ${openjpegdir}/build && cmake .. -DZLIB_INCLUDE_DIR=${cwd}/include -DZLIB_LIBRARY=${zlib} -DPNG_LIBRARY=${pnglib} -DPNG_PNG_INCLUDE_DIR=${cwd}/include -DCMAKE_C_COMPILER=${CC} -DCMAKE_POSITION_INDEPENDENT_CODE:bool=ON -BUILD_THIRDPARTY:BOOL=ON && make
    +------
    +
    + +

    Future Changes for v3.1.3

    +
      +
    • Support for OpenMP 3.1, 4.0, 4.5, 5.0 (old: 3.1) +
    • testing SIMD using OpenMP 4.0 +
    • plan to test GPU using OpenMP 5.0 +
    • -ens_processing and -new_grid could use a GPU because parallelized over number of grid points +
    • other loops are parallized over smaller numbers, so GPU is not ideal +
    • so that is why OpenMP added the collapse clause +
    • fixes for makefile (backported to v3.1.2) +
    • installing the AEC library is now default, requiring a recent CMake to build +
    • Found bug in -set_bitmap 1 code. Will release wgrib2 v3.1.3 ASAP (ed. 10/23/2023). +
    + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page dates: 4/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2_v3.1.3_changes.html b/docs/web_docs/wgrib2_v3.1.3_changes.html new file mode 100644 index 0000000..c7dad9e --- /dev/null +++ b/docs/web_docs/wgrib2_v3.1.3_changes.html @@ -0,0 +1,225 @@ + + + + Climate Prediction Center - wgrib2: Changes with v3.1.3 + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 Changes with v3.1.3 +
     
    + +

    wgrib2: v3.1.3

    +
    + +

    Changes from wgrib2 v3.1.2 to v3.1.3

    + +

    Bug fix for -set_bitmap 1

    +

    +Complex-packed grib files have good compression with highly +parallelized decompression. Complex packing has two ways +of storing undefined values, either in bitmap or by encoding +a special value. A bitmap takes 1 bit per grid point, and +a high resolution gfs files typically uses 3-5 bits per +grid point. So storing undefined values typically takes +25% more space than using a special value. Using a bitmap +is inefficient; however, some codes cannot handle storing +undefined as a bitmap. So some operational files from NCEP +use complex packing with a bitmap. To generate such files +using wgrib2, the option "-set_bitmap 1" has to be used. + +

    +A bug was introduced to the wgrib2 where creating complex +files with a bitmap was flawed. The calculation of the range +of the field as flawed and field was truncated to a constant +field. The "optimization" was fixed removing this bug. This +bug only affected new versions of wgrib2 when using "-set_bitmap 1". + +

    ECMWF uses AEC compression

    +

    +ECMWF is producing grib files using AEC compression. By making AEC a default option, +wgrib2 needs to be built using a recent version of CMake. Once CMake becomes a +requirement for the default build, Jasper can be replaced by the long planned +OpenJPEG for jpeg2000 support. You can still build wgrib2 without CMake but you will +have to turn off AEC and replace OpenJPEG by Jasper in the makefile. The output +files created by Jasper and OpenJPEG are not bit identical but decode to +identical numbers in my testing. + +

    +Wgrib2 v3.1.3 is still including proj4 as one of its geolocation libraries. +Removing proj4 means that aspherical-earth equal area Lambert is unsupported. +Some compilers do not support proj4 which is an old version of the Proj library. +Moving to a new version of Proj is ideal but there were some API changes. + +

    Changes for v3.1.3

    +
      +
    • Support for OpenMP 3.1, 4.0, 4.5, 5.0 (prior: 3.1) +
    • added SIMD pragmas which are used if OpenMP support them +
    • testing AVX2 and AVX512 enabled +
    • support for proj4 on Mac +
    • makefile fixes to compiling shared lib, OpenJPEG +
    • NCEP grib tables updated 4/2022. +
    + +The trade offs between using SIMD vs threading is an interesting +subject. For short loops, SIMD has no overhead and will be +faster than threading. For long loops, memory bandwidth will +limit the speed. So threading could use more memory controllers +and have a faster speed. The ideal is for the threaded section +to have loops that can be speed up using SIMD. Unfortunately +that doesn't occur that frequently. + +

    Future Changes for v3.1.4

    +
      +
    • integrate development with NCEPlibs: github, cmake +
    • until the v3.1.4 is released, the github will be used to get convert to the new workflow +
    • updated grib tables +
    • added -lvl, -set_lvl1, -set_lvl2 (low level level options) +
    • added more levels +
    +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page dates: 4/2022 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2api.html b/docs/web_docs/wgrib2api.html new file mode 100644 index 0000000..3369c47 --- /dev/null +++ b/docs/web_docs/wgrib2api.html @@ -0,0 +1,370 @@ + + + + Climate Prediction Center - HOME: ftn_wgrib2api + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > ftn_wgrib2api +
     
    + +

    HOME: ftn_wgrib2api

    +

    The Easy Way of Reading and Writing Grib2 Using Fortran

    +
    + + +

    Introduction

    + +

    +Can a set of fortran routines make reading and writing grib2 easy? +Is it possible? +Can you read grib2 without referring to a the WMO grib standard? +Can you write grib2 without becoming an grib2 expert? Is reading and writing grib +now easier than other popular file formats? + + +

    +!       read 6 hour forecast from z500 field from file 'FILE.grb2'
    +
    +        use wgrib2api
    +	real, allocatable :: grid(:,:)
    +
    +	iret = grb2_mk_inv('FILE.grb2','FILE.inv')	              ! make index/inventory file, FILE.inv
    +	if (iret.ne.0) stop 1
    +
    +!       search index file for terms: ':HGT:500 mb:' and ':6 hour fcst:'
    +	iret = grb2_inq('FILE,grb2','FILE.inv',':HGT:500 mb:',':6 hour fcst:',data2=grid)
    +	if (iret.ne.1) stop 2                                         ! error if not 1 match
    +	write(*,*)'It was easy!  Z500 fhr=6 grid(10,12) =', grid(10,12)
    +
    +	stop
    +	end
    +
    + + +

    +Reading doesn't get much easier than that. You are allowed upto 20 search terms that are +based on the wgrib2 inventory. You don't have to even allocate the variable grid. +Now wgrib2api uses optional parameters to make the +grb2_inq(..) call both simple and powerful. +We can expand the above program to get much more information about the field that was read. +Do some testing, is it easier to read grib2, netcdf or hdf5? + + +

    +!       read 6 hour forecast from z500 field from file 'FILE.grb2'
    +!       showing the use of some optional parameters
    +
    +        use wgrib2api
    +	real, allocatable :: grid(:,:), lat(:,:), lon(:,:)
    +        character (len=300) :: metadata, grid_info
    +        integer :: nx, ny
    +
    +	iret = grb2_mk_inv('FILE.grb2','FILE.inv')	              ! make index/inventory file, FILE.inv
    +	if (iret.ne.0) stop 1
    +
    +!       search index file for terms: ':HGT:', ':500 mb:' and ':6 hour fcst:'
    +	iret = grb2_inq('FILE,grb2','FILE.inv',':HGT:',':500 mb:',':6 hour fcst:',data2=grid, &
    +          nx=nx, ny=ny, lat=lat, lon=lon, desc=metadata, grid_desc=grid_info)
    +        if (iret.ne.1) stop 2                                         ! error if not 1 match
    +
    +        write(*,*)'It was easy!  Z500 fhr=6 grid(10,12) =', grid(10,12)
    +        write(*,*) 'at latitude=',lat(10,12),' longitude=',lon(10,12)
    +        write(*,*) 'grid size=(',nx,',',ny,')'
    +        write(*,*) 'metadata: ',trim(metadata)
    +        write(*,*) 'grid: ', trim(grid_info)
    +
    +	stop
    +	end
    +
    + + +

    +Writing grib2 is also easy. First you need a template which is a sample grib2 file. The +template has the correct grid and unchanging metadata such as the center and grid definition. +The writing process consists of adding +the gridded data, the new variable name, level, reference date and forecast information +such as analysis, or 12 hour forecast and perhaps some ensemble information or some similar +changing metadata. + +

    Finding a template has gotten easier as grib2 has become more common. There are tools +to change the grid information (wgrib2) and change specific metadata information (wgrib2). +Suppose we already have a template. Writing a grib2 file is as easy as + + +

    +!       template.grb2: grib2 file, message/record 1 is template
    +!       fort.11: 10 mb TMP binary data WE:SN order
    +!       OUT.grb2:  output file, 10 mb TMP in grib2 format
    +
    +        use wgrib2api
    +        real, allocatable :: grid(:,:)
    +        integer, parameter :: nx=360, ny=181
    +
    +        allocate (grid(nx,ny))
    +        read(11) grid
    +        i = grb2_wrt('OUT.grb2','template.grb2',1,data2=grid,meta='d=2001020100:TMP:10 mb:anl:packing=j')
    +!       writes out 10 mb temperature, reference date = 00Z01Feb2001, analysis, jpeg2000 packing
    +        if (i.ne.0) stop 8
    +
    +        stop
    +        end
    +
    + + +

    +Reading and writing is based on text strings rather numbers in a table, so you don't have to +refer to the WMO documentation. All the text strings are based on the wgrib2 inventories, +so there should be no surprises as long as you are familiar with the wgrib2 inventories. + + +

    +Here is a practical example, you want to calculate the 1000-500 mb thickness. +We are assuming that the input file only contains one Z1000 and Z500 field. We +are also assuming the first record can be used as a template. + + +

    +!	sample program:
    +!       read z500, z1000
    +!       write 500-1000 mb  thickness  (z500-z1000)
    +!
    +	use wgrib2api
    +
    +	real, allocatable :: z500(:,:), z1000(:,:)
    +	character (len=200) :: file, inv, metadata
    +
    +	file = 'gep19.t00z.pgrb2af180'
    +	inv = 'gep19.t00z.pgrb2af180.inv'
    +
    +	iret = grb2_mk_inv(file, inv)		! make an inventory file
    +
    +!       read z500 and z1000
    +	iret = grb2_inq(file,inv,':HGT:1000 mb:', data2=z1000)
    +	if (iret.ne.1) stop 2
    +	iret = grb2_inq(file,inv,':HGT:500 mb:', data2=z500, desc=metadata)
    +	if (iret.ne.1) stop 3
    +
    +        z1000 = z500 - z1000
    +
    +!	the write needs metadata, going to use metadata from the z500 read
    +
    +!	new style write, var=.. and level=.. override the z500 metadata
    +        iret = grb2_wrt('thick.grb',FILE,1,data2=z1000,meta=metadata,var='THICK',level='500-1000 mb')
    +	if (iret.ne.0) stop 4
    +
    +!	old style write, convert z500 metadata -> thickness metadata
    +        write(*,*) 'metadata 0 ', trim(metadata)
    +        iret = grb2_set_substring(metadata,'THICK',2)
    +	if (iret.ne.0) stop 5
    +        iret = grb2_set_substring(metadata,'500-1000 mb',3)
    +	if (iret.ne.0) stop 6
    +        write(*,*) 'metadata 1 ', trim(metadata)
    +        iret = grb2_wrt('thick.grb',FILE,1,data2=z1000,meta=metadata)
    +	if (iret.ne.0) stop 7
    +
    +        stop
    +        end
    +
    + + +

    Tested Systems

    +

    +

  • RH6 gfortran +
  • RH6 ifort +
  • SUSE ifort +
  • Ubuntu 14.04 gfortran +
  • Cygwin64 (Windows) gfortran +
  • MacOS ifort (beta v2.0.7) + + + +

    Source Code

    +

    +The source code is included with wgrib2. Please use the +newest version of wgrib2 because wgrib2api is a new addition to wgrib2. You need +to compile wgrib2api using the same fortran compiler that you will be using to +compile your fortran programs. By default, wgrib2api/ftp_api is compiled with +OpenMP. So your fortran needs to be compiled with the same OpenMP setting. + +

    +compiling (making the ftn_api)
    +Sample Code + +

    The default wgrib2/wgrib2api build includes the ipolates and netcdf3 libraries. If your fortran +code uses a different ipolates or netcdf libraries, you will have to configure the wgrib2's makefile +and rebuild the wgrib2 library without the ipolates and netcdf options. Removing the two libraries +will not have an effect on the grb2_*(..) routines. However, if the missing libraries would adversely +affect calls to wgrib2a(..) and wgrib2c(..) that use the -new_grid or -netcdf options. + + +

    +

    Documentation

    +
      +
    1. Introduction pptx +
    2. Making an index file, in order to read grib: grb2_mk_inv(..) +
    3. Reading grib: grb2_inq(..) +
    4. Scanning grib: grb2_inq(..) with sequential reads +
    5. Writing grib: grb2_wrt(..) +
    6. Freeing files: grb2_free_file(..) does a flush +
    7. undefined grid points +
    8. HPC: introduction +
    9. HPC: reading/writing memory buffers/files +
    10. Sample fortran code: merge 2000 small grids +
    11. Example: calculating the average surface to 700 mb relative humidity. +
    + +

    Other Languages

    +
      +
    1. C_wgrib2api is in development and is based on ftn_wgrib2api +
    2. py_wgrib2api +
    + + +
  • + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: January 25, 2018, Aug 16, 2018 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2api_ave_rh.html b/docs/web_docs/wgrib2api_ave_rh.html new file mode 100644 index 0000000..aa372ac --- /dev/null +++ b/docs/web_docs/wgrib2api_ave_rh.html @@ -0,0 +1,299 @@ + + + + Climate Prediction Center - wgrib2api + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api ave_rh.f90 +
     
    + +

    wgrib2api ave_rh.f90

    +

    Example: calculating average RH from surface to 700 mb

    +
    + + +

    Introduction

    + +

    +The wgrib2 utility can do calculations but some calculations are +more easily done in Fortran. This example came from a user question +on how to calculate the average RH from the surface to 700 mb. I +am using a sample file with the surface pressure, RH for the levels, +1000, 925, 850 and 700 mb. The proper tool for the job is wgrib2api. + + + +

    +     1	! 1/2018 Public Domain Wesley Ebisuzaki
    +     2	!
    +     3	!	Compute average rh from surface to 700 mb and write as grib file
    +     4	!
    +     5	!       input: grib file with RH on 1000, 925 850 and 700 mb
    +     6	!       output: grib file with pressure weighted average RH from
    +     7	!           surface to 700 mb
    +     8	!
    +     9	!       files:
    +    10	!           in = input grib2 file that has 1000, 825, 850 and 700 mb RH
    +    11	!                   (only one field at each level)
    +    12	!           inv = inventory file
    +    13	!           out = output grib2 with average RH
    +    14	!
    +    15	!       For RH below 1000 mb, use 1000 mb value
    +    16	!
    +    17	!       requires: wgrib2api built with wgrib2 v2.0.8 which supports
    +    18	!          'surface - 700 mb'
    +    19	!          grb_UNDEFINED
    +    20	!
    +    21	        use wgrib2api
    +    22	        character (len=100) :: in, out, inv
    +    23	        character (len=200) :: metadata
    +    24	        real, allocatable :: sfc_prs(:,:), tmp(:,:), rh(:,:,:), ave_rh(:,:)
    +    25	        integer, parameter :: nlevs = 4
    +    26		real, dimension (0:nlevs), parameter :: levels = (/ 2000.0, 1000.0, 925.0, 850.0, 700.0 /)
    +    27	        character (len=9), dimension(0:nlevs), parameter :: &
    +    28	            txt_levs = (/ ':2000 mb:', ':1000 mb:', ':925 mb: ', ':850 mb: ', ':700 mb: ' /)
    +    29	        character (len=30), parameter :: out_level = 'surface - 700 mb'
    +    30	
    +    31		integer :: lev, nx, ny, i, j
    +    32		real:: factor, ave_val, lower_val
    +    33	
    +    34		in='/export/cpc-lw-webisuzak/wd51we/grib2/examples/gep19.aec'
    +    35		inv='gep19.aec.inv'
    +    36		out='ave_rh.grb'
    +    37	
    +    38	!	make inventory
    +    39		i = grb2_mk_inv(in,inv)
    +    40		if (i /= 0) stop 1
    +    41	
    +    42	!	read surface pressure
    +    43		i = grb2_inq(in, inv, ':PRES:', ':surface:', data2=sfc_prs, nx=nx, ny=ny)
    +    44		if (i /= 1) stop 2
    +    45		sfc_prs = 0.01 * sfc_prs		! convert from Pa to mb
    +    46		write(*,*) 'read sfc pressure (mb) done'
    +    47	
    +    48	!	read rh 
    +    49		allocate(rh(nx,ny,0:nlevs))
    +    50		do lev = 1, nlevs
    +    51		   i = grb2_inq(in, inv, ':RH:', txt_levs(lev), data2=tmp, desc=metadata)
    +    52		   if (i /= 1) stop 3
    +    53		   rh(:,:,lev) = tmp
    +    54		enddo
    +    55		rh(:,:,0) = rh(:,:,1)			! rh(2000mb) = rh(1000mb)
    +    56		write(*,*) 'read rh finished'
    +    57	
    +    58	!	now find the ave RH, surface-700 mb, pressure weighted
    +    59		allocate(ave_rh(nx,ny))
    +    60		ave_rh = 0.0
    +    61		do j = 1, ny
    +    62		    do i = 1, nx
    +    63			if (sfc_prs(i,j).gt.2000) stop 4
    +    64			if (sfc_prs(i,j).lt.levels(nlevs)) then
    +    65	        	    ave_rh(i,j) = grb2_UNDEFINED
    +    66			    cycle
    +    67			endif
    +    68			do lev = 1, nlevs
    +    69			    if (sfc_prs(i,j) .gt. levels(lev-1)) then
    +    70	!			include whole layer
    +    71				ave_rh(i,j) = ave_rh(i,j) + (rh(i,j,lev-1)+rh(i,j,lev))*0.5*(levels(lev-1)-levels(lev))
    +    72			    else if (sfc_prs(i,j) .gt. levels(lev)) then
    +    73	!			include partial layer
    +    74				factor = (sfc_prs(i,j)-levels(lev)) / (levels(lev-1) - levels(lev))
    +    75				lower_val = factor*rh(i,j,lev-1) + (1.0-factor)*rh(i,j,lev)
    +    76			        ave_val = 0.5*(lower_val + rh(i,j,lev))
    +    77				ave_rh(i,j) = ave_rh(i,j) + ave_val * (sfc_prs(i,j) - levels(lev))
    +    78			    endif
    +    79			enddo
    +    80	!	        normalize ave_rh 
    +    81			ave_rh(i,j) = ave_rh(i,j) / (sfc_prs(i,j) - levels(nlevs))
    +    82		    enddo
    +    83		enddo
    +    84	
    +    85	!	write ave_rh
    +    86		i = grb2_wrt(out,in,1,data2=ave_rh,meta=metadata,level=out_level)
    +    87		if (i /= 0) stop 5
    +    88	
    +    89		stop
    +    90		end
    +
    + +
    +line 21:     needed use wgrib2api
    +lines 38-40: make inventory file
    +lines 42-46: read surface pressure, get nx, ny of the grid
    +lines 48-56: read RH for 1000, 925, 850 and 700 mb
    +             save in RH(:,:,level)
    +             for computations make RH for 2000 mb for the case
    +              where surface pressure is greater than 1000 mb.
    +lines 58-83: compute surface-700 mb average RH.
    +line 63:     if surface pressure is 2000 mb, something is really wrong
    +lines 64-67: if surface pressure is less than 700, ave RH is undefined
    +              note: grib2_UNDEFINED requires wgrib2api v2.0.7
    +lines 68-79: contribution of each layer to ave_rh
    +lines 85-87: write out ave_rh
    +              note: level_out requires wgrib2api v2.0.7
    +
    + +

    Comments

    + +

    +I needed to add couple of fixes to wgrib2 to make this example work. First +I added grb2_UNDEFINED and grb2_DEFINED_VAL(x) to wgrib2api. Next I had +to enhance wgrib2 so that -set_lev would handle "surface - 700 mb". + +

    +In the fortran code, reading and writing grib2 is done is a simple +manner. + +

    Code

    + +ave_rh.f90 + + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Jan 25, 2018 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2api_hpc.html b/docs/web_docs/wgrib2api_hpc.html new file mode 100644 index 0000000..809bdb4 --- /dev/null +++ b/docs/web_docs/wgrib2api_hpc.html @@ -0,0 +1,216 @@ + + + + Climate Prediction Center - wgrib2api hpc + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api hpc +
     
    + +

    HPC and wgrib2api

    +
    + + +

    Introduction

    + +

    +Wgrib2api was designed to work in High Performance Computing (HPC) applications. +The features useful for HPC are, + +

      +
    1. Applications can be written using the Intel fortran compiler, ifort. +
    2. Slow file reads and writes can be replaced by fast memory buffer reads and writes. +
    3. wgrib2api can be compiled without use of configure scripts which may cause problems + when cross compiling. However, you lose some functionality (handling jpeg2000 and png + encoded files). +
    4. wgrib2api can be compiled with/without OpenMP. +
    + +Some slowness can come from, + +
      +
    1. A high-level interface will always be slower than a low-level interface. However, +as grid size increases, the overhead will become a smaller fraction of workload. +
    2. wgrib2api is not reentrant. For large speedups, you have to run multiple copies of wgrib2api +by MPI. You are limited to one copy of wgrib2api per MPI processes and different copies better +not write to the same disk file. +
    + + +

    Reading

    + +

    Sure, HPC applications read. However, reading grib is a minor part of most +NWP-HPC jobs. Models and data assimilation systems tend to read much of their input +data files in non-grib formats. Most of the computation is in producing and +outputing the forecast or analyses. + +

    Writing

    +There has been much effort done in speeding up the writing of grib files. For example, the +GFS (Global Forecast System, NCEP) needs to writes grib files every 3 or 6 hours of +the forecasts. Each grib file has more than 700 fields. You can encode each field +independently but parallelization of the encoding of individual fields is limited. +The wgrib2api limits may be typical and they are + +
      +
    1. simple packing: highly parallized by OpenMP, poor compression +
    2. AEC packing: single thread, good compression +
    3. complex packing: some parallelization by OpenMP, good compression +
    4. jpeg2000: single thread using Jasper library, good compression +
    + +Simple packing could be parallelized using MPI but simple packing +is not competative because of its poor compression. So the best parallelization +will be from encoding individual fields using separate MPI processes. The output +file can either be created using a parallel filesystem or by copying the grib +messages to a I/O task to write them to the file system. Wgrib2api does not +support multiple programs writing to the same file, so the output can be +writen to a memory file and writen to a the larger disk file by another step. + +
    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Feb 21, 2017 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2m.html b/docs/web_docs/wgrib2m.html new file mode 100644 index 0000000..4a7c2ef --- /dev/null +++ b/docs/web_docs/wgrib2m.html @@ -0,0 +1,418 @@ + + + + Climate Prediction Center - wgrib2mv/wgrib2ms (nee wgrib2m) + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2m +
     
    + +

    wgrib2ms - wgrib2 m(multiple streams) s(scalar data)

    +

    wgrib2mv - wgrib2 m(multiple streams) v(vector data)

    +
    + + +

    Introduction

    + +

    +Wgrib2 was designed to be parallelized by what-may-be-called dataflow programming. +Data flows into a black box and data flows out. One way to parallelize is to +divide the data flow into N streams, process each stream separately and then recombine +the streams at the end of the processing. For example, some wgrib2 operations +can be doubled in processing speed if you run two copies of wgrib2 and let +one copy process the even grib messages (records) and the other process the +odd messages. The grib output of the two copies need to be recombined by +a merging program. + +diagram of single and dual processing streams + +

    +Wgrib2ms is a shell script that allow you parallelize your wgrib2 commands +by running N copies of wgrib2 by dividing the file into N streams. One +common operation that needs parallelization is regridding using the +-new_grid option. The +-new_grid option has a unique requirement that +zonal wind must be followed by the corresponding meridional wind in order to accuractely +determine the winds near the pole. We can use this data-flow parallelation by +creating a file which contains both components of the wind in the same grib message +by using submessages (vector). Once the grib file has the vectors in the same grib message, +the shell script, wgrib2mv, can be used to parallelized the regridding by +-new_grid. + + +

    wgrib2ms

    + + +

    Simple Usage

    +

    +

    +Each grib message has one field
    +run in 1 stream:                      wgrib2      FILE (options)
    +run in N streams:                     wgrib2ms  N FILE (options)           N > 1
    +generate script to run in N streams:  wgrib2ms -N FILE (options)           N > 1
    +
    + * restrictions on the options that work with wgrib2ms
    +
    + +Wgrib2ms runs wgrib2 in N streams and combines the grib output at the +end. For example, + +
    +wgrib2ms 4 IN.grb -set_grib_type c2 -ijsmall_grib 1:10 20:40 OUT.grb
    +
    +An easy-to-read version of the shell code that is generated by wgrib2ms,
    +
    + 1: mkfifo pipe1 pipe2 pipe3 pipe4
    + 2: wgrib2 -for_n 1::4 IN.grb -set_grib_type c2 -ijsmall_grib 1:10 20:40 pipe1 &
    + 3: wgrib2 -for_n 2::4 IN.grb -set_grib_type c2 -ijsmall_grib 1:10 20:40 pipe2 &
    + 4: wgrib2 -for_n 3::4 IN.grb -set_grib_type c2 -ijsmall_grib 1:10 20:40 pipe3 &
    + 5: wgrib2 -for_n 4::4 IN.grb -set_grib_type c2 -ijsmall_grib 1:10 20:40 pipe4 &
    + 6: gmerge OUT.grb pipe1 pipe2 pipe3 pipe4
    + 7: wait
    + 8: rm pipe1 pipe2 pipe3 pipe4
    +
    +line 1: make 4 pipes
    +lines 2-5: run 4 copies of wgrib2 in background, grib output to the pipes
    +    each copy of wgrib2 processes every 4th field
    +lines 6: gmerge reads grib messages from the 4 pipes in round-robin fashion and 
    +     writes it out to OUT.grb
    +
    +The advantage of this code is that there are no temporary disk files and the merging
    +of the results of the 4 streams is done at the same time as the wgrib2 processing.
    +
    + + +

    wgrib2mv

    +

    Regridding using -new_grid

    +
    + +

    Paralleling the regridding process is an almost trivial parallelization. +Regridding the Z500, Z1000 and T100 fields can be done independantly. The only +problem is in regridding vector quantities near the pole. For vector quantities, +one converts the vectors to a 3-d vector (x,y,z), interpolate the 3-d vectory and then project +it to the surface. So the two components of the vector need to be stored +in the same grib message, and the then the parallelization becomes easy. +Wgrib2mv is like wgrib2ms except it requires that the input grib file +have the scalars in their own grib message, and have the vectors +have the vector components saved as submessages in their own grib message. +The output of wgrib2mv, are in a like format. +

    + + +

    Wgrib2mv is for regridding using -new_grid. +This option requires the various vector fields (see vectors) +be processed together. To prevent the vector components from being processed by different copies +of wgrib2, the vector components are put in the same grib message. Using wgrib2 v3.0.0, making +the file is easy + +

    +$ wgrib2 IN.grb -new_grid_order OUT.grb ERROR.grb
    +
    +If there is an unmatched vector field (error), the field will be written to ERROR.grb.
    +So ERROR.grb should be an empty file.  Once the data are prepared, you can run wgrib2mv on it.
    +
    +
    +$ wgrib2mv 4 OUT.grb -new_grid_winds earth -new_grid ncep grid 3 grid3.grb
    +
    +This regrids the file using 4 threads.
    +
    + + +

    +Output options that can be used by wgrib2ms/wgrib2mv +

      +
    1. -grib +
    2. -grib_out +
    3. -ijsmall_grib +
    4. -new_grid (wgrib2mv, wgrib2ms if vectors are set to none) +
    5. -small_grib +
    6. all other output options should not be used +
    +

    +

    wgrib2m restrictions on the output options

    +

    +

      +
    1. Each output option must write to a different file +
    2. Each output option must write to the output file for every record processed. +
    3. You cannot use -if to select the record to be output (see restriction 2) +
    4. Output options can only write grib (ex. -netcdf, -cvs are not allowed) +
    +

    +

    wgrib2 reading options supported by wgrib2m

    +

    +

      +
    1. processing a regular grib file (not a pipe) +
    2. -i (reading inventory from stdin) added v1.1 +
    +

    +

    wgrib2 options that work differently in wgrib2m

    +

    +Some options still work but may behave differently in wgrib2m. +Since the processing is split in to N streams, each copy of +wgrib2 will not see all the records. For example, you +may want to calculate the 1000mb-500mb thickness. If one +copy of wgrib2 gets the 1000 mb Z and other one gets the 500 mb Z, +then you can't calculate the thinkness. This will affect + +

      +
    1. -rpn +
    2. -import (all types) +
    3. memory, and temporary files +
    + + +

    Usage

    +

    +

    +wgrib2ms N (wgrib2 subset options)
    +  for N > 1, execute wgrib2 (wgrib2 subset options) in N streams
    +  for N < -1, produces script running -N streams
    +wgrib2mv N (wgrib2 subset options)
    +  for N > 1, execute wgrib2 (wgrib2 subset options) in N streams
    +  for N < -1, produces script running -N streams
    +
    +v1.1+
    +  grep ":HGT:" nam.idx | wgrib2ms 3 -i nam.grb2 -set_grib_type c3 -grib_out HGT.c3
    +v1.2 wgrib2m was renamed wgrib2mv, added wgrib2ms
    +  can write to stdout by the "-" filename.  Note only one output option can write to stdout
    +
    + +

    Producing a Script

    +

    +Normally wgrib2ms is used to run wgrib2 in N streams. However, you might +use wgrib2ms to generate a script that runs wgrib2 in N streams. +You can then alter the script to run in your environment. For example, +NCEP operational scripts are not suppose to write files in /tmp. However, +that is the default location for pipes. NCEP operational scripts are +suppose to use $WGRIB2 instead of wgrib2. Again, another change that needs +to be done. + +

    Example:wgrib2mv

    +A major use of wgrib2mv is to regrid a file. Suppose we only want to do a vector +interpolation of (UGRD,VGRD) and (UGRD,VGRD) and only (UGRD,VGRD) are already +stored in the same grib message. In addition suppose we want to interpolate +to ncep grid 221. THen the 1 stream version is. +
    +    wgrib2 IN.grb -new_grid_winds grid -new_grid ncep grid 221 OUT221.grb
    +
    +    This will put UGRD and VGRD in their own grib messages. Suppose we want them in
    +    the same grib message, the you can do
    +
    +    wgrib2 IN.grb -inv /dev/null -new_grid_winds grid -new_grid ncep grid 221 - \
    +      wgrib2 - -ncep_uv OUT221.grb
    +
    +To parallelize (8 streams) the above you can do
    +
    +    wgrib2mv 8 IN.grb -inv /dev/null -new_grid_winds grid -new_grid ncep grid 221 OUT221.grb
    +
    +wgrib2mv run M(ultiple streams) using V(ector in own grib message).
    +
    +Now suppose we only want to treat (UGRD,VGRD) and (USTR,VSTM) as vectors.  In addition,
    +we want to bilinearly interpolate all the fields except to SOTYP and VGTYP which are
    +to be nearest neighbor values.  For one stream,
    +
    +   wgrib2 IN.grb -new_grid_winds earth -new_grid_interpolation bilinear \
    +      -new_grid_vectors "UGRD:VGRD:USTM:VSTM" \
    +      -if ":(VGTYP|SOTYP):" -new_grid_interpolation neighbor -fi \
    +      -new_grid ncep grid 221 - -inv /dev/null | wgrib2 - -ncep_uv OUT.grb
    +
    +The 4 stream version is
    +
    +   wgrib2 IN.grb -submsg_uv tmpfile
    +   wgrib2mv 4 tmpfile -new_grid_winds earth -new_grid_interpolation bilinear \
    +      -new_grid_vectors "UGRD:VGRD:USTM:VSTM" \
    +      -if ":(VGTYP|SOTYP):" -new_grid_interpolation neighbor -fi \
    +      -new_grid ncep grid 221 - -inv /dev/null | wgrib2 - -ncep_uv OUT.grb
    +
    + +

    Example 1: Jpeg2000 to complex packing

    + +Jpeg2000 packing is known for good compression at the expense of speed. +Suppose you have downloaded some jpeg2000 compressed files and want to +work with them. You speed up your processing by converting the files +from jpeg2000 to complex-3 in parallel. + +
    + $ wgrib2ms 8 jpeg2000.grb -set_grib_type c3 -grib_out fast.grb
    +
    + The above runs 8 copies of wgrib2 to speed up the processing.  On
    +an 8 core machine, the command will be quite quick.
    +
    + +

    Example 2: making a cookie-cutter subset grib file

    + +Making a cookie cutter subset of file can be done in parallel. + +
    + $ wgrib2ms 8 big_grid.grb -set_grib_type c3 -small_grib 10:40  20:60 small_grid.grb
    +
    + The above runs 8 copies of wgrib2 to speed up the processing.  On
    +an 8 core machine, the command will be quite quick.
    +
    +
    +

    Observations

    +

    +Using Centos 6.4 on a FX 8320 (8 core), there was little speed up with N > 4 when +using 1 MB grib messages. Using grib messages < 64KB (pipe buffer size), the +processing scaled better with the number of streams. Centos 6.4 has an old +kernel which limits the pipe size to 64KB. With a newer kernel, you +can increase the pipe size which will help speed up the wgrib2m. Some speedup +may be realized if gmerge were properly threaded. + +

    +Code location: https://www.ftp.cpc.ncep.noaa.gov/wd51we/wgrib2_aux_progs/ +

    +See also: +-new_grid, +-new_grid_order, +-new_grid_winds, +-wgrib2ms, + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: March 15, 2017, March 23, 2018, March 16, 2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wgrib2ms.html b/docs/web_docs/wgrib2ms.html new file mode 100644 index 0000000..40c6d5b --- /dev/null +++ b/docs/web_docs/wgrib2ms.html @@ -0,0 +1,254 @@ + + + + Climate Prediction Center - wgrib2ms + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2ms +
     
    + +

    wgrib2ms

    +
    + + +

    Introduction

    + +

    +Wgrib2 was designed to be parallelized by what-may-be-called dataflow programming. +Data flows into a black box and data flows out. One way to parallelize is to +divide the data flow into N streams, process each stream separately and then recombine +the streams at the end of the processing. Wgrib2ms parallelizes wgrib2 this way. +The limitation of this parallelization is that it uses pipes and is +limited by pipe speed, disk speed, the number of CPUs on a node/cpu and the +overhead of setting up and running the parallel job. Pipe speed can be increased +by increasing the pipe buffer size (linux kernel 2.6.35+). + +

    +Wgrib2ms parallelizes a wgrib2 command by dividing the data flow into N +streams which are processed independently. Only a limited number of output +options are supported. Note that the inventory from wgrib2ms is in a different +order than the inventory from a wgrib2 command. Each grid (submessage) is processed +by send it to one of the N streams. Since -new_grid requires that vector +fields to be processed in order, this division of labor is incompatible with -new_grid. +Any wgrib2 option that requires an order of processing is incmopatible with wgrib2ms. + +

    wgrib2 output options supported by wgrib2m

    +

    +

      +
    1. -grib +
    2. -grib_out +
    3. -ijsmall_grib +
    4. -new_grid +
    5. all other output options should not be used +
    +

    +

    wgrib2ms restrictions on the output options

    +

    +

      +
    1. Each output option must write to a different file +
    2. Each output option must write to the output file for every record processed. +
    3. You can use the -match option because -match selects the record prior to processing +
    4. You cannot use -if to select the record to be output (see restriction 2) +
    5. Output options can only write grib (ex. -netcdf, -cvs are not allowed) +
    +

    +

    wgrib2 reading options supported by wgrib2ms

    +

    +

      +
    1. processing a regular grib file (not a pipe) +
    2. -i (reading inventory from stdin) added v1.1 +
    3. -import will cause problems +
    +

    +

    wgrib2 options that work differently in wgrib2ms

    +

    +Some options still work but may behave differently in wgrib2ms. +Since the processing is split in to N streams, each copy of +wgrib2 will not see all the records. For example, you +may want to calculate the 1000mb-500mb thickness. If one +copy of wgrib2 gets the 1000 mb Z and other one gets the 500 mb Z, +then you can't calculate the thinkness. This will affect + +

      +
    1. -rpn +
    2. -import +
    +

    + +

    Usage

    +

    +

    +wgrib2ms N (wgrib2 subset options)
    +  for N > 1, execute wgrib2 (wgrib2 subset options) in N streams
    +  for N < -1, produces script running -N streams
    +
    +v1.1+
    +  grep ":HGT:" nam.idx | wgrib2ms 3 -i nam.grb2 -set_grib_type c3 -grib_out HGT.c3
    +
    + +

    Example

    +wgrib2ms 4 IN.grb -set_grib_type c3 -new_grid_winds -new_grid ncep grid 221 out22.grb -new_grid ncep grep 3 out3.grb + + +

    Observations

    +

    +Using Centos 6.4 on a FX 8320 (8 core), there was little speed up with N > 4 when +using 1 MB grib messages. Using grib messages < 64KB (pipe buffer size), the +processing scaled better with the number of streams. The program, gmerge, +should be written to be multi-threading. + +

    +Code location: https://www.ftp.cpc.ncep.noaa.gov/wd51we/wgrib2_aux_progs/wgrib2m +

    +See also: +wgrib2m + + +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Aug, 2014 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wind_dir.html b/docs/web_docs/wind_dir.html new file mode 100644 index 0000000..a4540bd --- /dev/null +++ b/docs/web_docs/wind_dir.html @@ -0,0 +1,224 @@ + + + + Climate Prediction Center - wgrib2: -wind_dir + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-wind_dir +
     
    + +

    wgrib2: -wind_dir

    +
    + + +

    Introduction

    + +

    +The -wind_dir option takes the zonal and meridional winds, +computes the wind direction and writes it out in grib format. The results +is in degrees where 0 degrees is a wind from the north and 90 degrees is a wind from +the east. For this option to +work, (1) the zonal and meridional winds must be earth relative (not grid relative +winds) and (2) the meridional wind must follow the corresponding zonal wind for that +level, time and forecast hour. (Condition 2 is the same restriction as for the +-wind_speed option. If the U and V in your grib file do not have +this order, the file must be sorted. However, many NCEP forecast files already +have this order. + +

    +The winds need to be earth relative. The -new_grid option +can convert between earth and grid relative winds. + +

    +You can save computer time by using the -match option +to restricting the decoding of records to U and V. + +

    The precision of the wind direction is set to the nearest degree (wgrib2 v3.0.0). +Earlier versions used the precision entering the routine. That would be precision +of the V field unless the precision was changed by a scaling option like -set_scaling. + +

    Calm Winds

    + +

    The calculation of the wind direction breaks down when the zonal and meridional +winds are zero. The wind direction for calm winds depends on the implementation. +(C's atan2 is well defined but some machines do not implement negative zero.) + + +

    Usage

    +

    + +

    +-wind_dir output_grib_file
    +
    +   Comment: the -wind_speed option can write to the same file as -wind_dir
    +
    + +

    Example

    +

    + +

    +$ wgrib2 gep19.t00z.pgrb2af180 -wind_dir wind.grb -wind_speed wind.grb -match "(UGRD|VGRD)"
    +4.1:86046:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    +4.2:86046:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    +8.1:226831:d=2009060500:UGRD:250 mb:180 hour fcst:ENS=+19
    +8.2:226831:d=2009060500:VGRD:250 mb:180 hour fcst:ENS=+19
    +
    +$ wgrib2 wind.grb
    +1:0:d=2009060500:WDIR:200 mb:180 hour fcst:ENS=+19
    +2:97922:d=2009060500:WIND:200 mb:180 hour fcst:ENS=+19
    +3:179554:d=2009060500:WDIR:250 mb:180 hour fcst:ENS=+19
    +4:277476:d=2009060500:WIND:250 mb:180 hour fcst:ENS=+19
    +
    + +

    +See also: -match, + -wind_speed + -wind_uv +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Feb 4, 2013 , 1/8/2020. +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wind_speed.html b/docs/web_docs/wind_speed.html new file mode 100644 index 0000000..75c3744 --- /dev/null +++ b/docs/web_docs/wind_speed.html @@ -0,0 +1,204 @@ + + + + Climate Prediction Center - wgrib2: -wind_speed + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-wind_speed +
     
    + +

    wgrib2: -wind_speed

    +
    + + +

    Introduction

    + +

    +The -wind_speed option takes the zonal and meridional winds, +computes the wind speed and writes it out in grib format. For this option to +work, the meridional wind must follow the corresponding zonal wind for that +level, time and forecast hour. If the U and V in your grib file do not have +this order, the file must be sorted. However, many NCEP forecast files already +have this order. + +

    +You can save computer time by using the -match option +to restricting the decoding of records to U and V. + +

    Usage

    +

    + +

    +-wind_speed output_grib_file
    +
    +   Comment: you can write the output of -wind_speed and -wind_dir to the same file
    +
    + +

    Example

    +

    + +

    +$ wgrib2 gep19.t00z.pgrb2af180 -wind_dir wind.grb -wind_speed wind.grb -match "(UGRD|VGRD)"
    +4.1:86046:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    +4.2:86046:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    +8.1:226831:d=2009060500:UGRD:250 mb:180 hour fcst:ENS=+19
    +8.2:226831:d=2009060500:VGRD:250 mb:180 hour fcst:ENS=+19
    +
    +$ wgrib2 wind.grb
    +1:0:d=2009060500:WDIR:200 mb:180 hour fcst:ENS=+19
    +2:97922:d=2009060500:WIND:200 mb:180 hour fcst:ENS=+19
    +3:179554:d=2009060500:WDIR:250 mb:180 hour fcst:ENS=+19
    +4:277476:d=2009060500:WIND:250 mb:180 hour fcst:ENS=+19
    +
    + +

    +See also: -match, + -wind_dir + -wind_uv +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page last modified: Feb 4, 2013 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/wind_uv.html b/docs/web_docs/wind_uv.html new file mode 100644 index 0000000..bc690b3 --- /dev/null +++ b/docs/web_docs/wind_uv.html @@ -0,0 +1,215 @@ + + + + Climate Prediction Center - wgrib2: -wind_uv + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-wind_uv +
     
    + +

    wgrib2: -wind_uv

    +
    + + +

    Introduction

    + +

    +The -wind_uv option takes the wind speed and wind +direction and computes the zonal (UGRD) and meridional (VGRD) wind +components. The wind components are then written out in grib format. +For this option to work, the corresponding wind direction and speed +must not be separated by a non-corresponding wind speed or direction. +If the speed and direction do no have this order, the file must be sorted. + +

    +If the wind direction is earth (grid) relative, the UGRD and VGRD +winds are earth (grid) relative. + +

    +You can save computer time by using the -match option +to restricting the decoding of records to wind speed (WIND) and +wind direction (WDIR). + +

    Usage

    +

    + +

    +-wind_uv output_grib_file
    +
    + +

    Example

    +

    + +

    +$ wgrib2 gep19.t00z.pgrb2af180 -wind_dir wind.grb -wind_speed wind.grb -match "(UGRD|VGRD)"
    +4.1:86046:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    +4.2:86046:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    +8.1:226831:d=2009060500:UGRD:250 mb:180 hour fcst:ENS=+19
    +8.2:226831:d=2009060500:VGRD:250 mb:180 hour fcst:ENS=+19
    +
    +$ wgrib2 wind.grb -wind_uv uv.grb
    +1:0:d=2009060500:WDIR:200 mb:180 hour fcst:ENS=+19
    +2:97922:d=2009060500:WIND:200 mb:180 hour fcst:ENS=+19
    +3:179554:d=2009060500:WDIR:250 mb:180 hour fcst:ENS=+19
    +4:277476:d=2009060500:WIND:250 mb:180 hour fcst:ENS=+19
    +
    +$ wgrib2 uv.grb
    +1:0:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    +2:89777:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    +3:179554:d=2009060500:UGRD:250 mb:180 hour fcst:ENS=+19
    +4:269331:d=2009060500:UGRD:250 mb:180 hour fcst:ENS=+19
    +
    +
    + +

    +See also: -match, + -wind_speed + -wind_dir +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page created: April 1, 2019 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + diff --git a/docs/web_docs/write_sec.html b/docs/web_docs/write_sec.html new file mode 100644 index 0000000..cbc8a91 --- /dev/null +++ b/docs/web_docs/write_sec.html @@ -0,0 +1,189 @@ + + + + Climate Prediction Center - wgrib2: -write_sec + + + + + + + + + + +
    + Skip Navigation Links + www.nws.noaa.gov 
    + + + + + + + + + + +
    + NOAA logo - Click to go to the NOAA home pageNational Weather Service  + NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    + + + + + + + + + + + +
    +
    +  
    + + + + + +  
    + + + + + +

    + + + + + + + + + +
    +
    + + + + + +   + +
    + About Us
    +    Our Mission
    +    Who We Are

    + Contact Us
    +    CPC Information
    +    CPC Web Team

    +
    +
    + + + + + + + + + + + + + + + + + + + +
     
    + HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-write_sec +
     
    + +

    wgrib2: -write_sec

    +
    + + +

    Introduction

    + +

    +The -write_sec option writes the current grib message section (0-8) +to file. The only options that applies to the file are the -header, +-no_header, -append, and +-no_append options. +The default -header option put a 4-byte unsigned integer header and trailer around the section data. +The header and trailer are the number of bytes of the section. + +

    +The -write_sec option is by codes that need low-level access to the grib data. + +

    Usage

    +
    +-write_sec N file            N = 0..8
    +                             file = file to write
    +
    + +

    Example 1

    +
    +wgrib2 IN.grb -write_sec 0 sec0.dat -write_sec 1 sec1.dat -write_sec 2 sec2.dat -write_sec 3 sec3.dat \
    +  -write_sec 4 sec4.dat -write_sec 5 sec5.dat -write_sec 6 sec6.dat -write_sec 7 sec7.dat
    +
    + +

    +See also: +-read_sec, +

    + + + + + + + + + +

    + NOAA/ + National Weather Service
    + National Centers for Environmental Prediction
    + Climate Prediction Center
    + 5830 University Research Court
    + College Park, Maryland 20740
    + Climate Prediction Center Web Team
    + Page created: 12/2020 +
    + Disclaimer + + Privacy Policy +
    +
    +
    + + + From e4369a51cb4f820a47006d765a0ed919050d3d2d Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA Date: Fri, 6 Sep 2024 09:59:54 -0600 Subject: [PATCH 2/2] delete original web_docs directory --- web_docs/0xSec.html | 194 ----- web_docs/AAIG.html | 215 ------ web_docs/AAIGlong.html | 220 ------ web_docs/EUMETSAT.html | 258 ------- web_docs/GRIB.html | 209 ------ web_docs/MM.html | 187 ----- web_docs/Match_inv.html | 190 ----- web_docs/N_ens.html | 192 ----- web_docs/RT.html | 187 ----- web_docs/S.html | 184 ----- web_docs/Sec0.html | 187 ----- web_docs/Sec3.html | 187 ----- web_docs/Sec4.html | 188 ----- web_docs/Sec5.html | 185 ----- web_docs/Sec6.html | 184 ----- web_docs/Sec_len.html | 196 ----- web_docs/T.html | 199 ------ web_docs/V.html | 187 ----- web_docs/VT.html | 199 ------ web_docs/YY.html | 185 ----- web_docs/aerosol_size.html | 197 ----- web_docs/aerosol_wavelength.html | 186 ----- web_docs/alarm.html | 212 ------ web_docs/all_commands.html | 392 ---------- web_docs/append.html | 188 ----- web_docs/ave.html | 518 -------------- web_docs/ave0.html | 175 ----- web_docs/ave_fcst_ave_merge_fcst.html | 223 ------ web_docs/ave_var.html | 232 ------ web_docs/big_endian.html | 187 ----- web_docs/bin.html | 226 ------ web_docs/bin_ieee_text_format.html | 262 ------- web_docs/bitmap.html | 205 ------ web_docs/box_ave.html | 206 ------ web_docs/c_grb2_inq.html | 242 ------- web_docs/c_grb2_mk_inv.html | 219 ------ web_docs/c_wgrib2api.html | 319 --------- web_docs/callable_wgrib2.html | 246 ------- web_docs/calling_wgrib2.html | 254 ------- web_docs/center.html | 191 ----- web_docs/check_pdt_size.html | 192 ----- web_docs/checksum.html | 270 ------- web_docs/code_table.html | 197 ----- web_docs/colon.html | 196 ----- web_docs/compile_questions.html | 664 ----------------- web_docs/config.html | 224 ------ web_docs/convert_wgrib2.html | 293 -------- web_docs/count.html | 200 ------ web_docs/cress_lola.html | 231 ------ web_docs/crlf.html | 180 ----- web_docs/csv.html | 344 --------- web_docs/csv_long.html | 310 -------- web_docs/ctl_ens.html | 168 ----- web_docs/ctl_inv.html | 168 ----- web_docs/cyclic.html | 210 ------ web_docs/d.html | 236 ------ web_docs/default_inv.html | 267 ------- web_docs/disc.html | 190 ----- web_docs/domain.html | 175 ----- web_docs/egrep.html | 260 ------- web_docs/egrep_v.html | 260 ------- web_docs/else.html | 177 ----- web_docs/elseif.html | 189 ----- web_docs/elseif_fs.html | 192 ----- web_docs/elseif_n.html | 193 ----- web_docs/elseif_rec.html | 195 ----- web_docs/elseif_reg.html | 197 ----- web_docs/end.html | 195 ----- web_docs/end_FT.html | 200 ------ web_docs/end_ft.html | 200 ------ web_docs/endif.html | 177 ----- web_docs/ens.html | 193 ----- web_docs/ens_processing.html | 480 ------------- web_docs/ens_qc.html | 338 --------- web_docs/eof_bin.html | 203 ------ web_docs/eof_string.html | 203 ------ web_docs/err_bin.html | 214 ------ web_docs/err_string.html | 214 ------ web_docs/error_final.html | 223 ------ web_docs/example_merra_2_grib2.html | 225 ------ web_docs/export_lonlat.html | 206 ------ web_docs/ext_name.html | 284 -------- web_docs/fcst_ave.html | 518 -------------- web_docs/fgrep.html | 260 ------- web_docs/fgrep_v.html | 260 ------- web_docs/fi.html | 208 ------ web_docs/fix_CFSv2_fcst.html | 469 ------------ web_docs/fix_ncep.html | 198 ------ web_docs/flush.html | 192 ----- web_docs/for.html | 202 ------ web_docs/for_n.html | 337 --------- web_docs/ftime.html | 275 ------- web_docs/ftime1.html | 190 ----- web_docs/ftime2.html | 198 ------ web_docs/ftn_api_fn0.html | 175 ----- web_docs/full_name.html | 177 ----- web_docs/function.html | 230 ------ web_docs/g2clib.html | 269 ------- web_docs/gctpc.html | 310 -------- web_docs/gdt.html | 192 ----- web_docs/geolocation.html | 245 ------- web_docs/get_byte.html | 195 ----- web_docs/get_hex.html | 205 ------ web_docs/get_ieee.html | 195 ----- web_docs/get_int.html | 193 ----- web_docs/get_int2.html | 194 ----- web_docs/grb2_free_file.html | 187 ----- web_docs/grb2_inq.html | 250 ------- web_docs/grb2_inq_scanning.html | 264 ------- web_docs/grb2_mk_inv.html | 228 ------ web_docs/grb2_undefined.html | 196 ----- web_docs/grb2_wrt.html | 314 -------- web_docs/grep.html | 260 ------- web_docs/grib.html | 205 ------ web_docs/grib_ieee.html | 168 ----- web_docs/grib_max_bits.html | 197 ----- web_docs/grib_out.html | 221 ------ web_docs/grib_out_irr.html | 219 ------ web_docs/grib_out_irr2.html | 222 ------ web_docs/gribify2.html | 201 ------ web_docs/gribify_cmorph.html | 615 ---------------- web_docs/gribify_ieee.html | 421 ----------- web_docs/gribtable_used.html | 227 ------ web_docs/grid.html | 298 -------- web_docs/grid_101.html | 253 ------- web_docs/grid_changes.html | 200 ------ web_docs/grid_def.html | 301 -------- web_docs/grid_id.html | 171 ----- web_docs/gridout.html | 203 ------ web_docs/h.html | 205 ------ web_docs/header.html | 198 ------ web_docs/help.html | 224 ------ web_docs/i.html | 319 --------- web_docs/i_file.html | 319 --------- web_docs/ieee.html | 221 ------ web_docs/if.html | 329 --------- web_docs/if_block.html | 216 ------ web_docs/if_delayed_error.html | 217 ------ web_docs/if_fs.html | 191 ----- web_docs/if_n.html | 212 ------ web_docs/if_rec.html | 212 ------ web_docs/if_reg.html | 232 ------ web_docs/if_structure.html | 289 -------- web_docs/ij.html | 189 ----- web_docs/ijbox.html | 207 ------ web_docs/ijlat.html | 192 ----- web_docs/ijsmall_grib.html | 209 ------ web_docs/ijundefine.html | 221 ------ web_docs/ilat.html | 199 ------ web_docs/import_bin.html | 247 ------- web_docs/import_grib.html | 247 ------- web_docs/import_grib_fs.html | 228 ------ web_docs/import_ieee.html | 247 ------- web_docs/import_lonlat.html | 225 ------ web_docs/import_netcdf.html | 431 ----------- web_docs/import_text.html | 247 ------- web_docs/index.html | 629 ---------------- web_docs/interpolating_NDFD.html | 188 ----- web_docs/interpolation.html | 228 ------ web_docs/inv.html | 217 ------ web_docs/inv_f77.html | 206 ------ web_docs/irr_grid.html | 218 ------ "web_docs/jj\177\177\177" | 580 --------------- web_docs/last.html | 216 ------ web_docs/last0.html | 191 ----- web_docs/lev.html | 183 ----- web_docs/lev0.html | 168 ----- web_docs/libwgrib2.html | 186 ----- web_docs/limit.html | 181 ----- web_docs/limitations.html | 236 ------ web_docs/little_endian.html | 187 ----- web_docs/ll2i.html | 228 ------ web_docs/ll2ij.html | 196 ----- web_docs/lola.html | 222 ------ web_docs/lon.html | 315 -------- web_docs/long_cmd_list.html | 538 -------------- web_docs/lvl.html | 256 ------- web_docs/macros.html | 187 ----- web_docs/match.html | 286 -------- web_docs/match_fs.html | 218 ------ web_docs/match_inv.html | 233 ------ web_docs/match_inv_add.html | 224 ------ web_docs/match_inv_f77.html | 222 ------ web_docs/max.html | 234 ------ web_docs/mem_blocks.html | 209 ------ web_docs/mem_del.html | 201 ------ web_docs/mem_final.html | 202 ------ web_docs/mem_init.html | 215 ------ web_docs/merge_fcst.html | 249 ------- web_docs/min.html | 234 ------ web_docs/misc.html | 203 ------ web_docs/mpe.png | Bin 16091 -> 0 bytes web_docs/n.html | 220 ------ web_docs/names.html | 291 -------- web_docs/nc3.html | 203 ------ web_docs/nc4.html | 203 ------ web_docs/nc_grads.html | 552 -------------- web_docs/nc_nlev.html | 552 -------------- web_docs/nc_pack.html | 552 -------------- web_docs/nc_table.html | 557 --------------- web_docs/nc_time.html | 552 -------------- web_docs/ncep_norm.html | 303 -------- web_docs/ncep_uv.html | 205 ------ web_docs/ncpu.html | 205 ------ web_docs/ndate.html | 230 ------ web_docs/ndates.html | 389 ---------- web_docs/ndates_fmt.html | 227 ------ web_docs/netcdf.html | 642 ----------------- web_docs/netcdf_2_grib_ostia.html | 331 --------- web_docs/new_grib.html | 208 ------ web_docs/new_grid.html | 671 ------------------ web_docs/new_grid_format.html | 253 ------- web_docs/new_grid_interpolation.html | 241 ------- web_docs/new_grid_intro.html | 436 ------------ web_docs/new_grid_ipopt.html | 236 ------ web_docs/new_grid_order.html | 244 ------- web_docs/new_grid_usage.html | 285 -------- web_docs/new_grid_v2.html | 187 ----- web_docs/new_grid_vectors.html | 201 ------ web_docs/new_grid_winds.html | 202 ------ web_docs/nl.html | 189 ----- web_docs/nl_out.html | 189 ----- web_docs/nlons.html | 214 ------ web_docs/no_append.html | 188 ----- web_docs/no_flush.html | 182 ----- web_docs/no_header.html | 198 ------ web_docs/no_nc_grads.html | 552 -------------- web_docs/no_nc_pack.html | 552 -------------- web_docs/no_nc_table.html | 552 -------------- web_docs/no_nc_time.html | 552 -------------- web_docs/not.html | 242 ------- web_docs/not_fs.html | 240 ------- web_docs/not_if.html | 199 ------ web_docs/not_if_fs.html | 183 ----- web_docs/npts.html | 180 ----- ...r_of_coordinate_values_after_template.html | 226 ------ web_docs/nxny.html | 190 ----- web_docs/one_line.html | 196 ----- web_docs/openmp.html | 254 ------- web_docs/order.html | 195 ----- web_docs/packing.html | 213 ------ web_docs/pds_fcst_time.html | 208 ------ web_docs/pdt.html | 188 ----- web_docs/persistent.html | 190 ----- web_docs/pipes.html | 250 ------- web_docs/precision.html | 212 ------ web_docs/print.html | 184 ----- web_docs/print_out.html | 204 ------ web_docs/prob.html | 203 ------ web_docs/problems.html | 284 -------- web_docs/process.html | 190 ----- web_docs/processid.html | 188 ----- web_docs/proj4.html | 317 --------- web_docs/py_wgrib2api.html | 206 ------ web_docs/pywgrib2.html | 251 ------- web_docs/pywgrib2_s.html | 343 --------- web_docs/pywgrib2_s_close.html | 201 ------ web_docs/pywgrib2_s_conventions.html | 213 ------ web_docs/pywgrib2_s_global_variables.html | 197 ----- web_docs/pywgrib2_s_inq.html | 346 --------- web_docs/pywgrib2_s_install.html | 241 ------- web_docs/pywgrib2_s_mk_inv.html | 209 ------ web_docs/pywgrib2_s_read_inv.html | 194 ----- web_docs/pywgrib2_s_wgrib2.html | 286 -------- web_docs/pywgrib2_s_write.html | 312 -------- web_docs/quit.html | 211 ------ web_docs/radius.html | 188 ----- web_docs/range.html | 168 ----- web_docs/read_sec.html | 188 ----- web_docs/reduced_gaussian_grid.html | 264 ------- web_docs/reset_delayed_error.html | 229 ------ web_docs/rewind_final.html | 196 ----- web_docs/rewind_init.html | 196 ----- web_docs/rewind_proc.html | 194 ----- web_docs/rpn.html | 579 --------------- web_docs/rpn_non-trivial_example.html | 293 -------- web_docs/rpn_raw2_2raw.html | 277 -------- web_docs/rpn_rcl.html | 182 ----- web_docs/rpn_smth9.html | 192 ----- web_docs/rpn_sto.html | 183 ----- web_docs/rpn_wind-chill.html | 228 ------ web_docs/s.html | 196 ----- web_docs/s_out.html | 193 ----- web_docs/scale.html | 200 ------ web_docs/scaling.html | 203 ------ web_docs/scaling_0001.html | 204 ------ web_docs/scan.html | 249 ------- web_docs/selecting_messages.html | 189 ----- web_docs/set.html | 261 ------- web_docs/set_ave.html | 179 ----- web_docs/set_bin_prec.html | 240 ------- web_docs/set_bitmap.html | 208 ------ web_docs/set_byte.html | 199 ------ web_docs/set_center.html | 170 ----- web_docs/set_date.html | 246 ------- web_docs/set_ens_num.html | 217 ------ web_docs/set_ensm_derived_fcst.html | 201 ------ web_docs/set_ext_name.html | 264 ------- web_docs/set_ext_name_chars.html | 213 ------ web_docs/set_ftime.html | 205 ------ web_docs/set_ftime1.html | 177 ----- web_docs/set_ftime_mode.html | 236 ------ web_docs/set_grib_max_bits.html | 226 ------ web_docs/set_grib_type.html | 236 ------ web_docs/set_hex.html | 256 ------- web_docs/set_ieee.html | 196 ----- web_docs/set_ijval.html | 196 ----- web_docs/set_int.html | 204 ------ web_docs/set_int2.html | 203 ------ web_docs/set_ival.html | 195 ----- web_docs/set_lev.html | 251 ------- web_docs/set_lvl1.html | 265 ------- web_docs/set_metadata.html | 285 -------- web_docs/set_metadata_str.html | 191 ----- web_docs/set_pdt.html | 229 ------ web_docs/set_percentile.html | 196 ----- web_docs/set_prob.html | 218 ------ web_docs/set_radius.html | 205 ------ web_docs/set_regex.html | 273 ------- web_docs/set_scaling.html | 257 ------- web_docs/set_sec_size.html | 203 ------ web_docs/set_subcenter.html | 170 ----- web_docs/set_ts_dates.html | 216 ------ web_docs/set_var.html | 258 ------- web_docs/short_cmd_list.html | 463 ------------ web_docs/single_dual_stream.png | Bin 28920 -> 0 bytes web_docs/small_fast_databases.html | 248 ------- web_docs/small_grib.html | 242 ------- web_docs/spatial_proc.html | 200 ------ web_docs/special_file_names.html | 305 -------- web_docs/speed.html | 306 -------- web_docs/spread.html | 232 ------ web_docs/start_FT.html | 200 ------ web_docs/start_ft.html | 200 ------ web_docs/stats.html | 234 ------ web_docs/status.html | 179 ----- web_docs/subcenter.html | 191 ----- web_docs/submessages.html | 233 ------ web_docs/submsg.html | 241 ------- web_docs/submsg_uv.html | 205 ------ web_docs/sys.html | 190 ----- web_docs/t.html | 199 ------ web_docs/table.html | 182 ----- web_docs/text.html | 214 ------ web_docs/text_col.html | 197 ----- web_docs/tigge.html | 174 ----- web_docs/time.html | 199 ------ web_docs/time_interpolation.html | 228 ------ web_docs/time_processing.html | 526 -------------- web_docs/timer.html | 215 ------ web_docs/tosubmsg.html | 258 ------- web_docs/transient.html | 190 ----- web_docs/type_reftime.html | 201 ------ web_docs/types.html | 400 ----------- web_docs/udf.html | 202 ------ web_docs/undefine.html | 213 ------ web_docs/undefine_val.html | 201 ------ web_docs/unix_time.html | 218 ------ web_docs/unmerge_fcst.html | 302 -------- web_docs/update_2.0.8.html | 209 ------ web_docs/usage_questions.html | 190 ----- web_docs/user_grib2tables.html | 323 --------- web_docs/v.html | 196 ----- web_docs/v0.html | 196 ----- web_docs/v1.html | 196 ----- web_docs/v2.html | 196 ----- web_docs/var.html | 240 ------- web_docs/varX.html | 252 ------- web_docs/vector_dir.html | 215 ------ web_docs/verf.html | 187 ----- web_docs/version.html | 186 ----- web_docs/vt.html | 199 ------ web_docs/wgrib2_dev.html | 204 ------ web_docs/wgrib2_hello_world.html | 208 ------ web_docs/wgrib2_memory.html | 251 ------- web_docs/wgrib2_options.html | 279 -------- web_docs/wgrib2_scripts.html | 187 ----- web_docs/wgrib2_utility_callable.html | 244 ------- web_docs/wgrib2_v3.0.0_changes.html | 205 ------ web_docs/wgrib2_v3.0.2_changes.html | 216 ------ web_docs/wgrib2_v3.1.0_changes.html | 186 ----- web_docs/wgrib2_v3.1.1_changes.html | 220 ------ web_docs/wgrib2_v3.1.2_changes.html | 262 ------- web_docs/wgrib2_v3.1.3_changes.html | 225 ------ web_docs/wgrib2api.html | 370 ---------- web_docs/wgrib2api_ave_rh.html | 299 -------- web_docs/wgrib2api_hpc.html | 216 ------ web_docs/wgrib2m.html | 418 ----------- web_docs/wgrib2ms.html | 254 ------- web_docs/wind_dir.html | 224 ------ web_docs/wind_speed.html | 204 ------ web_docs/wind_uv.html | 215 ------ web_docs/write_sec.html | 189 ----- 393 files changed, 95490 deletions(-) delete mode 100644 web_docs/0xSec.html delete mode 100644 web_docs/AAIG.html delete mode 100644 web_docs/AAIGlong.html delete mode 100644 web_docs/EUMETSAT.html delete mode 100644 web_docs/GRIB.html delete mode 100644 web_docs/MM.html delete mode 100644 web_docs/Match_inv.html delete mode 100644 web_docs/N_ens.html delete mode 100644 web_docs/RT.html delete mode 100644 web_docs/S.html delete mode 100644 web_docs/Sec0.html delete mode 100644 web_docs/Sec3.html delete mode 100644 web_docs/Sec4.html delete mode 100644 web_docs/Sec5.html delete mode 100644 web_docs/Sec6.html delete mode 100644 web_docs/Sec_len.html delete mode 100644 web_docs/T.html delete mode 100644 web_docs/V.html delete mode 100644 web_docs/VT.html delete mode 100644 web_docs/YY.html delete mode 100644 web_docs/aerosol_size.html delete mode 100644 web_docs/aerosol_wavelength.html delete mode 100644 web_docs/alarm.html delete mode 100644 web_docs/all_commands.html delete mode 100644 web_docs/append.html delete mode 100644 web_docs/ave.html delete mode 100644 web_docs/ave0.html delete mode 100644 web_docs/ave_fcst_ave_merge_fcst.html delete mode 100644 web_docs/ave_var.html delete mode 100644 web_docs/big_endian.html delete mode 100644 web_docs/bin.html delete mode 100644 web_docs/bin_ieee_text_format.html delete mode 100644 web_docs/bitmap.html delete mode 100644 web_docs/box_ave.html delete mode 100644 web_docs/c_grb2_inq.html delete mode 100644 web_docs/c_grb2_mk_inv.html delete mode 100644 web_docs/c_wgrib2api.html delete mode 100644 web_docs/callable_wgrib2.html delete mode 100644 web_docs/calling_wgrib2.html delete mode 100644 web_docs/center.html delete mode 100644 web_docs/check_pdt_size.html delete mode 100644 web_docs/checksum.html delete mode 100644 web_docs/code_table.html delete mode 100644 web_docs/colon.html delete mode 100644 web_docs/compile_questions.html delete mode 100644 web_docs/config.html delete mode 100644 web_docs/convert_wgrib2.html delete mode 100644 web_docs/count.html delete mode 100644 web_docs/cress_lola.html delete mode 100644 web_docs/crlf.html delete mode 100644 web_docs/csv.html delete mode 100644 web_docs/csv_long.html delete mode 100644 web_docs/ctl_ens.html delete mode 100644 web_docs/ctl_inv.html delete mode 100644 web_docs/cyclic.html delete mode 100644 web_docs/d.html delete mode 100644 web_docs/default_inv.html delete mode 100644 web_docs/disc.html delete mode 100644 web_docs/domain.html delete mode 100644 web_docs/egrep.html delete mode 100644 web_docs/egrep_v.html delete mode 100644 web_docs/else.html delete mode 100644 web_docs/elseif.html delete mode 100644 web_docs/elseif_fs.html delete mode 100644 web_docs/elseif_n.html delete mode 100644 web_docs/elseif_rec.html delete mode 100644 web_docs/elseif_reg.html delete mode 100644 web_docs/end.html delete mode 100644 web_docs/end_FT.html delete mode 100644 web_docs/end_ft.html delete mode 100644 web_docs/endif.html delete mode 100644 web_docs/ens.html delete mode 100644 web_docs/ens_processing.html delete mode 100644 web_docs/ens_qc.html delete mode 100644 web_docs/eof_bin.html delete mode 100644 web_docs/eof_string.html delete mode 100644 web_docs/err_bin.html delete mode 100644 web_docs/err_string.html delete mode 100644 web_docs/error_final.html delete mode 100644 web_docs/example_merra_2_grib2.html delete mode 100644 web_docs/export_lonlat.html delete mode 100644 web_docs/ext_name.html delete mode 100644 web_docs/fcst_ave.html delete mode 100644 web_docs/fgrep.html delete mode 100644 web_docs/fgrep_v.html delete mode 100644 web_docs/fi.html delete mode 100644 web_docs/fix_CFSv2_fcst.html delete mode 100644 web_docs/fix_ncep.html delete mode 100644 web_docs/flush.html delete mode 100644 web_docs/for.html delete mode 100644 web_docs/for_n.html delete mode 100644 web_docs/ftime.html delete mode 100644 web_docs/ftime1.html delete mode 100644 web_docs/ftime2.html delete mode 100644 web_docs/ftn_api_fn0.html delete mode 100644 web_docs/full_name.html delete mode 100644 web_docs/function.html delete mode 100644 web_docs/g2clib.html delete mode 100644 web_docs/gctpc.html delete mode 100644 web_docs/gdt.html delete mode 100644 web_docs/geolocation.html delete mode 100644 web_docs/get_byte.html delete mode 100644 web_docs/get_hex.html delete mode 100644 web_docs/get_ieee.html delete mode 100644 web_docs/get_int.html delete mode 100644 web_docs/get_int2.html delete mode 100644 web_docs/grb2_free_file.html delete mode 100644 web_docs/grb2_inq.html delete mode 100644 web_docs/grb2_inq_scanning.html delete mode 100644 web_docs/grb2_mk_inv.html delete mode 100644 web_docs/grb2_undefined.html delete mode 100644 web_docs/grb2_wrt.html delete mode 100644 web_docs/grep.html delete mode 100644 web_docs/grib.html delete mode 100644 web_docs/grib_ieee.html delete mode 100644 web_docs/grib_max_bits.html delete mode 100644 web_docs/grib_out.html delete mode 100644 web_docs/grib_out_irr.html delete mode 100644 web_docs/grib_out_irr2.html delete mode 100644 web_docs/gribify2.html delete mode 100644 web_docs/gribify_cmorph.html delete mode 100644 web_docs/gribify_ieee.html delete mode 100644 web_docs/gribtable_used.html delete mode 100644 web_docs/grid.html delete mode 100644 web_docs/grid_101.html delete mode 100644 web_docs/grid_changes.html delete mode 100644 web_docs/grid_def.html delete mode 100644 web_docs/grid_id.html delete mode 100644 web_docs/gridout.html delete mode 100644 web_docs/h.html delete mode 100644 web_docs/header.html delete mode 100644 web_docs/help.html delete mode 100644 web_docs/i.html delete mode 100644 web_docs/i_file.html delete mode 100644 web_docs/ieee.html delete mode 100644 web_docs/if.html delete mode 100644 web_docs/if_block.html delete mode 100644 web_docs/if_delayed_error.html delete mode 100644 web_docs/if_fs.html delete mode 100644 web_docs/if_n.html delete mode 100644 web_docs/if_rec.html delete mode 100644 web_docs/if_reg.html delete mode 100644 web_docs/if_structure.html delete mode 100644 web_docs/ij.html delete mode 100644 web_docs/ijbox.html delete mode 100644 web_docs/ijlat.html delete mode 100644 web_docs/ijsmall_grib.html delete mode 100644 web_docs/ijundefine.html delete mode 100644 web_docs/ilat.html delete mode 100644 web_docs/import_bin.html delete mode 100644 web_docs/import_grib.html delete mode 100644 web_docs/import_grib_fs.html delete mode 100644 web_docs/import_ieee.html delete mode 100644 web_docs/import_lonlat.html delete mode 100644 web_docs/import_netcdf.html delete mode 100644 web_docs/import_text.html delete mode 100644 web_docs/index.html delete mode 100644 web_docs/interpolating_NDFD.html delete mode 100644 web_docs/interpolation.html delete mode 100644 web_docs/inv.html delete mode 100644 web_docs/inv_f77.html delete mode 100644 web_docs/irr_grid.html delete mode 100644 "web_docs/jj\177\177\177" delete mode 100644 web_docs/last.html delete mode 100644 web_docs/last0.html delete mode 100644 web_docs/lev.html delete mode 100644 web_docs/lev0.html delete mode 100644 web_docs/libwgrib2.html delete mode 100644 web_docs/limit.html delete mode 100644 web_docs/limitations.html delete mode 100644 web_docs/little_endian.html delete mode 100644 web_docs/ll2i.html delete mode 100644 web_docs/ll2ij.html delete mode 100644 web_docs/lola.html delete mode 100644 web_docs/lon.html delete mode 100644 web_docs/long_cmd_list.html delete mode 100644 web_docs/lvl.html delete mode 100644 web_docs/macros.html delete mode 100644 web_docs/match.html delete mode 100644 web_docs/match_fs.html delete mode 100644 web_docs/match_inv.html delete mode 100644 web_docs/match_inv_add.html delete mode 100644 web_docs/match_inv_f77.html delete mode 100644 web_docs/max.html delete mode 100644 web_docs/mem_blocks.html delete mode 100644 web_docs/mem_del.html delete mode 100644 web_docs/mem_final.html delete mode 100644 web_docs/mem_init.html delete mode 100644 web_docs/merge_fcst.html delete mode 100644 web_docs/min.html delete mode 100644 web_docs/misc.html delete mode 100644 web_docs/mpe.png delete mode 100644 web_docs/n.html delete mode 100644 web_docs/names.html delete mode 100644 web_docs/nc3.html delete mode 100644 web_docs/nc4.html delete mode 100644 web_docs/nc_grads.html delete mode 100644 web_docs/nc_nlev.html delete mode 100644 web_docs/nc_pack.html delete mode 100644 web_docs/nc_table.html delete mode 100644 web_docs/nc_time.html delete mode 100644 web_docs/ncep_norm.html delete mode 100644 web_docs/ncep_uv.html delete mode 100644 web_docs/ncpu.html delete mode 100644 web_docs/ndate.html delete mode 100644 web_docs/ndates.html delete mode 100644 web_docs/ndates_fmt.html delete mode 100644 web_docs/netcdf.html delete mode 100644 web_docs/netcdf_2_grib_ostia.html delete mode 100644 web_docs/new_grib.html delete mode 100644 web_docs/new_grid.html delete mode 100644 web_docs/new_grid_format.html delete mode 100644 web_docs/new_grid_interpolation.html delete mode 100644 web_docs/new_grid_intro.html delete mode 100644 web_docs/new_grid_ipopt.html delete mode 100644 web_docs/new_grid_order.html delete mode 100644 web_docs/new_grid_usage.html delete mode 100644 web_docs/new_grid_v2.html delete mode 100644 web_docs/new_grid_vectors.html delete mode 100644 web_docs/new_grid_winds.html delete mode 100644 web_docs/nl.html delete mode 100644 web_docs/nl_out.html delete mode 100644 web_docs/nlons.html delete mode 100644 web_docs/no_append.html delete mode 100644 web_docs/no_flush.html delete mode 100644 web_docs/no_header.html delete mode 100644 web_docs/no_nc_grads.html delete mode 100644 web_docs/no_nc_pack.html delete mode 100644 web_docs/no_nc_table.html delete mode 100644 web_docs/no_nc_time.html delete mode 100644 web_docs/not.html delete mode 100644 web_docs/not_fs.html delete mode 100644 web_docs/not_if.html delete mode 100644 web_docs/not_if_fs.html delete mode 100644 web_docs/npts.html delete mode 100644 web_docs/number_of_coordinate_values_after_template.html delete mode 100644 web_docs/nxny.html delete mode 100644 web_docs/one_line.html delete mode 100644 web_docs/openmp.html delete mode 100644 web_docs/order.html delete mode 100644 web_docs/packing.html delete mode 100644 web_docs/pds_fcst_time.html delete mode 100644 web_docs/pdt.html delete mode 100644 web_docs/persistent.html delete mode 100644 web_docs/pipes.html delete mode 100644 web_docs/precision.html delete mode 100644 web_docs/print.html delete mode 100644 web_docs/print_out.html delete mode 100644 web_docs/prob.html delete mode 100644 web_docs/problems.html delete mode 100644 web_docs/process.html delete mode 100644 web_docs/processid.html delete mode 100644 web_docs/proj4.html delete mode 100644 web_docs/py_wgrib2api.html delete mode 100644 web_docs/pywgrib2.html delete mode 100644 web_docs/pywgrib2_s.html delete mode 100644 web_docs/pywgrib2_s_close.html delete mode 100644 web_docs/pywgrib2_s_conventions.html delete mode 100644 web_docs/pywgrib2_s_global_variables.html delete mode 100644 web_docs/pywgrib2_s_inq.html delete mode 100644 web_docs/pywgrib2_s_install.html delete mode 100644 web_docs/pywgrib2_s_mk_inv.html delete mode 100644 web_docs/pywgrib2_s_read_inv.html delete mode 100644 web_docs/pywgrib2_s_wgrib2.html delete mode 100644 web_docs/pywgrib2_s_write.html delete mode 100644 web_docs/quit.html delete mode 100644 web_docs/radius.html delete mode 100644 web_docs/range.html delete mode 100644 web_docs/read_sec.html delete mode 100644 web_docs/reduced_gaussian_grid.html delete mode 100644 web_docs/reset_delayed_error.html delete mode 100644 web_docs/rewind_final.html delete mode 100644 web_docs/rewind_init.html delete mode 100644 web_docs/rewind_proc.html delete mode 100644 web_docs/rpn.html delete mode 100644 web_docs/rpn_non-trivial_example.html delete mode 100644 web_docs/rpn_raw2_2raw.html delete mode 100644 web_docs/rpn_rcl.html delete mode 100644 web_docs/rpn_smth9.html delete mode 100644 web_docs/rpn_sto.html delete mode 100644 web_docs/rpn_wind-chill.html delete mode 100644 web_docs/s.html delete mode 100644 web_docs/s_out.html delete mode 100644 web_docs/scale.html delete mode 100644 web_docs/scaling.html delete mode 100644 web_docs/scaling_0001.html delete mode 100644 web_docs/scan.html delete mode 100644 web_docs/selecting_messages.html delete mode 100644 web_docs/set.html delete mode 100644 web_docs/set_ave.html delete mode 100644 web_docs/set_bin_prec.html delete mode 100644 web_docs/set_bitmap.html delete mode 100644 web_docs/set_byte.html delete mode 100644 web_docs/set_center.html delete mode 100644 web_docs/set_date.html delete mode 100644 web_docs/set_ens_num.html delete mode 100644 web_docs/set_ensm_derived_fcst.html delete mode 100644 web_docs/set_ext_name.html delete mode 100644 web_docs/set_ext_name_chars.html delete mode 100644 web_docs/set_ftime.html delete mode 100644 web_docs/set_ftime1.html delete mode 100644 web_docs/set_ftime_mode.html delete mode 100644 web_docs/set_grib_max_bits.html delete mode 100644 web_docs/set_grib_type.html delete mode 100644 web_docs/set_hex.html delete mode 100644 web_docs/set_ieee.html delete mode 100644 web_docs/set_ijval.html delete mode 100644 web_docs/set_int.html delete mode 100644 web_docs/set_int2.html delete mode 100644 web_docs/set_ival.html delete mode 100644 web_docs/set_lev.html delete mode 100644 web_docs/set_lvl1.html delete mode 100644 web_docs/set_metadata.html delete mode 100644 web_docs/set_metadata_str.html delete mode 100644 web_docs/set_pdt.html delete mode 100644 web_docs/set_percentile.html delete mode 100644 web_docs/set_prob.html delete mode 100644 web_docs/set_radius.html delete mode 100644 web_docs/set_regex.html delete mode 100644 web_docs/set_scaling.html delete mode 100644 web_docs/set_sec_size.html delete mode 100644 web_docs/set_subcenter.html delete mode 100644 web_docs/set_ts_dates.html delete mode 100644 web_docs/set_var.html delete mode 100644 web_docs/short_cmd_list.html delete mode 100644 web_docs/single_dual_stream.png delete mode 100644 web_docs/small_fast_databases.html delete mode 100644 web_docs/small_grib.html delete mode 100644 web_docs/spatial_proc.html delete mode 100644 web_docs/special_file_names.html delete mode 100644 web_docs/speed.html delete mode 100644 web_docs/spread.html delete mode 100644 web_docs/start_FT.html delete mode 100644 web_docs/start_ft.html delete mode 100644 web_docs/stats.html delete mode 100644 web_docs/status.html delete mode 100644 web_docs/subcenter.html delete mode 100644 web_docs/submessages.html delete mode 100644 web_docs/submsg.html delete mode 100644 web_docs/submsg_uv.html delete mode 100644 web_docs/sys.html delete mode 100644 web_docs/t.html delete mode 100644 web_docs/table.html delete mode 100644 web_docs/text.html delete mode 100644 web_docs/text_col.html delete mode 100644 web_docs/tigge.html delete mode 100644 web_docs/time.html delete mode 100644 web_docs/time_interpolation.html delete mode 100644 web_docs/time_processing.html delete mode 100644 web_docs/timer.html delete mode 100644 web_docs/tosubmsg.html delete mode 100644 web_docs/transient.html delete mode 100644 web_docs/type_reftime.html delete mode 100644 web_docs/types.html delete mode 100644 web_docs/udf.html delete mode 100644 web_docs/undefine.html delete mode 100644 web_docs/undefine_val.html delete mode 100644 web_docs/unix_time.html delete mode 100644 web_docs/unmerge_fcst.html delete mode 100644 web_docs/update_2.0.8.html delete mode 100644 web_docs/usage_questions.html delete mode 100644 web_docs/user_grib2tables.html delete mode 100644 web_docs/v.html delete mode 100644 web_docs/v0.html delete mode 100644 web_docs/v1.html delete mode 100644 web_docs/v2.html delete mode 100644 web_docs/var.html delete mode 100644 web_docs/varX.html delete mode 100644 web_docs/vector_dir.html delete mode 100644 web_docs/verf.html delete mode 100644 web_docs/version.html delete mode 100644 web_docs/vt.html delete mode 100644 web_docs/wgrib2_dev.html delete mode 100644 web_docs/wgrib2_hello_world.html delete mode 100644 web_docs/wgrib2_memory.html delete mode 100644 web_docs/wgrib2_options.html delete mode 100644 web_docs/wgrib2_scripts.html delete mode 100644 web_docs/wgrib2_utility_callable.html delete mode 100644 web_docs/wgrib2_v3.0.0_changes.html delete mode 100644 web_docs/wgrib2_v3.0.2_changes.html delete mode 100644 web_docs/wgrib2_v3.1.0_changes.html delete mode 100644 web_docs/wgrib2_v3.1.1_changes.html delete mode 100644 web_docs/wgrib2_v3.1.2_changes.html delete mode 100644 web_docs/wgrib2_v3.1.3_changes.html delete mode 100644 web_docs/wgrib2api.html delete mode 100644 web_docs/wgrib2api_ave_rh.html delete mode 100644 web_docs/wgrib2api_hpc.html delete mode 100644 web_docs/wgrib2m.html delete mode 100644 web_docs/wgrib2ms.html delete mode 100644 web_docs/wind_dir.html delete mode 100644 web_docs/wind_speed.html delete mode 100644 web_docs/wind_uv.html delete mode 100644 web_docs/write_sec.html diff --git a/web_docs/0xSec.html b/web_docs/0xSec.html deleted file mode 100644 index 19767c6..0000000 --- a/web_docs/0xSec.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -0xSec - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -0xSec -
     
    - -

    wgrib2: -0xSec

    -
    - - -

    Introduction:

    - -

    -The -0xSec option prints a hex dump of any of -the grib sections. The format of the hex dump depends on the -verbosity level. -

    - -
    -$ wgrib2 png.grb2 -0xSec 0
    -1:4:Sec0(1..16)=0x4752494200000002000000000000ad9c
    -$ wgrib2 png.grb2 -0xSec 0 -v1
    -1:4:Sec0(1..16)= 47 52 49 42 00 00 00 02 00 00 00 00 00 00 ad 9c
    -$ wgrib2 png.grb2 -0xSec 0 -v2
    -1:4:Sec0(1..16)=1:47 2:52 3:49 4:42 5:00 6:00 7:00 8:02 9:00 10:00 11:00 12:00 13:00 14:00 15:ad
    -  16:9c 
    -
    -The above 3 examples show a hex dump of Section 0 using the different 
    -verbosity levels.
    -
    - -

    Usage

    -

    - -

    --0xSec N
    -N = Section Number
    -
    - -See also: --Sec_len, --checksum, - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/AAIG.html b/web_docs/AAIG.html deleted file mode 100644 index 3bf44c6..0000000 --- a/web_docs/AAIG.html +++ /dev/null @@ -1,215 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -AAIG - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-AAIG -
     
    - -

    wgrib2: -AAIG

    -

    Ascii ArcInfo Grid

    -
    - - -

    Introduction

    - -

    -The -AAIG option writes the data into a Ascii ArcInfo Grid file. -This option is experimental and only supports equally spaced lat-lon grids. -My reading of the format specifications that each file contains a single grid. -Therefore, each field is written to different file (*.asc) which -is written to the current directory. - -

    File name convention for ouput: *.asc

    - -

    -The file name convention - -

    -   NAME = grib name (-var), ex. TEMP, HGT  
    -   LEVEL = level, ex. surface, 2_m_above_ground, 500_mb
    -   RT = reference time YYYYMMDDHH
    -   VT = verification time (end_ft) YYYYMMDDHH
    -
    -   If RT is the same as VT
    -     output = NAME.LEVEL.RT.asc
    -
    -   If RT is different than VT
    -     output = NAME.LEVEL.RT.VT.asc
    -
    - -

    Problems with file name convention

    - -

    The above file name convention works for a simple GFS forecast. -However, life quickly gets more complicated and a new file name -convention was needed (-AAIGlong). - -

    Usage

    -

    - -

    --AAIG
    -
    - - -

    Example

    -

    -

    -wgrib2 in_file -match ':HGT:400 mb:' -AAIG
    -
    -The above line converts all the 400 mb HGT fields into an -arcinfo ascii grid file. - - -

    -See also: -AAIGlong, --csv -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 30, 2008 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/AAIGlong.html b/web_docs/AAIGlong.html deleted file mode 100644 index 732dcba..0000000 --- a/web_docs/AAIGlong.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -AAIGlong - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-AAIGlong -
     
    - -

    wgrib2: -AAIGlong

    -
    - - -

    Introduction

    - -

    -The -AAIGlong option is similar to -the -AAIG option except for a new file name convention for the output. -The -AAIGlong option -writes the data into a Ascii ArcInfo Grid file. This option -is experimental and only supports equally spaced lat-lon -grids. (You can use the -new_grid option of wgrib2 to create -an equally spaced lat-lon grid.) Each field is written to different file in the current directory. - -

    File name convention for ouput: *.asc

    - -

    -The file name convention -

    -   NAME=(wgrib2 -S)
    -   remove (message number)[.submessage number]:(byte location): 
    -   remove trailing semicolon if any
    -   replace "/" by " DIV "
    -   replace "\" by " BS "
    -   replace ":" by "_"
    -   replace "'" by " Q "
    -   replace '"' by " Q "
    -
    -   Note: The (wgrib2 -S) output can change between different versions of wgrib2.
    -   The grib table can be updated.
    -   The new metadata can be added to the inventory in order to uniquely 
    -     identify fields.
    -   In rare cases, the format of the metadata has been updated.
    -
    -   If you need to format of the NAME to be unchanging, please freeze the
    -    version of wgrib2.
    -
    - -

    Usage

    -

    - -

    --AAIGlong
    -
    - - -

    Example

    -

    -

    -$ wgrib2 gep19.t00z.pgrb2af180 -match "HGT:500 mb" -AAIGlong
    -raster file: D=20090605000000_HGT_500 mb_180 hour fcst_ENS=+19.asc
    -9:280952:d=2009060500:HGT:500 mb:180 hour fcst:ENS=+19
    -$ ls *asc
    -D=20090605000000_HGT_500 mb_180 hour fcst_ENS=+19.asc
    -
    -The above line converts all the 400 mb HGT fields into an -arcinfo ascii grid file. - - -

    -See also: -AAIG --new_grid -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Nov 18, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/EUMETSAT.html b/web_docs/EUMETSAT.html deleted file mode 100644 index 866d88c..0000000 --- a/web_docs/EUMETSAT.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -stats, max, min - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: using EUMETSAT -
     
    - -

    wgrib2: EUMETSAT

    -
    - - -

    Introduction: using wgrib2 with grib2 EUMETSAT files

    - -

    -Many of the satellite data from EUMETSAT come in grib2 files using a space view projection. -Preliminary wgrib2 support for the geolocation or navigation of this grid was added May 2011. -With this support, wgrib2 knows the latitude/longitude of each pixel (grid point). This -give the following capabilities to wgrib2. - -

      -
    1. query latitude and longitude of pixel(i,j) -
    2. obtain pixel value as a function of latitude and longitude -
    3. interpolate to a latitude-longitude grid and write it out as binary, text, CSV or grib file. -
    - -This augments the previous capabilities, - -
      -
    1. obtain value for pixel(i,j) -
    2. write out pixel grid as binary, text files -
    3. compress the grib data (4.4x smaller with sample MPE cloud mask file) -
    - - -

    Pixel coordinates

    - -Wgrib2's convention is to arrange the grid to be WE:SN and the pixel -coordinates are X=1..NX and Y=1..NY. With this convention, (1,1) -is the bottom left corner and (NX,NY) is the top right corner. -This differs from the EUMETSAT convention where (0,0) is the bottom -right hand corner and (NX-1,NY-1) is the top left corner. - - -

    Example usage (as of 4/29/2011)

    - -
      -
    1. browse URL=https://oiswww.eumetsat.int/~idds/html/grib.html -
    2. download a file, for our example, MPE_20110428_1615_M9_00.grb, rename it MPE.grb -
    3. view inventory:
      -$ wgrib2 MPE.grb
      -1.1:0:d=2011042816:IRRATE:no_level:anl:
      -1.2:0:d=2011042816:var discipline=3 master_table=3 parmcat=1 parm=98:no_level:anl:
      -1.3:0:d=2011042816:var discipline=3 master_table=3 parmcat=1 parm=99:no_level:anl:
      -
    4. figure out what IIRATE means
      -$ wgrib2 MPE.grb -v -d 1
      -1.1:0:d=2011042816:IRRATE Instantaneous Rain Rate [kg/m^2/s]:no_level:anl:
      -
    5. find IRRATE (instantaneous rain rate) at two different locations, 10N,11E and at 12S and 13W,
      -$ wgrib2 MPE.grb -lon 10 11 -lon -12 -13 -d 1
      -experimental space_view2ll scan=12
      -experimental space_view2ij
      -experimental space_view2ij
      -1.1:0:lon=9.996141,lat=10.993532,val=9.999e+20:lon=-12.002473,lat=-13.011990,val=9.999e+20
      - This file uses an undefined value for a zero IRRATE (shown by 9.999e20). -
    6. interpolate the IIRATE to a 70W-70E, 70S-70N 0.1 degree latitude-longitude grid
      -$ wgrib2 MPE.grb -d 1 -lola -70:1401:0.1 -70:1401:0.1 lola.grb2 grib
      -experimental space_view2ll scan=12
      -experimental space_view2ij
      -1.1:0:d=2011042816:IRRATE:no_level:anl:
      -
    7. The version of GrADS that I have installed on my machine doesn't support pdt=30, so to -view the latitude-longitude I have to set the pdt to 0.
      -$ wgrib2 MPE.grb -d 1 -set_pdt +0 -lola -70:1401:0.01 -70:1401:0.1 lola.grb2 grib
      -
    8. Make a plot with GrADS. -
    - - GrADS plot of MPE - -

    Thanks to the testers, T. Tiberi and V. Loorits. - -

    See also: --lola, --lon, --set_pdt, - - - -

    - - - - - - - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: April 29, 2011 -
    - - - -

    -See also: -undefine -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/GRIB.html b/web_docs/GRIB.html deleted file mode 100644 index 4912313..0000000 --- a/web_docs/GRIB.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -GRIB - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-GRIB -
     
    - -

    wgrib2: -GRIB

    -
    - - -

    Introduction

    - -

    -The -GRIB option is used to copy an entire -GRIB2 message (including all the submessages) to a specified file. -This is useful if you want to preserve to keep the submessages. -This is in contrast to the -grib option which writes -submessages into its own grib message. - -

    The -GRIB option should only be used -to copy the original grib message to another file. Unlike the -the -grib option, changing the metadata -is not recommended. - -

    Usage

    -

    - -

    --GRIB file_name
    -
    - -

    Example

    -

    -The grib standard allows arbitrary data between grib messages. -Sometimes one want to remove this "junk" and only keep the grib -messages. For grib files with no submessages, the cleaning -operation is simple. - -

    -$ wgrib2 IN.grb -grib OUT.grb
    -
    - -For files with grib submessages, the cleaning can be done by, -
    -$ wgrib2 IN.grb -if "^[0-9]*(\.1:|:)" -GRIB OUT.grb                all versions of wgrib2
    -$ wgrib2 IN.grb -if "^[0-9]*(\.1:|:)" -GRIB OUT.grb -endif         wgrib2 v3.0.0+
    -
    --if "^[0-9]*(\.1:|:)"  matches message number XXX or XXX.1, single grib message or first grib submessage
    --GRIB                  write grib message including any submessage
    -
    - - - -See also: -grib --ncep_uv --submsg --tosubmsg --append -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, Sep 5, 2023 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/MM.html b/web_docs/MM.html deleted file mode 100644 index d0d18e6..0000000 --- a/web_docs/MM.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -MM - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-MM -
     
    - -

    wgrib2: -MM

    -
    - - -

    Introduction

    - -

    -The -MM option prints the month of the -reference time. The -MM -and -YY options are pretty useless. - -

    Usage

    -

    - -

    --MM
    -
    - -

    Example

    -

    -

    -$ wgrib2 png.grb2 -MM
    -1:4:MM=06
    -
    - - - - - -See also: -t, -T -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/Match_inv.html b/web_docs/Match_inv.html deleted file mode 100644 index 31b8788..0000000 --- a/web_docs/Match_inv.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -Match_inv - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-Match_inv -
     
    - -

    wgrib2: -Match_inv

    -
    - - -

    Introduction

    - -

    -The -Match_inv option is identical to --match_inv except the "d=YYYYMMDDHH" and -"D=YYYYMMDDHHmmss" fields are swapped in the inventories. -The wgrib2api uses -Match_inv option to create -its inventories. - -

    Wgrib2 inventories can be used as index files and as metadata -to create grib files. For index files, the -match_inv -makes a fine index file as it exposes a number of important parameters -that you may want to search upon. The problem with using these -files for metadata for creating grib files is that it uses a reference -time of "d=YYYYMMDDHH". Some applications require a reference time -that includes minutes (mm). The -Match_inv option -uses a reference time of "D=YYYYMMDDmmss" which solves this problem. - - -

    Usage

    -

    - -

    --Match_inv
    -
    - -See also: --match_inv, --set_metadata, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Aug 11, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/N_ens.html b/web_docs/N_ens.html deleted file mode 100644 index 47f6cca..0000000 --- a/web_docs/N_ens.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -N_ens - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-N_ens -
     
    - -

    wgrib2: -N_ens

    -
    - - -

    Introduction

    - -

    -The -N_ens option prints the number of members -in the ensemble (ensemble forecasts only). - -

    Usage

    -

    - -

    --N_ens
    -
    - -

    Example

    -

    - -

    -$ wgrib2 in.grb -N_ens
    -1:80:10 ens members
    -2:218826:10 ens members
    -3:434430:10 ens members
    -..
    -
    -for wgrib2 upto 2.0.7, will print -1 ens members for product definition tables that
    -do not support number of ensemble members. For wgrib2 2.0.8 and following, the field
    -will be empty.
    -
    - -See also: --ens.html --set_ens_num.html -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page modified: May 15, 2005, Nov 30, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/RT.html b/web_docs/RT.html deleted file mode 100644 index 10d8b9f..0000000 --- a/web_docs/RT.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -RT - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-RT -
     
    - -

    wgrib2: -RT

    -
    - - -

    Introduction

    - -

    -The reference time is usually the analysis time or the time of the start of -the forecast (forecast time=0). However, the grib standard also allows the reference -time to be verifying time of the forecast or the observation time as -indicated by Grib Table 1.2. While legal grib, you should think twice -before setting the reference time to the verifying time of the forecast. -The -RT option prints the type (signficance) of -the reference time (Grib Table 1.2). - - -

    Usage

    -
    --RT
    -
    - -

    Example

    -

    - -

    -$ wgrib2 png.grb2 -RT
    -1:4:RT=Start of fcst
    -
    -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 28, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/S.html b/web_docs/S.html deleted file mode 100644 index b4fc2bf..0000000 --- a/web_docs/S.html +++ /dev/null @@ -1,184 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -S - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -S -
     
    - -

    wgrib2: -S

    -
    - - -

    Introduction

    - -

    -The -s option prints out a simple inventory with minutes and seconds. --s is equivalent to --T, -var, -lev, -ftime , and --misc yyppp - -

    --sh-2.05b$ wgrib2 new.grb2 -s 
    -1:0:d=2007032600:HGT:1000 mb:anl:
    -2:125535:d=2007032600:HGT:1000 mb:3 hour fcst:
    -
    - -

    Usage

    -

    - -

    --s
    -
    - -See also: macros, --match_inv -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/Sec0.html b/web_docs/Sec0.html deleted file mode 100644 index d6b780a..0000000 --- a/web_docs/Sec0.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -Sec0 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -Sec0 -
     
    - -

    wgrib2: -Sec0

    -
    - - -

    Introduction:

    - -

    -The -Sec0 option prints a short summary of Section 0, -the Indicator Section. -

    - -
    -$ wgrib2 png.grb2 -Sec0
    -1:4:Sec0=GRIB reserved 0x0000 Discipline=0 Grib_Edition=2 len=44444
    -
    -GRIB                          octets 1-4, should be GRIB
    -reserved 0x0000               octects 5-6, 0x0000 if not used
    -Discipline=0                  Discipline, Table 0.0
    -Grib_Edition=2                Edition, 2 for grib version2
    -len=44444                     length in octets/bytes of entire grib message
    -
    - -

    Usage

    -

    - -

    --Sec0
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/Sec3.html b/web_docs/Sec3.html deleted file mode 100644 index 82d08a9..0000000 --- a/web_docs/Sec3.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -Sec3 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -Sec3 -
     
    - -

    wgrib2: -Sec3

    -
    - - -

    Introduction:

    - -

    -The -Sec3 option prints a short summary of Section 3, -the Grid Definition Section. -

    - -
    -$ wgrib2 png.grb2 -Sec3
    -1:4:Sec3 len=72 src gdef=0 npts=65160 Grid Def Template=3.0 opt arg=0
    -
    -len=72                        Section 3 is 72 octets/bytes in length
    -src gdef=0                    Source of grid definition, Code Table 3.0
    -npts=65160                    Number of data points
    -Grid Def Template=3.0         Grid definition template number, Code Table 3.1
    -opt arg=0                     optional arguments
    -
    - -

    Usage

    -

    - -

    --Sec3
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/Sec4.html b/web_docs/Sec4.html deleted file mode 100644 index 92fca54..0000000 --- a/web_docs/Sec4.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -Sec4 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -Sec4 -
     
    - -

    wgrib2: -Sec4

    -
    - - -

    Introduction:

    - -

    -The -Sec4 option prints a short summary of Section 4, the -product definition section. -

    - -
    -$ wgrib2 -Sec4 png.grb2 
    -1:4:Sec4 len=36 #vert coordinate=0 Product Defn Template=4.2 size=36 free=0
    -
    -len=36                        Section 4 is 36 octets/bytes in length
    -#vert coordinate=0            no vertical coordinates have been defined
    -Product Defn Template=4.2     using Product Definition Template 4.2  (Code Table 4.0)
    -size=36                       Size of PDT excluding vertical coordinates
    -free=0                        Should be zero, len-size-8*#vert_coordinates
    -
    - -

    Usage

    -

    - -

    --Sec4
    -
    - -See also: --pdt, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/Sec5.html b/web_docs/Sec5.html deleted file mode 100644 index 13f1d98..0000000 --- a/web_docs/Sec5.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -Sec5 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -Sec6 -
     
    - -

    wgrib2: -Sec5

    -
    - - -

    Introduction:

    - -

    -The -Sec5 option prints a short summary of Section 5, the -Data Representation Section. -

    - -
    -wgrib2 png.grb2 -Sec5
    -1:4:Sec5 len=21 #defined data points=65160 Data Repr. Template=5.41
    -
    -len=21                       Section 5 is 21 octets/bytes in length
    -#defined data points=65160   Number of data points with values present in Section 7
    -Data Repr. Template=5.41     Data Represenation Template is 5.41
    -
    - -

    Usage

    -

    - -

    --Sec5
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/Sec6.html b/web_docs/Sec6.html deleted file mode 100644 index cb929eb..0000000 --- a/web_docs/Sec6.html +++ /dev/null @@ -1,184 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -Sec6 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -Sec6 -
     
    - -

    wgrib2: -Sec6

    -
    - - -

    Introduction:

    - -

    -The -Sec6 option prints a short summary of Section 6, the -Bit Map Section. -

    - -
    -$ wgrib2 png.grb2 -Sec6
    -1:4:Sec6 length 6 bitmap indicator 255
    -
    -lenth=6                       Section 6 is 6 octets/bytes in length
    -bitmap indicator 255          Table 6.0 has a value of 255, (no bitmap)
    -
    - -

    Usage

    -

    - -

    --Sec6
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/Sec_len.html b/web_docs/Sec_len.html deleted file mode 100644 index 18ffb79..0000000 --- a/web_docs/Sec_len.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -Set_len - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-Set_len -
     
    - -

    wgrib2: -Sec_len

    -
    - - -

    Introduction

    - -

    -Grib2 messages (records) are comprised of 9 sections (0-8). Sections 0 and 8 -are 16 and 4 bytes long, respectively. When the message contains submessages, -each submessage contains 9 sections but some of the sections can be shared -with the other submessages. -The -Set_late option shows the length of each section -except for sections 0 and 8. - - -

    Usage

    -
    --Sec_len
    -
    - -

    Examples

    - -
    -$ wgrib2 small.grb2 -Sec_len
    -1:0:Sec size msg=188 id(1)=21 local(2)=0 grid(3)=72 product(4)=37 data-rep(5)=21 bitmap(6)=6 data(7)=11
    -
    -  The size of the grib message is 188 bytes.
    -  Section 1 is 21
    -  Section 2 is missing and not used
    -  Section 3 is 72
    -  Section 4 is 37
    -  Section 5 is 21
    -  Section 6 is 6
    -  Section 7 is 11
    -
    - -See also: --0xSec, --checksum, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/T.html b/web_docs/T.html deleted file mode 100644 index f39ee5a..0000000 --- a/web_docs/T.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -t -T -vt -VT - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -t -T -vt -VT -
     
    - -

    wgrib2: -t -T -vt -VT

    -
    - - -

    Introduction

    - -

    -The -t -T -vt -VT options prints various time flags. -The -t -T prints the reference time -and -vt -VT prints the verification time. -The capitalized versions print the time with the seconds -and the lower case options print the time with out the seconds. -In conjuntion with -v2 verbose mode, the -format of the time will change to be GrADS compatible. - -

    Usage

    -
    --t
    --T
    --vt
    --VT
    -
    - -

    Example

    -

    - -

    -$ wgrib2 g720_360.grb2 -t
    -1:4:d=2009010100
    -$ wgrib2 g720_360.grb2 -t -v2
    -1:4:00Z01jan2009
    -$ wgrib2 g720_360.grb2 -T
    -1:4:D=20090101000000
    -$ wgrib2 g720_360.grb2 -vt
    -1:4:vt=2009010600
    -$ wgrib2 g720_360.grb2 -vt -v2
    -1:4:00Z06jan2009
    -$ wgrib2 g720_360.grb2 -VT
    -1:4:vt=20090106000000
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/V.html b/web_docs/V.html deleted file mode 100644 index ad31c5c..0000000 --- a/web_docs/V.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -s -verf - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -s -verf -
     
    - -

    wgrib2 macros: -s -verf -V

    -
    - - -

    Introduction

    - -

    -The -s, --verf -and -V -options are really macros -which are defined in the Macro.c file. The -s option is special because if there is no -"inv" option used, wgrib2 will add a -s option to the end of the argument list. - - -

    Usage

    -

    - -

    --s
    -      equivalent to -t -var -lev -ftime -ens
    -
    --verf
    -      equivalent to -vt -var -lev -ftime -ens
    -
    --V
    -      equivalent to -vt -lev -ftime -var -ens -stats -grid
    -
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/VT.html b/web_docs/VT.html deleted file mode 100644 index f39ee5a..0000000 --- a/web_docs/VT.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -t -T -vt -VT - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -t -T -vt -VT -
     
    - -

    wgrib2: -t -T -vt -VT

    -
    - - -

    Introduction

    - -

    -The -t -T -vt -VT options prints various time flags. -The -t -T prints the reference time -and -vt -VT prints the verification time. -The capitalized versions print the time with the seconds -and the lower case options print the time with out the seconds. -In conjuntion with -v2 verbose mode, the -format of the time will change to be GrADS compatible. - -

    Usage

    -
    --t
    --T
    --vt
    --VT
    -
    - -

    Example

    -

    - -

    -$ wgrib2 g720_360.grb2 -t
    -1:4:d=2009010100
    -$ wgrib2 g720_360.grb2 -t -v2
    -1:4:00Z01jan2009
    -$ wgrib2 g720_360.grb2 -T
    -1:4:D=20090101000000
    -$ wgrib2 g720_360.grb2 -vt
    -1:4:vt=2009010600
    -$ wgrib2 g720_360.grb2 -vt -v2
    -1:4:00Z06jan2009
    -$ wgrib2 g720_360.grb2 -VT
    -1:4:vt=20090106000000
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/YY.html b/web_docs/YY.html deleted file mode 100644 index fa20ef0..0000000 --- a/web_docs/YY.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -YY - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-YY -
     
    - -

    wgrib2: -YY

    -
    - - -

    Introduction

    - -

    -The - option prints the year of the -reference time. The -MM -and -YY options are pretty useless. - -

    Usage

    -

    - -

    --YY
    -
    - -

    Example

    -

    -

    -$ wgrib2 png.grb2 -YY
    -1:4:YY=2009
    -
    - - - -See also: -t, -T -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/aerosol_size.html b/web_docs/aerosol_size.html deleted file mode 100644 index 0a6de2d..0000000 --- a/web_docs/aerosol_size.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -aerosol_size - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-aerosol_size -
     
    - -

    wgrib2: -aerosol_size

    -
    - - -

    Introduction

    - -

    -The -aerosol_size option prints the -size of the aerosol particle if applicable. This applies -to Product Definition Template 4.44 - 4.48. This option is -part of the standard inventory, -s. - -

    Usage

    - -

    -

    --aerosol_size
    -
    - -

    Example

    -
    -$ wgrib2 ngac.t00z.a3df03  -for 2:6
    -2:77259:d=2014081000:TMP:1 hybrid level:3 hour fcst:
    -3:131943:d=2014081000:RH:1 hybrid level:3 hour fcst:
    -4:205847:d=2014081000:MASSMR:1 hybrid level:3 hour fcst:aerosol=Dust Dry:aerosol_size >=2e-07,<2e-06:
    -5:243914:d=2014081000:MASSMR:1 hybrid level:3 hour fcst:aerosol=Dust Dry:aerosol_size >=2e-06,<3.6e-06:
    -6:279272:d=2014081000:MASSMR:1 hybrid level:3 hour fcst:aerosol=Dust Dry:aerosol_size >=3.6e-06,<6e-06:
    -
    -Message 4: mass mixing ratio (MASSMR) of Dry Dust, particle size ranges from 2e-7 meters to 2e-6 meters
    -
    -$ wgrib2 ngac.t00z.a3df03  -for 2:6 -aerosol_size
    -2:77259:
    -3:131943:
    -4:205847:aerosol_size <=2e-07,>2e-06
    -5:243914:aerosol_size <=2e-06,>3.6e-06
    -6:279272:aerosol_size <=3.6e-06,>6e-06
    -
    - -See also: --aerosol_wavelength, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 30, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/aerosol_wavelength.html b/web_docs/aerosol_wavelength.html deleted file mode 100644 index b4beb97..0000000 --- a/web_docs/aerosol_wavelength.html +++ /dev/null @@ -1,186 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -aerosol_wavelength - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-aerosol_wavelength -
     
    - -

    wgrib2: -aerosol_wavelength

    -
    - - -

    Introduction

    - -

    -The option, -aerosol_wavelength, prints the -optical properties of the aerosol particle. This option is part -of the standard inventory, -s. -

    - -

    Usage

    - -

    -

    --aerosol_wavelength
    -
    - -

    Example

    -
    -$ wgrib2 wrib2 ngac.t00z.a2df03  -aerosol_wavelength -d 1 
    -1:0:aerosol_wavelength <=5.45e-07,>=5.65e-07
    -
    - - -See also: --aerosol_size, - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 30, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/alarm.html b/web_docs/alarm.html deleted file mode 100644 index 14d5446..0000000 --- a/web_docs/alarm.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -alarm - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-alarm -
     
    - -

    wgrib2: -alarm

    -
    - - -

    Introduction

    - -

    -The -alarm N option terminates wgrib2 after N seconds (real time). -For example, you may want to use -alarm to kill a -wgrib2 job that running too long on a web server (ex. grib_filter). - -

    The code for -alarm is SVr4, BSD, POSIX-1-2001 and IEEE Std 1003.1-2001 -compatible. The code is also supported by the Cygwin system for Windows systems. The --alarm will need to be disabled in the makefile for non-compatible systems. -(Change DISABLE_ALARM=0 to DISABLE_ALARM=1 in the makefile.) - -

    The current version of -alarm simply terminates -the process. This may be the appropriate action when wgrib2 is taking too -long. However, this heavy-handed action may not be an ideal action for programs that -are calling the wgrib2 subroutine. For these situations, the alarm -should be set up by the main program so that a more appropriate action can -be taken. - -

    The -alarm option is a -replacement for -limit which limits -the number of (sub)messages which are processed. Jobs on -web servers may hang because of problems with the network -connections which will never trigger the --limit option. - -

    Usage

    -

    - -

    --alarm N
    -          N is an integer from 0..65536 (ISO C standard)
    -          N = 0 will remove any pending alarm
    -
    - -

    -The -alarm option is a setup/init option. So -the alarm is activated in the setup phase, cannot altered in the data -processing phase and is not removed the finalize phase. (wgrib2 v2.0.8+ -will remove the alarm in the finalize phase.) - -

    -For Posix systems, the system generates a SIGALRM signal -to the process after N seconds. The default action is to -terminate the process (wgrib2). - - -

    -See also: -quit, --limit - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: August 9, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/all_commands.html b/web_docs/all_commands.html deleted file mode 100644 index 00e5e20..0000000 --- a/web_docs/all_commands.html +++ /dev/null @@ -1,392 +0,0 @@ - - - - Climate Prediction Center - wgrib2: - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - -
     
    -
    -wgrib2 v0.1.9.4-beta2 6/2011 Wesley Ebisuzaki, Reinoud Bokhorst, Jaakko Hyvätti, Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Arlindo da Silva, Niklas Sondell, Sergey Varlamov
    - -0xSec           inv  X      Hex dump of section X (0..8)
    - -bitmap          inv         bitmap mode
    - -center          inv         center
    - -checksum        inv  X      CRC checksum of section X (0..8), whole message (X = -1/message) or (X=data)
    - -code_table_0.0  inv         code table 0.0 discipline
    - -code_table_1.0  inv         code table 1.0 master table version
    - -code_table_1.1  inv         code table 1.1 local table version
    - -code_table_1.2  inv         code table 1.2 significance of reference time
    - -code_table_1.3  inv         code table 1.3 production status of processed data
    - -code_table_1.4  inv         code table 1.4 type of processed data
    - -code_table_3.0  inv         code table 3.0 Source of grid definition
    - -code_table_3.1  inv         code table 3.1 Grid definition template number
    - -code_table_3.11 inv         code table 3.11 regional/global thinned/reduced grid
    - -code_table_3.15 inv         code table 3.15 Physical meaning of vertical coordinate
    - -code_table_3.2  inv         code table 3.2 Size (radius) and Shape of Earth
    - -code_table_3.21 inv         code table 3.21 Vertical Dimension coordinate values defn
    - -code_table_3.6  inv         code table 3.6 Spectral data representation type
    - -code_table_3.7  inv         code table 3.7 Spectral data representation mode
    - -code_table_3.8  inv         code table 3.8 Grid point position
    - -code_table_4.0  inv         code table 4.0 Product Definition Template Number
    - -code_table_4.1  inv         code table 4.1
    - -code_table_4.10 inv         code table 4.10 statistical processing
    - -code_table_4.11 inv         code table 4.11 type of time intervals
    - -code_table_4.15 inv         code table 4.15 type of areal statistical processing
    - -code_table_4.2  inv         code table 4.2
    - -code_table_4.230 inv         code table 4.230 chemical constituent type
    - -code_table_4.3  inv         code table 4.3 Type of Generating Process
    - -code_table_4.4  inv         code table 4.4
    - -code_table_4.5a inv         code table 4.5 (1st value)
    - -code_table_4.5b inv         code table 4.5 (2nd value)
    - -code_table_4.6  inv         code table 4.6 ensemble type
    - -code_table_4.7  inv         code table 4.7 derived forecast
    - -code_table_4.9  inv         code table 4.9 Probability Type
    - -code_table_5.0  inv         code table 5.0 data representation number
    - -code_table_5.1  inv         code table 5.1 type of original field values
    - -code_table_5.4  inv         code table 5.4 group splitting method
    - -code_table_5.5  inv         code table 5.5 missing value management for complex packing
    - -code_table_5.6  inv         code table 5.5 complex packing spatial differencing
    - -code_table_5.7  inv         code table 5.7 precision in IEEE packing
    - -code_table_6.0  inv         code table 6.0 Bitmap indicator
    - -ctl_ens         inv         ens info for g2ctl/GrADS
    - -ctl_inv         inv         ctl inventory dump for g2ctl/GrADS
    - -cyclic          inv         is grid cyclic? (not for gaussian)
    - -disc            inv         discipline (code table 0.0)
    - -domain          inv         find rectangular domain for g2ctl/GrADS plots
    - -ens             inv         ensemble information
    - -ext_name        inv         extended name, var+qualifiers
    - -flag_table_3.10 inv         flag table 3.10 scanning mode for one diamond
    - -flag_table_3.3  inv         flag table 3.3, resolution and component flags
    - -flag_table_3.4  inv         flag table 3.4, scanning mode
    - -flag_table_3.5  inv         flag table 3.5 projection center
    - -flag_table_3.9  inv         flag table 3.9 numbering order of diamonds seen from corresponding pole
    - -ftime           inv         forecast time
    - -full_name       inv         extended name, var+qualifiers
    - -get_byte        inv  X Y Z  get bytes in Section X, location Y (1..N), number of bytes Z (decimal format)
    - -get_hex         inv  X Y Z  get bytes in Section X, location Y (1..N), number of bytes Z (bytes in hexadecimal format)
    - -get_int         inv  X Y Z  get ints in Section X, location Y (byte), number of ints Z
    - -grid            inv         grid definition
    - -ij              inv  X Y    value of field at grid(X,Y) X=1,..,nx Y=1,..,ny (WxText enabled)
    - -ijlat           inv  X Y    lat,lon and grid value at grid(X,Y) X=1,..,nx Y=1,..,ny (WxText enabled)
    - -ilat            inv  X      lat,lon and grid value at Xth grid point, X=1,..,npnts (WxText enabled)
    - -lev             inv         level (code table 4.5)
    - -lev0            inv         level for g2ctl/GrADS
    - -lon             inv  X Y    value at grid point nearest lon=X lat=Y (WxText enabled)
    - -match_inv       inv         inventory used by -match, -not, -if and -not_if
    - -max             inv         print maximum value
    - -min             inv         print minimum value
    - -misc            inv         variable name qualifiers like chemical, ensemble, probability, etc
    - -MM              inv         reference time MM
    - -n               inv         prints out inventory number
    - -N_ens           inv         number of ensemble members
    - -nl              inv         inserts new line into inventory
    - -nlons           inv         number of longitudes for each latitude
    - -nl_out          inv  X      write new line in file X
    - -npts            inv         number of grid points
    - -nxny            inv         nx and ny of grid
    - -packing         inv         shows the packing mode (use -v for more details)
    - -pds_fcst_time   inv         fcst_time(1) in units given by pds
    - -print           inv  X      inserts string into inventory
    - -prob            inv         probability information
    - -process         inv         Process (code table 4.3)
    - -processid       inv         process id (locally defined)
    - -radius          inv         radius of Earth
    - -range           inv         print out location of record in bytes, 0 = first byte
    - -RT              inv         type of reference Time
    - -s               inv         simple inventory
    - -S               inv         simple inventory with minutes and seconds (subject to change)
    - -scale           inv         scale for packing
    - -scaling         inv         scaling for packing (old format)
    - -scan            inv         scan order of grid
    - -Sec0            inv         contents of section0
    - -Sec3            inv         contents of section 3 (Grid Definition Section)
    - -Sec4            inv         Sec 4 values (Product definition section)
    - -Sec5            inv         Sec 5 values (Data representation section)
    - -Sec6            inv         show bit-map section
    - -Sec_len         inv         length of various grib sections
    - -spatial_proc    inv         show spacial processing, pdt=4.15
    - -spectral        inv         show spectral bands
    - -spectral_bands  inv         spectral bands for satellite, pdt=4.31
    - -start_ft        inv         verf time = reference_time + forecast_time (YYYYMMDDHH) - no stat. proc time
    - -start_FT        inv         verf time = reference_time + forecast_time (YYYYMMDDHHMMSS) - no stat. proc time
    - -stats           inv         statistical summary of data values
    - -subcenter       inv         subcenter
    - -t               inv         reference time YYYYMMDDHH, -v2 for alt format
    - -T               inv         reference time YYYYMMDDHHMMSS
    - -table           inv         parameter table
    - -unix_time       inv         print unix timestamp for rt & vt
    - -V               inv         diagnostic output
    - -var             inv         short variable name
    - -varX            inv         raw variable name - discipline mastertab localtab center parmcat parmnum
    - -vector_dir      inv         grid or earth relative winds
    - -verf            inv         simple inventory using verification time
    - -vt              inv         verf time = reference_time + forecast_time, -v2 for alt format
    - -VT              inv         verf time = reference_time + forecast_time (YYYYMMDDHHMMSS)
    - -YY              inv         reference time YYYY
    - -s_out           inv> X      simple inventory written to X
    - -big_endian      misc        sets ieee output to big endian (default is big endian)
    - -colon           misc X      replace item deliminator (:) with X
    - -config          misc        shows the configuration
    - -count           misc        prints number of fields
    - -end             misc        stop after first (sub)message (save time)
    - -fix_ncep        misc        fix ncep PDT=8 headers produced by cnvgrib
    - -grid_changes    misc        prints number of grid changes
    - -grid_def        misc        read lon and lat data from grib file -- experimental
    - -h               misc        help, shows common options
    - -header          misc        f77 header or nx-ny header in text output (default)
    - -help            misc X      help [search string|all], -help all, shows all options
    - -if              misc X      if X (POSIX regular expression) matches, conditional execution up to next output/fi
    - -if_n            misc X      if (inv numbers in range), X=(start:end:step)
    - -if_rec          misc X      if (record numbers in range), X=(start:end:step)
    - -if_reg          misc X      if rpn registers defined, X = A, A:B, A:B:C, etc A = register number
    - -ijundefine      misc X Y Z  sets grid point values to undefined X=(in-box|out-box) Y=ix0:ix1 Z=iy0:iy1 ix=(1..nx) iy=(1..ny)
    - -import_bin      misc X      read binary file (X) for data
    - -import_ieee     misc X      read ieee file (X) for data
    - -import_text     misc X      read text file (X) for data
    - -inv             misc X      write inventory to X
    - -limit           misc X      stops after X fields decoded
    - -little_endian   misc        sets ieee output to little endian (default is big endian)
    - -new_grid_interpolation misc X      new_grid interpolation X=bilinear,bicubic,neighbor,budget
    - -new_grid_ipopt  misc X      new_grid ipopt values X=i1:i2..:iN N <= 20
    - -new_grid_vectors misc X      change fields to vector interpolate: X=none,default,UGRD:VGRD
    - -new_grid_winds  misc X      new_grid wind orientation: X = grid, earth (N/S, default) -- alpha
    - -no_header       misc        no f77 header or nx-ny header in text output
    - -not_if          misc X      if not X (regular expression) matches, conditional execution until next output/fi
    - -one_line        misc        puts all on one line (makes into inventory format)
    - -quit            misc        stop after first (sub)message (save time)
    - -rpn             misc X      reverse polish notation calculator (beta)
    - -set             misc X Y    set X = Y, X=local_table,etc (help: -set help help)
    - -set_ave         misc X      set ave/acc .. only on pdt=4.0 only anl/fcst
    - -set_bin_prec    misc X      X set number of binary bits for grib_out packing
    - -set_byte        misc X Y Z  set bytes in Section X, location Y (1..N), bytes Z (a|a:b:c)
    - -set_center      misc X      changes center X = C or C:S C and S are center/subcenter numbers
    - -set_date        misc X      changes date code .. keep old date code if not specified completely
    - -set_ext_name    misc X      X=0/1 extended name on/off
    - -set_flag_table_3.3 misc X      flag table 3.3 = X
    - -set_flag_table_3.4 misc X      flag table 3.4 = X
    - -set_ftime       misc X      set ftime .. only on pdt=4.0 only anl/fcst
    - -set_grib_max_bits misc X      sets scaling so number of bits does not exceed N in (new) grib output
    - -set_grib_type   misc X      set grib type = jpeg, simple, ieee, complex(1|2|3), same
    - -set_hex         misc X Y Z  set bytes in Section X, location Y (1..N), bytes Z (a|a:b:c) in hexadecimal
    - -set_ijval       misc X Y Z  sets grid point value X=ix Y=iy Z=val
    - -set_int         misc X Y Z  set in in Section X, location Y (1..N), signed integers Z (a|a:b:c)
    - -set_lev         misc X      changes level code .. not complete
    - -set_metadata    misc X      read meta-data for grib writing from file X
    - -set_pdt         misc X      makes new (clean) pdt, X=PDT_number or X=PDT_number:size of PDT in octets
    - -set_radius      misc X      set radius of Earth X= 0,6,8
    - -set_scaling     misc X Y    set decimal scaling=X binary scaling=Y for grib_out packing
    - -set_sec_size    misc X Y    resizes section , X=section number, Y=size in octets, DANGEROUS
    - -set_ts_dates    misc X Y Z  changes date code for time series X=YYYYMMDDHH(mmss) Y=dtime Z=block size
    - -set_var         misc X      changes variable name
    - -submsg          misc X      process submessage X (0=process all messages)
    - -sys             misc X      run system/shell command, X=shell command
    - -text_col        misc X      number of columns on text output
    - -text_fmt        misc X      format for text output (C)
    - -udf             misc X Y    run UDF, X=program+optional_args, Y=return file
    - -udf_arg         misc X Y    add grib-data to UDF argument file, X=file Y=name
    - -undefine        misc X Y Z  sets grid point values to undefined X=(in-box|out-box) Y=lon0:lon1 Z=lat0:lat1
    - -undefine_val    misc X      grid point set to undefined if X=val or X=low:high
    - -v               misc        verbose (v=1)
    - -v0              misc        not verbose (v=0)
    - -v1              misc        verbose (v=1)
    - -v2              misc        really verbose (v=2)
    - -v98             misc        verbose mode for debugging only (v=98)
    - -v99             misc        verbose mode for debugging only (v=99)
    - -version         misc        print version
    - -AAIG            out         writes Ascii ArcInfo Grid file, lat-lon grid only (alpha)
    - -ave             out  X Y    average X=time step, Y=output grib file needs file is special order
    - -bin             out  X      write binary data to X
    - -cress_lola      out  X..Z,A lon-lat grid values X=lon0:nlon:dlon Y=lat0:nlat:dlat Z=file A=radius1:radius2:..:radiusN
    - -csv             out  X      make comma separated file, X=file (WxText enabled)
    - -fcst_ave        out  X Y    average X=time step, Y=output grib file needs file is special order
    - -fi              out         null output operation
    - -grib            out  X      writes GRIB record (one submessage) to X
    - -GRIB            out  X      writes entire GRIB record (all submessages)
    - -grib_ieee       out  X      writes data[] to X.grb, X.head, X.tail, and X.h
    - -grib_out        out  X      writes decoded/modified data in grib-2 format to file X
    - -ieee            out  X      write (default:big-endian) IEEE data to X
    - -ijbox           out  X..Z,A grid values in bounding box X=i1:i2[:di] Y=j1:j2[:dj] Z=file A=[bin|text|spread]
    - -ijsmall_grib    out  X Y Z  make small domain grib file X=ix0:ix1 Y=iy0:iy1 Z=file (beta)
    - -irr_grid        out  X Y Z  make irregular grid, nearest neighbor, X=lon-lat list Y=radius (km) Z=output grib file
    - -lola            out  X..Z,A lon-lat grid values X=lon0:nlon:dlon Y=lat0:nlat:dlat Z=file A=[bin|text|spread|grib]
    - -merge_fcst      out  X Y    normalize NCEP-type ave/acc X=number Y=output grib file
    - -mysql           out  5 args H=[host] U=[user] P=[password] D=[db] T=[table] (alpha)
    - -mysql_dump      out  7 args H=[host] U=[user] P=[password] D=[db] T=[table] W=[western_lons:0|1] PV=[remove unlikely:0|1]
    - -mysql_speed     out  7 args H=[host] U=[user] P=[password] D=[db] T=[table] W=[western_lons:0|1] PV=[remove unlikely:0|1]
    - -ncep_norm       out  X      normalize NCEP-type ave/acc X=output grib file
    - -ncep_uv         out  X      combine U and V fields into one message like NCEP operations
    - -netcdf          out  X      write netcdf data to X
    - -new_grid        out  X..Z,A bilinear interpolate: X=projection Y=x0:nx:dx Z=y0:ny:dy A=grib_file alpha
    - -small_grib      out  X Y Z  make small domain grib file X=lonW:lonE Y=latS:latN Z=file (beta)
    - -spread          out  X      write text - spread sheet format into X (WxText enabled)
    - -text            out  X      write text data into X
    - -tosubmsg        out  X      convert GRIB message to submessage and write to file X
    - -wind_speed      out  X      calculate wind speed, X = output gribfile (U then V in datafile)
    - -append          init        append mode, write to existing output files
    - -d               init X      dump message X (n or n.m), only 1 -d allowed
    - -fix_ncep_2      init        ncep bug fix 2, probability observation < -ve number
    - -fix_ncep_3      init        sets flag to fix ncep bug 3 (constant fields)
    - -fix_ncep_4      init        fixes NCEP grib2 files where DX and DY are undefined
    - -flush           init        flush output buffers after every write (interactive)
    - -for             init X      process record numbers in range, X=(start:end:step), only one -for allowed
    - -for_n           init X      process inv numbers in range, X=(start:end:step), only one -for allowed
    - -g2clib          init X      X=0/1 use g2clib for decoding grib
    - -i               init        read Inventory from stdin
    - -match           init X      process data that matches X (POSIX regular expression)
    - -nc3             init        use netcdf3 (classic)
    - -nc4             init        use netcdf4 (compressed, controlled endianness etc)
    - -nc_grads        init        require netcdf file to be grads v1.9b4 compatible (fixed time step only)
    - -nc_nlev         init X      netcdf, X = max LEV dimension for {TIME,LEV,LAT,LON} data
    - -nc_pack         init X      pack/check limits of all NEW input variables, X=min:max[:byte|short|float]
    - -nc_table        init X      X is conversion_to_netcdf_table file name
    - -nc_time         init X      netcdf, [[-]yyyymmddhhnnss]:[dt{s[ec]|m[in]|h[our]|d[ay]}], [-] is for time alignment only
    - -no_append       init        not append mode, write to new output files (default)
    - -no_flush        init        flush output buffers when full (default)
    - -no_nc_grads     init        netcdf file may be not grads v1.9b4 compatible, variable time step
    - -no_nc_pack      init        no packing in netcdf for NEW variables
    - -no_nc_table     init        disable previously defined conversion_to_netcdf_table
    - -no_nc_time      init        netcdf, disable previously defined initial or relative date and time step
    - -not             init X      process data that does not match X (POSIX regular expression)
    - -order           init X      decoded data in X (raw|we:sn|we:ns) order, we:sn is default
    - -set_regex       init X      set regex mode X = 0:extended regex (default) 1:pattern 2:extended regex & quote metacharacters
    - -tigge           init        use modified-TIGGE grib table
    -
    -
    - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/append.html b/web_docs/append.html deleted file mode 100644 index 0dfb2fd..0000000 --- a/web_docs/append.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -append, -no_append - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-append -
     
    - -

    wgrib2: -append, -no_append

    -
    - - -

    Introduction

    - -

    -The -append and -no_append options -sets/clears the append flag. The out options are -expected to respect this flag when opening output files. So an -append option -before writing (-text, -bin, etc) should append to a currently existing file. -The -no_append directs the file to be created before use which is the default. - -

    -$ wgrib2 grb2 -d 1 -append -text all.txt -no_append -text rec.txt
    -
    - -The above line will append record #1 to all.txt and write record #1 to new file rec.txt - -

    Usage

    -

    - -

    --append
    -      append to output files
    -
    --no_append
    -      over-write the output files
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ave.html b/web_docs/ave.html deleted file mode 100644 index 218c38b..0000000 --- a/web_docs/ave.html +++ /dev/null @@ -1,518 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ave, -fcst_ave - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ncep_norm -
     
    - -

    wgrib2: -ave, -fcst_ave

    -
    - -News -

    -With wgrib2 v2.0.7, -the -ave and -fcst_ave -now call the -time_processing option. -This option handles more statistical operations and more -Product Definition Templates (PDT). - -The old -ave and -fcst_ave options will available as --ave0 and -fcst_ave0. I expect that -these two options will be eliminated within a year of the release of v2.0.7. - - -

    Introduction

    - -

    -The -ave -and -fcst_ave options are very similar; -they both make temporal averages. -The -fcst_ave option assumes that the -reference (initial) time is constant and the verification time -is increasing. -The --ave option assumes the reference time -is increasing and the difference between the verification and -reference time is constant. - -

    - -You would use -fcst_ave to temporally average -a single forecast run. For example, you have a 3 week forecast with -output every 6 hours. You could use -fcst_ave -to find the forecast for the second week. - -

    -You would use -ave to temporally average -several analyses. Suppose you have -analyses every 6 hours and you want to find the analysis for the month. - -

    -The input grib file has to be processed in a special order. Don't worry, -a grib file can be ordered very easily with the sort command. wgrib2 reads the data -sequentially and when ever it encounters a new variable/level/chemical-type, -it starts the averaging process. The length of the averaging depends on -how many records it finds to average. For example, to make a daily -average, a file has to be in the following order. - -

    -U500 2000-01-02 00Z             start ave
    -U500 2000-01-02 06Z
    -U500 2000-01-02 12Z
    -U500 2000-01-02 18Z             end ave
    -V500 2000-01-02 00Z             start ave
    -V500 2000-01-02 06Z
    -V500 2000-01-02 12Z
    -V500 2000-01-02 18Z             end ave
    -Z500 2000-01-02 00Z             start ave
    -Z500 2000-01-02 06Z
    -Z500 2000-01-02 12Z
    -Z500 2000-01-02 18Z             end ave
    -
    - -To make a daily average of the above file, you need to specify the -output file and the time interval between samples. The time -units are the same as used by GrADS (hr, dy, mo, yr). - -
    -$ wgrib2 input.grb -ave 6hr out.grb
    -
    - - -If the file is not sorted, you can use the unix sort by, - -
    -$ wgrib2 input.grb | sort -t: -k4,4 -k5,5 -k6,6 -k3,3 | \
    -   wgrib2 -i input.grb -set_grib_type c3 -ave 6hr output.grb
    -
    - -If you want to make daily means from 4x daily monthly files -and assuming that more than one variable/level is in the monthly file. - -
    -$ wgrib2 input.grb |  sed 's/\(:d=........\)/\1:/' | \
    -  sort -t: -k3,3 -k5,5 -k6,6 -k7,7 -k4,4 | \
    -  wgrib2 input.grb -i -set_grib_type c3 -ave 6hr daily.ave.grb
    -
    - -

    -Using -fcst_ave is like using --ave except you use the verification -time instead of the reference time. To make an inventory that -use the verification time instead of the reference time, you type, - -

    -$ wgrib2 input.grb -vt -var -lev -misc 
    -1:0:vt=2011040101:PRATE:surface:
    -2:592224:vt=2011040102:PRATE:surface:
    -3:1233694:vt=2011040103:PRATE:surface:
    -4:1909322:vt=2011040104:PRATE:surface:
    -5:2612620:vt=2011040105:PRATE:surface:
    -
    - -The sed command will be alterered very slightly when making the -sort (:d=) -> (:st=). - -

    Averaging several files using gmerge

    - -

    If want to average several grib files, and the files have the -following properties: - -

      -
    1. No submessages. -
    2. No non-grib data between the grib messages. -
    3. Each file is for a different time. -
    4. Each file has corresponding grib messages in the same order -
    -
    -Conditions 1 and 2 can be met using 
    -
    -      wgrib2 IN.grb -grib OUT.grb
    -
    -Condition 4 can be met using 
    -      wgrib2 IN.grb | sort -k3 -t: | wgrib2 -i IN.grb -grib OUT.grb
    -
    - -

    -Then you can use the gmerge program to produce a file in -the correct order. The program gmerge is included with the -wgrib2 distribution under grib2/aux_progs/. - -

    -$ ls pgb.20170107??
    -pgb.2017010700	pgb.2017010706	pgb.2017010712	pgb.2017010718
    -
    -$ gmerge - pgb.20170107?? | wgrib2 - -ave 6hr /tmp/daily.grb
    -1:0:d=2017010700:APCP:surface:0-6 hour acc fcst:
    -2:92905:d=2017010706:APCP:surface:0-6 hour acc fcst:
    -3:185445:d=2017010712:APCP:surface:0-6 hour acc fcst:
    -4:278666:d=2017010718:APCP:surface:0-6 hour acc fcst:
    -5:371535:d=2017010700:ACPCP:surface:0-6 hour acc fcst:
    -6:442127:d=2017010706:ACPCP:surface:0-6 hour acc fcst:
    -7:514343:d=2017010712:ACPCP:surface:0-6 hour acc fcst:
    -8:588096:d=2017010718:ACPCP:surface:0-6 hour acc fcst:
    -9:661594:d=2017010700:NCPCP:surface:0-6 hour acc fcst:
    -...
    -
    -$ wgrib2 /tmp/daily.grb 
    -1:0:d=2017010700:APCP:surface:4@6 hour ave(0-6 hour acc fcst),missing=0:
    -2:325115:d=2017010700:ACPCP:surface:4@6 hour ave(0-6 hour acc fcst),missing=0:
    -3:715210:d=2017010700:NCPCP:surface:4@6 hour ave(0-6 hour acc fcst),missing=0:
    -...
    -
    - - - -

    Fast Averaging several files

    -

    -Suppose we have a month of analyses at 3 hour intervals and want -to make a monthly mean for Nov. 2014. Using the above sorting approach, the steps -would be - -

    -1.  cat narr.201411????.grb2 >tmp.grb2
    -2.  wgrib2 tmp.grb2 |  \
    -3.     sort -t: -k4,4 -k5,5 -k6,6 -k3,3 | \
    -4.     wgrib2 tmp.grb2 -i -set_grib_type c3 -ave 3hr narr.201411
    -
    -The first line creates a file with all the data.
    -The second line make an inventory.
    -The third line sorts the inventory in the order for -ave to process.
    -The fourth line makes the average by processing data in the order
    -  determined by the inventory created by line 3.
    -
    - -

    -The above approach processes one average at a time and requires a -minimal amout of memory. However, if you count the I/O operations, -you find that there are 4 I/O operations for every field as well as -the writes of the monthly means. In addition, the read (line 4) is -random access. - -

    -The gmerge approach would look like - -

    -1.  gmerge - narr.201411????.grb2 | \
    -2.     wgrib2 - -set_grib_type c3 -ave 3hr narr.201411
    -
    -The first line creates a file with all the data.
    -The second line makes the average by processing data from line 1.
    -
    - -

    -For this to work, you would have to rewrite gmerge to that it can -large number of input files. For a monthly average of 3-hourly files, -a typical linux system wouldn't have any problems. For a 30-year -climatology, the typical linux system would complain about the -number of open files. - -

    The number of I/O operations with the gmerge is quite good, -every input file is read one time. The read would behave somewhere -between a sequential read and a random read. Another drawback -is the input files much have the data in the same order. - - -

    The third method takes advantage of HPC file systems which -are very fast for sequential reads of large files and terrible for -random-access reads like used in the -the sort-of-the-index method. Using this method for computing -monthly means from 3-hourly NARR data was taking three quarters of -an hour on a multi-million dollar machine. -The problem was that the file system was optimized for large -sequential reads rather than small random-access reads. -The following shows another approach. - - -

    -1.  cat narr.201411????.grb2 | \
    -2.     wgrib2 - \
    -3.        -if_fs ":HGT:200 mb:" -ave 3hr narr.201411 \
    -4.        -if_fs ":UGRD:200 mb:" -ave 3hr narr.201411 \
    -5.        -if_fs ":VGRD:200 mb:" -ave 3hr narr.201411 \
    -6.        -if_fs ":TMP:200 mb:" -ave 3hr narr.201411 
    -
    -The first line copies the data in chronological order and
    -   writes it to the pipe.
    -The second line has wgrib2 read the grib data from the pipe.
    -The third line selects the Z200 fields and runs the averaging
    -  option on it.  We are assuming the narr.* fields only have
    -  one Z200 field and narr.201411???? puts the data into
    -  chronological order.
    -Lines 4-6 apply the averaging option to other fields.
    -
    - -

    -The above approach computes the mean of Z200, U200, V200 and T200 data -at the same time with the use of more memory. -The I/O consists of sequential read of all the files and the -writes of the monthly means. The above script only creates -the mean of Z200, U200, V200 and T200 but you could write a -very long command line and compute the mean of all the fields in -the file. Here are the guts of a -bash script, fast_grib2_mean.sh, which creates and runs the command line. - -

    -1.  wgrib2 $1 -match_inv | cut -f4- -d: | sed -e 's/:n=.*//' >$tmp
    -2.  cmd="cat $* | $wgrib2 - -set_grib_type c3 "
    -3.  while read line
    -4.  do
    -5.    cmd="$cmd -if_fs '$line' -ave $dt $out "
    -6.  done <$tmp
    -7.  eval $cmd
    -
    -1. $1 is the first file to average.
    -   Line 1 creates a file with the field names (minus date codes)
    -2. cmd is the command line that is being built
    -3. loop over all the lines in file $tmp
    -5. generate the "-if_fs/-ave" for the cmd line
    -   Older versions of the web paged used -if but that caused problems when
    -   $line included metacharacters such as parentheses.
    -6. bash syntax to have the while loop read from $tmp
    -7. run the command line
    -
    - -

    -Making the NARR monthly means using the above approach uses large -sequential reads which is optimal for the HPC file system. The run -time went from 3/4 of an hour to maybe a minute. - -

    Fast Forecast Averaging

    - -

    -The previous shell script was for a fast averaging of many analyses. -Sometimes one want to average several forecasts starting from -the same initial time. An example would producing a week-4 forecast. - -

    -1.  $wgrib2 $1 -match_inv | cut -f4-5 -d:  >$tmp
    -2.  cmd="cat $* | $wgrib2 - -set_grib_type c3 "
    -3.  while read line
    -4.  do
    -5.    cmd="$cmd -if_fs '$line' -fcst_ave $dt $out "
    -6.  done <$tmp
    -7.  eval $cmd
    -
    -1. $1 is the first file to average.
    -   Line 1 creates a file with the name and level for each field
    -   It is assumed that the name and level is unique in the file.
    -2. cmd is the command line that is being built
    -3. loop over all the lines in file $tmp
    -5. generate the "-if_fs/-fcst_ave" for the cmd line
    -   Older versions of the web paged used -if but that caused problems when
    -   $line included metacharacters such as parentheses.
    -6. bash syntax to have the while loop read from $tmp
    -7. run the command line
    -
    -

    -Using the -merge_fcst option in a like -manner to the -fcst_ave option. in a like - - - -

    Monthly Climatologies

    - -Once you can make an average, making a monthly climatology should be easy. Except -it isn't. Here are some of the problems that I encountered. - -
      -
    1. February has 28 days except when it doesn't. This causes problems because - wgrib2 -ave will not average 28 and 29 day intervals. -
    2. '116@6 hour ave(anl)' includes a regex metacharacter -
    3. the process id changed -
    4. the subcenter changed -
    - -The solutions were: - -
      -
    1. rewrite the grib file with
      - -if_fs '116@6 hour ave(anl)' -set_ftime2 '112@6 hour ave(anl)' -fi \
      - -if_fs '116@6 hour ave(6 hour fcst)' -set_ftime2 '112@6 hour ave(6 hour fcst)' -fi \
      - -if_fs '116@6 hour ave(3-6 hour acc fcst)' -set_ftime2 '112@6 hour ave(3-6 hour acc fcst)' -fi \
      -
    2. Use -if_fs instead of -if -
    3. rewrite the file with -set analysis_or_forecast_process_id 180 -
    4. rewrite the file with -set subcenter 0 -
    - -

    -Finding items 3 and 4 was a pain. Using undocumented option v98 helps. However, the mismatches can -now be uncoverted by using a verbose mode (>0) and wgrib v2.0.6. - - -

    Limitations by wgrib2 version

    -

    -There is a limit in the maximum number of -if_fs/-ave clauses. -Wgrib2 v2.0.6 can process up to 2000 -if and 2000 -if_fs options and -accept 10000 words on the command line. Since each -if_fs/-ave clause takes 5 -words on the command line and you need to include the name of the -input file, you get a limit of 999 -if_fs/-ave clauses. To speed up -the code, the evaluation of the -if_fs options is done in parallel. - - -

    Usage

    -

    - -

    --ave (time interval)  (output grib file)
    --fcst_ave (time interval)  (output grib file)
    -
    -   wgrib2 prior to v2.0.7 only works with PDT=4.0, 4.1 and 4.8
    -    support for PDT 4.2 and 4.12 by -ave added 7.2016
    -   wgrib2 v2.0.7 is limited by the -time_processing option
    -
    - -

    -See also: --merge_fcst, --time_processing -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Feb 12, 2018, July 26, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ave0.html b/web_docs/ave0.html deleted file mode 100644 index 676218f..0000000 --- a/web_docs/ave0.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ave0, -fcst_ave0 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ncep_norm -
     
    - -

    wgrib2: -ave0, -fcst_ave0

    -
    - - -

    Introduction

    - - -The -ave0 and -and -fcst_ave0 options are the old -(wgrib2 v2.0.6) versions of -The -ave and -and -fcst_ave. - - -

    -See also: --ave, --fcst_ave -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sept 13, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ave_fcst_ave_merge_fcst.html b/web_docs/ave_fcst_ave_merge_fcst.html deleted file mode 100644 index 1c40417..0000000 --- a/web_docs/ave_fcst_ave_merge_fcst.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - Climate Prediction Center - wgrib2: ave vs fcst_ave vs merge_fcst - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -ave vs -fcst_ave vs -merge_fcst -
     
    - -

    wgrib2: -ave vs -fcst_ave vs -merge_fcst

    -
    - - -

    Introduction

    - -

    -The -ave, - -fcst_ave, and - -merge_fcst options all sound like -they do similar things; thus, the comfusion follows. - -

    -The -ave option makes averages of -time series of fields. The fields have to identical except -for the reference time (initial time) is increasing by dt. -Typical use is the daily temperature (average of 00Z,08Z,12Z,18Z -analyses). You can use the --ave to find the daily average 6 hour -forecasted winds (00Z,06Z,12Z,18Z runs). In this case, -you use -ave even though they -are forecasts. -

    -The -fcst_ave option is for making averages -from one forecast run. The items being averaged must be identical -excep that the forecast time must increase by dt. For example, you -may compute the day-2 zonal wind from the average of the 24, 30, 36, -and 42 hour forecasts. - - - -

    - - - -Changing the time stamp is more complicated than necessary. -Depending on the type of time stamp, the options needed differ, and -the options have some arbitary limitions. It's all on how -wgrib2 evolved. Originally there was PDT 4.0 and -set_ftime and --set_ave were written to modify the time stamp. Next came an -option to support PDT 4.8, -set_ave. The -set_ave option allowed -conversion of PDT 4.0 to 4.8. - -

    -Original: :d=2014113018:6 hour fcst:
    -New:      :d=2014122500:12 hour fcst:
    -   options: -set_date 2014122500 -set_ftime "12 hour fcst"
    -
    -Original: :d=2014113018:6 hour fcst:
    -New:      :d=2014122500:0-6 hour ave fcst:
    -   options: -set_date 2014122500 -set_ave "0-6 hour ave fcst"
    -
    -Original: :d=2014113018:6 hour fcst:
    -New:      :d=2014122500:124@6 hour ave(0-6 hour ave fcst),missing=0:
    -   options: -set_date 2014122500 -set_ave "124@6 hour ave(0-6 hour ave fcst),missing=0"
    -
    - -The options, -set_ave and -set_ftime may have to convert between PDTs. Only -a subset of the conversions are supported. - -

    It was noted that the old ftime had problems with the more complicated time stamps and -ftime2 was developed to be an eventual replacement. Similarily set_ftime2 was developed -to replace the old set_ftime/set_ave options. -

    - -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ave_var.html b/web_docs/ave_var.html deleted file mode 100644 index eab7b0c..0000000 --- a/web_docs/ave_var.html +++ /dev/null @@ -1,232 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ave_var - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ncep_norm -
     
    - -

    wgrib2: -ave_var

    -
    - - -

    Introduction

    - -

    -The -ave_var option is based on -the -ave option. In addition to -computing the mean, the -ave_var option -computes the sample standard deviation, minimum and maximum -values for each grid point. Welford's method for computing -the mean and variance was used because it is a -one-pass scheme with the accuracy of a two-pass algorithm. - -

    -The options and expected sequence of fields is the same as -with the -ave option. - - -

    Usage

    -

    - -

    --ave_var (time interval)  (output grib file)
    -   time interval = (integer)(units)
    -   (units) = hr, dy, mo, yr
    -
    - -

    Example

    -

    -

    -$ wgrib2 pgblnl.gdas.201302 -match ":UGRD:200 mb:" -ave_var 6hr out
    -141:1170314:d=2013020100:UGRD:200 mb:anl:
    -659:5936420:d=2013020106:UGRD:200 mb:anl:
    -1177:10703131:d=2013020112:UGRD:200 mb:anl:
    -1695:15432277:d=2013020118:UGRD:200 mb:anl:
    -...
    -$ wgrib2 out
    -1:0:d=2013020100:UGRD:200 mb:112@6 hour ave(anl),missing=0:
    -2:13343:d=2013020100:UGRD:200 mb:112@6 hour StdDev(anl),missing=0:
    -3:24058:d=2013020100:UGRD:200 mb:112@6 hour min(anl),missing=0:
    -4:37401:d=2013020100:UGRD:200 mb:112@6 hour max(anl),missing=0:
    -
    -Making a GrADS control for "out" requires editing the ctl file to shorten -the names of variables. -
    -$ alt_g2ctl -0t out > out.ctl
    -$ vi out.ctl
    -.. edit out.ctl so the last 6 lines look like this
    -vars 4
    -UGRDdev 0 0 "UGRD:112@6 hour StdDev(anl),missing=0:200 mb" * 200 mb U stddev
    -UGRDave 0 0 "UGRD:112@6 hour ave(anl),missing=0:200 mb" * 200 mb U ave
    -UGRDmax 0 0 "UGRD:112@6 hour max(anl),missing=0:200 mb" * 200 mb U max
    -UGRDmin 0 0 "UGRD:112@6 hour min(anl),missing=0:200 mb" * 200 mb U min
    -endvars
    -$ alt_gmp out.ctl
    -wgrib2_flags=-npts -set_ext_name 1 -T -ext_name -ftime -lev
    -wgrib2_inv=.invd02
    -dtype:  dtype grib2
    -tdef:  nt=1 start=00Z01feb2013 by=1mo
    -zdef: nlevel=1
    -resolve_dsets dset=out inctime=1mo
    -resolve_dsets: no template
    -scanning out (process=0)
    -merge index files
    -writing out index
    -/export/cpc-lw-webisuzak/wd51we/bin/alt_gmp v0.0.5 finished ctl=out.ctl records matched=4, not matched=0 ctl_defn=4
    -
    - -

    -See also: --ave
    - -https://jonisalonen.com/2013/deriving-welfords-method-for-computing-variance/ -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan 25, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/big_endian.html b/web_docs/big_endian.html deleted file mode 100644 index 74b8418..0000000 --- a/web_docs/big_endian.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -big_endian, -little_endian - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -big_endian -little_endian -
     
    -

    - -

    wgrib2: -big_endian -little_endian - -

    - - -

    Introduction

    - -

    -The -big_endian and the --little_endian -options changes the order that IEEE numbers are read and written. This -does not affect the order in which binary numbers are read/written. - - -

    Usage

    -

    - -

    --big_endian
    -   or
    --little_endian
    -
    - - -See also: --ieee, --import_ieee, --header, --no_header, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Aug, 2011 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/bin.html b/web_docs/bin.html deleted file mode 100644 index 20c5458..0000000 --- a/web_docs/bin.html +++ /dev/null @@ -1,226 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -bin - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-bin -
     
    - -

    wgrib2: -bin

    -
    - - -

    Introduction

    - -

    -The -bin option writes the grid values to a specified -file in binary format (C: float, Fortran: real). The default order is -WE:SN (see -order option) with f77 header/trailer (see -no_header). -The undefined value is 9.999e20. The file format remains unchanged from -wgrib except the order of grid points can now be specified. - -

    -When the header flag is on (default, or by the option -header), -, the header consists of an integer with the byte count of -the data. The size of the integer (4 or 8 bytes) depends on the native size -of the integer. Usually this size is compile time option. This is different -from the f77 header which is generated by -ieee which is always a 4 byte -integer. - -

    When the header flag if off (by the option -no_header), the binary -grid points are written with no header. To read the data, you need to -know the size of the grid. - -

    The default order of the grid point data is WE:SN. The order of -the grid point data can be changed to raw and WE:NS by use of the --order option. - - -

    On most machines, the binary format is either big or little-endian single -precision IEEE. - -

    Usage

    -

    - -

    --bin file_name
    -     "-" sends the output to the terminal/stdout (results are unpredicatable in Windows)
    -
    - - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -s | grep ":RH:2 m" | wgrib2 -i test.grb2 -bin data.bin
    -285:36796469:d=2005090200:RH:2 m above ground:60 hour fcst
    -
    - -
    -
    -      wgrib               ==>                 wgrib2
    -
    -      -header -bin -o out.bin                 -header -order raw -bin out.bin
    -      -bin -o out.bin                         -order raw -bin out.bin
    -
    -
    - -The above line extracts the 2 meter RH from file test.grb2 and writes it in data.bin - -

    -See also: -text, --netcdf, --spread, --ieee --no_header --header --order -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, March 2, 2021. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/bin_ieee_text_format.html b/web_docs/bin_ieee_text_format.html deleted file mode 100644 index 8fbafbe..0000000 --- a/web_docs/bin_ieee_text_format.html +++ /dev/null @@ -1,262 +0,0 @@ - - - - Climate Prediction Center - wgrib2: bin, text, ieee formats - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 format -
     
    - -

    wgrib2: bin, ieee, text formats

    -
    - - -

    The bin, text and ieee formats

    - -

    -The -bin, -text, -ieee -and -lola options create bin/text/ieee format files. The -format doesn't change from that used by wgrib. The difference between bin and ieee -is that bin writes the numbers in the machine's native format and ieee writes -the numbers in big_endian ieee format. - -

    -
    -			Text Format, with header
    -
    -
    -(grid 1)	(nx) (ny)		grid dimensions
    -		(grid value)
    -		(grid value)
    -		...
    -		(grid value)		nx*ny values
    -(grid 2)	(nx) (ny)		grid dimensions
    -		(grid value)
    -		(grid value)
    -		...
    -		(grid value)		nx*ny values
    -(grid 3)	...
    -
    -
    -
    -		        Text Format, with no header
    -
    -(grid 1)	(grid value)
    -		(grid value)
    -		...
    -		(grid value)		nx*ny values
    -(grid 2)	(grid value)
    -		(grid value)
    -		...
    -		(grid value)		nx*ny values
    -(grid 3)	...
    -
    -
    -	This format is not a recommended format because your code
    -could easily read too many or few grid points.
    -
    -
    -
    -			Binary and IEEE, no header
    -
    -(grid 1)	(binary float value)		grid value
    -		(binary float value)
    -		...
    -		(binary float value)		nx*ny values
    -
    -(grid 2)	(binary float value)
    -		(binary float value)
    -		...
    -		(binary float value)		nx*ny values
    -		etc
    -
    -	The no-header format is not a recommended format to use.  
    -The format does not indicate the size of the grid. If your program 
    -makes a mistake on the grid dimension, you could get interesting results.  
    -However, some fortran compilers require this format for binary files (Cray, 
    -ABSoft under AmigaOS).  In addition, this is the default GrADs binary format.
    -
    -
    -
    -			Binary and IEEE, with header
    -
    -
    -(grid 1)	(binary integer)	nx*ny*sizeof(float)
    -		(binary float value)
    -		...
    -		(binary float value)	nx*ny values
    -		(binary integer)	nx*ny*sizeof(float)
    -
    -(grid 2)	(binary integer)	nx*ny*sizeof(float)
    -		(binary float value)
    -		...
    -		(binary float value)	nx*ny values
    -		(binary integer)	nx*ny*sizeof(float)
    -
    -
    -    The binary-with-header format is commonly used by UNIX 
    -fortrans for their binary files.  Some MS-DOS fortran compilers
    -also support this format.  You can use this format with GrADS
    -with the "options sequential" line in the control file.
    -
    -
    - -

    -Note, the order of the numbers is controled by the --order option. - - -

    -See also: -text, --bin, --ieee, --lola, --order, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/bitmap.html b/web_docs/bitmap.html deleted file mode 100644 index 6eaa074..0000000 --- a/web_docs/bitmap.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -bitmap - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-bitmap -
     
    - -

    wgrib2: -bitmap

    -
    - - -

    Introduction

    - -

    -GRIB2 has 3 ways to specify undefined values. If the grid point -data is stored as IEEE format numbers, then the IEEE format has NaN (not -a number). NaN values can considered to be a undefined value. For -complex packing, values that are outside the range of normal -values are undefined. Decoders can give these undefined values a -special value. All the packing methods support a bitmap for specifying -undefined values. - -

    -The -bitmap option prints whether the record has a bitmap -and the number of undefined points as specified by the bitmap. It is possible -for an IEEE format packing to defined undefined by both NaN and a bitmap. So -in this case the number of undefined values will be larger than specified by -the bitmap. The same is true for complex packing where a bitmap could be -combined with special values undefineds. Combining two methods of specifying -undefineds would increase the file size, so it is not recommended. - -

    Note that using a bitmap to specify undefined values is not as efficient -as using special-value undefineds. The file size is significantly bigger and -decoding can be slower (wgrib2's code is parallelized for special values). - -

    Note that wgrib2 uses 9.999e20 for all undefined values including -special value undefineds. (The special value is ignored.) - -

    Usage

    -

    - -

    --bitmap
    -
    - -

    Example

    -

    - -

    -$ wgrib2 grib2.polar -bitmap
    -1.1:0:no bitmap
    -1.2:0:no bitmap
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan 4, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/box_ave.html b/web_docs/box_ave.html deleted file mode 100644 index 02848ae..0000000 --- a/web_docs/box_ave.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -box_ave - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-box_ave -
     
    - -

    wgrib2: -box_ave

    -
    - - -

    Introduction

    - -

    -The -box_ave option does a spatial smoothing -by doing a simple box average of the data field. Amount of smoothing -can be controlled by the size of the box. -The -box_ave option can be used on regional -and global fields. To identify global fields, you can use -the option -cyclic. - -

    Usage

    -
    --box_ave DX DY CRITICAL_WEIGHT
    -   DX=width of box (in grid points), DX has to be an odd positive integer
    -   DY=height of box (in grid points), DY has to be an odd positive integer
    -
    -   The box average is the mean value for a box of DX x DY centered on
    -   the grid point.
    -
    -   CRITICAL_WEIGHT
    -      -1: grid(i,j) = UNDEFINED    if original grid(i,j) is undefined
    -                    = box average  if original grid(i,j) is defined
    -       not -1: let wt = number of grid points that are defined in the box
    -            grid(i,j) = UNDEFINED     if wt <= WT
    -                      = box average   if wt > WT
    -
    -The speed of -box_ave is O(NX*NY*DY). The O(NX*NY) method was slower
    -because of poor cache utilization and false sharing.
    -
    - - -

    Example

    - -

    -I had a high-resolution Gaussian grid and wanted to convert it to a 1x1 degree grid. -There were about 81 grid points in a 1 degree cell. The budget interpolation -in -new_grid worked but it was slow and worked by taking 25 bilinear interpolations -and averaging them to make the budget interpolation. So the pre-existing solution -was slow and slighly inaccurate. To interpolate scalars to the 1x1 grid, you can -run a box_average with 9x9 grid and then use -new_grid to get the cell average values. -This method is, as expected, slightly smoother than the budget interpolation of --new_grid. For vectors, you have to use the budget interpolation of the -new_grid option. -

    - -See also: -new_grid, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created March 8, 2018, Page last modified: March 9, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/c_grb2_inq.html b/web_docs/c_grb2_inq.html deleted file mode 100644 index 783ea68..0000000 --- a/web_docs/c_grb2_inq.html +++ /dev/null @@ -1,242 +0,0 @@ - - - - Climate Prediction Center - c_wgrib2api: grb2_mk_inq - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > c_wgrib2api: grb2_inq -
     
    - -

    c_wgrib2api: grb2_inq(..)

    -
    - - -

    Introduction

    - -

    -To read grib using c_wgrib2api, you first need to an -index or inventory file. -Then you call grb2_inq(..) with the appropriate search terms -and the data and metadata that you want. - -

    Usage

    -
    -    iret = grb2_inq(GRB2, INV, OPTION, (list of search terms))
    -    iret:  integer
    -           number of matchs to the search term
    -           -1 if some error
    -    GRB2: character (len=*) grib2 file
    -    INV:  character (len=*) index file
    -                            created by grb2_mk_inv(..)
    -                                    or wgrib2 GRB -Match_inv >INV
    -                            If you use an index file created by wgrib2 GRB > INV
    -                             then the search terms will be appropriate to that index file.
    -                             The *_date and *_edate optional arguments may not work.
    -    OPTION:  unsigned integer
    - 
    -    search term: character (len=*)
    -                 search term matches "wgrib2 GRB2 -Match_inv"
    -                 you are allowed 0 to 20 search terms
    -                 Normally the search is a straight text match.  You
    -                 can enable regex searches.
    -    IN Optional Arguments:
    -               debug: integer
    -                      0      - no debug statements
    -                      /= 0   - debug statements
    -
    -               end_date: integer (kind=8) YYYYMMDDHH search
    -               end_edate: integer (kind=8) YYYYMMDDHHmmss search
    -               ref_date: integer (kind=8) YYYYMMDDHH search
    -               ref_edate: integer (kind=8) YYYYMMDDHHmmss search
    -               start_date: integer (kind=8) YYYYMMDDHH search
    -               start_edate: integer (kind=8) YYYYMMDDHHmmss search
    -               verf_date: integer (kind=8) YYYYMMDDHH search
    -               verf_edate: integer (kind=8) YYYYMMDDHHmmss search
    -
    -               lastuse: integer
    -                        0    - nothing (default)
    -                        /= 0 - close GRB and INV files after use
    -               sequential: integer
    -                           0    - rewind INV before reading, stop after 1st match
    -                           /= 0 - do not rewind INV before reading, stop after 1st match
    -               regex: integer
    -                      0      - fixed string search (default)
    -                      /= 0   - regex search
    -               copy: character (len=*) filename
    -                     copies matches to file
    -               order: character (len=*) scan order of grid
    -                      'we:sn'   - grid will be in we:sn order (default)
    -                      'we:ns'   - grid will be in we:ns order
    -                      'raw'     - grid will be in raw order
    -                                  order as encoded in grib
    -                      note: lat, lon only work with we:sn order
    -    OUT Optional Arguments:
    -               grid: real allocatable (:,:)
    -                     grid point values
    -               lat:  real allocatable (:,:)
    -                     latitude values for the grid
    -               lon:  real allocatable (:,:)
    -                     longitude values for the grid
    -               nx:   integer, grid(nx,ny)
    -               ny:   integer, grid(nx,ny)
    -               npts: integer, number of grid points (nx*ny)
    -               nmatch: integer
    -                       number of matches                     
    -               msgno: integer
    -                      grib message of last match
    -               submsg: integer
    -                       submessage number of last match
    -               desc: character, (len=*)
    -                     "wgrib2 -S" minus the record number and byte location
    -               grid_desc: character, (len=*)
    -                          "wgrib2 -grid" 
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Feb 21, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/c_grb2_mk_inv.html b/web_docs/c_grb2_mk_inv.html deleted file mode 100644 index d1876dd..0000000 --- a/web_docs/c_grb2_mk_inv.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - Climate Prediction Center - wgrib2api: grb2_mk_inv - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > c_wgrib2api: grb2_mk_inv -
     
    - -

    c_wgrib2api: grb2_mk_inv(..)

    -
    - - -

    Introduction

    - -

    -To read grib using c_wgrib2api, you need to have an index or inventory file. -The index file is used for searching and it is quick to create. The -format of the index file keeps expanding as needed. For example, -chemical tracers were added to the grib format, so naturally the index -file had to include the possibility of a chemical type. - -

    -The index file created by grb2_mk_inv('file.grb2', 'file.inv') is the same as created by - -

    -  wgrib2 file.grb2 -Match_inv > file.inv
    -
    - -

    The inv file can be created before the C program is run. -This may be more efficient if multiple programs need to create -the inv of the same file. - -

    Usage

    -
    -    iret = grb2_mk_inv(GRB2, INV)
    -    iret:  integer
    -           0 if index file created
    -           1 if index file not created
    -    GRB2: character (len=*) existing grib2 file
    -    INV:  character (len=*) index file that is created
    -          Note: special files are supported
    -              @tmp:string   temporary disk file
    -              @mem:N        memory file, N=0..8
    -                            registers 9..19 are reserved by wgrib2api
    -
    - -

    Advanced Usage: pre-existing wgrib2 inventories

    - -

    -Pre-existing index files (wgrib2 inventories) can be used -to save processing time. However, there are two issues. -First, the typical inventory will be smaller and contain fewer -valid search terms. Second, the C API reference -date is YYYYMMDDHHmmss rather than the YYYYMMDDHH and assumed -zero minutes and seconds. So the C-API inventory -replaces the "d=YYYYMMDDHH" by "D=YYYYMMDDHHmmss". It's -not a big deal and both formats are accepted by the grb2_wrt -routine. The difference would be apparent in a search term -that of the form, - -

    -  mk_inv: ":D=YYYYMMDDHHmmss:HGT:200 mb:"
    -  std inv: ":d=YYYYMMDDHH:HGT:200 mb:"
    -
    - -Since the C api has added minutes and seconds to the -time stamp. Being consistent is nice. By the way, the -reference time has to be stored in a 64 bit integer when -passing to grb2_wrt. - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Oct 3, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/c_wgrib2api.html b/web_docs/c_wgrib2api.html deleted file mode 100644 index 7123d27..0000000 --- a/web_docs/c_wgrib2api.html +++ /dev/null @@ -1,319 +0,0 @@ - - - - Climate Prediction Center - c_wgrib2api - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > c_wgrib2api -
     
    - -

    c_wgrib2api

    -

    The Easy Way of Reading and Writing Grib2 Using C

    -
    - - -

    Introduction

    - -

    -Can a set of C make reading and writing grib2 easy? -Is it possible? -Can you read grib2 without referring to a the WMO grib standard? -Can you write grib2 without becoming an grib2 expert? Is reading and -writing grib now easier than other popular file formats? - -

    -The c wgrib2api is light-weight set of routines that calls -the wgrib2 subroutine to do all the heavy work. The advantage -of this approach is that c_wgrib2api is small (fewer bugs, ease -of development) and the hard work is done by pre-existing code. -The API is modelled after the ftn_wgrib2api which useful -for both the application and library developer. - - -

    Status

    -

    -

      -
    1. ftn_wgrib2api has been released and is being used -
    2. c_wgrib2api is in pre-release development -
    3. python_wgrib2api is in preplanning. -
    - - - -
    -#include <stdio.h>>
    -#include <stdlib.h>
    -#include "c_wgrib2api.h"
    -
    -int main() {                  /* simple program to read grib2 */
    -    long long int ndata;
    -    int ierr;
    -    float *data, *lat, *lon;
    -    char meta[200], gridmeta[1000];
    -
    -    ierr = grb2_mk_inv("merc.g2", "merc.inv");     /* make inv/index file */
    -    if (ierr) exit(1);
    -
    -    /* inquire - using 3 wgrib2 match strings, read data,lat,lon,metadata,gridmetadata */
    -    ndata = grb2_inq("merc.g2", "merc.inv", DATA|LATLON|META|GRIDMETA,
    -          ":TMP:",":d=2014050600:",":surface:");
    -    if (ndata <= 0) exit(2);
    -
    -    /* allocate data */
    -    data = (float *) malloc(ndata * sizeof(float));
    -    lat = (float *) malloc(ndata * sizeof(float));
    -    lon = (float *) malloc(ndata * sizeof(float));
    -    if (data == NULL | lat == NULL || lon == NULL) exit(3);
    -
    -    ierr = grb2_get_data(data,ndata);		/* get grid */
    -    if (ierr) exit(4);
    -    ierr = grb2_get_lonlat(lon,lat,ndata);	/* get lat-lon */
    -    if (ierr) exit(5);
    -    ierr = grb2_get_meta(meta, sizeof(meta));	/* get metadata */
    -    if (ierr) exit(6);
    -    ierr = grb2_get_gridmeta(gridmeta, sizeof(gridmeta));	/*get grid info */
    -    if (ierr) exit(7);
    -
    -    printf("That was easy: data[0[=%lf, lon[0]=%lf lat[0]=%lf ndata=%d\n",
    -      data[0],lon[0],lat[0],ndata);
    -    printf("meta=%s\n", meta);
    -    printf("gridmeta=%s\n", gridmeta);
    -    exit(0);
    -}
    -
    -
    - -

    -Reading doesn't get much easier than that. You are allowed an arbitrary number of -search term that are based on the wgrib2 inventory. You need to specify the -fields that you want. The above example selected "DATA|LATLON|META|GRIDMETA" to read. - -

    -Writing grib2 is also easy. First you need a template which is a sample grib2 file. The -template has the correct grid and unchanging metadata such as the center and grid definition. -The writing process consists of adding -the gridded data, the new variable name, level, reference date and forecast information -such as analysis, or 12 hour forecast and perhaps some ensemble information or some similar -changing metadata. - -

    Finding a template has gotten easier as grib2 has become more common. There are tools -to change the grid information (wgrib2) and change specific metadata information (wgrib2). -Suppose we already have a template. Writing a grib2 file is as easy as - - -

    -#include <stdio.h>>
    -#include <stdlib.h>
    -#include "c_wgrib2api.h"
    -#define GRIDSIZE 1679
    -
    -int main() {                    /* simple program write grib2 file */
    -        float data[GRIDSIZE];
    -        char *template;
    -        int i;
    -
    -        /* define data[0..npnts-1] */
    -        for (i = 0; i < GRIDSIZE; i++) data[i] = 10.0;
    -        data[0] = 0.0;
    -        template="merc.g2";
    -
    -        i = grb2_wrt("new.grb", template, 2, data, GRIDSIZE,"lev", "201 mb","grib_type","s",
    -              "ftime", "0-1 hour ave fcst","var","UFLX","bin_prec",7,"date",20880112010259LL);
    -
    -        printf("writing new.grb err=%d\n", i);
    -        return i;
    -}
    -

    -Writing grib is eavn easier than reading grib. -Reading and writing is based on text strings rather numbers in a table, so you don't have to -refer to the WMO documentation. All the text strings are based on the wgrib2 inventories, -so there should be no surprises as long as you are familiar with the wgrib2 inventories. - - -

    Tested Systems

    -

    -

  • RH6 icc - - - -

    Source Code

    -

    -The source code is included with wgrib2. Please use the -newest version of wgrib2 because c_wgrib2api is a new addition to wgrib2. To compile -and link with c_wgrib2api, you will have to use similar options that was used to -compile c_wgrib2api such as OpenMP, instruction set (32 vs 64 bits, SSE3 vs no SSE3, etc). - - - -

    -compiling (making the ftn_api)
    -Sample Code - -

    The default wgrib2/wgrib2api build includes the ipolates and netcdf3 libraries. If your fortran -code uses a different ipolates or netcdf libraries, you will have to configure the wgrib2's makefile -and rebuild the wgrib2 library without the ipolates and netcdf options. Removing the two libraries -will not have an effect on the grb2_*(..) routines. However, if the missing libraries would adversely -affect calls to wgrib2a(..) and wgrib2c(..) that use the -new_grid or -netcdf options. - - -

    -

    Documentation

    -
      -
    1. Making an index file, in order to read grib: grb2_mk_inv(..) -
    2. Reading grib: grb2_inq(..) -
    3. Writing grib: grb2_wrt(..) -
    4. Freeing files: grb2_free_file(..) -
    5. undefined grid points -
    6. HPC: introduction -
    7. HPC: reading/writing memory buffers/files -
    8. Sample fortran code: merge 2000 small grids -
    9. Example: calculating the average surface to 700 mb relative humidity. -
    -
  • - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: January 25, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/callable_wgrib2.html b/web_docs/callable_wgrib2.html deleted file mode 100644 index 6783d2a..0000000 --- a/web_docs/callable_wgrib2.html +++ /dev/null @@ -1,246 +0,0 @@ - - - - Climate Prediction Center - wgrib2: callable wgrib2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > callable wgrib2 -
     
    - -

    wgrib2: callable wgrib2

    -
    - - -

    Introduction

    - -

    -Usually wgrib2 is used as a command-line utility; however, wgrib2 can called -as a subroutine. The subroutine has the same arguments as an ordinary -C main program. - -

    -   int wgrib2(int argc, char **argv);
    -
    - -Making the wgrib2 library is similar to compiling wgrib2 but the -target of the makefile is "lib". - -
    -   tar -xzvf wgrib2.tgz
    -   cd grib2
    -   export CC=gcc
    -   export FC=gfortran
    -   make
    -   make lib
    -   library is in grib2lib/
    -
    - -

    -The above wgrib2 subroutine is the lowest level interface. The next stage -is to write a fortran API for reading and writing grib. - - - -

    FTN API

    - -

    The primary way of using callable_wgrib2 is through Fortran calls. -See the web pages wgrib2api. - -

    The equivalent calls are given by, - -

    -F95:   i = grb2_mk_inv(file, inv) 
    -C:     i = wgrib2a(file,"-rewind_init", file, "-inv", inv, "-Match_inv", NULL);
    -
    - -
    -F95: i = grb2_inq(file, inv, search1, search2, grid=data, npts=ndata)
    -C:   i = wgrib2a(file,"-i_file",inv,"-rewind_init",inv,
    -            "-inv","/dev/null",     /* unix/linux */
    -            "-fgrep", search1,
    -            "-fgrep", search2,
    -            "-rpn_sto", "19",
    -            "-ftn_api_fn0","-last0","@mem:19", NULL);
    -      /* check i */
    -      ndata = wgrib2_get_reg_size(19);
    -      /* check ndata */
    -      data = (float *) malloc(ndata * sizeof(float));
    -      /* check data */
    -      i = wgrib2_get_reg_data(data, size, 19);
    -      /* check i */
    -
    - -
    -F75:  i = grb2_wrt:(file, template, tmpno, data2=grid, meta=metadata)
    -C:    i = wgrib2_set_reg(grid, ndata, 19)
    -      /* check i */
    -      sprintf(number,"%d", ndata);
    -      i = wgrib2a(template,"-rewind_init",template,
    -          "-d",number,"-rpn_rcl","19","-set_metadata_str", metadata,
    -          "-set_grib_type", "c2", 
    -          "-grib_out", file)
    -
    -

    -The Fortran interface is much nicer than the C interface. - - -

    -9/2015: The write API was tested by converting a simple GFS post-processer -to grib2. - -

    -8/2016: After a hiatus of a year, I found need to do some analyses of grib -files. To make life easier, I converted converted all the files -into grib2 and started using the ftn api to read 10s of thousands -of grib files. It's convenient to use. - -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sep 20, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/calling_wgrib2.html b/web_docs/calling_wgrib2.html deleted file mode 100644 index 0c4c271..0000000 --- a/web_docs/calling_wgrib2.html +++ /dev/null @@ -1,254 +0,0 @@ - - - - Climate Prediction Center - wgrib2: calling wgrib2 from C - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 calling wgrib2 from C -
     
    - -

    wgrib2: Calling wgrib2 from C

    -
    - - -

    Introduction

    - -

    -There 3 basic ways to call wgrib2 from a C program. The simpler way is to call -wgrib2 and when wgrib2 finishes execution, control is returned to the calling -program. A more complicated way to run wgrib2 in another process and communicate -between the two processes. - -

    Simple: system call

    - -

    -Calling wgrib2 from C can be as simple as calling the system function - -

    -    system("wgrib2 IN.grb -match ":TMP:2 m above ground:anl:" -csv tmp2m.csv"); 
    -
    - -This approach is simple but there is overhead of initializing and running wgrib2 -as well as opening and closing of the files for every call to wgrib2. All -the communication with wgrib2 is through the file system. - -

    Wgrib2 as a subroutine, CW2

    - -

    -Wgrib2 v2.0.2 introduced the ability to call wgrib2 as a subroutine (CW2). This avoids -the overhead of loading wgrib2 into memory every time you run wgrib2. Time is -also saved by keeping the files open between calls. Memory files were introduced to -wgrib2, so that the calling program can encode and decode buffers and avoid using -the disk to communicate with wgrib2. -

    - -
    -    int argc;
    -    char argv[MAX_ARGC][MAX_STRLEN];
    -    ...
    -    ierr = wgrib2(argc, argv);
    -
    -More information is given in callable_wgrib2. This -facility was used to create a fortran api to read and write grib2. -

    - -

    Wgrib2 as a Process (Filter)

    - -A program can run wgrib2 as a process and communicate to wgrib2 by -a pipe. In this example, the main program has grib -data and it wants the data regridded or converted into netcdf. - -
    -#include <stdio.h>
    -#include <stdlib.h>
    -
    -/*
    - * how to call wgrib2 from a C program.
    - *
    - * in this example, the main program writes grib data to a pipe, 
    - * wgrib2 reads from the pipe, regrids the data and saves in a file.
    - *
    - * This example shows how to call wgrib2 from a C program
    - *
    - */
    -
    -#define INPUT_FILE  "../examples/gep19.t00z.pgrb2af180"
    -
    -
    -int main() {
    -
    -   FILE  *input, *wgrib2_input;
    -   int c,err;
    -
    -   /* open a file with "test" data */
    -   input = fopen(INPUT_FILE,"rb");
    -   if (input == NULL) exit(1);
    -
    -   /* run wgrib2 to read from stdin and interpolate to a new grid */
    -
    -   wgrib2_input = popen("wgrib2 - -new_grid_winds earth -new_grid ncep grid 221 out.221.grb","w");
    -   if (wgrib2_input == NULL) exit(2);
    -
    -   while ( (c = fgetc(input))  != EOF) {
    -	fputc(c, wgrib2_input);
    -   }
    -
    -   /* close the wgrib2 program */
    -   err=pclose(wgrib2_input);
    -   printf("all done, err=%d\n",err);
    -
    -   return 0;
    -}
    -
    -A grib encoder was developed using wgrib2 as a process. The main program would write -data to a pipe and wgrib2 would read the pipe and write a grib file. The advantage -of this approach is the the writing is multitasking. The disadvantage is that -it was difficult to develop a grib reader using this approach. Eventually CW2 was -developed to solve the grib reader problem and CW2 became the appropriate approach -for writing grib. - - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Oct 25, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/center.html b/web_docs/center.html deleted file mode 100644 index d6e9e99..0000000 --- a/web_docs/center.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -center - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-center -
     
    - -

    wgrib2: -center

    -
    - - -

    Introduction

    - -

    -The -center option prints out the center (ex. NCEP, ECMWF) that created -the grib file. If your center is printed as a number rather than a name, feel welcome to send -an email requesting an update to the tables. - -

    Usage

    -

    - -

    --center
    -
    - - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -center
    -1:0:center=US National Weather Service - NCEP (WMC)
    -2:46042:center=US National Weather Service - NCEP (WMC)
    -3:63079:center=US National Weather Service - NCEP (WMC)
    -...
    -
    - - See also: -set_center, - -set, - -subcenter - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/check_pdt_size.html b/web_docs/check_pdt_size.html deleted file mode 100644 index 709cea0..0000000 --- a/web_docs/check_pdt_size.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -check_pdt_size - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -check_pdt_size -
     
    - -

    wgrib2: -check_pdt_size

    -
    - - -

    Introduction

    - -

    -Wgrib2 v3.0.1 will check the size of the Product Definition Template (PDT, Section 4). -If the PDT is wrong size, wgrib2 will exit with a delayed fatal error. The fatal -error is delayed so the user can investigate the contents of the bad grib message. -Note that it is possible to seg fault because Section 4 is a different size than -expected, and the rest of the grib message may be corrupted. - -

    -You may skip the pdt size check using the option -check_pdt_size 0. -You would use this option if wgrib2 calculates the incorrect size of Section 4. - -

    Usage

    -

    - -

    --check_pdt_size    0 disable PDT size check
    -                   1 enable  PDT size check
    -
    - -

    Example

    -

    -

    -$ wgrib2 png.grb2 -check_pdt_size 0
    -1:4:YY=2009
    -
    - - - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created: Nov 24, 2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/checksum.html b/web_docs/checksum.html deleted file mode 100644 index 9495609..0000000 --- a/web_docs/checksum.html +++ /dev/null @@ -1,270 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -checksum - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-checksum -
     
    - -

    wgrib2: -checksum

    -
    - - -

    Introduction

    - -

    -The -checksum option writes the checksum (32 bit CRC) -for the entire grib message, the decoded grid-point data or any -specified section. Two sections or messages with the same checksum are -very probably the same. If the grid-point data has the same -checksum, they are very probably bitwise identical. This option -can be used to check the integrity of a grib message or to check for -for identical sections. Note that decoded grid-point values may -not be unique. Wgrib2 is compiled with the "fast" option which may -sacrifice some precision for speed or uniqueness. For example, -A*B*C should be calculated by (A*B)*C. However A*(B*C) will be -faster if B*C was previously calculated. While -mathematically the expressions are the same, the final results may -be slightly different. -

    - -

    Usage

    -

    - -

    --checksum N
    -1..8 for the checksum of section N
    --1 for the checksum of the entire message
    -data for the checksum of the decoded gridded data
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -checksum 3
    -1:0:sec3_cksum=4006285726
    -2:4786:sec3_cksum=4006285726
    -3:9572:sec3_cksum=4006285726
    -4:13335:sec3_cksum=4006285726
    -5:17098:sec3_cksum=4006285726
    -
    -Section 3 is the Grid Definition Section (GDS).
    -All 5 grib messages have the same GDS
    -
    -$ wgrib2 png.grb2 -checksum -1
    -1:4:msg_cksum=827378178
    -
    -
    -
    -
    -
    -$ wgrib2 test.grb2 -checksum 3 | cut -f3 -d: | sort -u | wc -l
    - 1
    -
    -The above example prints out the number of grid defintion sections in the -file by (1) creating the checksum for the GDS, (2) extracting the GDS checksum, -(3) finding the unique checksums and finally counting them. - -

    -Space can be saved by putting combining like grib messages. For example, -if a 100 messages share the same bitmap and discipline, then the -100 messages could be combined into one message with a hundred -submessages. By combining the message, only one copy of the -bitmap is needed. This saves 99 copies of the bitmap. -

    -$ wgrib2 test.grb2 -checksum 6 | sort -k3,3 -t: | wgrib2 test.grib -i -tosubmsg new.grb2
    -1:0:d=2008120200:TMP:800 mb:anl:
    -2:4786:d=2008120200:TMP:750 mb:anl:
    -3:9572:d=2008120200:RH:800 mb:anl:
    -4:13335:d=2008120200:RH:750 mb:anl:
    -5:17098:d=2008120200:TMP:2743 m above mean sea level:anl:
    -
    -Submessage statistics:
    -- # submessages written  : 5
    -- Kbytes saved           : 0
    -- Kbytes written         : 20
    -
    - - - -

    -See also: -

    - - - - - - - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - - - -

    -See also: -undefine -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: August 15, 2014, July 2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/code_table.html b/web_docs/code_table.html deleted file mode 100644 index dbb6040..0000000 --- a/web_docs/code_table.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -code_table - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-code_table -
     
    - -

    wgrib2: -code_table

    -
    - - -

    Introduction

    - -

    -The -code_table_X.Y option shows the value of code table X.Y in -the inventory. Code tables are parts of the nuts and bolts of the grib2 format. -To see which code tables are supported , type wgrib2 -help "code table". - -

    -wgrib2 beta 0.1.3 wesley ebisuzaki 9/2006
    -  -code_table_0.0 inv         code table 0.0 discipline
    -  -code_table_1.0 inv         code table 1.0 master table version
    -  -code_table_1.1 inv         code table 1.1 local table version
    -  -code_table_1.2 inv         code table 1.2 significance of reference time
    -  -code_table_1.3 inv         code table 1.3 production status of processed data
    -  -code_table_1.4 inv         code table 1.4 type of processed data
    -  -code_table_3.0 inv         code table 3.0 Source of grid definition
    -  -code_table_3.1 inv         code table 3.1 Grid definition template number
    -  -code_table_3.2 inv         code table 3.2 Size and Shape of Earth
    -  -code_table_3.6 inv         code table 3.6 Spectral data representation type
    -  -code_table_3.7 inv         code table 3.7 Spectral data representation mode
    -  -code_table_4.0 inv         code table 4.0 Product Definition Template Number
    -  -code_table_4.1 inv         code table 4.1
    -  -code_table_4.2 inv         code table 4.2
    -  -code_table_4.3 inv         code table 4.3 Type of Generating Process
    -  -code_table_4.4 inv         code table 4.4
    -  -code_table_5.0 inv         code table 5.0 data representation number
    -
    - -

    Usage

    -

    - -

    --code_table_X.Y
    -      X.Y has to be one of the supported code tables
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/colon.html b/web_docs/colon.html deleted file mode 100644 index 9d0498c..0000000 --- a/web_docs/colon.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -colon - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -colon -
     
    - -

    wgrib2: -colon

    -
    - - -

    Introduction:

    - -

    -The wgrib2 inventory consists of many fields separated by a colon (:). For example, - -

    -    $ wgrib2 small.grb2
    -    1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -
    - -You can change the field separator from a colon to any string. For example, - -
    -    $ wgrib2 -colon "[--]" small.grb2
    -    1:0[--]d=2009060500[--]HGT[--]200 mb[--]180 hour fcst[--]ENS=+19
    -

    -

    -You may want to use the -colon option because -you are going to be parsing the inventory with another program that uses -a different field separator. (CSV file?). - -

    Usage

    -

    - -

    --colon string
    -
    -

    Example

    -
    -    $ wgrib2 small.grb2  -colon ':,"' -t  -colon '","'  -var -lev -ftime -misc -colon '' -print '"'
    -    1:0:,"d=2009060500","HGT","200 mb","180 hour fcst","ENS=+19"
    -
    - -See also: --print, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: September 27, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/compile_questions.html b/web_docs/compile_questions.html deleted file mode 100644 index 8283b9f..0000000 --- a/web_docs/compile_questions.html +++ /dev/null @@ -1,664 +0,0 @@ - - - - Climate Prediction Center - wgrib2: how to compile - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 questions -
     
    - - -

    Compiling wgrib2 v3.0.2+

    -
    - -
    1) Download ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz 
    -        or https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz
    -2) remove pre-existing grib2 directory if exists: rm -r grib2
    -3) untar wgrib2.tgz:  tar -xzvf wgrib2.tgz   (use gnu tar)
    -4) cd to main directory:  cd grib2
    -
    -  For wgrib2 upto v3.1.2 .. add AEC support for ECMWF files
    -
    -5) edit makefile
    -6) change USE_AEC=0 to USE_AEC=1
    -
    -The makefile uses two and one optional environment variables that have to be set.
    -  With wgrib2 v3.0.2, you need to set $CC and $FC, and the makefile tries to identify
    -    $COMP_SYS from "uname -a".  However, if the makefile cannot identify your system,
    -    $COMP_SYS will not be set.  If your compilers are gcc and gfortran, you can
    -    try compiling wgrib2 with COMP_SYS=gnu_linux.
    -
    -
    -  linux, bsd-type OS, gcc/gfortran compilers:  COMP_SYS=gnu_linux
    -                                               CC=gcc
    -                                               FC=gfortran
    -  linux, AOCC:                                 COMP_SYS=clang_linux
    -                                               CC=clang
    -                                               FC=flang
    -  linux, icc and ifort:                        COMP_SYS=intel_linux
    -                                               CC=icc
    -                                               FC=ifort
    -  linux, icx and ifx: requires wgrib2 v3.1.2   COMP_SYS=oneapi_linux
    -    (needs src code bug fix)                   CC=icx
    -                                               FC=ifx
    -  linux, Nvidia HPC SDK                        COMP_SYS=nvidia_linux
    -                                               CC=nvc
    -                                               FC=nvfortran
    -
    -  Windows, cygwin gcc and gfortran:            COMP_SYS=cygwin_win
    -                                               CC=gcc
    -                                               FC=gfortran
    -
    -  MacOS, real gcc and gfortran:                COMP_SYS=gnu_mac
    -                                               CC=gcc
    -
    -
    -
    -  not recently tested AIX, gnu_linux_g95, open64
    -  If COMP_SYS is not defined, the makefile will attempt to determine the COMP_SYS.
    -
    -8) set environment variables and make, example
    -
    -   export CC=gcc                    (bash version)
    -   export FC=gfortran
    -   export COMP_SYS=gnu_linux        (optional in linux)
    -   make                             (to make wgrib2)
    -   make lib                         (to make wgrib2 library) 
    -
    -   For NCEP's WCOSS-2.  see the question on lib64, and WCOSS-2.
    -
    - - -

    AEC and ECMWF files

    -ECMWF started using AEC compression (type 42) June 2023. The default wgrib2 v3.1.2 and earlier -did not include AEC compression in the default build because building it requires a -recent version of CMake. Some sites, like my workplace, do not provide CMake. So I -cannot (June 2023) build the AEC library at work. -Now that ECMWCF is distributing files with AEC compression, wgrib2 v3.1.3 will include -AEC compression as default. - - -

    Intel Compilers

    - -The Intel C compiler will not compile the Jasper library (jpeg2000 support). -To get jpeg2000 support, you will either have to use OpenJPEG or compile -Jasper with the gnu compiler. The makefile will automatically use gcc when -trying to build the Jasper library when the classic Intel compilers are used. -Compiling wgrib2 using the Intel compilers on Windows is possible but is -not supported. (Grib files will be limited to 2 GB, and I have no way to test.) -

    -To compile with the intel compilers on linux, - -

    -Classic compilers
    -   export CC=icc
    -   export FC=ifort
    -   export COMP_SYS=intel_linux
    -   make
    -
    -LLVM compilers (wgrib2 v3.1.2+)
    -   need to use OpenJPEG instead of Jasper
    -   export CC=icx
    -   export FC=ifx
    -   export COMP_SYS=oneapi_linux
    -   make
    -
    - -

    Compiling with Cygwin (Windows)

    - -

    The only Windows C compiler supported is Cygwin's gcc. -The other Windows C compilers follow Microsoft's lead where -a "long int" is 32-bits on a 64 bit operating system. Wgrib2 -will work with a 32-bit long int but will limit a grib file -to barely acceptable 2GB size. Cygwin's gcc also supports POSIX -which means that you don't have to turn off features that require POSIX. - -

    Compiling in MacOS

    - -

    You need to use compile with gcc and gfortran. The default MacOS -installation has gcc pointing to clang. You can get the real deal -from homebrew. - -

    With wgrib2 v3.0.0, MacOS support is now builtin. For prior -releases, there have been nice pages which detail the compiling process. - -

    With wgrib2 v3.1.2, you have to turn off proj support. - -

    Compiling with other compilers

    - -

    -There is no support for other compilers. At one time, AIX was -supported until our machines were scraped (2012). Use to support -gcc/g95 and the open64 compilers until development was stopped on -g95 and open64. I haven't tried the Cray compilers because -the Crays are already well supported by gcc/gfortran, icc/ifort -and clang/flang. - -

    While there is no support for other compilers, the wgrib2 source -code was written to be operating system, compiler and hardware independant. The only -limitation is that integers need to be 32+ bits long. The only compiler/hardware -feature is an optional optimization to replace a loop with a __builtin_clz() -which works when GNUC >= 4. The main difficulties with porting to another -system should be in the libraries and disabling POSIX features. - - - -

    Makefile Options

    - - - -

    There are many options that are documented in the makefile (grib2/makefile). -There are options to remove features that require POSIX support. There are -options to remove libraries that are not public domain or not under a GNU license. -There are options for code that may be difficult to cross-compile. - -

    Python Support, make a shared library

    - -

    -Python support requires a shared wgrib2 library. This option -only works for gnu/linux, gnu/MacOS, gnu/Windows, nvidia/linux AOCC/linux, icx/ifx. - -

    -  MAKE_SHARED_LIB=1
    -   note: to make the shared library $ make clean
    -                                    $ make lib
    -                                    shared library will be in lib/
    -
    - - -

    Grib names

    -

    -With wgrib2 v3.0.2, the grib variable names are shown using the -DWD, ECMWF or NCEP tables. The locally defined variable names are -shown by the table of the local center. This option sets the default -grib table. -

    -Not all names could be -accommadated because some of the names had level, timing information -This feature is more beta because of the difficulty with level -and timing information in the variable names. -

    -  USE_NAMES=NCEP          use NCEP name (default)
    -  USE_NAMES=ECMWF         use ECMWF names
    -  USE_NAMES=DWD1          use DWD names, DWD has two center ids.
    -
    - - -

    NetCDF

    - -
      -
    • Option 1: No NetCDF support -
        -
      • fastest compile -
      • small executable (3.9 MB as of 2014) -
      • compile works on 32+ bit machines -
      • cannot read nor write NetCDF files -
      • no library conflicts in wgrib2lib when calling program - uses netcdf or hdf -
      • makefile configuration: USE_NETCDF3=0, USE_NETCDF4=0 -
      - - -
    • Option 2: NetCDF3 support (default in makefile) -
        -
      • fast compile -
      • modest increase in executable size (5.7 MB vs 3.9 MB as of 2014) -
      • compile may fail on 32-bit machines -
      • library conflict in wgrib2lib when calling program that uses netcdf -
      • makefile configuration: USE_NETCDF3=1, USE_NETCDF4=0 -
      -
    • Option 3: NetCDF4 compile libraries -
        -
      • slow compile time (hours on an Intel Apollo Lake) -
      • 3.5x increase in executable size (13.5 MB vs 3.9 MB as of 2014) -
      • makefile configuration: before wgrib2 v3.1.2 USE_NETCDF3=0, USE_NETCDF4=1 -
      • makefile configuration: wgrib2 v3.1.2+ USE_NETCDF3=0, USE_NETCDF4=compile, USE_HDF5=compile -
      • may or may not work -
      • User is resonsible for validating the results using the netcdf4/hdf5 libraries. -
      • library conflict in wgrib2lib when calling program also uses netcdf -
      • prompts for downloading netcdf4/hdf5 libraries -
      -
    • Option 4: NetCDF4 and HDF5 system libraries (v3.1.2+) -
        -
      • In some systems, the netcdf4 and hdf5 libraries are automatically found -
      • makefile configuration: wgrib2 v3.1.2+ USE_NETCDF3=0, USE_NETCDF4=system, USE_HDF5=system -
      • User is resonsible for validating the results using the netcdf4/hdf5 libraries. -
      -
    • Option 5: NetCDF4 and HDF5 libraries installed (v3.1.2+) -
        -
      • makefile configuration: wgrib2 v3.1.2+ USE_NETCDF3=, USE_NETCDF4=A:B, USE_HDF5=C:D -
      • A=directory of the NetCDF4 includes -
      • B=directory of the NetCDF4 libraries -
      • C=directory of the HDF5 includes -
      • D=directory of the HDF5 libraries -
      • User is resonsible for validating the results using the netcdf4/hdf5 libraries. -
      -
    - -

    -The NetCDF4 option is currently unsupported (10/2020). Compiling -NetCDF/HDF5 is strongly dependent on the compiler and linux distribution. -Testing has been a pain as some errors only occur in specific situations. -The user needs verify that NetCDF/HDF5 is working. - - -

    JPEG2000: Jasper, OpenJPEG

    - -

    With wgrib2 v3.0.0, jpeg2000 compression can be handled by either the -Jasper or OpenJPEG library. Both libraries are equally slow and files are -roughly the same size. (I haven't tried compiling OpenJPEG with AVX2.) -The advantages with the Jasper library is that the last problem with the Jasper library was fixed -may years ago. The disadvantage with Jasper is that support may be lacking and -it doesn't compile with several C compilers. -The advantage with OpenJPEG is the support is ongoing. The disadvantage is that it requires -cmake to build. Consequently I cannot build and test the OpenJPEG version on my linux -workstation at work. Eventually OpenJPEG will be the default option. - - -

    Some libraries are being created in grib2/lib64

    - -

    Normally the libraries created by the wgrib2 build are stored in -grib2/lib. However, I found one weird machine that put some libraries in grib2/lib64. -One builds many of the libraries by first configuring the build by running -the "./configure" program. The "./configure -help" command says the libraries -will be saved in (whatever)/lib. However, in the weird machine, the -$CONFIG_SITE script changes it ti (whatever)/lib64. In my case, you can -work around this $CONFIG_SITE by - -

    -$ make
    -  (crash)
    -$ cp -r lib64/* lib/
    -
    -if you want the wgrib2 program
    -$ make
    -
    -if you want the wgrib2 library
    -$ make lib
    -
    -
    -
    -
    -

    Missing zlib.h

    -
    -

    -I haven't been able to reproduce this compiling problem. The png compression requires -both the zlib library and the zlib.h include. I suspect that the libpng configure program -is using the system zlib because it finds the system zlib library. Perhaps the fix is -to install the zlib.h files by installing the "zlib-develop" package. Another fix -is to remove the system zlib and let libpng use the wgrib2-supplied zlib. The third -fix is to diable png compression in the make file. PNG compression -is not very good and I have only seen it used by RADAR files from ESRL. - - -

    wgrib2 compile questions

    - -

    -

    Question: Warnings about parameter type mismatch in fftpack.f"?
    -
    -Answer:
    -   The file fftpack.f is was written to an old fortran standard
    -before you had an allocatable array and memory was at a premium.
    -To save space, a real work array was defined and used in some parts 
    -of the code.  The same array was used in other parts of the code 
    -which needed an integer work array.  You save memory by using the 
    -same array in both places.  It was common practice and the old 
    -compilers didn't complain.  Ignore the warnings.
    -
    -

    -

    Question: Why do you not support "make install"?
    -
    -Answer:
    -
    -  "Make install" is not supported by the makefile because
    -installation is just copying the executable to another location.
    -There is no obvious default for all systems.
    -
    - -

    -

    Question: Why do you build japser with the following flags?
    -
    -     --disable-libjpeg --disable-opengl
    -
    -Answer:
    -
    -Libjpeg is not needed by wgrib2.  The makefile should work when
    -the system doesn't have libjpeg installed.
    -
    -Opengl is not needed by wgrib2. Makefile should still work when the 
    -system doesn't have opengl installed.
    -
    -The wgrib2 makefile compiles the libraries in a manner optimized for wgrib2.
    -The libraries are not meant for general use.  For example, the netcdf library
    -doesn't have a fortran interface because I want the makefile to
    -work if a user lacks a fortran compiler. 
    -
    - -

    -

    -
    -Question: Why do build zlib and libpng?
    -
    -Answer:  Not all linux distributions include libpng or they give it a 
    -different name.  Some linux distributions may have different versions 
    -of libpng and zlib.
    -
    - -

    -

    Question: Why don't you make netcdf4 the default netcdf package?
    -
    -Answer:
    -
    -The Netcdf4/hdf5 libraries are very big and the end result is a long
    -download time and a large executable. If you decide to compile with
    -Netcdf4, the make will fail with the commands needed to download
    -the netcdf4 and hdf5 libraries.  After you have download the libraries,
    -the make should work. 
    -
    -At the current time (9/2020), compiling with the netcdf4 option has been 
    -unsupported for a few years.  (Classes of users will have problems and nothing
    -can be done.) Until recently, the hdf5 library had problems being compiled 
    -with the newer versions of gcc.  The latest version will compile with the 
    -gcc included with Ubuntu.  However the newest version breaks the -import_netcdf
    -option with a uninformative hdf5 error message. 
    -
    - -

    -

    Question: Why don't you automatically download the netcdf and hdf5 packages?
    -Answer:
    -
    -   People concerned about security would not like that action.
    -
    - -

    -

    Question: I get the error messagee: /bin/sh: ./configure: Permission denied
    -
    -Answer:
    -
    -It is possible to configure a filesystem so that the execute bit is
    -set to zero. Programs and scripts will not execute when they reside
    -on that filesystem.  Try compiling on another filesystem.  If that doesn't
    -work, you are probably not allowed to download programs.  The solution
    -is to ask that your sys admin to compile the program for you.  But if
    -your sys admin will compile code for you, why are you reading this page?
    -Let him read this page.
    -
    -

    -

    Question: Why the options to turn off aec, jpeg2000 and png compression
    -
    -Answer:
    -
    -Some HPC machines use one type of cpu and/or OS to compile and
    -another type of cpu and/or OS to run (cross-compile).  Using configure
    -scripts can be a challenge when cross-compiling.  I wanted a reasonable
    -wgrib2-subset that can be cross-compiled.  Consequently all libraries that
    -that require a configure script are optional.
    -
    -The configure programs of various libraries may not handle certain
    -machines or compilers.  For example an ARM user had to turn off the
    -jasper library.  Clang on the MacOS may be a problem for the AEC
    -library.
    -
    - -

    -

    Question: Why does compiling wgrib2 with the Netcdf option fail?
    -
    -Answer:
    -
    -This frequently happens with 32-bit machines.  This problem goes away
    -on a 64-bit platform or if netcdf-4 is used instead of netcdf-3. This
    -problem is not being addressed because of a lack of 32-bit machines.
    -
    -Some versions of hdf5 will not compile with modern C compilers.
    -
    - -

    -

    Question: Why the option to turn off g2clib?
    -
    -Answer: g2clib is not needed but it can be installed for testing at NCEP.
    -
    -

    -

    Question: Why gctpc and proj4? Why not proj4 without gctpc?
    -
    -Answer: Gctpc and proj4 are both projection libraries and only one is
    -really needed.  Proj4 has more functionality, is modern and has an
    -active support group.  Gctpc is old and is more-or-less unsupported.
    -On the other hand, gctpc is simpler, works and supports OpenMP like the
    -rest of wgrib2.  Proj4 supports a different threading model.  As
    -grids get larger, you want the speed of gctpc. Both libraries are being 
    -supported in order to help debugging and in the case that a future
    -grid requires Proj4 support.
    -
    -

    -

    Question: Why so many compile options?
    -
    -Answer:  
    -  Some systems or compilers do not support certain POSIX features
    -  Some functionality is not needed by most systems.
    -  Not all systems have fortran, MySQL, or support NetCDF/HDF5.
    -  The code that calls IPOLATES is not using a standard interface.
    -  Some systems do not handle cross-compiling easily.
    -  Some uses of wgrib2 may require a small RAM usage.
    -  Same makefile is used to compile the wgrib2 library.
    -  Some compilers may not support C99 or C11 (future).
    -
    - -
     Problem: I compiled wgrib2 and when I run it, it complains about 
    -      missing libraries.
    -
    -Answer:
    -  I have the same problem with our Cray.  If you compile with the Intel 
    -  compilers, you have to load the Intel environment before running the
    -  executables.  If you compile with the GNU compilers, you have to load 
    -  the GNU environment before running.  The way to get around this
    -  problem is to compile wgrib2 with the same compiler that was used
    -  to compile the system commands.  (An old version of gcc/gfortran.)
    -
    - -
    Question: I am compiling with Intel Compilers and amd getting undefined references.
    -
    -Answer:
    -  If you get an error message to a "ompc" routine like
    -
    -      Ncpu.c:(.text+0x24): undefined reference to `ompc_set_num_threads'
    -
    -  This is because you are using an old Intel compiler.  The makefile uses the 
    -current option to enable OpenMP rather than the old option.  
    -
    - -
    Question: Why don't the get_*.sh work?
    -
    -Answer:
    -   The get_*.sh scripts download tables from the WMO github servers,
    -and local tables from various centers.  My work machine has wget v1.14,
    -and gets this error.
    -
    -    wget: unable to resolve host address ‘-o-’
    -
    -My home machine has wget v1.20 and works.  The created *.dat file can
    -be used on machines with an old wget.
    -
    - -
      Question: how to compile on RedHat 6? 
    -
    -RedHat 6 uses an old version of gcc (v4.4) which doesn't fully support 
    -OpenMP v3.1.  You can compile wgrib2 v2.0.8.  For a more modern version
    -of wgrib2, you will have to turn off OpenMP and Proj4 by changeing grib2/makefile
    -
    -   USE_OPENMP=0
    -   USE_PROJ4=0
    -
    -Of course, moving to a newer version of Redhat means that you getting
    -more wgrib2 testing.  Testing building wgrib2 was tested on RH8 but
    -not RH6. Future testing will include building on RH7, RH8, Ubuntu v20.04LTS,
    -and Ubuntu v22.04LTS.  
    -
    -
    - - -
      Question: how to compile on WCOSS-2 using icc/ifort? 
    -
    -   module install intel/19.1.3.304    module load the intel compiler
    -   export CC=icc
    -   export FC=ifort
    -   make                               this will fail because of missing libraries
    -   cp lib64/*a lib/                   they changed configure to write the libraries to lib64 instead of lib
    -   to make wgrib2: make
    -   to make libwgrib2: make lib
    -
    -   OpenJPEG will not compile on WCOSS-2.  OpenJPEG requires the png, tiff, lcms, z libraries
    -   and the WCOSS2 build complains about missing libjbig and liblzma.  I see them in /usr/lib64.
    -
    -   Icc/ifort will compile OpenJPEG on my personal machine. I spent enough time with compiling 
    -   wgrib2 on this weird machine.
    -
    - - - - - - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page modified: Dec 29, 2017, Oct 13, 2019, Sep 30, 2020, Oct 2020, Feb 2021, Oct 2021, Jan 2023. Feb 2023 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/config.html b/web_docs/config.html deleted file mode 100644 index 3711cd2..0000000 --- a/web_docs/config.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -config - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-config -
     
    - -

    wgrib2: -config

    -
    - - -

    Introduction

    - -

    -The -config option shows the configuration of wgrib2 -and then ends the program. - -

    Usage

    -

    - -

    --config
    -
    - -

    Example

    -

    -

    -$ wgrib2 -config
    -wgrib2 v0.1.7.8h 4/2009 Wesley Ebisuzaki, Jaakko Hyvätti, Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Arlindo da Silva, Niklas Sondell, Sergey Varlamov
    -
    -Compiled on 10:54:05 Apr 24 2009
    -
    -Netcdf3 package is installed
    -Netcdf4 package is not installed
    -mysql package is not installed
    -regex package is installed
    -tigge package is installed
    -maximum nunber of arguments on command line: 300
    -stdout buffer length: 30000
    -g2clib is the default decoder
    -
    -

    -Here is the config four years later. -

    - -
    -$ wgrib2 -config
    -bash-4.1$ wgrib2 -config
    -wgrib2 v0.1.9.9beta3 8/2013 Wesley Ebisuzaki, Reinoud Bokhorst, Jaakko Hyvätti, Dusan Jovic, Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Arlindo da Silva, Niklas Sondell, Sergey Varlamov
    -
    -Compiled on 12:09:10 Sep  3 2013
    -
    -Netcdf package: "3.6.3" of Sep  3 2013 12:01:28 $ is installed
    -mysql package is not installed
    -regex package is installed
    -tigge package is installed
    -interpolation package is installed
    -gptpc interface: experimental v0.1
    -UDF package is not installed
    -maximum number of arguments on command line: 5000
    -maximum number of -match,-not,-if, and -not_if arguments: 1000
    -stdout buffer length: 30000
    -default decoding: g2clib emulation
    -g2clib decoders are installed
    -user gribtable: (none)
    -C compiler: gcc
    -Fortran compiler: gfortran
    -OpenMP: control number of threads with environment variable OMP_NUM_THREADS
    -INT_MAX:   2147483647
    -ULONG_MAX: 18446744073709551615
    -
    - -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/convert_wgrib2.html b/web_docs/convert_wgrib2.html deleted file mode 100644 index 391a48d..0000000 --- a/web_docs/convert_wgrib2.html +++ /dev/null @@ -1,293 +0,0 @@ - - - - Climate Prediction Center - wgrib2: wgrib -> wgrib2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib -> wgrib2 -
     
    - -

    wgrib -> wgrib2

    -
    - - -

    Changed options

    - -

    -Converting scripts that use wgrib to wgrib2 should be straight forward. - - -

    -       wgrib                             wgrib2
    -
    -       -d all                            (no option needed)
    -       -d N                              -d N or -d N.M (for grib2 submessages)
    -       -bin -o FILE.BIN                  -bin FILE.BIN
    -       -text -o FILE.TXT                 -text FILE.TXT
    -       -ieee -o FILE.BIN                 -ieee FILE.BIN
    -       -grib -o FILE.GRIB                -grib FILE.GRIB
    -       -nh                               -no_header
    -       -h                                -header
    -       -verf (sets verf time flag)       -verf (write inventory with verf time)
    -       -s -verf                          -verf
    -       -PDS/-PDS10                       n/a, use -get_bytes
    -       -GDS/-GDS10                       n/a, use -get_bytes
    -       -ncep_opn/-ncep_rean              not needed
    -       -4yr                              not needed, -4yr is always set
    -       -ncep_ens                         n/a, not needed
    -       -p                                n/a
    -       -dwdgrib                          n/a, not needed
    -       -H                                n/a
    -       -o                                not needed, syntax change
    -       -----                             -order ???? (grids are converted to we:sn order by default)
    -                                         use -order we:ns for GFS, nothing for NAM.
    -
    - - -

    Changed inventory format, different searches

    - -

    -The wgrib2 inventory has changed. The various grep/egreps will have to be -changed to see if they are compatible with new inventory format - -

    -works:
    -            wgrib  FILE | grep ":HGT:" | wgrib -i  FILE -bin -o FILE.BIN
    -            wgrib2 FILE | grep ":HGT:" | wgrib2 -i FILE -bin FILE.BIN
    -            wgrib2 FILE -bin FILE.BIN -match ":HGT:"
    -
    -works:
    -            wgrib -4yr FILE | grep ":d=2006081712:" | wgrib -i  FILE -bin -o FILE.BIN
    -            wgrib2 FILE | grep ":d=2006081712:" | wgrib2 -i  FILE -bin -o FILE.BIN
    -            wgrib2 -match ":d=2006081712:" FILE -bin -o FILE.BIN
    -
    -wgrib2 uses a 4 digit year code.  Scripts using 2 digit years need to modified.
    -
    -convert:
    -            wgrib  FILE | grep ":d=06081712:" | wgrib -i  FILE -bin -o FILE.BIN
    -            wgrib2 FILE | grep ":d=2006081712:" | wgrib2 -i  FILE -bin -o FILE.BIN
    -            wgrib2 -match ":d=2006081712:" FILE -bin FILE.BIN
    -
    -wgrib2 doesn't print out kdps5 .. kpds7 which are not applicable to grib2.
    -
    -convert:
    -            wgrib  FILE | grep "kpds5=7:kpds6=100:kpds7=500:" | wgrib -i  FILE -bin -o FILE.BIN
    -            wgrib2 -match ":HGT:" -match ":500 mb:" -bin FILE.BIN FILE
    -
    -            Note: kpds5/6/7 are table dependent so using HGT/500 mb was more reliable.
    -
    - - - - - -

    grep/egrep

    - -

    When you use wgrib, you end up using lots of greps. Many -of the greps will have to be rewritten because the text has -been altered (ex. "10 m above gnd" -> "10 m above ground"), -are gone ("kpds5=6"), or replaced by a new format. GRIB2 is -big compared with GRIB1 so things had to change. Generally -the wgrib2 version use fewer abbreviations because it is -easier to understand and line length is less of an issue -with a flexiable inventory format. - -

    grep versus egrep

    - -

    Sometimes you want grep (pattern matching) rather than egrep (regular expressions, REGEX). -This can happen when your search string could have metacharacters. You can alter -the type of search used by the various options by the "-set_regex N" option. -With the default value (N=0), extended REGEXs are used (egrep). N=1 gives a pattern -match like grep and N=2 gives and extended regex with a need to quote the metacharacters. - - - - -

    Scan, Order of the Data

    - -In wgrib, files were decoded in the "raw" order; i.e., the order that they were -written. For most files the order was we:ns or we:sn. With GRIB2, the complexity -of the order was increased. In order to make life easier for the user, wgrib2, -by default, put the data in a we:sn order. (There is an option to put the data -in a we:ns order.) - -

    Command line: order of options

    - -With wgrib, option processing was simple. You didn't care where -the option went and if you had conflicting options, the last one -was used. With wgrib, the flags changed the configuration before -the processing of the grib data. - -

    -Wgrib2 is a much more dynamic program. Each option now runs -a subroutine. As with subroutines, the order is important -and the subroutine can be called multiple times. These -subroutines are run in following order. - -

    -Initialize:
    -
    -1) In command-line order with the mode set to Initialize.  This
    -stage is used to open files, initialize arrays and can be used
    -to parse the arguments.
    -
    -Processing:
    -
    -2) In command-line order with mode set to Process and a copy of 
    -the data and latitudes and longitudes (if requested).  This is
    -repeated for each field.
    -
    -Finalize:
    -3) Each called routine is executed with the mode set to Finalize.
    -This allows the routines to complete any pending operations
    -(example, averaging) and free up arrays.
    -
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: April 1, 2011 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - diff --git a/web_docs/count.html b/web_docs/count.html deleted file mode 100644 index 089e621..0000000 --- a/web_docs/count.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -count - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-cout -
     
    - -

    wgrib2: -count

    -
    - - -

    Introduction

    - -

    -The -count option just counts the number -of fields. It is very similar to the piping the output of -wgrib to the "wc -l". The advantage of using --count is that the inventory is displayed -and the count goes to stderr. By retaining stderr, one -could make sure the expected number of records were processed. - -

    Usage

    -

    - -

    --count
    -
    - -

    Example

    -

    - -

    -$ wgrib2 fcst.grb2 -count
    --sh-3.00$ wgrib2 fcst.grb2 -count
    -1:4:d=2007032600:HGT:1000 mb:anl:
    -2:422561:d=2007032600:HGT:1000 mb:3 hour fcst:
    -number of records: 2
    -
    - -The above example shows that there were two records in the file. - -
    -$ wgrib2 fcst.grb2 -count -match fcst
    -2:422561:d=2007032600:HGT:1000 mb:3 hour fcst:
    -number of records: 1
    -
    - -The above example shows that only 1 record had the string fcst in it. - -See also: -grid_changes -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/cress_lola.html b/web_docs/cress_lola.html deleted file mode 100644 index f0b4187..0000000 --- a/web_docs/cress_lola.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -cress_lola - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -cress_lola -
     
    - -

    wgrib2: -cress_lola

    -
    - - -

    Introduction

    - -

    -The -cress_lola option is similar to the --lola option in that it creates a regular LOngitude-LAtitude grid. -The former uses a Cressman analysis and the latter option uses a nearest-neighbor interpolation. - -

    You need to specify the lower -left corner of the grid, the number of points in the zonal and meridional directions -and the latitude/longitude increments. Finally you need to specify the output file -and the format. WARNING: winds and other vector fields will not be -rotated. If the vector fields use a grid relative orientation, -then your interpolated winds will be using the original grid. - - -

    Interpolation scheme

    -

    -The interpolation to the lola grid is by a Cressman analysis. The Cressman analysis -is a multipass system which uses a user-specified "radius" for each pass. -A Cressman analysis can be computationally expensive so you may want to explore -multiprocessing techniques. - - -

    Usage

    -

    - -

    --cress_lola LonSW:#lon:dlon LatSW:#lat:dlat file radius1:radius2:..:radiusN
    -
    -LonSW        Longitude of the South-West point, values from 0 .. 360
    -#lon         number of longitude points
    -dlon         spacing of the points in the zonal direction in degrees
    -
    -LatSW        Latitude of the South-West point, values from -90 .. 90
    -#lat         number of latitude points
    -dlat         spacing of the points in the meridional direction in degrees
    -
    -file         name of the output grib file
    -
    -radiusM      The radius in km for M-th pass.
    -
    -
    - -

    Prelim - Cressman Analysis

    - -
    -defintion: input grid = observations = grid from the input grib file
    -           output grid = grid as defined by  LonSW:#lon:dlon LatSW:#lat:dlat
    -
    -(1) compute mean of observations,save mean on background grid (output)
    -    background(i,j) = average(observation)
    -
    -(2) Repeat N times:  PASS-M
    -
    -   (a) find background value for observations by bilinear interpolation of background grid
    -   (b) remove the background from the observations: obs' = obs - interpolated_background
    -   (c) inc'(i,j)  = weighted average of obs'
    -           inc'(i,j) is increment on output grid
    -           weighted average of obs' depends on the distance between grid point and obsservation
    -   (d) new background = background + inc'
    -
    - -

    -Warning, this scheme doesn't handle handle rotated winds in a useful manner. -There will also be problem with analyzing winds near the poles. - -

    -See alse: --lon --lola -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Nov 2011 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/crlf.html b/web_docs/crlf.html deleted file mode 100644 index 28de7a3..0000000 --- a/web_docs/crlf.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -crlf - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -crlf -
     
    - -

    wgrib2: -crlf

    -
    - - -

    Introduction

    - -

    -On unix/linux machines, wgrib2 terminates the end of a inventory line by a LF (newline or "\n"). -On Windows machines, wgrib2 terminates the end of a inventory line by a CRLF. -The -crlf option is for unix/linux machine so that they terminate -the line by CRLF. This will make the inventory Windows compatible. -

    - -

    Usage

    -

    - -

    --crlf
    -
    - - - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/csv.html b/web_docs/csv.html deleted file mode 100644 index d718bbe..0000000 --- a/web_docs/csv.html +++ /dev/null @@ -1,344 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -csv - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-csv -
     
    - -

    wgrib2: -csv (comma separated values)

    -
    - - -

    Introduction

    - -

    -The -csv option writes the grid values to a specified -file as a comma separated values (text) which can be imported into a -spread sheet. This function is similar to -spread -and -csv_long with a different output format. - -

    -   "time0","time1","field","level",longitude,latitude,grid-value
    -
    - -

    -For an analysis that is valid at a specific time, time0 and time1 -will have the same value. For a temporal average or accumulation -of analyses, time0 will be the start and time1 will be end of -the average or accumulation. - -

    -For a forecast, time0 will be the start of the forecast (i.e, date -of the initial conditions). For a forecast for a specific time, -then time1 will be time that the forecast is valid. For a forecast -of a temporal average or accumulation, time1 wll be the end of the -average or accumulation. - -

    In grib speak, time0 is the reference time and time1 is -the verification time. Here are some examples, - -

    -1:0:d=2009062900:TMP:surface:anl:     (default inventory)
    -
    -   This an analysis (anl) of the surface temperature.
    -   This analysis is valid for 2009062900.
    -   Time0 = 2009062900    Time1 = 2009062900
    -   field=TMP             level=surface
    -
    -29:1155322:d=2009060500:UGRD:925 mb:180 hour fcst:ENS+19     (default inventory)
    -   This is a 180 hour forecast of the 925 hPa zonal wind.
    -   The forecast run uses initial conditions at 2009060500
    -   and verifies 180 hours laster at 2009061212.  
    -   Time0 = 2009060500    Time1 = 2009060500
    -   field=UGRD            level = 925 mb
    -
    -43:1844451:d=2009060500:APCP:surface:174-180 hour acc fcst:ENS=+19     (default inventory)
    -   This is a forecast of accumulated precipitation from 174 to 180 hours.
    -   The forecast run uses initial conditions at 2009060500 and 
    -   accumulates the precip from 2009061206 to 2009061212.  The
    -   verification time is defined as the end of the accumulation period
    -   Time0 = 2009060500    Time1 = 2009060500
    -   field= APCP           level= surface
    -
    - -

    -The -csv option only works on the grids -for which wgrib2 can derive latitude and longitudes values. -Otherwise no output is generated. The undefined value is 9.999e20. - -

    -The size of a CSV file can be overwhelming. One technique is to -only generate the CSV for variables that you need. This can be -done with the -match option. Even with -the -match option, the high-resolution -models can stil generate huge files. The next technique is -to undefine the grid points that you don't want. For example, -you are only interested in Hawaii (its 0C outside as I write -this). Then you can use the the -undefine option -to set the grid points outside of the Hawaii domain to undefined. -Since -csv doesn't print undefined -grid points, the CSV files is much smaller. - -

    Extended Variable Names

    - -

    The default field value (see above) is the grib name such as TMP or HGT. -However, the grib name may not be unique. For example, the field could be -the HGT from the 19th ensemble member. A better field name may be -"HGT.ENS=+19". You enable the extended variable name by adding the option --set_ext_name 1. - - -

    Usage

    -
    --csv output_file_name
    -   the field is the grib name
    -   output_file_name cannot be a memory file
    --set_ext_name 1 -csv output_file_name
    -   the field is the extended grib name
    -   output_file_name cannot be a memory file
    -
    -

    Example 1

    -

    -

    -$ wgrib2 fcst.grb2 -csv junk 
    -1:0:d=2007032600:HGT:1000 mb:anl:
    -2:125535:d=2007032600:HGT:1000 mb:3 hour fcst:
    -$ cat junk 
    -"2007-03-26 00:00:00","2007-03-26 00:00:00","HGT","1000 mb",0,-90,164.1
    -"2007-03-26 00:00:00","2007-03-26 00:00:00","HGT","1000 mb",0.5,-90,164.1
    -"2007-03-26 00:00:00","2007-03-26 00:00:00","HGT","1000 mb",1,-90,164.1
    -"2007-03-26 00:00:00","2007-03-26 00:00:00","HGT","1000 mb",1.5,-90,164.1
    -...
    -"2007-03-26 00:00:00","2007-03-26 03:00:00","HGT","1000 mb",-1.5,90,-91.7
    -"2007-03-26 00:00:00","2007-03-26 03:00:00","HGT","1000 mb",-1,90,-91.7
    -"2007-03-26 00:00:00","2007-03-26 03:00:00","HGT","1000 mb",-0.5,90,-91.7
    -
    - -

    Example 2: CSV for one point

    - -

    -Suppose we want a CSV for one point. You use the -undefine option -to set the to undefined except for the selected point. Suppose we have a 1x1 grid. - -

    -$ wgrib2 gep19.aec   -undefine out-box .9:1.1 10.9:11.1 -csv  1E11N.csv
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -2:70707:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    -3:96843:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    -...
    -$ cat 1E11N.csv 
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",1,11,12440.8
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","TMP","200 mb",1,11,219.6
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","RH","200 mb",1,11,100
    -...
    -
    - -

    Example 3: CSV for two points

    - -The simple way is do the previous example twice. There is a computationally -faster method. - -
    -$ wgrib2 gep19.aec -rpn sto_1 -undefine out-box .9:1.1 10.9:11.1 -csv junk -rpn rcl_1 -undefine out-box 1.9:2.1 19.9:20.1 -csv junk
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -2:70707:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    -3:96843:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    -...
    -$ cat junk
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",1,11,12440.8
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",2,20,12360.8
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","TMP","200 mb",1,11,219.6
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","TMP","200 mb",2,20,218.8
    -...
    -
    - - - - -

    Warning #1

    - -

    -The options -csv, --csv_long, --spread and --text do not support memory files. -You can blame sloth or lack of need. I like to think that -text files with grid point values are are insanely large -and shouldn't be saved in memory. - - -

    Warning #2

    - -

    It may be tempting to take a grib file, convert it into a CSV file -and then deal with the CSV file. After all, everybody can read -a CSV file. Sure there is a litte overhead of reading a CSV file -but who cares. Suppose you want to read some GFS forecasts files -(20 forecast times, 5 days every 6 hours) at 0.25 x 0.25 degree global resolution. -Your CSV file is going to be about 720 GBs. Suppose that our hard -drive can write/read at 70 MB/s. Then we are talking about 3 hours to -write the CSV file and 3 hours to read the CSV file not including CPU time -which will slow down the process. Converting grib into CSV is a -viable strategy if the conversion is limited. You need to restrict -the number of fields converted and should consider only converting -a regional domain. Note, I wrote "viable" and not optimal. - - -

    -See also: --spread, --csv_long, --text, --bin, --ieee, --set_ext_name, --undefine -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Oct 25, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/csv_long.html b/web_docs/csv_long.html deleted file mode 100644 index e432ce5..0000000 --- a/web_docs/csv_long.html +++ /dev/null @@ -1,310 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -csv_long - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-csv_long -
     
    - -

    wgrib2: -csv_long (comma separated values)

    -
    - - -

    Introduction

    - -

    -The -csv_long option writes the grid values to a specified -file as a comma separated values (text) which can be imported into a -spread sheet. This function is similar to --spread and -csv -with a different output format. The format is - -

    -   "time0","time1","time2","field","ftime","level",longitude,latitude,grid-value
    -
    - -

    -Some programs have a simple data model: x, y, z and time. Forecast models -need a more complicated data model. Most forecasts only need -3 time coordinates. Some examples that need 1 to 3 times are, - -

    -  time0: reference time
    -         ex. temperature analysis for 00Z, June 2, 2014
    -
    -  time0, time1: reference time, forecast time
    -         ex. temperature forecast started with initial conditions at 00Z, June 2, 2014
    -             and verifing at 00Z, June 3, 2014
    -
    -  time0, time1, time2: reference time, start of forecasting period, end of forecasting period
    -         ex. precipitation forecast started with initial conditions at 00Z, June 2, 2014
    -             and for the average precipitation from 00Z June 2, 2014 to 00Z June 3, 2014.
    -
    - -

    You can define quantities that require more than 3 times but they are -relatively rare. - - -

    -  Examples of quantities that need more than 3 times to describe
    -   a) climatology of 6-12 hour forecasts (start time of climatology, end time of the
    -         climatology, 6 hour, 12 hour)
    -   b) forecast of the monthly mean of the average 00Z-01Z temperature. (starting time
    -      of the monthly average, ending time of the monthly average, starting time of 
    -      the diuranl average, ending time of the diurnal average)
    -
    - -

    -For an analysis that is valid at a time0, time1 and time2 will -have the same value as time0. For a forecast valid at a -specific time, time0 will be the start of the forecast and -time1 will be the valid time. Time2 will have the same value -as time1. Finally for a forecast that is an average, accumulation, -minimum value or maximum value of a time interval, time0 -will be the start of the forecast, time1 will be the start -of the time interval and time2 will the end of the interval. -For more complicated quantities, see the ftime value. - -

    In wgrib2 speak, -

    -   time0 is -T in a different format
    -   time1 is -start_FT in a different format
    -   time2 is -end_FT in a different format
    -   field is -var in a different format
    -   ftime is -ftime
    -   level is -lev
    -   longitude is in degrees with values between -180 and 180 
    -   latitude is in degrees values between -90 and 90 (south = -ve, north = +ve)
    -
    - -

    -The -csv_long option only works on the grids -for which wgrib2 can derive latitude and longitudes values. -Otherwise no output is generated. The undefined value is 9.999e20. - -

    -The size of a CSV file can be overwhelming. One technique is to -only generate the CSV for variables that you need. This can be -done with the -match option. Even with -the -match option, the high-resolution -models can stil generate huge files. The next technique is -to undefine the grid points that you don't want. For example, -you are only interested in Hawaii (its 0C outside as I write -this). Then you can use the the -undefine option -to set the grid points outside of the Hawaii domain to undefined. -Since -csv_long doesn't print undefined -grid points, the CSV files is much smaller. - - -

    Extended Variable Names

    - -

    The default field value (see above) is the grib name such as TMP or HGT. -However, the grib name may not be unique. For example, the field could be -the HGT from the 19th ensemble member. A better field name may be -"HGT.ENS=+19". You enable the extended variable name by adding the option --set_ext_name 1. - - -

    Usage

    -
    --csv_long output_file_name
    -   The CSV is written to output_file_name, note output_file_name cannot be a memory file
    --set_ext_name 1 -csv output_file_name
    -   the field is the extended grib name
    -
    - - -

    Warning #1

    - -

    -The options -csv, --csv_long, --spread and --text do not support memory files. -You can blame sloth or lack of need. I like to think that -text files with grid point values are insanely large -and shouldn't be saved in memory. - - - -

    Warning #2

    - -

    It may be tempting to take a grib file, convert it into a CSV file -and then deal with the CSV file. After all, everybody can read -a CSV file. Sure there is a litte overhead of reading a CSV file -but who cares. Suppose you want to read some GFS forecasts files -(20 forecast times, 5 days every 6 hours) at 0.25 x 0.25 degree global resolution. -Your CSV file is going to be about 720 GBs. Suppose that our hard -drive can write/read at 70 MB/s. Then we are talking about 3 hours to -write the CSV file and 3 hours to read the CSV file not including CPU time -which will slow down the process. Converting grib into CSV is a -viable strategy if the conversion is limited. You need to restrict -the number of fields converted and should consider only converting -a regional domain. Note, I wrote "viable" and not optimal. - - - - - - - - -

    -See also: --spread, --csv, --text, --bin, --ieee, --match, --set_ext_name, --undefine -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Nov 19, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ctl_ens.html b/web_docs/ctl_ens.html deleted file mode 100644 index 6b7e613..0000000 --- a/web_docs/ctl_ens.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ctl_ens - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ctl_ens -
     
    - -

    wgrib2: -ctl_ens

    -
    - - -

    Warning

    - -

    -The -ctl_ens option is used by the script g2ctl -to generate control files for GrADS. The output of this option is -determined by the needs of g2ctl. - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ctl_inv.html b/web_docs/ctl_inv.html deleted file mode 100644 index 161eacd..0000000 --- a/web_docs/ctl_inv.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ctl_inv - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ctl_inv -
     
    - -

    wgrib2: -ctl_inv

    -
    - - -

    Warning

    - -

    -The -ctl_inv option is used by the script g2ctl -to generate control files for GrADS. The output of this option is -determined by the needs of g2ctl. - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/cyclic.html b/web_docs/cyclic.html deleted file mode 100644 index 8d44d14..0000000 --- a/web_docs/cyclic.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -cyclic - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -cyclic -
     
    - -

    wgrib2: -cyclic

    -
    - - -

    Introduction

    - -

    -Sometimes it is useful to know whether the domain is cyclic. -For example, the large domain goes from 0E to 359W by steps -of 1 degree. Now there is a request for a subdomain that goes -from 350E (left) to 10E (right). Knowing that the domain is cyclic -is useful in this case. The -small_grib option -calls the cyclic code. - -

    The -cyclic option will only detect cyclic -grids that are either lat-lon, Gaussian or Mercator. All other -grids will return a not-cyclic response. In addition, -staggered and thinned grids will also return a not-cyclic response. -The test for cyclic is a bit loose because NCEP grib2 files often -have the lon(gitude) and dlon(gitude) to the nearest millidegree rather than the -nearest microdegree. (Reason 1: grib1 only stored the lon and dlon to the -nearest millidegree. Reason 2: most NCEP codes use single precision -for the longitudes and latitudes.) - -

    Usage

    -
    --cyclic
    -
    - - -

    Example

    -

    -

    -$ wgrib2 gdt140.g2 -cyclic -nl -grid
    -1:0:not cyclic:
    -:grid_template=140:winds(N/S):
    -	Lambert Azimuthal Equal Area grid: (1050 x 1050) input WE:NS output WE:SN res 48
    -	Lat1 18.876988 Lon1 225.000000 Cen Lon 0.000000 Std Par 90.000000
    -	Dx 10000.000000 m Dy 10000.000000 m mode 48
    -
    -$ wgrib2 gep19.t00z.pgrb2af180 -cyclic -nl -grid
    -1:0:cyclic:
    -:grid_template=0:winds(N/S):
    -	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output WE:SN res 48
    -	lat 90.000000 to -90.000000 by 1.000000
    -	lon 0.000000 to 359.000000 by 1.000000 #points=65160
    -...
    -
    - - -

    -See also: --small_grib, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 15, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/d.html b/web_docs/d.html deleted file mode 100644 index e033d9a..0000000 --- a/web_docs/d.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -d - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-d -
     
    - -

    wgrib2: -d

    -
    - - -

    Introduction

    - -

    -The -d N option specifies the grib message number (N) to -process. (The -d N option comes from wgrib where "d" stood fom "dump".) -If Nth message has submessage, then the first submessage is chosen (N.1). -For messages with submessages, use -d N.M to select the -Mth submessage of the Nth message. If M is missing, only the first submessage is selected. - -

    -With wgrib2 v3.0.0, you can add an optional offset. For example, -d N:OFFSET -will skip OFFSET bytes (must be positive), find the next grib message, give it a label N, and dump it. -The other form, -d N.M:OFFSET will skip OFFSET bytes (must be positive), -find the next grib message and dump the Mth submessage of that grib message. -Using the offset option can be faster for large files, and can be used to skip sections of a grib -file that stop wgrib2 processing. -The -d option works for files and pipes. - -

    -If there are more than one -d on a command line, only -the last one is used. - -

    The form, -d all, is not valid in wgrib2. This -is the default action. - -

    -The -d should be used with caution. The order of -messages records within grib files can change without notice (ex. today's forecast -may have a different order from tomorrow's forecast). I use --d interactively but this option should not be used -in scripts unless you are 100% certain of the order of the records. - -

    Usage

    -

    - -

    --d N
    --d N.M
    --d N:OFFSET
    --d N.M:OFFSET
    -where N is an integer larger than 0, M is an positive integer, OFFSET is a positive integer
    -
    - - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -s -d 1 -bin data.bin
    -1:0:d=2005090200:HGT:1000 mb:60 hour fcst
    -The above command writes the first record to a binary file data.bin
    -
    -
    -$ wgrib2 test.grb2 -s -d 287.2 -bin data.bin
    -287.2:37032193:d=2005090200:VGRD:10 m above ground:60 hour fcst
    -The above command dumps the second submessage of record 287.
    -
    -$ cat gfs.t00z.master.grb2f048 | wgrib2 - | head -n 4
    -1:0:d=2018030400:PRES:mean sea level:48 hour fcst:
    -2:3565800:d=2018030400:REFC:entire atmosphere:48 hour fcst:
    -3:4748163:d=2018030400:VIS:surface:48 hour fcst:
    -4:5462029:d=2018030400:UGRD:planetary boundary layer:48 hour fcst:
    -$ cat gfs.t00z.master.grb2f048 | wgrib2 - -d 3:4748163
    -3:4748163:d=2018030400:VIS:surface:48 hour fcst:
    -$ cat gfs.t00z.master.grb2f048 | wgrib2 - -d 1:4748163
    -1:4748163:d=2018030400:VIS:surface:48 hour fcst:
    -
    -Using the offset option on a pipe
    -
    - - -

    -See also: --for, --i, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page modified: Aug 27, 2014, March 19, 2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/default_inv.html b/web_docs/default_inv.html deleted file mode 100644 index 7ce6821..0000000 --- a/web_docs/default_inv.html +++ /dev/null @@ -1,267 +0,0 @@ - - - - Climate Prediction Center - wgrib2: default inventory format - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: default inventory format -
     
    - -

    wgrib2: default inventory format

    -
    - - -

    Introduction

    - -

    -One of wgrib2 functions is to inventory grib2 files. The inventory -format is very customizable; at present there are 120 options -to modify the inventory. However the default inventory (-s) -is most often used and understanding this format will help you to -understand the structure of the inventory. -

    -

    Format

    - -

    -The format for the wgrib2 invetory is relatively simple. There is one line -for each gridded field. Usually each grid is in its own grib message -or record. However, is is possible to store related grids in into -a single grib message. Below are some examples. - - -

    -Example 1:  1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev
    -Example 2:  1:0:d=2010032900:TMP:2 m above ground:anl:
    -Example 3:  1:40:d=2011062206:ICAHT:cumulonimbus base:6 hour fcst:
    -Example 4:  1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -Example 5:  34.1:1464607:d=2009060500:UGRD:10 m above ground:180 hour fcst:ENS=+19
    -            34.2:1464607:d=2009060500:VGRD:10 m above ground:180 hour fcst:ENS=+19
    -
    -Output Format:
    -
    -  (msg|msg.submsg):(byte location):d=(YYYYMMDDHH):(variable):(level):(ftime):(optional attr)
    -
    -  msg = message/record number starting from 1
    -  submsg = submessage number starting from 1 (optional)
    -  byte location: byte location of the start of the message starting from 0
    -  YYYYMMDDHH = reference time of the grib message, YYYY = year, MM = month (01..12), DD = day, HH = hour
    -  level = level/layer attributes, ex. "500 mb", "ground", "2 m above ground"
    -  ftime = time attributes, ex. "12 hour fcst", "anl", "0-6 hr ave fcst"
    -  optional attr: optional attributes that are needed to define the field such as ensemble memeber,
    -                 chemical type (for concentration), probability range
    -
    - - - -

    NOMADS: point value (text)

    -
    - -

    -The Nomads g2subset/grib-filter software can download point-value text files. -These text files are simply wgrib2 inventories created with the following options. -

    - -
    -   wgrib2 IN.grb -crlf -v -s v0 -start_ft -lon (LON) (LAT)
    -
    -   -crlf adds a cr-lf at the end of each line instead of the default lf or newline.
    -          (for windows users)
    -   -v turn on verbose mode
    -   -s is the standard inventory in verbose mode
    -   -v0 turn off verbose mode
    -   -start_ft adds the forecast or verification time or the start of the verification time
    -             if a forecast for a period of time (ex. 3-4 month forecast).
    -   -lon adds the point value to the inventory
    -
    -
    -Output Format:
    -
    -  (msg|msg.submsg):(byte location):d=(YYYYMMDDHH):(verbose variable):(level):(ftime):(optional attr):
    -         start_ft=(YYYYMMDDHH):lon=(lon),lat=(lat),val=(value)
    -
    -  msg = message/record number starting from 1
    -  submsg = submessage number starting from 1 (optional)
    -  byte location: byte location of the start of the message starting from 0
    -  YYYYMMDDHH = reference time of the grib message, YYYY = year, MM = month (01..12), DD = day, HH = hour
    -  verbose variable = variable name, description and units
    -  level = level/layer attributes, ex. "500 mb", "ground", "2 m above ground"
    -  ftime = time attributes, ex. "12 hour fcst", "anl", "0-6 hr ave fcst"
    -  optional attr: optional attributes that are needed to define the field such as ensemble memeber,
    -                 chemical type (for concentration), probability range
    -  start_ft = start of the forecast/verification time
    -  val = value of the grid point at (lat) and (lon).
    -
    - - - -

    -In example 1, the optional attributes is "std dev". In this case, the field is the standard deviation -of an ensemble. The field cannot be a temporal std dev because the ftime field is "300 hour fcst". -(A temporal std dev would have been encoded in the ftime field.). -

    -

    -In example 5, we have the first field beind 34.1 and 34.2. In this example, message number 34 has -two submessages. Notice that the byte location is the same for both sub messages. -

    -

    -The inventory consists of one line per field. The first two fields (record number and byte location) are -fixed and the other fields will depend on the inventory options that are used. For example, the -default option (-s) is a macro that runs the -t, -var, -lev -ftime and -misc options. -

    -

    -In the future, the date codes in the nomads point-value text files may be extended to include minutes. -

    - -

    -The default option gives the starting but not the ending location of each grib message. The ending -location is one less than the starting location of the next grib message (assuming no junk bytes). -The -range option will print out the starting and ending location of each record. Using the range, -a grib message can be extracted from a grib file. However, submessages are different. It is much -more difficult to extract a submessage from a grib message. -

    - - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/disc.html b/web_docs/disc.html deleted file mode 100644 index 8bb7315..0000000 --- a/web_docs/disc.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -disc - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-disc -
     
    - -

    wgrib2: -disc

    -
    - - -

    Introduction

    - -

    -The -disc option prints the discipline. Use the --v option to get the name of the discipline. - -

    Usage

    -

    - -

    --disc
    -
    - -

    Example

    -

    - -

    -$ wgrib2 grib2.polar -disc
    -1.1:0:disciple=0
    -1.2:0:disciple=0
    -
    - -
    -$ wgrib2 grib2.polar -v -disc
    -1.1:0:disciple=0 Meteorlogy
    -1.2:0:disciple=0 Meteorlogy
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/domain.html b/web_docs/domain.html deleted file mode 100644 index f49bed2..0000000 --- a/web_docs/domain.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -domain - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -domain -
     
    - -

    wgrib2: -domain

    -
    - - -

    Introduction

    - -

    -The -options option finds a rectangular box that -encompasses the grid. This option does not print out the vertices of -the grid. Requirements for this option are determined by g2ctl. - -

    Usage

    -

    - -

    --domain
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/egrep.html b/web_docs/egrep.html deleted file mode 100644 index cef5fcf..0000000 --- a/web_docs/egrep.html +++ /dev/null @@ -1,260 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -grep (various) - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grep (various) -
     
    - -

    wgrib2: -egrep, -egrep_v, -fgrep, -fgrep_v

    -
    - - -

    Introduction

    - -

    -When you use wgrib2 extensively, common sequences keep occuring, such as, - -

    -   1:  wgrib2 A.grb >A.inv
    -   2:  cat A.inv | fgrep ":HGT:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib hgt500.grb
    -   3:  cat A.inv | fgrep ":TMP:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib tmp500.grb
    -   4:  cat A.inv | egrep ":(UGRD|VGRD):" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib wind500.grb
    -
    - -Using the various -grep, -inv and the -i_file option, the above example can -be written as - -
    -   1:  wgrib2 A.grb -inv A.inv
    -   2:  wgrib2 -fgrep ":HGT:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib hgt500.grb
    -   3:  wgrib2 -fgrep ":TMP:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib tmp500.grb
    -   4:  wgrib2 -egrep ":(UGRD|VGRD):" -fgrep ":500 mb:" -i_file A.inv A.grb -grib wind500.grb
    -
    - -The first version is easier to read. So why were the extra options added? - -
      -
    1. Some shells have problems with pipes. -
        -
      • Some versions of Windows dos-prompt have problems with pipes. -
      • RNomads: solved Windows 7 problem by using these options -
      -
    2. More efficient when you avoid multiple processes and pipes. -
        -
      • Every millisecond and K byte of RAM usage counts! -
      -
    3. Used by callable wgrib2. -
        -
      • A subroutine (wgrib2) can read a field using the index file! -
      -
    - -The options were added for the third reason, but one and two are some -nice side effects. The 4 examples can be coded in fortran as, - -
    -   include wgrib2api
    -   ...
    -   i = wgrib2a('A.grb','-inv','A.inv')
    -   i = wgrib2a('-fgrep',':HGT:','-fgrep',':500 mb:','-i_file,'A.inv','A.grb','-grib','hgt500.grb')
    -   i = wgrib2a('-fgrep',':TMP:','-fgrep',':500 mb:','-i_file','A.inv','A.grb','-grib','tmp500.grb')
    -   i = wgrib2a('-egrep',':(UGRD|VGRD):','-fgrep',':500','mb:','-i_file','A.inv','A.grb','-grib','wind500.grb')
    -
    - -

    The -grep options are used in wgrib2api's grb2_inq(..) function. - -

    -Definition of grep options:
    -
    -    (...) | wgrib2 -OP1 X (...)
    -      behaves like
    -    (...) | OP2 X | wgrib2 (...) 
    -
    -      if OP1 == egrep       then OP2 = egrep
    -      if OP1 == fgrep       then OP2 = fgrep
    -      if OP1 == egrep_v     then OP2 = egrep -v
    -      if OP1 == fgrep_v     then OP2 = fgrep -v
    -
    -    X is a posix extended regular expression (egrep, egrep_v)
    -    or a fixed string (fgrep, fgrep_v)
    -
    -   The number of -fgrep and -fgrep_v options is limited to 200.
    -   The number of -egrep and -egrep_v options is limited to 200.
    -   The wgrib2 option -set_regex does not affect the -grep options.
    -
    - - -

    Usage

    -

    - -

    --egrep X
    --egrep_v X
    --fgrep Y
    --fgrep_v Y
    -
    -X is a posix extended regular expression
    -Y is a fixed string (not a regular expression)
    -Note: -set_regex does not modify the type of regex for these options
    -
    - -

    -See also: --match, --not, --match_inv, --end, --if, --i_file, --not_if, --set_regex. -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page modified: Feb 3, 2017, 7/2019. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/egrep_v.html b/web_docs/egrep_v.html deleted file mode 100644 index cef5fcf..0000000 --- a/web_docs/egrep_v.html +++ /dev/null @@ -1,260 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -grep (various) - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grep (various) -
     
    - -

    wgrib2: -egrep, -egrep_v, -fgrep, -fgrep_v

    -
    - - -

    Introduction

    - -

    -When you use wgrib2 extensively, common sequences keep occuring, such as, - -

    -   1:  wgrib2 A.grb >A.inv
    -   2:  cat A.inv | fgrep ":HGT:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib hgt500.grb
    -   3:  cat A.inv | fgrep ":TMP:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib tmp500.grb
    -   4:  cat A.inv | egrep ":(UGRD|VGRD):" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib wind500.grb
    -
    - -Using the various -grep, -inv and the -i_file option, the above example can -be written as - -
    -   1:  wgrib2 A.grb -inv A.inv
    -   2:  wgrib2 -fgrep ":HGT:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib hgt500.grb
    -   3:  wgrib2 -fgrep ":TMP:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib tmp500.grb
    -   4:  wgrib2 -egrep ":(UGRD|VGRD):" -fgrep ":500 mb:" -i_file A.inv A.grb -grib wind500.grb
    -
    - -The first version is easier to read. So why were the extra options added? - -
      -
    1. Some shells have problems with pipes. -
        -
      • Some versions of Windows dos-prompt have problems with pipes. -
      • RNomads: solved Windows 7 problem by using these options -
      -
    2. More efficient when you avoid multiple processes and pipes. -
        -
      • Every millisecond and K byte of RAM usage counts! -
      -
    3. Used by callable wgrib2. -
        -
      • A subroutine (wgrib2) can read a field using the index file! -
      -
    - -The options were added for the third reason, but one and two are some -nice side effects. The 4 examples can be coded in fortran as, - -
    -   include wgrib2api
    -   ...
    -   i = wgrib2a('A.grb','-inv','A.inv')
    -   i = wgrib2a('-fgrep',':HGT:','-fgrep',':500 mb:','-i_file,'A.inv','A.grb','-grib','hgt500.grb')
    -   i = wgrib2a('-fgrep',':TMP:','-fgrep',':500 mb:','-i_file','A.inv','A.grb','-grib','tmp500.grb')
    -   i = wgrib2a('-egrep',':(UGRD|VGRD):','-fgrep',':500','mb:','-i_file','A.inv','A.grb','-grib','wind500.grb')
    -
    - -

    The -grep options are used in wgrib2api's grb2_inq(..) function. - -

    -Definition of grep options:
    -
    -    (...) | wgrib2 -OP1 X (...)
    -      behaves like
    -    (...) | OP2 X | wgrib2 (...) 
    -
    -      if OP1 == egrep       then OP2 = egrep
    -      if OP1 == fgrep       then OP2 = fgrep
    -      if OP1 == egrep_v     then OP2 = egrep -v
    -      if OP1 == fgrep_v     then OP2 = fgrep -v
    -
    -    X is a posix extended regular expression (egrep, egrep_v)
    -    or a fixed string (fgrep, fgrep_v)
    -
    -   The number of -fgrep and -fgrep_v options is limited to 200.
    -   The number of -egrep and -egrep_v options is limited to 200.
    -   The wgrib2 option -set_regex does not affect the -grep options.
    -
    - - -

    Usage

    -

    - -

    --egrep X
    --egrep_v X
    --fgrep Y
    --fgrep_v Y
    -
    -X is a posix extended regular expression
    -Y is a fixed string (not a regular expression)
    -Note: -set_regex does not modify the type of regex for these options
    -
    - -

    -See also: --match, --not, --match_inv, --end, --if, --i_file, --not_if, --set_regex. -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page modified: Feb 3, 2017, 7/2019. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/else.html b/web_docs/else.html deleted file mode 100644 index 4d74e82..0000000 --- a/web_docs/else.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -else - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -else -
     
    - -

    wgrib2: -else

    -
    - - -

    Introduction

    - -

    -The -else option is part of the - -if, - -else, - -endif structure for conditional execution of wgrib2 options. -More details are in the -if documentation. -The -else option was introduced with wgrib2 v3.0.0 to replace -the older version 1 IF structure. - -

    -See also: --if, --endif, --match, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page: March 16, 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/elseif.html b/web_docs/elseif.html deleted file mode 100644 index 536aeee..0000000 --- a/web_docs/elseif.html +++ /dev/null @@ -1,189 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -elseif - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -elseif -
     
    - -

    wgrib2: -elseif

    -
    - - -

    Introduction

    - -

    -The -elseif option is part of the - -if, - -else, - -endif structure for conditional execution of wgrib2 options. -The -elseif option must follow an - -if or -elseif type option, and it must preceed either the next - -elseif-type, - -else or - -endif option. -

    -The -elseif option is a test for a regular expression. -For a non-regex string, use the -elseif_fs option. - -More details are in the -if documentation. -The -else option was introduced with wgrib2 v3.0.0 to replace -the older version 1 IF structure. - -

    -See also: --if, --if_fs, --else, --elseif_fs, --endif, --match, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page: March 16, 2021, 6/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/elseif_fs.html b/web_docs/elseif_fs.html deleted file mode 100644 index 7854bdd..0000000 --- a/web_docs/elseif_fs.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -elseif_fs - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -elseif -
     
    - -

    wgrib2: -elseif_fs

    -
    - - -

    Introduction

    - -

    -The -elseif_fs option is part of the - -if, - -else, - -endif structure for conditional execution of wgrib2 options. -The -elseif* option must follow an - -if or -elseif type option, and it must preceed either the next - -elseif type, - -else or - -endif option. - -

    -The -elseif_fs is an --elseif* options and -does a comparison with a fixed string (fs) instead -of a regular expression as done by the -else_if. -

    -More details are in the -if documentation. -The -else option was introduced with wgrib2 v3.0.0 to replace -the older version 1 IF structure. - -

    -See also: --if, --if_fs, --else, --elseif, --endif, --match, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page: 6/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/elseif_n.html b/web_docs/elseif_n.html deleted file mode 100644 index b6a672f..0000000 --- a/web_docs/elseif_n.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -elseif_n - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -elseif_n -
     
    - -

    wgrib2: -elseif_n

    -
    - - -

    Introduction

    - -

    -The -elseif_n option is part of the - -if, - -else, - -endif structure for conditional execution of wgrib2 options. -The -elseif type option must follow an - -if or -elseif type option, and it must preceed either the next - -elseif type, - -else or - -endif option. - -

    -The -elseif_n is the --elseif equivalent of the --if_n option. - -More details are in the -if documentation. -The -else option was introduced with wgrib2 v3.0.0 to replace -the older version 1 IF structure. - -

    -See also: --if, --if_fs, --if_n, --else, --elseif, --elseif_fs, --endif, --match, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page: 6/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/elseif_rec.html b/web_docs/elseif_rec.html deleted file mode 100644 index 28a4c06..0000000 --- a/web_docs/elseif_rec.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -elseif_rec - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -elseif_rec -
     
    - -

    wgrib2: -elseif_rec

    -
    - - -

    Introduction

    - -

    -The -elseif_rec option is part of the - -if, - -else, - -endif structure for conditional execution of wgrib2 options. -The -elseif type option must follow an - -if or -elseif type option, and it must preceed either the next - -elseif type, - -else or - -endif option. - -

    -The -elseif_rec is the --elseif equivalent of the --if_rec option. - -More details are in the -if documentation. -The -else option was introduced with wgrib2 v3.0.0 to replace -the older version 1 IF structure. - -

    -See also: --if, --if_fs, --if_n, --if_rec, --else, --elseif, --elseif_fs, --elseif_n, --endif, --match, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page: 6/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/elseif_reg.html b/web_docs/elseif_reg.html deleted file mode 100644 index 0ceffc9..0000000 --- a/web_docs/elseif_reg.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -elseif_reg - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -elseif_reg -
     
    - -

    wgrib2: -elseif_reg

    -
    - - -

    Introduction

    - -

    -The -elseif_reg option is part of the - -if, - -else, - -endif structure for conditional execution of wgrib2 options. -The -elseif type option must follow an - -if or -elseif type option, and it must preceed either the next - -elseif type, - -else or - -endif option. - -

    -The -elseif_reg is the --elseif equivalent of the --if_reg option. - -More details are in the -if documentation. -The -else option was introduced with wgrib2 v3.0.0 to replace -the older version 1 IF structure. - -

    -See also: --if, --if_fs, --if_n, --if_rec, --if_reg, --else, --elseif, --elseif_fs, --elseif_n, --elseif_rec, --endif, --match, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page: 6/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/end.html b/web_docs/end.html deleted file mode 100644 index 5180b19..0000000 --- a/web_docs/end.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ftim - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end -
     
    - -

    wgrib2: -end

    -
    - - -

    Introduction

    - -

    -The -end option stops the processing of the grib file after -one line of the inventory has been written. The -end option -is designed to improve speed when used with the -match option - - -

    Usage

    -

    - -

    --end
    -
    - -

    Example

    -

    - -

    -$ wgrib2 ../example/eta.t00z.awphys18.grb2 -match "HGT:500 mb" -text hgt.txt -end 
    -
    -The above line writes out the first 500 mb HGT field to the file hgt.txt and stops 
    -reading the file.
    -
    -$ wgrib2 ../example/eta.t00z.awphys18.grb2 -match "HGT:500 mb" -text hgt.txt -end 
    -
    -The above line writes out all 500 mb HGT fields to the file hgt.txt.  This wastes 
    -time if you only have one matching field.
    -
    -
    - - -See also: -match, --not -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/end_FT.html b/web_docs/end_FT.html deleted file mode 100644 index 3ea3ded..0000000 --- a/web_docs/end_FT.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -start_ft, start_FT, -end_ft, -end_FT - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -start_ft, -start_FT, -end_ft, -end_FT -
     
    - -

    wgrib2: -start_ft, -start_FT, -end_ft, -end_FT

    -
    - - -

    Introduction

    - -

    -Suppose you make a forecast starting from initial conditions of 00Z January 1 for the average -conditions from the month of February. In this forecast, there are three time stamps. - -

    -   Name                        date           YYYYMMDDHH option  (HH)Z(DD)(MON)YYYY option      with minutes and seconds
    -
    -   reference time              00Z Jan 1     -t                  -v2 -t                         -T
    -   start of forecast period    00Z Feb 1     -start_ft           -v2 -start_ft                  -start_FT
    -   end of forecast period      00Z Mar 1     -end_ft             -v2 -end_ft                    -end_FT
    -
    - -For common ftimes, - -
    -
    -analysis:                      reference time == start_ft == end_ft
    -6 hour forecast:               reference time + 6 == start_ft == end_ft
    -30 year monthly climatology:   reference time = start_ft = start of 1st month used to make climatology
    -                               end_ft = end of the last month used to make the climatology
    -

    Usage

    -
    --start_ft
    --end_ft
    --start_FT
    --end_FT
    -
    - -

    Example

    -

    - -

    -$ wgrib2 a.grb -start_ft
    -1:0:start_FT=20111101000000
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/end_ft.html b/web_docs/end_ft.html deleted file mode 100644 index 3ea3ded..0000000 --- a/web_docs/end_ft.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -start_ft, start_FT, -end_ft, -end_FT - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -start_ft, -start_FT, -end_ft, -end_FT -
     
    - -

    wgrib2: -start_ft, -start_FT, -end_ft, -end_FT

    -
    - - -

    Introduction

    - -

    -Suppose you make a forecast starting from initial conditions of 00Z January 1 for the average -conditions from the month of February. In this forecast, there are three time stamps. - -

    -   Name                        date           YYYYMMDDHH option  (HH)Z(DD)(MON)YYYY option      with minutes and seconds
    -
    -   reference time              00Z Jan 1     -t                  -v2 -t                         -T
    -   start of forecast period    00Z Feb 1     -start_ft           -v2 -start_ft                  -start_FT
    -   end of forecast period      00Z Mar 1     -end_ft             -v2 -end_ft                    -end_FT
    -
    - -For common ftimes, - -
    -
    -analysis:                      reference time == start_ft == end_ft
    -6 hour forecast:               reference time + 6 == start_ft == end_ft
    -30 year monthly climatology:   reference time = start_ft = start of 1st month used to make climatology
    -                               end_ft = end of the last month used to make the climatology
    -

    Usage

    -
    --start_ft
    --end_ft
    --start_FT
    --end_FT
    -
    - -

    Example

    -

    - -

    -$ wgrib2 a.grb -start_ft
    -1:0:start_FT=20111101000000
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/endif.html b/web_docs/endif.html deleted file mode 100644 index 0b214a4..0000000 --- a/web_docs/endif.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -endif - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -endif -
     
    - -

    wgrib2: -endif

    -
    - - -

    Introduction

    - -

    -The -endif option is part of the - -if, - -else, - -endif structure for conditional execution of wgrib2 options. -More details are in the -if documentation. -The -endif option was introduced with wgrib2 v3.0.0 to replace -the older version 1 IF structure. - -

    -See also: --if, --else, --match, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page: March 16, 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ens.html b/web_docs/ens.html deleted file mode 100644 index 677e1cc..0000000 --- a/web_docs/ens.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ens - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ens -
     
    - -

    wgrib2: -ens

    -
    - - -

    Introduction

    - -

    -The -ens option prints the ensemble information. - -

    Usage

    -

    - -

    --ens
    -
    - -

    Example

    -

    - -

    -$ wgrib2 -var-ens ens.grb
    -1:0:HGT:ENS=+1
    -2:45932:SPFH:ENS=+1
    -3:89724:SPFH:ENS=+1
    -4:144624:HGT:ENS=+1
    -5:198928:TMP:ENS=+1
    -6:219134:SPFH:ENS=+1
    -7.1:258504:UGRD:ENS=+1
    -7.2:258504:VGRD:ENS=+1
    -8:380298:SPFH:ENS=+1
    -9:441918:SPFH:ENS=+1
    -
    - -See also: --N_ens.html --set_ens_num.html -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ens_processing.html b/web_docs/ens_processing.html deleted file mode 100644 index 32996b0..0000000 --- a/web_docs/ens_processing.html +++ /dev/null @@ -1,480 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ens_processing - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ens_processing -
     
    - -

    wgrib2: -ens_processing

    -
    - - -

    Introduction (wgrib2 v3.0.0)

    - -

    -Please don't use -ens_processing with -wgrib2 v2.0.8 because you get the wrong results if the number of threads -is not one when using a newer gcc compiler. In addtion, -75% is inaccuracte, precip trace -amounts (option = 1) is bad, and a possible seg fault could occur. -(An out-of-bounds -array value is multipled by zero, so it doesn't affect the calculation.) -So you need to use wgrib2 v3.0.0+. - -

    -The -ens_processing option takes -the ensemble member data and creates a pre-defined set of ensemble statistics. -If you want find the probability that a certain field has -values exceeding a limit, you should look at trick 65 in -the -wgrib2 tricks page. - -

    -The -ens_processing option is used -to create various ensemble statistics such as -minimum, maximum, average, spread, and various percentiles in order to describe the PDF. -The values are calculated with respect -to all the ensemble members. The calculations are different from the calculations -used by the operational ensemble forecasts done at NCEP. So fields like the various percentiles -and spread will have different values from the NCEP operational products. -The results from the -ens_processing option should not -be considered to be replacements for the official products because of the different -algorithms used. (The exception will be the future climate reanalysis produced by CPC/NCEP.) - -

    The percentiles values were chosen because the future CPC/NCEP climate reanalysis (CORe) -will be using 80 ensemble members. - -

    The calculated variables are -

    -1) ensemble mean,  em = sum(x(i))/n,  i=1..n
    -2) ensemble spread, RMSE = sqrt(sum((x(i)-em)**2)/n)  note: n is used rather than n-1
    -3) minimum = minimum value over all ensemble members (for each grid point)
    -4) maximum = maximum value over all ensemble members (for each grid point)
    -5) 10 percentile
    -6) 25 percentile
    -7) 50 percentile (median)
    -8) 75 percentile
    -9) 90 percentile
    -
    -Note: these calculations done when all the ensemble members have
    -values.  This will affect parameters like the cloud-top temperature
    -when some of the ensemble members are cloud free and have no cloud-
    -top temperatures. The -enq_qc calculates the ensemble mean and spread
    -ignoring the undefined values.
    -
    -There are a few common ways to compute the percentile, wgrib2 uses a method
    -  recommended by NIST:
    -
    -    https://www.itl.nist.gov/div898/handbook/prc/section2/prc262.htm
    -
    -    percentile: sort values (1..N), p=percentile/100
    -           x(1) if p ≤ 1/(N+1)
    -           x(p*(N+1)) if 1/(N+1) ≤ p &le N/(N+1)
    -           x(N) if N/(N+1) ≤ p ≤ 1
    -
    -           x(r) = x(floor(r))(1-(r-floor(r)) + x(floor(r)+1)(r-floor(r))
    -              for non-integral r
    -
    -For the probabilities, a count is used to determine them.
    -
    -As previously mentioned, the above calculations may differ from those used
    -in deriving the operational products.
    -
    - -

    -The -ens_processing option was developed for the -future CORe reanalysis. For this reanalysis, additional fields -are enabled by the second parameter set to "1". However, users are warned -that these fields are expected to change. Generation of additional -fields can be enabled by setting the second parameter to special values. - -

    -10) probability of precipitation > 0 *
    -11) probability of more than a trace of precipitation (trace=TBD) *
    -12) probability of 2m temperature greater than 273.15K *
    -13) 95 percentile for WIND at 10m above ground *
    -
    -* optional, the definition of trace of precipitation is ad hoc
    -     trace can mean precipitation that will get the rain gauge wet but register as zero
    -     trace can mean less than 0.01 inches
    -     trace can mean less than 0.1 mm
    -     for wgrib2, trace = accumulated precip < 0.xxx mm, or a rate < 0.xxx mm/day.
    -
    - -

    -The -ens_processing is unlike most wgrib2 -options in that this option can use large amounts of memory. Suppose -that you have an 80 member ensemble and are processing the tmp500 field. -In order to calculate the percentiles of the tmp500, you need keep -all 80 tmp500 fields in memory. As the size of the grid and the number -of ensemble member increases, the required memory will increase. - -

    Code Table 4.3, Type of Generating Process

    -

    Grib contains metadata, and one piece is the "generating process". -Wgrib2 tries its best to describe how the fields were created. This -is documented in detail because if varies between PDT and center that -created the grib file. - -

    -Ensemble mean, ensemble spread, ensemble minimum, ensemble maximum:
    -  Code Table 4.3 is preserved from the input file.
    -
    -Percentiles, Probabilities:
    -  NCEP: code table 4.3 = 199,  Ensemble forecast based on counting
    -  Other centers: code table 4.3 = 4, Ensemble forecast
    -
    -The NCEP files are more descriptive because an entry in a local table was
    -specially created for wgrib2.
    -
    - - -

    Definition of an Ensemble Member

    - -

    -Wgrib2 v3.0.0 defined an ensemble as having the same Product Definition Template (PDT=0, 1, 8, 11) -except for perturbation number. The initial time and forecast times could be different as long -as the verification time was the same. This allows lagged averge forecast (LAF) ensembles. -With wgrib2 v3.0.0, the type of ensemble forecast can be different. -(code table 4.6) -This means that -ens_processing can now work with a -combination of perturbed and control runs. -

    -Limiting the PDTs to 0, 1, 8 and 11 is unnecessarily restrictive. As a result, --ens_processing does not work on aerosols, chemical -tracers and simulated satellite data from ensemble members. - -

    Order of Fields

    - -The -ens_processing requires fields -to be in a specific order. The data has to be processed -sequentially. If the --ens_processing finds a field that is -unlike the previous fields (except for ensemble member id), it -writes out the summary fields and starts processing a new variable. -The number id of the ensemble members is ignored, and is not -even necessary. - -
    -bash-4.1$ wgrib2 all.grb | head -n 60
    -1:0:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+1
    -2:83628:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+2
    -3:164290:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+3
    -4:248531:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+4
    -..
    -19:1494083:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+19
    -20:1574514:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+20
    -21:1657406:d=2018020600:VIS:surface:84 hour fcst:ENS=+1
    -22:1703817:d=2018020600:VIS:surface:84 hour fcst:ENS=+2
    -..
    -39:2488331:d=2018020600:VIS:surface:84 hour fcst:ENS=+19
    -40:2533546:d=2018020600:VIS:surface:84 hour fcst:ENS=+20
    -41:2579586:d=2018020600:UGRD:planetary boundary layer:84 hour fcst:ENS=+1
    -42:2629955:d=2018020600:UGRD:planetary boundary layer:84 hour fcst:ENS=+2
    -..
    -
    -

    Order of Fields: gmerge to the rescue

    - -

    The -ens_processing requires the -fields to be in a specific order (or processed in a specific order). -Suppose we have forecasts from 3 ensemble members in files fcst1, fcst2 -and fcst3. Now we are going to require that the fields have the -same order in these files, and the files have no submessages. -Then we can combine these files using gmerge, the resulting file -will be in the correct order. (Gmerge has been included with wgrib2 -source code for many years.) There is a minor restriction, gmerge -doesn't handle grib files which includes non-grib data. - -

    -gmerge output fcst1 fcst2 fcst3
    -
    - -The requirements for output to be in the right order. - -
      -
    1. fcstX must have fields in the same order -
    2. number of forecasts &le 200 for wgrib2 v2.0.8 distribution -
    3. fcstX must not use submessages -
    4. the like forecasts must have same PDT except for ensemble number -
    5. the ensemble number is optional -
    6. no non-grib data in grib file -
    - -You can find gmerge in the wgrib2 public distrbution under the aux_progs directory. -If your initial files are not in identical order, you could combine the forecasts -and sort the fields so that like fields are adjacent. However, sorting the individual -forecasts and then running gmerge would probably be faster. - - -

    Now that "output" has the data in the correct order, the -option -ens_processing can be used to -create the min/max/ave/spread of the ensemble. - -

    -gmerge  output1 fcst1 fcst2 fcst3
    -wgrib2  output1 -ens_processing output2 x
    -  note: x is a dummy argument, it may be used in the future
    -
    -For faster processing, we can replace the disk file "output" by a pipe.
    -This method may or may not work under Windows.
    -
    -
    -gmerge - fcst1 fcst2 fcst3 | wgrib2 - -ens_processing output x
    -
    -    gmerge - A B C   writes the output to stdout (denoted by the -)
    -    wgrib2 - (..)    reads the input grib data from stdin (denoted by the -)
    -
    -NOTE 1: must use a recent version of gmerge.  Old versions of gmerge
    -only accepted a small number of input files and did not allow
    -output to the pipe by "-".
    -
    -NOTE 2: a common unix convention is that the "-" instead of a file name
    -represents either stdin or stdout.  By knowing the program arguements, 
    -one can determine whether the dash is stdin or stdout.  Wgrib2 uses
    -this convention in most places that require a file name.
    -
    - -

    Fast Processing at the expense of Large Memory

    - -

    -Using gmerge, and sending the output to wgrib2 is simple. However, it -can be I/O inefficient especially for large ensembles. Consider a -small system that has 80 ensemble member data on one drive. For the 1st -field, the system has to read field-1 of file-1. For the second field, -the system has to read field-1 from file-2. For the 81st field, the -system has to read field-2 from file-1. Hopefully the disk cache was -big enough that the field-2 of file-1 was still cached. The speed of -processing depends on the size of disk cache. This example is for -a small system, what would happen on a HPC system? Disk cache is -much larger but so is the block size. If one job takes a large fraction -of the disk cache, the other jobs will be much more disk inefficient. - -

    A better approach is to adopt the technique used in -fast averaging. You may be -limited by the amount of physical memory on the system. - -

    -cat fcst.2018122600.mem* | wgrib2 - -set_grib_type c3 \
    -  -if (xxx1) -ens_processing out 0 -fi \
    -  -if (xxx2) -ens_proceesing out 0 -fi \
    -  ...
    -  -if (xxxN) -ens_proceesing out 0 -fi
    -
    - -This approach only has two open files at any one time, and -the files are read and written sequentially. This approach is -harder to program but is much more I/O friendly for both workstations -and HPCs. The drawback is that this approach needs to keep all -the fields in memory. (#ensemble members x #fields/file x NX x NY x 4 bytes). - - -

    Usage

    -

    - -

    --ens_processing FILE Option
    -   FILE = output file, grib2 format
    -   Option = 0   default
    -            1   include probabilities (TMP2m, precip)
    -                note: option 1 is intended for use by the future
    -		Conventional Observation REanalysis
    -		(CORe).  The output will be determined the needs of this
    -                reanalysis. 
    -            2   for future use or different output.
    -
    -  If you would like to add more output from -ens_processing, it
    -  needs to be enabled by an option number.  Ask me (WNE) for
    -  a number.
    -
    - -

    Example

    -

    -

    -$ wgrib2 input -ens_processing output 0 
    -1:0:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+1
    -2:83628:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+2
    -3:164290:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+3
    -4:248531:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+4
    -5:331723:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+5
    -6:412226:d=2018020600:PRES:mean sea level:84 hour fcst:ENS=+6
    -..
    -$ wgrib2 output
    -1:0:d=2018020600:PRES:mean sea level:84 hour fcst:min all members
    -2:130501:d=2018020600:PRES:mean sea level:84 hour fcst:max all members
    -3:261002:d=2018020600:PRES:mean sea level:84 hour fcst:ens mean
    -4:391503:d=2018020600:PRES:mean sea level:84 hour fcst:ens spread
    -5:497569:d=2018020600:PRES:mean sea level:84 hour fcst:25%-75% range
    -6:611780:d=2018020600:PRES:mean sea level:84 hour fcst:10% all members
    -7:742281:d=2018020600:PRES:mean sea level:84 hour fcst:90% all members
    -8:872782:d=2018020600:VIS:surface:84 hour fcst:min all members
    -9:938123:d=2018020600:VIS:surface:84 hour fcst:max all members
    -...
    -
    - -

    GrADS

    - -

    At the time of writing (1/2018), the files that -are produced by - -ens_processing cannot be displayed -using the g2ctl/gribmap/GrADS set of programs. However, they -can be displayed by atl_g2ctl/alt_gmp/GrADS set of programs. - -

    -  alt_g2ctl -short output >output.ctl
    -  alt_gmp output.ctl
    -  grads
    -
    - -

    -See also: --ens_qc - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan 18, 2018, Aug 29, 2018, June 21, 2019, Sep 24, 2019. Jan 2021, Jan 2022, July 2023 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ens_qc.html b/web_docs/ens_qc.html deleted file mode 100644 index 96f6c1d..0000000 --- a/web_docs/ens_qc.html +++ /dev/null @@ -1,338 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ens_qc - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ens_qc -
     
    - -

    wgrib2: -ens_qc

    -
    - - -

    Introduction (wgrib2 v3.1.1)

    - -

    -The option -ens_qc tests the -ensemble members looking for extreme values, values that -are extreme relative the spread of the ensemble members. -This test is done for each grid point. An unreasonable -scaled extreme value provides a simple quality control -for an egregiously bad ensemble member. -

    -During the production of the Conventional Observations REanalsyis (CORe), -a glitch was found where the upper-level ozone was two orders of magnitude -larger than expected. The problem was caused by a single ensemble -member which had an irreproducible problem which showed up in a single layer -of a tracer. The -ens_qc option was written to -detect extreme values of the ensemble members for quality control. -In addition, -ens_qc -can be used to calculate the ensemble mean and spread faster -than -ens_processing. - -

    -The option -ens_qc will QC ensemble -members which limits this option to PDTs of 0, 1, 8, and 11. -PDTs of 1 and 11 are explicity ensemble members. PDTs of 0 and -8 are often used by the control runs. The code should be updated -to include other ensemble PDTs. - -

    The contents of the output files will vary depending the qc_version. -As of 1/2022, only qc_version 1 has been defined. - -

    -1) ens_mean,  sum(x(i))/n,  i=1..n where n is the number of ensemble members
    -2) ens_spread, sqrt(sum((x(i)-em)**2)/n)  note: n is used rather than n-1
    -3) ens_min = minimum value over all ensemble members (for each grid point)
    -4) ens_max = maximum value over all ensemble members (for each grid point)
    -5) scaled extreme value, max((ens_max-ens_mean),(ens_mean-ens_min))/ens_spread
    -6) grid maximum of the scaled extreme value (single number)
    -
    -(1)-(4) are written to arg1, order: (3), (4), (1), (2)
    -(5) is written to arg2
    -(6) is written to arg3
    -
    -Note: the calculations are done grid point by grid point. If all the
    -members have UNDEFINED values for a particular grid point, then variables
    -1-5 are set to UNDEFINED for that grid point.  If the ensemble spread
    -is zero, then the scaled extreme value is set to zero.  The calculation
    -differs from -ens_processing which requires no missing values for all
    -the ensemble members before calculating the various products. This
    -will affect the calculation of the mean cloud top temperature some
    -ensemble members are missing clouds.
    -
    - -

    -The -ens_qc is unlike most wgrib2 -options in that this option can use large amounts of memory. Suppose -that you have an 80 member ensemble and are processing the tmp500 field. -This option stores all 80 tmp500 fields in memory. As the size of the grid and the number -of ensemble member increases, the required memory will increase. - -

    Code Table 4.7

    -

    Grib Code Table 4.7 is used to specify whether the field -is the ensemble mean, spread, min, max or scaled extreme value. -The ensemble mean, spread, min and max are WMO defined values. -For the scaled extreme value, wgrib2 is using the locally defined NCEP -"extreme forecast index". Since the NCEP documentation doesn't define -the index, wgrib2 will be using the scaled extreme value. So -other uses of the "extreme forecast index" will differ. - -

    -The scaled extreme values are stored in 8 bits precision (two digits), -and can only be written if the original file is from NCEP because -there is no equivalent WMO code for extreme value (1/2022). - - -

    Definition of an Ensemble Member

    - -

    -The -ens_qc option uses the same defintion of ensemble member as --ens_processing. Any grib message which is -not identified as an ensemble member is ignored by -ens_qc. -So you cannot use -ens_qc on the ensemble-mean. -The wgrib2 code [ed. written 3/2022 v3.1.1] that identifies ensemble member -is unreasonably simplistic. Ensemble members are identified by having a PDT -of 0, 1, 8 and 11. As a result, aerosols, chemical tracers, simulated satellite data, -and post-processing of ensemble members are ignored. - -

    Order of Fields

    - -The -ens_qc requires fields to be in a specific order, -the same order as in -ens_processing. Please -see the documentation for -ens_processing. - - - -

    Usage

    -

    - -

    --ens_qc FILE1 FILE2 FILE3 QC_VERSION
    -   FILE1 = ensemble min, ensemble max, ensemble mean, ensemble spread
    -           output in grib2 format
    -   FILE2 = if center == NCEP, (ensemble) scaled extreme value
    -           output in grib2 format
    -           if center != NCEP, no output is written
    -   FILE3 = grid maximum of the (ensemble) scaled extreme value
    -           text, single line per field
    -   QC_VERSION = the type of QC to be run
    -           1  only acceptable value (1/2021)
    -
    - -

    Example

    -
    -$ gmerge - sfg_2014060500_fhr06_mem0* | wgrib2 - -ens_qc out1 out2 out3 1
    -1:0:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:ENS=+1
    -2:183334:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:ENS=+2
    -3:366283:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:ENS=+3
    -4:549841:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:ENS=+4
    -5:733631:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:ENS=+5
    -...
    -  gmerge - (list of ensemble members)
    -           The output file is "-" which is a convention for stdin/stdout depending 
    -             on the expectation. Since we expecting an output file, the "-" is stdout.
    -           Takes the 1st grib message from each ensemble member and writes it to stdout.
    -           Takes the 2nd grib message from each ensemble member and writes it to stdout.
    -           etc
    -           The gmerge step puts the data into proper order assuming,
    -              the grib file contains no sub-messages,
    -              the indivdual grib files are in the same order.
    -           gmerge is not Windows compatilble.
    -
    -  wgrib2 - -ens_qc out1 out2 out3 1
    -           The input file is "-" which is a convention for stdin/stdout depending 
    -             on the expectation. Since we expecting an input file, the "-" is stdin.
    -           writes min, max, mean and spread to out1
    -           writes scaled extreme values to out2
    -           writes grid maximum scale extreme value to out3
    -
    -  Note: piping grib data to stdout and from stdin should not work in Windows.
    -  I have seen it work, and I have seen it fail. My standard practice is to
    -  avoid pipes in Windows.
    -
    -$ wgrib2 out1
    -1:0:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:min all members
    -2:262325:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:max all members
    -3:524650:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:ens mean
    -4:786975:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:ens spread
    -5:1000148:d=2014060412:UGRD:1-2 hybrid pressure layer:12 hour fcst:min all members
    -...
    -
    -$ wgrib2 out2
    -1:0:d=2014060412:UGRD:0-1 hybrid pressure layer:12 hour fcst:extreme forecast index
    -2:131253:d=2014060412:UGRD:1-2 hybrid pressure layer:12 hour fcst:extreme forecast index
    -3:262506:d=2014060412:UGRD:2-3 hybrid pressure layer:12 hour fcst:extreme forecast index
    -...
    -
    -$ cat out3
    -UGRD:0-1 hybrid pressure layer:max scaled extreme=7.454012
    -UGRD:1-2 hybrid pressure layer:max scaled extreme=8.029185
    -UGRD:2-3 hybrid pressure layer:max scaled extreme=7.936052
    -...
    -
    -

    GrADS

    - -

    At the time of writing (1/2021), the files that -are produced by - -ens_qc cannot be displayed -using the g2ctl/gribmap/GrADS set of programs. However, they -can be displayed by atl_g2ctl/alt_gmp/GrADS set of programs. - -

    -  alt_g2ctl -short output >output.ctl
    -  alt_gmp output.ctl
    -  grads
    -
    - -

    -See also: --ens_processing, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: 1/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - diff --git a/web_docs/eof_bin.html b/web_docs/eof_bin.html deleted file mode 100644 index ff54c68..0000000 --- a/web_docs/eof_bin.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lon - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-err_bin, err_string, eof_bin, eof_string, -
     
    - -

    wgrib2: -err_bin, -err_string, -eof_bin, -eof_string

    -
    - - -

    Introduction

    - -

    -When you want your want to embed wgrib2 in your program, you want to run wgrib2 and -have ways to talk with wgrib2. For example, we set up a pipe between the main program -and wgrib2. Wgrib2 was suppose to send the a decoded grid to the main program. However, -the grid didn't exist (EOF) or something was wrong (ERR). Consequently wgrib2 didn't -send the grid over the pipe and the main program just waited for data that would never -come. One method is to send an EOF or ERR message so that the main program would -realize something was wrong. For the case that started this, sending a binary 0 -was enough to alert the main program. (The main program was expecting a fortran -sequential file and a record size of 0 is not a reasonable value.) - -

    -The -err_bin, -eof_bin, -err_string, -and -eof_string options are setup options. Like all setup options, they -are only evaluated before processing of the file and in the case of duplicate options, -only the last applies. -The -err_bin and -eof_bin options write integer -to the specified file. The size of the integer will be determined by the size of the native -integer (often a compile option on 64 bit machines). The endian properties will depend -whether the code is compiled a big or little endian machine. - -

    -The -err_* options will write output when a "FATAL ERROR" message is triggered. -The -eof_* options will write output when wgrib2 ends with out a "FATAL ERROR" -message. However, if wgrib2 fails in an abnormal way (example: segmentation fault), -none of these routines will write output. - - -

    Usage

    - -
    --err_bin file integer
    --err_string file string
    --eof_bin file integer
    --eof_string file string
    -
    - - - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/eof_string.html b/web_docs/eof_string.html deleted file mode 100644 index ff54c68..0000000 --- a/web_docs/eof_string.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lon - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-err_bin, err_string, eof_bin, eof_string, -
     
    - -

    wgrib2: -err_bin, -err_string, -eof_bin, -eof_string

    -
    - - -

    Introduction

    - -

    -When you want your want to embed wgrib2 in your program, you want to run wgrib2 and -have ways to talk with wgrib2. For example, we set up a pipe between the main program -and wgrib2. Wgrib2 was suppose to send the a decoded grid to the main program. However, -the grid didn't exist (EOF) or something was wrong (ERR). Consequently wgrib2 didn't -send the grid over the pipe and the main program just waited for data that would never -come. One method is to send an EOF or ERR message so that the main program would -realize something was wrong. For the case that started this, sending a binary 0 -was enough to alert the main program. (The main program was expecting a fortran -sequential file and a record size of 0 is not a reasonable value.) - -

    -The -err_bin, -eof_bin, -err_string, -and -eof_string options are setup options. Like all setup options, they -are only evaluated before processing of the file and in the case of duplicate options, -only the last applies. -The -err_bin and -eof_bin options write integer -to the specified file. The size of the integer will be determined by the size of the native -integer (often a compile option on 64 bit machines). The endian properties will depend -whether the code is compiled a big or little endian machine. - -

    -The -err_* options will write output when a "FATAL ERROR" message is triggered. -The -eof_* options will write output when wgrib2 ends with out a "FATAL ERROR" -message. However, if wgrib2 fails in an abnormal way (example: segmentation fault), -none of these routines will write output. - - -

    Usage

    - -
    --err_bin file integer
    --err_string file string
    --eof_bin file integer
    --eof_string file string
    -
    - - - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/err_bin.html b/web_docs/err_bin.html deleted file mode 100644 index 6cf4851..0000000 --- a/web_docs/err_bin.html +++ /dev/null @@ -1,214 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lon - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-err_bin, err_string, eof_bin, eof_string, -
     
    - -

    wgrib2: -err_bin, -err_string, -eof_bin, -eof_string

    -
    - - -

    Introduction

    - -

    -When you want your want to embed wgrib2 in your program, you want to run wgrib2 and -have ways to talk with wgrib2. For example, we set up a pipe between the main program -and wgrib2. Wgrib2 was suppose to send the a decoded grid to the main program. However, -the grid didn't exist (EOF) or something was wrong (ERR). Consequently wgrib2 didn't -send the grid over the pipe and the main program just waited for data that would never -come. One method is to send an EOF or ERR message so that the main program would -realize something was wrong. For the case that started this, sending a binary 0 -was enough to alert the main program. (The main program was expecting a fortran -sequential file and a record size of 0 is not a reasonable value.) - -

    -The -err_bin, -eof_bin, -err_string, -and -eof_string options are setup options. Like all setup options, they -are only evaluated before processing of the file and in the case of duplicate options, -only the last applies. -The -err_bin and -eof_bin options write integer -to the specified file. The size of the integer will be determined by the size of the native -integer (often a compile option on 64 bit machines). The endian properties will depend -whether the code is compiled a big or little endian machine. - -

    -The -err_* options will write output when a "FATAL ERROR" message is triggered. -The -eof_* options will write output when wgrib2 ends without a "FATAL ERROR" -message. However, if wgrib2 fails in an abnormal way (example: segmentation fault), -none of these routines will write output. - -

    -If a "FATAL ERROR" occurs before the The -err_* option is initialized, there will -be no error file written. This can occur when the command line options are wrong -(option expects 3 arguments and you supply a different number). It can also -occur when the initialization of an earlier option failed. (Ex. read from a -non-existant file.) Consequently the -err_* options should be in front of the -comamand line arguments. -right. - - - - -

    Usage

    - -
    --err_bin file integer
    --err_string file string
    --eof_bin file integer
    --eof_string file string
    -
    - - - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/err_string.html b/web_docs/err_string.html deleted file mode 100644 index 6cf4851..0000000 --- a/web_docs/err_string.html +++ /dev/null @@ -1,214 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lon - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-err_bin, err_string, eof_bin, eof_string, -
     
    - -

    wgrib2: -err_bin, -err_string, -eof_bin, -eof_string

    -
    - - -

    Introduction

    - -

    -When you want your want to embed wgrib2 in your program, you want to run wgrib2 and -have ways to talk with wgrib2. For example, we set up a pipe between the main program -and wgrib2. Wgrib2 was suppose to send the a decoded grid to the main program. However, -the grid didn't exist (EOF) or something was wrong (ERR). Consequently wgrib2 didn't -send the grid over the pipe and the main program just waited for data that would never -come. One method is to send an EOF or ERR message so that the main program would -realize something was wrong. For the case that started this, sending a binary 0 -was enough to alert the main program. (The main program was expecting a fortran -sequential file and a record size of 0 is not a reasonable value.) - -

    -The -err_bin, -eof_bin, -err_string, -and -eof_string options are setup options. Like all setup options, they -are only evaluated before processing of the file and in the case of duplicate options, -only the last applies. -The -err_bin and -eof_bin options write integer -to the specified file. The size of the integer will be determined by the size of the native -integer (often a compile option on 64 bit machines). The endian properties will depend -whether the code is compiled a big or little endian machine. - -

    -The -err_* options will write output when a "FATAL ERROR" message is triggered. -The -eof_* options will write output when wgrib2 ends without a "FATAL ERROR" -message. However, if wgrib2 fails in an abnormal way (example: segmentation fault), -none of these routines will write output. - -

    -If a "FATAL ERROR" occurs before the The -err_* option is initialized, there will -be no error file written. This can occur when the command line options are wrong -(option expects 3 arguments and you supply a different number). It can also -occur when the initialization of an earlier option failed. (Ex. read from a -non-existant file.) Consequently the -err_* options should be in front of the -comamand line arguments. -right. - - - - -

    Usage

    - -
    --err_bin file integer
    --err_string file string
    --eof_bin file integer
    --eof_string file string
    -
    - - - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/error_final.html b/web_docs/error_final.html deleted file mode 100644 index 399cc4f..0000000 --- a/web_docs/error_final.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -error_final - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-error_final -
     
    - -

    wgrib2: -error_final

    -
    - - -

    Introduction

    - -

    -The -error_final tests the final value -and can raise an error condition when wgrib2 returns. -For version 1, the only value that can be tested is the count -of the number time the option is called in the grib-processing phase. - -

    -When -error_final is intialized, the count is set to zero. -Then -error_final increments the count whenever it processes -a grib message. -Finally when -error_final is run after processing all the grib -messages, it tests count to a specified integer and sets the error return. - -

    Usage

    - -
    --error_final count TEST INTEGER
    -   TEST = eq, ne, lt, gt, le, ge
    -   INTEGER integer
    -   sets return error to one if "count TEST INTEGER" is true
    -
    - -

    Example

    - -
    --sh-4.2$ wgrib2 LIS.c3 
    -1:0:d=2014030500:SPRATE:surface:anl:
    -2:661778:d=2014030500:RPRATE:surface:anl:
    -3:903352:d=2014030500:SKINT:surface:anl:
    -4:4108932:d=2014030500:SDWE:surface:anl:
    -5:9512902:d=2014030500:SNOD:surface:anl:
    -6:14281104:d=2014030500:PRATE:surface:anl:
    -7:14925511:d=2014030500:TMP:surface:anl:
    --sh-4.2$ wgrib2 LIS.c3  -error_final count ne 7 -if ':TMP:' -error_final count ne 1 -endif
    -1:0:d=2014030500:SPRATE:surface:anl:
    -2:661778:d=2014030500:RPRATE:surface:anl:
    -3:903352:d=2014030500:SKINT:surface:anl:
    -4:4108932:d=2014030500:SDWE:surface:anl:
    -5:9512902:d=2014030500:SNOD:surface:anl:
    -6:14281104:d=2014030500:PRATE:surface:anl:
    -7:14925511:d=2014030500:TMP:surface:anl:
    --sh-4.2$ echo $?
    -0
    --sh-4.2$ wgrib2 LIS.c3  -error_final count ne 7 -if ':TMP:' -error_final count ne 3 -endif
    -1:0:d=2014030500:SPRATE:surface:anl:
    -2:661778:d=2014030500:RPRATE:surface:anl:
    -3:903352:d=2014030500:SKINT:surface:anl:
    -4:4108932:d=2014030500:SDWE:surface:anl:
    -5:9512902:d=2014030500:SNOD:surface:anl:
    -6:14281104:d=2014030500:PRATE:surface:anl:
    -7:14925511:d=2014030500:TMP:surface:anl:
    --sh-4.2$ echo $?
    -1
    -
    - - - -See also: --if --endif -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page: 7/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/example_merra_2_grib2.html b/web_docs/example_merra_2_grib2.html deleted file mode 100644 index 6b522f7..0000000 --- a/web_docs/example_merra_2_grib2.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - Climate Prediction Center - wgrib2: converting MERRA HDF file to grib2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 - example converting MERRA HDF to grib2 -
     
    - -

    wgrib2: Converting MERRA HDF file to GRIB-2

    -
    - - -

    Introduction

    - -

    -MERRA is a NASA reanalysis project that has created reanalyses in HDF format. -For some people, grib is a more convenient format. Here is our first attempt -to convert a MERRA HDF file into grib-2. - -

    Surveying the situation we see that Lats or the simpler to use Lats4d can -convert HDF into grib-1. Grib-1 can be converted into grib-2 by the -cnvgrib utility except that lats creates a custom grib table. Therefore a -program would have to be written that converts the grib-1 file with the -custom grib table into a grib table using the standard NCEP table. Doable -but the program wouldn't be very generic. In addition the process would -take 3 steps (convert to grib1, translate grib1, convert to grib2). -Can we do better? - -

    Looking at the programs that can read HDF, we see a familiar face, GrADS. -GrADS can read the HDF and write it out as a binary file. wgrib2 can then -read the binary file, a grib-2 template and metadata and then create a grib-2 -file. - -

    1: The template

    -Grib-2 files include much metadata that is constant such as grid, center that created the -data, the process that created the data, etc. Making a template takes some knowledge -and we'll assume it has already been done. For the MERRA template, I used copygb/cnvgrib -to create a grib2 file with the proper grid definition and then used wgrib2 to fill -in some of the metadata (center). Probably should have filled in more of the metadata -but I didn't. - -

    2: Writing the binary and meta data

    -The script g2write takes three arguments, the GrADS variable/expression, -the output file and some metadata (variable:level:forecast/analysis). -The script then creates the binary and metadata for one or more grids -depending whether t is varying. These two files along with the -template can be used to make a grib2 file. - -

    3: All together

    - - -
  • Start gradshdf. -
  • open the HDF file, sdfopen hdf-file -
  • run the script, merra2grb2.gs - - -

    4: What does merra2grb2 do?

    - -
  • set the grid .. grads often uses an extra column .. 0..360 degrees -
  • set the time -
  • writes out ps with the metadata PRES:surface:anl -
  • writes out slp with the metadata PRES:mean sea level:anl -
  • loops over subset of available pressure levels -
  • writes out h with the metadata HGT:xx mb:anl -
  • writes out t with the metadata TMP:xx mb:anl -
  • writes out u with the metadata UGRD:xx mb:anl -
  • writes out v with the metadata VGRD:xx mb:anl -
  • writes out qv with the metadata SPFH:xx mb:anl -
  • writes out o3 with the metadata O3MR:xx mb:anl -
  • after finishing looping over the vertical levels, the binary file are closed -
  • the binary data is stored in test -
  • the metadata is stored in test.inv, one line per field -
  • finally wgrib2 is run which takes the binary data (test), inventory (test.inv) and template (hires-merra.template.grb) - and creates a grib2 file (test.grb2) - - -
  • - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/export_lonlat.html b/web_docs/export_lonlat.html deleted file mode 100644 index 20a0108..0000000 --- a/web_docs/export_lonlat.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -export_lonlat - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -export_lonlat -
     
    - -

    wgrib2: -export_lonlat

    -
    - - -

    Writing longitudes and latitudes to a file

    - -

    -By default grib2 saves the latitude and longitude in micro-degrees. This -is more precision than the standard single-precision floating point variable -can hold. So wgrib2 uses double precision variables for its angles. -However, the -rpn facility is single precision, so it cannot be use for -angles without losing precision. -The -export_lonlat and --import_lonlat options allow you to write -and read double-precision longitude and latitudes. - - -

    File format

    -

    -The -export_lonlat option writes the -longitudes and latitudes in the following format. - -

    -8 bytes:                        'wgrib2ll'       text
    -(sizeof unsigned int) bytes      ndata           unsigned integer with number of grid points
    -(sizeof unsigned int) bytes      0               unsigned integer with value of zero
    -ndata*(sizeof double)            longitudes      ndata values of double precision longitudes
    -ndata*(sizeof double)            latitudes       ndata values of double precision latitudes
    -
    -(sizeof unsigned int) is usually 4.  By wgrib2 requirements, the value must be 4 or greater.
    -(sizeof double) is usually 8.
    -
    - -

    Usage

    -

    -

    --export_lonlat FILE
    -    FILE = file that is written with the binary data
    -
    - -

    Example

    -
    -   $ wgrib2 IN.grb -ncpu 3 -new_grid_winds grid -new_grid ncep grid 221 - | wgrib2 - -ncpu 1 -set_grib_type j -ncep_uv OUT.grb
    -
    -

    -The above line uses 3 threads for regridding and one thread for jpeg2000 compression. The jpeg2000 -compression routines can't take advantage of more than one thread. -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created: 6/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ext_name.html b/web_docs/ext_name.html deleted file mode 100644 index d24d8cd..0000000 --- a/web_docs/ext_name.html +++ /dev/null @@ -1,284 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ext_name= - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: -ext_name -
     
    - -

    wgrib2: -ext_name

    -
    - - -

    Introduction

    - -

    In the beginning, grib fields were identified by a name, a level -and some timing information, like temperature, surface, 12 hour forecast -from January 1, 2021. Eventually that wasn't good enough. The field -has modifiers such as ensemble member number or median forecast. -So the concept of "extended name" was introduced into wgrib2. -So by setting a flag, some options would use the extended name -instead of the normal name (-aaig, -csv, -csv_long, -netcdf, -and macros that call -ext_name). - - -

    Old Extended Names, up to wgrib2 3.0.2

    - -The original extended name included the grib name and modifiers like ensemble and -tracer information (misc info). The individual items were separated by -a period, and spaces were converted into underscore. The option -set_ext_name N -was documented to accept N being 0 and 1. (The wgrib2 would accept any integer, -and would test for zero and not zero.) The option, -ext_name would print -out the extend name (name.misc-info). - - -

    Extended Name for wgrib2 3.0.2+

    - -

    -Wgrib2 can write netcdf files, and -netcdf concatinates the level information -to the extended name to produce the netcdf name for the field. For some -of the newer NCEP forecast files, this name wasn't unique. So the extended -name was expanded to be name.misc-info.level-info.forecast-time.info -where the last 3 field were optional. - -

    -  $ wgrib2.v3.0.1 FCST.grb -set_ext_num 1 -netcdf FCST.nc
    -     lost fields because the field names were not unque
    -
    -  $ wgrib2.v3.0.1 FCST.grb -set_ext_num 5 -netcdf FCST.nc
    -     extended name include misc-info and forecast-time-info.
    -
    - -

    -The final modification to the extended name, was to make the field and space -character a run-time parameter by the option, -set_ext_name_chars. The default -values are '.' and '_' for backwards compatibilty. The modification was needed -we now are seeing level-info and misc-info with periods in them like "0.5 mb". - - - - -The -var option prints the VARIABLE name of -the grib message. Common names would be HGT and TMP for the geopotential -height and the temperature. For most knowing the variable name, -the level and the timimg information is all you need. Then things -became more complicated. Eventually a file came along which had only -one variable type (MASSDEN, mass density) but had a couple of -important qualifier chemical type (H2O/O3/N02) and ensemble member ID. -The -AAIG output was useless because its output -used the variable name. - -

    -To fix the -AAIG output, an extended name -was introduced. You can see the extended name by -the -ext_name option. - - -

    -$  wgrib2 chem.grb2 
    -1:0:d=2009012600:MASSDEN:surface:anl:ENS=hi-res ctl chemical=Water Vapour
    -$- wgrib2 chem.grb2 -ext_name
    -1:0:MASSDEN.hi-res_ctl.Water_Vapour
    -$ wgrib2 chem.grb2 -misc 
    -1:0:ENS=hi-res ctl:chemical=Water Vapour
    -
    - -The extended name takes the output of -misc, -changes the colons to periods, spaces to underscores and removes the -text up to the equal size and appends it to the variable name. As of -wgrib2 v1.9.0, the extended name is used with --AAIGc, -csv, and -netcdf. -To stop using the extended name in -AAIG, -csv and -netcdf, use the option --set_ext_name 0. - -

    -The -ext_name prints the extended name when the extended name type -is not zero. (The -set_ext_name option sets the extended name type.) - - -

    Extended Name when the extended name type is 0

    - -

    -The -ext_name always prints an extended name. -If the ext_name type is 0 which is the default value, -ext_name prints -out an extended name with the misc information. One sets the extended -name type using -set_ext_name. - -

    Usage

    - -
    --set_ext_name N
    -       N = 0..1  wgrib2 upto v3.0.1
    -       N = 0..7  wgrib2 v3.0.2+
    -       N = 0     default value
    --ext_name
    -       prints extended name type N if N > 0
    -       prints extended name type 1 if N == 0
    -
    - -

    Several options such as -netcdf use the -extended name type differently. If the extend name type is 0, they -use the regular name (-var). - -

    Examples

    - -
    --sh-2.05b$ ./wgrib2 chem.grb2 -var
    -1:0:MASSDEN
    --sh-2.05b$ ./wgrib2 chem.grb2 -ext_name
    -1:0:MASSDEN.hi-res_ctl.Water_Vapour
    -
    - - -See also: -s, --set_ext_name --set_ext_name_chars -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, 2/26/2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/fcst_ave.html b/web_docs/fcst_ave.html deleted file mode 100644 index 218c38b..0000000 --- a/web_docs/fcst_ave.html +++ /dev/null @@ -1,518 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ave, -fcst_ave - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ncep_norm -
     
    - -

    wgrib2: -ave, -fcst_ave

    -
    - -News -

    -With wgrib2 v2.0.7, -the -ave and -fcst_ave -now call the -time_processing option. -This option handles more statistical operations and more -Product Definition Templates (PDT). - -The old -ave and -fcst_ave options will available as --ave0 and -fcst_ave0. I expect that -these two options will be eliminated within a year of the release of v2.0.7. - - -

    Introduction

    - -

    -The -ave -and -fcst_ave options are very similar; -they both make temporal averages. -The -fcst_ave option assumes that the -reference (initial) time is constant and the verification time -is increasing. -The --ave option assumes the reference time -is increasing and the difference between the verification and -reference time is constant. - -

    - -You would use -fcst_ave to temporally average -a single forecast run. For example, you have a 3 week forecast with -output every 6 hours. You could use -fcst_ave -to find the forecast for the second week. - -

    -You would use -ave to temporally average -several analyses. Suppose you have -analyses every 6 hours and you want to find the analysis for the month. - -

    -The input grib file has to be processed in a special order. Don't worry, -a grib file can be ordered very easily with the sort command. wgrib2 reads the data -sequentially and when ever it encounters a new variable/level/chemical-type, -it starts the averaging process. The length of the averaging depends on -how many records it finds to average. For example, to make a daily -average, a file has to be in the following order. - -

    -U500 2000-01-02 00Z             start ave
    -U500 2000-01-02 06Z
    -U500 2000-01-02 12Z
    -U500 2000-01-02 18Z             end ave
    -V500 2000-01-02 00Z             start ave
    -V500 2000-01-02 06Z
    -V500 2000-01-02 12Z
    -V500 2000-01-02 18Z             end ave
    -Z500 2000-01-02 00Z             start ave
    -Z500 2000-01-02 06Z
    -Z500 2000-01-02 12Z
    -Z500 2000-01-02 18Z             end ave
    -
    - -To make a daily average of the above file, you need to specify the -output file and the time interval between samples. The time -units are the same as used by GrADS (hr, dy, mo, yr). - -
    -$ wgrib2 input.grb -ave 6hr out.grb
    -
    - - -If the file is not sorted, you can use the unix sort by, - -
    -$ wgrib2 input.grb | sort -t: -k4,4 -k5,5 -k6,6 -k3,3 | \
    -   wgrib2 -i input.grb -set_grib_type c3 -ave 6hr output.grb
    -
    - -If you want to make daily means from 4x daily monthly files -and assuming that more than one variable/level is in the monthly file. - -
    -$ wgrib2 input.grb |  sed 's/\(:d=........\)/\1:/' | \
    -  sort -t: -k3,3 -k5,5 -k6,6 -k7,7 -k4,4 | \
    -  wgrib2 input.grb -i -set_grib_type c3 -ave 6hr daily.ave.grb
    -
    - -

    -Using -fcst_ave is like using --ave except you use the verification -time instead of the reference time. To make an inventory that -use the verification time instead of the reference time, you type, - -

    -$ wgrib2 input.grb -vt -var -lev -misc 
    -1:0:vt=2011040101:PRATE:surface:
    -2:592224:vt=2011040102:PRATE:surface:
    -3:1233694:vt=2011040103:PRATE:surface:
    -4:1909322:vt=2011040104:PRATE:surface:
    -5:2612620:vt=2011040105:PRATE:surface:
    -
    - -The sed command will be alterered very slightly when making the -sort (:d=) -> (:st=). - -

    Averaging several files using gmerge

    - -

    If want to average several grib files, and the files have the -following properties: - -

      -
    1. No submessages. -
    2. No non-grib data between the grib messages. -
    3. Each file is for a different time. -
    4. Each file has corresponding grib messages in the same order -
    -
    -Conditions 1 and 2 can be met using 
    -
    -      wgrib2 IN.grb -grib OUT.grb
    -
    -Condition 4 can be met using 
    -      wgrib2 IN.grb | sort -k3 -t: | wgrib2 -i IN.grb -grib OUT.grb
    -
    - -

    -Then you can use the gmerge program to produce a file in -the correct order. The program gmerge is included with the -wgrib2 distribution under grib2/aux_progs/. - -

    -$ ls pgb.20170107??
    -pgb.2017010700	pgb.2017010706	pgb.2017010712	pgb.2017010718
    -
    -$ gmerge - pgb.20170107?? | wgrib2 - -ave 6hr /tmp/daily.grb
    -1:0:d=2017010700:APCP:surface:0-6 hour acc fcst:
    -2:92905:d=2017010706:APCP:surface:0-6 hour acc fcst:
    -3:185445:d=2017010712:APCP:surface:0-6 hour acc fcst:
    -4:278666:d=2017010718:APCP:surface:0-6 hour acc fcst:
    -5:371535:d=2017010700:ACPCP:surface:0-6 hour acc fcst:
    -6:442127:d=2017010706:ACPCP:surface:0-6 hour acc fcst:
    -7:514343:d=2017010712:ACPCP:surface:0-6 hour acc fcst:
    -8:588096:d=2017010718:ACPCP:surface:0-6 hour acc fcst:
    -9:661594:d=2017010700:NCPCP:surface:0-6 hour acc fcst:
    -...
    -
    -$ wgrib2 /tmp/daily.grb 
    -1:0:d=2017010700:APCP:surface:4@6 hour ave(0-6 hour acc fcst),missing=0:
    -2:325115:d=2017010700:ACPCP:surface:4@6 hour ave(0-6 hour acc fcst),missing=0:
    -3:715210:d=2017010700:NCPCP:surface:4@6 hour ave(0-6 hour acc fcst),missing=0:
    -...
    -
    - - - -

    Fast Averaging several files

    -

    -Suppose we have a month of analyses at 3 hour intervals and want -to make a monthly mean for Nov. 2014. Using the above sorting approach, the steps -would be - -

    -1.  cat narr.201411????.grb2 >tmp.grb2
    -2.  wgrib2 tmp.grb2 |  \
    -3.     sort -t: -k4,4 -k5,5 -k6,6 -k3,3 | \
    -4.     wgrib2 tmp.grb2 -i -set_grib_type c3 -ave 3hr narr.201411
    -
    -The first line creates a file with all the data.
    -The second line make an inventory.
    -The third line sorts the inventory in the order for -ave to process.
    -The fourth line makes the average by processing data in the order
    -  determined by the inventory created by line 3.
    -
    - -

    -The above approach processes one average at a time and requires a -minimal amout of memory. However, if you count the I/O operations, -you find that there are 4 I/O operations for every field as well as -the writes of the monthly means. In addition, the read (line 4) is -random access. - -

    -The gmerge approach would look like - -

    -1.  gmerge - narr.201411????.grb2 | \
    -2.     wgrib2 - -set_grib_type c3 -ave 3hr narr.201411
    -
    -The first line creates a file with all the data.
    -The second line makes the average by processing data from line 1.
    -
    - -

    -For this to work, you would have to rewrite gmerge to that it can -large number of input files. For a monthly average of 3-hourly files, -a typical linux system wouldn't have any problems. For a 30-year -climatology, the typical linux system would complain about the -number of open files. - -

    The number of I/O operations with the gmerge is quite good, -every input file is read one time. The read would behave somewhere -between a sequential read and a random read. Another drawback -is the input files much have the data in the same order. - - -

    The third method takes advantage of HPC file systems which -are very fast for sequential reads of large files and terrible for -random-access reads like used in the -the sort-of-the-index method. Using this method for computing -monthly means from 3-hourly NARR data was taking three quarters of -an hour on a multi-million dollar machine. -The problem was that the file system was optimized for large -sequential reads rather than small random-access reads. -The following shows another approach. - - -

    -1.  cat narr.201411????.grb2 | \
    -2.     wgrib2 - \
    -3.        -if_fs ":HGT:200 mb:" -ave 3hr narr.201411 \
    -4.        -if_fs ":UGRD:200 mb:" -ave 3hr narr.201411 \
    -5.        -if_fs ":VGRD:200 mb:" -ave 3hr narr.201411 \
    -6.        -if_fs ":TMP:200 mb:" -ave 3hr narr.201411 
    -
    -The first line copies the data in chronological order and
    -   writes it to the pipe.
    -The second line has wgrib2 read the grib data from the pipe.
    -The third line selects the Z200 fields and runs the averaging
    -  option on it.  We are assuming the narr.* fields only have
    -  one Z200 field and narr.201411???? puts the data into
    -  chronological order.
    -Lines 4-6 apply the averaging option to other fields.
    -
    - -

    -The above approach computes the mean of Z200, U200, V200 and T200 data -at the same time with the use of more memory. -The I/O consists of sequential read of all the files and the -writes of the monthly means. The above script only creates -the mean of Z200, U200, V200 and T200 but you could write a -very long command line and compute the mean of all the fields in -the file. Here are the guts of a -bash script, fast_grib2_mean.sh, which creates and runs the command line. - -

    -1.  wgrib2 $1 -match_inv | cut -f4- -d: | sed -e 's/:n=.*//' >$tmp
    -2.  cmd="cat $* | $wgrib2 - -set_grib_type c3 "
    -3.  while read line
    -4.  do
    -5.    cmd="$cmd -if_fs '$line' -ave $dt $out "
    -6.  done <$tmp
    -7.  eval $cmd
    -
    -1. $1 is the first file to average.
    -   Line 1 creates a file with the field names (minus date codes)
    -2. cmd is the command line that is being built
    -3. loop over all the lines in file $tmp
    -5. generate the "-if_fs/-ave" for the cmd line
    -   Older versions of the web paged used -if but that caused problems when
    -   $line included metacharacters such as parentheses.
    -6. bash syntax to have the while loop read from $tmp
    -7. run the command line
    -
    - -

    -Making the NARR monthly means using the above approach uses large -sequential reads which is optimal for the HPC file system. The run -time went from 3/4 of an hour to maybe a minute. - -

    Fast Forecast Averaging

    - -

    -The previous shell script was for a fast averaging of many analyses. -Sometimes one want to average several forecasts starting from -the same initial time. An example would producing a week-4 forecast. - -

    -1.  $wgrib2 $1 -match_inv | cut -f4-5 -d:  >$tmp
    -2.  cmd="cat $* | $wgrib2 - -set_grib_type c3 "
    -3.  while read line
    -4.  do
    -5.    cmd="$cmd -if_fs '$line' -fcst_ave $dt $out "
    -6.  done <$tmp
    -7.  eval $cmd
    -
    -1. $1 is the first file to average.
    -   Line 1 creates a file with the name and level for each field
    -   It is assumed that the name and level is unique in the file.
    -2. cmd is the command line that is being built
    -3. loop over all the lines in file $tmp
    -5. generate the "-if_fs/-fcst_ave" for the cmd line
    -   Older versions of the web paged used -if but that caused problems when
    -   $line included metacharacters such as parentheses.
    -6. bash syntax to have the while loop read from $tmp
    -7. run the command line
    -
    -

    -Using the -merge_fcst option in a like -manner to the -fcst_ave option. in a like - - - -

    Monthly Climatologies

    - -Once you can make an average, making a monthly climatology should be easy. Except -it isn't. Here are some of the problems that I encountered. - -
      -
    1. February has 28 days except when it doesn't. This causes problems because - wgrib2 -ave will not average 28 and 29 day intervals. -
    2. '116@6 hour ave(anl)' includes a regex metacharacter -
    3. the process id changed -
    4. the subcenter changed -
    - -The solutions were: - -
      -
    1. rewrite the grib file with
      - -if_fs '116@6 hour ave(anl)' -set_ftime2 '112@6 hour ave(anl)' -fi \
      - -if_fs '116@6 hour ave(6 hour fcst)' -set_ftime2 '112@6 hour ave(6 hour fcst)' -fi \
      - -if_fs '116@6 hour ave(3-6 hour acc fcst)' -set_ftime2 '112@6 hour ave(3-6 hour acc fcst)' -fi \
      -
    2. Use -if_fs instead of -if -
    3. rewrite the file with -set analysis_or_forecast_process_id 180 -
    4. rewrite the file with -set subcenter 0 -
    - -

    -Finding items 3 and 4 was a pain. Using undocumented option v98 helps. However, the mismatches can -now be uncoverted by using a verbose mode (>0) and wgrib v2.0.6. - - -

    Limitations by wgrib2 version

    -

    -There is a limit in the maximum number of -if_fs/-ave clauses. -Wgrib2 v2.0.6 can process up to 2000 -if and 2000 -if_fs options and -accept 10000 words on the command line. Since each -if_fs/-ave clause takes 5 -words on the command line and you need to include the name of the -input file, you get a limit of 999 -if_fs/-ave clauses. To speed up -the code, the evaluation of the -if_fs options is done in parallel. - - -

    Usage

    -

    - -

    --ave (time interval)  (output grib file)
    --fcst_ave (time interval)  (output grib file)
    -
    -   wgrib2 prior to v2.0.7 only works with PDT=4.0, 4.1 and 4.8
    -    support for PDT 4.2 and 4.12 by -ave added 7.2016
    -   wgrib2 v2.0.7 is limited by the -time_processing option
    -
    - -

    -See also: --merge_fcst, --time_processing -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Feb 12, 2018, July 26, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/fgrep.html b/web_docs/fgrep.html deleted file mode 100644 index cef5fcf..0000000 --- a/web_docs/fgrep.html +++ /dev/null @@ -1,260 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -grep (various) - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grep (various) -
     
    - -

    wgrib2: -egrep, -egrep_v, -fgrep, -fgrep_v

    -
    - - -

    Introduction

    - -

    -When you use wgrib2 extensively, common sequences keep occuring, such as, - -

    -   1:  wgrib2 A.grb >A.inv
    -   2:  cat A.inv | fgrep ":HGT:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib hgt500.grb
    -   3:  cat A.inv | fgrep ":TMP:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib tmp500.grb
    -   4:  cat A.inv | egrep ":(UGRD|VGRD):" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib wind500.grb
    -
    - -Using the various -grep, -inv and the -i_file option, the above example can -be written as - -
    -   1:  wgrib2 A.grb -inv A.inv
    -   2:  wgrib2 -fgrep ":HGT:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib hgt500.grb
    -   3:  wgrib2 -fgrep ":TMP:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib tmp500.grb
    -   4:  wgrib2 -egrep ":(UGRD|VGRD):" -fgrep ":500 mb:" -i_file A.inv A.grb -grib wind500.grb
    -
    - -The first version is easier to read. So why were the extra options added? - -
      -
    1. Some shells have problems with pipes. -
        -
      • Some versions of Windows dos-prompt have problems with pipes. -
      • RNomads: solved Windows 7 problem by using these options -
      -
    2. More efficient when you avoid multiple processes and pipes. -
        -
      • Every millisecond and K byte of RAM usage counts! -
      -
    3. Used by callable wgrib2. -
        -
      • A subroutine (wgrib2) can read a field using the index file! -
      -
    - -The options were added for the third reason, but one and two are some -nice side effects. The 4 examples can be coded in fortran as, - -
    -   include wgrib2api
    -   ...
    -   i = wgrib2a('A.grb','-inv','A.inv')
    -   i = wgrib2a('-fgrep',':HGT:','-fgrep',':500 mb:','-i_file,'A.inv','A.grb','-grib','hgt500.grb')
    -   i = wgrib2a('-fgrep',':TMP:','-fgrep',':500 mb:','-i_file','A.inv','A.grb','-grib','tmp500.grb')
    -   i = wgrib2a('-egrep',':(UGRD|VGRD):','-fgrep',':500','mb:','-i_file','A.inv','A.grb','-grib','wind500.grb')
    -
    - -

    The -grep options are used in wgrib2api's grb2_inq(..) function. - -

    -Definition of grep options:
    -
    -    (...) | wgrib2 -OP1 X (...)
    -      behaves like
    -    (...) | OP2 X | wgrib2 (...) 
    -
    -      if OP1 == egrep       then OP2 = egrep
    -      if OP1 == fgrep       then OP2 = fgrep
    -      if OP1 == egrep_v     then OP2 = egrep -v
    -      if OP1 == fgrep_v     then OP2 = fgrep -v
    -
    -    X is a posix extended regular expression (egrep, egrep_v)
    -    or a fixed string (fgrep, fgrep_v)
    -
    -   The number of -fgrep and -fgrep_v options is limited to 200.
    -   The number of -egrep and -egrep_v options is limited to 200.
    -   The wgrib2 option -set_regex does not affect the -grep options.
    -
    - - -

    Usage

    -

    - -

    --egrep X
    --egrep_v X
    --fgrep Y
    --fgrep_v Y
    -
    -X is a posix extended regular expression
    -Y is a fixed string (not a regular expression)
    -Note: -set_regex does not modify the type of regex for these options
    -
    - -

    -See also: --match, --not, --match_inv, --end, --if, --i_file, --not_if, --set_regex. -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page modified: Feb 3, 2017, 7/2019. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/fgrep_v.html b/web_docs/fgrep_v.html deleted file mode 100644 index cef5fcf..0000000 --- a/web_docs/fgrep_v.html +++ /dev/null @@ -1,260 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -grep (various) - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grep (various) -
     
    - -

    wgrib2: -egrep, -egrep_v, -fgrep, -fgrep_v

    -
    - - -

    Introduction

    - -

    -When you use wgrib2 extensively, common sequences keep occuring, such as, - -

    -   1:  wgrib2 A.grb >A.inv
    -   2:  cat A.inv | fgrep ":HGT:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib hgt500.grb
    -   3:  cat A.inv | fgrep ":TMP:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib tmp500.grb
    -   4:  cat A.inv | egrep ":(UGRD|VGRD):" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib wind500.grb
    -
    - -Using the various -grep, -inv and the -i_file option, the above example can -be written as - -
    -   1:  wgrib2 A.grb -inv A.inv
    -   2:  wgrib2 -fgrep ":HGT:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib hgt500.grb
    -   3:  wgrib2 -fgrep ":TMP:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib tmp500.grb
    -   4:  wgrib2 -egrep ":(UGRD|VGRD):" -fgrep ":500 mb:" -i_file A.inv A.grb -grib wind500.grb
    -
    - -The first version is easier to read. So why were the extra options added? - -
      -
    1. Some shells have problems with pipes. -
        -
      • Some versions of Windows dos-prompt have problems with pipes. -
      • RNomads: solved Windows 7 problem by using these options -
      -
    2. More efficient when you avoid multiple processes and pipes. -
        -
      • Every millisecond and K byte of RAM usage counts! -
      -
    3. Used by callable wgrib2. -
        -
      • A subroutine (wgrib2) can read a field using the index file! -
      -
    - -The options were added for the third reason, but one and two are some -nice side effects. The 4 examples can be coded in fortran as, - -
    -   include wgrib2api
    -   ...
    -   i = wgrib2a('A.grb','-inv','A.inv')
    -   i = wgrib2a('-fgrep',':HGT:','-fgrep',':500 mb:','-i_file,'A.inv','A.grb','-grib','hgt500.grb')
    -   i = wgrib2a('-fgrep',':TMP:','-fgrep',':500 mb:','-i_file','A.inv','A.grb','-grib','tmp500.grb')
    -   i = wgrib2a('-egrep',':(UGRD|VGRD):','-fgrep',':500','mb:','-i_file','A.inv','A.grb','-grib','wind500.grb')
    -
    - -

    The -grep options are used in wgrib2api's grb2_inq(..) function. - -

    -Definition of grep options:
    -
    -    (...) | wgrib2 -OP1 X (...)
    -      behaves like
    -    (...) | OP2 X | wgrib2 (...) 
    -
    -      if OP1 == egrep       then OP2 = egrep
    -      if OP1 == fgrep       then OP2 = fgrep
    -      if OP1 == egrep_v     then OP2 = egrep -v
    -      if OP1 == fgrep_v     then OP2 = fgrep -v
    -
    -    X is a posix extended regular expression (egrep, egrep_v)
    -    or a fixed string (fgrep, fgrep_v)
    -
    -   The number of -fgrep and -fgrep_v options is limited to 200.
    -   The number of -egrep and -egrep_v options is limited to 200.
    -   The wgrib2 option -set_regex does not affect the -grep options.
    -
    - - -

    Usage

    -

    - -

    --egrep X
    --egrep_v X
    --fgrep Y
    --fgrep_v Y
    -
    -X is a posix extended regular expression
    -Y is a fixed string (not a regular expression)
    -Note: -set_regex does not modify the type of regex for these options
    -
    - -

    -See also: --match, --not, --match_inv, --end, --if, --i_file, --not_if, --set_regex. -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page modified: Feb 3, 2017, 7/2019. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/fi.html b/web_docs/fi.html deleted file mode 100644 index ee11016..0000000 --- a/web_docs/fi.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -fi - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-fi -
     
    - -

    wgrib2: -fi

    -
    - - -

    Introduction

    - -

    -The -fi option is used by the version 1 IF block. -It is recommened that version 2 of the IF block be used and --fi no longer be used. - - -

    -Version 1 IF structure:  
    -
    -  -if TEST (non-output options) (output option)
    -
    -   If the test is false, all the options up to and including
    -   the next output option are not executed.  The -fi
    -   option is a null output option.
    -
    -   If the test is true, the following options are executed
    -
    -
    -Version 2 IF block:  (wgrib2 v3.0.0+)
    -
    -  -if TEST (options) -endif
    -  -if TEST (options) -else (options) -endif
    -  -if TEST (options) -elseif TEST (options) -endif
    -  -if TEST (options) -elseif TEST (options) -elseif TEST (options) -endif
    -  -if TEST (options) -elseif TEST (options) -else (options) -endif
    -
    -  The "-else (options)" is optional.
    -  The "-elseif TEST (options)" is optional, and can be repeated may times.
    -
    -
    -  The new structure can include nested IF blocks.
    -
    - -The -endif option is tne new way to close -an IF block (wgrib2 v3.0.0+). Wgrib2 v3.0.0 handles both -the old and new IF blocks. While there is no plans to -remove the old IF blocks, it is recommended that the new IF -blocks be used because the scripts will be easier to read by future -users. Note that the old and new IF blocks cannot be mixed. - - -

    -See also: --if, --endif, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, March 13, 2019, March 18, 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/fix_CFSv2_fcst.html b/web_docs/fix_CFSv2_fcst.html deleted file mode 100644 index a71a36b..0000000 --- a/web_docs/fix_CFSv2_fcst.html +++ /dev/null @@ -1,469 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -fix_CFSv2_fcst - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-fix_CFSv2_fcst -
     
    - -

    wgrib2: -fix_CFSv2_fcst

    -
    - - -

    Introduction

    - -

    -The Climate Forecast System version 2 (CFSv2) is a coupled atmosphere/ocean -forecast system that was developed at NCEP. CFSv2 produces analyses (CFSR) -and daily to seasonal forecats. The seasonal forecasts consists of hindcasts -(CFSRR) and the real-time forecasts (CFSv2 forecasts). - -

    The monthly-mean forecasts from the CFSRR and CFSv2 are originally -written in grib1 format and later converted to grib2 format for public -distribution. In this process, the resulting grib2 files are mangled -and the metadata no longer correctly describes the contents of the file. -The -fix_CFSv2_fcst option alters the metadata of the -CFSRR/CFSv2 monthly forecasts files to make them grib2 compliant and to -fix the metadata. After the data has been fixed, the files can -then be read with grib2 decoders such as GrADS. - - -

    CFSRR/CFSv2 Monthly Forecast File Names

    - -The CFSv2 monthly forecasts have a naming convengtiion. - -
    -(NAME)(DATE0).(EN).(DATE1).avrg[.(HH)Z].grb2
    -
    -NAME=type of file
    -     flxf       forecast (f) data on special levels (flx)
    -     ipvf       forecast (f) data on isentropic surfaces (ipv)
    -     ocnf       forecast (f) data for the oceans (ocn)
    -     pgbf       forecast (f) data for pressure (p) levels grib (gb)
    -
    -DATE0=starting time of the forecasts
    -      YYYYMMDDHH
    -
    -EN=ensemble member number
    -
    -DATE1=target month of the forecast
    -      YYYYMM
    -
    -[..] = contents in the square brackets are optional
    -
    -Case 1: contents of [] are missing or null
    -        The forecast system produces daily forecasts ending at 00Z, 06Z, 12Z and 18Z.
    -        All these forecasts are included in the forecast of the monthly mean.
    -
    -Case 2: contents of [] are present, i.e., .(HH)Z
    -       HH = 00, 06, 12, 18
    -       The monthly forecast is for a specific cycle of the day.
    -       For example the 00Z cycle.  For instantaneous quantities,
    -       the monthly forecast will be consist of the mean of all daily forecasts 
    -       that verify on the 00Z hour.  For quantities that are 6 hour
    -       averages or accumulations, they will be the average of all the
    -       forecasts with averages/accumulations that end at 00Z hour
    -       (18Z-24Z average/accumulations).
    -
    -       Unfortunately the original file doesn't contain any metadata
    -       concerning the hour or the type of quantity, so the hour
    -       has to be entered as an argument and the forecasts are
    -       assumed to be the average of instantaneous fields.
    -
    - - -

    Fixing the CFSRR/CFSv2 monthly forecasts format

    - -A filter was added to wgrib2 that fixes the metadata in -the CFSv2 monthly forecasts. To fix the metadata, - -
    -wgrib2 IN -fix_CFSv2_fcst TIME EN N_ENS -grib OUT
    -
    -IN=name of input grib file, ex. flxf2009010100.01.200901.avrg.06Z.grb2
    -
    -TIME=daily, 00, 06, 12, 18
    -    use daily if .(HH)Z is missing from the input filename
    -    use 00 if .00Z is part of the input filename
    -    use 06 if .06Z is part of the input filename
    -    use 12 if .12Z is part of the input filename
    -    use 18 if .18Z is part of the input filename
    -
    -EN=ensemble member number, suggested that EN from the filename is used but value is arbitrary.
    -
    -N_ENS=number of ensemble members, use max of (EN).  Value is arbitrary.
    -
    -OUT=name of the output grib file
    -
    - -

    Example of Fixing the CFSRR monthly forecast

    - -
    -bash-3.2$ wgrib2 flxf2009010100.01.200903.avrg.06Z.grb2 -for 1:3 -fix_CFSv2_fcst 06 1 1  -grib out.grb
    -1:0:d=2009010100:UFLX:surface:1422 hour-(1422 hour+30 day) ave@(fcst,dt=1 day),missing=0:ENS=+1
    -2:66720:d=2009010100:VFLX:surface:1422 hour-(1422 hour+30 day) ave@(fcst,dt=1 day),missing=0:ENS=+1
    -3:133122:d=2009010100:SHTFL:surface:1422 hour-(1422 hour+30 day) ave@(fcst,dt=1 day),missing=0:ENS=+1
    -
    -flxf2009010100.01.200903.avrg.06Z.grb2   input file
    --for 1:3                                 process records 1..3
    --fix_CFSv2_fcst 06 1 1                   fix metadata for 06Z type file, 
    --grib out.grb                            save corrected file in out.grb
    -
    - -

    Examining our corrected file

    - -The default wgrib2 inventory looks like - -
    -bash-3.2$ wgrib2 out.grb 
    -1:0:d=2009010100:UFLX:surface:1422 hour-(1422 hour+30 day) ave@(23 hour fcst)++,missing=0:ENS=+1
    -2:66719:d=2009010100:VFLX:surface:1422 hour-(1422 hour+30 day) ave@(23 hour fcst)++,missing=0:ENS=+1
    -3:133120:d=2009010100:SHTFL:surface:1422 hour-(1422 hour+30 day) ave@(23 hour fcst)++,missing=0:ENS=+1
    -
    -d=2009010100                             initial time of the forecast
    -UFLX                                     zonal wind stress
    -1422 hour-(1422 hour+30 day) ave         average for 1422 hour to (1422 hours + 30 day)
    -(fcst,dt=1 day)                          average the forecast at 1 day intervales
    -missing=0                                no missing fields in the average
    -
    - -Now I can't figure out 1422 hours in my head, so I can print out the start and and of the -forecast time interval by, - -
    -bash-3.2$ wgrib2 out.grb -start_ft -end_ft
    -1:0:start_ft=2009030106:end_ft=2009033106
    -2:66719:start_ft=2009030106:end_ft=2009033106
    -3:133120:start_ft=2009030106:end_ft=2009033106
    -
    - -Notice the start_ft has a 06 hour as you would have expected from the original file, -flxf2009010100.01.200903.avrg.06Z.grb2. - -

    Adding Ocean Metadata

    - -

    In the NCDC archives, the DBSS variable has bad level information. -For example, the time series of N degree isotherm is not encoded correctly - -

    -bash-3.2$ wgrib2 dt5c.ensm.apr.cfsv2.data.grb2
    -1:0:d=1982040618:DBSS:0C ocean isotherm:0-1 month ave fcst:
    -2:42547:d=1982040618:DBSS:0C ocean isotherm:1-2 month ave fcst:
    -3:85611:d=1982040618:DBSS:0C ocean isotherm:2-3 month ave fcst:
    -4:128757:d=1982040618:DBSS:0C ocean isotherm:3-4 month ave fcst:
    -...
    -
    -The level should be 5C ocean isotherm as indicated by the file name.
    -
    -
    -To fix this time series, you need to rewrite the level information.
    -
    -
    -bash-3.2$ wgrib2 dt5c.ensm.apr.cfsv2.data.grb2 -set_lev "5C ocean isotherm" -grib dt5c.ensm.apr.cfsv2.data.grb2.new
    -1:0:d=1982040618:DBSS:5C ocean isotherm:0-1 month ave fcst:
    -2:42547:d=1982040618:DBSS:5C ocean isotherm:1-2 month ave fcst:
    -3:85611:d=1982040618:DBSS:5C ocean isotherm:2-3 month ave fcst:
    -4:128757:d=1982040618:DBSS:5C ocean isotherm:3-4 month ave fcst:
    -...
    -
    - -In monthly ocean forecasts @ NCDC, we can find bad level data. For example, -one file had bad level metadata for messages 216-222. -
    -216:11232042:d=1999052200:DBSS:0C ocean isotherm:2-3 month ave fcst:
    -217:11278152:d=1999052200:DBSS:0C ocean isotherm:2-3 month ave fcst:
    -218:11322088:d=1999052200:DBSS:0C ocean isotherm:2-3 month ave fcst:
    -219:11360222:d=1999052200:DBSS:0C ocean isotherm:2-3 month ave fcst:
    -220:11392818:d=1999052200:DBSS:0C ocean isotherm:2-3 month ave fcst:
    -221:11419935:d=1999052200:DBSS:0C ocean isotherm:2-3 month ave fcst:
    -222:11440970:d=1999052200:DBSS:0C ocean isotherm:2-3 month ave fcst: 
    -
    - -The following code snippet will fix the level data for the above file. -
    -wgrib2 $f \
    - -if "^216:" -set_lev "2.5C ocean isotherm"  -fi \
    - -if "^217:" -set_lev "5C ocean isotherm"  -fi \
    - -if "^218:" -set_lev "10C ocean isotherm"  -fi \
    - -if "^219:" -set_lev "15C ocean isotherm"  -fi \
    - -if "^220:" -set_lev "20C ocean isotherm"  -fi \
    - -if "^221:" -set_lev "25C ocean isotherm"  -fi \
    - -if "^222:" -set_lev "28C ocean isotherm"  -fi  \
    - -grib $f.fixed
    -
    - - - -

    Making GrADS control files

    - -Once you have converted the files using the -fix_CFSv2_fcst option, -you have to use the -b option in g2ctl/gribmap to get the target times to line up correctly. -The -b option sets the start of the target month as the GrADS time. If you use the default option, -you will get the end of the forecast period. For the ordinary forecast files, that will be -at 18Z of the last month. Definately not as friendly. - -
    -bash-3.2$ g2ctl -b out.grb >out.ctl
    -bash-3.2$ gribmap -b -i out.ctl
    -grib2map: scanning GRIB2 file: out.grb
    -grib2map: Writing out the index file 
    -
    - - -

    A Real Example

    - -

    -The previous examples were the conversion, inventory and display of a single file. -Most of the time, people would want to examine the entire forecast run. In this -followring example, we look at a forecast run. Here we cannot include -the file with the target month which is the same as the starting month -because this file does not start on the 1st of the month like the other files. - -

    -CFSRR files:
    -
    -    (do not include this file) -->   pgbf2009081500.01.200908.avrg.grb2
    -    pgbf2009081500.01.200909.avrg.grb2
    -    pgbf2009081500.01.200910.avrg.grb2
    -    pgbf2009081500.01.200911.avrg.grb2
    -
    - -Fixing the metadata in the bash shell on a linux box. - -
    -bash-3.2$ for f in pgbf2009081500.01.2009??.avrg.grb2
    ->do
    -> wgrib2 $f -fix_CFSv2_fcst_daily 1 1 -grib $f.new >/dev/null
    ->done
    -fix_CFSRv2_fcst 524 fields fixed
    -fix_CFSRv2_fcst 524 fields fixed
    -fix_CFSRv2_fcst 524 fields fixed
    -
    - -Making the GrADS ctl and idx files. Note the -b options to both g2ctl and gribmap. -Note that gribmap v2 and grads v2 have to be used. Note the use of the template (%m2) in -the g2ctl line. - - -
    -bash-3.2$ g2ctl -b pgbf2009081500.01.2009%m2.avrg.grb2.new >pgb.ctl
    -bash-3.2$ gribmap -b -i pgb.ctl
    -grib2map: scanning GRIB2 file: pgbf2009081500.01.200909.avrg.grb2.new 
    -grib2map: scanning GRIB2 file: pgbf2009081500.01.200910.avrg.grb2.new 
    -grib2map: scanning GRIB2 file: pgbf2009081500.01.200911.avrg.grb2.new 
    -grib2map: reached end of files
    -grib2map: Writing out the index file 
    -
    - -Running grads v2 with the new ctl/idx file. - -
    -bash-3.2$ grads
    -
    -Grid Analysis and Display System (GrADS) Version 2.0.a9
    -Copyright (c) 1988-2010 by Brian Doty and the
    -Institute for Global Environment and Society (IGES)
    -GrADS comes with ABSOLUTELY NO WARRANTY
    -See file COPYRIGHT for more information
    -
    -Config: v2.0.a9 little-endian readline printim grib2 netcdf hdf4-sds hdf5 opendap-grids,stn geotiff shapefile
    -Issue 'q config' command for more detailed configuration information
    -Landscape mode? ('n' for portrait):
    -GX Package Initialization: Size = 11 8.5 
    -ga-> open pgb.ctl
    -Scanning description file:  pgb.ctl
    -Data file pgbf2009081500.01.2009%m2.avrg.grb2.new is open as file 1
    -LON set to 0 360 
    -LAT set to -90 90 
    -LEV set to 1000 1000 
    -Time values set: 2009:8:15:0 2009:8:15:0 
    -E set to 1 1 
    -ga-> set lev 500
    -LEV set to 500 500 
    -ga-> d hgtprs
    -Contouring: 4900 to 5900 interval 100 
    -ga-> 
    -
    - -

    Encoding the Ensemble Information

    -

    -The -fix_CFSv2_fcst option adds enesemble information. The directions -suggest that you number the runs using the same numbers as suggested by the CFSv2 filename convention. -That will minimize confusion. However, you are allowed to give any ensemble number -up to 254. Usiog unique ensemble member numbers would be useful GrADS. -

    - -

    Caveats

    -

    -The filtering action of -fix_CFSv2_fcst assumes that the fields -that were averaged were instantaneous fields (ex. Z500 at a specific time). This -is not true as some fields are 6-hour accumulations or averages. Grib2 can describe -averages of accumulations/averages. However, this nuance was ignored. - -

    -The instructions suggest that you encode the CFSRR enemble member number as 1 to be consistent -with the CFSv2 file name convention. For CFSRR, there is only one ensemble member (01) which -by would be considered the high-resolution control run. - -

    Usage

    -

    - -

    --fix_CFSv2_fcst X Y Z
    -X=daily, 00, 06, 12, 18
    -Y=Ensemble member number (perturbation number)
    -Z=number of ensemble members
    -
    - - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Nov 2, 2011 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/fix_ncep.html b/web_docs/fix_ncep.html deleted file mode 100644 index e681b7e..0000000 --- a/web_docs/fix_ncep.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -fix_ncep - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-fix_ncep -
     
    - -

    wgrib2: -fix_ncep

    -
    - - -

    Introduction

    - -

    --fix_ncep is a "set" option that replaces -certain NCEP-defined time ranges by the WMO equivalents. The current (7/2008) -wgrib2 needs this option in order to correctly print out the -time ranges for NCEP-defined time ranges. - -

    The -fix_ncep option changes -the memory image of the grib message. Therefore, if you -want the NCEP time range, you must have the --grib or -grib_out option -before the -fix_ncep option. Otherwise -you will get the WMO time range. - -

    -Caution: expect this option to change as more NCEP time ranges -are added - -

    Usage

    -

    - -

    --fix_ncep
    -
    - -

    Example

    -

    - -

    -wgrib2 -fix_ncep in_grib -grib out_grib
    -
    -The above line replaces NCEP time ranges by the WMO equivalents -and writes out the new grib data into out_grib. - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/flush.html b/web_docs/flush.html deleted file mode 100644 index fae3c44..0000000 --- a/web_docs/flush.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -flush -no_flush - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-flush -
     
    - -

    wgrib2: -flush

    -
    - - -

    Introduction

    - -

    -When the flush mode is off, output is buffered. Than means the output -is saved to a memory buffer and is only flushed (written out) when -the buffer is full or the program ends. This mode speeds up the output. -However, this mode fails when writting to a pipe or file and another program -is reading from that pipe or file while wgrib2 is executing. - -

    -The -flush option causes wgrib2 to flush the -output buffers after every write. This option is now rarely used -because wgrib2 internally sets the flush option on when detects a -write to a pipe. The only current need for the --flush option is when another program -is reading the disk file while wgrib2 is writting that file. - In this case, you would use this option to ensure that the -disk file is written as soon as possible. - - -

    -In systems that do not have a POSIX-compatible stat() function, the flush -mode is turned on. - -

    Usage

    -

    - -

    --flush
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Oct 6, 2017, Aug 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/for.html b/web_docs/for.html deleted file mode 100644 index 7d72e09..0000000 --- a/web_docs/for.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -for - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-for -
     
    - -

    wgrib2: -for

    -
    - - -

    Introduction

    - -

    -The -for option selects the range of record numbers -upon which to operate using the "for" syntax. If you want to operate on -records 10 to 20, you would use the parameter 10:20. -If you want to operate on all the even records from 10 to 20, you would -use 10:20:2. The restrictions are the start value must be less than -the ending value and the step has to be greater than zero. -

    -

    -The -for option ignores the submessage number when -selecting the fields. -

    - - -

    Usage

    -

    - -

    --for I:J:K        same as for n = I to J by K
    --for I:J          same as for n = I to J by 1
    --for I::K         same as for n = I to MAX_INTEGER by K
    --for I            same as for n = I to MAX_INTEGER by 1
    -
    - - - -

    Example

    -

    - -

    - $ wgrib2 file.grb2  -for 4:5
    -4:13335:d=2008120200:RH:750 mb:anl:
    -5:17098:d=2008120200:TMP:2743 m above mean sea level:anl:
    -
    - -See also: --if_rec --match --for_n -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/for_n.html b/web_docs/for_n.html deleted file mode 100644 index af8d968..0000000 --- a/web_docs/for_n.html +++ /dev/null @@ -1,337 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -for_n - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-for_n, wgrib2-n -
     
    - - -

    wgrib2: -for_n

    -
    -

    -A grib file has set of grids and you can reference the field by its grib message number and submessage number. -You can also reference the field by its inventory number which starts at 1. -The -for_n option allows you to process a subset of the -grib file using a for-loop syntax on the inventory number. Suppose you want to process -grids 10 through 20 by 2, you can add the option -for_n 10:20:2. - -

    Usage

    -

    - -

    --for_n I:J:K        same as for n = I to J by K
    --for_n I:J          same as for n = I to J by 1
    --for_n I::K         same as for n = I to MAX_INTEGER by K
    --for_n I            same as for n = I to MAX_INTEGER by 1
    -
    - - - - - -

    wgrib2: multi-processing with -for_n and -n

    -
    - - -

    Introduction

    - -

    There are two ways to parallize wgrib2, one way is -the thread the loops and another is to run multiple copies -of wgrib2. Threading the loops is great but there is -so much serial code that the speed up is limited. The -biggest speed up can come from running multiple copies -of wgrib2. a Rather than pull out the MPI textbook, -we'll show some script-level multiprocessing. - -

    Assumptions

    - -
      -
    • CPU time is longer than the I/O time -
    • each record can be handled independantly -
    • multiple cpus are available on the same machine/node -
    • a two cpu version is sufficient documentation -
    - -

    The inventory number, -n

    - -

    Our first step is to understand the inventory number. -You can see the inventory number by the -n option. -Once we have add the inventory number, we can have one copy of wgrib2 -process the even numbered and another process the odd numbered records. - -

    Note that the inventory number is not the same as the -record number for many reason such as the order of processing -may be read from standard input by -i, -some messages may have submessages and some records could -be skipped by the -match and other options. - -

    Even and Odd, -for_n

    -

    -The -for_n option is like the --for option except that it uses the inventory -number rather than the record number. - -

    -To select the odd records to process, you use the -option -for_n 1:99999:2. Here, 99999 is just -a large number greater than the number of records. -You could also use -for_n 1::2. -To process the even fields, use -for_n 2::2. - - -

    Pipes, fifo (Unix/Linux)

    -

    -Now that we can run wgrib2 on the even and odd records, how -do we make the output. Here is a simple way in Unix/Linux. -

    - - -
    -# bad example: slow, output in different order
    -# input=grib file, output=grib file, makes regional subset using two copies of wgrib2
    -f=input
    -wgrib2 $f -ijsmall_grib 1:10 1:10 /tmp/p1 -for_n 1:99999:2 >/dev/null
    -wgrib2 $f -ijsmall_grib 1:10 1:10 /tmp/p2 -for_n 2:99999:2 >/dev/null
    -cat /tmp/p1 /tmp/p2 >output
    -rm /tmp/p1 /tmp/p2
    -
    - -

    -The above method is not optimal as it uses temporary files, -rearranges the order of the records and is limited to 99999 records. A better method is to use -pipes and a simple program that reads the pipes and writes out -a merged output file. -

    - -
    -# input=grib file, output=grib file, makes regional subset using two copies of wgrib2
    -# uses named pipes for speedup, keeps order of records
    -f=input
    -mkfifo /tmp/p1.$$
    -mkfifo /tmp/p2.$$
    -wgrib2 $f -ijsmall_grib 1:10 1:10 /tmp/p1.$$ -for_n 1::2 >/dev/null &
    -wgrib2 $f -ijsmall_grib 1:10 1:10 /tmp/p2.$$ -for_n 2::2 >/dev/null &
    -gmerge output /tmp/p1.$$ /tmp/p2.$$
    -rm /tmp/p1.$$ /tmp/p2.$$
    -
    - -

    -The program, gmerge, simply reads a grib message from p1.$$ and -writes the output to "output". -Then it reads a grib message from p2.$$ and writes -it to "output". This is repeated until there is no data left (pipes are closed). -gmerge is part of the wgrib2 distribtution. -

    - -

    -The program amerge is like gmerge except it reads one line from p1 -and writes it to the output. Then it reads one line from p2 and -writes it to output. This is repeated until there is no data left -(pipes are closed). The amerge program can be used to run -inventories on mutiple cpus. -

    - -
    -# input=grib file, run 2 copies of wgrib2 and writes inventory on stdout
    -f=input
    -mkfifo /tmp/p1.$$
    -mkfifo /tmp/p2.$$
    -wgrib2 -for_n 1::2 $file -s -lon 0 0 >/tmp/p1.$$ &
    -wgrib2 -for_n 2::2 $file -s -lon 0 0 >/tmp/p2.$$ &
    -amerge /tmp/p1.$$ /tmp/p2.$$
    -rm /tmp/p1.$$ /tmp/p2.$$
    -
    - -

    More than 2 CPUs

    -

    -The previous examples split the work into two processes. This -works well for a dual core system. On systems with 4 cores, -you may want to split the work into 4 jobs. The current versions -of gmerge and amerge allow input for upto 32 different inputs. -

    - -
    -# same as 2nd example but with 3 cpus
    -f=input
    -mkfifo /tmp/p1.$$ /tmp/p2.$$ /tmp/p3.$$
    -wgrib2 $f -ijsmall_grib 1:10 1:10 /tmp/p1.$$ -for_n 1::3 >/dev/null &
    -wgrib2 $f -ijsmall_grib 1:10 1:10 /tmp/p2.$$ -for_n 2::3 >/dev/null &
    -wgrib2 $f -ijsmall_grib 1:10 1:10 /tmp/p3.$$ -for_n 3::3 >/dev/null &
    -gmerge output /tmp/p1.$$ /tmp/p2.$$ /tmp/p3.$$
    -rm /tmp/p1.$$ /tmp/p2.$$ /tmp/p3.$$
    -
    - - -

    Source code for gmerge and amerge

    - -gmerge: merge grib files (1 grib message at a time)
    -amerge: merge ascii files (1 line at a time)
    - - -

    Usage

    -
    --n                  prints the inventory number
    --for_n I:J:K        same as for n = I to J by K
    --for_n I:J          same as for n = I to J by 1
    --for_n I::K         same as for n = I to MAX_INTEGER by K
    --for_n I            same as for n = I to MAX_INTEGER by 1
    -
    - - - -See also: --if_n, --for, --flush, --n, -using pipes, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 31, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ftime.html b/web_docs/ftime.html deleted file mode 100644 index e5930ef..0000000 --- a/web_docs/ftime.html +++ /dev/null @@ -1,275 +0,0 @@ - - - Climate Prediction Center - wgrib2: -ftime - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ftime -
     
    - -

    wgrib2: -ftime

    -
    - - -

    Introduction

    - -

    -The -ftime option prints the forecast time stamp -such as the forecast hour, accumulation period, etc. This option is used -by many other inventory options. -The -set_ftime option does the inverse of the --ftime option. -The -set_ftime option takes the forecast time stamp -in text format, and alters the grib metadata. - -

    Types of time stamps

    -The simplest forecast time stamps are for an analysis and a forecast at a point in time. -Note that wgrib2 considers a "0 hour forecast" to be an "analysis". In theory, code table -4.3 could be used to determine whether the field is a "0 hour forecast" or "analysis". -In practice, models like the GFS will use an analysis for the initial conditions, and -the "0 hour forecast" will be the same as the analysis. So code table 4.3 is ignored. - - -
      Single analysis or single forecast -
    • anl analysis -
    • 12 hr fcst 12 hour forecast -
    - - -The next simplest time stamp involves an statistical operator and single time period -from a forecast. Processing is done continously or at a high frequency. - -
      Single forecast, examples of common statiistical operators (Code Table 4.10) -
    • 174-180 hour acc fcst: accumulated forecast between 174-180 hours -
    • 174-180 hour ave fcst: average forecast between 174-180 hours -
    • 174-180 hour max fcst: maximum forecast between 174-180 hours -
    • 174-180 hour min fcst: minmum forecast between 174-180 hours -
    • 174-180 hour OPR fcst: operator of forecast between 174-180 hours, OPR from Code Table 4.10 -
    - -Grib allows for processed sets of data. For example, you have -have analyses from May 1, .., May 31. You can create a grib message which is -the May mean. You can then combine the May means from 1991..2020, and -produce a 1991-2020 climatology. Another example is the take the forecasts -from a single forecast run. You can take days 7..14, and create the 2nd week forecast. -

    - -

      Multiple analyses(forecasts), constant time between analyses (forecast start times) -
    • 240@3 hour ave(anl),missing=0 average of 240 analyses with 3 hour interval between analyses, no missing analyses -
    • 248@3 hour ave(6 hour fcst),missing=0 average of 240 6-hour fcsts with 3 hour interval of forecast start times -
    • 248@3 hour ave(0-3 hour ave fcst),missing=0, average of 240 "0-3 hour ave forecasts", with 3 hour interval - between forecast start times -
    - - -The next type of forecast time stamp is used for processing forecast from a single forecast run. -The "(xxx)++" notation means that xxx is incremented to the next forecast time. - - -
      Multiple forecasts from a single forecast run -
    • 9@1 hour max(0-1 hour max fcst)++,missing=0: max(0-1 hour max fcst, 1-2 hour max fcst, .., 8-9 hour max fcst)
      - Note: this can be encoded as "0-9 hour max fcst" -
    - -LAF (Lagged Average Forecasts) which are forecasts with different forecast start times and -the same verification time. This is the easiest to produce ensemble forecast. - - -
      Lagged Average Forecasts, old to new forecasts -
    • LAF[..]++ reference time++, fcst_time-- (verification time does not change) -
    - - -
      Lagged Average Forecasts, new to old forecasts -
    • LAF[..]-- reference time--, fcst_time++ (verification time does not change) -
    - -Grib allows fields that are produced by multiple statistical operators. -This is how you can generate climatologies. - -
      Climatology -
    • 30@1 year ave(124@6 hour ave(anl)),missing=0: reference time is 1981050100
      - "124@6 hour ave(anl)" is the average of (00Z May 1, 06Z May2, .., 18Z May 31), month average
      - "30@1 year ave(X)" is the 30 year average of the X
      - So a 1981-2010 May climatology has been precisely defined -
    • 30@1 year ave(31@24 hour ave(anl)),missing=0: reference time is 1981050100
      - This is the 1981-2020 climatology of the May 00Z analyses -
    - - -

    It was noted that the old ftime had problems with the more complicated time stamps and -ftime2 was developed as the replacement. Currently (5/2021), you can use the -old ftime by -ftime1 and the new ftime by -ftime2 . -The default -ftime will use -ftime2. -The -config option will tell which version is the default. - -

    Usage

    -

    - -

    --ftime
    -
    -Note: -ftime is called by many other options like -s and -S.
    -
    - -

    Example

    -

    - -

    -$ wgrib2 grib2.polar -ftime
    -1.1:0:24 hour fcst
    -1.2:0:24 hour fcst
    -
    - - -See also: --set_ftime --vt - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, updated 4/2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ftime1.html b/web_docs/ftime1.html deleted file mode 100644 index 72c3f47..0000000 --- a/web_docs/ftime1.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ftime1 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ftime2 -
     
    - -

    wgrib2: -ftime1

    -
    - - -

    Introduction

    - -

    -The -ftime1 option calls the old ftime1 routine. -The ftime1 routines have been replace by the ftime2 routine because they -could not handle more complicated time stamps correctly. One should -not use -ftime1. The ftime2 routines will work with -more complicated time stamps and are more powerful. - -

    Usage

    -

    - -

    --ftime1
    -
    - -

    Example

    -

    - -

    -$ wgrib2 grib2.polar -ftime1
    -1.1:0:24 hour fcst
    -1.2:0:24 hour fcst
    -
    - - -See also: --ftime - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 12, 2017, modified 6/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ftime2.html b/web_docs/ftime2.html deleted file mode 100644 index 7f0010b..0000000 --- a/web_docs/ftime2.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ftime2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ftime2 -
     
    - -

    wgrib2: -ftime2

    -
    - - -

    Introduction

    - -

    -The -ftime option calls either - -ftime1 or -ftime2 options. -The -ftime2 option is newer and will become the -default in newer versions of wgrib2. The -ftime2 option -fixes some problems in describing climatologies of monthly means (averages of averages) -or any nested statistical processing operators. The --ftime2 option is fully recursize while the older --ftime1 attempted and failed to bypass the recursion. -

    Along with the change to -ftime2, the -The -set_ftime, -set_ave options are being replaced -by -set_ftime2. - - -

    Usage

    -

    - -

    --ftime2
    -
    - -

    Example

    -

    - -

    -$ wgrib2 grib2.polar -ftime2
    -1.1:0:24 hour fcst
    -1.2:0:24 hour fcst
    -
    - - -See also: --set_ftime --vt - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 12, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ftn_api_fn0.html b/web_docs/ftn_api_fn0.html deleted file mode 100644 index bc656d9..0000000 --- a/web_docs/ftn_api_fn0.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ftn_api_fn0 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -ftn_api_fn0 -
     
    - -

    wgrib2: -ftn_api_fn0

    -
    - - -

    Introduction:

    - -

    -The option, -ftn_api_fn0, is used by the ftn_api for -reading grib. Since the ftn_api and wgrib2 are part of the same package, there -is no need for compatibility between versions of wgrib2. Use of this -option is not recommended. The current output is by this C statement. - -

    -sprintf(inv_out, "%8d %8u %8u %8u %8d %8d",inv_no,npnts,nx_,ny_,msg_no, submsg)
    -
    - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 29, 2016. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/full_name.html b/web_docs/full_name.html deleted file mode 100644 index ec72a35..0000000 --- a/web_docs/full_name.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -full_name - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-var -
     
    - -

    wgrib2: full_name is idepreciated for wgrib2 3.0.2+

    -
    - - -

    Introduction

    - -

    With the expansion of "Extended Names", the full name is now -a subset of the new Extended Names. - - -

    -
    -old:    -full_name
    -new:    -set_ext_name 3 -ext_name
    -
    -
    - - -See also: -ext_name, - -set_ext_name -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Feb , 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/function.html b/web_docs/function.html deleted file mode 100644 index f81ccb3..0000000 --- a/web_docs/function.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - Climate Prediction Center - wgrib2: functions - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > -wgrib2 -
     
    - -

    wgrib2: a sample function

    - - - -

    Introduction

    - -Wgrib2 is "function" driven. Options on the command line corresponds to a function call. -When wgrib2 is started, each option-function is initialized by calling it with mode=-1. -For each grib record processed, the option-function is called with mode=verbosity index (verbosity ≥ 0). -After all grib records have been processed, the option-functions are told to clean up by calling -them with mode=-2. -Here is a sample function. - -
    -
    -
    -
    -#include <stdio.h>
    -#include "grb2.h"
    -#include "wgrib2.h"
    -#include "fnlist.h"
    -
    -extern int decode;
    -extern int need_output_file;
    -
    -/*
    - * HEADER:100:min:inv:0:print minimum value
    - * the above line is needed by each command line option
    - * HEADER:sort-order:type-of-function:number-of-arguments:description
    - */
    -
    -int f_min(int mode, unsigned char **sec, float *data, int ndata, char *inv_out, void **local) {
    -   - double mn;
    -   - int ok, i;
    -
    -   - if (mode == -1) decode = 1; // decode=1 so wgrib2 will unpack grib data
    -   - else {
    -     - mn = ok = 0;
    -     - for (i = 0; i < ndata; i++) {
    -       - if (!UNDEFINED_VAL(data[i])) {
    -         - if (ok) mn = mn < data[i] ? mn : data[i];
    -         - else { ok = 1; mn = data[i]; }
    -       - }
    -     - }
    -     - if (ok) sprintf(inv_out, "min=%lg",mn);
    -     - else sprintf(inv_out, "min=undefined");
    -   - }
    -   - return 0;
    -}
    -
    -
    -The arguments to f_min() are the standard for options that do not require an argument
    -  mode = -1: initialization  -2: cleanup  O+: processing verbosity index
    -  sec = sections of the grib (sub) message
    -  *data = decoded grid point values
    -  ndata = number of grid points
    -  *inv_out = string that written to the inventory
    -  **local = unique pointer, used for "static" variables.
    -
    - - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 27, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/g2clib.html b/web_docs/g2clib.html deleted file mode 100644 index 5b7f86c..0000000 --- a/web_docs/g2clib.html +++ /dev/null @@ -1,269 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -g2clib - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-g2clib -
     
    - -

    wgrib2: -g2clib

    -
    - - -

    Introduction

    - -

    Originally wgrib2 used the g2clib library for unpacking the grid point data (GDS). -The first break from a complete dependence on the g2clib was adding support -for ieee-type grib files. Then the optimized grib1-style unpacking from wgrib -was added to the internal routines. Then jpeg, png and complex packing were added -to the internal decoder. Finally more packing schemes that were not in g2lib/g2clib -were added (run-length and log scaling). -

    - -

    -As of wgrib2 v1.9.8, a third option was added, use the internal decoder in g2clib -emulation mode. The options were also relabeled. The new default is to use -the internal decoder in g2clib emulation mode (-g2clib 1). -To use use the internal decoder you still use -g2clib 0. -To get the g2clib decoder, use -g2clib 2 which is now -a compile-time option. The changes were made because -

    - -
      -
    1. internal routines are faster for complex packing (1 cpu) -
    2. some internal routines were parallelized for decoding (complex and simple packing) -
    3. some distributions were linking the official g2clib rather than the patched - version included with the wgrib2 sources. This caused seg faults. -
    - - -

    Wgrib2 has always used its own routines for encoding grib files. The -encoding follows the WMO standard but are compatible with the NCEP libraries -(g2clib and g2lib). - -

    Differences as of October 2008

    - -

    The NCEP encoding/decoding routines have a problem -with constant fields. The routines ignore the decimal scaling -and assume it is zero (decimal scaling = multiplication by one). -The packing and unpacking routines are are consistent -with themselves so the problem wasn't noticed for many years. -As of 6/2014 this situation hasn't changed. This same bug -has been found in routine in other software packages. Some -are consistently ignore the decimal scaling for all packing modes, -whereas others only have the bug for certain packing modes. -By the use of "-g2clib 0" and "-g2clib 1", you can handle -grib files without/with this bug. - -

    -

    -The wgrib2 internal decode routines do not have a decimal scaling -problem and follow the WMO standard. The wgrib2 encode routines -will automatically use a decimal scaling = 0 for constant fields -and consequently be compatible with the WMO standard and will -decode correcty with g2clib/g2lib. -

    - -

    -The g2clib emulation (default, -g2clib 1) are recommend when -

      -
    1. The files were created by using g2clib/g2lib libraries (NCEP) and have the bug
      - The files must must have the center set to NCEP -
    2. files that were encoded using wgrib2 (more than simple subsetting) -
    3. WMO-compliant files from centers other than NCEP -
    - -Turning off the g2clib emulation (-g2clib 0) is recommend when - -
      -
    1. grib files that follow WMO standard for constant fields -
    - -Finally one potentially compile wgrib2 to include g2clib. -This is useful for testing and -for cases where g2clib supports a packing that is not supported by the -internal decoder. The disadvantages of the g2clib routines are - -
      -
    1. Single precision routines -
    2. The routines are slower for large grids and they are not threaded -
    3. The g2clib routines "fail" when they finds an undefined template. -
    4. Decoding problems with certain fields (6/2016). -
    5. Problems with seg faults when linked with the official g2clib (Fedora/Redhat rpms) -
    - -

    -g2clib

    - -

    -The -g2clib option allows you to select the internal/g2clib -decoder. If X is 0, then internal routines are selected. -If X is 1, then the internal decoder with g2clib emulation is selected (g2clib is used with older wgrib2 versions). -When X is 2, then the g2clib decoder is used if the g2clib decoder were compiled into the executable. -Note that g2clib doesn't support ieee, RLE, AEC and irregular structured grids. - -

    Usage

    -

    - -

    --g2clib N   N = 0, 1 or 2
    -            0 = WMO standard (for all files)
    -            1 = default
    -	        emulate NCEP g2/g2c bug for decoding constant values fields for
    -	        files from NCEP (center=NCEP (7))
    -		Files not from NCEP are unaffected
    -            2 = use g2clib, only available if compiled with g2clib
    -                This option should only be used for testing.
    -                Some distributions will seg fault using this option.
    -		Files from non-NCEP sources may have the wrong constant values
    -
    - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Aug 19, 2016, July 2024 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/gctpc.html b/web_docs/gctpc.html deleted file mode 100644 index a54fe94..0000000 --- a/web_docs/gctpc.html +++ /dev/null @@ -1,310 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -gctpc, -proj4 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -gctpc,-proj4 -
     
    - -

    wgrib2: -gctpc, -proj4

    -
    - - -

    Introduction

    - -

    -Wgrib2 has 3 sets of geolocation routines. Geolocation routines -are used to find the locations of the grid points by a (i,j) -> (lon,lat) -transformation. Some geolocation routines can calculate (i,j) from (lon,lat). -There is no "best" set of routines, so up to 3 sets can be used. - -

    -Internal Routines -

      -
    1. Spherical Earth only -
    2. Very fast and multithreaded, 3.5/12.7 sec on test case 1* -
    3. Very fast and multithreaded, 3.5/12.7 sec on test case 2* -
    4. Needed for NWP grids such as Gaussian grids and rotated lat-lon -
    5. Common projections -
    6. C, no configure file needed -
    7. Can transform (i,j) to (lon,lat) -
    8. Many of the codes trace their origins to operational codes at NCEP -
    - - -

    -GCTPC library -

      -
    1. Handles ellipsoidal Earth -
    2. Slow and multithreaded (OpenMP), 5.5/19.5 sec on test case 1* -
    3. Slow and multithreaded (OpenMP), 15.7/58.7 sec on test case 2* -
    4. More projections than internal routines -
    5. C, no configure file needed -
    6. Can transform (i,j) to (lon,lat) -
    7. Can transform (X,Y) to (lon,lat) -
    8. Can transform (lon,lat) to (X, Y) -
    9. Library is old but working, no recent development -
    10. Support for library is unknown -
    -

    -Proj4 library -

      -
    1. Handles ellipsoidal Earth -
    2. Slow and no support for OpenMP, 17.8/19.7 sec on test case 1* -
    3. Slow and no support for OpenMP, 62.8/64.7 sec on test case 2* -
    4. Proj4 supports pthreads, wgrib2 uses OpenMP -
    5. More projections than GCTPC, ex. ellipsoidal Lambert Azimuthal Equal Area grid -
    6. C, requires config script -
    7. Can transform (i,j) to (lon,lat) -
    8. Can transform (X,Y) to (lon,lat) -
    9. Can transform (lon,lat) to (X, Y) -
    10. Library has active development -
    11. Support for library is good -
    12. The first choice by many people. -
    - -
    -* test case 1 - read large Lambert conformal grid (6887 x 6610) and 
    -calculate lon/lat for the entire grid and print lon/lat for 1 grid point.
    -This uses a spherical Earth.
    -
    -* test case 2 - read large Lambert conformal grid (6887 x 6610) and 
    -calculate lon/lat for the entire grid and print lon/lat for 1 grid point.
    -This uses a ellipsoidal Earth.
    -
    -The timing code is
    -
    -  time wgrib2 burned_area_20120131_12_23_1km.grib2.c0 -ijlat 4 3
    -  time wgrib2 burned_area_20120131_12_23_1km.grib2.c0 -ijlat 4 3 -gptpc 1
    -  time wgrib2 burned_area_20120131_12_23_1km.grib2.c0 -ijlat 4 3 -proj4 1
    -
    -and the two numbers correspond to the wall clock and CPU times for a 4
    -core Intel Xeon E5506 with OMP_NUM_TREADS=4.
    -
    -grid:
    -  Lambert Conformal: (6887 x 6610) input WE:NS output WE:SN res 0
    -  Lat1 64.997800 Lon1 180.492400 LoV 264.000000
    -  LatD 40.000000 Latin1 20.000000 Latin2 60.000000
    -  LatSP 0.000000 LonSP 0.000000
    -  North Pole (6887 x 6610) Dx 1000.000000 m Dy 1000.000000 m mode 0
    -
    -Earth:
    -  case 1: code3.2=0 sphere predefined radius=6367470.0 m
    -  case 2: code3.2=4 IAG-GRS80 ave radius=6367444.5 m
    -
    -Packing: grid point data - complex packing,c1 
    -
    - -

    -The internal routines are fast, multithreaded but only handle -a spherical earth and cannot transform from (lon,lat) -> (X,Y). -The internal routines include grids not included with GCTPC. - -

    -The GCTPC routines can handle an ellipsoidal Earth. They are -50% slower than the internal routines for a spherical earth and -are acceptable for NOMADs. For an ellipsoidal Earth, the speed is -probably adequate for NOMADS. The lack of support is not a major factor -because the codes are tested and relatively simple. By supporting -both GCTPC and Proj4, I am comfortable that the codes can be -adequately tested. - -

    -Proj4 is the Gold standard; it used by many projects, it has -good support and updates appear on a regular basis. Proj4 supports -more projections than GCTPC. Unfortunately Proj4 is slow. For a -spherical Earth, Proj4 is probably adequate (slower than gctpc -for a spherical earth). For an ellipsoidal Earth, Proj4 is -too slow for Nomads. There have been some efforts to make Proj4 -thread safe. Another difficulty with Proj4 is that compiling -uses a config script. Config scripts can cause problems -when cross-compiling for compute nodes (some HPC computers). -

    - -

    -Wgrib2 needs the internal routines for grids not supported by -GCTPC/Proj4. Wgrib2 needs GCTPC/Proj4 for handling ellipsoidal -Earths. The current policy is that Proj4 will be an optional -package and GCTPC will be come the default package in the -near future. Support for Proj4 is useful for debugging and -for "keeping the options open". -

    - - -

    Usage

    - -

    -

    --gctpc 0
    -   do not use gctpc for geolocation
    --gctpc 1
    -   enable gctpc for geolocation
    --proj4 0
    -   do not use Proj4 for geolocation
    --proj4 1
    -   enable Proj4 for geolocation
    -
    -   Priority:
    -     Try Proj4 if Proj4 is enabled (not default) and installed (not default)
    -     Try gctpc if gctpc is enabled (default)
    -     try internal routines  
    -
    -     note: older version of the priority was wrong.
    -
    -   Note: some grids are only  supported by the internal routines
    -
    - - - -See also: --geolocation - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 30, 2014, April 13, 2020, 10/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/gdt.html b/web_docs/gdt.html deleted file mode 100644 index 3013b7a..0000000 --- a/web_docs/gdt.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -gdt - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-gdt -
     
    - -

    wgrib2: -gdt

    -
    - - -

    Introduction

    - -

    -Section 3 contains the grid definition template (GDT) -and the -gdt option prints the -parameters used to define the grid as -used by g2clib/g2lib (NCEP libraries). This option is -only useful finding the grid parameters for later use -by g2clib/g2lib. -

    -

    -The -gdt option will only -work if g2clib is installed at compile time. -

    - -

    Usage

    - -

    -

    --gdt
    -
    - -

    Example

    -
    -$ wgrib2 -gdt png.grb2
    -1:4:GDT Number= 0 GDT= 6 0 0 0 0 0 0 360 181 0 0 90000000 0 48 -90000000 359000000 1000000 1000000 0
    -
    - - -See also: - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 30, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/geolocation.html b/web_docs/geolocation.html deleted file mode 100644 index aacfffd..0000000 --- a/web_docs/geolocation.html +++ /dev/null @@ -1,245 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -geolocation - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-geolocation -
     
    - -

    wgrib2: -geolocation

    -
    - - -

    Introduction

    - -

    -Geolocation routines are used to calculate the longitudes and latitudes -of the grid points. Wgrib2 can use Proj4, gctpc and its own internal -routines to do the geolocation. Each set of routines has advanages and -disadvantages. The routines are listed in the default order. - -

    Proj

    - -

    -The Proj library was called PROJ4 from 1994-2017. In 2018, PROJ v5 was released -and the software was renamed PROJ. Wgrib2 is still using a v4 library and -all references in the code are to PROJ4. - -

    -PROJ is the gold standard of geolocation libraries. It is commonly used -and well supported. The drawbacks are it doesn't support OpenMP and -model grids. As of wgrib2 v3.1.2, PROJ4 is installed by default in order -to suppore aspherical equal area Lambert grids. - -

    Gctpc

    - -

    -Gctpc is an older library was which has lost support of its original authors (USGS). -The advantage is that it does support OpenMP unlike Proj4. It supports fewer grids -than Proj4 but that isn't a major problem because the grib2 standard only has -support for a few grids. Gctpc supports an ellipsoidal earth and -is always compiled with wgrib2. - - -

    Internal

    - -

    The internal routines are used to support model grids (Gaussian grid, rotated lat-lon grid), -spherical earth grids, and observational grids such as the space-view grid (used by EUMETSAT) -and radar grids (angle, distance from the origin). - -

    - -

    External, wgrib2 v3.1.2+

    -

    -Wgrib2 can set or overwrite the locations of the grid points using -rpn -(sto_lat, sto_lon), reading from a grib file using -grid_def, and reading from -a double precision binary file using -import_lonlat. These methods will -set the geolocation flag to external. -

    - -

    -For wgrib2 prior to v3.1.2, the geolocation flag showed which geolocation library -generated the locations of the grid points. External methods were not considered. -

    - - -

    Usage

    - -

    -

    --geolocation
    -    print out geolocation routines used: proj4, gctpc, internal, external, or not_used
    -      external means the lat/lon may be read or computed by an external calculation.
    -      If wgrib3 does not need the geolocation information, the geolocation routines
    -         will not be called. 
    -
    - -

    Example

    -
    -$ wgrib2 burned_area_20120131_12_23_1km.grib2 -geolocation -lon -90 30 
    -1:0:geolocation=gctpc:lon=270.004694,lat=29.997210,val=0
    -
    -	The gctpc routines were used for geolocation.
    -
    -$ wgrib2 burned_area_20120131_12_23_1km.grib2 -geolocation
    -1:0:geolocation=not_used
    -
    -	The geolocation use not used.
    -
    - - -See also: --gctpc --grid_def --import_lonlat --proj4 --rpn -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page dates: created 4/13/2020, modified 10/2022, 1/2023 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/get_byte.html b/web_docs/get_byte.html deleted file mode 100644 index 7730d40..0000000 --- a/web_docs/get_byte.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -get_byte - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-get_byte -
     
    - -

    wgrib2: -get_byte

    -
    - - -

    Introduction

    - -

    -The -get_byte option prints the values of -selected bytes in the grib message. For example if you want to -see the 20 and 21 octet (byte in WMO speak) of section 4, you would -use -get_byte 4 20 2. The first argument -is the section number. The second is the byte (octet) number starting -from 1 (consistent with WMO documentation) and the third is the number -of octets to display. - -

    Usage

    -

    - -

    --get_byte SECTION OCTET NUMBER
    -SECTION = section of the grib message to print
    -OCTET = starting octet to start printing, OCTET ≥ 1
    -NUMBER = number of bytes to print
    -
    - -

    Example

    -
    -$ wgrib2 f.grb2 -get_byte 0 1 16
    -1:0:0-1=71,82,73,66,0,0,0,2,0,0,0,0,0,0,18,178
    -
    - - -See also: -new grib, --set_byte, --get_ieee, --get_int, --get_hex -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/get_hex.html b/web_docs/get_hex.html deleted file mode 100644 index d82dcd5..0000000 --- a/web_docs/get_hex.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -get_hex - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-get_hex -
     
    - -

    wgrib2: -get_hex

    -
    - - -

    Introduction

    - -

    -The -get_hex option is identical to the --get_byte option excepts it prints the -bytes in hexidecimal format. -see the 20 and 21 octet (byte in WMO speak) of section 4, you would -use -get_byte 4 20 2. The first argument -is the section number. The second is the byte (octet) number starting -from 1 (consistent with WMO documentation) and the third is the number -of octets to display. -

    -

    -The input arguments to the option are in decimal rather than in hexidecimal because -all the grib2 documentation uses decimal numbers to specify the byte locations. -

    - - - - -

    Usage

    -

    - -

    --get_hex SECTION OCTET NUMBER
    -SECTION = section to print
    -OCTET = starting octet to print
    -NUMBER = number of octets/bytes to print
    -
    - -

    Example

    -
    -$ wgrib2 f.grb2 -get_hex 0 1 12
    -1:0:0-1=71,52,49,42,00,00,00,02,00,00,00,00
    -2:46042:0-1=71,52,49,42,00,00,00,02,00,00,00,00
    -3:63079:0-1=71,52,49,42,00,00,00,02,00,00,00,00
    -
    - - -See also: -new grib, --set_byte --get_ieee --get_int -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/get_ieee.html b/web_docs/get_ieee.html deleted file mode 100644 index c740a90..0000000 --- a/web_docs/get_ieee.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -get_ieee - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-get_ieee -
     
    - -

    wgrib2: -get_ieee

    -
    - - -

    Introduction

    - -

    -The -get_ieee option prints -the selected parts of the grib message as an IEEE floating -point number. -

    - -

    Usage

    - -

    -

    --get_ieee SECTION OCTET N
    -SECTION = section number of the grib message to print
    -OCTET = the octet number to print
    -N = number of IEEE float to print (4 octets per IEEE number)
    -
    - -

    Example

    -
    -$ wgrib2 rtgssthr_grb_0.083_awips.grib2
    -1:0:d=2009062900:TMP:surface:anl:
    -  : field is surface temperature, SST over water
    -$ wgrib2 rtgssthr_grb_0.083_awips.grib2 -packing -v
    -1:0:packing=grid point data - jpeg2000 compression,j val=(27133+i*2^0)*10^-2, i=0..8191 (#bits=13)
    -  : jpeg2000 packing, reference value is 27133
    -$ wgrib2 rtgssthr_grb_0.083_awips.grib2 -get_ieee 5 12 1
    -1:0:5-12=27133.000000
    -  : for jpeg2000 packing, the reference value is stored in Section 5, octet 12-15
    -
    -See also: --get_byte --get_byte --get_int -
    - - - - - - - - - -

    -NOAA/ -National Weather Service
    -National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 30, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/get_int.html b/web_docs/get_int.html deleted file mode 100644 index 76c3891..0000000 --- a/web_docs/get_int.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -get_int - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-get_int -
     
    - -

    wgrib2: -get_int

    -
    - - -

    Introduction

    - -

    -The -get_int option prints the values of -selected four-byte integers in a grib message. For example if you want to -see the number of data points (section 3, octets 7-10), you could -use -get_int 3 7 1. The first argument -is the section number. The second is the octet number starting -from 1 (consistent with WMO grib documentation) and the third is the number -of integers to display. The -get_int option uses -the grib format for signed 4-octet integers. - - -

    Usage

    -

    - -

    --set_int SECTION OCTET_NUMBER COUNT
    -
    - -

    Example

    -
    -$ wgrib2 f.grb -get_int 3 7 1  
    -1:0:3-7=65160
    -
    - - -See also: -new grib, --get_byte --get_int2 --get_hex -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified Nov 19, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/get_int2.html b/web_docs/get_int2.html deleted file mode 100644 index 4858f9d..0000000 --- a/web_docs/get_int2.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -get_int2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-get_int2 -
     
    - -

    wgrib2: -get_int2

    -
    - - -

    Introduction

    - -

    -The -get_int2 option prints the values of -selected two-byte integers in a grib message. For example if -you wanted to see octet N and N+1 is section M as a signed -two byte integer, you could -use -get_int2 M N 1. The first argument -is the section number. The second is the octet number starting -from 1 (consistent with WMO grib documentation) and the third is the number -of integers to display. The -get_int2 option uses -the grib format for signed 2-octet integers. - - -

    Usage

    -

    - -

    --set_int2 SECTION OCTET_NUMBER COUNT
    -
    - -

    Example

    -
    -$ wgrib2 f.grb -get_int2 1 6 1  
    -1:0:1-6=7
    -
    - - -See also: -new grib, --get_byte --get_int --get_hex -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grb2_free_file.html b/web_docs/grb2_free_file.html deleted file mode 100644 index 16dd826..0000000 --- a/web_docs/grb2_free_file.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - Climate Prediction Center - wgrib2api: grb2_free_file - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api: grb2_free_file -
     
    - -

    wgrib2api: grb2_free_file(..)

    -
    - - -

    Introduction

    - -

    -When files are opened using wgrib2api, they are normally not closed until -the program ends. This -saves time in closing and then reopening files. For most programs using -wgrib2api, there is no need to close files opened using wgrib2api. -However, there are two cases. First, you use wgrib2api to write a file, and you -then want to use the file before the program that created the file ends. -Wgrib2api may buffer some of the writes in an output buffer until the program -ends or until the file is closed. For this case, you have to free the file. -Second, there are exceptional programs which open huge numbers of files. -Since we all write exceptional programs, some more frequently than others, - there is a function to close -usused files that are opened by wgrib2api. This function does not affect -the files opened by the normal fortran "open" routine. - -

    Usage

    -
    -    i = grb2_free_file(FILE)
    -    i =  0    ok
    -      /= 0   failure
    -
    -    FILE:      character (len=*) file to close
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 13, 2017, May 1, 2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grb2_inq.html b/web_docs/grb2_inq.html deleted file mode 100644 index b9a40f0..0000000 --- a/web_docs/grb2_inq.html +++ /dev/null @@ -1,250 +0,0 @@ - - - - Climate Prediction Center - wgrib2api: grb2_mk_inq - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api: grb2_inq -
     
    - -

    wgrib2api: grb2_inq(..)

    -
    - - -

    Introduction

    - -

    -To read grib using wgrib2api, you first need to an -index or inventory file. -Then you call grb2_inq(..) with the appropriate search terms -and the data and metadata that you want. - -

    Usage

    -
    -    iret = grb2_inq(GRB2, INV, (list of search terms), (list of options))
    -    iret:  integer
    -           number of matchs to the search term
    -           -1 if some error
    -    GRB2: character (len=*) grib2 file
    -    INV:  character (len=*) index file
    -                            created by grb2_mk_inv(..)
    -                                    or wgrib2 GRB -Match_inv >INV
    -                            If you use an index file created by wgrib2 GRB > INV
    -                             then the search terms will be appropriate to that index file.
    -                             The *_date and *_edate optional arguments may not work.
    -    search term: character (len=*)
    -                 search term matches "wgrib2 GRB2 -Match_inv"
    -                 you are allowed 0 to 20 search terms
    -                 Normally the search is a straight text match.  You
    -                 can enable regex searches.
    -    IN Optional Arguments:
    -               debug: integer
    -                      0      - no debug statements
    -                      /= 0   - debug statements
    -
    -               end_date: integer (kind=8) YYYYMMDDHH search
    -               end_edate: integer (kind=8) YYYYMMDDHHmmss search
    -               ref_date: integer (kind=8) YYYYMMDDHH search
    -               ref_edate: integer (kind=8) YYYYMMDDHHmmss search
    -               start_date: integer (kind=8) YYYYMMDDHH search
    -               start_edate: integer (kind=8) YYYYMMDDHHmmss search
    -               verf_date: integer (kind=8) YYYYMMDDHH search
    -               verf_edate: integer (kind=8) YYYYMMDDHHmmss search
    -
    -               lastuse: integer
    -                        0    - nothing (default)
    -                        /= 0 - close GRB and INV files after use
    -               sequential: integer
    -                           0    - rewind INV before reading, stop after 1st match
    -                           /= 0 - do not rewind INV before reading, stop after 1st match
    -               regex: integer
    -                      0      - fixed string search (default)
    -                      /= 0   - regex search
    -               copy: character (len=*) filename
    -                     copies matches to file
    -               order: character (len=*) scan order of grid
    -                      'we:sn'   - grid will be in we:sn order (default)
    -                      'we:ns'   - grid will be in we:ns order
    -                      'raw'     - grid will be in raw order
    -                                  order as encoded in grib
    -                      note: lat, lon only work with we:sn order
    -    OUT Optional Arguments:
    -               grid: real allocatable (:,:)
    -                     grid point values
    -               lat:  real allocatable (:,:)
    -                     latitude values for the grid
    -               lon:  real allocatable (:,:)
    -                     longitude values for the grid
    -               nx:   integer, grid(nx,ny)
    -               ny:   integer, grid(nx,ny)
    -               npts: integer, number of grid points (nx*ny)
    -               nmatch: integer
    -                       number of matches                     
    -               msgno: integer
    -                      grib message of last match
    -               submsg: integer
    -                       submessage number of last match
    -
    -               The following options return a wgrib2 inventory option
    -               You are limited to 18.
    -
    -               desc: character, (len=*)
    -                          same as wgrib2 -S   (record number and byte location are not included)
    -               grid_desc: character, (len=*)
    -                          same as wgrib2 -grid
    -               get_ref_edate: integer (kind=8)
    -                          same as wgrib2 -T
    -               get_start_edate: integer (kind=8)
    -                          same as wgrib2 -start_FT
    -               get_end_edate: integer (kind=8)
    -                          same as wgrib2 -end_FT  or wgrib2 -VT
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Feb 21, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grb2_inq_scanning.html b/web_docs/grb2_inq_scanning.html deleted file mode 100644 index ee4dccc..0000000 --- a/web_docs/grb2_inq_scanning.html +++ /dev/null @@ -1,264 +0,0 @@ - - - - Climate Prediction Center - wgrib2api: grb2_mk_inq_scanning - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api: grb2_inq and scanning -
     
    - -

    wgrib2api: grb2_inq(..) and Scanning

    -
    - - -

    Introduction

    - -

    -In the page grb2_inq.html, grb2_inq(..) was used to -read individual fields. In some applications, sometimes you have to scan -to see which fields are available. To read the file in "scan" mode, you need -to read the file sequentially. The first call to grb2_inq(..) has -the option "sequential=0". By adding the optional parameter "sequential", only -one matching field is read. By setting sequential to zero, the first matching -field in the file is read. - -

    -    iret = grb2_inq(GRB2, INV, (list of search terms), (list of options),sequential=0)
    -      reads the first field that matches the search terms
    -    if iret = 0, matching field is not found
    -
    - -To read the remaining matching fields, you read the file sequentially by calls to grb2_inq(..) -using sequantial=N where N is non-zero. - -
    -    iret = grb2_inq(GRB2, INV, (list of search terms), (list of options),sequential=N)
    -      N is non-zero
    -      reads the next field that matches the search terms
    -    if iret = 0, matching field is not found
    -
    - -The sequential reads should not be mixed with non-sequential reads. It is probably -a mistake if the search terms varies in the sequential reads. - -

    Example

    -This example comes from Da Li (CMC). - -
    -use wgrib2api
    -character (len=100) :: in, out, inv
    -character (len=500) :: metadata
    -real, allocatable :: spfh(:,:), tmp(:,:), w(:,:)
    -integer :: nlevs, iret, i, j, k
    -real:: cp, grav, rgas
    -real,  allocatable :: levs(:)
    -character (len=30), allocatable :: slevs(:)
    -
    -!---- Constant for poisson's equation
    -grav = 9.80665         ! m/s**2; gravity
    -rgas = 287.058       ! J/kg/K; gas constant
    -
    -in='one.grb2'
    -inv='tt.inv'
    -out='omega.grb2'
    -
    -!  make inventory
    -iret = grb2_mk_inv(in,inv)
    -if (iret.ne.0) stop 1
    -
    -! get number of SPFH levels
    -nlevs = grb2_inq(in,inv,':SPFH:',' mb:')
    -write(*,*) 'nlevs=',nlevs
    -
    -allocate (levs(nlevs))
    -allocate (slevs(nlevs))
    -
    -! get the pressure levels, and pressure search string by sequential reads
    -
    -do i = 1,nlevs
    -   iret=grb2_inq(in,inv,':SPFH:',' mb:',sequential=i-1,desc=metadata)
    -   if (iret.ne.1) stop 2
    -   j = index(metadata,':SPFH:') + len(':SPFH:')
    -   k = index(metadata," mb:") + len(" mb:")-1
    -   read(metadata(j:),*) levs(i)
    -   slevs(i) = metadata(j-1:k)
    -   write(*,*) 'levs=',levs(i), slevs(i)
    -enddo
    -
    -! need to read the data with random access
    -! because grib messages can be in any order
    -
    -do i = 1,nlevs
    -   iret=grb2_inq(in,inv,':SPFH:',slevs(i),data2=spfh)
    -   if (iret.ne.1) stop 3
    -
    -   iret=grb2_inq(in,inv,':TMP:',slevs(i),data2=tmp)
    -   if (iret.ne.1) stop 4
    -
    -   iret=grb2_inq(in,inv,':DZDT:',slevs(i),data2=w)
    -   if (iret.ne.1) stop 5
    -
    -   w = -1.0 * w * levs(i) * 100.0 * grav / (rgas * tmp)
    -   iret=grb2_wrt(out,in,1,data2=w,meta=metadata,mb=levs(i),var='VVEL')
    -   if (iret.ne.0) stop 8
    -   write(*,*) 'omega:',w(1,1), ' level=',levs(i),' hPa'
    -
    -enddo
    -stop
    -end
    -
    - -This above example shows the basic method of scanning a file to find the -vertical levels, and processing the data in order to create new fields. -The above code is independent on the resolution of the grid and the number -of pressure levels. - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Feb 21, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grb2_mk_inv.html b/web_docs/grb2_mk_inv.html deleted file mode 100644 index d43a5cc..0000000 --- a/web_docs/grb2_mk_inv.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - Climate Prediction Center - wgrib2api: grb2_mk_inv - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api: grb2_mk_inv -
     
    - -

    wgrib2api: grb2_mk_inv(..)

    -
    - - -

    Introduction

    - -

    -To read grib using wgrib2api, you need to have an index or inventory file. -The index file is used for searching and it is quick to create. The -format of the index file keeps expanding as needed. For example, -chemical tracers were added to the grib format, so naturally the index -file had to include the possibility of a chemical type. - -

    -The index file created by grb2_mk_inv('file.grb2', 'file.inv') is the same as created by - -

    -  wgrib2 file.grb2 -Match_inv > file.inv
    -
    - -

    The inv file can be created before the fortran program is run. -This may be more efficient if multiple programs need to create -the inv of the same file. - -

    Usage

    -
    -    iret = grb2_mk_inv(GRB2, INV, options)
    -    iret:  integer
    -           0 if index file created
    -           1 if index file not created
    -    GRB2: character (len=*) existing grib2 file
    -    INV:  character (len=*) index file that is created
    -          Note: special files are supported
    -           @tmp:string      temporary disk file
    -           @memN            memory file, N=0..8
    -                            registers 9..19 are reserved for wgrib2api
    -    options: optional parameters
    -          use_ncep_table=.true.            use ncep variable tables 
    -          use_ncep_table=.false.           use variable tables as determined by center encoded in the file (default)
    -
    - -

    -Some centers such as Canada and ESRL use NCEP grib2 variable tables for some of their files. -The optional argument 'use_ncep_table=.true.' can be use to read these files. (requires wgrib2api.f90 -from wgrib2 v3.0.0) - - -

    Advanced Usage: pre-existing wgrib2 inventories

    - -

    -Pre-existing index files (wgrib2 inventories) can be used -to save processing time. However, there are two issues. -First, the typical inventory will be smaller and fewer -valid search terms. Second, the fortran API reference -date is YYYYMMDDHHmmss rather than the YYYYMMDDHH and assumed -zero minutes and seconds. So the fortran-API inventory -replaces the "d=YYYYMMDDHH" by "D=YYYYMMDDHHmmss". It's -not a big deal and both formats are accepted by the grb2_wrt -routine. The difference would be apparent in a search term -that of the form, - -

    -  mk_inv: ":D=YYYYMMDDHHmmss:HGT:200 mb:"
    -  std inv: ":d=YYYYMMDDHH:HGT:200 mb:"
    -
    - -Since the ftn api has added minutes and seconds to the -time stamp. Being consistent is nice. By the way, the -reference time has to be stored in a 64 bit integer. - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page recent modifications: Oct 3, 2017, Nov 13, 2019 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grb2_undefined.html b/web_docs/grb2_undefined.html deleted file mode 100644 index 746f1ab..0000000 --- a/web_docs/grb2_undefined.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - Climate Prediction Center - wgrib2api: grb2_UNDEFINED, grb2_UNDEFINED_VAL(), grb2_DEFINED_VAL() - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api: undefined values -
     
    - -

    wgrib2api: undefined values

    -
    - - -

    Introduction

    - -

    In grib2, the grid points can have undefined values. Grib doesn't -doesn't use a special value to indicate an undefined but uses one -of 3 methods. - -

      -
    1. a bitmap (used by jpeg2000, simple, ieee and by complex packing) -
    2. the IEEE 754 format undefined (ieee packing) -
    3. a special bit pattern by complex packing (prefered) -
    - -

    -However, users usually find a special value the easiest method to indicate an undefined value. -Wgrib2api, like wgrib2, uses the value 9.999e20 to indicate a special value. -There are one symbolic values and two functions -in wgrib2api (v2.0.8) to handle undefined values. - -

      -
    • grb2_UNDEFINED: symbolic value for 9.999e20 -
    • grb2_UNDEFINED_VAL(x): returns true if x is the undefined values otherwise false -
    • grb2_DEFINED_VAL(x): returns true if x is a defined values otherwise false -
    - - -

    Usage

    -
    -    grid(i,j) = grb2_UNDEFINED
    -       set grid(i,j) to the special undefined values 9.999e20
    -    if (grb2_UNDEFINED(grid(i,j)) then
    -       if grid(i,j) is undefined than
    -    if (grb2_DEFINED(grid(i,j)) then
    -       if grid(i,j) is defined than
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan 25, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grb2_wrt.html b/web_docs/grb2_wrt.html deleted file mode 100644 index d861222..0000000 --- a/web_docs/grb2_wrt.html +++ /dev/null @@ -1,314 +0,0 @@ - - - - Climate Prediction Center - wgrib2api: grb2_wrt - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api: grb2_wrt -
     
    - -

    wgrib2api: grb2_wrt(..)

    -
    - - -

    Introduction

    - -

    -Writing grib using wgrib2api is simple. You need -

      -
    1. gridded data you want to write -
    2. sample grib2 message with the same grid as (1) and unchanging - metadata such as center/subcenter/process-id -
    3. the changing metadata in a wgrib2-style string such as
      - 'd=1999123100:HGT:500 mb:anl:', 'D=20170102123000:UGRD:2 m above ground:15 minute fcst:' -
    - -

    -The grb2_wrt(..) function will -take the template, change the grid values, change the grib headers based -on the metadata string and write out the grib message. -

    - -

    -Optional parameters that are in the grb2_wrt source code that -are not documented here are to be considered to be alpha -code. - -

    A simple fortran program to write grib2

    -
    -use wgrib2api
    -real, allocatable :: grid(:,:)
    -
    -allocate (grid(360:181))
    -read(11) grid
    -i = grb2_wrt('out.grb2','tempplate.grb2',1,data2=grid,meta='D=20170102030000:HGT:500 mb:anl:')
    -write(*,*) 'error=',i
    -stop
    -end
    -
    - -

    A simple program to write out the 10 m wind speed

    -
    -use wgrib2api
    -real, allocatable :: u(:,:), v(:,:)
    -character (len=200) meta
    -
    -i=grb2_mk_inv('gep19.t00z.pgrb2af180','in.inv')                    ! make index file
    -if (i.ne.0) stop 1
    -i=grb2_inq('gep19.t00z.pgrb2af180','in.inv', ':UGRD:10 m above ground:', data2=u) ! read U
    -if (i.ne.1) stop 2                                                 ! only want one match
    -i=grb2_inq('gep19.t00z.pgrb2af180','in.inv', ':VGRD:10 m above ground:', data2=v,& ! read V
    -     desc=meta)
    -if (i.ne.1) stop 3                                                 ! only want one match
    -
    -u=sqrt(u*u+v*v)                                                    ! calculate wind speed
    -i=grb2_wrt('out.grb','gep19.t00z.pgrb2af180',1,data2=u,meta=meta,var='WIND')  ! write wind speed
    -! using grib message 1 of original file as a template
    -!  modifying the variable to WIND (wind speed
    -if (i.ne.0) stop 4
    -write(*,*) ' file : out.grb'
    -stop
    -end
    -
    - -

    Code fragment to write surface hgt from ss2grb2.f90

    - -
    -  metadata='d=' // datecode // ':HGT:surface:' // trim(ftime) // ':'
    -  iret = grb2_wrt(grib_output,grib_template,1,hgt_sfc,meta=metadata,order='raw')
    -  if (iret.ne.0) stop 1
    -  write(*,*) 'grib_write HGTsfc'
    -
    -

    The grib template, grib_template, is created on the fly by using wgrib2 -to alter the grid. - -

    In ss2grb2, the grids are stored in we:ns order and we want the output grids -to be in we:ns order. So the order parameter is set to raw. The order could -have been set to we:ns but raw is slightly faster. - -

    Code fragment to write hgt(pres) from ss2grb2.f90

    -
    -  do i = 1, n_plevs
    -     metadata='d=' // datecode // ':HGT:' // trim(plevs_txt(i)) &
    -       // ':' // trim(ftime) // ':'
    -     iret = grb2_wrt(grib_output,grib_template,1,xz(:,i),meta=metadata,order='raw')
    -     if (iret.ne.0) stop 4
    -  enddo
    -  write(*,*) 'grib_write HGT mb'
    -
    -

    The pressure levels are defined by both a numeric value (plevs(n_plevs) -and a text string (plevs_txt(n_plevs)). Note that the loop that writes -calls grb2_wrt(..) is not multithreaded (no !$OMP PARALLEL DO) because -the wgrib2api is not thread safe. - -

    You may notice that both code fragments use the old style where you modify -the metadata. The new style wasn't available for ss2grb2.f90. - - -

    Usage

    -
    -    iret =     grb2_wrt(GRB2, TEMPLATE, IMSG, data2=GRID, meta=META, (list of optional arguments))
    -               or
    -    iret =     grb2_wrt(GRB2, TEMPLATE, IMSG, data1=GRID1, meta=META, (list of optional arguments))
    -
    -    iret:      integer
    -               0 grib message written
    -               1 grib message not written
    -
    -               Necessary Parameters
    -
    -    GRB2:      character (len=*) output grib file
    -    TEMPLATE:  character (len=*) template file
    -    IMSG:      integer, grib message number to be used as template
    -    data2:     real allocatable :: grid(nx:ny)          : modern programs
    -               values of grid
    -    data1:     real grid1(nx*ny)                        : legacy programs
    -               values of grid
    -    meta:      character (len=*) metadata string, modeled on wgrib2 -S
    -
    -               Optional Parameters
    -
    -    meta:      is optional, concise form of the metadata
    -    append:    integer
    -               0     create GRB2
    -               /= 0  append to GRB2
    -    encode_bits: N, integer
    -               use ECMWF-style scaling (wgrib2 default)
    -               grid values = I * 2**M + offset, where I = 0..2^N - 1
    -               I has at most N bits
    -               wgrib2/wgrib2api supports N as large as 25.
    -    debug:     integer
    -               0     no debug information
    -               /= 0  debug information
    -    order:     character (len=*)
    -               'we:sn'             grid data is we:sn order  (DEFAULT)
    -               'we:ns'             grid data is we:ns order
    -               'raw'               grid data is raw order
    -
    -               Parameters that Override Values in Metadata String (v2.0.7)
    -
    -    var:       character (len=*)
    -               ex. 'HGT', 'TMP'
    -    date:      integer (kind=8)
    -               sets the reference date, format is YYYYMMDDHHmmss
    -    level:     character (len=*)
    -               wgrib2 style level definition, ex. '10 m above ground', '50 mb'
    -    timing:    character (len=*)
    -               wgrib2 style forecast type, ex. 12 hour fcst, 0-6 hour ave fcst
    -
    -    center:    integer, 0..255
    -               WMO defined center id, 255=undefined
    -    subcenter: integer, 0..255
    -               subcenter id, 255=undefined
    -    packing:   character (len=*)
    -               wgrib2 style packing name, ex c1, aec, simple
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: April 7, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grep.html b/web_docs/grep.html deleted file mode 100644 index cef5fcf..0000000 --- a/web_docs/grep.html +++ /dev/null @@ -1,260 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -grep (various) - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grep (various) -
     
    - -

    wgrib2: -egrep, -egrep_v, -fgrep, -fgrep_v

    -
    - - -

    Introduction

    - -

    -When you use wgrib2 extensively, common sequences keep occuring, such as, - -

    -   1:  wgrib2 A.grb >A.inv
    -   2:  cat A.inv | fgrep ":HGT:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib hgt500.grb
    -   3:  cat A.inv | fgrep ":TMP:" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib tmp500.grb
    -   4:  cat A.inv | egrep ":(UGRD|VGRD):" | fgrep ":500 mb:" | wgrib2 -i A.grb -grib wind500.grb
    -
    - -Using the various -grep, -inv and the -i_file option, the above example can -be written as - -
    -   1:  wgrib2 A.grb -inv A.inv
    -   2:  wgrib2 -fgrep ":HGT:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib hgt500.grb
    -   3:  wgrib2 -fgrep ":TMP:" -fgrep ":500 mb:" -i_file A.inv A.grb -grib tmp500.grb
    -   4:  wgrib2 -egrep ":(UGRD|VGRD):" -fgrep ":500 mb:" -i_file A.inv A.grb -grib wind500.grb
    -
    - -The first version is easier to read. So why were the extra options added? - -
      -
    1. Some shells have problems with pipes. -
        -
      • Some versions of Windows dos-prompt have problems with pipes. -
      • RNomads: solved Windows 7 problem by using these options -
      -
    2. More efficient when you avoid multiple processes and pipes. -
        -
      • Every millisecond and K byte of RAM usage counts! -
      -
    3. Used by callable wgrib2. -
        -
      • A subroutine (wgrib2) can read a field using the index file! -
      -
    - -The options were added for the third reason, but one and two are some -nice side effects. The 4 examples can be coded in fortran as, - -
    -   include wgrib2api
    -   ...
    -   i = wgrib2a('A.grb','-inv','A.inv')
    -   i = wgrib2a('-fgrep',':HGT:','-fgrep',':500 mb:','-i_file,'A.inv','A.grb','-grib','hgt500.grb')
    -   i = wgrib2a('-fgrep',':TMP:','-fgrep',':500 mb:','-i_file','A.inv','A.grb','-grib','tmp500.grb')
    -   i = wgrib2a('-egrep',':(UGRD|VGRD):','-fgrep',':500','mb:','-i_file','A.inv','A.grb','-grib','wind500.grb')
    -
    - -

    The -grep options are used in wgrib2api's grb2_inq(..) function. - -

    -Definition of grep options:
    -
    -    (...) | wgrib2 -OP1 X (...)
    -      behaves like
    -    (...) | OP2 X | wgrib2 (...) 
    -
    -      if OP1 == egrep       then OP2 = egrep
    -      if OP1 == fgrep       then OP2 = fgrep
    -      if OP1 == egrep_v     then OP2 = egrep -v
    -      if OP1 == fgrep_v     then OP2 = fgrep -v
    -
    -    X is a posix extended regular expression (egrep, egrep_v)
    -    or a fixed string (fgrep, fgrep_v)
    -
    -   The number of -fgrep and -fgrep_v options is limited to 200.
    -   The number of -egrep and -egrep_v options is limited to 200.
    -   The wgrib2 option -set_regex does not affect the -grep options.
    -
    - - -

    Usage

    -

    - -

    --egrep X
    --egrep_v X
    --fgrep Y
    --fgrep_v Y
    -
    -X is a posix extended regular expression
    -Y is a fixed string (not a regular expression)
    -Note: -set_regex does not modify the type of regex for these options
    -
    - -

    -See also: --match, --not, --match_inv, --end, --if, --i_file, --not_if, --set_regex. -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page modified: Feb 3, 2017, 7/2019. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grib.html b/web_docs/grib.html deleted file mode 100644 index 598e0fd..0000000 --- a/web_docs/grib.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -grib - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grib -
     
    - -

    wgrib2: -grib

    -
    - - -

    Introduction

    - -

    -The -grib option writes the data in GRIB-2 format. This -option only writes the current field (record/submessage) if the GRIB message -contains multiple fields (records/submessages). If you want to copy the -entire GRIB-2 message, use the -GRIB option. - - -

    -grib vs. -grib_out

    -

    These two options do similar things, they write a grib message to a specified file. -The -grib writes the grib message and --grib_out option takes the decoded grib message, -converts it back into grib2 and then writes it out. Obviously the latter option -is much slower. You only use -grib_out when you -have modified the data (grid) values. For example, you may have set many of the -points to undefined in order to the data volume. Since the data values -have changed, you have to use the -grib_out in order -to create the smaller grib file. - -

    Usage

    -

    - -

    --grib file_name
    -
    - -

    Example

    -

    - -

    -The slow way of extracting 2 meter RH to rh.grb.  (Read test.grb2 twice.)
    -$ wgrib2 test.grb2 -s | grep ":RH:2 m above ground:" | wgrib2 -i test.grb2 -grib rh.grb
    -285:36796469:d=2005090200:RH:2 m above ground:60 hour fcst
    -
    -The fast way of extracting 2 meter RH to rh.grb.  (Read test.grb2 once.)
    -$ wgrib2 test.grb2 -match ":RH:2 m above ground:"  -grib rh.grb
    -285:36796469:d=2005090200:RH:2 m above ground:60 hour fcst
    -
    - -

    -See also: -GRIB, --grib_out --append -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, updated Aug 10, 2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grib_ieee.html b/web_docs/grib_ieee.html deleted file mode 100644 index 8a19f69..0000000 --- a/web_docs/grib_ieee.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -grib_ieee - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grib_ieee -
     
    - -

    wgrib2: -grib_ieee

    -
    - - -

    Status

    - -

    -The -grib_ieee option is a very early -method of writing grib files. This method was never used -outside of testing AFAIK. This option will be deleted in -the future (2015) unless there are objections. -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 30, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grib_max_bits.html b/web_docs/grib_max_bits.html deleted file mode 100644 index f6e32f8..0000000 --- a/web_docs/grib_max_bits.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -grib_max_bits - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grib_max_bits -
     
    - -

    wgrib2: -grib_max_bits

    -
    - - -

    Introduction

    - -

    -When wgrib2 encodes a grib message (creates a new grib message), -the grid values are usually stored as scaled integers. -The number of bits required to store the scaled integers will depend -on the precision/scaling factors. If these values are poorly -set, the scaled integers could be 100 bits long. That would -be very inconvenient for machines with 32-bit registers. -To prevent this problem, you have to limit the size of the scaled -integers. The wgrib2 default is 16 bits, and can be increased -up to 25 bits by the -set_grib_max_bits option. -Since the IEEE single precision floating point format only has -25 bits of precision, there is little need to support longer -scaled integers at this point in time (9/2017). The --grib_max_bits option displays the current -value of the maximum binary precision. - - -

    -Grib decoders usually have a limit to the size of the scaled integers -used to store grid values. Wgrib2 has a limit of 25 bits which is determined by the minimum -size of the integer (32 bits) and the algorithm used to convert -between a bitsting and integer. I don't know the limits for -other software packages. - -

    - -

    --grib_max_bits INTEGER
    -               INTEGER between 1 and 25
    -
    - -See also: --scaling, --set_grib_max_bits, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified Feb 21, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grib_out.html b/web_docs/grib_out.html deleted file mode 100644 index 7add8d5..0000000 --- a/web_docs/grib_out.html +++ /dev/null @@ -1,221 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -grib_out - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grib_out -
     
    - -

    wgrib2: -grib_out

    -
    - - -

    Introduction

    - -

    -The -grib_out option writes the decoded grid to a -specified file in grib2 format. Normally you would use the --grib option as this option just copies the original grib (sub)message. -The -grib_out option has to repack or compress the decoded grid which -is much slower. -You would only use the --grib_out option when you have modified -the decoded grid by -the -undefine, -import, --rpn, or some other option that modifies the -decoded grid. -Use the -set_grib_type option -to specify the grib packing and -set_scaling to specify the scaling. -When the -set_grib_type option is not used, the packing defaults -to simple. -When the -set_scaling option is not used, the scaling is retained -from the input grib message unless a -rpn or -import -option is executed. These two options reset the scaling to the default because they -can alter the range of grid point values. - - -

    Usage

    -

    - -

    --grib_out file_name
    -
    -

    Example

    -

    - -

    -$ wgrib2 new.grb2 -undefine out-box -10:10 20:40 -grib_out small.grb2
    -1:0:d=2005082812:HGT:1000 mb:78 hour fcst:
    -
    - -The above routine sets all the grid points outside the 10W-10E 20N-40N to -undefined and then writes the resultant field as a grib file -in small.grb2. This file will be much smaller than the original field. - -

    -Hint: by proper use of the -undefine and -grib_out options, one -should be able to send horizontal boundary conditions for -regional models very very quickly. Imagine just sending -4 lines of horizontal boundary conditions. - -

    Hint: gzip -

    -See also: -text, --netcdf --spread --bin --ieee --import_bin, -import_grib, -import_ieee, import_grib --grib --rpn --set_grib_type --undefine -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 28, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grib_out_irr.html b/web_docs/grib_out_irr.html deleted file mode 100644 index eb1b5a4..0000000 --- a/web_docs/grib_out_irr.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -grib_out_irr - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -grib_out_irr -
     
    - -

    wgrib2: -grib_out_irr

    -
    - - -

    Introduction

    - -

    -This option will be eliminated as template 3.130 was not added to the grib standard. - -

    -The grib2 format allows irregular grids; that is, grids that are defined by a list of latitude-longitude pairs. -This extension to the grib2 format allows you to handle models with unusual grids, -model data interpolated to a specific point and even observations. -Why would you use grib to handle point data rather than other -formats such as BUFR or netcdf? Some formats are difficult to use and converting between from grib to netcdf/BUFR -will lose metadata. Keeping the keeping the point data in grib facilitates the conversion between gridded -and collection-of-points data. For the conversion, wgrib2 can do nearest neighbor and a Cressman analysis. - -

    Space

    -

    -Each grid point has a 4-byte latitude and a 4-byte longitude value. This is an -8 * num_grid_point byte overhead. Since each grib message is independent, this -overhead has to be repeated for each grib message even if the grid is unchanged. -Howver, the grib format allows submessages so the overhead is only for the first -submessage. However, the length of any grib message has to be -less than 2 GB in order to be compatible a 32-bit machines. In practice you should -keep the message size smaller in order not to use up all the free memory. - - -

    Usage

    -
    --irr_grid LON-LAT-LIST RADIUS OUT
    -
    -LON-LAT-LIST   = lon-lat list, lon1:lat1:lon2:lat2:...:lon-n:lat-n
    -RADIUS         = radius in km
    -OUT            = output grib file
    -
    -The -irr_grid option creates an irregular grid using nearest-neighbor interpolation.
    -If no input grid point is within RADIUS kms, the resulting grid has a undefined value.
    -
    - -

    Example: make file with grid points at (10W,20N) (30W,40N)

    -
    -$ wgrib2 flx.grb2 -irr_grid 10:20:30:40 1000 2pt.grb2
    -1:0:d=2009010100:UFLX:surface:0-1 month ave fcst:
    -$ wgrib2 -V 2pt.grb2
    -1:0:vt=2009010100:surface:0-1 month ave fcst:UFLX Momentum Flux, U-Component [N/m^2]:
    -    ndata=2:undef=0:mean=0.0129:min=0.0035:max=0.0223
    -    grid_template=130:winds(N/S):
    -        Irregular Grid:(2 x 1) units 1e-06 input raw output raw res N/A
    -        lat=20.000000 40.000000 
    -        lon=10.000000 30.000000 
    -
    -1st point lon=10W lat=20N
    -2nd point lon=30W lat=40N
    -
    - -See also: --grib_out_irr, --lola, --cress_lola, - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grib_out_irr2.html b/web_docs/grib_out_irr2.html deleted file mode 100644 index 67e6ab8..0000000 --- a/web_docs/grib_out_irr2.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -grib_out_irr2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -grib_out_irr2 -
     
    - -

    wgrib2: -grib_out_irr2

    -
    - - -

    Introduction

    - -

    -The option -grib_out_irr2 replaces --grib_out_irr. The former uses Grid -Definition Template (GDT) 101 which is part of the grib -standard. The latter uses GDT 130 which was was not adopted. -The -grib_out_irr2 allows you to define -an unstructured grids which allows the locations of the grid -points to be arbitrary. For example, you can define an -unstructured grid to be the locations of the all the US -weather observing stations. One neat feature of GDT 101 -is the grid number is a UUID (universally unique identifier) -which can be generated on the fly and is not "registered" -with the center or WMO. This feature, for example, will -allow you to generate a grid for all the ship observations -at 00Z January 1, 2017 and a different grid for any other -observation time. With the UUID feature of GDT 101, one -can store observational data in grib. - -

    -The locations of are not part of the metadata in grib message, -and the locations have to be provided another means such as -documentation at the center's web site or by including grib -mesages with the latitudes (NLAT) ane longitudes (ELON). - -

    Usage

    -
    --grib_out_irr2 NPNTS CENTER_GRID_NUBER REF_GRID_TYPE UUID OUTFILE
    -
    -NPNTS              = number of grid points, can be differ from the size of the input grid
    -CENTER_GRID_NUMBER = use -1 unless your center has defined an appropriate grid number
    -REF_GRID_TYPE      = use -1 unless your center has defined an appropriate reference grid type
    -UUID               = universally unique identifier, use uuidgen to create a new UUID,
    -                     has a format: e1fc1f28-5024-4ff5-a04b-cf837d8574f6
    -                     0 = no UUID
    -OUTFILE            = output grib file
    -
    - -

    -The option, -grib_out_irr2, can generate a grid with any number -of grid points. The data for the new grid is taken from the DATA register which is -usually the input data. If NPNTS is less than the size of the data register (NDATA), -then the first NPNTS of DATA are written out. If NPNTS is greater or equal to NDATA, -the DATA is written out and any extra points are set to undefined. For both cases, -there is no attempt to remap the data by finding the nearest grid point, etc. (At -this point, the latitudes and longitudes have not been specified.) - -

    Is GDT 101 Useful?

    - -GDT 101 is useful! I can define a UUID, and make a grib files with 3 grib messages, -NLAT, ELON, TMP2m. Using wgrib2, I can interpolate TMP2m to a lat-lon grid. - -

    -I have a netcdf file with latitude(x,y), longitude(x,y) and TMP2m(t,latitude,longitude). -Using -import_netcdf, I can make grib message with ELON, NLAT and TMP2m. I can now -interpolate TMP2m to a lat-lon grid. - -

    -See also: - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 21, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/gribify2.html b/web_docs/gribify2.html deleted file mode 100644 index 435312d..0000000 --- a/web_docs/gribify2.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - Climate Prediction Center - gribify_ieee: -ftim - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > gribify2 -
     
    - -

    gribify using import and a template

    -
    - - -

    Introduction

    - -

    Here is another way of writing a grib2 file. Create a template -grib2 file. In our example, we already created one in grib1 and then -converted it to grib2 using cnvgrib. Once we have a template file, we can -replace the data using one of the import options, adjust the -date code, handle the undefined grid point and write it out using -the -grib_out option. Here is -an example script. - -

    -#!/bin/sh
    -#
    -# example of converting a binary file to grib2
    -#
    -# conustemplate.grb2 is the template
    -#  was created in grib1 using the gribw library
    -#  and converted to grib2 by cnvgrib
    -#
    -# the data file has two records but we only want to convert the 1st record
    -#
    -set -x
    -
    -# date=$1
    -# date0=`ndate -12 ${date}00`
    -date=20090414
    -date=2009041312
    -
    -# -no_header    .. read/write data without f77 header
    -# -import_bin   .. read one binary record (no header) and replace the grib data field
    -# -set_date     .. set a new reference time
    -# -undefine_val .. the binary file used -999 as the undefined flag
    -# -rpn          .. use the rpn calculator to convert to standard units (x=x/10/86400)
    -# -grib_out     .. write the data as a grib file
    -
    -wgrib2 conustemplate.grb2 -no_header -import_bin PRCP_CU_GAUGE_V1.0CONUS_0.25deg.lnx.$date.RT \
    -  -set_date $date0 -undefine_val -999 -rpn 10:/:86400:/ -grib_out precip$date0.grb2
    -
    - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: June 1, 2009 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/gribify_cmorph.html b/web_docs/gribify_cmorph.html deleted file mode 100644 index cf014d0..0000000 --- a/web_docs/gribify_cmorph.html +++ /dev/null @@ -1,615 +0,0 @@ - - - - Climate Prediction Center - wgrib2: example, converting CMORPH into GRIB - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > Converting CMORPH into GRIB - -
     
    - -

    Converting CMORPH into GRIB

    -
    - -

    Introduction

    - -

    -Converting a binary file into GRIB is a common operation. Once the -data in grib, using the data is easier and safer. I remember someone -who stored data in a simple binary file. Every day, he would get the Z500 -and tack it onto the file as a simple (nx,ny) array. So the first record -was January 1, 20XX Z500, the second record was January 2, 20XX Z500 and so on. -Suppose the computer that updated the archive was down one day, his archive would -be out of sync, and he may never know it. Not safe. Once the data -are stored in a "descriptive" format, you can never get out of sync and other -programs can read the data. - -

    -CPC produces CMORPH which is a high temporal estimate of the precipitation. -Making 30 minute estimates of the precip is hard because satellites that -"see" the precip are polar orbiters. To make a "movie", you really want -to use a geostationary satellite. So CMORPH uses the polar orbiters to -get the precip when available. For the other times, it assumes that -the precip from a cloud system is similar to the precip from that cloud system -when observed by a polar orbiter in a previous and future time. Identification -of cloud systems can be done using imagery from geostationary satellites. - -

    -A sample binary CMORPH file is described by the following GrADS control file. - -

    -DSET ^CMORPH2_3Phase_0.25deg-30min_%y4%m2%d2%h2
    -OPTIONS template little_endian
    -UNDEF -999.0
    -TITLE CMORPH-2 3-Phase 0.25deg-30min precip rate
    -XDEF 1440 LINEAR   0.125 0.25
    -YDEF  720 LINEAR -89.875 0.25
    -ZDEF    1 LEVELS   1
    -TDEF 9999 LINEAR 00:00Z13Sep2018 30mn
    -VARS 4
    -cmorph  1  99  total precip rate  [mm/hr]
    -liquid  1  99  liquid precip rate [mm/hr]
    -mixed   1  99  mixed precip rate  [mm/hr]
    -solid   1  99  solid precip rate  [mm/hr]
    -
    -name = CMORPH2_3Phase_0.25deg-30min_YYYYMMDDHH
    -format: little endian ieee
    -        fortran direct access
    -        undefined grid values have the value -999.0
    -grid:   1440 x 720 we:sn
    -        0.125W to 359.885W by 0.25 degrees
    -        89.875S to 89.875N by 0.25 degrees
    -fields: 4
    -        #1 CMORPH (total precip) unit mm/hr
    -        #2 liquid precip
    -        #3 mixed precip
    -        #4 solid precip
    -
    - - -

    Making a Template File

    - -

    -We are going to show two ways to gribify the CMORPH data. One is -by using a fortran program and the second by the wgrib2 utility. - - - -

    - -The -netcdf option writes the grid values to a specified -file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator -and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic -projection grids. Other grid templates and projections are not supported yet. - -

    -Default the grid values are written as 4 bytes float having {TIME,LAT,LON} -dimension shape (3D data) and possible vertical LEV information added to the name of variables. -For example, V wind component defined at 10 m level in atmosphere will have default name -VGRD_10maboveground. -With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data -with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical -structure analysis etc. -

    -3D and 4D data could be mixed in the same netcdf file if both have the same horizontal -grid shapes. Practically any number of variables could be placed in to the single netcdf file -as well as time dimension can be almost arbitrary extended. For these purposes -please use the wgrib2 -append option. -All missing values in data are replaced by the _FillValue defined in wgrib2 as -9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. - - - -

    Simple usage

    -

    - -

    --netcdf file_name
    -
    - -

    Example 1

    -

    - -

    -$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    -
    -The above line converts the grib2 file into a netcdf file.
    -
    -
    - -

    Sub-options for -netcdf

    - -

    -Next sub-options could help to customize created netcdf file(s). -All sub-options must preceed the -netcdf option as it is the wgrib2 rule. -More then one -netcdf option could be given on the wgrib2 command line, -please read the documentation for wgrib2. -Almost all sub-options have -no_... version that annulates previous -assignment. -For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table -with the -nc_table sub-option or combine the command line options -with instructions in the -nc_table conversion file. - -

    -The -append option makes possible to create single -large data set for long time series of gridded data. Time dimension of data in the netcdf file -is "unlimited", it could be extended "forward" when adding new data but not "backward" before -the first defined time value. If data for the same time step already exist in the updated -netcdf file these will be silently overwritten. - -

    -The -nc_nlev option is needed to export data to netcdf -as 4D data defined in {TIME,LEV,LAT,LON} space. -It must be followed by integer max_number_of_vertical_levels -which defines the vertical dimension size of 4D data exported to the netcdf file. -This value can not be found from each single grib2 message or sub-message, -usually it has to be scanned the entire grib2 file or even number of files. -It is the reason why the max_number_of_vertical_levels -value must be provided by user. -

    -Grib2 types of vertical levels eligible for export to the netcdf as 4D data -are defined in the wgrib2 internal table and now include next types of GRIB2 levels: -

    -
    -
    20:K level -
    100:pressure level -
    104:sigma level -
    105:hybrid level -
    107:K isentropic level -
    160:ocean depth below sea level -
    -
    -

    -Data for the first found eligible level type are treated as 4D and vertical level -information is not added to the variable names. -Error is generetad if data for other then first found eligible level type -are met in the input stream. -Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space -with the possible level information included into the variable names or with the user-specified names -(see -nc_table option description below for how to do it). -

    -The -nc_nlev option has not -no_... option, -please use instead the max_number_of_vertical_levels equal to 0. -In this case all data from the input stream will be threated as 3D. -

    -When existing netcdf file is updated in the -append mode -the value of max_number_of_vertical_levels must not exceed -initial value provided when the netcdf file was first created (defined). -By default when first creating the netcdf file, vertical level values are not fixed -(are undefined) and these are defined one-by-one when data at new level are added -to the netcdf file, up to the max_number_of_vertical_levels. -To overcome this feature please use the -nc_table option. - -

    -The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is -default and do not assume data packing, only data range is checked. Data outside of -specified range are replaced by missing value code for all types of packing. -This replacement is done in the local copy of unpacked data, so main data array -stays unchanged. -Values of min and max could be any -signed float. Packing is applied to all new variables in the input stream. -If some variable was already defined in the netcdf file and now is appended to it -in the -append mode the initially defined and fixed in the netcdf file -valid range and packing parameters are used. -

    -The packing is possible to the short (2 bytes) -or byte (1 byte) values with potential loss of precision. -Both zero values of min and max -packing parameters for the short or -byte packing activate 'auto' packing when -min and max -values are defined from the first entered field. - -

    -PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file -is open with 'sdfopen' command. But by some reasons using the GrADS -data description file (catalog) for the same netcdf file helps in this situation. - -

    -The -nc_grads option activates some tests for the created -netcdf file to be GrADS (version 1.9b4) compatible, -or to be open by sdfopen in gradsnc or gradsdods. -The GrADS support only COARDS convention netcdf files; -it do not support non-constant data time stepping -and silently generates wrong time stamps for such netcdf files. -Packing to byte also is not directly recognized by GrADS v1.9b4. -With this option an error is raised and processing stops -if any of criterias above is determined. - -

    -The -nc_table option followed by the file_name is most usefull for the advanced users -as it specifies the file where user can customize many features of created netcdf file. -Next examples demonstrate which directives and conversion rules could be given -in the -nc_table file. -Almost all of them are optional with exception of $nlev for the case -when user explicitly specifies the vertical level values $levs. -

    -$lev_type 100:pressure:pressure level:mb:0.01 -

    This directive explicitly defines the type of vertical level -in the grib2 file that becomes eligible for treating data at these levels as 4D data -and some it attributes for netcdf file. -Default, first found level type listed in the wgrib2 build-in table -of eligible levels is selected if no $lev_type directive found. -

    Fields here include: -

    -
    -
    100-the grib2 level type code number -for treating data as 4D. In this example it is the code number for pressure levels, integer -
    pressure- -short_name for the vertical axis in the netcdf file, string -
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces -
    mb-vertical axis units as written in the netcdf file, string -
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file -
    -
    - -$nlev X -

    This directive is an equivalent of the -nc_nlev command line option -but value in the -nc_table file has precedence over the command line option if both are found. -It is required if next $levs directive is specified. -

    - -
    $levs lev(1) lev(2) lev(3)... -
    ...lev(I-1) lev(I) lev(I+1)... -
    ...lev(X-1) lev(X) -
    -

    -This directive explicitly specifies the vertical level values to be exported -to the netcdf file, in the netcdf units. -If this directive exists in the -nc_table file and there is found the grib2 data -eligible for the 4D presentation but defined on other then listed level - -these data are skipped from export and work is silently continued. -All data conversion parameters are checked before the $levs is checked. -List of level values could consist of multiple lines; -max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); -use space, ',', ';' or ':' as lev(i) fields separator. -

    -Impact of $nlev and $levs directives is different depending on -does the netcdf file is first created or it is updated. -When the netcdf file is first created these values are written -to the netcdf file fixing 4D data vertical structure. -When updating an existing netcdf file in the -append mode -these parameters will work like filter limiting possible -updates of 4D data by these that satisfy to the given $levs only and -ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. -

    -The $nlev and $levs directives could be necessary if records -in the grib2 file have randomly changing vertical level values -that makes it impossible sequentionally define valid order of vertical levels. - -

    -$grads 1 -

    This directive is an equivalent of the -nc_grads command line option -if passed value is 1 or to the -no_nc_grads if value is 0. -Directive in the -nc_table file has precedence over the command line option. - -

    -wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] -

    -All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' -are treated as grib2 to netcdf conversion rules for the specified variables. -In these strings the wgib2_name and wgrib2_level -are strings as returned by the wgrib2 inventory; -* used as the wgrib2_level will apply -to all levels not given explicitly. -The valid range and packing information is optional but it overwrites common -packing rule if such is specified by the -nc_pack command line option. -Absence of packing information means no packing for this variable. -Min and max values are any signed float values. Both could be omitted or put to zero. -Last case means that automatic scaling will be estimated from the first entered -wgib2_name field at the wgrib2_level -or at the first level in case of * as level value. -

    -If the keyword ignore is found as a netcdf variable name or -as a packing type value, the corresponding data are ignored -and do not written to the netcdf file. -Impact from this keyword is similar to the wgrib2 -not option -or filtering data with the grep utility. -

    -The ignore keyword is recommended if the data from the same -grib2 file are exported in number of output files (netcdf or other) -by the same wgrib2 process. Then the same decoded data could be passed -for the output in other file of any supported type. -Doing export to the single netcdf file it is not recommended to use the -ignore keyword -as corresponding data are first decoded and after that skipped from writing -to the netcdf file. -

    -In the next example two lines from the -nc_table file instruct -the wgrib2 utility export to the netcdf file the geopotential height changing name -from HGT (wgrib2) to -geopotential in the netcdf file, -at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: -

    -
    -HGT:*:geopotential
    -HGT:975 mb:ignore
    -
    -
    -All other variables not listed in the -nc_table file but found in the input stream -are processed as regular 3D data. - - -

    Example 2

    -

    -Next example shows the content of user-defined -nc_table file -for one special case of Japan Meteorological Agency MSM system grib2 data conversion. -Same -nc_table file includes the rules for -conversion of both 'surface' and upper air data although -the input grib2 files are different. - -

    -
    -#
    -# File name: jma_msm_g2nc.table
    -# Description: Specifies parameters for conversion to Netcdf format
    -# hourly analyses and forecasts of JMA MSM system as best suited to
    -# my purposes: forcing of ocean model and reference data for analysis
    -# of meteorological conditions with GrADS-based visualization tools.
    -# Sergey Varlamov, July 2007
    -#
    -$lev_type  100:p:pressure level:mb:0.01
    -$nlev      16
    -$levs  1000 975 950 925 900 850 800 700 600 500
    -        400 300 250 200 150 100
    -$grads 1
    -#
    -# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    -#
    -UGRD:*:u
    -VGRD:*:v
    -#UGRD:*:u:ignore
    -#VGRD:*:v:ignore
    -TMP:*:temp
    -#write HGT at any level as hgtprs:
    -HGT:*:hgtprs
    -#but skip HGT at 100 mb, now commented - example and test
    -#HGT:100 mb:hgtprs:ignore
    -RH:*:rh:short:-2:110
    -VVEL:*:omega
    -#
    -# JMA MSM model surface data conversion rules
    -#
    -PRMSL:mean sea level:prmsl
    -PRES:surface:prsfc
    -UGRD:10 m above ground:u10m
    -VGRD:10 m above ground:v10m
    -TMP:1.5 m above ground:t2m
    -RH:1.5 m above ground:rh2m:short:-5:110
    -TCDC:surface:ncld:short:-5:110
    -LCDC:surface:ncld_low:short:-5:110
    -MCDC:surface:ncld_mid:short:-5:110
    -HCDC:surface:ncld_upper:short:-5:110
    -APCP:surface:r1h
    -# End of file
    -
    -
    -Using above file we could create the daily file with 3h analyses
    -at the 'surface' layers from the input grib2 files
    -with the next simple shell script:
    -
    -
    -date=20070715
    -for (( j=0; j<=21; j+=3 )) #hour of day loop
    -do
    -  if [ $j -lt  10 ]
    -  then
    -    h=0$j
    -  else
    -    h=$j
    -  fi
    -  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    -
    -  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    -  code=$?
    -  if [ $code -eq 0 ]
    -  then
    -    echo ${date}${h}': created/added to Netcdf'
    -  else
    -    echo ${date}${h}': wgrib2 failed...'
    -    exit $code
    -  fi
    -done
    -
    -
    -Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    -
    -gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    -
    -and change the name for the output file:
    -
    -./msm_s_${date}.nc to the ./msm_p_${date}.nc
    -
    -Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    -utility for data visualization and analyses.
    -
    - -

    Example 3

    - -In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, -convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf -option doesn't support appending, the netcdf conversion cannot be in a loop. - -
    -Version 1, using loops and a temporary file
    -
    -rm tempfile
    -for f in gfs.t00z.pgrb2f[01]?
    -do
    -   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    -done
    -wgrib2 tempfile -netcdf ~/myfile.nc
    -rm tempfile
    -
    -Version 2, data-flow 
    -
    -1:   cat gfs.t00z.pgrb2f[01]? | \
    -2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    -3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    -4:   wgrib2 - -netcdf ~/myfile.nc
    -
    -
    -Line 1 (cat), takes all the desired grib files and writes to stdout
    -Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    -Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    -Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    -
    -

    -See also: --bin, --ieee --text --spread - --append -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan. 27, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/gribify_ieee.html b/web_docs/gribify_ieee.html deleted file mode 100644 index b6300cb..0000000 --- a/web_docs/gribify_ieee.html +++ /dev/null @@ -1,421 +0,0 @@ - - - - Climate Prediction Center - gribify_ieee: -ftim - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > gribify_ieee -
     
    - -

    gribify using ieee

    -
    - - -

    Introduction

    - -

    Writing grib-2 files can be quite painful with all the libraries -involved. However, there is a type of grib which is relatively easy -to write. In this format, a single grib2 record looks like - -

    -     (binary header)           variable number of bytes
    -     (big endian ieee data)    4*ndata bytes
    -     (binary trailer)          4 bytes, ascii '7777'
    -
    - -You can obtain the header/trailer using the -grib_ieee -option. - -
    -   $ wgrib2 -order raw -d 1 in.grb2 -grib_ieee out
    -   1:0:d=2008022101:APCP:surface:1 month fcst:
    -   $ ls out*
    -   out.grb  out.h  out.head  out.tail
    -
    - -

    The first line takes the first record of the file and creates -

    -   out.grb        ieee grib2 file (one record)
    -   out.head       binary file with the header
    -   out.tail       binary file with the trailer
    -   out.h          C header
    -
    - -

    Making a simple grib file

    - -Continuing our example, we need some big endian binary data (ieee.bin). -We extract the ieee data (ieee.bin) using wgrib2. Normally you -would create the ieee data by another program. - -
    -   $ wgrib2 -d 1 in.grb2 -no_header -ieee ieee.bin
    -   1:0:d=2008022101:APCP:surface:1 month fcst:
    -
    - -Once we have the field in big-endian ieee, we can make -the grib file. - -
    -   $ cat out.head ieee.bin out.tail > first.grb
    -   $ wgrib2 first.grb -grib_out second.grb
    -   1:0:d=2008022101:APCP:surface:1 month fcst:
    -
    - -The "cat" combines the header, data and trailer. The file, -first.grb is a valid grib2 if there were no undefined values -in "ieee.bin" (see the following section, "Undefined grid points"). -The wgrib2 converts any undefined grid points to a bit -mask and uses a more common compression scheme. -Of course the example is pretty lame as it has the same date and -variable as the original file. However that can be changed. - -
    -   $ wgrib2 second.grb -set_date 2008010100 -set_var SNOD -grib_out third.grb
    -   1:0:d=2008010100:SNOD:surface:1 month fcst:
    -
    - - -

    Making a grib file with C

    - -The header file may looks like this, - -
    -unsigned char head[] = {
    - 71, 82, 73, 66, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 164, 234, 0, 0, 0, 21,
    - 1, 0, 7, 0, 1, 2, 1, 1, 7, 216, 4, 14, 0, 0, 0, 0, 1, 0, 0, 0,
    - 72, 3, 0, 0, 0, 41, 16, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0,
    - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 144, 0, 0, 0, 73, 0, 0, 0, 0, 0,
    - 0, 0, 0, 5, 93, 74, 128, 0, 0, 0, 0, 48, 133, 93, 74, 128, 21, 79, 4, 96,
    - 0, 38, 37, 160, 0, 38, 37, 160, 0, 0, 0, 0, 34, 4, 0, 0, 0, 0, 3, 5,
    - 2, 0, 180, 0, 0, 0, 1, 0, 0, 0, 0, 100, 0, 0, 1, 134, 160, 255, 0, 0,
    - 0, 0, 0, 0, 0, 0, 12, 5, 0, 0, 41, 16, 0, 4, 1, 0, 0, 0, 6, 6,
    - 255, 0, 0, 164, 69, 7,};
    -
    -unsigned char tail[4] = {55, 55, 55, 55};
    -
    -#define NDATA 10512
    -#define SEC0 0
    -#define DISCIPLINE 6
    -#define EDITION 7
    -#define SEC1 16
    -#define CENTER 21
    -#define SUBCENTER 23
    -#define MASTERTABLE 25
    -#define LOCALTABLE 25
    -#define YEAR 28
    -#define MONTH 30
    -#define DAY 31
    -#define HOUR 32
    -#define MINUTE 33
    -#define SECOND 34
    -#define SEC3 37
    -#define SEC4 109
    -#define PRODUCTDEFTEMPLATENUM 116
    -#define PRODUCTDEFTEMPLATE 118
    -#define PRODUCTCATEGORY 118
    -#define PRODUCTNUMBER 118
    -#define SEC5 143
    -#define SEC6 155
    -#define SEC7 161
    -
    - -The header has definition of the header and trailer and -the location of selected elements in the header. Here -is an example that uses the above header (g2.6.h) - -
    -#include <stdio.h>
    -#include <stdlib.h>
    -#include "g2.5.h"
    -
    -// Method #2 of writing a grib file
    -//
    -//  sample program to create a grib2 ieee file
    -//  to convert to jpeg file, type wgrib2 in_file -grib_out out_file
    -//
    -// can also use wgrib2 to change the variable name, level and time
    -//   by the set_* commands
    -//
    -// 4/2008 Wesley Ebisuzaki
    -
    -int main() {
    -        FILE *grib;
    -        float r;
    -        char s[4], *t;
    -        int i;
    -
    -        grib = fopen("test.grb", "wb");
    -
    -// to change octet N of section 4 to the value of K
    -// add the following line:
    -//      head[SEC4+(N-1)] = K;
    -// the grib documentation starts numbering octets at 1
    -// C uses 0 as the base
    -
    -        head[YEAR] = 2008 / 256;
    -        head[YEAR+1] = 2008 % 256;
    -        head[MONTH] = 2;
    -        head[DAY] = 3;
    -        head[HOUR] = 4;
    -
    -        head[DISCIPLINE] = 0;
    -        head[PRODUCTCATEGORY] = 1;
    -        head[PRODUCTNUMBER] = 2;
    -
    -        // write grib header
    -
    -        i = fwrite(head, 1, sizeof(head), grib);
    -        printf("size of head = %d\n",i);
    -
    -        // for missing values, use the value NaN
    -        // note: wgrib2 will convert 9.999e20 to missing
    -        // write out IEEE big-endian data (NDATA)
    -
    -        // silly array -- needs to be in big-endian
    -
    -        r = 1.0;
    -        t = (char *) &r;
    -        // byte swap on a little endian machine
    -        s[0] = t[3];
    -        s[1] = t[2];
    -        s[2] = t[1];
    -        s[3] = t[0];
    -        for (i = 0; i < NDATA; i++) {
    -            fwrite(s,1,4,grib);
    -        }
    -
    -        // write grib trailer
    -
    -        fwrite(tail,1,sizeof(tail),grib);
    -        return 0;
    -}
    -
    - -

    -As with the first example, one should convert undefined grid points and the ieee packing -to a more commonly used packing using "wgrib2 in.grb -grib_out out.grb". - -

    -In this example, in.grb2 happens to have the correct grid -but wrong the center. If you examine in.grb2, you see that it comes from -NCEP and you happen to be working in in Kiribati (196 in WMO table). That can be easily fixed. - -

    -   $ wgrib2 in.grb2 -center
    -   1:0:center=US National Weather Service - NCEP (WMC)
    -   $ wgrib2 in.grb2 -set_center 196  -grib_out third.grb2
    -   1:0:d=2008022101:APCP:surface:1 month fcst:
    -   $ wgrib2 third.grb2 -center
    -   1:0:center=Kiribati (NMC)
    -
    - -Are all the necessary -set_* options available? -Probably not as this this procedure for making grib file is -a work in progress. Send comments to wesley.ebisuzaki@noaa.gov. - -

    Getting the "template" grib2 file

    - -

    The procedure depends on having a grib2 file with the -correct grid. For common grids, you can often find a -such a grib file. Sometimes you can find a grib1 file -and then you can use -cnvgrib to convert the file into grib2. As a last -resort, one could take a grib1 file, convert it to -the correct domain by the program copygb and then use -cnvgrib. -Of course, the last resort is the hardest because it requires -knowing the grid description in the arcane "GDS" format. -(You'll have to read the fortran code and know a bit about grib1.) - -

    5/2010: wgrib2 can make regular lat-lon template files -by the -lola option. - -

    Undefined grid points

    -

    -In grib, undefined grid points are usually specified by a -bit mask. However, ieee floating point numbers can have a -value of NaN or "not a number". The current WMO documentation -doesn't specify how to interpret a NaN, so wgrib2 interprets -a NaN as undefined. Seems logical, doesn't? Anyways I'll assume -logic holds until WMO defines otherwise. However, -writing a NaN can be difficult in some languages. So -one can use a special number as the undefined value. If -you use 9.999e20, you can fix the file by - -

    -   wgrib2 in.grb2 -grib_out out.grb2
    -
    - -If for some reason, you decided to use -999 as the undefined value, -you can fix the file by - -
    -   wgrib2 in.grb2 -undefine_val -999 -grib_out out.grb2
    -
    - - -

    Other grib decoders

    - -The ieee variation of grib2 is not supported by the NCEP fortran and C -libraries and programs based on those libraries. You can convert to -a more standard packing by using wgrib2. - -
    -   wgrib2 in.grb2 -grib_out out.grb2
    -
    - - -

    Warning

    -Please check the results of gribifying your data. This -facility is very new and variations of grib files is many. -Please plot the results. - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Oct 30, 2008 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/gribtable_used.html b/web_docs/gribtable_used.html deleted file mode 100644 index 8a56dcf..0000000 --- a/web_docs/gribtable_used.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -gribtable_used - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -gribtable_used -
     
    - -

    wgrib2: -gribtable_used

    -
    - - -

    Introduction

    - -

    -The grib variable table that is built in to wgrib2 is based on the NCEP table -and entries from other centers. For the WMO-defined entries, NCEP -names are used. You may want to change the grib table because - -

      -
    1. grib table is incomplete -
    2. you want to use names that make sense -
    3. the center's names for locally defined fields are not included in wgrib2 -
    4. you want to use an unofficial table -
    - -To solve this problem, you can set up user grib tables. - -

    - -https://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/user_grib2tables.html - -

    -Now the -gribtable_used option helps you set up the user -grib table. The option writes grib table entries used by a file. - -

    Usage

    -

    - -

    --gribtable_used OUTPUT
    -     OUTPUT is a file with the grib table entries for each field
    -
    - - -

    Example

    -

    - -

    -$ wgrib2 gep19.t00z.pgrb2af180 -gribtable_used junk
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -2:46042:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    -3:63079:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    -..
    -
    -$ sort -u junk > grbtbl     (get rid of duplicate entries)
    -edit grbtbl, change UGRD to U, VGRD to V and TMP to T
    -
    -$ export grib2table=`pwd`/grbtbl      (define a user grib table)
    -
    -$ wgrib2 gep19.t00z.pgrb2af180 -match '(U|V|T)'
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -2:46042:d=2009060500:T:200 mb:180 hour fcst:ENS=+19
    -3:63079:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    -4.1:86046:d=2009060500:U:200 mb:180 hour fcst:ENS=+19
    -4.2:86046:d=2009060500:V:200 mb:180 hour fcst:ENS=+19
    -5:137483:d=2009060500:HGT:250 mb:180 hour fcst:ENS=+19
    -6:184669:d=2009060500:T:250 mb:180 hour fcst:ENS=+19
    -..
    -
    -Note: U and V will not be treated as vectors in -new_grid.  You have
    -to use -new_grid_vectors to get U and V to be vectors.
    -
    - -

    -See also: -new_grid, --new_grid_vectors, - user_grib2tables -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - created 10/27/2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grid.html b/web_docs/grid.html deleted file mode 100644 index 07b7cba..0000000 --- a/web_docs/grid.html +++ /dev/null @@ -1,298 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -grid - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grid -
     
    - -

    wgrib2: -grid

    -
    - - -

    Introduction

    - -

    -The -grid option prints out the grid information. - - -

    -$ wgrib2 gep19.t00z.pgb2af180 -grid -d 1
    -1:0:grid_template=0:winds(N/S):
    -	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output WE:SN res 48
    -	lat 90.000000 to -90.000000 by 1.000000
    -	lon 0.000000 to 359.000000 by 1.000000 #points=65160
    -
    - -
    -$ wgrib2 nam.683 -grid
    -1:0:grid_template=30:winds(grid):
    -	Lambert Conformal: (1473 x 1025) input WE:SN output WE:SN res 8
    -	Lat1 12.190000 Lon1 226.541000 LoV 265.000000
    -	LatD 25.000000 Latin1 25.000000 Latin2 25.000000
    -	LatSP 0.000000 LonSP 0.000000
    -
    - -
    -$ wgrib2 .t00z.master.grb2f048 -grid -d 1
    -ebis@landing2:~/grib2_examples$ wgrib2 gfs.t00z.master.grb2f048 -grid | more
    -1:0:grid_template=40:winds(N/S):
    -	Gaussian grid: (3072 x 1536) units 1e-06 input WE:NS output WE:SN
    -	number of latitudes between pole-equator=768 #points=4718592
    -	lat 89.909340 to -89.909340
    -	lon 0.000000 to 359.882813 by 0.117188
    -
    - -
    -$ wgrib2 merc.g2 -grid -d 1
    -1:0:grid_template=10:winds(N/S):
    -	Mercator grid: (73 x 23) LatD 22.500000 input WE:SN output WE:SN res 48
    -	lat -48.090000 to 48.090000 by 513669.000000 m
    -	lon 0.000000 to 0.000000 by 513669.000000 m
    -	orientation 0.000000
    -
    - -

    -The four previous examples are for a grid definitions of a lat-lon, Lambert Conformal, -Gaussian and Mercator grids. These are the most common grids that are commonly distributed -from NCEP. Other commonly used grids are: polar stereographic, rotated lat-lon and -thinned Gaussian. Radar and satellites often use different grids. - -

    Understanding the grid definitions

    -

    -The grid definitions are based on the grib grib defintions as published -by the WMO and copied by the NCEP's grib documentation. For example, the -lat-lon grid defintion is given by - -https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-0.shtml. -Wgrib2's version of the lat-lon grid is given by -

    -$ wgrib2 gep19.t00z.pgb2af180 -grid -d 1
    -1:0:grid_template=0:winds(N/S):
    -	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output WE:SN res 48
    -	lat 90.000000 to -90.000000 by 1.000000
    -	lon 0.000000 to 359.000000 by 1.000000 #points=65160
    -
    -template=N      .. grid defintion template 3.N
    -winds(N/S)      .. winds are earth relative
    -winds(grid)     .. winds are grid relative
    -(NX x NY)       .. grid dimensions (for rectangular grid)
    -units 1e-06     .. scaling of angles, scaled angles are stored as 4-byte integers
    -input WE:NS     .. grib has the data in WE:NS scan order
    -output WE:SN    .. wgrib2 internally has the data is in WE:SN scan order
    -                   if wgrib2 writes a bin/ieee/text file, it will be in the output scan order
    -                   The output scan order has to be WE:SN for geolocation to work.
    -                   The default output scan order is WE:SN.
    -output WE:NS    .. wgrib2 internally has the data is in WE:NS scan order
    -                   The is enabled by -order we:ns, and is used for writing binary data
    -                   in WE:NS order.
    -output raw      .. wgrib2 internally has the data in the input scan order
    -                   This scan order is needed for -new_grid to work.  
    -res N           .. value of the resolution and component flags octet (byte)
    -lat X to Y by Z .. latitudes start at X goes to Y by steps of Z
    -lon X to Y by Z .. longitudes start at X goes to Y by steps of Z
    -                   note: grib2 uses longitude is in [0,360) model
    -#points N       .. number of points in the grid including grid points with undefined values
    -
    - - -

    dlat and dlon in lat-lon grids

    -An above example showed the dlat and dlon for lat-lon grids. The dlat and dlon were -saved to the nearest 1e-6 of a degree. For calculating the lat/lon of the grid points, -wgrib2 calculates a more accurate version of dlat and dlon from the end points -of the grid. For all the angle calculations, wgrib2 uses double precision. The only -exceptions is when angles are saved to rpn registers which are single precision, and if -wgrib2 is configured to call the old (single precision) iplib library. - -

    Staggered Grids, wgrib2 2.0.8+

    - -

    Staggered grids are often used in grid point (as opposed to spectral) -atmospheric models. (Arakawa, A.; Lamb, V.R. (1977). "Computational design of the -basic dynamical processes of the UCLA general circulation model". Methods in Computational Physics: -Advances in Research and Applications. 17: 173–265.) There are advantages in -storing the model grids in grib for both the modeler and the user. The advantages -are compactness, and a standard format. The user also has the advantage of -eliminating an extra interpolation step. The staggering information is stored -in the last 4 bits of flag table 3.4. If these bits are all zero, there is no -staggering. - -

    Staggered grids in GRIB work by -

      -
    1. A "fundamental" grid is defined -
    2. staggered grid could have an 0 dx offset in the X direction -
    3. or staggered grid could have an 1/2 dx offset in the X direction -
    4. or staggered grid could have 0 dx offset for odd rows and 1/2 dx for even rows (all in the X direction) -
    5. staggered grid could have an 0 dy offset in the Y direction -
    6. or staggered grid could have an 1/2 dy offset in the Y direction -
    7. staggered grid could have fewer points in the row or column if the offset is non-zero -
    - -This scheme allows encoding the Arakawa A-E Egrids. The wgrib2 -grid will show -the staggering. The storage description was updated in v2.0.8 to be -
      -
    1. nx*ny: length of the row is nx, there are ny rows -
    2. nx*(ny-1): length of the row is nx, there are ny-1 rows -
    3. trim-x*ny: length of the row is either nx or nx-1, there are ny rows -
    4. trim-x*(ny-1): length of the is either nx or nx-1, there are ny-1 rows -
    - - -

    Usage

    -

    - -

    --grid
    -
    - -See also: --nxny, --nlons -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, updated Nov 29, 2018, 5-2021, June 2024 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grid_101.html b/web_docs/grid_101.html deleted file mode 100644 index 11c60fc..0000000 --- a/web_docs/grid_101.html +++ /dev/null @@ -1,253 +0,0 @@ - - - - Climate Prediction Center - wgrib2: unstructured grids (GDT=101) - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > unstructured grids (GDT=101) -
     
    - -

    Unstructured grids (GDT=101)

    -
    - - -

    Introduction

    - -

    -The grib2 standard supports unstructured grids using Grid Definition Template 101. With -unstructured grids, you can have grid points at arbitrary locations (latitude, longitude). -Each grid is uniquely identified by a Universally Unique IDentifier (UUID). (The UUID -is generated by the producer rather than being assigned by the WMO.) To save space, -the locations of the grid points are not specified in each grib message. Common -methods of specifying the locations is to create two grib message which contain -the latitude and longitude of the grid points. By using the same UUID, the user -knows the locations correpond to any (unstructured) grid identified by the same UUID. -The locations in grib format can be stored in another file or by prepending -grib locations to the various files. - -

    Latitude/Longitude prepended to the data file

    - -
    -  Consider a file, junk, created by (grid point 1: 1E, 2N), (grid point 2: 40E, 41N)
    -$ wgrib2 gep19.t00z.pgrb2af180 -new_grid location 1:2:40:41 junk
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -2:46042:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    -3:63079:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    -4.1:86046:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    -4.2:86046:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    -..
    -
    -  The file, junk, now has two fields prepended, the GEOLON and GEOLAT.
    -bash-4.1$ wgrib2  junk
    -1:0:d=2009060500:GEOLON:surface:anl:
    -2:172:d=2009060500:GEOLAT:surface:anl:
    -3:344:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -4:493:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    -5:639:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    -6:785:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    -7:931:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    -..
    -
    -The file is using GDT=101, an unstructured grid with 2 grid points
    -bash-4.1$ wgrib2 junk -grid -v2
    -1:0:grid_template=101:
    -	General Unstructured Grid grid=0 ref_grid=0 uuid=00000000-0000-0000-0000-000000000000 #points=2
    -
    -2:172:grid_template=101:
    -	General Unstructured Grid grid=0 ref_grid=0 uuid=00000000-0000-0000-0000-000000000000 #points=2
    -
    - -

    Using GDT=101 and prepended location

    - -Wgrib2 can handle the unstructured grid with a prepended location by using -the -grid_def option. The --grid_def option associates the GEOLAT and GEOLON with -the grid locations. To see the values of the first grid point, you can do, - -
    -  To see the first grid point:
    -bash-4.1$ wgrib2 junk -if "^(1|2):" -grid_def else -s -ilat 1 -endif
    -1:0
    -2:172
    -3:344:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19:grid pt 1,lon=1.000000,lat=2.000000,val=12429.8
    -4:493:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19:grid pt 1,lon=1.000000,lat=2.000000,val=219
    -5:639:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19:grid pt 1,lon=1.000000,lat=2.000000,val=45
    -6:785:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19:grid pt 1,lon=1.000000,lat=2.000000,val=3.6
    -7:931:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19:grid pt 1,lon=1.000000,lat=2.000000,val=-4.7
    -..
    -
    -  To see the second grid point:
    -bash-4.1$ wgrib2 junk -if "^(1|2):" -grid_def -else -s -ilat 2 -endif
    -1:0
    -2:172
    -3:344:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19:grid pt 2,lon=40.000000,lat=41.000000,val=12130.2
    -4:493:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19:grid pt 2,lon=40.000000,lat=41.000000,val=218
    -5:639:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19:grid pt 2,lon=40.000000,lat=41.000000,val=32
    -6:785:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19:grid pt 2,lon=40.000000,lat=41.000000,val=4.3
    -7:931:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19:grid pt 2,lon=40.000000,lat=41.000000,val=7.2
    -..
    -
    -
    - -Uses of -new_grid location (location_list) UUID out - -The -new_grid option is usually used to transform -from one grid to another. -The -new_grid location option can be used to interpolate -from a regular grid to an arbitrary set of locations. With this option, you -can choose nearest neighbor, bilinear and under special circumstances spectral -interpolation. This new feature allows you to efficiently transform to -arbitrary locations. - -

    -See also: --grid_def, - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grid_changes.html b/web_docs/grid_changes.html deleted file mode 100644 index d2938b1..0000000 --- a/web_docs/grid_changes.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -grid_changes - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - count - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-cout -
     
    - -

    wgrib2: -grid_changes

    -
    - - -

    Introduction

    - -

    -The -grid_changes option is a safety option. -Normally we don't expect the grid to change within a grib file, and many -programs would fail if the grid did change. Wgrib2 will work if the -grid changes but it would work much slower. (Each grid change would -require a recalculation of the grid parameters such as the the -grid point locations if needed.) -The -grid_changes option prints -to stderr, the number of times the grid changed during processing -of the file. Only grib (sub-)messages that were processed and not -skipped by a -match or similar option will count. - -

    Usage

    -

    - -

    --grid_changes
    -
    - -

    Example

    -

    - -

    -$ wgrib2 fcst.grb2 -bin fcst.bin -grid_changes -count
    --sh-3.00$ wgrib2 fcst.grb2 -bin fcst.bin -grid_changes
    -1:4:d=2007032600:HGT:1000 mb:anl:
    -2:422561:d=2007032600:HGT:1000 mb:3 hour fcst:
    -Good: only one grid
    -number of records: 2
    -
    - -In the above example, we converted the file to binary. It consisted -of a single grid and two records. - -

    -See also: -count -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sep 13, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grid_def.html b/web_docs/grid_def.html deleted file mode 100644 index 36fbb64..0000000 --- a/web_docs/grid_def.html +++ /dev/null @@ -1,301 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -grid_def - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grid_def -
     
    - -

    wgrib2: -grid_def

    -
    - - -

    Introduction

    - -

    When wgrib2 processes a field, it often calculates the longitude -and latitude (location) of each grid point. Wgrib2 doesn't do the calculation -when one of the following conditions are true -

      -
    1. the locations of the grid points are not needed by any of the options -
    2. the grid is the same as the previously processed grib message -
    3. wgrib2 does not know how to calculate the locations -
    - -

    -For some grids, wgrib2 does not know how to calculate the grid locations -and the grid locations are available from the center in the form of grib files. -Then you can use the -grid_def to add the grid -locations for wgrib2 processing. -The option, -grid_def checks to see if the grib message -is a longitude or latitude. If it is, the longitude or latitude is associated -with the longitude or latitude of the grid points. -Because of "2", wgrib2 will use these longitudes -or latitudes for the following fields until wgrib2 encountours a different -grid. - - -

    wgrib2 up to v2.0.5

    -

    Bug in the -grid_def option only allows -the option to work with grids with calculated grid locations. -(Passed testing but not that useful.) - -

    wgrib2 v2.0.6, v2.0.7

    - -
      -
    1. LOUV, LOPP or ELON will associate the data with the longitudes -
    2. LAUV, LAPP or NLAT will associate the data with the latitudes -
    - -

    wgrib2 v2.0.8+

    -
      -
    1. LOUV, LOPP, ELON or GEOLON will associate the data with the longitudes -
    2. LAUV, LAPP, NLAT or GEOLAT will associate the data with the latitudes -
    - - -

    wgrib2 v3.0.0+

    -With wgrib2 v3.0.0 can associated latitudes and longitudes using -rpn -and the "sto_lat" and "sto_lon" options. You can import double precision -lat and lons using -import_lonlat. - -

    Precision of the latitudes and longitudes

    -By default, grib2 stores angles to the millionth of a degree. This -requires the angles to be stored in double precision. Reading the -latitudes and longitudes in grib format could be done in double -precision but the current decoder is limited to 25 bits which is -basically single precision. If you need double precision lat and lon -values, use -import_lonlat. - -

    -

    Usage

    -
    --grib_def
    -  will alter the latitude or longitudes associated with the grid points
    -  when the variable is a latitude or longitude field
    -

    - -

    Example

    - -For -grid_def to work, the latitude and longitudes have -processed prior the to remaining grids. The file, icon.grb, satifies this requirement. - -
    -$ 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:
    -
    - -An additional requirement is the grids be the same. -
    -$ wgrib2 icon.grb -grid
    -1:0:grid_template=101:
    -	General Unstructured Grid grid=26 ref_grid=1 uuid=a27b8de6-18c4-11e4-820a-b5b098c6a5c0
    -
    -2:5898409:grid_template=101:
    -	General Unstructured Grid grid=26 ref_grid=1 uuid=a27b8de6-18c4-11e4-820a-b5b098c6a5c0
    -
    -3:11796818:grid_template=101:
    -	General Unstructured Grid grid=26 ref_grid=1 uuid=a27b8de6-18c4-11e4-820a-b5b098c6a5c0
    -
    -

    -A more precise method of identifying identical grids is by - -

    -$ wgrib2 icon.grb -checksum 3     (Section 3 is the grid defininition template)
    -1:0:sec3_cksum=470959557
    -2:5898409:sec3_cksum=470959557
    -3:11796818:sec3_cksum=470959557
    -
    - -Using wgrib2 v3.0.0+, we can get a 2x2 degree lat-lon grid by, - -
    -$ wgrib2 icon.grb -grid_def -not_if ":GEO(LAT|LON):" -s -lola 0:180:2 -90:91:2 lola.grb grib -endif
    -1:0
    -2:5898409
    -3:11796818:d=2019040900:TMP:2 m above ground:0-6 hour max fcst:
    -bash-4.1$ wgrib2 lola.grb -s -grid
    -1:0:d=2019040900:TMP:2 m above ground:0-360 min max fcst::grid_template=0:winds(N/S):
    -	lat-lon grid:(180 x 91) units 1e-06 input WE:SN output WE:SN res 48
    -	lat -90.000000 to 90.000000 by 2.000000
    -	lon 0.000000 to 358.000000 by 2.000000 #points=16380
    -
    -The -not_if is used so that GEOLAT and GEOLON fields are not interpolated.
    -
    - -For wgrib2 up to v2.0.6 and, -grid_def did not recognize GEOLAT and GEOLON. -As a result, the location had to be converted to NLAT and ELON which are -recognized. NLAT and ELON are NCEP local variables, so the center has to -be changed to 7 which is NCEP by the GRIB standard. - -
    -$ 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 ":GEO(LAT|LON):" -s -lola '0:180:2' '-90:91:2' lola.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::d=2019040900:TMP:local level type 103 2:0-6 hour max fcst:
    -
    -

    With wgrib2 v3.0.0, you can also use -rpn to update the latitude and -longitudes. - -

    -$ wgrib2 icon.grb icon.grb -if ":GEOLAT:" -rpn sto_lat -endif -if ":GEOLON:" -rpn sto_lon -endif \
    -  -not_if ":GEO(LAT|LON):" -s -lola "0:180:2" "-90:91:2" lola.grb grib -endif
    -
    -
    -See also: 
    --rpn
    -
    -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: April 10, 2019 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/grid_id.html b/web_docs/grid_id.html deleted file mode 100644 index 9e0e0f9..0000000 --- a/web_docs/grid_id.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -grid_id - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-grid_id -
     
    - -

    wgrib2: -grid_id

    -
    - - -

    Introduction

    - -

    -The option, -grid_id, is for the development -of the Proj4 interface. This option may change or disappear -in future versions of wgrib2. -

    - -See also: - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 30, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/gridout.html b/web_docs/gridout.html deleted file mode 100644 index 3491ad5..0000000 --- a/web_docs/gridout.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -gridout - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-gridout -
     
    - -

    wgrib2: -gridout

    -
    - - -

    Introduction

    - -

    -Many grib message contain grids of the following form: grid_val(NX,NY), -longitude(NX,NY) and latitude(NX,NY). Common exceptions are spectral -data, thinned grids and staggered grids. If the grib message is -of the first form, then you can use the -gribout -option to print out i, j, latitude(i,j), longitude(i,j) - -

    -

    Usage

    -

    -

    --gridout FILE
    -   FILE is an output of the command
    -   if grid is of the form: grid_val(nx,ny), lat(nx,ny), lon(nx,ny)
    -     print ((i, j, lat(i,j), lon(i,j), i=1,nx), j=1,ny)
    -     using the format "%10i,%10i, %.3f, %.3f\n"
    -
    -     FILE will be a CSV file with the latitudes and longitudes of the grid points
    -
    - - -

    Example

    -
    -$ wgrib2 small.grb2 -grid
    -1:0:grid_template=0:winds(N/S):
    -	lat-lon grid:(2 x 2) units 1e-06 input WE:SN output WE:SN res 48
    -	lat 20.000000 to 28.000000 by 8.000000
    -	lon 0.000000 to 10.000000 by 10.000000 #points=4
    -$ wgrib2 small.grb2 -gridout grid.txt
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -$ cat grid.txt
    -         1,         1, 20.000, 0.000
    -         2,         1, 20.000, 10.000
    -         1,         2, 28.000, 0.000
    -         2,         2, 28.000, 10.000
    -
    - -

    -See also: --grid, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 27, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/h.html b/web_docs/h.html deleted file mode 100644 index 873054d..0000000 --- a/web_docs/h.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -h - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-h -
     
    - -

    wgrib2: -h

    -
    - - -

    Introduction

    - -

    -The -h option lists the common options. - -

    --sh-2.05b$ ./wgrib2 -h
    -wgrib2 v0.1.6 1/2008 wesley ebisuzaki, Jaakko Hyvätti, Karl Pfeiffer, Manfred Schwarb, Kristian Nilssen, Sergey Varlamov
    - -0xSec           inv  X      Hex dump of section X (0..8)
    - -bitmap          inv         bitmap mode
    - -center          inv         center
    - -ctl_inv         inv         ctl inventory dump (for g2ctl)
    - -disc            inv         discipline (code table 0.0)
    - -domain          inv         max limit for n/s/e/w
    - -ens             inv         ensemble information
    - -ftime           inv         forecast time
    - -grid            inv         grid definition
    - -ij              inv  X Y    value of field at grid(X,Y) X=1,..,nx Y=1,..,ny
    - -ijlat           inv  X Y    lat,lon and grid value at grid(X,Y) X=1,..,nx Y=1,..,ny
    - -ilat            inv  X      lat,lon and grid value at Xth grid point, X=1,..,npnts
    - -lev             inv         level (code table 4.5)
    - -lev0            inv         level (for g2ctl)
    - -lola            inv  X..Z,A lon-lat grid values X=lon0:nlon:dlon Y=lat0:nlat:dlat Z=file A=[bin|text|spread]
    - -lon             inv  X Y    value at grid point nearest lon=X lat=Y
    - -max             inv         print maximum value
    - -min             inv         print minimum value
    - -MM              inv         month
    - -N_ens           inv         number of ensemble members
    - -nl              inv         inserts new line into inventory
    - -nlons           inv         number of longitudes for each latitude
    - -npts            inv         number of grid points
    - -nxny            inv         nx and ny of grid
    - -packing         inv         data packing mode
    -[rest is deleted]
    -
    - - -

    Usage

    -

    - -

    --h
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/header.html b/web_docs/header.html deleted file mode 100644 index 14832d1..0000000 --- a/web_docs/header.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -header - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-header/no_header -
     
    - -

    wgrib2: -header, -no_header

    -
    - - -

    Introduction

    - -

    -The -header and --no_header options -sets and clears the header flag. When the -header flag is set, binary and ieee is read and written -using f77-style header and trailers. -When a text file (as opposed to spread sheet or csv) is written, -a preliminary line with the grid dimension, "nx ny", -is written. The default is -header. - - -

    Usage

    -

    - -

    --header
    --no_header
    -
    - -

    Example

    -

    - -

    -$ wgrib2 -ens ens.grb -header -ieee data.ieee
    -1:0:HGT:ENS=+1
    -
    - -See also: --no_header, --big_endian, --little_endian, --ieee, --bin, --import_ieee, --import_bin -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/help.html b/web_docs/help.html deleted file mode 100644 index 9b56006..0000000 --- a/web_docs/help.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -help - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-help -
     
    - -

    wgrib2: -help

    -
    - - -

    Introduction

    - -

    -The -help options list the commands that match your query. For example, -suppose you want options that deal with time, then you would use the "-help time" option. -

    -$ wgrib2 -help time
    -wgrib2 v0.2.0.3beta3 10/2015 Wesley Ebisuzaki, Reinoud Bokhorst, John Howard, Jaakko Hyvätti, Dusan Jovic, 
    -Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Arlindo da Silva, Niklas Sondell, Sergey Varlamov
    -   stock build
    - -code_table_1.2  inv         code table 1.2 significance of reference time
    - -code_table_4.11 inv         code table 4.11 (first) type of time intervals
    - -code_table_4.11s inv         code table 4.11 (all) type of time intervals
    - -end_ft          inv         verf time = reference_time + forecast_time + stat. proc time (YYYYMMDDHH) (same as -vt)
    - -end_FT          inv         verf time = reference_time + forecast_time + stat. proc time (YYYYMMDDHHMMSS) (same as -VT)
    - -ftime           inv         forecast time
    - -MM              inv         reference time MM
    - -pds_fcst_time   inv         fcst_time(1) in units given by pds
    - -RT              inv         type of reference Time
    - -start_ft        inv         verf time = reference_time + forecast_time (YYYYMMDDHH) : no stat. proc time
    - -start_FT        inv         verf time = reference_time + forecast_time (YYYYMMDDHHMMSS) - no stat. proc time
    - -t               inv         reference time YYYYMMDDHH, -v2 for alt format
    - -T               inv         reference time YYYYMMDDHHMMSS
    - -unix_time       inv         print unix timestamp for rt & vt
    - -verf            inv         simple inventory using verification time
    - -vt              inv         verf time = reference_time + forecast_time, -v2 for alt format
    - -VT              inv         verf time = reference_time + forecast_time (YYYYMMDDHHMMSS)
    - -YY              inv         reference time YYYY
    - -count           misc        prints count, number times this -count was processed
    - -end             misc        stop after first (sub)message (save time)
    - -quit            misc        stop after first (sub)message (save time)
    - -set_ftime       misc X      set ftime
    - -set_ts_dates    misc X Y Z  changes date code for time series X=YYYYMMDDHH(mmss) Y=dtime Z=#msgs/date
    - -ave             out  X Y    average X=time step, Y=output grib file needs file is special order
    - -fcst_ave        out  X Y    average X=time step, Y=output grib file needs file is special order
    - -nc_grads        init        require netcdf file to be grads v1.9b4 compatible (fixed time step only)
    - -nc_nlev         init X      netcdf, X = max LEV dimension for {TIME,LEV,LAT,LON} data
    - -nc_time         init X      netcdf, [[-]yyyymmddhhnnss]:[dt{s[ec]|m[in]|h[our]|d[ay]}], [-] is for time alignment only
    - -no_nc_grads     init        netcdf file may be not grads v1.9b4 compatible, variable time step
    - -no_nc_time      init        netcdf, disable previously defined initial or relative date and time step
    -
    - - -

    Usage

    -

    -

    --help search-term
    --help all
    -
    - -

    Example

    -
    -$ wgrib2 -help speed
    -wgrib2 v0.2.0.5beta5 6/2016  Wesley Ebisuzaki, Reinoud Bokhorst, John Howard, Jaakko Hyvätti, Dusan Jovic, Daniel Lee, 
    -Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Gregor Schee, Arlindo da Silva, Niklas Sondell, 
    -Sam Trahan, Sergey Varlamov
    -   stock build
    - -mysql_speed     out  7 args H=[host] U=[user] P=[password] D=[db] T=[table] W=[western_lons:0|1] PV=[remove unlikely:0|1]
    - -wind_speed      out  X      calculate wind speed, X = output gribfile (U then V in datafile)
    -
    - -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 27, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/i.html b/web_docs/i.html deleted file mode 100644 index d0cd62e..0000000 --- a/web_docs/i.html +++ /dev/null @@ -1,319 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -i -i_file - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-i -i_file -
     
    - -

    wgrib2: -i, -i_file

    -
    - - -

    Introduction

    - -

    -The -i option specifies that wgrib2 should read -STDIN to determine the records to be processed. -The -i_file option is similar except that -wgrib2 reads file a user-specified file to determine the records to be processed. -Some -of the common uses of -i can also be -done with the -match option. - -

    Slicing and Dicing

    -

    -Wgrib2 is a program to "slice and dice" grib2 files. Suppose you have a big grib file -but you only want the 2-meter temperature and the precipitation. Rather than fill up -your disk with big files, you can easily extract the required fields. - -

    -The first step is to figure what is in the grib file. - -

    --sh-2.05b$ wgrib2 test.grb2 -s
    -1:0:d=2005090200:HGT:1000 mb:60 hour fcst
    -2:133907:d=2005090200:HGT:975 mb:60 hour fcst
    -3:263511:d=2005090200:HGT:950 mb:60 hour fcst
    -4:389058:d=2005090200:HGT:925 mb:60 hour fcst
    -5:511037:d=2005090200:HGT:900 mb:60 hour fcst
    -6:630256:d=2005090200:HGT:850 mb:60 hour fcst
    -7:745505:d=2005090200:HGT:800 mb:60 hour fcst
    -....
    -291:37540403:d=2005090200:GPA:1000 mb:60 hour fcst
    -292:37677072:d=2005090200:GPA:500 mb:60 hour fcst
    -293:37791941:d=2005090200:5WAVA:500 mb:60 hour fcst
    -
    - -

    -Information overload. Lets see if you can find the desired variables. - -

    --sh-2.05b$ wgrib2 test.grb2 -s | grep ':TMP:2 m'
    -265:35107588:d=2005090200:TMP:2 m above ground:60 hour fcst
    -
    -Found the 2-m temperature, can we find the precipitation? -
    --sh-2.05b$ wgrib2 test.grb2 -s | grep ':PRATE:'
    -260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    -
    - -Yes. we found the fields. Now we need to combine the above into a -single command using the or option of egrep; i.e., egrep '(A|B)'. - -
    --sh-2.05b$ wgrib2 test.grb2 -s | egrep '(:TMP:2 m|:PRATE:)'
    -260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    -265:35107588:d=2005090200:TMP:2 m above ground:60 hour fcst
    -
    - -Now that we have selected the records, we can send the output (inventory) back -into wgrib2 to manipulate. - -
    --sh-2.05b$  wgrib2 test.grb2 -s | egrep '(:TMP:2 m|:PRATE:)' | wgrib2 -i test.grb2 -grib small.grb
    -260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    -265:35107588:d=2005090200:TMP:2 m above ground:60 hour fcst
    -
    -The above command made a grib2 file consisting of the precipation (PRATE) and 2-m temperature (TMP). -
    --sh-2.05b$ ls -l test.grb2 small.grb
    --rw-r--r--    1 wd51we   wd5        212429 2006-10-16 15:08 small.grb
    --rwxr-xr-x    1 wd51we   wd5      37862776 2006-05-25 15:16 test.grb2
    -
    -As you can see, the new file is much smaller than the original file. - -
    --sh-2.05b$  wgrib2 small.grb
    -1:0:d=2005090200:PRATE:surface:54-60 hour fcst
    -2:110654:d=2005090200:TMP:2 m above ground:60 hour fcst
    -
    - -As expected, the new grib file only has the desired two fields. - -

    Decoding a Single record

    - -

    Another use of the -i option is to specify the field to decode. - -

    --sh-2.05b$ wgrib2 test.grb2 -s | grep ':PRATE:' | wgrib2 -i test.grb2 -spread field.txt
    -260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    --sh-2.05b$ head field.txt
    -lon,lat,PRATE surface d=2005090200 54-60 hour fcst
    -0,-90,5e-06
    -0.5,-90,5e-06
    -1,-90,5e-06
    -1.5,-90,5e-06
    -2,-90,5e-06
    -2.5,-90,5e-06
    -3,-90,5e-06
    -3.5,-90,5e-06
    -4,-90,5e-06
    -
    - -

    -i_file

    - -The -i_file MY_FILE option reads the inventory from -file, MY_FILE. The following 3 lines are equivalent. - -
    -cat FILE.inv | grep UGRD | wgrib2 -i FILE.grb -bin data.bin
    -
    -cat FILE.inv | wgrib2 -i FILE.grb -match UGRD -bin data.bin
    -
    -wgrib2 -i_file FILE.inv FILE.grb -match UGRD -bin data.bin 
    -
    - -

    Usage

    -

    - -

    --i
    --i_file FILE
    -
    - -

    Speed

    - -

    -The following command is very common so it incorporated -within wgrib2. This speeds up the operation by eliminating -two program executions and duplicate reads. - -

    -wgrib2 gribfile | grep "string" | wgrib2 -i gribfile (other options)
    -
    -is equivalent to 
    -
    -wgrib2 gribfile -match "string" (other options)
    -
    - -However, the -i option can be more efficient -when making multiple extractions from a file. For example, - -
    -wgrib2 gribfile >gribfile.inv
    -grep "string1" gribfile.inv | wgrib2 -i gribfile (other options)
    -grep "string2" gribfile.inv | wgrib2 -i gribfile (other options)
    -grep "string3" gribfile.inv | wgrib2 -i gribfile (other options)
    -
    -is faster than
    -
    -wgrib2 gribfile -match "string1" (other options)
    -wgrib2 gribfile -match "string2" (other options)
    -wgrib2 gribfile -match "string3" (other options)
    -
    - -

    -See also: --match, --not, --d, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/i_file.html b/web_docs/i_file.html deleted file mode 100644 index d0cd62e..0000000 --- a/web_docs/i_file.html +++ /dev/null @@ -1,319 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -i -i_file - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-i -i_file -
     
    - -

    wgrib2: -i, -i_file

    -
    - - -

    Introduction

    - -

    -The -i option specifies that wgrib2 should read -STDIN to determine the records to be processed. -The -i_file option is similar except that -wgrib2 reads file a user-specified file to determine the records to be processed. -Some -of the common uses of -i can also be -done with the -match option. - -

    Slicing and Dicing

    -

    -Wgrib2 is a program to "slice and dice" grib2 files. Suppose you have a big grib file -but you only want the 2-meter temperature and the precipitation. Rather than fill up -your disk with big files, you can easily extract the required fields. - -

    -The first step is to figure what is in the grib file. - -

    --sh-2.05b$ wgrib2 test.grb2 -s
    -1:0:d=2005090200:HGT:1000 mb:60 hour fcst
    -2:133907:d=2005090200:HGT:975 mb:60 hour fcst
    -3:263511:d=2005090200:HGT:950 mb:60 hour fcst
    -4:389058:d=2005090200:HGT:925 mb:60 hour fcst
    -5:511037:d=2005090200:HGT:900 mb:60 hour fcst
    -6:630256:d=2005090200:HGT:850 mb:60 hour fcst
    -7:745505:d=2005090200:HGT:800 mb:60 hour fcst
    -....
    -291:37540403:d=2005090200:GPA:1000 mb:60 hour fcst
    -292:37677072:d=2005090200:GPA:500 mb:60 hour fcst
    -293:37791941:d=2005090200:5WAVA:500 mb:60 hour fcst
    -
    - -

    -Information overload. Lets see if you can find the desired variables. - -

    --sh-2.05b$ wgrib2 test.grb2 -s | grep ':TMP:2 m'
    -265:35107588:d=2005090200:TMP:2 m above ground:60 hour fcst
    -
    -Found the 2-m temperature, can we find the precipitation? -
    --sh-2.05b$ wgrib2 test.grb2 -s | grep ':PRATE:'
    -260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    -
    - -Yes. we found the fields. Now we need to combine the above into a -single command using the or option of egrep; i.e., egrep '(A|B)'. - -
    --sh-2.05b$ wgrib2 test.grb2 -s | egrep '(:TMP:2 m|:PRATE:)'
    -260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    -265:35107588:d=2005090200:TMP:2 m above ground:60 hour fcst
    -
    - -Now that we have selected the records, we can send the output (inventory) back -into wgrib2 to manipulate. - -
    --sh-2.05b$  wgrib2 test.grb2 -s | egrep '(:TMP:2 m|:PRATE:)' | wgrib2 -i test.grb2 -grib small.grb
    -260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    -265:35107588:d=2005090200:TMP:2 m above ground:60 hour fcst
    -
    -The above command made a grib2 file consisting of the precipation (PRATE) and 2-m temperature (TMP). -
    --sh-2.05b$ ls -l test.grb2 small.grb
    --rw-r--r--    1 wd51we   wd5        212429 2006-10-16 15:08 small.grb
    --rwxr-xr-x    1 wd51we   wd5      37862776 2006-05-25 15:16 test.grb2
    -
    -As you can see, the new file is much smaller than the original file. - -
    --sh-2.05b$  wgrib2 small.grb
    -1:0:d=2005090200:PRATE:surface:54-60 hour fcst
    -2:110654:d=2005090200:TMP:2 m above ground:60 hour fcst
    -
    - -As expected, the new grib file only has the desired two fields. - -

    Decoding a Single record

    - -

    Another use of the -i option is to specify the field to decode. - -

    --sh-2.05b$ wgrib2 test.grb2 -s | grep ':PRATE:' | wgrib2 -i test.grb2 -spread field.txt
    -260:34814859:d=2005090200:PRATE:surface:54-60 hour fcst
    --sh-2.05b$ head field.txt
    -lon,lat,PRATE surface d=2005090200 54-60 hour fcst
    -0,-90,5e-06
    -0.5,-90,5e-06
    -1,-90,5e-06
    -1.5,-90,5e-06
    -2,-90,5e-06
    -2.5,-90,5e-06
    -3,-90,5e-06
    -3.5,-90,5e-06
    -4,-90,5e-06
    -
    - -

    -i_file

    - -The -i_file MY_FILE option reads the inventory from -file, MY_FILE. The following 3 lines are equivalent. - -
    -cat FILE.inv | grep UGRD | wgrib2 -i FILE.grb -bin data.bin
    -
    -cat FILE.inv | wgrib2 -i FILE.grb -match UGRD -bin data.bin
    -
    -wgrib2 -i_file FILE.inv FILE.grb -match UGRD -bin data.bin 
    -
    - -

    Usage

    -

    - -

    --i
    --i_file FILE
    -
    - -

    Speed

    - -

    -The following command is very common so it incorporated -within wgrib2. This speeds up the operation by eliminating -two program executions and duplicate reads. - -

    -wgrib2 gribfile | grep "string" | wgrib2 -i gribfile (other options)
    -
    -is equivalent to 
    -
    -wgrib2 gribfile -match "string" (other options)
    -
    - -However, the -i option can be more efficient -when making multiple extractions from a file. For example, - -
    -wgrib2 gribfile >gribfile.inv
    -grep "string1" gribfile.inv | wgrib2 -i gribfile (other options)
    -grep "string2" gribfile.inv | wgrib2 -i gribfile (other options)
    -grep "string3" gribfile.inv | wgrib2 -i gribfile (other options)
    -
    -is faster than
    -
    -wgrib2 gribfile -match "string1" (other options)
    -wgrib2 gribfile -match "string2" (other options)
    -wgrib2 gribfile -match "string3" (other options)
    -
    - -

    -See also: --match, --not, --d, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ieee.html b/web_docs/ieee.html deleted file mode 100644 index c80f0e6..0000000 --- a/web_docs/ieee.html +++ /dev/null @@ -1,221 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ieee - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ieee -
     
    -

    wgrib2: -ieee

    - -

    Introduction

    - -

    -The -ieee option writes the grid values to a specified -file in IEEE format (C: float, Fortran: real). The default endian is "big", -but that can be changed by the - -big_endian and - -little_endian options. -

    -

    -By default, the data are written out in -WE:SN order (see -order option) with f77 header/trailer (see -no_header option). The -undefined value is 9.999e20. The output format is unchanged from wgrib except -the order can now be specified. - -

    The default is to write a 4 byte header and trailer with the record size in bytes. -No header and trailer are written if the header flag is off by -the -no_header option. - -

    The default is write the grid point data in WE:SN order. The ordering of the data -can be changed to raw or WE:NS by the -order option. - -

    The default endian of the header, trailer and data are in big endian order. This can -be changed to little endian by the -little_endian option. - -

    The -ieee option is slower than the -bin option and may not be exact on an ieee -machine because all grid point data is converted from the native format into ieee format -by a software routine. - -

    Usage

    -

    - -

    --ieee file_name
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -s | grep ":RH:2 m" | wgrib2 -i test.grb2 -ieee data.bin
    -285:36796469:d=2005090200:RH:2 m above ground:60 hour fcst
    -
    - -The above line extracts the 2 meter RH from file test.grb2 and writes it in data.bin - -
    -
    -      wgrib                ==>                 wgrib2
    -
    -      -header -ieee -o out.bin                 -header -order raw -ieee out.bin
    -      -ieee -o out.bin                         -order raw -ieee out.bin
    -
    -
    - - -

    -See also: -text, --netcdf --spread --bin --big_endian --little_endian -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, March 2, 2021. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/if.html b/web_docs/if.html deleted file mode 100644 index d10601a..0000000 --- a/web_docs/if.html +++ /dev/null @@ -1,329 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -if, -not_if - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -if,-not_if -
     
    - -

    wgrib2: -if, -not_if

    -
    - - -

    Introduction IF block structure

    - -

    -The -if option returns either true or false. What happens -next depends on whether you are using Version 1 or Version 2 of the "If blocks". -Prior to wgrib2 v3.0.0, you only get Version 1. With wgrib2 3.0.0+, you can use -either Version 1 or 2 but not both at the same time. - -

    Version 1 If blocks

    - -

    -For Version 1 "IF blocks", the -if option returns true or false. If true, then -all the options up to and including the next "output" option are executed. If false, then -all the options up to and including the next "output" option are not executed. Options following -the output option are executed as normal.With Version 1, nesting of IF blocks is not defined. The -option -fi is a NULL output option. Note that -fi -cannot be used in Version 2 "IF blocks". -

    Definition

    -
    -    wgrib2 (...) [if] [list of non-ouput options] [output option]
    -
    -   [if] = -if, -not_if, -if_fs, -not_if_fs, -if_n, -if_rec
    -
    -   if [if] returns the value of false, the list of non-output options
    -                                       and the next output option are not executed
    -           returns the value of true, the following options are executed
    -   [output option] is the terminator of the if block
    -
    -   If blocks should not be nested. The results are undefined.
    -
    - -

    Example

    -
    -     wgrib2 gribfile -if ":(UGRD|VGRD):" -grib winds.grb \
    -                     -if ":TMP:" -grib tmp.grb \
    -                     -if ":HGT:" -grib hgt.grb \
    -                     -not_if ":(UGRD|VGRD|TMP|HGT):" -grib rest.grb
    -
    -     note: -grib is an output option
    -
    -     wgrib2 gribfile -new_grid_interpolation bilinear \
    -        -if ":SOTYP:" -new_grid_interpolation neighbor -fi \
    -        ...
    -
    -     note: -fi is an output option
    -
    - - -

    Version 2 IF blocks (introduced wgrib2 v3.0.0)

    - -

    For Version 2 of the IF blocks, wgrib2 uses --if, -elseif, -else and --endif options to implement a proper IF blocking structure. IF blocks -can be nested. Note, the "if" flag is reset prior to processing of a record. - -

    Definition

    - -
    -1. The if blocks can now be nested, and are terminated by an -endif.
    -2. Within the if block, you can have -else and -elseif options.
    -3. The -elseif options must proceed the -else option.
    -4. The -fi option is not allowed.
    -5. Version 1 and Version 2 if blocks cannot be mixed.
    -
    - -

    Example 1

    - -
    -     wgrib2 gribfile -if ":(UGRD|VGRD):" -grib winds.grb \
    -                     -elseif ":TMP:" -grib tmp.grb \
    -                     -elseif ":HGT:" -grib hgt.grb \
    -                     -else -grib rest.grb -endif
    -
    -     wgrib2 gribfile -new_grid_interpolation bilinear \
    -        -if ":SOTYP:" -new_grid_interpolation neighbor -endif \
    -        ...
    -
    - -

    Example 2

    - -The SNOHF and Clear Sky radienaces were converted from the nemsio file as -an instantaneous forecast rather an average. (A problem with the nemsio -file.) So I needed to change the -grib files. The new IF blocks make the code look readable. The old -IF blocks would be a mess. - -
    -# bash: fix SNOHF and CS(radiances) timing info
    -for f in *.grb
    -do
    -  wgrib2 $f \
    -    -if "(:SNOHF:|:CS)" \
    -      -if ":3 hour fcst:" -set_ftime "0-3 hour ave fcst" -endif  \
    -      -if ":6 hour fcst:" -set_ftime "3-6 hour ave fcst" -endif  \
    -      -if ":9 hour fcst:" -set_ftime "6-9 hour ave fcst" -endif \
    -      -if ":12 hour fcst:" -set_ftime "9-12 hour ave fcst" -endif \
    -      -if ":15 hour fcst:" -set_ftime "12-15 hour ave fcst" -endif \
    -    -endif \
    -    -grib ../test/$f
    -done
    -
    - -

    - -

    Limitations

    - -

    The Version 1 limits, -the maximum number of -if options on a command -line is limited by (1) system limit of open files -(2) maximum length of a command line, -(3) maximum number of regular expressions allowed MAX_MATCH (wgrib.h), -and (4) maximum number of parsed arguments N_ARGLIST (wgrib.h). - -

    The Version 2 limits include the Version 1 limits and include a limit -of the number of nested IF blocks (10). - -

    Version 1 and Version 2 IF blocks cannot be mixed. The --fi option is restricted to Version 1 IF blocks. -There are NO plans to eliminate Version 1 IF blocks. However, -Version 2 IF blocks are recommended for future development. - -

    Introduction -if and -not_if

    - -

    Usage

    -

    - -

    --if X
    -
    -X is a regular expression
    -sets the "run_flag" if X matches the "match inventory",
    -used to control the execution of following options
    -
    - -

    Future Changes

    -

    -The format of the "match inventory" has evolved and will continue to evolve. -The rule for future changes is that new items in the "match inventory" will be added -as the second last item. Consequently the last item in the inventory will always -be ":vt=YYYYMMDDHH:". In order to future proof your --match, and -not selections, you -must not include any item before the ":vt=YYYYMMDD:" field. - -

    -    -match ":vt=2011111500:"                  good
    -    -not ":vt=2011111500:$"                   good (dollar sign matches the end of the line)
    -    -not ":n=10:vt=2011111500:"               bad (item before :vt=)
    -    -match ":RH:975 mb:anl::vt=2010050806:"   bad (item before :vt=)
    -
    - -Some recent changes (as of Nov 2011) to the match inventory include: - -
      -
    • adding the "extended name of the variable", ex. TMP.prob_<273 -
    • adding the inventory number, ex. n=10 -
    • adding ensemble/chemical/probability information (-misc) -
    - - -

    -See also: -not, --end, --match, --i, --if. --if_fs. --fi. --set_regex. -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, March 18, 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/if_block.html b/web_docs/if_block.html deleted file mode 100644 index e8ce92e..0000000 --- a/web_docs/if_block.html +++ /dev/null @@ -1,216 +0,0 @@ - - - - Climate Prediction Center - wgrib2: IF block structure - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 IF block structure -
     
    - -

    wgrib2: IF block structure

    - -

    Introduction IF block structure

    - -

    -Wgrib2 (v3.0.0+) has an IF block structure for conditional execution. The -block structure is - -

    -  IF-option
    -    r_options
    -  ELSE-IF-option    |   can be repeated 0-N times
    -    r_options       |
    -  ELSE-option           |   optional
    -    r_options           |
    -  ENDIF-option
    -
    -
    -IF-option: -if, -if_fs, -if_n, -if_rec, -if_reg, -not_if, -not_if_fs
    -ELSE-IF-option: -elseif, -elseif_fs, -elseif_n, -elseif_rec, -elseif_reg
    -ELSE-option: -else
    -ENDIF-option: -endif
    -r_options: may not include: -fi
    -           should not include setup (init) options
    -             setup (init) options are executed prior to reading the grib data
    -             and ignore the IF-options, ELSE-IF-options, ELSE-options and 
    -             ENDIF-options
    -           may include IF-BLOCKS 
    -
    -Maybe I should have used Backus-Naur form (BNF) to describe the IF block structure.
    -
    -The IF blocks can be nested up to 10 blocks deep.
    -
    - -

    -The version 1 of the IF block structure is even easier. - - -

    -  IF-option
    -  r_options
    -  o_option
    -
    -IF-option: -if, -if_fs, -if_n, -if_rec, -if_reg, -not_if, -not_if_fs
    -r_option: may not include: IF-option, o_option
    -           should not include setup (init) options
    -             setup (init) options are executed prior to reading the grib data
    -             and are executed ignoring the IF-options
    -o_option: an output option
    -
    - -While version 1 is compatible with wgrib2 v3.0.0+, it is recommended that you -adopt version 2 IF blocks because it is more powerful and easier to understand. - -

    -See also: --endif, --if. --else. -

    - - - - - - - - -

    - - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page: March 16, 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/if_delayed_error.html b/web_docs/if_delayed_error.html deleted file mode 100644 index 6ad34f8..0000000 --- a/web_docs/if_delayed_error.html +++ /dev/null @@ -1,217 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -if_delayed_error - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -if_delayed_error -
     
    - -

    wgrib2: -if_delayed_error

    -
    - - -

    Introduction

    - -

    -Wgrib2 v3.0.1 introduces delayed errors. The (-if_delayed_error) allows you -to check the delayed error flag and perhaps run a process to fixed the delayed errors. -Unlike most -if options, there isn't an equivalent --elseif_delayed_error option. -

    -If you are interested in writting an "if" option for wgrib2, the source code, If_delayed_error.c, -is an ideal example. - -

    Example

    - - -fields with delayed errors will have the full inventory printed - -$ wgrib2 bad_n_header.grb2 -if_delayed_error -s -endif -reset_delayed_error -1:0:delayed_error=0 -2:154212:delayed_error=0 -3:308556:delayed_error=0 -4:311920:delayed_error=0 -5:312107:delayed_error=0 -6:324894:delayed_error=0 -7:325081:delayed_error=0 -8:330180:delayed_error=0 -9:345421:delayed_error=0 -10:401570:delayed_error=0 -11:401757:delayed_error=0 -12:401944:delayed_error=0 -13:477882:delayed_error=0 -14:615677:delayed_error=0 -15:803947:delayed_error=0 -16:899104:delayed_error=0 -17:1041002:delayed_error=0 -18:1190330:delayed_error=0 -19:1194054:delayed_error=0 -** ERROR bad grib message: Statistical Processing bad n=0 ** -20:1194241:d=2017041700:LRGHR:1 hybrid level:::delayed_error=18 -21:1229461:delayed_error=0 -22:1383477:delayed_error=0 -23:1383916:delayed_error=0 -24:1384103:delayed_error=0 -.. - - - -

    Usage

    -

    - -

    --if_delayed_error   will enter if block if there is a delayed error
    -
    - -

    -See also: - -reset_delayed_error, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created Dec 14, 2020. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/if_fs.html b/web_docs/if_fs.html deleted file mode 100644 index 329101d..0000000 --- a/web_docs/if_fs.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -if_fs, -not_if_fs - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -if_fs,-not_if_fs -
     
    - -

    wgrib2: -if_fs, -not_if_fs

    -
    - - -

    Introduction

    - -

    -The -if_fs option is the same as the -the -if option except it takes "fixed strings" -rather than extended regular expressions. The --not_if_fs is the same as the -not_if option -except it takes "fixed strings". - -

    The "fixed string" options have the advantage that matches do not use the -regex wildcards. For example, "-if 3.0" will match "300" because the period is -a wildcard character that matches any character including a zero. - - -

    Usage

    -

    - -

    --if_fs X
    --not_if_fs X
    -
    -X is a fixed string (not a regular expression)
    -
    - - - -

    -See also: -if, -See also: -not_if, -See also: -not_if_fs, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, modified 3/2019 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/if_n.html b/web_docs/if_n.html deleted file mode 100644 index e68c442..0000000 --- a/web_docs/if_n.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -if_n - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -if_n -
     
    - -

    wgrib2: -if_n

    -
    - - -

    Introduction

    - -

    -The -if_n option is an -if for a range of inventory numbers. -The -if_n option uses the same syntax as the "for_n" option. -If you want to operate on -inventory records 10 to 20, you would use the parameter 10:20. -If you want to operate on all the even inventory records from 10 to 20, you would -use 10:20:2. The restrictions are the start value must be less than -the ending value and the step has to be greater than zero. -

    - -

    -The -if_n option is similar to the --for_n option in that they both select a range of invetory records. -The difference is that the -for_n option selects the range -of records that wgrib2 will process. With the -the -if_n option, all the records will be processed -but only the additional processing within the -if block will be only -done for the selected records. The -for_n option can be much -faster if the field has to be decoded. With the -for_n option, -only the selected records need to be docoded whereas all the records would be decoded -when using the -if_n option. The command line, however, -can have multiple -if_n options. -

    - -

    Usage

    -

    - -

    --if_n I:J:K        same as for n = I to J by K
    --if_n I:J          same as for n = I to J by 1
    --if_n I::K         same as for n = I to MAX_INTEGER by K
    --if_n I            same as for n = I to MAX_INTEGER by 1
    -
    - - - -

    Example

    -

    - -

    - $ wgrib2 file.grb2  -if_n 4:5 -s -fi
    -4:13335:d=2008120200:RH:750 mb:anl:
    -5:17098:d=2008120200:TMP:2743 m above mean sea level:anl:
    -
    - -See also: -match --if_rec --for --for_n -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/if_rec.html b/web_docs/if_rec.html deleted file mode 100644 index 2c6548b..0000000 --- a/web_docs/if_rec.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -if_rec - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -if_rec -
     
    - -

    wgrib2: -if_rec

    -
    - - -

    Introduction

    - -

    -The -if_rec option is an -if for a range of record numbers. -The -if_rec option uses the same syntax as the "for" option. -If you want to operate on -records 10 to 20, you would use the parameter 10:20. -If you want to operate on all the even records from 10 to 20, you would -use 10:20:2. The restrictions are the start value must be less than -the ending value and the step has to be greater than zero. -

    - -

    -The -if_rec option is similar to the --for option in that they both select a range of records. -The difference is that the -for option selects the range -of records that wgrib2 will process. With the -the -if_rec option, all the records will be processed -but only the additional processing within the -if block will be only -done for the selected records. The -for option can be much -faster if the field has to be decoded. With the -for option, -only the selected records need to be docoded whereas all the records would be decoded -when using the -if_rec option. The command line, however, -can have multiple -if_rec options. -

    - -

    Usage

    -

    - -

    --if_rec I:J:K        same as for n = I to J by K
    --if_rec I:J          same as for n = I to J by 1
    --if_rec I::K         same as for n = I to MAX_INTEGER by K
    --if_rec I            same as for n = I to MAX_INTEGER by 1
    -
    - - - -

    Example

    -

    - -

    - $ wgrib2 file.grb2  -if_rec 4:5 -s -fi
    -4:13335:d=2008120200:RH:750 mb:anl:
    -5:17098:d=2008120200:TMP:2743 m above mean sea level:anl:
    -
    - -See also: -match --if_n --for --for_n -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/if_reg.html b/web_docs/if_reg.html deleted file mode 100644 index e62219c..0000000 --- a/web_docs/if_reg.html +++ /dev/null @@ -1,232 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -if_reg - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -if_reg -
     
    - -

    wgrib2: -if_reg

    -
    - - -

    Introduction

    - -

    -The reverse polish notation calculator (-rpn) allows you -to manipulate the grid values and save the results in registers. The values in -the registers are persistent until they are cleared or the program (wgrib2) ends. -The persistent registers allow you to do calculations that require multiple -fields. For example, to calculate the wind speed, you have to save the zonal -wind in a register and the meridional wind in another register. When both -registers have values (U and V), you can then proceed with the wind speed -calculation. -The -if_reg option tests to see if specified registers have -been set. If the register have been set, then the options up to and including the -next output option are executed like with an -if option. -

    - -

    -Here is an example of computing the 500 mb wind speed. -

    -
    -$ wgrib2 a.grb -match ":[UV]grd:500 mb:anl:" \
    -     -if ":UGRD:" -rpn "sto_1" -fi \
    -     -if ":VGRD:" -rpn "sto_2" -fi \
    -     -if_reg 1:2 \
    -         -rpn "rcl_1:sq:rcl_2:sq:+:sqrt:clr_1:clr_2" \
    -         -set_var WIND \
    -         -grib_out out.grb
    -
    -     line 1: only process the U and V at 500 mb
    -     line 2: store U 500mb analysis in register 1
    -     line 3: store V 500mb analysis in register 2
    -     line 4: if (register 1 and register 2 have values then
    -     line 5: calculate the wind speed: sqrt(reg_1**2 + reg_2**2)
    -     line 6: set variable time to WIND (wind speed)
    -     line 7: write out the WIND data to a grib file
    -             -grib_out is an output option and ends the -if block
    -
    -     Note: this is a very simple script and that doesn't check the matching
    -     date code, grid type, etc.
    -
    - -

    With operational NCEP files, the V field immediately follows the corresponding U field. -If we assume that this is always true, then the following computes all the wind speeds. -

    - -
    -$ wgrib2 a.grb -match ":[UV]grd:" \
    -     -if ":UGRD:" -rpn "sto_1" -fi \
    -     -if ":VGRD:" -rpn "sto_2" -fi \
    -     -if_reg 1:2 \
    -         -rpn "rcl_1:sq:rcl_2:sq:+:sqrt:clr_1:clr_2" \
    -         -set_var WIND \
    -         -grib_out out.grb
    -
    - - - -

    Usage

    -

    - -

    --if_reg X
    -
    -X is a list of register names, ex. 1:2 or 2:4:7
    -
    - -

    -See also: - -if, --fi. - -rpn, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/if_structure.html b/web_docs/if_structure.html deleted file mode 100644 index 9fd65c1..0000000 --- a/web_docs/if_structure.html +++ /dev/null @@ -1,289 +0,0 @@ - - - - Climate Prediction Center - wgrib2: if structure - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 if structure -
     
    - -

    wgrib2: if structure

    -
    - - -

    Introduction

    - -

    -The "if" structure has been evolving in wgrib2. Up to wgrib2 v1.6.1 (1/2009), there were no "if" statements. -From wgrib2 v1.6.2 (2/2008) to v2.0.8 (2/2009), "if" statements were terminated by output statements, "if" -blocks could not be nested and there were no "else" statements. -Wgrib2 v3.0.0 (9/2020), introduced "else", "elseif", "endif" and nested "if" blocks. -The old and new style of "if" strutcture will continue to work but cannot be mixed on the -command line. - - -

    Old Style

    - -
    -    If statement = -if, -if_fs, -if_n, -if_rec, -if_reg, -not_if, -not_if_fs
    -
    -    If block is terminated by an output statement.
    -     -fi is a no operation, output statement
    -     -fi is often used to terminate a "if" block
    -    If blocks cannot be nested
    -
    - -

    New Style

    - -
    -    If statement = -if, -if_fs, -if_n, -if_rec, -if_reg, -not_if, -not_if_fs
    -    EsleIf statement = -elseif, -elseif_fs, -elseif_n, -elseif_rec, -elseif_reg
    -    Else statement = -else
    -    Endif statement = -endif
    -
    -    If block is terminated by an endif statement.
    -    If blocks can be nested (preset limit)
    -
    -    Types of If blocks
    -
    -    If statement
    -    ..
    -    optional Elseif statement      }  this block can be repeated 0-N time
    -    ..                             }
    -    optional Else statement
    -    ..
    -    Endif statement
    -
    -
    -

    Old Style vs New Style

    - -

    Wgrib2 3.0.0+ supports both old and new "if" structures. -Wgrib2 determines the style of "if" blocks during the parsing phase by, -

      -
    1. -fi option found, old style -
    2. elseif option found, new style -
    3. else option found, new style -
    4. endif option found, new style -
    5. if now -fi, elseif, else or endif option, then old style -
    - -

    Example

    -

    -

    -In this example, we want to split a file into the height, temperature,
    -relative humidity and other fields.
    -
    -Old style                                    New style
    -
    -wgrib2 IN.grb \                              wgrib2 IN.grb \
    --if ":HGT:" -grib hgt.grb \                  -if ":HGT:" -grb hgt.grb \
    --if ":TMP:" -grib tmp.grb \                  -elseif ":TMP:" -grib tmp.grb \
    --if ":RH:" -grib rh.grb \                    -elseif ":RH": -grib rh.grb \
    --not_if ":(HGT|TMP|RH):" -grib rest.grb      -else -grib rest.grb \
    -                                             -endif
    -
    -

    -The new style is easier to read and perhaps to write. (The old style may not be -obvious to all users.) One might expect the the new style is faster because -some -elseif tests are not evaluated. However, all the -elseif and -elseif_fs -tests are evaluated in parallel. So there little time savings. - -

    - Life and "if" blocks are getting more complicated. -For example, the interpolation scheme use to be - -

    -interpolation_type = bilinear
    -if (soil type or vegatation type) interpolation_type = nearest_neighbor
    -
    - -The above translates to -
    -Old style                                    New style
    -
    -wgrib2 IN.grb \                              wgrib2 IN.grb \
    - -new_grid_interpolation bilinear \          -new_grid_interpolation bilinear \
    - -if ":(VGTYP|SOTYP):" \                     -if ":(VGTYP|SOTYP):" \
    -    -new_grid_interpolation neighbor \          -new_grid_interpolation neighbor \
    - -fi \                                       -endif \
    - ...                                         ...
    -
    - -The more that you interpolate, the more that you learn how to interpolate. For example, -when you interpolate precipitation, you almost always do a budget -interpolation because you want to preserve global or area average -precipitation. Understanding the local land surface depends on the -point values of vegatation type, soil type, soil and surface coditions. -Spectral interpolation may be more accurate but it can make the RH greater -than 100%. So a better selection of interpolation types may be, -Translating the following to a shell script using the old "if" structure -seems hard. - -
    -large_scale= new_dx/old_dx > 3
    -
    -if (soil type or vegatation type) { interpolation_type = nearest_neighbor }
    -else if (variable == precipitation) { interpolation_type = budget }
    -else if (large_scale) { interpolation = budget }
    -else if (level ≤ 10m above the surface) interpolation_type=nearest neighbor
    -else if (not humidity and pressure level) interpolation_type = spectral
    -else interpolation_type = bilinear
    -
    - - - -

    -See also: --set_hex --set_ieee --set_int --set_int2 --set_ieee -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: June 1, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ij.html b/web_docs/ij.html deleted file mode 100644 index bab4064..0000000 --- a/web_docs/ij.html +++ /dev/null @@ -1,189 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ij - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ij -
     
    - -

    wgrib2: -ij

    -
    - - -

    Introduction

    - -

    -The -ij option prints the value of the grid point (i,j) -where i = 1..nx and j = 1..ny. Note, by default the grid is converted to a -WE:SN order. This means that (1,1) is at the South-West corner. - -

    Usage

    -

    - -

    --ij i j
    -      i = 1 .. nx
    -      j = 1 .. ny
    -
    - -

    Example

    -

    -

    -sh-2.05b$ wgrib2 new.grb2 -s  -ij 1 1
    -1:0:d=2005082812:HGT:1000 mb:78 hour fcst:val=162.3
    -
    - - - - - -See also: -ijlat, -ilat, -lon -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ijbox.html b/web_docs/ijbox.html deleted file mode 100644 index bf214b0..0000000 --- a/web_docs/ijbox.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ijbox - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ijbox -
     
    - -

    wgrib2: -ijbox

    -
    - - -

    Introduction

    - -

    -The -ijbox option takes a rectangular box -of data from a rectanular grid an writes it out in either -text, bin, or spread (sheet) format. The extracted box can -have every point or every n-th point. - -

    Usage

    -
    --ijbox i1:i2:di j1:j2:dj output_file format
    -     format = bin, text or spread   (format of output_file)
    -
    -     The data in output_file is written out as
    -      do iy=j1, j2, dj
    -         do ix=i1, i2, di
    -            data(ix,iy)
    -         enddo
    -      enddo
    -
    -    Note: -big_endian and -little_endian have no effect the bin type output
    -
    - -

    Example

    -

    - Wgrib2 when writing binary, can make a fortran header at the -beginning of the grid and a fortran trailer at the end of -the grid. I wanted to create a file with fortran header -and trailer surrounding each row of the grid. I was -able to do it with -ijox. The grid of rtgssthr_grb2 -is 1041 x 441. - -

    -rm output
    -i=1
    -while [ $i -le 441 ] ; do
    -   wgrib2 rtgssthr_grb2 -append -header ijbox 1:1041 $i:$i output bin
    -   i=`expr $i + 1`
    -done
    -
    - -

    -See also: --undefine, --small_grib, --text_col, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page modified: Dec 30, 2016, 5/8/2019 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ijlat.html b/web_docs/ijlat.html deleted file mode 100644 index 966a82e..0000000 --- a/web_docs/ijlat.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ijlat - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ijlat -
     
    - -

    wgrib2: -ijlat

    -
    - - -

    Introduction

    - -

    -The -ijlat option prints the latitude, longitude and -value of the grid point (i,j) where i = 1..nx and j = 1..ny. Note, -by default the grid is converted to a WE:SN order which puts (1,1) -in the South-West corner. Note, multiple -ijlat can be on the command line. - - -

    Usage

    -

    - -

    --ijlat i j
    -      i = 1 .. nx
    -      j = 1 .. ny
    -
    - -

    Example

    -

    -

    --sh-2.05b$ wgrib2 new.grb2 -s -ijlat 1 1
    -1:0:d=2005082812:HGT:1000 mb:78 hour fcst:(1,1),lon=0,lat=-90,val=162.3
    -
    --sh-2.05b$ wgrib2 new.grb2 -s -ijlat 1 1 -ijlat 2 2
    -1:0:d=2005082812:HGT:1000 mb:78 hour fcst:(1,1),lon=0,lat=-90,val=162.3:(2,2),lon=1,lat=-89,val=183.7
    -
    -
    - - -See also: -ij, -ilat, -lon -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ijsmall_grib.html b/web_docs/ijsmall_grib.html deleted file mode 100644 index 828358b..0000000 --- a/web_docs/ijsmall_grib.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ijsmall_grib - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ijsmall_grib -
     
    - -

    wgrib2: -ijsmall_grib

    -
    - - -

    Introduction

    - -

    -The -ijsmall_grib option writes the grid values -to a grib2 file with the same grid spacing but a smaller domain. -It is similar to the -small_grib option -except it uses i,j values rather than lat-lon values. The grid point -locations are unchanged. This option is used to make a regional subset -and only works for certain grids such as the lat-lon, rotated lat-lon, Mercator and Lambert conformal. - -

    Limitations

    -
      -
    1. rotated lat-lon grid: must use WMO grid template and not the NCEP locally defined grid template -
    2. staggered grids are not supported -
    - - -

    Usage

    -

    - -

    --ijsmall_grib ix0:ix1 iy0:iy1 file_name
    -
    -Where, 1 <= ix0 < ix1 < nx
    -Where, 1 <= iy0 < iy1 < ny
    -By default, (i,j) is the South-West corner
    -
    -File_name is the output grib2 file 
    -
    - -

    Example

    -

    - -

    -$ wgrib2 fcst.grb2 -ijsmall_grib 10:20 20:30 small.grb
    -1:0:d=2007032600:HGT:1000 mb:anl:
    -
    -$ wgrib2 small.grb -grid
    -1:0:grid_template=0:
    -        lat-lon grid:(11 x 11) units 1e-06 input WE:SN output WE:SN res 48
    -        lat -80.500000 to -75.500000 by 0.500000
    -        lon 4.500000 to 9.500000 by 0.500000 #points=121
    -
    - - -

    -See also: -undefine, --small_grib -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Nov 20, 2015, Feb 2024 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ijundefine.html b/web_docs/ijundefine.html deleted file mode 100644 index 4b9537b..0000000 --- a/web_docs/ijundefine.html +++ /dev/null @@ -1,221 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ijundefine - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ijundefine -
     
    - -

    wgrib2: -ijundefine

    -
    - - -

    Introduction

    - -

    -The -ijundefine option sets the -selected grid values to undefined. The grid points are have to be -inside or outside a user defined (i,j) box. I and j are the column -and row number of the "raw" data starting from 1. This option can be -used to limit the output when writing output. -For example, you were only interested in the UK, you could use this -option to undefine the grid points outside the of UK. Then when you write -the data in spread-sheet format, you would get a much smaller output. -This option can also be used to find the regional average using the -stat option. Note that the --ijundefine option changes the in-memory values -of the grid points. If you want to alter the grib file, you will -have to write out the in-memory grid point values using the -the -grib_out option. - - - -

    Usage

    -

    - -

    --ijundefine (in-box|out-box) ix0:ix1 iy0:iy1
    -
    -in-box:  decoded grid points inside the box are set to undefined
    -out-box: decoded grid points outside the box are set to undefined
    -ix0:ix1 columns limits (1 <=  ix0 <= ix1 < nx)
    -iy0:iy1 row limits (1 <= iy0 <= iy1 <  ny)
    -Note: the order of the data should be in default mode (we:sn).
    -Note: ix0, iy0 is the lower left hand corner (w/s).
    -
    -Points on the box boundary are considered to be in the box.
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -ijundefine out-box 1:1 1:10 -stats
    -
    - -The above line calculates the statistics for ix=1, iy=1..10. - -
    -$ wgrib2 test.grb2 -ijundefine out-box 10:30 20:40 -ijundefine in-box 11:29 21:39 -bin boundary.bin
    -
    - -The above line undefines the grid points outside of a box and then undefines the grid points of a smaller -box that is contained in the first box. Then it writes the data as a binary file. The data file contains -the data points for a perimeter of a box. Why would someone want to do that? Think "horizontal boundary -conditions for a regional model". For this to work well, a module to write the data out in grib-2 needs -to be written. BTW the binary file will compress to an extremely small file. - -

    -See also: --undefine, --spread, --stats, --undefine_val, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ilat.html b/web_docs/ilat.html deleted file mode 100644 index c7fe759..0000000 --- a/web_docs/ilat.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ilat - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ilat -
     
    - -

    wgrib2: -ilat

    -
    - - -

    Introduction

    - -

    -The -ilat option prints the latitude, longitude and -value of ith grid point. For example, you get a text output and you -were curious about the lat-lon of the fifth grid on the list. You -would use this option to get the value and its location. - -

    The -ilat option uses the Fortran convention -which has the index starting from one. In addition, the index is for the -output grid may differ from the input grid. - - - -

    Usage

    -

    - -

    --ilat i
    -      i = 1 .. number of grid points
    -
    - -

    Example

    -

    -

    --sh-2.05b$ wgrib2 ens.grb -ilat 5
    -1:0:grid pt 5,lon=4.000000,lat=-90.000000,val=18168.8
    -2:45932:grid pt 5,lon=4.000000,lat=-90.000000,val=8e-07
    -3:89724:grid pt 5,lon=4.000000,lat=-90.000000,val=2.6e-06
    -4:144624:grid pt 5,lon=4.000000,lat=-90.000000,val=8309.4
    -5:198928:grid pt 5,lon=4.000000,lat=-90.000000,val=205.9
    -
    - - -See also: -ijlat, --lon --ll2i --scan -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan 26, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/import_bin.html b/web_docs/import_bin.html deleted file mode 100644 index 2c0cf2e..0000000 --- a/web_docs/import_bin.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -import_(bin, ieee, text, grib) - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-import_(bin,ieee,text,grib) -
     
    - -

    wgrib2: -import_bin, -import_ieee, -import_text, -import_grib

    -
    - - -

    Introduction

    - -

    -Wgrib2 will decode the grib message and save the decoded -grid point values in a floating point array (DATA). The -import -options read grid point values from a specified file and replace the values of DATA. -The size of DATA and imported grid should match. The -import -options are often used to read data that is later written out as a grib message. -

    -Note that the import functions will reset the scaling and precision of the grib writing (new files) -to the default (ECMWF-style, 12 bits). Any -set_metadata should be done after the -import functions. - -

    Scan Order

    -The grib message's scan order is called the "input" scan order (wgrib2 -grid). -Wgrib2 converts this to the "output" scan order. (This is the scan order for -options like: -bin, -text, -cvs.) The import file needs to be in the "output" -scan order. Of course, you can change the output scan order using the -order -option. - -

    import Format

    -The file that you import needs to be in a special format. - -
      -
    • grib: grib2 message -
    • bin: native single point format -
    • ieee: IEEE single point format -
    • bin: may have a f77 style header depending on the -header option -
    • ieee: may have a f77 style header depending on the -header option -
    • ieee: may be little or big (default) ending depending on options -
    • text: may have a "nx ny" header depending on the -header option -(see -text option) -
    - - -

    Usage

    -
    --import_bin data.bin              .. a binary (native format floating point) file
    --import_ieee data.ieee            .. a big-endian 32-bit ieee file
    -                                     note that the -header and -no_header affect the data file format
    --import_text data.txt		  .. a text file
    -                                     note that the -header and -no_header affect the data file format
    --import_grib data.grb		  .. a grib2 file
    -                                     -g2clib 2 is not supported
    -                                     conversion to we:sn and we:ns is supported
    -                                     reads next grid (message or submessage)
    -                                     -not and -match do not affect -import_grib
    -
    -Note: grid size (if it can be determined) must match the current grid.
    -
    - -

    Example 1

    -
    -wgrib2 IN.grb -bin dump.bin              .. make a binary sequential file of the fields
    -Fix.sh dump.bin dump.bin.new             .. alter dump.bin
    -wgrib2 IN.grb -set_grib_type same -import_bin dump.bin.new -set_scaling same same -grib_out IN.new.grb
    -
    -The -import options reads the data for one field and overwrites -the current grid point values. The -grib_out option writes a new -grib message with the new grid point values. - -

    Example 2: using import to write a grib file

    - -
    -template.grb2             is a single message (field/record) grib2 file with the appropriate grid
    -                          usually a simple type like 6 hour forecast or analysis
    -new.bin                   is a binary file with a single field with th same grid as template.grb2
    -
    -
    -wgrib2 template.grb2 -import_bin new.bin -set_var GEOLAT -set_lev "surface" -set_ftime "anl" \
    -     -set_date 1999123112 -set_grib_max_bits 24 -set_bin_prec 24 -grib_out new.grb2
    -
    -This commands writes new.bin as a grib2 file as GEOLAT at 12Z Dec 31, 1999 using 24 bits precision.
    -
    - -

    -See also: --import_grib_fs, --import_netcdf, --set_grib_type, --set_scaling, --undefine, --grib_out, --set_date, --set_ftime, --set_lev, --set_var, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page modified: Sep 14, 2016. Sep 23, 2022. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/import_grib.html b/web_docs/import_grib.html deleted file mode 100644 index 2c0cf2e..0000000 --- a/web_docs/import_grib.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -import_(bin, ieee, text, grib) - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-import_(bin,ieee,text,grib) -
     
    - -

    wgrib2: -import_bin, -import_ieee, -import_text, -import_grib

    -
    - - -

    Introduction

    - -

    -Wgrib2 will decode the grib message and save the decoded -grid point values in a floating point array (DATA). The -import -options read grid point values from a specified file and replace the values of DATA. -The size of DATA and imported grid should match. The -import -options are often used to read data that is later written out as a grib message. -

    -Note that the import functions will reset the scaling and precision of the grib writing (new files) -to the default (ECMWF-style, 12 bits). Any -set_metadata should be done after the -import functions. - -

    Scan Order

    -The grib message's scan order is called the "input" scan order (wgrib2 -grid). -Wgrib2 converts this to the "output" scan order. (This is the scan order for -options like: -bin, -text, -cvs.) The import file needs to be in the "output" -scan order. Of course, you can change the output scan order using the -order -option. - -

    import Format

    -The file that you import needs to be in a special format. - -
      -
    • grib: grib2 message -
    • bin: native single point format -
    • ieee: IEEE single point format -
    • bin: may have a f77 style header depending on the -header option -
    • ieee: may have a f77 style header depending on the -header option -
    • ieee: may be little or big (default) ending depending on options -
    • text: may have a "nx ny" header depending on the -header option -(see -text option) -
    - - -

    Usage

    -
    --import_bin data.bin              .. a binary (native format floating point) file
    --import_ieee data.ieee            .. a big-endian 32-bit ieee file
    -                                     note that the -header and -no_header affect the data file format
    --import_text data.txt		  .. a text file
    -                                     note that the -header and -no_header affect the data file format
    --import_grib data.grb		  .. a grib2 file
    -                                     -g2clib 2 is not supported
    -                                     conversion to we:sn and we:ns is supported
    -                                     reads next grid (message or submessage)
    -                                     -not and -match do not affect -import_grib
    -
    -Note: grid size (if it can be determined) must match the current grid.
    -
    - -

    Example 1

    -
    -wgrib2 IN.grb -bin dump.bin              .. make a binary sequential file of the fields
    -Fix.sh dump.bin dump.bin.new             .. alter dump.bin
    -wgrib2 IN.grb -set_grib_type same -import_bin dump.bin.new -set_scaling same same -grib_out IN.new.grb
    -
    -The -import options reads the data for one field and overwrites -the current grid point values. The -grib_out option writes a new -grib message with the new grid point values. - -

    Example 2: using import to write a grib file

    - -
    -template.grb2             is a single message (field/record) grib2 file with the appropriate grid
    -                          usually a simple type like 6 hour forecast or analysis
    -new.bin                   is a binary file with a single field with th same grid as template.grb2
    -
    -
    -wgrib2 template.grb2 -import_bin new.bin -set_var GEOLAT -set_lev "surface" -set_ftime "anl" \
    -     -set_date 1999123112 -set_grib_max_bits 24 -set_bin_prec 24 -grib_out new.grb2
    -
    -This commands writes new.bin as a grib2 file as GEOLAT at 12Z Dec 31, 1999 using 24 bits precision.
    -
    - -

    -See also: --import_grib_fs, --import_netcdf, --set_grib_type, --set_scaling, --undefine, --grib_out, --set_date, --set_ftime, --set_lev, --set_var, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page modified: Sep 14, 2016. Sep 23, 2022. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/import_grib_fs.html b/web_docs/import_grib_fs.html deleted file mode 100644 index 5999519..0000000 --- a/web_docs/import_grib_fs.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -import_grib_fs - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-import_grib_fs -
     
    - -

    wgrib2: -import_grib_fs (wgrib2 v3.0.0+)

    -
    - - -

    Introduction

    - -

    -The -import_grib_fs option sets the file pointer -to the beginning of the file, and reads sequentially until it finds -a record that matches the search string. It like a --if_fs for reading a grib file. - -

    -The option -import_grib reads the input file sequentially. -The -import_grib_fs option allows you select the field to read. - -

    Usage

    -
    --import_grib_fs STRING data.grb	     reads a grib message that matchs STRING from file data.grb
    -				     the match is by fixed string, not regular expression
    -                                     -g2clib 2 is not supported
    -                                     conversion to we:sn and we:ns is supported
    -                                     starts at the beginning of the file
    -				     reads sequentially
    -                                     -not and -match do not affect -import_grib
    -                STRING               this is a subset of the match inventory (see -match_inv)
    -		                     starting with d=YYYYMMDDHH
    -                data.grb             grib file for reading by -import_grib_fs
    -Note: grid size (if it can be determined) must match the current grid.
    -
    - -

    Example 1

    -Here is a script that reads the CORe and CFS analyses, and finds the -average 500 mh height. CORe and CFS are on different grids, so the first -step is to convert them to to same grid. - -
    -#!/bin/sh
    -#
    -# ave two Z500 fields from totally different systems (CORe, CFS)
    -#
    -# Step 1, convert to same grid
    -# Step 2, use -import_grib_fs (v3.0.0+) to read the field
    -#         use -rpn to average the two fields
    -#         change center to unknown because the metadata is not descriptive
    -#
    -# Note: for Step 2,
    -#        -match ":d=2000010100:HGT:500 mb:"  is not needed
    -#        -import_grib_fs "d=2000010100:HGT:500 mb:anl:"  file2.grb
    -#          can be replaced by -import_grib file2.grb
    -# I made the code more complicated because if file1 and file2 were already on
    -# same grid, you can avoid Step 1.
    -
    -file1=/cpc/cfsr/reanalyses/corefv3/ens_mean/3hr/pgb/2000/01/pgb_2000010100_ensmean
    -file2=/cpc/cfsr/archive/6hr_h/pgb.g2/2000/01/pgb.2000010100.g2
    -
    -# Step 1
    -wgrib2 $file1 -match ":d=2000010100:HGT:500 mb:" -new_grid_winds earth -new_grid ncep grid 3 file1.grb
    -wgrib2 $file2 -match ":d=2000010100:HGT:500 mb:" -new_grid_winds earth -new_grid ncep grid 3 file2.grb
    -echo "\n\n"
    -
    -# Step 2
    -wgrib2 file1.grb -match ":d=2000010100:HGT:500 mb:" -rpn "0.5:*:sto_0" \
    -   -import_grib_fs "d=2000010100:HGT:500 mb:anl:"  file2.grb \
    -   -rpn "0.5:*:rcl_0:+" -set_center 255 -grib_out ave.grb
    -exit 0
    -
    - -

    -See also: --import_grib, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sep 14, 2016. May 2024. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/import_ieee.html b/web_docs/import_ieee.html deleted file mode 100644 index 2c0cf2e..0000000 --- a/web_docs/import_ieee.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -import_(bin, ieee, text, grib) - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-import_(bin,ieee,text,grib) -
     
    - -

    wgrib2: -import_bin, -import_ieee, -import_text, -import_grib

    -
    - - -

    Introduction

    - -

    -Wgrib2 will decode the grib message and save the decoded -grid point values in a floating point array (DATA). The -import -options read grid point values from a specified file and replace the values of DATA. -The size of DATA and imported grid should match. The -import -options are often used to read data that is later written out as a grib message. -

    -Note that the import functions will reset the scaling and precision of the grib writing (new files) -to the default (ECMWF-style, 12 bits). Any -set_metadata should be done after the -import functions. - -

    Scan Order

    -The grib message's scan order is called the "input" scan order (wgrib2 -grid). -Wgrib2 converts this to the "output" scan order. (This is the scan order for -options like: -bin, -text, -cvs.) The import file needs to be in the "output" -scan order. Of course, you can change the output scan order using the -order -option. - -

    import Format

    -The file that you import needs to be in a special format. - -
      -
    • grib: grib2 message -
    • bin: native single point format -
    • ieee: IEEE single point format -
    • bin: may have a f77 style header depending on the -header option -
    • ieee: may have a f77 style header depending on the -header option -
    • ieee: may be little or big (default) ending depending on options -
    • text: may have a "nx ny" header depending on the -header option -(see -text option) -
    - - -

    Usage

    -
    --import_bin data.bin              .. a binary (native format floating point) file
    --import_ieee data.ieee            .. a big-endian 32-bit ieee file
    -                                     note that the -header and -no_header affect the data file format
    --import_text data.txt		  .. a text file
    -                                     note that the -header and -no_header affect the data file format
    --import_grib data.grb		  .. a grib2 file
    -                                     -g2clib 2 is not supported
    -                                     conversion to we:sn and we:ns is supported
    -                                     reads next grid (message or submessage)
    -                                     -not and -match do not affect -import_grib
    -
    -Note: grid size (if it can be determined) must match the current grid.
    -
    - -

    Example 1

    -
    -wgrib2 IN.grb -bin dump.bin              .. make a binary sequential file of the fields
    -Fix.sh dump.bin dump.bin.new             .. alter dump.bin
    -wgrib2 IN.grb -set_grib_type same -import_bin dump.bin.new -set_scaling same same -grib_out IN.new.grb
    -
    -The -import options reads the data for one field and overwrites -the current grid point values. The -grib_out option writes a new -grib message with the new grid point values. - -

    Example 2: using import to write a grib file

    - -
    -template.grb2             is a single message (field/record) grib2 file with the appropriate grid
    -                          usually a simple type like 6 hour forecast or analysis
    -new.bin                   is a binary file with a single field with th same grid as template.grb2
    -
    -
    -wgrib2 template.grb2 -import_bin new.bin -set_var GEOLAT -set_lev "surface" -set_ftime "anl" \
    -     -set_date 1999123112 -set_grib_max_bits 24 -set_bin_prec 24 -grib_out new.grb2
    -
    -This commands writes new.bin as a grib2 file as GEOLAT at 12Z Dec 31, 1999 using 24 bits precision.
    -
    - -

    -See also: --import_grib_fs, --import_netcdf, --set_grib_type, --set_scaling, --undefine, --grib_out, --set_date, --set_ftime, --set_lev, --set_var, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page modified: Sep 14, 2016. Sep 23, 2022. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/import_lonlat.html b/web_docs/import_lonlat.html deleted file mode 100644 index 5a3e32a..0000000 --- a/web_docs/import_lonlat.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -import_lonlat - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -import_lonlat -
     
    - -

    wgrib2: -import_lonlat

    -
    - - -

    Reading longitudes and latitudes to a file

    - -

    -By default grib2 saves the latitude and longitude in micro-degrees. This -is more precision than the standard single-precision floating point variable -can hold. So wgrib2 uses double precision variables for its angles. -However, the -rpn facility is single precision, so it cannot be use for -angles without losing precision. -The -export_lonlat and --import_lonlat options allow you to write -and read double-precision longitude and latitudes. - - -

    File format

    -

    -The -import_lonlat option read the -longitudes and latitudes in the following format. - -

    -8 bytes:                        'wgrib2ll'       text
    -(sizeof unsigned int) bytes      ndata           unsigned integer with number of grid points
    -(sizeof unsigned int) bytes      0               unsigned integer with value of zero
    -ndata*(sizeof double)            longitudes      ndata values of double precision longitudes
    -ndata*(sizeof double)            latitudes       ndata values of double precision latitudes
    -
    -(sizeof unsigned int) is usually 4.  By wgrib2 requirements, the value must be 4 or greater.
    -(sizeof double) is usually 8.
    -
    - -

    -Prior to wgrib2 v3.1.2, -import_lonlat would always -read the first record of the input file. For wgrib2 v3.1.2+, --import_lonlat would read the records sequentially. If -there was an EOF, then read would start at the beginning of the file. Consequently -old behavior mimicked for files with only one record. - -

    Caution

    -The -import_lonlat will change the internal values of -the longitudes and latitudes. However, wgrib2 will still use the original -grid organization. For example, the grib message was a lat-long grid, -and replaced the values for a polar stereographic grid. Some parts of wgrib2 -may still assume the grid is a lat-lon grid. -The -import_lonlat will be more useful for unstructured grids -like GDT 3.101 (General Unstructured Grid). GDT 3.101 does not include geolocation, -and -import_lonlat can add the geolocation. Consequently -the nearest neighbor interpolation will then work. - -

    Usage

    -

    -

    --import_lonlat FILE
    -    FILE = file that has special format with longitude and latitude values.
    -    The longitude and latitudes replace the internal values.
    -
    - -

    Example

    -
    -   $ wgrib2 IN.grb -ncpu 3 -new_grid_winds grid -new_grid ncep grid 221 - | wgrib2 - -ncpu 1 -set_grib_type j -ncep_uv OUT.grb
    -
    -

    -The above line uses 3 threads for regridding and one thread for jpeg2000 compression. The jpeg2000 -compression routines can't take advantage of more than one thread. -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created: 6/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/import_netcdf.html b/web_docs/import_netcdf.html deleted file mode 100644 index 56fb327..0000000 --- a/web_docs/import_netcdf.html +++ /dev/null @@ -1,431 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -import_netcdf - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-import_netcdf -
     
    - -

    wgrib2: -import_netcdf (beta)

    -
    - -

    -The -import_netcdf option is beta code which means -that the syntax is not going to change. This option -has been in the code for a number of years but it is not a well-used -option and there may be problems with your netcdf file. Personally I -would see if CDO can convert your file from netcdf to grib before -trying -import_netcdf. - -

    My second use of this -option (wgrib2 v3.0.0) improved the code. There were bug fixes and the -ability to import values stored in bytes and integers. The second use converted -the OSTIA SST files from netcdf to grib. The grib2 file was 8% of the original size. -(92% size reduction). The grib2 compression was extremely good, using only 0.97 bits -to store each grid point value. The grib compression was good because one field -was a mask, ice concentration was mostly zero value, and the SST and SST error where -undefined over land and lakes. The grid point values were unchanged in the conversion -from netcdf to grib because both the netcdf and grib files used the same precision. - - -

    Introduction

    - -

    -Reading netcdf is easy if someone else writes the program to read the netcdf file. -Writing the code to read netcdf is something else. -The -import_netcdf option allows you to read/import arbitrary -netcdf variables into wgrib2. The netcdf data that you read replaces the -grid point values of the "grib record" that you also read in. This is the -standard operating procedure of the -import options. - -

    -A netcdf file can contain many variables. In my sample file, there is one -data varable "acpcp" and and 6 supporting variables. -variables are -

    -    variable 0: time
    -    variable 1: lat(x,y)                 latitude
    -    variable 2: lon(x,y)                 longitude
    -    variable 3: y                        integer
    -    variable 4: x                        integer
    -    variable 5: Lambert_Conformal        grid definition
    -    variable 6: acpcp(x,y,time)          accumulated convective precip
    -
    - -

    -Netcdf variables have dimensions which can -be of arbitrary units. For example the time is not stored as YYYYMMDDHHSS but -could be stored as "nanoseconds since 1981-2-23", "fortnights since 1990-11-25 12:00 EST" -or anything else you can imagine. Geopotential height can have units of -meters, metres, inches, microns, nautical miles, chains, rods or any unit of length -in any language (ncdf supports unicode). This is the joy of a standard that don't set -standards. (Netcdf is a standard but fails to standardize units of length.) - -

    -Variables in netcdf can be viewed as variable(dim-i,dim-j,..,dim-last) where -the number of dimensions differ. For example, in one dataset, -X could be one-dimensional, latitude could be two dimensional and temperature -could be 4 dimensional. - -

    -There is netcdf library code to read varaible(i0:i1, j0:j1, .. , last0:last1). -With -import_netcdf, you specifiy the netcdf file, -the netcdf variable and "i0:i1,..,last0:last1". The code reads the data -and uses it to overwrite the wgrib2's data register. For this option, you don't -specify "i0:i1" but "i0" and "n", the number of to read (i1=i0+n-1). - - -

    Tutorial: Variables in an unknown netcdf file

    - -

    -In this example, I am trying to read a NARR netcdf file produced by a 3rd party. -As a first step, I want to list the variables in the netcdf file. - -

    -acpcp.1979.nc = netcdf file
    -
    -small.grb2 = arbitary grib2 file (used so that -import_netcdf will run)
    -asd = junk name that doesn't match a variable name or dimension specification
    -
    -sh-4.1$ wgrib2  ~/grib2/examples/small.grb2 -import_netcdf acpcp.1979.nc asd asd 
    -import_netcdf: asd is not valid variable, valid variables are
    -variable 0: time
    -variable 1: lat
    -variable 2: lon
    -variable 3: y
    -variable 4: x
    -variable 5: Lambert_Conformal
    -variable 6: acpcp
    -
    -In the above line, I am importing the variable "asd" from netcdf file "apcpc.1979.nc".
    -As expected, "asd" is not a valid varaible, and I get an error message and the 
    -desired list of valid variables.
    -
    - -

    Tutorial: Unknown attributes and dimensions of a variable

    - -To get a variable description, you need to try to import a netcdf file. acpcp.1979.nc -with a valid variable, acpcp, with an invalid dimension specification, "asd". - -
    -bash-4.1$ wgrib2 ~/grib2/examples/small.grb2 -import_netcdf acpcp.1979.nc acpcp asd 
    -ndims=3 var_type=5 #var_attributes 16
    -acpcp.0 attr=GRIB_id type=3 len=1
    -acpcp.1 attr=GRIB_name: ACPCP
    -acpcp.2 attr=coordinates: lat lon
    -acpcp.3 attr=dataset: NARR 3-hourly
    -acpcp.4 attr=grid_mapping: Lambert_Conformal
    -acpcp.5 attr=level_desc: Surface
    -acpcp.6 attr=long_name: 3-hourly accumulated convective precipitation at Surface
    -acpcp.7 attr=parent_stat: Other
    -acpcp.8 attr=standard_name: convective_precipitation_amount
    -acpcp.9 attr=statistic: Individual Obs
    -acpcp.10 attr=units: kg/m^2
    -acpcp.11 attr=valid_range type=5 len=2
    -acpcp.12 attr=var_desc: convective precipitation accumulation
    -acpcp.13 attr=missing_value type=5 len=1
    -acpcp.14 attr=actual_range type=5 len=2
    -acpcp.15 attr=_FillValue type=5 len=1
    -_FillValue=9969209968386869046778552952102584320.000000 1 missing_value=-9969209968386869046778552952102584320.000000 1
    -dimension mismatch asd, netcdf file has
    -   dim 0 id=0 name=time recs=2920
    -   dim 1 id=1 name=y recs=277
    -   dim 2 id=2 name=x recs=349
    -
    -*** FATAL ERROR: import_netcdf: dimensions do not match ***
    -
    - -By using an invalid dimension, the attributes and dimensions of the -variable are listed. From the attributes, we see that the variable is -a 3 hour accumulated convective precipitation. (Don't know whether it -is the 0-3 hour accumulated forecast or n-n+3 hour hour forecast.) - -

    Wgrib2 is using the C interface to the netcdf library. So -C conventions apply. For example, indices start at zero such -as the dimension number. - -

    The dimension description shows that acpcp is is a 3 dimensional -variable, apcpcp(time, y, x). - -

    Tutorial: Grid of an unknown netcdf file

    - -We can get the description of the latitude by - -
    -1:0bash-4.1$ wgrib2 ~/grib2/examples/small.grb2 -import_netcdf acpcp.1979.nc lat asd
    -ndims=2 var_type=5 #var_attributes 5
    -lat.0 attr=axis: Y
    -lat.1 attr=coordinate_defines: point
    -lat.2 attr=long_name: Latitude
    -lat.3 attr=standard_name: latitude
    -lat.4 attr=units: degrees_north
    -_FillValue=0.000000 0 missing_value=0.000000 0
    -dimension mismatch asd, netcdf file has
    -   dim 0 id=1 name=y recs=277
    -   dim 1 id=2 name=x recs=349
    -
    -*** FATAL ERROR: import_netcdf: dimensions do not match ***
    -
    - -Similarily we can find the description of lon. We see -that lat(y,x) and lon(y, x). - - -

    Tutorial: Projection of an unknown netcdf file

    - -The NARR grid is a Lambert Conformal grid. The grid description is -stored in the Lambert_Conformal variable. - -
    -bash-4.1$ wgrib2 ~/grib2/examples/small.grb2 -import_netcdf acpcp.1979.nc Lambert_Conformal asd 
    -ndims=0 var_type=4 #var_attributes 6
    -Lambert_Conformal.0 attr=false_easting type=6 len=1
    -Lambert_Conformal.1 attr=false_northing type=6 len=1
    -Lambert_Conformal.2 attr=grid_mapping_name: lambert_conformal_conic
    -Lambert_Conformal.3 attr=latitude_of_projection_origin type=6 len=1
    -Lambert_Conformal.4 attr=longitude_of_central_meridian type=6 len=1
    -Lambert_Conformal.5 attr=standard_parallel type=6 len=2
    -_FillValue=0.000000 0 missing_value=0.000000 0
    -WARNING: import_netcdf: size mismatch grib:4 netcdf:1
    -data is padded
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -
    - -

    Tutorial: converting a netcdf field to grib2

    - -In our example, we have a NARR grid and we can find -NARR grib1 files online from NCEI. Using grb1to2.pl, we -can convert a NARR file into grib2 and make a sample -grib2 file. This template will use the same grid -as our netcdf file. The following will read the 1st field from acpcp.1979.nc -and convert it into grib2. - -
    -bash-4.1$ wgrib2 narr.grb2 -import_netcdf acpcp.1979.nc acpcp "0:1:0:277:0:349" -set_var ACPCP \
    -   -set_lev surface -set_date 1979010100 -set_ftime2 "0-3 hour acc fcst" -grib_out out.grb2
    -ndims=3 var_type=5 #var_attributes 16
    -acpcp.0 attr=GRIB_id type=3 len=1
    -acpcp.1 attr=GRIB_name: ACPCP
    -acpcp.2 attr=coordinates: lat lon
    -acpcp.3 attr=dataset: NARR 3-hourly
    -acpcp.4 attr=grid_mapping: Lambert_Conformal
    -acpcp.5 attr=level_desc: Surface
    -acpcp.6 attr=long_name: 3-hourly accumulated convective precipitation at Surface
    -acpcp.7 attr=parent_stat: Other
    -acpcp.8 attr=standard_name: convective_precipitation_amount
    -acpcp.9 attr=statistic: Individual Obs
    -acpcp.10 attr=units: kg/m^2
    -acpcp.11 attr=valid_range type=5 len=2
    -acpcp.12 attr=var_desc: convective precipitation accumulation
    -acpcp.13 attr=missing_value type=5 len=1
    -acpcp.14 attr=actual_range type=5 len=2
    -acpcp.15 attr=_FillValue type=5 len=1
    -_FillValue=9969209968386869046778552952102584320.000000 1 missing_value=-9969209968386869046778552952102584320.000000 1
    -1:0:d=1979010100:ACPCP:surface:0-3 hour acc fcst:
    -
    --import_netcdf acpcp.1979.nc acpcp "0:1:0:277:0:349"
    -  0:1:0:277:349 = hyperslab specifier
    -           0:1   for the 1st dimension (t), start at 0 and loop 1 time
    -                  (if your file has multiple times, to get the second
    -                  time, you use "1:1".)
    -           0:277 for the 2nd dimension (y), start at 0 and loop 277 times
    -           0:349 for the 3rd dimension (x), start at 0 and loop 349 times
    --set_var ACPCP                   change the grib variable name to ACPCP of the memory buffer
    --set_lev surface                 change the grib level to surface of the memory buffer
    --set_date 1979010100             change the reference data of the memory buffer
    --set_ftime2 "0-3 hour acc fcst"  change the time stamp of the memory buffer
    --grib_out out.grb2               write memory buffer to out.grb2
    -
    --import_netcdf reads a hyberslab of dimension 1 x 277 x 349.  Now the narr.grb2 has
    -a grid of 349 x 277.  You can check that the grib2 scan order is compatible with
    -the netcdf scan order either by examining the lat/lon or by checking the netcdf
    -file with the grib file obtained from another source.
    -
    -

    -The -import_netcdf option is not convenient and -takes some work to setup. However, it did work and I was able to verify -that the netcdf NARR file was the same as my grib copy. For lat-lon netcdf files -that follow the coards convention, using GrADS and the g2grb.gs -script is easier to use. - -

    Warnings

    -

    -The -import_netcdf option does very little -error checking. Suppose your netcdf hyper-cube is organized WE:NS, -and your in-memory grid is WE:SN (default). The --import_netcdf directly over-write the -in-memory grid with the netcdf hyper-cube. The user is responsible -it reordering the data (-rpn -yrev). As of 3/2022, only WE:NS can -be transformed to WE:SN. - -

    Usage

    -
    --import_netcdf file variable "dim_list"
    -                                 file     = netcdf file
    -                                 variable = variable in the netcdf file
    -                                 dim_list    = specification of the hyperslab to read
    -                                 dim_list    = dim_spec:dim_spec:..:dim_spec
    -                                 dim_spec    = dim_start:dim_loop
    -                                 dim_start   = index for start of hyberslap starting at 0
    -                                 dim_loop    = number time to loop
    -
    - -

    More Examples

    - -See Converting OSTIA SST in netcdf to grib. - -

    -See also: --import_bin, --import_grib, --import_grib_fs, --import_text, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sep 18, 2017. Updated 1/8/2020, 9/2023 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/import_text.html b/web_docs/import_text.html deleted file mode 100644 index 2c0cf2e..0000000 --- a/web_docs/import_text.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -import_(bin, ieee, text, grib) - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-import_(bin,ieee,text,grib) -
     
    - -

    wgrib2: -import_bin, -import_ieee, -import_text, -import_grib

    -
    - - -

    Introduction

    - -

    -Wgrib2 will decode the grib message and save the decoded -grid point values in a floating point array (DATA). The -import -options read grid point values from a specified file and replace the values of DATA. -The size of DATA and imported grid should match. The -import -options are often used to read data that is later written out as a grib message. -

    -Note that the import functions will reset the scaling and precision of the grib writing (new files) -to the default (ECMWF-style, 12 bits). Any -set_metadata should be done after the -import functions. - -

    Scan Order

    -The grib message's scan order is called the "input" scan order (wgrib2 -grid). -Wgrib2 converts this to the "output" scan order. (This is the scan order for -options like: -bin, -text, -cvs.) The import file needs to be in the "output" -scan order. Of course, you can change the output scan order using the -order -option. - -

    import Format

    -The file that you import needs to be in a special format. - -
      -
    • grib: grib2 message -
    • bin: native single point format -
    • ieee: IEEE single point format -
    • bin: may have a f77 style header depending on the -header option -
    • ieee: may have a f77 style header depending on the -header option -
    • ieee: may be little or big (default) ending depending on options -
    • text: may have a "nx ny" header depending on the -header option -(see -text option) -
    - - -

    Usage

    -
    --import_bin data.bin              .. a binary (native format floating point) file
    --import_ieee data.ieee            .. a big-endian 32-bit ieee file
    -                                     note that the -header and -no_header affect the data file format
    --import_text data.txt		  .. a text file
    -                                     note that the -header and -no_header affect the data file format
    --import_grib data.grb		  .. a grib2 file
    -                                     -g2clib 2 is not supported
    -                                     conversion to we:sn and we:ns is supported
    -                                     reads next grid (message or submessage)
    -                                     -not and -match do not affect -import_grib
    -
    -Note: grid size (if it can be determined) must match the current grid.
    -
    - -

    Example 1

    -
    -wgrib2 IN.grb -bin dump.bin              .. make a binary sequential file of the fields
    -Fix.sh dump.bin dump.bin.new             .. alter dump.bin
    -wgrib2 IN.grb -set_grib_type same -import_bin dump.bin.new -set_scaling same same -grib_out IN.new.grb
    -
    -The -import options reads the data for one field and overwrites -the current grid point values. The -grib_out option writes a new -grib message with the new grid point values. - -

    Example 2: using import to write a grib file

    - -
    -template.grb2             is a single message (field/record) grib2 file with the appropriate grid
    -                          usually a simple type like 6 hour forecast or analysis
    -new.bin                   is a binary file with a single field with th same grid as template.grb2
    -
    -
    -wgrib2 template.grb2 -import_bin new.bin -set_var GEOLAT -set_lev "surface" -set_ftime "anl" \
    -     -set_date 1999123112 -set_grib_max_bits 24 -set_bin_prec 24 -grib_out new.grb2
    -
    -This commands writes new.bin as a grib2 file as GEOLAT at 12Z Dec 31, 1999 using 24 bits precision.
    -
    - -

    -See also: --import_grib_fs, --import_netcdf, --set_grib_type, --set_scaling, --undefine, --grib_out, --set_date, --set_ftime, --set_lev, --set_var, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page modified: Sep 14, 2016. Sep 23, 2022. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/index.html b/web_docs/index.html deleted file mode 100644 index 9c8b4d8..0000000 --- a/web_docs/index.html +++ /dev/null @@ -1,629 +0,0 @@ - - - Climate Prediction Center - wgrib2: grib2 utility - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -
     
    - -

    wgrib2: wgrib for GRIB-2

    -

    Utility to read and write grib2 files

    - -News - -wgrib2 moved to github -
    - -

    News

    -Wgrib2 moved to github. -

    -Wgrib2 development has been transitioning from a makefile build to a github/CMake build. -This allows future wgrib2 development to be integrated into a the software build/maintanence -system that is used by NCEP and the NOAA R&D HPC systems. Wgrib2 version 3.3.0 has the -major functionality of wgrib2 v3.1.3. (Ubuntu: IP-7/18/2024?, AEC-yes, JPEG200-no, PNG-no). - -

      Different -
    1. CMake build vs gnu makefile -
    2. build does not include independent library sources -
    3. questions, bug reports go to the github site -
    4. moving development into EMC/NCEP mainstream -
    - -
      Bad -
    1. all functionality of wgrib2 v3.1.3 is not present -
    2. equal area Lambert projection on aspherical earth is not supported (to do) -
    3. creating of libraries for pywgrib2 and wgrib2api not done (to do) -
    4. -new_grid of rotated lat-lon grids using WMO templates doesn't work (to do) -
    5. many of the build options are not supported (to do) -
    6. cannot check for library compatibility -
    7. CMake support for unusual platforms vs gnu make? -
    8. moving development into EMC/NCEP mainstream: lose independent check on EMC software -
    - -
      Good -
    1. future maintenence should be easier -
    2. support by multiple people -
    3. easier to build on NOAA computers -
    4. using a maintained version of ipolates -
    5. cleanup of code -
    6. unix standard calls to fortran ipolates replaced by standard version -
    7. use local installed libraries (ex. netcdf) -
    8. moving development into EMC/NCEP mainstream: saving of resources -
    9. EMC/NCEP mainstream: EMC could start using wgrib2api
      -
    - -
      Fixed in v3.3.0 vs v3.1.3 -
    1. updated NCEP grib table -
    2. small_grib: writing the lat/lon values in the metadata used a truncate rather than a round
      - angles could be off by 1e-6 of a degree -
    - -

    -At this point, we need feedback. The install documentation is weak. -IF you find something is braken, add it to the issues so it can be -fixed and a test added. - - -

    Introduction

    - -

    Wgrib2 is a processor for grib2 files. It is a utility -and library for manipulating grib files, The utility was designed to be -used to reduce the need for custom Fortran programs to -read, write and manipulate grib files. -Wgrib2 has the following abilities. - -

      -
    • inventory and read grib2 files -
    • create subsets -
    • create regional subsets by cookie cutter or projections -
    • export to ieee, text, binary, CSV, netcdf and mysql -
    • import to ieee, text, binary, and netcdf -
    • write of new grib2 fields -
    • parallel processing by using threads (OpenMP) -
    • parallel processing by flow-based programming -
    - - -

    Wgrib2 is versatile because it's command line is a simple -language. This makes wgrib2 useful in embedding. -Some programs that embed wgrib2. - -

      -
    • g2ctl -a control maker for GraADS -
    • atl_g2ctl, alt_gmp -alternative versions of g2ctl/gribmap for for -GraADS -
    • grib-filter/g2subset cgi-bin programs for Nomads (NOAA OperationalModel Archive & Distribution System) -
    • g2grb.gs enables GrADS to write grib2 files -
    • grb1to2.pl grib1 to grib2 converter -
    • Xplane11 flight simulator -
    • rNOMADS R interface for NOAA weather data -
    - - - - - -

    OpenMP Configuration

    -
    - -

    -OpenMP is used to speed up wgrib2 by running loops over -multiple cores. OpenMP is enabled by default for most builds -and you can slow up your machine if you the wrong OpenMP -configuration. - -

    The first configuration is to set up the number of -threads that wgrib2 will use. The default configuration -is set the number of threads equal to the number of -physical cores. The default is reasonable except for -when your computer becommes becomes -unresonsive. For a 4 core CPU, I set the number of threads -to be 3, so I another core to handle other work. -

    - -
    -export OMP_NUM_THREADS=3
    -
    - -

    The next OpenMP configuration is how to handle unused threads (cores). -By setting OMP_WAIT_POLICY to PASSIVE, -unused cores are made availible to to work on other tasks. -Setting OMP_WAIT_POLICY to ACTIVE, will not share the cores. -In kindergarten, you learned the value of sharing. -

    -
    -export OMP_WAIT_POLICY=PASSIVE
    -
    - -

    News

    -

    -4/14/2022: wgrib2 v3.1.1 is released -

      Changes for wgrib2 v3.1.1 -
    • fixes check_pdt_len for some ECMWF and ICON files with vertial coordinates -
    • fixes -unix_time because of glibc -
    • more support for unix time: -set_date, -import_netcdf -
    • tested: gcc/gfortran on Ubuntu 20.04, Redhat 7 -
    • tested: icc/ifort on Redhat 7 -
    • tested: AOCC v3.2 (clang, flang) on Ubuntu 20.04 -
    • minor tested: Windows 10 using cygwin64 -
    • minor tested: gcc/gfortran on Ubuntu 18.04 -
    - -

    Usage

    - -
      -
    • each option corresponds to a subroutine call -
    • type wgrib2 to see primary options -
    • inventory format is specified on command line by options -
    • if no "inv" option is specified, -s is used -
    - - -

    Joining the development effort

    -
      -
    • Source code: knowledge of C and some grib-2 -
    • Changes to existing source code has to use the same licence as the original code -
    • New code (files) must either be GNU or public domain. -
    • Github? No. -
    • Bug reports are important -
    • Some inovations by first time contributors -
        -
      • first implementation of lat-lon of common grids -
      • write netcdf files -
      • callable wgrib2 (making wgrib2 a subroutine) -
      • write to mysql files -
      • AEC compression -
      • python interface -
      -
    • Contact wesley.ebisuzaki@noaa.gov -
    - -

    Contributions by

    -
      -
    • Wesley Ebisuzaki: many modules -
    • Reinoud Bokhorst: tosubmsg, checksum -
    • DWD (Gregor Schee, Daniel Lee and others): AEC compression -
    • Jaakko Hyvätti: gribtab -
    • John Howard: callable wgrib2 -
    • Dusan Jovic: staggered grids, proj4 code -
    • Kristian Nilssen: netcdf module -
    • Karl Pfeiffer: georeferencing -
    • Pablo Romero: unix_time -
    • Manfred Schwarb: many modules -
    • Arlindo da Silva: openGrADS, bbox -
    • Niklas Sondell: mysql module -
    • Sam Trahan: satellite tables -
    • George Trojan: python interface, improvements to wgrib2api -
    • Sergey Varlamov: netcdf module improvements, georeferencing updates -
    • thanks to the people who report the bugs and more who provide the fixes! -
    - -

    Documentation

    - -

    The options

    - - -

    Some solutions

    - - -

    Selecting Fields/Records/Message

    -

    Select/Ignore by name/level/time/etc

    -
      -
    • -match process records that match a posix extended regular expression -
    • -not process records not matching a regular expression -
    • -match_inv the inventory used by -match and -not -
    • -i reads inventory from stdin for record selection -
    - -

    Select by number (better to use previous method)

    -
      -
    • -d dump specific record -
    • -for select a range of records to process (nth message) -
    • -for_n select a range of records to process (nth message/submessage) -
    - -

    Selective Processing: if options

    -

    -After selecting the fields to process, you can refine the processing by -the "if" options. With wgrib2 v3.0.0, the IF -structure was improved. Scripts that used the older IF structure still work; -however, the new IF structure is easier to read. - -

    If possible, it is better to use the match options than the if options. -The -match/-not options prevent unwanted records from being processed which -saves time over the if options which process the fields. - -

    Individual Grid Point Data

    -
      -
    • -ij print value at grid point (i, j) -
    • -ijlat print lat, lon, value at grid point (i, j) -
    • -ilat print lat, lon, value of Nth grid point -
    • -lon prints the lat-lon, and value of the grid point nearest the specified lat-lon -
    • -max prints the maximum value -
    • -min prints the minimum value -
    • -stats prints some statistics about the fields -
    • -V verbose inventory (shows stats) -
    - - -

    Regridding, Interpolating to new grids

    - -

    Wgrib2 has the ability to convert grib files from one grid -to another. The conversion uses a user-selected interpolation -scheme: bilinear (default), bicubic, nearest neighbor, budget, and spectral. -The supported grids include lat-lon, gaussian, Lambert conformal, polar stereographic, -and WMO-defined rotated lat-lon grid. This capability uses the NCEP IPOLATES2 library -and is an optional package. - -

    Note: the interpolation uses scalar and vector interpolation -schemes. For the vector quantities the V field must immediately -follow the corresponding U field. - -

    - - -

    Exporting data to other programs

    -
      -
    • -netcdf: write data in netcdf format -
    • -mysql: export data to a mysql database -
    • -mysql_speed: export data to a mysql database -
    • -spread: write data for spreadsheets -
    • -csv: write in column separated values, another one for spreadsheets -
    • -text: data in text format -
    • -bin: data native binary floating point -
    • -ieee: data in big endian IEEE format -
    • -ijbox: write a rectangular grid of data -
    • -AAIG: arcinfo ascii grid, GIS -
    - -For a short list of options, type "wgrib -h"
    -For a complete list, type "wgrib -help all"
    -To search for an option, type "wgrib -help keyword"
    - -

    Writing grib2

    - -Wgrib2 has adopted the template approach for writing grib. You -have a sample grib2 message (template), and you modify the grid point values -and metadata to create a new grib message that you can write. -This is similar to how ECMWF's ECCodes writes grib. The other approach -is to supply many parameters to create a grib message which is used -by NCEP's g2 library. - -
      -
    1. from wgrib2 command line -
    2. from GrADS using g2grb.gs -
    3. fron python using write -
    4. from fortran using grb2_write -
    - - - -

    Machines able to run wgrib2

    - -
      64-bit with IPOLATES -
    • Redhat 7 Enterprise: gcc/gfortran (primary development system) -
    • Redhat 7 Enterprise: gcc/gfortran, icc/ifortran -
    • SUSE Enterprise: gcc/gfortran, icc/ifortran -
    • Ubuntu 20.04: gcc/gfortran (primary development system) -
    • Ubuntu 20.04: AOCC's clang and flang (development system) with OpenJPEG -
    • Ubuntu 20.04: nvidia with OpenJPEG -
    • ARM: needed to be compiled with USE_NETCDF4=1, USE_JASPER=0 (old report) -
    • Redhat linux: 32-bit with IPOLATES, not tested recently, use netcdf4 (old report) -
    • Mandriva linux (old report) -
    • AIX: use makefile, some fiddling with libraries is necessary, not tested recently -
    • Solaris, needs gnu make and gcc (old report) -
    • Solaris-10 (old report) -
    • HPUX, needs changes to makefiles (old report) -
    • Windows: using Cygwin system produces 32-bit binaries (old report) -
    • Windows: using Cygwin system produces 64-bit binaries -
    • Windows: compiled MingW (not recent), Watcom C, icc/ifort (old report) -
    • Windows/linux subsystem (ubuntu): compiled with gcc/gfortran (old report) -
    • Intel-based Mac using gcc and gfortran -
    - -The makefile works on Redhat and Ubuntu (with needed installed options). -For other systems, you may have to modify the makefile. The makefile -requires gnu make which is a common version of make. - -

    System dependencies: 32 vs 64 bit, big vs little endian, Windows vs Linux/UNIX

    - -

    -The wgrib2 source code is written to be portable; there are no -issues with big vs little endian or the size of the integer as -long as it is 32 bits or more. The source code is written in -ANSI/ISO C (C89), with optional features that require -POSIX or POSIX-2. There has been a debate about -moving the base rquirements to C99. - -

      -
    • big vs little endian: either works -
    • 32-bit machine: files limited to 2GB files, netcdf3 may not work -
    • Windows: 2GB+ files with 64-bit cygwin, 2GB with other windows C compilers -
    • Windows: only 64-bit cygwin is supported -
    • POSIX: all POSIX code is optional. Regex support is POSIX and useful. -
    • JPEG2000: OpenJPEG library or Jasper library -
    - - -

    Source Code and Compling Hints

    -

    -The wgrib2 source code is written to the POSIX-2 standard. Features requiring -POSIX2, such as regular expressions, can usually be turned off -in the makefile. The wgrib2 code can be compiled with 32 or 64 bit pointers and integers. -However, the code has to be compiled in a like manner for all the libraries. -Some packages are optional (netcdf, mysql) and enabling these options can really -increase the executable size. -

    - -

    -While compiling wgrib2, you may see warnings about unknown pragmas. Pragmas -are "comments" that are used when compiling an OpenMP version of the code. The -default is to compile with OpenMP turned on. -

    - -

    -2/2019: The HDF5 library has problems being compiled with newer gcc compilers. -The only consisten method of adding NetCDF4 to wgrib2 is by using old compilers -(RedHat 6) or using the Intel compilers. The work around to enable NetCDF3 support -and use an external utility to convert the files to Netcdf4. - -

    -NetCDF3 has problem being compiled on 32-bit machines. -

    - - - -

    Precompiled code from External Sites

    -

    -There are many sites with precompiled versions of wgrib2. This list -is neither exhaustive nor an endorsement of the sites. I have -not tested the wgrib2 executables from these sites and YMMV. - -

    - -

    Status

    -

    -The wgrib2 is used operationally in the NCEP production suite. -

    - -

    -Change logfile -

    - -

    Changes

    -

    Prior to wgrib2 v3.1.0, chemical and aerosol names were from the NCO web table for Code Table 4.30. -For wgrib2 v3.1.0+, the names are from the WMO names for CCT14. Expect differences. For example, -"Total Aerosol" became "Total aerosol", and "Carbon Monoxide" became "Carbon monoxide". If you use -for "Carbon ]mM]onoxide", it will work with both -if and -match. - - -

    Bugs

    - -

    Please report bugs to wesley.ebisuzaki@noaa.gov. When you report bugs, -try to make them reproducible on a linux machine and include sample data. - -

    The long time practice was not to port bug fixes to older versions of -wgrib2. As of June 23, 2023, the official policy is not to backport bug fixes -to older versions of wgrib2, especially versions that are over 4 year old, -and 5 public releases ago. As of June 23, 2023, a recent CMake is necessary -to compile some default library/libraries used by wgrib2. Wgrib2 can be -compiled without the libraries and avoiding the use of CMake. - -

    Distribution

    -

    - The source code modules for wgrib2 are either in the public domain or under the GNU - licence depending on the authors of the various modules. Wgrib2 uses libraries that - are in the public domain, under various GNU licences, the Image Power JPEG-2000 Public Licence*, - libpng licence*, the zlib licence*, the netcdf licence*, HDF5 licence*, MySQL licence* and perhaps others. How - about one licence to rule them all? -

    - * optional package -

    -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page modified: 12/29/2016, 10/2/2020, 4/2024 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/interpolating_NDFD.html b/web_docs/interpolating_NDFD.html deleted file mode 100644 index 153546f..0000000 --- a/web_docs/interpolating_NDFD.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -i - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 interpolating NDFD grids -
     
    - -

    wgrib2: interpolating NDFD grids

    -
    - - -

    Introduction

    - -

    -Interpolation of the NDFD CONUS grid is not supported by the --new_grid option because the IPOLATES -library was written to grib-1 standards and the NDFD grids -use a grib-2 only scanning mode. If you want to interpolate -a NDFD CONUS grid (Lambert conformal), you have to get change -the scanning mode to WE:SN by the followin line. - -

    - $ wgrib2 ds.td.bin -rpn alt_x_scan -set_byte 3 65 64 -grib_out junk
    -1:80:d=2009062918:DPT:surface:60 hour fcst:
    -2:218826:d=2009062918:DPT:surface:66 hour fcst:
    -3:434430:d=2009062918:DPT:surface:72 hour fcst:
    -..
    -
    -$ wgrib2 junk -grid -d 1
    -1:0:grid_template=30:winds(N/S):
    -        Lambert Conformal: (1073 x 689) input WE:SN output WE:SN res 0
    -        Lat1 20.191999 Lon1 238.445999 LoV 265.000000
    -        LatD 25.000000 Latin1 25.000000 Latin2 25.000000
    -        LatSP -90.000000 LonSP 0.000000
    -        North Pole (1073 x 689) Dx 5079.406000 m Dy 5079.406000 m mode 0
    -
    - -

    -The file "junk" can now be interpolated with the -new_grid option. - - - - - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/interpolation.html b/web_docs/interpolation.html deleted file mode 100644 index b7f9ee4..0000000 --- a/web_docs/interpolation.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - Climate Prediction Center - wgrib2: interpolation - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data -> wgrib2 -> longitude-latutide interpolation -
     
    - -

    wgrib2: interpolation

    - - - -

    Introduction

    - -

    -There is no universal grid for data on a sphere. It has been a long-standing -problem that people want to know the latitude/longitude of individual grid points -or to know the value at a specified latitude/longutude point. Another problem -is that many NCEP grib files have the winds specified relative a grid rather than -the Earth's North pole. Consequently one need to rotate the winds to get them -into physical space. - -

    -For wgrib2, I have added some grid specific capabilities, - - -

      -
    • display latitude-longitude of individual grid points -
    • include latitude-longitude values in "dumps" -
    • find nearest neighbor values to specified latitude-longitude points -
    • find nearest neighbor values to specified latitude-longitude array -
    - -As of 7-2006, the only supported grids are lat-lon, Gaussian, polar stereographic, -Lambert conformal and Mercator. - -

    -The limitations of the code are that the values are not interpolated and are -simply the nearest neighbor values. In addition, the winds are not corrected -if they are grid relative. - -

    -Note, multiple requests can be combined on a singe command line, - -

    -    wgrib2 GRIB_FILE -lon 0 10 -lon 20 30 -

    -The previous line prints the values at (0E, 10N) and (20E, 30N) in the inventory of GRIB_FILE. -

    -    wgrib2 GRIB_FILE -d 1 -lola 0:35:10 -90:19:10 spread txt.out \
    -         -lola 0:11:1 0:11:1 bin bin.out -

    -The previous line writes out an array (0E .. 350E by 10 degrees), (90S .. 90N by 10 degrees) -in spread(-sheet) format in file txt.out and an array (0E .. 10E by 1 degree), (0N .. 10N by -1 degree) in binary format to the file bin.out - - - - -

    Details

    - -Adding grid information is straight forward. A (i,j) -> (lat,lon) routine is used -to create arrays of the latitude, longitude and, in the future, the wind rotation -of each grid point. Using a simple brute-force search, the nearest neighbor values -are then found. In theory, a (lat-lon) -> (i,j) routine would be faster for some -operations and allow binlinear interpolation. - -

    -The input GRIB-2 file should only have a single grid-type for maximum -efficiency. Whenever a different GDS (grid specifications) is encountered, -the lat-lon and nearest neighbors are recomputed. - - -

    Status

    -The interpolation and lat-lon code is new and not well tested. - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/inv.html b/web_docs/inv.html deleted file mode 100644 index d4848a5..0000000 --- a/web_docs/inv.html +++ /dev/null @@ -1,217 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lon - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-inv -
     
    - -

    wgrib2: -inv

    -
    - - -

    Introduction

    - -

    -The -inv option redirects the inventory to -a file. This option could be used with an option to send decoded -data to STDOUT. - -

    -$ wgrib2 file -inv my.inv -text - -no_header  -match ':HGT:500 mb:' |  JOB
    -
    -  -inv my.inv   writes the inventory to my.inv
    -  -text -       write the decoded data as a text file to stdout
    -  -no_header    no header
    -  JOB           is some program that reads the raw data from stdin
    -
    - -

    -The -inv option is similar but different from saving -stdout. - -

    -$ wgrib2 file -inv my.inv
    -$ wgrib2 file >my.inv2
    -
    -

    - -In the above example, my.inv and my2.inv will be the same. However, -wgrib2 can be used as a grib filter. In this case, grib data is read -from stdin and written to stdout. - -

    -$ cat FILE1 FILE2 | wgrib2 - -match ':HGT:500 mb:' -grib - -inv /dev/null | \
    -   wgrib2 - -new_grid_winds earth -new_grid ncep grid 3 newgrd.grb
    -
    - - -

    -The -inv option is very specialized and helps -when you want to imbed wgrib2 within another program. For example, -reading a grib2 record from within perl program is easy. - -

    -  open(DATA, "wgrib2 file -inv /dev/null -text - -no_header -match ':HGT:500 mb:' |");
    -
    - - -

    Usage

    -

    - -

    --inv FILE
    -
    - -See also: --text --bin -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, updated 11/2019 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/inv_f77.html b/web_docs/inv_f77.html deleted file mode 100644 index f674b8d..0000000 --- a/web_docs/inv_f77.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -inv_f77 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -inv_f77 -
     
    - -

    wgrib2: -inv_f77

    -
    - - -

    Introduction

    - -

    -The -inv_f77 option writes the match inventory -(see the -match_inv option) to a file -that is readable by a fortran unformatted I/O statement. The -format is more or less standand and consistes of a 4-byte integer -of number of bytes in the character string, -the character string and 4-byte integer with the length of the -character string as a trailer. If the match inventory is shorter -than the character string, it is padded with blanks. If the -match inventory is longer, it simply truncated. Not all fortran -compilers support this format. - -

    Usage

    -

    -

     -inv_f77 OPTION CLEN FILE
    -   
    -   OPTION = "ieee" or "bin"
    -      bin = native format
    -      ieee = 4-byte big_endian header/trailer (default)
    -             4-byte little_endian header/trailer (by option)
    -   CLEN = integer, the length of the character string
    -   FILE = output file
    -
    - -

    Example

    -

    -

    -  wgrib2 IN.grb -inv_f77 bin 100  inv.dat
    -
    -  character*100  m_inv
    -  open(unit=11,file='inv.dat',form='unformatted')
    -  read(11) m_inv
    -  write(*,*) 'first record:',trim(m_inv)
    -  read(11) m_inv
    -  write(*,*) 'second record:',trim(m_inv)
    -
    - -

    -The -inv_f77 option was added to facilitate the -writing of fortran codes that can read wgrib2 output. - -See also: --match_inv -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/irr_grid.html b/web_docs/irr_grid.html deleted file mode 100644 index fedbbc5..0000000 --- a/web_docs/irr_grid.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -irr_grid - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -irr_grid -
     
    - -

    wgrib2: -irr_grid

    -
    - - -

    Introduction

    - -

    -This option will be elimated as template 3.130 was not adopted into the grib standard. -

    -The grib2 format allows irregular grids; that is, grids that are defined by a list of latitude-longitude pairs. -This extension to the grib2 format allows you to handle models with unusual grids, -model data interpolated to a specific point and even observations. -Why would you use grib to handle point data rather than other -formats such as BUFR or netcdf? Some formats are difficult to use and converting between from grib to netcdf/BUFR -will lose metadata. Keeping the keeping the point data in grib facilitates the conversion between gridded -and collection-of-points data. For the conversion, wgrib2 can do nearest neighbor and a Cressman analysis. - -

    Space

    -

    -Each grid point has a 4-byte latitude and a 4-byte longitude value. This is an -8 * num_grid_point byte overhead. Since each grib message is independent, this -overhead has to be repeated for each grib message even if the grid is unchanged. -Howver, the grib format allows submessages so the overhead is only for the first -submessage. However, the length of any grib message has to be -less than 2 GB in order to be compatible a 32-bit machines. In practice you should -keep the message size smaller in order not to use up all the free memory. - - -

    Usage

    -
    --irr_grid LON-LAT-LIST RADIUS OUT
    -
    -LON-LAT-LIST   = lon-lat list, lon1:lat1:lon2:lat2:...:lon-n:lat-n
    -RADIUS         = radius in km
    -OUT            = output grib file
    -
    -The -irr_grid option creates an irregular grid using nearest-neighbor interpolation.
    -If no input grid point is within RADIUS kms, the resulting grid has a undefined value.
    -
    - -

    Example: make file with grid points at (10W,20N) (30W,40N)

    -
    -$ wgrib2 flx.grb2 -irr_grid 10:20:30:40 1000 2pt.grb2
    -1:0:d=2009010100:UFLX:surface:0-1 month ave fcst:
    -$ wgrib2 -V 2pt.grb2
    -1:0:vt=2009010100:surface:0-1 month ave fcst:UFLX Momentum Flux, U-Component [N/m^2]:
    -    ndata=2:undef=0:mean=0.0129:min=0.0035:max=0.0223
    -    grid_template=130:winds(N/S):
    -        Irregular Grid:(2 x 1) units 1e-06 input raw output raw res N/A
    -        lat=20.000000 40.000000 
    -        lon=10.000000 30.000000 
    -
    -1st point lon=10W lat=20N
    -2nd point lon=30W lat=40N
    -
    - -See also: --grib_out_irr, --lola, --cress_lola, - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git "a/web_docs/jj\177\177\177" "b/web_docs/jj\177\177\177" deleted file mode 100644 index 2726cea..0000000 --- "a/web_docs/jj\177\177\177" +++ /dev/null @@ -1,580 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -rpn - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rpn -
     
    - -

    wgrib2: -rpn

    -
    - - -

    Introduction

    - -

    -The -rpn option runs a reverse polish notation -(RPN) -calculator. Having a built-in calculator is quite handy. We use it to convert -units (ex. geopotential to geopotential meters, accumulations to rates), -compute simple quantities (net flux from downward and upward fluxes), -and even compute the plant hardiness index from the 2 m temperatures. The goal -of the calculator is to reduce the need to write simple grib programs that -do simple calculations. - -

    The "hardware" of the rpn calculator consists of 20 registers -and a stack (10 entries deep). (Wgrib2 prior to 2.0.6 has 10 registers.) -Stack entries and registers are arrays rather floating point numbers on -your store-bought calculator. - -

    -The conceptual model of the >-rpn calculator is the -grid values array is the top of the stack. The calculator has -a statck that is 10 entries deep and 20 registers. When -ever you enter rpn mode, the stack is cleared except for the -top of the stack. The registers are only clears when you -"turn on" the calculator; that is start the wgrib2 utility -or the first call to wgrib2 if you are using calling wgrib2 -through wgrib2api or pywgrib2. - -

    To save the calculations, you can save them in a register -or write them out by -grib_out, -bin, -ieee, -text, etc. - - -

    Callable wgrib2, wgrib2api

    - -

    Callable Wgrib2 and wgrib2api use the -rpn registers to transfer -gridded data between the calling program and the wgrib2 subroutine. A Fortran or C -program can read and write the wgrib2's RPN registers. For example, if a program -wants to write a grib2 file, it would first place the grid values into a register. -The calling program would then call the wgrib2 subroutine with instructions to -read a template, replace the grid values with the register values, and then -write a grib message. - -

    Implementation Details

    - -

    The size of a registers may differ as the size of grids can also vary in a grib file. -However the size of the register has to match the size of the stack entry in order -"recall" the register. - -

    Wgrib2 always reads a grib message before processing it using commmands like -rpn. -This sets the size of the data array. Thus the size of the stack entries is always -the size of the grib message that is being processed. - -

    The conceptual moddel is the data array (grid values) is the -top of the stack. The implmentation is that the data array is copied -to the top of the stack when -rpn is run, and the top of the stack is -copied to the data array when -rpn is finished. An error message -will occur if the top of the stack is empty when -rpn finishes. - -

    Limitations of -rpn

    - -

    -The -rpn option was designed for -simple calculations. For more complicated calculations, you -should use a real programming language. You can do the -calculations in another step and then import the results -using one of the various -import_* options. You can -use wgrib2api (Fortran and C) to read the data into a Fortran -or C program, do the calculation and then write the data out -using wgrib2. Finally you can use python and one of the pywgrib2 -packages to do the calculation using Python, numpy and - pywgrib2. - -

    Uses

    -
      -
    • change of units when importing data (gribifying data) -
    • computations: ex, U,V -> wind speed, wind direction, potential temperature -
    • merging data -
    • complex masking of data -
    • changing units before writing text/ieee files -
    • removing extreme data values -
    • finding min and max values -
    • finding the globally averaged precipitation -
    • comparing fields -
    - - -

    Usage

    -

    - -

    --rpn  "A:B:C:..."
    -    A,B,C,.. = number, rpn function, or rpn operator
    -
    - -

    -Operators and Functions: -

    -Pop X, Push Fn(X)
    -
      -
    • abs: absolute value -
    • acos: arc cos, [0, pi] radians -
    • alt_x_scan: changes alternate x scanning to regular x scanning and vice versa -
    • asin: arc sin, result is [-pi/2, pi/2] radians -
    • atan: arc tan, result is [-pi/2, pi/2] radians, see atan2 -
    • abs: absolute value -
    • ceil: smallest integer >= X -
    • cos: cosine, argument in radians -
    • exp: e^X -
    • floor: largest integer <= X -
    • ln: natural logorithm -
    • raw2: convert from input scan order to output scan order -
    • sin: sine, argument in radians -
    • smth9g: smth9 for global fields -
    • smth9r: snth9 for regional fields -
    • sq: X*X -
    • sqrt: square root -
    • tan: tangent, argument in radians -
    • xave: for nx-ny grids, averages in the x direction (normally zonal mean) -
    • xdev: for nx-ny grids, remove x average (normally deviation from zonal mean) -
    • yrev: for nx-ny grids, changes we:sn to we:ns and vice versa -
    • 1/x: 1/X -
    • 2raw: convert from output scan order to input scan order -
    -Pop Y, Pop X, push Fn(X,Y) -
      -
    • +: push X+Y -
    • -: push X-Y -
    • *: push X*Y -
    • /: push X/Y -
    • <: push X < Y (1/0 if true/false) -
    • <=: push X <= Y (1/0 if true/false) -
    • ==: push X == Y (1/0 if true/false) -
    • !=: push X != Y (1/0 if true/false) -
    • >=: push X >= Y (1/0 if true/false) -
    • >: push X > Y (1/0 if true/false) -
    • atan2: push arctan(X/Y), result is [-pi, pi] radians, see atan -
    • pow: push X**Y (X^Y) -
    • mask: if (Y != 0) push(X) else push(UNDEFINED) -
    • max: push max(X,Y), for logical values, max is the same as OR -
    • merge: if (Y != UNDEFINED) push(Y) else push(X) -
    • min: push min(X,Y), for logical values, min is the same as AND -
    -Note: an operation involving an UNDEFINED is UNDEFINED -
    - - - -Stack Operators: -
    -
      -
    • clr, clear the stack (stack is emptied) -
    • dup, duplicate the top of the stack -
    • pop, remove the top of the stack -
    • exc/swap, exchange the top 2 stack entries -
    -
    -Register Operators: (note: CW2 v2.0.6+ uses registers 7,8,9 prior versions 0,1,2) -
    -
      -
    • clr_I, clear register I, I=0,1..,9 (19 for v2.0.6+) -
    • rcl_I, push register I on top of stack, I=0,1..,9 (19 for v2.0.6+) -
    • sto_I, save top of stack in register I, I=0,1..,9 (19 for v2.0.6+) -
    • rcl_lat, push latitudes onto the top of the stack (degrees) -
    • rcl_lon, push longitudes onto the top of the stack (degrees) -
    • sto_lon, save top of stack as longitudes (degrees) (wgrib2 v3.0.0+) -
    • sto_lat, save top of stack as latitudes (degrees) (wgrib2 v3.0.0+) -
    • note: latitudes and longitudes are double precision values, the stack is single precision -
    -
    - -Variables and Constants: put on the top of the stack -
    -
      -
    • number number = floating point or integer number like 0, 10.1, -1.23e-4 -
    • days_in_ref_month number of days in the month for the reference date (conversion between monthly acc. and rates) -
    • days_in_verf_month number of days in the month for the verification time (conversion betwee monthly acc. and rates) -
    • pi 3.1415.... -
    • rand random number uniformly distributed between 0 and 1, each grid point has a different random number -
    -
    - -Printing Operators: -
    -
      -
    • print_corr, write cosine weighted spatial correlation, data[TOP] data[TOP-1] -
    • print_max, print_min, data[TOP] -
    • print_rms, write cosine weighted RMS, data[TOP]-data[TOP-1] -
    • print_diff, write cosine weighted difference, data[TOP-1]-data[TOP] -
    • print_ave, write cosine weighted average, grid_ave(data[TOP]*cos(grid))/grid_ave(cos(grid)) -
    • print_wt_ave, write weighted average grid_ave, data[TOP] is the weighting - print grid_ave(data[TOP]*data[TOP-1])/grid_ave(data[TOP]) -
    -
    - - -

    Example 1

    -

    -The standard units of grib temperature is K but you want the text output in Celcius. -

    -$ wgrib2 a.grb -match ":TMP:850 mb:" -rpn "273.15:-" -text C.dat
    -
    - -

    -Fahrenheit is easy too (F = (K-273.15)*9/5+32). -

    -$ wgrib2 a.grb -match ":TMP:850 mb:" -rpn "273.15:-:9:*:5:/:32:+" -text F.dat
    -
    - -

    Example 2

    -

    -Suppose you want to limit the relative humidity values to 100. This example only -affect the RH fields. All submessages will be converted into messages. -

    -$ wgrib2 a.grb -if ":RH:" -rpn "100:min" -fi -grib_out out.grb -not_if ":RH:" -grib out.grb
    -
    -
    - -

    Example 3

    -

    -Suppose that you wanted the 500 to 1000 mb thickness, and the file only contained -one field of Z1000 and one field of Z500. - -

    -$ wgrib2 IN.grb -match ":HGT:" -match ":(500|1000) mb:" \
    -     -if ":500 mb:" -rpn sto_1 -fi \
    -     -if ":1000 mb:" -rpn sto_2 -fi \
    -     -if_reg "1:2" \
    -         -rpn "rcl_1:rcl_2:-:clr_1:clr_2" \
    -         -set_var THICK -set_lev "500-1000 mb" \
    -         -set_grib_type c3 -grib_out OUT.grb
    -
    -     line 1: only process the HGT at 500 and 1000 mb which save processing time
    -     line 2: store HGT at 500mb in register 1
    -     line 3: store HGT at 1000mb in register 2
    -     line 4: if (register 1 and register 2 have values then
    -     line 5: calculate the thickness: reg_1 - reg_2
    -     line 6: set variable type to THICK, and level to "500-1000 mb"
    -     line 7: write out the WIND data to a grib file with complex compression
    -
    -     Note: this is a very simple script and that doesn't check the matching
    -     date code, grid type, etc.
    -
    -
    -

    Example 4

    -

    -Write out the 500 mb wind speed. -

    -$ wgrib2 IN.grb -match ":[UV]grd:500 mb:" \
    -     -if ":UGRD:" -rpn "sto_1" -fi \
    -     -if ":VGRD:" -rpn "sto_2" -fi \
    -     -if_reg 1:2 \
    -         -rpn "rcl_1:sq:rcl_2:sq:+:sqrt:clr_1:clr_2" \
    -         -set_var WIND \
    -         -grib_out out.grb
    -
    -     line 1: only process the U and V at 500 mb
    -     line 2: store U 500mb in register 1
    -     line 3: store V 500mb in register 2
    -     line 4: if (register 1 and register 2 have values then
    -     line 5: calculate the wind speed: sqrt(reg_1**2 + reg_2**2)
    -     line 6: set variable type to WIND (wind speed)
    -     line 7: write out the WIND data to a grib file
    -
    -     Note: this is a very simple script and that doesn't check the matching
    -     date code, grid type, etc.
    -
    -     Note: there are options to calculate wind speed and wind direction
    -
    - - -

    Example 5

    -

    -Suppose someone made a mistake and the latent heat flux (LHTFL) had the wrong sign. RPN to the rescue. - -

    -$ wgrib2 IN.grb -match ":LHTFL:" -rpn "-1:*" -grib_out new_lhtfl.grb
    -
    - -The file, new_lhtfl, only contained the LHTFL fields. You duplicate the file with the -fixed LHTFL fields by - -
    -$ wgrib2 IN.grb -if ":LHTFL:" -rpn "-1:*" -fi -grib_out new.grb
    -
    - -It would be faster if you only compressed the LHTFL fields. (-grib uses the -original compressed data and -grib_out uses the "data" register.) - -
    -$ wgrib2 a.grb -set_grib_type jpeg \
    -   -not_if ":LHTFL:" -grib new.grb -if ":LHTFL:" -grib_out new.grb
    -
    - - -If both the latent and sensible heat fluxes needed a sign reversal, you could do, - -
    -$ wgrib2 a.grb -if ":(LHTFL|SHTFL):" -rpn "-1:*" -fi -grib_out new.grb
    -
    -

    Example 6

    -If you want to set certain values to undefined, you define a mask and then -apply the mask. In this example, values below 20 are set to undefined. - -
    -$ wgrib2 a.grb -rpn "dup:20:>=:mask" -grib_out -set_grib_type c3 new.grb 
    -
    -The RPN calculator is used:
    -    dup       the data is duplicated
    -    20        20 is pushed on the stack
    -    >=        test data >= 20, top of stack is 1/0 depending on test >= 20
    -    mask      apply mask to the data
    -
    --set_grib_type c3    sets the grib compression to complex3
    --grib_out new.grb    writes a grib message using the decoded data
    -
    - -Don't forget to enclose the argument to rpn in quotes because the shell can do unexpect things. - -Printing operators -
    - print_corr write cosine weighted spatial correlation R(TOP-1), R(TOP)
    - print_max write max(R(TOP)) to stdout
    - print_min write min(R(TOP)) to stdout
    - print_rms write cosine weighted RMS(R(TOP-1)-R(TOP))
    -
    - -

    Example 7: Merging

    - -

    -Suppose that we have a nested model, we have a low resolution TMP2m from the -the outer model and a high-resolution TMP2m from the nested model. Now we -want a field that uses the TMP2m in the nested-model domain and the TMP2m from -the outer model elsewhere. To do this, you need to convert both fields to a -common grid. Then you use "-rpn merge". Make sure that both domains are -contained in the common grid as this is a requirement of the interpolation library. - -

    -   wgrib2 OUTER.T2m -new_grid_winds earth -new_grid A B C A1.grb
    -   wgrib2 NESTED.T2m -new_grid_winds earth -new_grid A B C A2.grb
    -   wgrib2 A2.grb -rpn sto_1 -import_grib A1.GRB -rpn "rcl_1:merge" \
    -    -grib_out MERGED.T2m
    -
    - - -

    Example 8: Land Mask

    -The file mask.grb contains the values 0 for water, 1 for land and -2 for sea ice. I wanted a small file with 0 for water+sea-ice and 1 for land. - -
    -wgrib2 mask.grb -rpn "1:==" -set_scaling 0 1 -set_grib_type c1 -grib_out land.grb
    -
    -  -rpn "1:=="        if grid value is 1, the new value is 1 else 0
    -  -set_scaling 0 1   1 bit for storing the grib values
    -  -set_grib_type c1  complex packing 1 is good for long runs of the same value.
    -   The file sizes  16 bits/point 16 bits precision simple packing (mask.grb)
    -                   0.7 bits per point 16 bits precision complex packing 1 (mask.grb)
    -                   0.2 bits per point complex packing 1 (land.grb)
    -   grid size: 131K points, land.grb is 3331 bytes
    -
    - - -

    Example 9: Total-total index

    -

    -An example of calculating the dewpoint and -total-total index is more involved. Using an on-line infix to postfix (reverse polish) -calculator is helpful. - -

    Example 10: global precipitation

    -

    The model has the precipitation in the variable PRATE -which has units of mm/sec (assuming 1 gm H2O = 1cc). Suppose -I wanted the globally averaged precip in the non-metric unit -of mm/day. It's one command away -

    -  wgrib2 gfsfile -match PRATE -s -rpn "86400:*" -stats
    -
    - -

    Changes

    - -

    Wgrib2 v3.0.0+ adds error chechking to floating point values, -

    -   wgrib2 prior to 3.0.0
    -
    -      wgrib2 IN.grb -rpn "2cars:+" -grib_out OUT.grb
    -           adds 2 to the grid point values as atof("2cars") returns 2.0
    -
    -   wgrib2 v3.0.0+
    -
    -      wgrib2 IN.grb -rpn "2cars:+" -grib_out OUT.grb
    -          will result in an error message as "2cars" is not a legal floating point value
    -
    -

    Comments

    -

    -Warning: Reverse Polish notation can cause headaches if you try something -too complicated. An infix -> postfix calculator is the suggested -remedy. Another approach is to use pywgrib2_s, pywgrib2_xy, or pywgrib2_lite. - - -

    -The -rpn option is a piece of easy to -understand and modify code (RPN.c). If you want to add -a specialized function (ex. wind chill calculation), you many -consider adding it to the RPN calculator. The another method -is to code your calculation in python and use pywgrib2_s, -pywgrib2_xy or pywgrib2_lite. - -

    -Why an RPN calculator? Well, wgrib2 is heavily influenced by the stack language Forth. -It's only natural that the calculator would be based on reverse -Polish notation. - -

    -See also: --if, --if_reg, --fi, --grib_out, --rpn_rcl, --rpn_sto, - - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Aug 4, 2016, Oct 10, 2018, July 11, 2020, July 11, 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/last.html b/web_docs/last.html deleted file mode 100644 index 6505568..0000000 --- a/web_docs/last.html +++ /dev/null @@ -1,216 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -last - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -last -
     
    - -

    wgrib2: -last

    -
    - -

    Introduction

    - -

    The -last FILE option writes the results of the previous option -to FILE. The FILE can be a disk file, temporary file or memory file. If -the -last option preceeds any inventory options, then the -"grib message number[.submessage number:byte location" will be written to the file. - -

    The -last option was designed for callable wgrib2 to obtain -inventory information. -Note the -s_out FILE option should be replaced by the -more powerful -s -last FILE syntax. - -

    The -last option does not write to the inventory, so -if you have two consecutive -last options, the second --last will have no output. With wgrib2 v3.0.0+, the --last and -last0 options will -not clear the last option output buffer. -So the the second -last option will have the same output -as the immediately preceeding -last or -last0 -option. - -

    Usage

    -

    - -

    --last FILE
    -
    - -

    Example

    - -Suppose you want a the grid values (nearest neighbor) for 1000 points. You could -do something like this, - -
    -$ wgrib2 gep19.t00z.pgrb2af180 -s -lon 0 10 > point1.txt
    -$ wgrib2 gep19.t00z.pgrb2af180 -s -lon 20 50 > point2.txt
    -...
    -$ wgrib2 gep19.t00z.pgrb2af180 -s -lon 250 40 > point1000.txt
    -
    -This would not be the fastest because you have to read and decode -the input file 1000 times. You could read and decode the file once -by using the -last option. Here how to do it using N=2. - -
    -wgrib2 gep19.t00z.pgrb2af180 -s -last point1.txt -last point2.txt \
    -    -print_out ':' point1.txt -lon 0 0 -last point1.txt -nl_out point1.txt \
    -    -print_out ':' point2.txt  -lon 10 20 -last point2.txt -nl_out point2.txt
    -
    - - -

    The -new_grid option can interpolate to set of -user defined grid points. - -See also: --last0 --new_grid -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 1, 2015, March 5, 2018, June 2, 2020, June 23, 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/last0.html b/web_docs/last0.html deleted file mode 100644 index e0b5267..0000000 --- a/web_docs/last0.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -last0 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -last0 -
     
    - -

    wgrib2: -last0

    -
    - -

    Introduction

    - -

    The -last0 FILE option writes the results of the previous option -to the beginning of FILE. The FILE can be a disk file, temporary file or memory file. If -the -last option preceeds any inventory options, then the -"grib message number[.submessage number:byte location" will be written to the file. - -

    The -last0 option was designed for callable wgrib2. This -allows calls to wgrib2 to obtain inventory information. Note -the -s_out FILE option should be replaced by the -more powerful -s -last FILE syntax. - -

    The -last0 option does not write to the inventory, so -if you have two consecutive -last0 options, the second --last0 will have zero output. With wgrib2 v3.0.0+, the --last and -last0 options will -not clear the last option output buffer. -So the the second -last0 option will have the same output -as the immediately preceeding -last or -last0 -option. - - -

    Usage

    -

    - -

    --last0 FILE
    -
    - -See also: --last -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: September 12, 2017, June 2, 2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/lev.html b/web_docs/lev.html deleted file mode 100644 index ba22620..0000000 --- a/web_docs/lev.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lev - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-lev -
     
    - -

    wgrib2: -lev

    -
    - - -

    Introduction

    - -

    -The -lev option prints the level of the -field. -

    Usage

    -

    - -

    --lev
    -
    - -

    Example

    -

    - -

    -$ wgrib2 grib2.polar -lev
    -1.1:0:500 mb
    -1.2:0:850 mb
    -
    - -See also: -s -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/lev0.html b/web_docs/lev0.html deleted file mode 100644 index e228363..0000000 --- a/web_docs/lev0.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lev0 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-lev0 -
     
    - -

    wgrib2: -lev0

    -
    - - -

    Warning

    - -

    -The -lev0 option is used by the script g2ctl -to generate control files for GrADS. The output of this option is -determined by the needs of g2ctl. - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/libwgrib2.html b/web_docs/libwgrib2.html deleted file mode 100644 index 821fee8..0000000 --- a/web_docs/libwgrib2.html +++ /dev/null @@ -1,186 +0,0 @@ - - - - Climate Prediction Center - libwgrib2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > libwgrib2 -
     
    - -

    libwgrib2

    -
    - - -

    The wgrib2 library

    - -

    -The wgrib2 library contains the callable wgrib2 routine, an -alternative method of calling the wgrib2 routine, a routine to -close files, and routines that -allow access to the rpn registers and memory files, - -

    All the nice-to-use routines used by wgrib2 are considered internal -routines and should not be called. The wgrib2 library is used by the fortran -wgrib2api, C wgrib2api, and pywgrib2. - -

      -
    1. int wgrib2(int argc, const char **argv);
      standard C interface to wgrib2, identical to the wgrib2 utility except for error handling -
    2. int wgrib2a(char *arg1, char *arg2, ...);
      NULL terminated set of text arguments -
    3. int wgrib2_free_file(const char *filename);
      close file *filename -
    4. size_t wgrib2_get_mem_buffer_size(int n);
      get size of memory buffer n in bytes -
    5. int wgrib2_get_mem_buffer(unsigned char *buffer,size_t size, int n);
      copy memory buffer n to buffer[0]:buffer[size-1] -
    6. int wgrib2_set_mem_buffer(const unsigned *buffer, size_t size, int n);
      copy buffer to memory buffer n -
    7. size_t wgrib2_get_reg_size(int reg);
      return size of register n in number of floats -
    8. int wgrib2_get_reg_data(float *data, size_t size, int reg);
      copy register n to data[0]..data[size-1] -
    9. int wgrib2_set_reg_reg(float *data, size_t size, int reg);
      copy data[0]..data[size-1] to register n -
    -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sep 16, 2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/limit.html b/web_docs/limit.html deleted file mode 100644 index a1f56d7..0000000 --- a/web_docs/limit.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -limit - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-limit -
     
    - -

    wgrib2: -limit

    -
    - - -

    Introduction

    - -

    -The -limit option stops the processing of the grib file after N messages/submessages have been decoded. The purpose of this function -to limit amount of CPU time that a web server may devote to an individual -request. - -

    -The newer -alarm option is better suited for stopping jobs web jobs. - -

    Usage

    -

    - -

    --limit N    where N is an integer.
    -
    - -See also: -quit, --alarm - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 3, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/limitations.html b/web_docs/limitations.html deleted file mode 100644 index 4105ea8..0000000 --- a/web_docs/limitations.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - Climate Prediction Center - wgrib2: limitations - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 questions -
     
    - -

    wgrib2: limitations

    -
    - -
      Limitations on 32-bit computer -
    1. The maximum grib file is limited to 2GB unless the file is read sequentially.
      - i.e., cat grib_file | wgrib2 - (rest of options) -
    2. large grib messages and grids will use buffer space and exhaust physical memory. -
    3. grib message is limited to 2GB (fixed v2.0.4) -
    4. Any buffer greater than 4GB is a problem. -
    5. The maximum grib message is limited to 2GB to 4GB (depending on routine) -
    6. The maximum number of grid points varies by routine from to 2G to 4G (grib2 standard=4G).
      - The amount of addressable memory will be a limitation. -
    7. The maximum bit precision of a complex-packed file is 25. -
    - -
      Limitations on 64-bit computer -
    1. The maximum number of grid points varies by routine from to 2G to 4G (grib2 standard=4G).
      - Low priority to get the routines to 4G.
      -
    2. -new_grid is limited to 2G grid points by the fortran library. -
    3. grib message is limited to 2GB (fixed v2.0.4) -
    4. The maximum bit precision of a complex-packed file is 25. -
    - -
      Limitations on computer with 64-bit pointers and 32-bit long integers -
    1. Similar to 32-bit limitations. -
    - - -
      Supported Unpacking Schemes -
    1. simple -
    2. simple with log preprocessing -
    3. complex with bitmaps or special values -
    4. jpeg2000 -
    5. png -
    6. ieee -
    7. RLE -
    8. CCSDS/AEC -
    - -
      Supported Packing Schemes -
    1. simple -
    2. complex with bitmaps or special values -
    3. jpeg2000 -
    4. ieee -
    5. CCSDS/AEC -
    - -
      Grid Support Levels: geolocation -
    1. nothing -
    2. diagnostic inforamtion -
    3. latitude/longitude of the grid points are calculated (spherical earth) -
    4. latitude/longitude of the grid points are calculated (aspherical earth) -
    - -
      Grid Support Levels: ipolates (-new_grid) -
    1. nothing -
    2. can be an input grid for -new_grid -
    3. can be an input or output grid for -new_grid -
    - -
      Grid Support Levels: -small_grib -
    1. nothing -
    2. can be an input grid for -small_grib -
    - - -
      Grid support: -
    • lat-lon: full support -
    • Lambert conformal: full support -
    • Polar stereographic: full support -
    • Mercator: full support -
    • Gaussian: all but -small_grib -
    • thinned lat-lon grids: only geolocation -
    • rotated lat-lon grids: only geolocation -
    • space view perspective: only geolocation -
    • Albers equal area: only geolocation -
    • Lambert Azimuthal equal area: only geolocation -
    • staggering all above except for Gaussian: only geolocation -
    • irregular grid: only geolocation -
    - - - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 27, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/little_endian.html b/web_docs/little_endian.html deleted file mode 100644 index 74b8418..0000000 --- a/web_docs/little_endian.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -big_endian, -little_endian - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -big_endian -little_endian -
     
    -

    - -

    wgrib2: -big_endian -little_endian - -

    - - -

    Introduction

    - -

    -The -big_endian and the --little_endian -options changes the order that IEEE numbers are read and written. This -does not affect the order in which binary numbers are read/written. - - -

    Usage

    -

    - -

    --big_endian
    -   or
    --little_endian
    -
    - - -See also: --ieee, --import_ieee, --header, --no_header, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Aug, 2011 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ll2i.html b/web_docs/ll2i.html deleted file mode 100644 index fed4aa6..0000000 --- a/web_docs/ll2i.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ll2i - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ll2i -
     
    - -

    wgrib2: -ll2i

    -
    - - -

    Introduction

    - -

    -The -ll2i and - -ll2ij options are in alpha status. -

    -The -ll2i has been redefined (v2.0.5) so that it returns -the value 1..ndata. This change was to support grids from 1..2^32 - 1 grid points. -With this change, 0 denotes a lat-lon that is outside of the domain. - -

    -The -lon option uses a brute-force -method to find the closest grid point to a specified latitude -and longitude. It finds the minimum distance to each grid -point. This slow procedure is more-or-less necessary when -your geolocation routines can transfrom from (X,Y) -> (lon, lat) -but not (lon, lat) -> (X, Y). The gctpc/Proj4 geolocation -libraries have both the forward and inverse transformation so -improved geolocation routines can be added to wgrib2 such -as a fast -lon option and a -bilinear interpolation option. - -

    Some grids only have an (i,j) -> (lon,lat) transformation. -(I.e., find that lat-lon of the grid points.) Examples include: -staggered grids, thinned Gaussian grids and irregular grids. - - - -

    -The -ll2i option takes a given latitude and -longitude, finds the grid point that is closest to that specified -latitude and longitude and prints out the index of the grid point. -The -ll2i option uses the gctpc library -and only supports a grids supported by gctpc. - - -Note that updated -ll2i uses the Fortran convention -which has the index starting at one. Note that the index is for -the output grid which may be different from the input grid. -For example, the GFS usually writes the grib files in WE:NS order. -By default, wgrib2 will read a WE:NS input grid and convert it to -to a WE:SN (output) grid. This is explained in the page for the --scan option. - -

    Usage

    -

    - -

    --ll2i LON LAT
    -      LON is the longitude -180..360
    -      LAT is the latitude from -90..90
    -      option prints out the index,  0..number of grid points - 1
    -
    - -

    Example

    - -
    --sh-4.1$ wgrib2 png.grb2 -ll2i 11 22
    -1:4:11.000000 22.000000 -> (40332)
    --sh-4.1$ wgrib2 png.grb2 -ilat 40332
    -1:4:grid pt 40331,lon=10.000000,lat=22.000000,val=3.3
    -
    - - -See also: -ilat, --scan, - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 3, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ll2ij.html b/web_docs/ll2ij.html deleted file mode 100644 index e8b890b..0000000 --- a/web_docs/ll2ij.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ll2ij - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ll2ij -
     
    - -

    wgrib2: -ll2ij

    -
    - - -

    Introduction

    - -

    -The -ll2ij and - -ll2ij options are in alpha status. -

    -The -lon option uses a brute-force -method to find the closest grid point to a specified latitude -and longitude. It finds the minimum distance to each grid -point. This slow procedure is more-or-less necessary when -your geolocation routines can transfrom from (X,Y) -> (lon, lat) -but not (lon, lat) -> (X, Y). The gctpc/Proj4 geolocation -libraries have both the forward and inverse transformation so -improved geolocation routines can be added to wgrib2 such -as a fast -lon option and a -bilinear interpolation option. - -

    Some grids only have an (i,j) -> (lon,lat) transformation. -(I.e., find that lat-lon of the grid points.) Examples include: -staggered grids, thinned Gaussian grids and irregular grids. - - - -

    -The -ll2ij option takes a given latitude and -longitude, finds the grid point that is closest to that specified -latitude and longitude and prints out the ix and iy of the grid point. -The -ll2i option uses the gctpc library -and only supports a grids supported by gctpc. - - -

    -See also: -ijlat, --ll2i - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan 20, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/lola.html b/web_docs/lola.html deleted file mode 100644 index 86778f0..0000000 --- a/web_docs/lola.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lola - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-lola -
     
    - -

    wgrib2: -lola

    -
    - - -

    Introduction

    - -

    -The -lola option was not named after a girl but for extracting data -on a LOngitude-LAtitude grid. You need to specify the lower -left corner of the grid, the number of points in the zonal and meridional directions -and the latitude/longitude increments. Finally you need to specify the output file -and the format. WARNING: winds and other vector fields will not be -rotated. If the vector fields use a grid relative orientation, -then your interpolated winds will be using the original grid. - - -

    Interpolation scheme

    -

    -The interpolation to the lola grid is by nearest neighbor. Sure there are more -accurate schemes and people are welcome to do better. Warning: the interpolation -scheme simply picks up the value of the nearest neighbor. This can be very -inaccurate for winds and other vectors near the pole. - -

    Usage

    -

    - -

    --lola LonSW:#lon:dlon LatSW:#lat:dlat file format
    -
    -LonSW        Longitude of the South-West point, values from 0 .. 360
    -#lon         number of longitude points
    -dlon         spacing of the points in the zonal direction in degrees
    -
    -LatSW        Latitude of the South-West point, values from -90 .. 90
    -#lat         number of latitude points
    -dlat         spacing of the points in the meridional direction in degrees
    -
    -file         name of the output file
    -
    -format       format of the output file: bin, text, spread
    -               bin = binary
    -               text = simple "text" format, one value per line
    -               spread = spread-sheet format, latitude, longitude and value of each grid point
    -               grib = grib2
    -
    -The order of the data points is WE:SN (wgrib2 standard).
    -
    -
    - -

    Comments

    -I dislike this routine. It is slow, uses a simplistic interpolation -scheme and doesn't handle rotated winds in a useful manner. -

    -The grib file support allows you to make lat-lon templates which is used by -g2grb.gs. As much as I dislike this routine, I keep using it for interpolations. -Keep wanting to modify it to do bilinear interpolations for interpolating from -lat-lon grids. - -

    -5/2010: interpolation from regular lat-lon grids is now handled as special case. -This speeds up the interpolation and paves the way for a bilinear interpolation -for the special cases. - -

    -See alse: -lon -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/lon.html b/web_docs/lon.html deleted file mode 100644 index 7c515f1..0000000 --- a/web_docs/lon.html +++ /dev/null @@ -1,315 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lon - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-lon -
     
    - -

    wgrib2: -lon

    -
    - - -

    Introduction

    - -

    -The -lon option prints the value of the grid point -closest to the specified longitude latitude. The latitude-longitude of the grid -point are also printed. If you use the verbose mode, the grid -coordinates (i,j) and the number of the element are also printed. -The -lon option can be repeated to save processing -time. - -

    --sh-2.05b$ wgrib2 eta.t00z.awphys18.grb2 -d 1 -s -lon 249 39 -lon 255 33
    -1:0:d=2003090300:MSLET:mean sea level:18 hour fcst:lon=249.035,lat=38.9912,val=101685:
    -lon=254.964,lat=32.9671,val=101668
    -
    --sh-3.00$ wgrib2 rtma.t12z.2dvaranl_ndfd.grb2.c2 -d 1 -v -lon -120 30
    -1:0:lon=240.008805,lat=29.988418,i=220037,ix=72,iy=206,val=0
    -
    - -In the latter example, the verbose mode has been set and -the inventory includes both the value, location and its -grid coordinates; i.e., the 220037th element in the array and -its coordinates are (72,206). Note that these coordinates -are after the data has been converted into a WE:SN scan order. -Both the i, ix and iy start with a value of one. - -

    Usage

    -

    - -

    --lon LONGITUDE LATITUDE
    -      LONGITUDE = 0 .. 360
    -      LATITUDE = -90 .. 90
    -
    -      If the verbosity is 0, the print out the longitude and
    -        latitude of the nearest grid point as well as the grid value.
    -
    -      If the verbosity is 1 or higher, the prints out the longitude and
    -        latitude of the nearest grid point, the index (i) to the data,
    -        the grid coordinates (ix,iy) as well as the grid point value.
    -
    -        i = 1..number of grid points
    -        ix = 1..nx
    -        iy = 1..ny
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -s -lon -90 20
    -1:0:d=2005090200:HGT:1000 mb:60 hour fcst:lon=270,lat=20,val=121.3
    -2:133907:d=2005090200:HGT:975 mb:60 hour fcst:lon=270,lat=20,val=344.4
    -3:263511:d=2005090200:HGT:950 mb:60 hour fcst:lon=270,lat=20,val=573
    -4:389058:d=2005090200:HGT:925 mb:60 hour fcst:lon=270,lat=20,val=806.5
    -...
    -
    - -

    Old vs New

    - -

    The original code for the --lon option used the internal geolocation package. -This package could compute the lat/lon of the grid points but -nothing else. To find the grid point closest to a specified -lat/lon, the distance to every grid point had to be calculated. -Later, a short cut was added for lat-lon grids. Finally the -geolocation packages gctpc and Proj4 have inverse functions -which allow you to find the closest grid point to specified point -for the the supported grids. For unsupported grids like the -Gaussian grid and staggered grids, the original brute force -code is used. You can turn off the new code by the --gctpc 0 option. The old code did -not know about grid domains and would find the closest point -even if the point were outside of the grid domain. The -gctpc-based closest will return a lat=lon=999 to signal an -intial point outside of the domain. - - -

    Want Speed?

    - -

    You want extract the values for a 1000 different points. -So you call wgrib2 1000 times and complain that wgrib2 is slow. -Well decoding a jpeg2000 compressed file 1000 times does take time. -It's better to add a 1000 -lon options to the -command line and only decode the file once. - -

    The number of -lon options on a -command line is limited by a compile-time option. Try -running wgrib2 -config and look for the line -"maximum number of arguments on command line:". The current -value is 5000 which allows you 5000 words on the command line. Each --lon option takes 3 words, so that gives -you about 1600 -lon options you can run -on one line. Of course, limitations such as the maximum line -length or maximum number of continuations may stop you first. - -

    Text, Binary and CSV Output

    - -

    The -lon option writes the grid value -to the inventory. What happens if you want the output written -to a file. You could write the output of --lon to a file by using the --last option. - -

    -$ wgrib2 gep19.aec -lon 10 20  -last junk -nl_out junk -for 1:3
    -1:0:lon=10.000000,lat=20.000000,val=12391.6
    -2:70707:lon=10.000000,lat=20.000000,val=219.5
    -3:96843:lon=10.000000,lat=20.000000,val=85
    -$ cat junk
    -lon=10.000000,lat=20.000000,val=12391.6
    -lon=10.000000,lat=20.000000,val=219.5
    -lon=10.000000,lat=20.000000,val=85
    -
    - -

    -You can also use the -lola option which can -write a 1x1 grid to binary, text or a grib file. - -

    -$ wgrib2 gep19.aec -no_header -lola "10:1:1" "20:1:1" out.txt text -for 1:3
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -2:70707:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    -3:96843:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    -$ cat out.txt
    -12391.6
    -219.5
    -85
    -
    - -You can make a CSV file by first converting the grib file and running wgrib2 on that -grib file. - -
    -$ wgrib2 gep19.aec -no_header -lola "10:1:1" "20:1:1" out.grb grib -for 1:3
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -2:70707:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    -3:96843:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    -$ wgrib2 out.grb -csv out.csv
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -2:182:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    -3:364:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    -$ cat out.csv
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",10,20,12391.6
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","TMP","200 mb",10,20,219.5
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","RH","200 mb",10,20,85
    -
    - - -

    -See also: -last, --lola, --config - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Oct 25, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/long_cmd_list.html b/web_docs/long_cmd_list.html deleted file mode 100644 index d6d6ef3..0000000 --- a/web_docs/long_cmd_list.html +++ /dev/null @@ -1,538 +0,0 @@ - - - - Climate Prediction Center - wgrib2: - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - -
     
    -
    -wgrib2 v3.1.1rc1 4/2022  Wesley Ebisuzaki, Reinoud Bokhorst, John Howard, Jaakko Hyvätti, Dusan Jovic, Daniel Lee, Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Gregor Schee, Arlindo da Silva, Niklas Sondell, Sam Trahan, George Trojan, Sergey Varlamov
    -   stock build
    - -else            else         else, -if ... -else ... -endif
    - -elseif          elif  X      elseif X (POSIX regular expression) conditional on match, -if ... -elseif ... -endif
    - -elseif_fs       elif  X      elseif X (fixed string) conditional execution
    - -elseif_n        elif  X      elseif (inv numbers in range), X=(start:end:step)
    - -elseif_rec      elif  X      elseif (record numbers in range), X=(start:end:step)
    - -elseif_reg      elif  X      elseif rpn registers defined, X = A, A:B, A:B:C, etc A = register number
    - -endif           endif        terminates if block
    - -if              if    X      if X (POSIX regular expression), conditional execution on match
    - -if_delayed_error if           if delayed error
    - -if_fs           if    X      if X (fixed string), conditional execution on match
    - -if_n            if    X      if (inv numbers in range), X=(start:end:step)
    - -if_rec          if    X      if (record numbers in range), X=(start:end:step)
    - -if_reg          if    X      if rpn registers defined, X = A, A:B, A:B:C, etc A = register number
    - -not_if          if    X      not_if X (regular expression), conditional execution on not match
    - -not_if_fs       if    X      if X (fixed string) does not match, conditional execution up to next output/fi
    - -0xSec           inv   X      Hex dump of section X (0..8)
    - -aerosol_size    inv          optical properties of an aerosol
    - -aerosol_wavelength inv          optical properties of an aerosol
    - -bitmap          inv          bitmap mode
    - -center          inv          center
    - -checksum        inv   X      CRC checksum of section X (0..8), whole message (X = -1/message) or (X=data)
    - -cluster         inv          cluster identifier
    - -cluster_info    inv          cluster information
    - -code_table_0.0  inv          code table 0.0 discipline
    - -code_table_1.0  inv          code table 1.0 master table version
    - -code_table_1.1  inv          code table 1.1 local table version
    - -code_table_1.2  inv          code table 1.2 significance of reference time
    - -code_table_1.3  inv          code table 1.3 production status of processed data
    - -code_table_1.4  inv          code table 1.4 type of processed data
    - -code_table_1.5  inv          Identification template number
    - -code_table_1.6  inv          calendar
    - -code_table_3.0  inv          code table 3.0 Source of grid definition
    - -code_table_3.1  inv          code table 3.1 Grid definition template number
    - -code_table_3.11 inv          code table 3.11 regional/global thinned/reduced grid
    - -code_table_3.15 inv          code table 3.15 Physical meaning of vertical coordinate
    - -code_table_3.2  inv          code table 3.2 Size (radius) and Shape of Earth
    - -code_table_3.20 inv          code table 3.20 Type of Horizontal line
    - -code_table_3.21 inv          code table 3.21 Vertical Dimension coordinate values defn
    - -code_table_3.6  inv          code table 3.6 Spectral data representation type
    - -code_table_3.7  inv          code table 3.7 Spectral data representation mode
    - -code_table_3.8  inv          code table 3.8 Grid point position
    - -code_table_4.0  inv          code table 4.0 Product Definition Template Number
    - -code_table_4.1  inv          code table 4.1
    - -code_table_4.10 inv          code table 4.10 statistical processing .. first occurence
    - -code_table_4.11 inv          code table 4.11 (first) type of time intervals
    - -code_table_4.11s inv          code table 4.11 (all) type of time intervals
    - -code_table_4.15 inv          code table 4.15 type of areal statistical processing
    - -code_table_4.16 inv          code table 4.16 quality control value
    - -code_table_4.2  inv          code table 4.2
    - -code_table_4.230 inv          code table 4.230 chemical constituent type
    - -code_table_4.233 inv          code table 4.233 aerosol type
    - -code_table_4.235 inv          code table 4.235 Wind-generated wave spectral description
    - -code_table_4.240 inv          code table 4.240 Type of distribution function
    - -code_table_4.241 inv          code table 4.241 coverage attributes
    - -code_table_4.242 inv          code table 4.242 tile classification
    - -code_table_4.3  inv          code table 4.3 Type of Generating Process
    - -code_table_4.4  inv          code table 4.4 (first)
    - -code_table_4.5a inv          code table 4.5 (1st value)
    - -code_table_4.5b inv          code table 4.5 (2nd value)
    - -code_table_4.6  inv          code table 4.6 ensemble type
    - -code_table_4.7  inv          code table 4.7 derived forecast
    - -code_table_4.8  inv          code table 4.7 derived forecast
    - -code_table_4.9  inv          code table 4.9 Probability Type
    - -code_table_4.91 inv          code table 4.91 type of interval
    - -code_table_4.91b inv          code table 4.91 type of interval (2nd copy)
    - -code_table_5.0  inv          code table 5.0 data representation number
    - -code_table_5.1  inv          code table 5.1 type of original field values
    - -code_table_5.4  inv          code table 5.4 group splitting method
    - -code_table_5.5  inv          code table 5.5 missing value management for complex packing
    - -code_table_5.6  inv          code table 5.5 complex packing spatial differencing
    - -code_table_5.7  inv          code table 5.7 precision in IEEE packing
    - -code_table_6.0  inv          code table 6.0 Bitmap indicator
    - -ctl_ens         inv          ens info for g2ctl/GrADS
    - -ctl_inv         inv          ctl inventory dump for g2ctl/GrADS
    - -cyclic          inv          is grid cyclic? (not for thinned grids)
    - -disc            inv          discipline (code table 0.0)
    - -domain          inv          find rectangular domain for g2ctl/GrADS plots
    - -end_ft          inv          verf time = reference_time + forecast_time + stat. proc time (YYYYMMDDHH) (same as -vt)
    - -end_FT          inv          verf time = reference_time + forecast_time + stat. proc time (YYYYMMDDHHMMSS) (same as -VT)
    - -ens             inv          ensemble information
    - -ext_name        inv          extended name, var+qualifiers
    - -flag_table_3.10 inv          flag table 3.10 scanning mode for one diamond
    - -flag_table_3.3  inv          flag table 3.3, resolution and component flags
    - -flag_table_3.4  inv          flag table 3.4, scanning mode
    - -flag_table_3.5  inv          flag table 3.5 projection center
    - -flag_table_3.9  inv          flag table 3.9 numbering order of diamonds seen from corresponding pole
    - -ftime           inv          either ftime1 or ftime2 dep on version_ftime
    - -ftime1          inv          forecast time
    - -ftime2          inv          timestamp -- will replace -ftime in the future TESTING
    - -ftn_api_fn0     inv          n npnts nx ny msg_no submsg i11,5(1x,i11)
    - -full_name       inv          extended name, var+misc+lev (depreciated)
    - -gdt             inv          contents of Grid Definition Template (g2c)
    - -geolocation     inv          package (proj4,gctpc,internal,not_used) to get lat/lon of grid points
    - -get_byte        inv   X Y Z  get bytes in Section X, Octet Y, number of bytes Z (decimal format)
    - -get_hex         inv   X Y Z  get bytes in Section X, Octet Y, number of bytes Z (bytes in hexadecimal format)
    - -get_ieee        inv   X Y Z  get ieee float in Section X, Octet Y, number of floats Z
    - -get_int         inv   X Y Z  get 4-byte ints in Section X, Octet Y, number of ints Z
    - -get_int2        inv   X Y Z  get 2-byte ints in Section X, Octet Y, number of ints Z
    - -grib_max_bits   inv          maximum bits used in grib encoding
    - -grid            inv          grid definition
    - -grid_id         inv          show values from grid_id
    - -hybrid          inv          shows vertical coordinate parameters from Sec4 (assuming 2 var per level
    - -ij              inv   X Y    value of field at grid(X,Y) X=1,..,nx Y=1,..,ny (WxText enabled)
    - -ijlat           inv   X Y    lat,lon and grid value at grid(X,Y) X=1,..,nx Y=1,..,ny (WxText enabled)
    - -ilat            inv   X      lat,lon and grid value at Xth grid point, X=1,..,npnts (WxText enabled)
    - -JMA             inv          inventory for JMA locally defined PDT
    - -lev             inv          level (code table 4.5)
    - -lev0            inv          level for g2ctl/GrADS
    - -ll2i            inv   X Y    x=lon y=lat, converts to (i), 1..ndata
    - -ll2ij           inv   X Y    x=lon y=lat, converts lon-lat to (i,j) using gctpc
    - -lon             inv   X Y    value at grid point nearest lon=X lat=Y (WxText enabled)
    - -match_inv       inv          inventory used by -match, -not, -if and -not_if
    - -Match_inv       inv          same as -match_inv except d=YYYYMMDDHH <-> D=YYYYMMDDHHmmss
    - -max             inv          print maximum value
    - -min             inv          print minimum value
    - -misc            inv          variable name qualifiers like chemical, ensemble, probability, etc
    - -MM              inv          reference time MM
    - -model_version_date inv          prints model date code
    - -n               inv          prints out inventory number
    - -N_clusters      inv          number of clusters
    - -N_ens           inv          number of ensemble members
    - -nl              inv          inserts new line into inventory
    - -nlons           inv          number of longitudes for each latitude
    - -npts            inv          number of grid points
    - -number_of_coordinate_values_after_template inv          
    - -nxny            inv          nx and ny of grid
    - -packing         inv          shows the packing mode (use -v for more details)
    - -pds_fcst_time   inv          fcst_time(1) in units given by pds
    - -pdt             inv          Product Definition Table (Code Table 4.0)
    - -percent         inv          percentage probability
    - -post_processing inv          type of post-processing
    - -precision       inv          precision of packing
    - -print           inv   X      inserts string (X) into inventory
    - -prob            inv          probability information
    - -process         inv          Process type (code table 4.3)
    - -processid       inv          process id (locally defined)
    - -proj4_ij2ll     inv   X Y    X=x Y=y, converts to (i,j) to lon-lat using proj.4 (experimental) we:sn
    - -proj4_ll2i      inv   X Y    x=lon y=lat, converts to (i) using proj.4 (experimental) 1..ndata
    - -proj4_ll2ij     inv   X Y    x=lon y=lat, converts lon-lat (i,j) using proj.4 (experimental)
    - -pyinv           inv          miscelaneous metadata for pywgrib2_XXX (experimental)
    - -radius          inv          radius of Earth
    - -range           inv          print out location of record in bytes, 0 = first byte
    - -reset_delayed_error inv          clear reset_delayed_error flag
    - -RT              inv          type of reference Time
    - -s               inv          simple inventory
    - -S               inv          simple inventory with minutes and seconds (subject to change)
    - -s2              inv          simple inventory .. for testing ftime2
    - -scale           inv          scale for packing
    - -scaling         inv          scaling for packing (old format)
    - -scan            inv          scan order of grid
    - -Sec0            inv          contents of section0
    - -Sec3            inv          contents of section 3 (Grid Definition Section)
    - -Sec4            inv          Sec 4 values (Product definition section)
    - -Sec5            inv          Sec 5 values (Data representation section)
    - -Sec6            inv          show bit-map section
    - -Sec_len         inv          length of various grib sections
    - -spatial_proc    inv          show spacial processing, pdt=4.15
    - -spectral_bands  inv          spectral bands for satellite, pdt=4.31 or 4.32
    - -spectral_bands_extname inv          spectral bands for satellite, pdt=4.31 or 4.32, concise name for ExtName
    - -start_ft        inv          verf time = reference_time + forecast_time (YYYYMMDDHH) : no stat. proc time
    - -start_FT        inv          verf time = reference_time + forecast_time (YYYYMMDDHHMMSS) - no stat. proc time
    - -stats           inv          statistical summary of data values
    - -subcenter       inv          subcenter
    - -t               inv          reference time YYYYMMDDHH, -v2 for alt format
    - -T               inv          reference time YYYYMMDDHHMMSS
    - -table           inv          parameter table
    - -timer           inv          reads OpenMP timer
    - -unix_time       inv          print unix timestamp for rt & vt
    - -V               inv          diagnostic output
    - -var             inv          short variable name
    - -varX            inv          raw variable name - discipline mastertab localtab center parmcat parmnum
    - -vector_dir      inv          grid or earth relative winds
    - -verf            inv          simple inventory using verification time
    - -vt              inv          verf time = reference_time + forecast_time, -v2 for alt format
    - -VT              inv          verf time = reference_time + forecast_time (YYYYMMDDHHMMSS)
    - -warn_old_g2     inv          warn if old g2lib would have problem
    - -wave_partition  inv          ocean surface wave partition (pdt=4.52)
    - -YY              inv          reference time YYYY
    - -inv_f77         inv>  X Y Z  match inventory written to Z with character*(Y) and X=(bin,ieee)
    - -last            inv>  X      write last inv item to file X
    - -last0           inv>  X      write last inv item to beginning of file X
    - -nl_out          inv>  X      write new line in file X
    - -print_out       inv>  X Y    prints string (X) in file (Y)
    - -s_out           inv>  X      simple inventory written to X
    - -big_endian      misc         sets ieee output to big endian (default is big endian)
    - -box_ave         misc  X Y Z  box average X=odd integer (lon) Y=odd integer (lat) critical_weight
    - -check_pdt_size  misc  X      check pdt size X=1 enable/default, X=0 disable
    - -colon           misc  X      replace item deliminator (:) with X
    - -config          misc         shows the configuration
    - -count           misc         prints count, number times this -count was processed
    - -end             misc         stop after first (sub)message (save time)
    - -error_final     misc  X Y Z  error if at end X=count Y=ne,eq,le,lt,gt,ge Z=integer
    - -export_lonlat   misc  X      save lon-lat data in binary file
    - -fix_CFSv2_fcst  misc  X Y Z  fixes CFSv2 monthly fcst X=daily or 00/06/12/18 Y=pert no. Z=number ens fcsts v1.0
    - -fix_ncep        misc         fix ncep PDT=8 headers produced by cnvgrib
    - -gctpc           misc  X       X=0,1 use gctpc library (default=1)
    - -grid_changes    misc         prints number of grid changes
    - -grid_def        misc         read lon and lat data from grib file -- experimental
    - -h               misc         help, shows common options
    - -header          misc         f77 header or nx-ny header in text output (default)
    - -help            misc  X      help [search string|all], -help all, shows all options
    - -ijundefine      misc  X Y Z  sets grid point values to undefined X=(in-box|out-box) Y=ix0:ix1 Z=iy0:iy1 ix=(1..nx) iy=(1..ny)
    - -import_bin      misc  X      read binary file (X) for data
    - -import_grib     misc  X      read grib2 file (X) for data
    - -import_grib_fs  misc  X Y    read grib2 file (Y) sequentially for record that matches X (fixed string)
    - -import_ieee     misc  X      read ieee file (X) for data
    - -import_lonlat   misc  X      read lon-lat data from binary file
    - -import_netcdf   misc  X Y Z  alpha X=file Y=var Z=hyper-cube specification
    - -import_text     misc  X      read text file (X) for data
    - -limit           misc  X      stops after X fields decoded
    - -little_endian   misc         sets ieee output to little endian (default is big endian)
    - -mem_del         misc  X      delete mem file X
    - -mem_final       misc  X Y    write mem file X to file Y at cleanup step
    - -mem_init        misc  X Y    read mem file X from file Y (on initialization)
    - -new_grid_format misc  X      new_grid output format X=bin,ieee,grib
    - -new_grid_interpolation misc  X      new_grid interpolation X=bilinear,bicubic,neighbor,budget
    - -new_grid_ipopt  misc  X      new_grid ipopt values X=i1:i2..:iN N <= 20
    - -new_grid_vectors misc  X      change fields to vector interpolate: X=none,default,UGRD:VGRD,(U:V list)
    - -new_grid_winds  misc  X      new_grid wind orientation: X = grid, earth (no default)
    - -no_header       misc         no f77 header or nx-ny header in text output
    - -proj4           misc  X      X=0,1 use proj4 library for geolocation (testing)
    - -quit            misc         stop after first (sub)message (save time)
    - -read_sec        misc  X Y    read grib message section (0-8) X from binary file (Y)
    - -rewind_final    misc  X      rewinds file X on cleanup step if already opened, CW2
    - -rewind_proc     misc  X      rewinds file X on processing step if already opened, CW2
    - -rpn             misc  X      reverse polish notation calculator
    - -rpn_rcl         misc  X      data = register X .. same as -rpn rcl_X .. no geolocation calc needed
    - -rpn_sto         misc  X      register X = data.. same as -rpn sto_X .. no geolocation calc needed
    - -scaling_0001    misc         changes scaling testing (sample)
    - -set             misc  X Y    set X = Y, X=local_table,etc (help: -set help help)
    - -set_ave         misc  X      set ave/acc .. only use on pdt=4.0/4.8 (old code)
    - -set_bin_prec    misc  X      X use X bits and ECMWF-style grib encoding
    - -set_bitmap      misc  X      use bitmap when creating complex packed files X=1/0
    - -set_byte        misc  X Y Z  set bytes in Section X, Octet Y, bytes Z (a|a:b:c)
    - -set_center      misc  X      changes center X = C or C:S C and S are center/subcenter numbers
    - -set_date        misc  X      changes date code, X=(+|-)N(hr|dy|mo|yr), YYYYMMDDHHmmSS, u(UNIX TIME)
    - -set_ensm_derived_fcst misc  X Y    convert PDT 0,1,2 -> 2, 8,11,12 -> 12, X=code table 4.7 Y=num ens members
    - -set_ens_num     misc  X Y Z  ensemble member info, X=code table 4.6 Y=pert num Z=num ens members -1=No Change
    - -set_flag_table_3.3 misc  X      flag table 3.3 = X
    - -set_flag_table_3.4 misc  X      flag table 3.4 = X
    - -set_ftime       misc  X      either set_ftime1 or set_ftime2 dep on version_ftime
    - -set_ftime1      misc  X      set ftime
    - -set_ftime2      misc  X      set ftime2 .. will be replace -set_ftime/ave in the future -- TESTING ---
    - -set_gds         misc  X      makes new gds (section 3), X=size in bytes
    - -set_grib_max_bits misc  X      sets scaling so number of bits does not exceed N in (new) grib output
    - -set_grib_type   misc  X      set grib type = jpeg, simple, ieee, complex(1|2|3), aec, same
    - -set_hex         misc  X Y Z  set bytes in Section X, Octet Y, bytes Z (a|a:b:c|abc) in hexadecimal
    - -set_ieee        misc  X Y Z  set ieee float in Section X, Octet Y, floats Z (a|a:b:c)
    - -set_ijval       misc  X Y Z  sets grid point value X=ix Y=iy Z=val
    - -set_int         misc  X Y Z  set 4-byte ints in Section X, Octet Y, signed integers Z (a|a:b:c)
    - -set_int2        misc  X Y Z  set 2-byte ints in Section X, Octet Y, signed integers Z (a|a:b:c)
    - -set_ival        misc  X Y    sets grid point value X=i1:i2:.. Y=va1:val2:.. grid[i1] = val1,etc i>0
    - -set_lev         misc  X      changes level code .. not complete
    - -set_metadata    misc  X      read meta-data for grib writing from file X
    - -set_metadata_str misc  X      X = metadata string
    - -set_pdt         misc  X      makes new pdt, X=(+)PDT_number or X=(+)PDT_number:size of PDT in octets, +=copy metadata
    - -set_percentile  misc  X      convert PDT 0..6 -> 6, 8..15 -> 10, X=percentile (0..100)
    - -set_prob        misc  5 args X/Y forecasts Z=Code Table 4.9 A=lower limit B=upper limit
    - -set_radius      misc  X      set radius of Earth X= 0,2,4,5,6,8,9 (Code Table 3.2), X=1:radius , X=7:major:minor
    - -set_scaling     misc  X Y    set decimal scaling=X/same binary scaling=Y/same new grib messages
    - -set_sec_size    misc  X Y    resizes section , X=section number, Y=size in octets, DANGEROUS
    - -set_ts_dates    misc  X Y Z  changes date code for time series X=YYYYMMDDHH(mmss) Y=dtime Z=#msgs/date
    - -set_var         misc  X      changes variable name
    - -start_timer     misc         starts OpenMP timer
    - -status          misc  X      X X=file
    - -submsg          misc  X      process submessage X (0=process all messages)
    - -sys             misc  X      run system/shell command, X=shell command
    - -text_col        misc  X      number of columns on text output
    - -text_fmt        misc  X      format for text output (C)
    - -udf             misc  X Y    run UDF, X=program+optional_args, Y=return file
    - -udf_arg         misc  X Y    add grib-data to UDF argument file, X=file Y=name
    - -undefine        misc  X Y Z  sets grid point values to undefined X=(in-box|out-box) Y=lon0:lon1 Z=lat0:lat1
    - -undefine_val    misc  X      grid point set to undefined if X=val or X=low:high
    - -v               misc         verbose (v=1)
    - -v0              misc         not verbose (v=0)
    - -v1              misc         verbose (v=1)
    - -v2              misc         really verbose (v=2)
    - -v97             misc         verbose mode for debugging only (v=97)
    - -v98             misc         verbose mode for debugging only (v=98)
    - -v99             misc         verbose mode for debugging only (v=99)
    - -version         misc         print version
    - --version        misc         print version
    - -AAIG            out          writes Ascii ArcInfo Grid file, lat-lon grid only (alpha)
    - -AAIGlong        out          writes Ascii ArcInfo Grid file, lat-lon grid only long-name *.asc (alpha)
    - -ave             out   X Y    average X=time step Y=output v2
    - -ave0            out   X Y    average X=time step, Y=output grib file needs file is special order
    - -ave_var         out   X Y    average/std dev/min/max X=time step, Y=output
    - -bin             out   X      write binary data to X
    - -cress_lola      out   X..Z,A lon-lat grid values X=lon0:nlon:dlon Y=lat0:nlat:dlat Z=file A=radius1:radius2:..:radiusN
    - -csv             out   X      make comma separated file, X=file (WxText enabled)
    - -csv_long        out   X      make comma separated file, X=file (WxText enabled)
    - -cubeface2global out   X Y    write faces X as global cubed grid to Y: X=list of faces to exclude
    - -ens_processing  out   X Y    ave/min/max/spread X=output Y=future use
    - -ens_qc          out   X..Z,A simple qc ensemble members X=stats.grb Y=extreme.grb Z=extreme.txt A=1 (qc_version)
    - -fcst_ave        out   X Y    average X=time step Y=output v2
    - -fcst_ave0       out   X Y    average X=time step, Y=output grib file needs file is special order
    - -fi              out          depreceated, used in old IF structure
    - -grib            out   X      writes GRIB record (one submessage) to X
    - -GRIB            out   X      writes entire GRIB record (all submessages)
    - -grib_ieee       out   X      writes data[] to X.grb, X.head, X.tail, and X.h
    - -grib_out        out   X      writes decoded/modified data in grib-2 format to file X
    - -grib_out_irr    out   X Y    writes irregular grid grib (GDT=130 not adopted) X=(all|defined) Y=(output file)
    - -grib_out_irr2   out   5 args writes irregular grid grib GDT 101 X=npnts Y=grid_no Z=grid_ref A=UUID B=(output file)
    - -gribtable_used  out   X      write out sample gribtable as derived from grib file, X=file
    - -gridout         out   X      text file with grid: i j lat lon (1st record)
    - -ieee            out   X      write (default:big-endian) IEEE data to X
    - -ijbox           out   X..Z,A grid values in bounding box X=i1:i2[:di] Y=j1:j2[:dj] Z=file A=[bin|text|spread]
    - -ijsmall_grib    out   X Y Z  make small domain grib file X=ix0:ix1 Y=iy0:iy1 Z=file
    - -irr_grid        out   X Y Z  make irregular grid (GDT=130 not adopted), nearest neighbor, X=lon-lat list Y=radius (km) Z=output grib file
    - -lola            out   X..Z,A lon-lat grid values X=lon0:nlon:dlon Y=lat0:nlat:dlat Z=file A=[bin|text|spread|grib]
    - -merge_fcst      out   X Y    merge forecast ave/acc/min/max X=number to intervals to merge (0=every) Y=output grib file
    - -mysql           out   5 args H=[host] U=[user] P=[password] D=[db] T=[table]
    - -mysql_dump      out   7 args H=[host] U=[user] P=[password] D=[db] T=[table] W=[western_lons:0|1] PV=[remove unlikely:0|1]
    - -mysql_speed     out   7 args H=[host] U=[user] P=[password] D=[db] T=[table] W=[western_lons:0|1] PV=[remove unlikely:0|1]
    - -ncep_norm       out   X      normalize NCEP-type ave/acc X=output grib file
    - -ncep_uv         out   X      combine U and V fields into one message like NCEP operations
    - -netcdf          out   X      write netcdf data to X
    - -new_grid        out   X..Z,A bilinear interpolate: X=projection Y=x0:nx:dx Z=y0:ny:dy A=grib_file alpha
    - -new_grid_order  out   X Y    put in required order for -new_grid, X=out Y=out2 no matching vector
    - -reduced_gaussian_grid out   X Y Z  reduced Gaussian grid, X=outputfile Y=-1 Z=(neighbor|linear)[-extrapolate]
    - -small_grib      out   X Y Z  make small domain grib file X=lonW:lonE Y=latS:latN Z=file
    - -spread          out   X      write text - spread sheet format into X (WxText enabled)
    - -submsg_uv       out   X      combine vector fields into one message
    - -text            out   X      write text data into X
    - -time_processing out   X..Z,A average X=CodeTable 4.10 Y=CodeTable 4.11 Z=time step A=output
    - -tosubmsg        out   X      convert GRIB message to submessage and write to file X
    - -unmerge_fcst    out   X Y Z  unmerge_fcst X=output Y=fcst_time_0 Z: 0->result 1->+init 2->+all
    - -wind_dir        out   X      calculate wind direction, X = output gribfile (direction in degrees, 0=wind from north, 90=wind from east)
    - -wind_speed      out   X      calculate wind speed, X = output gribfile (U then V in datafile)
    - -wind_uv         out   X      calculate UGRD/VGRD from speed/dir, X = output gribfile
    - -write_sec       out   X Y    write grib msessage section X (0-8) to binary file Y
    - -alarm           init  X      terminate after X seconds
    - -append          init         append mode, write to existing output files
    - -crlf            init         make the end of the inventory a crlf (windows) instead of newline (unix)
    - -d               init  X      dump message X = n, n.m, n:offset, n.m:offset, only 1 -d allowed
    - -egrep           init  X      egrep X | wgrib2 (X is POSIX regular expression)
    - -egrep_v         init  X      egrep -v X | wgrib2 (X is POSIX regular expression)
    - -eof_bin         init  X Y    send (binary) integer to file upon EOF: X=file Y=integer
    - -eof_string      init  X Y    send string to file upon EOF: X=file Y=string
    - -err_bin         init  X Y    send (binary) integer to file upon err exit: X=file Y=integer
    - -err_string      init  X Y    send string to file upon err exit: X=file Y=string
    - -fgrep           init  X      fgrep X | wgrib2
    - -fgrep_v         init  X      fgrep -v X | wgrib2
    - -fix_ncep_2      init         ncep bug fix 2, probability observation < -ve number
    - -fix_ncep_3      init         sets flag to fix ncep bug 3 (constant fields)
    - -fix_ncep_4      init         fixes NCEP grib2 files where DX and DY are undefined
    - -fix_undef       init         set unused values to undef
    - -flush           init         flush output buffers after every write (interactive)
    - -for             init  X      process record numbers in range, X=(start:end:step), only one -for allowed
    - -for_n           init  X      process inv numbers in range, X=(start:end:step), only one -for allowed
    - -g2clib          init  X      X=0/1/2 0=WMO std 1=emulate g2clib 2=use g2clib
    - -i               init         read Inventory from stdin
    - -i_file          init  X      read Inventory from file
    - -inv             init  X      write inventory to X
    - -match           init  X      process data that matches X (POSIX regular expression)
    - -match_fs        init  X      process data that matches X (fixed string)
    - -match_inv_add   init  X Y Z  add new options to match_inventory
    - -names           init  X      grib name convention, X=DWD, dwd, ECMWF, ecmwf, NCEP, ncep
    - -nc3             init         use netcdf3 (classic)
    - -nc4             init         use netcdf4 (compressed, controlled endianness etc)
    - -nc_grads        init         require netcdf file to be grads v1.9b4 compatible (fixed time step only)
    - -nc_nlev         init  X      netcdf, X = max LEV dimension for {TIME,LEV,LAT,LON} data
    - -nc_pack         init  X      pack/check limits of all NEW input variables, X=min:max[:byte|short|float]
    - -ncpu            init  X      number of threads, default is environment variable OMP_NUM_THREADS/number of cpus
    - -nc_table        init  X      X is conversion_to_netcdf_table file name
    - -nc_time         init  X      netcdf, [[-]yyyymmddhhnnss]:[dt{s[ec]|m[in]|h[our]|d[ay]}], [-] is for time alignment only
    - -ndate           init  X Y    X=date Y=dt print date + dt
    - -ndates          init  X Y Z  X=date0 Y=(date1|dt1) Z=dt2 for (date=date0; date<(date1|date0+dt1); date+=dt2) print date
    - -ndates_fmt      init  X      X = C format for ndates option ex. 'date=%s'
    - -no_append       init         not append mode, write to new output files (default)
    - -no_flush        init         flush output buffers when full (default)
    - -no_nc_grads     init         netcdf file may be not grads v1.9b4 compatible, variable time step
    - -no_nc_pack      init         no packing in netcdf for NEW variables
    - -no_nc_table     init         disable previously defined conversion_to_netcdf_table
    - -no_nc_time      init         netcdf, disable previously defined initial or relative date and time step
    - -not             init  X      process data that does not match X (POSIX regular expression)
    - -not_fs          init  X      process data that does not match X (fixed string)
    - -one_line        init         puts all on one line (makes into inventory format)
    - -order           init  X      decoded data in X (raw|we:sn|we:ns) order, we:sn is default
    - -persistent      init  X      makes file X persistent if already opened (default on open), CW2
    - -rewind_init     init  X      rewinds file X on initialization if already opened, CW2
    - -set_ext_name    init  X      X=type ext_name (1*misc+2*level+4*ftime)
    - -set_ext_name_chars init  X Y    extended name characters X=field Y=space
    - -set_regex       init  X      set regex mode X = 0:extended regex (default) 1:pattern 2:extended regex & quote metacharacters
    - -set_version_ftime init  X      set version of ftime X=1, 2
    - -tigge           init         use modified-TIGGE grib table
    - -transient       init  X      make file X transient, CW2
    -
    -
    - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5200 Auth Road
    - Camp Springs, Maryland 20746
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/lvl.html b/web_docs/lvl.html deleted file mode 100644 index faa3e58..0000000 --- a/web_docs/lvl.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lvl - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-lvl -
     
    - -

    wgrib2: -lvl wgrib2 (introduced v3.1.4)

    -
    - - -

    Introduction: levels, should I use lev or lvl

    -

    -The standard method of displaying and altering the level/layer metadata is by the --lev and -set_lev options. -This method is high level so you don't have to know the details of grib. -The problems with a high level interface are when you -are using a new type of level information that "-lev" don't understand. When this -happens, you can use the "lvl" options. -The "lvl" method is low level and are for cases when a high level interface doesn't work. - -

    The Problem with Ambiguity of Numbers

    - -The grib standard stores the level as a (signed 32-bit integer)*10**(signed 8-bit integer). -Nothing wrong with this format but numbers and be stored in different ways. - -
    -   500 can be stored as 5*10**2
    -   500 can be stored as 50*10**1
    -   500 can be stored as 500*10**0
    -   500 can be stored as 5000*10**-1
    -
    - -All are valid representations and libraries should treat them as equivalent. -So if you search for the wind speed at "50 meters above the ground", you -should not have to worry whether 50 is stored at 5*10**1 or 50*10**0 in -the grib file. However, there are some libraries will only match one variant -of "50". So to get your grib files to be compatible with this library, -you may have to use the "lvl" interface. (With wgrib2, you match the string -"50m above ground", so the variants don't matter.) - -

    -Another example of ambiguity is for "0.1 meters above the ground". Now 0.1 is not -a nice number when stored as a binary floating point number. You can only save an approximate -value when using a finite number of digits. It is like 1/3 when written -as a decimal number. (1/3=0.3333333333333..) -

    -  0.1 can be stored as 1*10**-1
    -  0.1 can be stored as 1000000015*10**-10
    -
    -Obviously the former is the preferred format but the latter is -the result trying to get the best scaled number for double -precision number "0.1". - -

    The "lvl" interface can be used to remove ambiguities in the level information -using -set_lvl1 and -set_lvl2. - - -

    lvl format

    - - -The "lvl" format is based on the grib standard. - -
    - 1 octet  unsigned 8-bit integer   type of first fixed surface (see Code Table 4.5) lv1l type
    - 1 octet  8-bit signed integer     scale factor of first fixed surface              lvl1 scale_factor
    - 4 octets 32-bit signed integer    scaled value of first fixed surface              lvl1 scaled_value
    -                            
    - 1 octet  unsigned 8-bit integer   type of 2nd fixed surface (see Code Table 4.5)   lvl2 type
    - 1 octet  8-bit signed integer     scale factor of 2nd surface                      lvl2 scale_factor
    - 4 octets 32-bit signed integer    scaled value of 2nd fixed surface                lvl2 scaled_value
    -
    - value = scaled_value * 10**(-scale_factor)
    - Note: missing is denoted by scale factor and scale value having all bits set to one
    -
    -lvl format   value is not missing
    -             lvl1=(type,scaled_value*10**(-scale_factor), scale_factor, scaled_value)
    -             lvl2=(type,scaled_value*10**(-scale_factor), scale_factor, scaled_value)
    -
    -lvl format   value is missing
    -             lvl1=(type,missing,missing,missing)
    -             lvl2=(type,missing,missing,missing)
    -
    -	     type = 0..255
    -
    - -

    Usage

    -

    - -

    --lvl
    -
    - - -

    Example

    -
    -$ $ wgrib2 small.grb2 -lev
    -1:0:200 mb
    -$ $ wgrib2 small.grb2 -lvl
    -1:0:lvl1=(100,20000,0,20000):lvl2=(255,missing,missing,missing)
    -
    - - - -See also: -set_lvl1 - -set_lvl2 -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page 11/2023 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/macros.html b/web_docs/macros.html deleted file mode 100644 index ad31c5c..0000000 --- a/web_docs/macros.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -s -verf - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -s -verf -
     
    - -

    wgrib2 macros: -s -verf -V

    -
    - - -

    Introduction

    - -

    -The -s, --verf -and -V -options are really macros -which are defined in the Macro.c file. The -s option is special because if there is no -"inv" option used, wgrib2 will add a -s option to the end of the argument list. - - -

    Usage

    -

    - -

    --s
    -      equivalent to -t -var -lev -ftime -ens
    -
    --verf
    -      equivalent to -vt -var -lev -ftime -ens
    -
    --V
    -      equivalent to -vt -lev -ftime -var -ens -stats -grid
    -
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/match.html b/web_docs/match.html deleted file mode 100644 index c547a66..0000000 --- a/web_docs/match.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -match - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-match -
     
    - -

    wgrib2: -match

    -
    - - -

    Introduction

    - -

    -The -match option selects records which should -be processed. When multiple -match options are used, all matches -must be satisfied. The -match and --not options seem to be similar to the --if and -if_not options. -The big difference is that the --match and -not -options are processed before any other record processing. If -the record satisfies the -match and --not options, then the record is -processed. This include the optional decoding and latitude-longitude -calculation and the other options. - - -

    -
    -    wgrib2 -match X (...)
    -
    -is the same as 
    -
    -    wgrib2 -match_inv file | egrep X | wgrib2 -i (...)
    -
    -
    -
    -    wgrib2 -match X -match Y -not Z (...)
    -
    -is the same as 
    -
    -    wgrib2 -match_inv file | egrep X | egrep Y | egrep -v Z | wgrib2 -i (...)
    -
    -where X, Y and Z are regular expressions. 
    -
    -If X, Y and Z are "fixed strings" rather than regular expressions, 
    -use -match_fs, and -not_fs.
    -
    - -

    Usage

    -

    - -

    --match X
    -
    -X is a posix extended regular expression
    -
    - -

    -The -match, and -not selection -facility is more limited than the "wgrib2 | filter | wgrib2 -i" syntax. -However, it can be more efficient especially when combined with the --end option. Note that the "match" inventory -often expands. Usually the inventory expands by adding new items -to the end of the inventory in order not the break scripts. - -

    Examples

    - -
    -wgrib2 IN.grb -match ":(UGRD|VGRD|TMP):(200|500) mb:"
    -
    -selects the UGRD, VGRD and TMP fields at the 200 and 500 mb levels
    -
    - -

    -match vs -if

    - - -

    The --match, and -if can -be confused. -The --match option selects the fields that are to be -processed by the command line. -The --if option selects the fields that will be processed -and the selection ends at the next --fi or output option. For example, - -

    -1. wgrib2 IN.grb -match ":UGRD:200 mb:anl:" -csv u200.csv
    -2. wgrib2 IN.grb -if ":UGRD:200 mb:anl:" -csv u200.csv
    -
    - -Lines 1 and 2 will produce the same CSV file. However, line 1 will only -process one field. For line 1, only only one field will be docoded -and converted to a CSV file. For line 2, all the fields will be -processed and only one field will be converted to a CSV file. The -total processing will be the docoding of all the fields in the file -and one conversion to a CSV file. - - -

    Future Changes

    -

    -The format of the "match inventory" has evolved and will continue to evolve. -The rule for future changes is that new items in the "match inventory" will be added -as the second last item. Consequently the last item in the inventory will always -be ":vt=YYYYMMDDHH:". In order to future proof your --match, and -not selections, you -must not include any item before the ":vt=YYYYMMDD:" field. - -

    -    -match ":vt=2011111500:"                  good
    -    -not ":vt=2011111500:$"                   good (dollar sign matches the end of the line)
    -    -not ":n=10:vt=2011111500:"               bad (item before :vt=)
    -    -match ":RH:975 mb:anl::vt=2010050806:"   bad (item before :vt=)
    -

    - -Some recent changes (as of Nov 2011) to the match inventory include: - -
      -
    • adding the "extended name of the variable", ex. TMP.prob_<273 -
    • adding the inventory number, ex. n=10 -
    • adding ensemble/chemical/probability information (-misc) -
    - -

    -See also: -not, --not_fs, --match_fs, --match_inv, --end, --i, --if, --not_if, --set_regex. -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 20, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/match_fs.html b/web_docs/match_fs.html deleted file mode 100644 index 948c0f1..0000000 --- a/web_docs/match_fs.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -match_fs, .not_fs, -if_fs, -not_if_fs - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-Match_fs package -
     
    - -

    wgrib2: -match_fs, -not_fs, -if_fs, -not_if_fs

    -
    - - -

    Introduction

    - -

    -The (-match_fs, -not_fs, -if_fs, -not_if_fs) options are -similar to the -(-match, -not, -if, -not_if) options except the former -group uses fixed strings rather than regular expressions. - - -Now why would you want to use the "fs" versions? Suppose you want to to -search for the "2.5 mb" level. - -

    -bash-4.1$ wgrib2 -match ":2.5 mb:" junk
    -1:0:d=2009060500:HGT:225 mb:180 hour fcst:ENS=+19
    -2:46042:d=2009060500:HGT:2.5 mb:180 hour fcst:ENS=+19
    -
    - -What happened? The command matched the 2.5 and 225 mb level! Well the -period is regular expression metacharacter and matchs any character. To -only get "2.5 mb" either have to quote the period or change the regex mode. - -
    -bash-4.1$ wgrib2 -match ":2\.5 mb:" junk
    -2:46042:d=2009060500:HGT:2.5 mb:180 hour fcst:ENS=+19
    -
    -bash-4.1$ wgrib2 -set_regex 0 -match ":2.5 mb:" junk
    -1:0:d=2009060500:HGT:225 mb:180 hour fcst:ENS=+19
    -2:46042:d=2009060500:HGT:2.5 mb:180 hour fcst:ENS=+19
    -
    -bash-4.1$ wgrib2 -set_regex 1 -match ":2.5 mb:" junk
    -2:46042:d=2009060500:HGT:2.5 mb:180 hour fcst:ENS=+19
    -
    -bash-4.1$ wgrib2 -set_regex 2 -match ":2.5 mb:" junk
    -2:46042:d=2009060500:HGT:2.5 mb:180 hour fcst:ENS=+19
    -
    - -

    -So setting the regex mode to 1 or 2 will work. The "_fs" options -uses fixed strings with no metacharacters which is the same -as the regex mode set to 1. - -

    The "_fs" options only requires standard C support rather than POSIX-2 -so they are available on all wgrib2. Options using -regular expressions are optional and may not be available on platforms. - -

    -See also: --if, --if_fs, --match, --match_inv, --not, --not_fs, --not_if, --not_if_fs, --set_regex. -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 15, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/match_inv.html b/web_docs/match_inv.html deleted file mode 100644 index 883a843..0000000 --- a/web_docs/match_inv.html +++ /dev/null @@ -1,233 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -match_inv - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-match_inv -
     
    - -

    wgrib2: -match_inv

    -
    - - -

    Introduction

    - -

    -The -match_inv option prints out the inventory -which is used by the --match, --not, -if, --not_if --match_fs, --not_fs, -if_fs and --not_if_fs - options. - -

    --sh-2.05b$ wgrib2 new.grb2 -match_inv
    -1:0:d=2007032600:HGT:1000 mb:anl:vt=2007032600
    -2:125535:d=2007032600:HGT:1000 mb:3 hour fcst:vt=2007032603
    -
    - -

    Usage

    -

    - -

    --match_inv
    -
    - -

    Changes

    -

    -The format of the "match inventory" has evolved and will continue to evolve. -The rule for future changes is that new items in the "match inventory" will be added -as the second last item. Consequently the last item in the inventory will always -be ":vt=YYYYMMDDHH:". In order to future proof your --match, and -not selections, you -must not include any item before the ":vt=YYYYMMDD:" field. - -

    -    -match ":vt=2011111500:"                  good
    -    -not ":vt=2011111500:$"                   good (dollar sign matches the end of the line)
    -    -not ":n=10:vt=2011111500:"               bad (item before :vt=)
    -    -match ":RH:975 mb:anl::vt=2010050806:"   bad (item before :vt=)
    -
    - -Some recent changes (as of Nov 2011) to the match inventory include: - -
      -
    • adding the "extended name of the variable", ex. TMP.prob_<273 -
    • adding the inventory number, ex. n=10 -
    • adding ensemble/chemical/probability information (-misc) -
    - -

    Changes: wgrib2 v2.0.5

    - -

    For all versions of wgrib2 up to v2.0.4, the match inventory was -dependent on the verbosity mode (0,1,2). As a results, -match ":HGT:10 mb:" -would work in default mode but would not work in the -v1 and v2 modes. -With wgrib2 v2.0.5, the match inventory is generated with default -verbosity mode (-v0). It is possible that this break a few pieces -of code. However, I think that the match facility shouldn't be -dependent on the verbosity mode. - -

    -See also: --if, --if_fs, --match, --Match_inv, --match_fs, --not, --not_fs, --not_if, --not_if_fs, --set_regex. -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 1, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/match_inv_add.html b/web_docs/match_inv_add.html deleted file mode 100644 index 12a4d02..0000000 --- a/web_docs/match_inv_add.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -match_inv_add - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-match_inv_add -
     
    - -

    wgrib2: -match_inv_add

    -
    - -

    Introduction !!ALPHA!!

    - -

    -Wgrib2's command line is a simple language that allows you -to process selected fields using, for example, the -if option. -The -if option is limited as it only works on -parameters that are exposed by the -match_inv option. -For example, you cannot check the diameter of the earth by using - -

    -   wgrib2 IN.grb -if "code table 3.2=6 " -print "oh no code 3.2=6" -fi
    -
    -
    -because code table 3.2 is not in the match inventory (-match_inv).  The match
    -inventory has been expanding with time.  However, there will alway be new needs
    -that need an expanded match inventory.  
    -
    -

    -You cannot add functions that depend on the grid point values (ex. -max, -min) or -the locations of the grid points because these calculations are done after the -match inventory is generated. - -

    The current status is ALPHA and the syntax may be altered. - -

    Usage

    -
    --match_inv_add OPTION ARG1 ARG2
    -  OPTION is an inv option with no parameters
    -    note that you do not add a dash to the option
    -  ARG1 is argument 1 to the option, if option has no argument, use a dummy argument
    -  ARG2 is argument 2 to the option, if option does not need a second argument, use a dummy argument
    -
    -  As of v2.0.8, you are allowed to add upto 10 extra functions to the match inventory
    -
    -

    Example 1

    - -
    -$ wgrib2 small.grb2 -match_inv_add code_table_3.2 x x -match_inv
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19:HGT.ENS=+19:n=1:npts=4:var0_2_1_7_3_5:pdt=1: D=20090
    -605000000:start_FT=20090612120000:end_FT=20090612120000:scaling ref=1.22666e+06 dec_scale=-2 bin_scale
    -=2 nbits=12:code table 3.2=6 Earth assumed spherical with radius = 6,371,229.0 m:vt=2009061212:
    -
    -$ wgrib2 small.grb2 -match_inv_add code_table_3.2 x x -if "code table 3.2=6" -print "fount radius=6" -fi
    -1:0:fount radius=6
    -
    - - -

    -See also: --if, --if_fs, --match, --match_fs, --match_inv, --Match_inv, --not, --not_fs, --not_if, --not_if_fs, --set_regex. - - - - - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Feb 1, 2019 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/match_inv_f77.html b/web_docs/match_inv_f77.html deleted file mode 100644 index bba197a..0000000 --- a/web_docs/match_inv_f77.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -match_inv_f77 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -match_inv_f77 -
     
    - -

    wgrib2: -match_inv_f77

    -
    - - -

    Introduction

    - -

    -The -match_inv_f77 option prints out the match inventory (-match_inv) to a file in f77 unformatted sequential -access format. The fortran headers and trailers can either be in 4-byte (big/little endian) or native-format integers -containing the size of the string. Note that the -match_inv_f77 option always creates a -header and ignores the -header option. -The -match_inv_f77 option was added in order to make it easier for fortran programs to read wgrib2 dumps. - -

    -Fortran program with no conversion of input data:
    -
    --sh-2.05b$ wgrib2 new.grb2 -match_inv_f77 bin 200 dump.bin -bin dump.bin
    -
    -The Fortran code to read inv.dat will look like:
    -
    -        character*200 inventory
    -        real field1x1(360,181)
    -
    -        open(unit=2,file='dump.bin',form='unformatted')
    -!       read first record
    -        read(2) inventory
    -        read(2) field1x1
    -        (do work)
    -!       read second record
    -        read(2) inventory
    -        read(2) field1x1
    -
    -If the Fortran program which reads data in big_endian format, then dump.bin is made by
    -
    --sh-2.05b$ wgrib2 new.grb2 -match_inv_f77 ieee 200 dump.bin -ieee dump.bin
    -
    -If the Fortran program which reads data in little_endian format, then dump.bin is made by
    -
    --sh-2.05b$ wgrib2 new.grb2 -little_endian -match_inv_f77 ieee 200 dump.bin -ieee dump.bin
    -
    -Note the the size of the character string inventory has to be the same as the first argument to -match_inv_f77 and
    -the size of field1x1 will depend on the grid definition in the file.  Advanced users would replace
    -dump.bin by a named pipe.
    -
    - -

    Usage

    -

    - - - - -

    --match_inv_f77 TYPE LEN FILE
    -TYPE is either bin or ieee
    -LEN is number of characters allocated for the inventory string
    -FILE is the output file
    -
    - -See also: -match_inv, --s_out, --inv, --bin, --ieee, --big_endian, --little_endian, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/max.html b/web_docs/max.html deleted file mode 100644 index 96c065d..0000000 --- a/web_docs/max.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -stats, max, min - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-stats, -mmax, -min -
     
    - -

    wgrib2: -stats, -max, -min

    -
    - - -

    Introduction

    - -

    -The -stats option writes a statistical summary -of the field into the inventory. -The -max option writes the maximum value and -the -min option writes the minimum. -These option are useful for quickly determining if the field has reasonable numbers. - -

    Usage

    -

    - -

    --stats
    --max
    --min
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -stats
    -1:0:ndata=65160:undef=0:mean=83.8696:min=-428.1:max=317.8
    -
    -ndata = number of grid points
    -undef = number of grid points with an undefined value
    -mean = grid point average (not area weighted)
    -min = minimum value
    -max = maximum value
    -
    -$ wgrib2 test.grb2 -max
    -1:0:max=317.8
    -
    -$ wgrib2 test.grb2 -min
    -1:0:min=-428.1
    -
    -
    - -The -stats option can be combined with -the -undefine option to produce -statistics for a box.
    - -
    -$ wgrib2 test.grb2 -stats
    -1:4:ndata=10512:undef=0:mean=77.5081:min=-370:max=340.2:cos_wt_mean=97.267
    -
    -produces the global statistics. By setting grid points to undefined, -we can produce the statistics for a box.
    -
    -$ wgrib2 test.grb2 -undefine outobx 0:90 -10:10 -stats
    -1:4:ndata=10512:undef=10179:mean=79.8829:min=41:max=144:cos_wt_mean=79.8688
    -
    - -Note, if we reverse the order of the --stats and --undefine options, we get the global mean. -That is because the -stats option is excuted -before the -undefine options. - - -$ wgrib2 test.grb2 -stats -undefine out-box 0:10 -10:10 -1:4:ndata=10512:undef=0:mean=77.5081:min=-370:max=340.2:cos_wt_mean=97.267 - - -

    If all the data are undefined, -the -stats option will produce values -of zero for the the mean, min and max. -The -min and -max -options will yield a text string of "undefined". - - -

    -See also: -undefine -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/mem_blocks.html b/web_docs/mem_blocks.html deleted file mode 100644 index caef007..0000000 --- a/web_docs/mem_blocks.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - Climate Prediction Center - wgrib2: memory blocks, memory files, ramdisk - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 memory blocks -
     
    - -

    wgrib2: memory blocks

    -

    memory files

    -
    - - -

    Introduction

    - -

    -Memory blocks or memory files have a name like @mem:N, where N = 0..9. Memory blocks can be read and written -like ordinary files (except for text files). The advantages of memory files are - -

      -
    1. Can be initialized (read from disk) prior to processing. -
    2. Can be written to disk after processing. -
    3. Can be used to change a random access disk read to a sequential disk read. -
    4. Memory blocks Are persistant between C or fortran calls to callable wgrib2 -
    5. Memory blocks can be used HPC applicatinos where the input and output are memory and not files. -
    - -Memory blocks were added so that callable wgrib2 could be used in HPC applications. - -

    -See also: -

    - - - - - - - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - - - -

    -See also: -undefine -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/mem_del.html b/web_docs/mem_del.html deleted file mode 100644 index 3525c51..0000000 --- a/web_docs/mem_del.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -mem_del - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-mem_del -
     
    - -

    wgrib2: -mem_del CW2

    -
    - - -

    Introduction

    - -

    -Wgrib2 supports memory files. Memory files are transient and only exist -while wgrib2 is running. Memory files -can be loaded prior to grib processing by the -mem_init option, -writen to disk after grib processing by the -mem_final option -and deleted during the processing phase by the -mem_del option. -Memory files can be used with the wgrib2 utility but were designed for use by callable wgrib2 (CW2). - - -

    HPC and CW2

    - -Memory files was designed to support the read and writing of grib files using CW2 in -a HPC environment. Suppose you want to read a grib file with a 1000 grib messages. -One CPU reads the grib file, divides it into 1000 grib messages and sends one -grib message to 1000 different CPUS. Each of the CPUS is reponsible for -reading 1 grib message. Each CPU receives a message (memory buffer) with -a grib message and needs to decode that data. Rather than writing that -grib message to disk, the CPU will write the grib message to memory file -and then have wgrib2 decode the memory file, saving the metadata to another -memory file and the grid data to a rpn register. The CPU can then get the -metadata and grid from memory. - - - -

    Usage

    -
    --mem_del N
    -                   N=0..19
    -
    - -

    Example

    -

    -The -mem_del option is intended for the use by callable wgrib2 -so that memory files can be deleted and the memory freed. - -

    -See also: -mem_final, --mem_init, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sep 3, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/mem_final.html b/web_docs/mem_final.html deleted file mode 100644 index 57479c9..0000000 --- a/web_docs/mem_final.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -mem_final - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-mem_final -
     
    - -

    wgrib2: -mem_final

    -
    - - -

    Introduction

    - -

    -Wgrib2 supports memory files. Memory files are transient and only exist -while wgrib2 is running. Memory files -can be loaded prior to grib processing by the -mem_init option -and writen to disk after grib processing by the -mem_final option. -Memory files are rarely used in interactive wgrib2 use. - -

    HPC and CW2

    -

    -Memory files was designed to support the reading and writing of grib files using CW2 in a HPC environment. -Suppose you want to write a grib file with a 1000 grib messages. You let 1000 CPUS encode one grib -message each. The encoding CPU may set the RPN register with the grid values. -The calling wgrib2 to encode data and write the grib2 message to a memory file. -After the call, the memory file can be read and sent to the cpus that are tasked -with writing the 1000 grib messages to disk. - -

    Usage

    -
    --mem_final N FILE
    -                   N=0..19
    -                   FILE=file to write
    -
    - -

    Example

    -

    -

    -$ wgrib2 gep19.t00z.pgrb2af180 -mem_final 1 OUT.grb -grib @mem:1
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -2:46042:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    -..
    -
    -The above line reads the file 'gep19.t00z.pgrb2af180' and and writes it -to @mem:1. At the end of the grib processing @mem:1 is written to OUT.grb. -This example shows the contents of the memory file at the end of the grib -processing. - -

    -See also: -mem_init - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 29, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/mem_init.html b/web_docs/mem_init.html deleted file mode 100644 index 5bfe7e6..0000000 --- a/web_docs/mem_init.html +++ /dev/null @@ -1,215 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -mem_init - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-mem_init -
     
    - -

    wgrib2: -mem_init CW2

    -
    - - -

    Introduction

    - -

    -Wgrib2 supports memory files. Memory files are transient and only exist -while wgrib2 is running. Memory files -can be loaded prior to grib processing by the -mem_init option -and writen to disk after grib processing by the -mem_final option. -Memory files can be used with the wgrib2 utility but were designed for use by callable wgrib2 (CW2). - - -

    HPC and CW2

    - -Memory files was designed to support the read and writing of grib files using CW2 in -a HPC environment. Suppose you want to read a grib file with a 1000 grib messages. -One CPU reads the grib file, divides it into 1000 grib messages and sends one -grib message to 1000 different CPUS. Each of the CPUS is reponsible for -reading 1 grib message. Each CPU receives a message (memory buffer) with -a grib message and needs to decode that data. Rather than writing that -grib message to disk, the CPU will write the grib message to memory file -and then have wgrib2 decode the memory file, saving the metadata to another -memory file and the grid data to a rpn register. The CPU can then get the -metadata and grid from memory. - - - -

    Usage

    -
    --mem_init N FILE
    -                   N=0..19
    -                   FILE=file to read
    -
    - -

    Example

    -

    -

    -$ wgrib2 -mem_init 10 gep19.t00z.pgrb2af180 @mem:10
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -2:46042:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    -..
    -
    -The above line reads the file 'gep19.t00z.pgrb2af180' and save it in -memory file, @mem:10, before grib processing. Wgrib2 processes -the memory file, @mem:10. This example has no practical application; -however, the following can be used. - -
    -$ wgrib2 IN.grb | sort -t: -k3,7 | wgrib2 -i -mem_init IN.grb 0 @mem:0 -grib OUT.grb
    -
    -The above line takes the original file, IN.grb, and writes it out in sorted order. By using -a memory file, a random access read is replaced by the much faster sequential read. - -

    -See also: -mem_final, - -rpn -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 29, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/merge_fcst.html b/web_docs/merge_fcst.html deleted file mode 100644 index e40ea94..0000000 --- a/web_docs/merge_fcst.html +++ /dev/null @@ -1,249 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -merge_fcst - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-merge_fcst -
     
    - -

    wgrib2: -merge_fcst

    -
    - - -

    Introduction

    - -

    -The -merge_fcst option will try to combine -adjacent messages by increasing the time period for forecast average, -accumulation, minimum and maximum. For example, - -

    -$ wgrib2 prate.l.gdas.201404.ts -for 1:4
    -1:0:d=2014040100:PRATE:surface:0-1 hour ave fcst:
    -2:13083:d=2014040100:PRATE:surface:1-2 hour ave fcst:
    -3:26587:d=2014040100:PRATE:surface:2-3 hour ave fcst:
    -4:40437:d=2014040100:PRATE:surface:3-4 hour ave fcst:
    -
    -$ wgrib2 preas.201404.ts -for 1:4 -merge_fcst 4 /tmp/all.grb
    -(listing of input)
    -
    -$ wgrib2 /tmp/all.grb 
    -1:0:d=2014040100:PRATE:surface:0-4 hour ave fcst:
    -
    -$wgrib2 prate.l.gdas.201404.ts -for 1:4 -merge_fcst 2 /tmp/all2.grb
    -(iisting of input)
    -
    -$ wgrib2 /tmp/all2.grb 
    -1:0:d=2014040100:PRATE:surface:0-2 hour ave fcst:
    -2:29531:d=2014040100:PRATE:surface:2-4 hour ave fcst:
    -
    - -The -merge_fcst option needs the fields to be processed -in order. Fields that are not fcst averages/accumlations are ignored. In -the previous example, the input data was a time series of one varianble, and -the fields were in order. The more common case is that you have the fhr06 -(0-6 hour forecast), fhr12 (6-12 hour forecast), fhr18 (12-18 hour forecast) -and fhr24 (18-24 hour forecast) files and you want the 0-24 hour mean. Each of the -forecast files contain hundreds of fields. - -
    -$ cat fhr06 fhr12 fhr18 fhr24 | \
    -   wgrib2 - -set_grib_type c1 -set_grib_max_bits 20 -set_bin_prec 20 \
    -   -if ":PRATE:" -merge_fcst 4 OUT \
    -   -if ":APCP:" -merge_fcst 4 OUT \
    -   -if ":ACPCP:" -merge_fcst 4 OUT \
    -   -if ":BGRUN:" -merge_fcst 4 OUT
    -
    -The above command works by -
      -
    1. The first line writes the grib to stdout in chrnological order -
    2. The second line has wgrib2 read from stdin and sets the packing and precision -
    3. The third line process the PRATE, the -merge_fcst sees the data in the proper order -
    4. The 4-6 lines process the APCP, ACPCP and BGRUN fields -
    - -You can use the old and slow way which is -
    -$ cat fhr06 fhr12 fhr18 fhr24 > IN.grb
    -$ wgrib2 IN.grb | sort -t: -k4,4 -k5,5 -k6,6n | wgrib2 -i IN.grb -grib OUT.grb
    -$ wgrib2 OUT.grb -merge_fcst 4 OUT
    -
    - -

    Usage

    -

    - -

    --merge_fcst (N=number fields to combine) (output grib file)
    -
    -When N > 0, then N fields are merged together and then written to the output grib file
    -   (requires wgrib2 v2.0.1)
    -When N == 0, then there is no limit to the number of fields to be merged
    -             and intermediate steps are written out
    -              ex. 0-1 + 1-2 + 2-3 -> 0-1, 0-2, 0-3
    -
    - -

    -The most common use would be get the 12-hour, daily, N-day average -precipation forecasts from the N hour to N+6 hour precipitation -forecasts. - -

    Restrictions

    -

    -

      -
    1. Only 1 time range specificaion is allowed in the PDS (no nested time ranges) -
    2. Forecast time units must be the same between message to be merged. -
    3. The various metadata in the grib messages to be merged must be identical except for - the averaging/accumulation interval. -
    - -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page recently modified: Sep 16, 2016, Jul 25, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/min.html b/web_docs/min.html deleted file mode 100644 index 96c065d..0000000 --- a/web_docs/min.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -stats, max, min - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-stats, -mmax, -min -
     
    - -

    wgrib2: -stats, -max, -min

    -
    - - -

    Introduction

    - -

    -The -stats option writes a statistical summary -of the field into the inventory. -The -max option writes the maximum value and -the -min option writes the minimum. -These option are useful for quickly determining if the field has reasonable numbers. - -

    Usage

    -

    - -

    --stats
    --max
    --min
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -stats
    -1:0:ndata=65160:undef=0:mean=83.8696:min=-428.1:max=317.8
    -
    -ndata = number of grid points
    -undef = number of grid points with an undefined value
    -mean = grid point average (not area weighted)
    -min = minimum value
    -max = maximum value
    -
    -$ wgrib2 test.grb2 -max
    -1:0:max=317.8
    -
    -$ wgrib2 test.grb2 -min
    -1:0:min=-428.1
    -
    -
    - -The -stats option can be combined with -the -undefine option to produce -statistics for a box.
    - -
    -$ wgrib2 test.grb2 -stats
    -1:4:ndata=10512:undef=0:mean=77.5081:min=-370:max=340.2:cos_wt_mean=97.267
    -
    -produces the global statistics. By setting grid points to undefined, -we can produce the statistics for a box.
    -
    -$ wgrib2 test.grb2 -undefine outobx 0:90 -10:10 -stats
    -1:4:ndata=10512:undef=10179:mean=79.8829:min=41:max=144:cos_wt_mean=79.8688
    -
    - -Note, if we reverse the order of the --stats and --undefine options, we get the global mean. -That is because the -stats option is excuted -before the -undefine options. - - -$ wgrib2 test.grb2 -stats -undefine out-box 0:10 -10:10 -1:4:ndata=10512:undef=0:mean=77.5081:min=-370:max=340.2:cos_wt_mean=97.267 - - -

    If all the data are undefined, -the -stats option will produce values -of zero for the the mean, min and max. -The -min and -max -options will yield a text string of "undefined". - - -

    -See also: -undefine -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/misc.html b/web_docs/misc.html deleted file mode 100644 index 27c051b..0000000 --- a/web_docs/misc.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -misc - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -misc -
     
    - -

    wgrib2: -misc

    -
    - - -

    Introduction

    - -

    -We need names to identify objects and people. In the beginning, -there was variable names (ex. TMP, HGT), the level (ex. surface, 500 mb) -and a date code (ex. 2017010100, x seconds after 1 Jan. 1970). -Then there was a need for forecast time (ex. 12 hour forecast) -and accumulations/averages (0-6 hour accumulation). Life became -more complicated and wgrib2 used the -misc -option to print out the additional items necessary for identification. -The -misc will change with time as -more details are needed to identify the fields. As of 9/2017, --misc includes ensemble information -(ex 10th member), probability (10% forecast), spatial processing, -wave_partition, JMA specific, climatology, error, confidence indicator, -chemical information and aerosol information. - -The -misc option is called by the --s option and many other similar options. - - -

    Usage

    -

    - -

    --misc
    -
    - -

    Example

    -

    - -

    -$ wgrib2 percentile_precip.grib2 -stats
    -1:0:75% level
    -2:315649:90% level
    -$ wgrib2 percentile_precip.grib2 -s
    -1:0:d=2014101012:TPRATE:surface:2@1 hour max(13-14 hour acc fcst)++,missing=0:75% level
    -2:315649:d=2014101012:TPRATE:surface:2@1 hour max(13-14 hour acc fcst)++,missing=0:90% level
    -
    - -

    -See also: -s -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: September 15, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/mpe.png b/web_docs/mpe.png deleted file mode 100644 index 0592901d74082c24b6fb3c341b74f2b72be49ff2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16091 zcmc(GL%@%bclw!f zj|=bXmpTfM>%;%N9uLT@MmT~FU+14Cja)B12Cs`Beo8)=0hY)B`2aw1aWN2ahX4Rz z02O%|9q+WgbhTKPhV&^~aNCnbbGTsBMFN&$^h80}FN^a{ou`e@>{)1^e$v&eX=ay` z;NR=jSNm#kxg6}MQW8aEg5BhI^qa_=uXPsdBhWNQ)jsq3ndoI8Br`59kvQ%sbF0(} zEu(l$$@1WT+iPo8R`z;tu=we%0)~IPBS))O|adM+(1(b z=mM6@4P(;xON4GFeBFr{{rXBEG2K(B*4MF0M8m}ZPBSh5xhE1j!>X1M-Sf-o!@V}V zqaqFFp^e^WHLNMHJ1s*c;f367-1*K@dc*U?S(>I`Se?AM;_B=|(}KNv?IquKX?0KA2uvHU|1EhEDa4_l0~?`^2LFce4A{DKM1d{ zr#UE2T!}ueMo^V`}Ij+S4 zR&)qY?fv4RLggy}{|$uqI8-1D)w7-SUfK?$e9Ky5vbU?Jw2f3(boU~#@+MyxA`uJv zx=>WS9M`10@{X#dQ=GQZ+l}#yCU{oJ#AbaG5exGxX;ebNKsI~Q7J&2bx~u!M1RNme zz=i@P`f(lHd|Ww!oW>3HAcHj=YYagF1LVt>U0CfBT~y^!)8W0Gs>(`WPp(m1D^wZ) z8$yGks?`6IcCH{n4aFYY92&9mgg?as{h%Ykmu!>5)Mq-Z$J(AJv=>YwlIZ&}QQBLy z>JHyk(bwp-QgRV~l7dk&%ba|Z#HMe$8!Z&ezXC@7#2{g5Uu-zmJH@uksXMV4Y5U}N zj`cc>qSXzOGj1Y1PkINmZrd#srww~1MJ}O}FC%_Nf^9A-_ySh@+yrA`hHz6Hc`$cO zMbo`?)#Xf~{%uD{)0AAk)7mB}g;e-;`X)z~ zYT=&OA*wa*ux(q3{@F^e2EEgkdK*=#bPpSJaft?XdSzOM6ts{+e3pR|#>h~*^7r~S zdizJBvTmX_DMVCwlcH%SN&q7O_(O=ipg^!e56ugnr|e85#0E&bZo0eI+0#}%yh?oKnpjKC`+waj z<#p1$0C8QINR)t%UK24Wez3K2WkQ#e7w?*LX<{u-g>x%S0$Nd{Z1R`p z!0SBeP0w^pMNXy=dX*|JU5WYr&kt$(v{?Gjo6X412|nBk$*`86*?+cT4hD%M?#}0`1S^ zeZiNlOY`ZB8;mOtz)si+2rKPQWrSLe=;r+{wEJD5bzt1SuD!Q}9ezP(ixsjL#`0*WZ3J`hjBcQLkHffZS@%HCV}$~!=aJy1Q7%* z%?O|&FDB$XlX!I*;ZB_awrK76_gbJffp@D8w6qMiGd}pCEkq(^9X_+rPAQuhNw1eY z0@mf8RT$%g@-N|yS6&DE3a~F_YQjQ7(X9j%zU9O*t#(=Y8|CnNZyN`tdoqJJ6(q7c z3DNH>9Dm)4SMR-_=`uk)H{s*M>EU=0Mh*pr z5LiW|oi9GbU@~O6QugK`=v+h_bjzMYHHAOCtApcLs1(^L(zEK5p@r?p|B20aB`g&3 z%U|P`cyL^hxjTjZlOeo2c}+Eu=PnlQ`%{1V#DfJ>{`xB^T#RaCT|Lv%uUANG@9aYv z+=2SqZ+BlTw%gz0UmcT0+=b|D)>Y+mn4D6AKWri|oM?43ohH6g6b5dBa8Timot$%} zeku1G*;-Zrn$wWvuiWM+QsD2FD@a{gM6v>>U;9pJU-wE&`RcP-IAhMM_h^=s`{!XD z#%g%Uz<(YPhTp9Z0U76}8(TA;<=!a6iUUd9Y7ehzehmAKH2#TI?e%!fK^QRm#$FZ2 z+EI4L*Kg3hwRu&D;vD&tTiUk`gcC)yI)sx?VEs8ItS@4&cBJpg@V6cu1^E%TUw~Dc zs9YR=LexJQx0BZajJ4oCoB2;@K%7A#cc6prktociEfna}f&ct@oXG|gTeD~bGBH1v zZnVbhS#}o3IvM)%t_s}#YUWf+OG)@5+8Td)d>Pep>I5MNg)Ais0nb`PqW;zF9x6F=`~a&?EZLp z!t0m8!SJ7QN=w^@6oj1!7S~tS5OTPa@{pcG_TqB~jThQ%o5S#&!D*n&%b81ZA8(V5 z(XG76(@62p(P&V+-z7^@+HF`FNf1C(D=JErqURw_kmowy@O8xng+D_7OSlkk&Xdiv z0gtMH)$wsGRcD5#2bGbK(i=r52H-VZ);tTh;Fj z4EKI`)xe$iN{+TIPKzM3;on$96aaKd;~~~8)5+SzYt8Sm8L0c+<5dr%2)>0ii7n;G zjK0-Z>`Xd1#Pipk^h;+6#?5`hDty>${JxV#*&vxqXe1t{fi- zRe9iS?A)yqvB6EFU0i&*iXC6Uu8`AWcU7{N&w_Z}=Sb(#C*(@Kr0Gmr~JrfWIt~lRn}ODgQ8pMW69o7 z%QOrPE(|D2){bAEF65_xTfOUJMiAcP@g_)gyNQ@WSO&jo8T`c)~#YuUDMf@Yu| zGp`x234lxV9Uz!^_a#&?ZkA;QAL{Y!JPP%(TqQm9ED!0O+oHMTR*e*olJ90frVCL( z<-aGUS1(}wCVipAc(}vEEx%&W{Fe@ONjhuzS5z!Y$yqt#RVyt+056`Ln9=v{N?0mQ zm-zdI5bA=2*4m4a<5f)w4EqR612LJL#^Ziaei4YNl1BI(n?UCdYcp_aIAQ2XENv8x6VYlcy zBE`vd60)cMDIYSahk%fq*Od_1udfkc8Js4-KSFA+0WnSKsandT${|-`p}8sA_Q;Lv zH9+>=W1ZM15QaLQOyCvu0Wc?R0))?-U8{8|uYgYfH-?znqdR+pIe& zjwN!boCetYw%G-3a3eOUpOeGIvEly3AAQ7nEp`f3jAZ9LbPCN9i}0)-B4mo6X-D6< z!P0`@%Piwj$%|z3H%>)x-zzwsX()5W0>R8LqRI0wW#^Vg&d*<$zI)fH*cv^#wL|J` zk^7mcuK~D}x{pIEXFg(+5^hjXEmf&Kjkc7vNgoN@JUO1$4Y>f8D74HGY2xGj5Flr##~*= z`6C@l?qr!-&H5XoU7i_jND;BP3oy@RYjmlttqyDcmF4@j=*WQ>tk&>sB`O$+u(f?J zXNAKF9HDGsQMV#ffp}1EY!U%ZE0`q7Rs*~Pf;pJDOvaqQjkN^(ZEM0d-j9VBwY)`L zaXmL7!Q*sY+%$6%79)MxEWa7YOZX}|0x<(V!ptAmteNQLIORXeUDdFC z0dEm0ina4HLRr7`4fCEKO@L%~6{cn4lGt)93wW(v9wB`i%jUi?FU*Q+U4Di z8-ww6#X=>8$tc(w|Hv3LkD9?^3uHDA;}}MB_m#IAYI9KGm5B_j1$* za%zR~nS^84&!?5-Z^4r(F=e72h2x$D|3TogVxgr05}PqQO7{v4Crf@^J8fih$XpCT zf4Nh6`r8_4XP;(bNi(N8Xcg0Fu%}MxFy_c^n!;qG)SfzCG}!l<_N=yx`n4zOfELsa zzEag&ETVj1qFKll%faBs?WvHR3V+i9p~1yrNw%N3Lpdn-JkyFRgTIxj9d?j(?nAK1 z#T~AZqnQ1La&I%lzy0`!EhkoC7)IPqAd zQD8jgFDxvfbCnMWyg{41J!jgUm{*mBEMOa9$Opgwj#>HM0Ef7#i{!o~YhKu%`ljE5 zcwPmDMWW6{YWtE82m8CRPU4#!WwDZlG++DlS8ZqZ^uY6UBMBYo?mENff@Zu+@&yV=HD;jsG( zA7(Wvv;%`U(wt`T1I*UwZl6BYYgNFb;wgV@)CN$g!_0rI!sp|K1mA<5;F}~r)!E*> z^)ezA(irBUf&(n&zA?l<2)ee*V0>&sVIYlar@3b3{g=IR&x-AeTFp!v^!nKQ@1kON z`8yIcP{dxDMiQViX;jDHz2L1VGH&2m+LYfctq#!T)l8qdWjZbN?d$$z6}=M7CqzN+ zr{wUkoY$5@5aWhVpeQkZ{4sU7XyLgAY zmr?`T>OJE64&AK0J9V=IaCv3^8hQJx%^qX9S05u!PkzYB`ITZjsl*My(nCy+vyqtnDwhgCYPl|ZS>I^vDdKyj^!!rE zD_I-`=f{n3BI_egYfQ?$%iwg>6|Z7rI|}LP{4%^Tmisx8`Vyk;Y@&OQ?Ve-wv$?{R z9|u{A>7(yHB`J7}K~t-sdkK6P*tl1Uo~bxDgjnqx4h;_HcZIaOqD$?FPL`&n{3K0# z9ZYy{xv(v0OcMyzGjF@RIIYVk?1~)V)NP9;WRY&AQmeG#y-|91XM9t;U!v1IW>Z;W`cEK|{T0KF$gX<>T0YcRCDV(p>kLfkjj$&?= zqxE3OE>Q9b*0W4uP9s2x<@0`UV5k}BFr57JM_f2IbUN(iuu1V#qrYTjuO7eVBw2HmiO*OA%ng$OBOlK!QdcSZw82{sh-u)Ga9HD$kpr3}1|pKA;WLwW(khE0L%iPs z?QqFwcj#EvjEzpIvoMjp1r3-|r>Hbk>J6=LIb&2A0W_)U$xg;K3j$SD<-u25?lp4- z(XM~{qs`cCh9n=e2OxH(ubUM@$GqY-u3Z(D9kVxw{KUf!AQ9riKe%fGxvc8IWskx} z4UwXP_aB_A2O}M}s~@9QaNmYSdDp=IZj_Btd_Itvb{^RbO-1#rvpybAOZ8Lh zWQ>rRjgSA4JkX(80EZ9FpCE+Up@gnEHLQ$w#toCkgZr7H!`QEh>5s&%?p6L3(Y_ZX z(vhQVWN{M&dt#YZ*=e8DzDxP2yWvq&LP8u>c?kj3bmqpiS|-1awrIb_y;$7%tWSex zcNjCj!t4WK`~BEme-{Oky&V2ysk5(vd2MzMr5>4L==;$ZtZ3$(nDdDZg3eSAW~FYbg41OSfAVEl~2y`-F zZb%~jj~zELBL?%IiCnhvH6QR1m&Ml~(tHW#a9oNXUr|dzNbkMvT)aH%CpsETwfh6+ z*6iM$@((tDuavc0dCC|2e2Vw!eYd1fKk)WT2@|FDcR@inx6q9vBN3~9qPbGAR_pJ@ zE;zicA9(dE^U3LT>7G9Pn+pe(1Hy5Ht(MD*-$dD2=IkW=x5q>m9aYMAj<&mT;8z;Y zJg$B$EhhG=EG>A*ya4S2VNJK(x|^B=<+l*ByrYhfb#=b4*n!8x4LpUAM{y{=HY`1W zjlR}rYJI)pK0#O?`i+Hw{m-|OG50S|@|Sx-SF>&F$IiZR>FYw+h5CET&C@ZTXoa~f z*QzsB&V!G(3EX~j2K=pAW+%Cm5viD9AJ2t&X>dWcP@v_to?k)Nv45_ds-#k_$+sHD z0tRyIYbJ~kr82fbj;U6c<#NZdTvjVrc=NM&zfRhG_o^Aoo%e6i!8^Q8fqUXacCbD# z?(~tC7FDTkGnlP}@Aw-(VYNz9A}Y7ljbJ?49l=Ph#}j$NbVF#i5R9P)e^ z$s^M=J6m_JaJ^-;vUqfigpd}bWT<1H8ILP!mM$l8;`fe=0V5g<$0Brm-mHVWlRLqhpgl78}?>@c_JP}@Hre!QLvMJJ{k-<1UZ*6VBg!|llnzZU$1E2G2x zabvUA%k+(Xf&yzreoD+d?>$3(_rROsEN7g{Q;pUDaI5~t=8r$ z{;@ANmlY09Djl6hg^fo|u^4bcqIw>fLX=RhY*FQf&rvv&5$aKV;xV~ik!tDVdyjMJ zmEZeW4K$)9pvU@Ad*`Zgur;Zs;chz}a!k6UcDa#U2at46AAE8^YKB- z)5(yKh@PRKZ}J50g+918gctWFUP4ym?2)t@g(ucB) z-bc0ts$snx+jf8AEIkZV4YSdO`I5vw-=(eKZ*YA*;jD~l0pA>?u{z)lzrXi-xVw8I ztZJtW7?v)iQ%2zXEza+(Yt%qGZu1FVBwlnMc}!25O{lFhD}%p zT%S?aHLv_yXN!=s7&!+=75qDzc3H|DAYR9i=k1hzcM&G-$q{1A*VL{Ecx5m>zla{# zn@0|`A3IpWOOXXoG=2W^q0T2G`F@1A%UL%sB|&HDC%Mxq5gojy&hWmXj9)XiitGD| zH`cVFFSK#NA*e`cah30JJFjTg6Wj8EaW%p-!}eSvo@SP-kcgM;Hect97Y$meVFHeT zJ9`XBF!$96G_3^yU@-pA3s6I%{Of7^2%^U~Z{js-OY z6dcrRHOkqL7g6f{g3q=i^xM1A(WRA8kuT>}-IbGjAO>+*uOS|NHUDad(YTi2V66kp z;a^beHFecuR=~;ISwthAXU}uy9{fF7_e{e8s`$@w|3NKBtQKD@!!ieDPlR+M{Ow-Y zg8#W&W9${~Xqevs-u=Fw-wziX_uRkczeD9T`HlK3A;tj*##j&+E-OmhoYbRo>^+l| z&;pjZ9ID^7zsx1}h8Xfd;cZ?YFL%jjRm?8#%#8DlJQi3Jnp}VI zEQTT-PAlU}F8pere_mY7%q4LldhL_KLy4WEhox#_U>s+H?WVb7**vz(wB$w8bC;1t zX(~8*BF9l^V&s_jVZGFKEl0ra=JG9@qd%c4{_{0tVH$jiP zLhMUzUD1p-Jgj_)@0*{9te7ZtM&3sT-%IAR=3mr2bzdA&%+!me=|M&> z)ZP7jSFjj#YU7bR9Zt4(7E#P&9s?E49}px8eq!i58su1T8<^FgJ+ryr(Tb;7%bWd3 zQ7d032+uJcn*Uw7nrD#2RJZec_Z3UEbmP}A?U|XQmopjU*5{*1P=1|JDD11AEwPib zw?xNRTPLOT^lw5bwO8lHA8hjQfP4Cpl#dklZJBe!ZT|wb&PEjxCwL^0sS`v7l+jUF zuNdyl2paPPB-)`C0_%v*4E66#XUlxAoDk12f>KFfJY;=!!_AcJvWzXl+~h)2w-y&P z&26)zACKoh-Y+qNI<-*!dQk%;%5gKZq3~TYOKG{p8b`U+(Z2?nPz68Ub8r^rqI=}& zO%wR;wCTb1!4&+f$>DC56XEY*XJ9LA*KcP)Rp)Pu4BII*Zfo!WH_Z?vp(1-6-M8Z*x^*TJgrqWP(^WL8#GxI0Ecq;LPx11*MIN{5?$w-ji= zSnK8?*2@;KFgn>uhqA=FVGW5`GBZMW zF775gQ01bK-w`iak`^IL)nFu^--UtDX)reQpn^*z!ITebgx%qGIm&(1!ml&!Y=eXu zP@A`3>{+_{IRnK`8SF7gpoFVeADd#rv8l!|6^!(WKisTkB*)Fq15p@6zq+@(I|@jW=!;}?7;OZ#B<=2i%S?09n} ziaia&QVv`+`P6gbypM8c5YNNK_5|DhaY`<=uJI`l%M$~1eg?se<8HKs8U9@S)_Aam zV*i2a3!<5*ca(8=rxR|E3qIx{M12fX7Fa#&)?>>4u7pY`8c3cj@Rqy?hdVof*$nZ6|3j$ z2<0dZ-Y*h#Zna3b!w_u^clWy6_eXOS}!X&B@Mqm}ae(%OsCeRD;iSRVhP z8t;7`D9z#Bsyz{^uo<(kWfwbh{~!~Cz_S!fnjC5_l)qOXeb3>>9#0CeyKMKIdojcc zLyE6$=t+phsUZu?RrS7Jf>NdpFE02WL`e^I+_o3CFP?$pOzqcx|6Myj#Oy(slk(A{ zzklq?@uxgVK9+|M`fz-alz&uFlKM06xoftph2QBuz211Jy*ZH-yeg?Ww?ibP1Z3c2 z2M<>XRPUZKs9bV1>9su|kDtbN1%B9!^Y*^EHD>w)PC9D-)2VH1c`4Gie9X@Vk)M*^ z*p++zqbPJyo1G?4BbsBlva!IM_Cm;@$>Zd*M^OrMb-IcK99IOCdH84I6JFgkbLlAER&dIgi ze%JQi$i09kzGc-QkrIPqE~nJQb|_&CYnXi)jw{hKtq?ddGM}NIt15a6Q*|B+2`@At zhwJYL`rl_XviiUR3l1XpIY_iwI=X)(zz@fLkof3cpx7>A&UF29m9hSnZ+J=RA36R< zboAm3_wz*h_B){ONo4v?jd@vPTgx99@6P0Rm9a^HOEu3I0ZIchC}YekBvU*8@Il1@ zrJ@=`a5RJ@;R6m*Y~H~Kp5~$d{(YorW9vpZ4F3s_3uJv_a;rNEr^y4E7hcN;Kov(D z7Dk1&UEwpGaZ@tBa5GO<)z?)wD*4<_iNV4=R87{|s*Y7;ESYTQdWzxu@$vfNE9mP} zrt5+JdTGQlC5}A>|4NQxwVYPRS%UY4nPuHrV=!4ez_N4_Mab zULxXvHWIJz2A5>QC1Rr`tD;nRTl>NAWB4OhR7 z5{w$Z9>Jq~`$?Gw8;bR29EcNkhA6b^|5l<4)55;t*!aa9d_m zPu7vw1<57CdQNV=P0aLL`6X>jU zGZot2ddE+JE$Ue#$FVX7X)UkZg|C1gh3G*~Rij|MB4vVmkz5Soy<7^&JLu9Y4g^rilf)lkE9_2&i+) zv_ucvE+&KRtfTX7@P9vv8*Lz14+C?G{as^mR0fYjJ%`ty2`uuu3R676L49zAZDy^H z{mzUBU;S4lv;j-D>%Ts!7?toXZa#hV<-{((m2k2N!%V4G=$MlP9X5&FRC;f}oVo9k zO8z+Uy;3!@XUhRU>Q7Gkjqj_jude!QrQPSR@W(ZWm{L*e_PFHC@!jNg9cdf>r*gmS(Y(vt-mQ}CIJV@alQdO zg1gA$>s>ka#@B~eQ9m!Q1zI}ZF8ms}&x)x;{Jf8^F91DKR3gx4E0Afst>rW$LEY+-y-_ zhvc#QKQnIK4;F$c*yc~7ASCoX$@xKt8gavI58`xVb5#y7KQ2mquF)c5BWRhbTSqCB z6u8>panA1laS2X%V}CKn`Fs@?@&)@*lFo+OVuU;p!voWz-Im}BJ-ietKb-Fs54$7! zByoc(`l|OxK1aJw!-sy+)%A6|Dmf{;j?Q#V*; z;}e15q}Zw*cHZuhga^5%EPwa{6~jH zJtOk)n0kUOk(m@xSpLYPX$ztCt$34H<|{kAzUBn)Cu4O|)UPPzE%xeK{_Ew9xLh%r zQa}2=0ZDicGuwh6miU>7lR*P>Ak+uIO86MpqU(T@4}4b^;pHI5wv2H&r=$!*9T)Q^ zJeHM8B0oloh56Re_fFjW{fbtf6zRJHgt&u>wG0`cvk}8fo*%Ph7Uf%qv|z;+xR+ns zgNx6HOvum~X4MkAUgNVTNt1#{b5#iR*Xm>fNM+Tx?btW;)XHz3JsObI&pVDQxOb!! zQ%+3XE;tIDhT%_ok4qs{9 zyK`!yR<#coT_xAk+Gy-R?MAq8;1f53Ao zUhx&iL4k+9tO7S(Z(BxIwr0t_853dmcN%e(i@F(g{8Qp@8G9`` z-r{UzF4hhW<@6q=%TXGA^e-Pj04V9Txxv;ILOf^&qa^5`*96zIFWIytmlRf`{y3dA zRcGOTtv*^d17>@0ZKzXziX_p(mN&|_T1ib0z+M#&Ywp7RQawzongAY6OKKEuVm{`k zk8q|)&--MC_M_^TjDLvlsYNq~$OE?w>Y1<1=uS>YvJ^fl2TgjYec`P~(TovZNCsg~ z%AXu<&uxTP{hRVgQ$-xk7$eZuGKy}2Ixwp>MDR`d=^#NF0oJi*?`VeX-fztsJrn^1 zL$0$EP_&7HARy1)@LAClqr{e~bh^d=zWaXrOES0fJA3Gnqx`Q;#IA{Lkm1PRUuGG_ z;@r9R;{cy7M||so!|4X$%nBCK8MVT_-aUI2bN>-O8scj177R$FvOekh%3$eCU#Bji z6-x3>KZ)jd@cR^9XIwqiEX~E&GF4!$a_g;x>VIaceaj+lgdNL>!Z1LILouLT9bo+t zTZ#?{QPi@4dp`G)oXbIcAolrcI!@Q>^>;RF)=w)iJ~QD54Gu&eq|8{*$ z0A14Ia<&#E2e&h@LO;JTY-)-EGvUL-fHLk%01S_)qUOA1(mT4I$FS^~)`_poDa@w2 zIEnSL93@5W_q=-67I*O&aagW&CpIEGMXY$c*&FFc2Qv=r!kE>C>2tQ^6O2X+u#Qw?E@^1wP%pxPNgsMEe3w3GoJa3yJE|flsZSlj} zM$x07Yd>J{%^kx^Kb}x0EUqyXMj>aPf5c8(r~u3k(W8yF-ZbF+{j4m8%wQQ?K&_go zmj?%XmOhL6$D2&nLeKA6+X;UrT9-aovcMe9!_8jLW9w_R_>BHbxOD#rc&tK_S{1$t zKpAiiPy0ReV{n7~+tMfEFjmCA0=2=9q;X(2q~E&nEp6NIl&52zOt})`-`rYE$jJ=Ky+k~+y^VqkCjnOFFU23#a=bZI?9+N5kdAi5-kG? z-ya4S66K%dObQuDy4S_%U3lF^sevlR+^Ly8T}o)9nRbJ}`z9C}A9x9kzh3&<`7;3d z_&JDy8p?u95UELKuF>#%+UPGf#vll?#Xk*?)CH? zcL|f+{xE^H0dlR&MGL z{`gV2jzg#bbO9RImmnvo2mAR#SmW#UFfA7W#xRza>r3N{=#+aE+K$xjd6~DZ=C+HP zGfdaOwdJjL^!`Mi6f^zKRC62K?#ufn9mG?KGqg%7m3E$uIvqK`?rUcKa5+7BCm$Tf z_wlBl>)3t8Z~Lg&6S3_-<1)PSgv)wvL*L!d*}uW!dJ~Tpm-@a#*-Fxc1(nWIkETeA zf;B!vO!uUajoVd0mP=Yn70efn{xuiHb~b$X$gQB!_UzXEf=9P%jyBR&Q7>6UE7BVVnSBnw+k7diQq=V7`NMl`c^nb~{BIAPMb6!ZgpK z@jIo2oekmDJxuMVy||8Q>+IZ5bX&AbD>S!36_DN;^wfZnDi^}Ld;JwDcJ|e|5UiA7 zYJPFruWv%0RE2DscLoQ6k7fs1+~MXeOcX~rwNlP6!KGjJ!so3D0Ak-C zP=dVr_TkFeCkrW(a=+`kKUX1OI)*?#5Ozq5u9g1p8n;>?SBoD;jyyOn>aWrHufHM7 z$L~CChFTS6{nF{)b&3>OGv-^1wKf(;TA~N0@pJ7AB&RJtKm0q2D7k*m^D(Js5qMZG-fR{s^Mc;BpssVC7%I)~p38V8I9VVzJD#!L^ zWc!&aeom}EtL~`u=Iy6?TU%bYw;LF=A;AFULWs83w%a&L%SoJhZNYIx97Po*f-Wh5 zzl5c-WRk04Y5=YGpn&(Vt0{i4@=-Zk!BDk4sWEPzG9Q-mnqem{=eB7=-y;MnuiNl< zPiKCU(2&;aH{xZXvqt}=9miE$oq^TxXBbedQ@&>N)YTu)+|`~ zse-VpXj*nG$f319Rp0nQ4M7h;?WgzKWsR)REcrwl!|9Me-$MYvkbox;tIok}(1P6S&^bB@Eho-EB|*AK(rG!-c2TH=0~d`;vV6WK$2HS8Dp1gi1E?^45S%6;^A zzM=!r$wk;z7>>)z&1JUd6PT}t>xb#Q$#7D=JL{Bir&N4)e@MPBsF51X+e=9>pZ3D# zRijH~pMhRHYJg^)MZAw50O3$>rcX}N%qHu!b(yYtGk$4lc_I43VZj-J)#7*&X)(Gg zjqNmUo2#N?80fB%N=&JM6p$ea@!ze>*A!Y3*8J4i_PwuOtnPwaSf2TE7@kH(hiqVV zk`O6(tmffd2UWsXdo0JA*q>opT#O1h%p(&XUC|O%x0BRsL*!p zb9E7jFwy=`-JP)7bY|d^G5R_5Co-Ynxif5NYjQbK8@G!D$TEGF`vxy+gJ3lx^-~u5 zHbiOQ-_K^`zwGxDD6k<0{5|H-I)T-ti$mUnV&eo*4G`nc(^+(G3>lYg)1 z>#Z)5Dl9D($TIxQg$$~Nndh!*bq~j7o8C40_r(G<5Gf8V)RynND94jtzC}D`%CXGq%e3d?zEz^M#9nFveS6)=v?@zuA!5!d}_5iaW(cu@Dc zLPw_G#W&RyZnRnMLRgxwO7n(9Mv_pmw1@4#i5kMHR#K-x%j(v&gA`NXH%p zssu1RHXf4o`@&mqY0r*+V}K00=aZ`4Fa%p6+=b7+EXQ!-fk)2zkD3#|TLbN$riB!p z5?4~ez8ID1Q6Ie2q5wf6S3WSN&Hi)JcsxG&y8Ub3KG#FeZ}3e&jp=h}4_8S_iJn#x zFvOYh=|!Jvk1XQf^Zr z_a!CG5~!wBac^k8alvlm3b84<;rnQw>6x(9B~KbWeqAQy2K%u?+}`l&+bcB_rouBlfc{#gGwM`liIkv?MMC?w4Z z^W8GhRzuVv7m!_U2;FJB$w|&>?Hr+bZGVOXyjO9Oa_M?D@alXpPAcnp`bal3!wbIm9 zY%%cX;Sz@<3~GjjI!m<8sj;d-x;7E5?d4c)Mw9lj*DU`&Ki2c!9{<4(0bPyC@tE?Z zkVX^8ONgQQ*lD!QzL55(3jAduO$Owo0qWsD>Z!jJ{?Pv753@MHS>wDN7?6faY?Jnk z0?nT>Q$Qz+1U12SbTFnT_&^G(8TcHrH6^OqKq4hHQUTBiUv-;Sm*A7MgnePQ%i?03 z^6X0+QU^jTw5tlz=uqT(*r=2)N)e+H4r(ZU6~Mv}kfsYZr$B&@M)nY*7H%18pE<)h-^W%Uj}tFnems8>JzlFNWdK>Z)nKi4UE{so*kadU_x+1*caH3)d%n*q4evi^W|rc!|4DO1$FsyS+k)3 E2kE*pIRF3v diff --git a/web_docs/n.html b/web_docs/n.html deleted file mode 100644 index 80da807..0000000 --- a/web_docs/n.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -n - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -n -
     
    - -

    wgrib2: -n

    -
    - - -

    Introduction: message number vs inventory number

    - -

    -A grib file is made of messages and each message can contain one or more gridded fields. -If the message has two or more gridded fields, we say the message has submessages. -The wgrib2 convention for number the messages/submessages is -

    - -
    -Message/submessage numbering convention:
    -
    -   No submessage, one field
    -
    -     I     I is integer starting from 1 and is the message number
    -
    -   Submessage, multiple fields
    -
    -     I.J   I is integer starting from 1 and is the message number
    -           J is integer and is the sub-message number
    -           J = 1 for the first submessage of the Ith message
    -
    -
    -Inventory numbering convention:
    -
    -     I     I is integer starting from 1 and is the number of the field
    -
    - -

    -An alternative method for numbering the fields is the inventory number. The inventory number -is simply the grids starting from one. The inventory number is simply the line number of -the default wgrib2 inventory. The message number is the first column of the the default -wgrib2 inventory. -

    - -

    -Both the message number and the inventory number are valid ways of numbering the fields in -a grib file. The message number is the original method and reflects the structure of -the grib message/submessage structure. The inventory number is a logical numbering scheme -when trying trying to multitask wgrib2. (For example, send even fields to CPU1 and odd fields -to CPU2.) -

    - - - -
    --sh-2.05b$ ./wgrib2 test.grb2 -s -npts -d 1
    -1:0:d=2005090200:HGT:1000 mb:60 hour fcst:npts=259920
    -
    - -

    Usage

    -

    - -

    --n
    -
    - -See also: --if_n, --for_n -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/names.html b/web_docs/names.html deleted file mode 100644 index 65e0145..0000000 --- a/web_docs/names.html +++ /dev/null @@ -1,291 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -names - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-names -
     
    - -

    wgrib2: -names

    -
    - - -

    Introduction (alpha)

    - -

    -WMO has defined how fields like temperature -are encoded into grib. For example, temperature has to have -(discipline, category, and parameter) to be (0, 0, 0). However, WMO never -defined a name for like "t" or "TMP" for the temperature. -Of course saying "discipline=0, category=0, and parameter=0" -is unwieldy, so the centers have adopted names for the various -fields. - -

    -The -names option changes the names of -the WMO defined fields to either the DWD, ECMWF or NCEP names or convention. -The grib format allows for locally defined fields. Centers can make extensions -to the grib table which apply to their file from that center. These fields -will use the names as defined by the originating center. The default naming -convention being set at compile time. - -

    -The -names -option is in an alpha stage of development. Our use of the ECMWF and DWD grib table -needs more work. The ECMWF and DWD names often mix the variable -(discipline, category, parameter) with other orthogonal parameters -such as - -

      -
    1. level, ex 2 meters above ground -
    2. statistical processing (in time), ex average over last 24 hours -
    3. grid, latitude on F grid -
    4. satellite information (instrument type) -
    5. aerosol type -
    6. MRMS (NSSL Mult-Radar/Multi-Sensor) adds probability to the grib name -
    - -

    -For wgrib2 v3.0.1, if the ECMWF or DWD grib name depends on any of the above parameters, the -name is not included in the wgrib2's grib table. This causes some problem because some of -the ECMWF grib names don't apply when the orthogonal parameter is not defined. -As I said before, this approach is in alpha testing. - -

    -The geometrical height has the names "dist" and "h" in the ECMWF table. Wgrib2 v3.0.1-v3.0.3 -is using "dist". Using "dist" versus "h" may change in -later versions of wgrib2, depending on which is more commonly used. (Feedback please) - -

    -The use of the ECMWF and DWD grib has not been finalized. So use -names at your own risk. - - -

    Wgrib2 has options that are dependent on the grib names such as -vector interpolation in -new_grid. At present, there is no automatic -conversion of the names. - -

    Usage

    -

    -

    --names CENTER
    -       CENTER  =  ncep (default in the public-release makefile)
    -                  ecmwf
    -                  dwd
    -
    -       This option changes the names of the WMO defined fields to either the NCEP, DWD or
    -       ECMWF conventions.  The locally defined fields are not affected.
    -
    -The default convention is a compile-time option (USE_NAMES in the makefile).
    -To see the default, run "wgrib2 -config" and look for "default WMO names:".
    -
    - -

    Example

    -
    - wgrib2 wind.grb -names ecmwf
    -1:0:d=2009060500:wdir:200 mb:180 hour fcst:ENS=+19
    -2:97922:d=2009060500:ws:200 mb:180 hour fcst:ENS=+19
    -3:179554:d=2009060500:wdir:250 mb:180 hour fcst:ENS=+19
    -..
    - wgrib2 wind.grb -names ncep
    -1:0:d=2009060500:WDIR:200 mb:180 hour fcst:ENS=+19
    -2:97922:d=2009060500:WIND:200 mb:180 hour fcst:ENS=+19
    -3:179554:d=2009060500:WDIR:250 mb:180 hour fcst:ENS=+19
    -
    - -

    NCEP Names

    -

    -The NCEP grib names are unique, a name refers to a unique quantity. -However, the same grib name may be defined both locally and by the WMO. -Since WMO approval of a new field may take several months, NCEP usually makes -a local definition in order to speed up development. -NCEP considers duplicate names to be a mistake (same name but different quantities). -When the wgrib2 sets the variable name (ex. -set_var, -set_metadata), the WMO definition -is used if local and WMO definition exists. - - -

    DWD Names

    -The DWD grib names are unique except for a few cases (wgrib2 v3.0.1) -which were probably an oversights. There are WMO defined fields -which do not have a DWD name. -

    -Some DWD names are not orthogonal because the names include information about -the level or timing. They are not included in the wgrib2 tables. - - -

    ECMWF Names

    -The ECMWF grib names are not unique. Names may refer to -different quantities. For example, uv could have units of -m^2/s^2 or m/s^2. For decoding grib, the duplicate -names do not pose a problem. However, using -the -set_var or -set_metadata option will have problems -with names that are duplicated. Wgrib2 will use the -first definition that it finds. - -

    -Some ECMWF names are not orthogonal, they include information about -the level or timing. The some non-orthogonal variable names -are not included in the wgrib2 tables. For example, "2t" -which is the temperature two meter above the ground (or water surface). -The "2t" grib is defined as the air temperature with a level of 2 meter -above the ground. So "2t" can be thought as "t" with a level of "2 meters -above the ground". The wgrib2 script that reads the ECMWF parameter database -determines that "2t" is a non-orthogonal variable because it needs to have -a level of "2 meters above ground". As result, "2t" is not wgrib2's gribtable. -

    -Some non-orthogonal variable names are included in the wgrib2 tables. For example, -"10spg10" is defined as "10 metre wind speed probability of at least 10 m/s". The -ECMWF database indicates this parameter doesn't depend on the level or any probability -or level information. Since this variable is not conditional on the level or -probability templates, this variable is added to wgrib2's tables. - -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created: Jan 6, 2021, July 29, 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/nc3.html b/web_docs/nc3.html deleted file mode 100644 index 416c571..0000000 --- a/web_docs/nc3.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -nc4, -nc3 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end - -
     
    - -

    wgrib2: -nc4, -nc3

    -
    - -

    Introduction

    - -

    -Wgrib2 can be compiled to use either the netCDF v3 (netCDF3) or netCDF v4 (netCDF4) libraries. If wgrib2 is -compiled with the netCDF3, you can neither read nor write netCDF4 files. However, if wgrib2 is -compiled with netCDF4, wgrib2 can read and write netCDF3 and netCDF4 files. The disadvantage of -linking in netCDF4 is that the wgrib2 executable is much larger, compiling wgrib2 can now take hours -(1.1 GHz Apollo Lake), -and problems have been encountered in compiling the latest hdf5 library with newer compilers (12/2018). - -

    -The -nc4 and --nc3 options toggle the type of netcdf file written. The former -option will have the netcdf file be netcdf-4 format with compression turned on. The latter -will have the netcdf file be uncompressed in netcdf-3 format. - - - -

    Simple usage

    -

    - -

    --nc3
    --nc4
    -
    - -

    Example 1

    -

    - -

    -$ wgrib2 ../example/eta.t00z.awphys18.grb2 -nc4 -netcdf eta.nc
    -
    -The above line converts the grib2 file into a netcdf4 file assuming wgrib2 was
    -compiled with netCDF4.
    -
    -
    - -

    -See also: --netcdf, --nc3 --nc4 -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan. 27, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/nc4.html b/web_docs/nc4.html deleted file mode 100644 index 416c571..0000000 --- a/web_docs/nc4.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -nc4, -nc3 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end - -
     
    - -

    wgrib2: -nc4, -nc3

    -
    - -

    Introduction

    - -

    -Wgrib2 can be compiled to use either the netCDF v3 (netCDF3) or netCDF v4 (netCDF4) libraries. If wgrib2 is -compiled with the netCDF3, you can neither read nor write netCDF4 files. However, if wgrib2 is -compiled with netCDF4, wgrib2 can read and write netCDF3 and netCDF4 files. The disadvantage of -linking in netCDF4 is that the wgrib2 executable is much larger, compiling wgrib2 can now take hours -(1.1 GHz Apollo Lake), -and problems have been encountered in compiling the latest hdf5 library with newer compilers (12/2018). - -

    -The -nc4 and --nc3 options toggle the type of netcdf file written. The former -option will have the netcdf file be netcdf-4 format with compression turned on. The latter -will have the netcdf file be uncompressed in netcdf-3 format. - - - -

    Simple usage

    -

    - -

    --nc3
    --nc4
    -
    - -

    Example 1

    -

    - -

    -$ wgrib2 ../example/eta.t00z.awphys18.grb2 -nc4 -netcdf eta.nc
    -
    -The above line converts the grib2 file into a netcdf4 file assuming wgrib2 was
    -compiled with netCDF4.
    -
    -
    - -

    -See also: --netcdf, --nc3 --nc4 -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan. 27, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/nc_grads.html b/web_docs/nc_grads.html deleted file mode 100644 index d396341..0000000 --- a/web_docs/nc_grads.html +++ /dev/null @@ -1,552 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -netcdf - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end - -
     
    - -

    wgrib2: -netcdf

    -
    - -

    Introduction

    - -

    -The -netcdf option writes the grid values to a specified -file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator -and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic -projection grids. Other grid templates and projections are not supported yet. - -

    -Default the grid values are written as 4 bytes float having {TIME,LAT,LON} -dimension shape (3D data) and possible vertical LEV information added to the name of variables. -For example, V wind component defined at 10 m level in atmosphere will have default name -VGRD_10maboveground. -With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data -with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical -structure analysis etc. -

    -3D and 4D data could be mixed in the same netcdf file if both have the same horizontal -grid shapes. Practically any number of variables could be placed in to the single netcdf file -as well as time dimension can be almost arbitrary extended. For these purposes -please use the wgrib2 -append option. -All missing values in data are replaced by the _FillValue defined in wgrib2 as -9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. - - - -

    Simple usage

    -

    - -

    --netcdf file_name
    -
    - -

    Example 1

    -

    - -

    -$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    -
    -The above line converts the grib2 file into a netcdf file.
    -
    -
    - -

    Sub-options for -netcdf

    - -

    -Next sub-options could help to customize created netcdf file(s). -All sub-options must preceed the -netcdf option as it is the wgrib2 rule. -More then one -netcdf option could be given on the wgrib2 command line, -please read the documentation for wgrib2. -Almost all sub-options have -no_... version that annulates previous -assignment. -For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table -with the -nc_table sub-option or combine the command line options -with instructions in the -nc_table conversion file. - -

    -The -append option makes possible to create single -large data set for long time series of gridded data. Time dimension of data in the netcdf file -is "unlimited", it could be extended "forward" when adding new data but not "backward" before -the first defined time value. If data for the same time step already exist in the updated -netcdf file these will be silently overwritten. - -

    -The -nc_nlev option is needed to export data to netcdf -as 4D data defined in {TIME,LEV,LAT,LON} space. -It must be followed by integer max_number_of_vertical_levels -which defines the vertical dimension size of 4D data exported to the netcdf file. -This value can not be found from each single grib2 message or sub-message, -usually it has to be scanned the entire grib2 file or even number of files. -It is the reason why the max_number_of_vertical_levels -value must be provided by user. -

    -Grib2 types of vertical levels eligible for export to the netcdf as 4D data -are defined in the wgrib2 internal table and now include next types of GRIB2 levels: -

    -
    -
    20:K level -
    100:pressure level -
    104:sigma level -
    105:hybrid level -
    107:K isentropic level -
    160:ocean depth below sea level -
    -
    -

    -Data for the first found eligible level type are treated as 4D and vertical level -information is not added to the variable names. -Error is generetad if data for other then first found eligible level type -are met in the input stream. -Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space -with the possible level information included into the variable names or with the user-specified names -(see -nc_table option description below for how to do it). -

    -The -nc_nlev option has not -no_... option, -please use instead the max_number_of_vertical_levels equal to 0. -In this case all data from the input stream will be threated as 3D. -

    -When existing netcdf file is updated in the -append mode -the value of max_number_of_vertical_levels must not exceed -initial value provided when the netcdf file was first created (defined). -By default when first creating the netcdf file, vertical level values are not fixed -(are undefined) and these are defined one-by-one when data at new level are added -to the netcdf file, up to the max_number_of_vertical_levels. -To overcome this feature please use the -nc_table option. - -

    -The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is -default and do not assume data packing, only data range is checked. Data outside of -specified range are replaced by missing value code for all types of packing. -This replacement is done in the local copy of unpacked data, so main data array -stays unchanged. -Values of min and max could be any -signed float. Packing is applied to all new variables in the input stream. -If some variable was already defined in the netcdf file and now is appended to it -in the -append mode the initially defined and fixed in the netcdf file -valid range and packing parameters are used. -

    -The packing is possible to the short (2 bytes) -or byte (1 byte) values with potential loss of precision. -Both zero values of min and max -packing parameters for the short or -byte packing activate 'auto' packing when -min and max -values are defined from the first entered field. - -

    -PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file -is open with 'sdfopen' command. But by some reasons using the GrADS -data description file (catalog) for the same netcdf file helps in this situation. - -

    -The -nc_grads option activates some tests for the created -netcdf file to be GrADS (version 1.9b4) compatible, -or to be open by sdfopen in gradsnc or gradsdods. -The GrADS support only COARDS convention netcdf files; -it do not support non-constant data time stepping -and silently generates wrong time stamps for such netcdf files. -Packing to byte also is not directly recognized by GrADS v1.9b4. -With this option an error is raised and processing stops -if any of criterias above is determined. - -

    -The -nc_table option followed by the file_name is most usefull for the advanced users -as it specifies the file where user can customize many features of created netcdf file. -Next examples demonstrate which directives and conversion rules could be given -in the -nc_table file. -Almost all of them are optional with exception of $nlev for the case -when user explicitly specifies the vertical level values $levs. -

    -$lev_type 100:pressure:pressure level:mb:0.01 -

    This directive explicitly defines the type of vertical level -in the grib2 file that becomes eligible for treating data at these levels as 4D data -and some it attributes for netcdf file. -Default, first found level type listed in the wgrib2 build-in table -of eligible levels is selected if no $lev_type directive found. -

    Fields here include: -

    -
    -
    100-the grib2 level type code number -for treating data as 4D. In this example it is the code number for pressure levels, integer -
    pressure- -short_name for the vertical axis in the netcdf file, string -
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces -
    mb-vertical axis units as written in the netcdf file, string -
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file -
    -
    - -$nlev X -

    This directive is an equivalent of the -nc_nlev command line option -but value in the -nc_table file has precedence over the command line option if both are found. -It is required if next $levs directive is specified. -

    - -
    $levs lev(1) lev(2) lev(3)... -
    ...lev(I-1) lev(I) lev(I+1)... -
    ...lev(X-1) lev(X) -
    -

    -This directive explicitly specifies the vertical level values to be exported -to the netcdf file, in the netcdf units. -If this directive exists in the -nc_table file and there is found the grib2 data -eligible for the 4D presentation but defined on other then listed level - -these data are skipped from export and work is silently continued. -All data conversion parameters are checked before the $levs is checked. -List of level values could consist of multiple lines; -max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); -use space, ',', ';' or ':' as lev(i) fields separator. -

    -Impact of $nlev and $levs directives is different depending on -does the netcdf file is first created or it is updated. -When the netcdf file is first created these values are written -to the netcdf file fixing 4D data vertical structure. -When updating an existing netcdf file in the -append mode -these parameters will work like filter limiting possible -updates of 4D data by these that satisfy to the given $levs only and -ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. -

    -The $nlev and $levs directives could be necessary if records -in the grib2 file have randomly changing vertical level values -that makes it impossible sequentionally define valid order of vertical levels. - -

    -$grads 1 -

    This directive is an equivalent of the -nc_grads command line option -if passed value is 1 or to the -no_nc_grads if value is 0. -Directive in the -nc_table file has precedence over the command line option. - -

    -wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] -

    -All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' -are treated as grib2 to netcdf conversion rules for the specified variables. -In these strings the wgib2_name and wgrib2_level -are strings as returned by the wgrib2 inventory; -* used as the wgrib2_level will apply -to all levels not given explicitly. -The valid range and packing information is optional but it overwrites common -packing rule if such is specified by the -nc_pack command line option. -Absence of packing information means no packing for this variable. -Min and max values are any signed float values. Both could be omitted or put to zero. -Last case means that automatic scaling will be estimated from the first entered -wgib2_name field at the wgrib2_level -or at the first level in case of * as level value. -

    -If the keyword ignore is found as a netcdf variable name or -as a packing type value, the corresponding data are ignored -and do not written to the netcdf file. -Impact from this keyword is similar to the wgrib2 -not option -or filtering data with the grep utility. -

    -The ignore keyword is recommended if the data from the same -grib2 file are exported in number of output files (netcdf or other) -by the same wgrib2 process. Then the same decoded data could be passed -for the output in other file of any supported type. -Doing export to the single netcdf file it is not recommended to use the -ignore keyword -as corresponding data are first decoded and after that skipped from writing -to the netcdf file. -

    -In the next example two lines from the -nc_table file instruct -the wgrib2 utility export to the netcdf file the geopotential height changing name -from HGT (wgrib2) to -geopotential in the netcdf file, -at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: -

    -
    -HGT:*:geopotential
    -HGT:975 mb:ignore
    -
    -
    -All other variables not listed in the -nc_table file but found in the input stream -are processed as regular 3D data. - - -

    Example 2

    -

    -Next example shows the content of user-defined -nc_table file -for one special case of Japan Meteorological Agency MSM system grib2 data conversion. -Same -nc_table file includes the rules for -conversion of both 'surface' and upper air data although -the input grib2 files are different. - -

    -
    -#
    -# File name: jma_msm_g2nc.table
    -# Description: Specifies parameters for conversion to Netcdf format
    -# hourly analyses and forecasts of JMA MSM system as best suited to
    -# my purposes: forcing of ocean model and reference data for analysis
    -# of meteorological conditions with GrADS-based visualization tools.
    -# Sergey Varlamov, July 2007
    -#
    -$lev_type  100:p:pressure level:mb:0.01
    -$nlev      16
    -$levs  1000 975 950 925 900 850 800 700 600 500
    -        400 300 250 200 150 100
    -$grads 1
    -#
    -# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    -#
    -UGRD:*:u
    -VGRD:*:v
    -#UGRD:*:u:ignore
    -#VGRD:*:v:ignore
    -TMP:*:temp
    -#write HGT at any level as hgtprs:
    -HGT:*:hgtprs
    -#but skip HGT at 100 mb, now commented - example and test
    -#HGT:100 mb:hgtprs:ignore
    -RH:*:rh:short:-2:110
    -VVEL:*:omega
    -#
    -# JMA MSM model surface data conversion rules
    -#
    -PRMSL:mean sea level:prmsl
    -PRES:surface:prsfc
    -UGRD:10 m above ground:u10m
    -VGRD:10 m above ground:v10m
    -TMP:1.5 m above ground:t2m
    -RH:1.5 m above ground:rh2m:short:-5:110
    -TCDC:surface:ncld:short:-5:110
    -LCDC:surface:ncld_low:short:-5:110
    -MCDC:surface:ncld_mid:short:-5:110
    -HCDC:surface:ncld_upper:short:-5:110
    -APCP:surface:r1h
    -# End of file
    -
    -
    -Using above file we could create the daily file with 3h analyses
    -at the 'surface' layers from the input grib2 files
    -with the next simple shell script:
    -
    -
    -date=20070715
    -for (( j=0; j<=21; j+=3 )) #hour of day loop
    -do
    -  if [ $j -lt  10 ]
    -  then
    -    h=0$j
    -  else
    -    h=$j
    -  fi
    -  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    -
    -  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    -  code=$?
    -  if [ $code -eq 0 ]
    -  then
    -    echo ${date}${h}': created/added to Netcdf'
    -  else
    -    echo ${date}${h}': wgrib2 failed...'
    -    exit $code
    -  fi
    -done
    -
    -
    -Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    -
    -gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    -
    -and change the name for the output file:
    -
    -./msm_s_${date}.nc to the ./msm_p_${date}.nc
    -
    -Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    -utility for data visualization and analyses.
    -
    - -

    Example 3

    - -In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, -convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf -option doesn't support appending, the netcdf conversion cannot be in a loop. - -
    -Version 1, using loops and a temporary file
    -
    -rm tempfile
    -for f in gfs.t00z.pgrb2f[01]?
    -do
    -   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    -done
    -wgrib2 tempfile -netcdf ~/myfile.nc
    -rm tempfile
    -
    -Version 2, data-flow 
    -
    -1:   cat gfs.t00z.pgrb2f[01]? | \
    -2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    -3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    -4:   wgrib2 - -netcdf ~/myfile.nc
    -
    -
    -Line 1 (cat), takes all the desired grib files and writes to stdout
    -Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    -Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    -Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    -
    -

    -See also: --bin, --ieee --text --spread - --append -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan. 27, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/nc_nlev.html b/web_docs/nc_nlev.html deleted file mode 100644 index d396341..0000000 --- a/web_docs/nc_nlev.html +++ /dev/null @@ -1,552 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -netcdf - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end - -
     
    - -

    wgrib2: -netcdf

    -
    - -

    Introduction

    - -

    -The -netcdf option writes the grid values to a specified -file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator -and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic -projection grids. Other grid templates and projections are not supported yet. - -

    -Default the grid values are written as 4 bytes float having {TIME,LAT,LON} -dimension shape (3D data) and possible vertical LEV information added to the name of variables. -For example, V wind component defined at 10 m level in atmosphere will have default name -VGRD_10maboveground. -With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data -with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical -structure analysis etc. -

    -3D and 4D data could be mixed in the same netcdf file if both have the same horizontal -grid shapes. Practically any number of variables could be placed in to the single netcdf file -as well as time dimension can be almost arbitrary extended. For these purposes -please use the wgrib2 -append option. -All missing values in data are replaced by the _FillValue defined in wgrib2 as -9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. - - - -

    Simple usage

    -

    - -

    --netcdf file_name
    -
    - -

    Example 1

    -

    - -

    -$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    -
    -The above line converts the grib2 file into a netcdf file.
    -
    -
    - -

    Sub-options for -netcdf

    - -

    -Next sub-options could help to customize created netcdf file(s). -All sub-options must preceed the -netcdf option as it is the wgrib2 rule. -More then one -netcdf option could be given on the wgrib2 command line, -please read the documentation for wgrib2. -Almost all sub-options have -no_... version that annulates previous -assignment. -For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table -with the -nc_table sub-option or combine the command line options -with instructions in the -nc_table conversion file. - -

    -The -append option makes possible to create single -large data set for long time series of gridded data. Time dimension of data in the netcdf file -is "unlimited", it could be extended "forward" when adding new data but not "backward" before -the first defined time value. If data for the same time step already exist in the updated -netcdf file these will be silently overwritten. - -

    -The -nc_nlev option is needed to export data to netcdf -as 4D data defined in {TIME,LEV,LAT,LON} space. -It must be followed by integer max_number_of_vertical_levels -which defines the vertical dimension size of 4D data exported to the netcdf file. -This value can not be found from each single grib2 message or sub-message, -usually it has to be scanned the entire grib2 file or even number of files. -It is the reason why the max_number_of_vertical_levels -value must be provided by user. -

    -Grib2 types of vertical levels eligible for export to the netcdf as 4D data -are defined in the wgrib2 internal table and now include next types of GRIB2 levels: -

    -
    -
    20:K level -
    100:pressure level -
    104:sigma level -
    105:hybrid level -
    107:K isentropic level -
    160:ocean depth below sea level -
    -
    -

    -Data for the first found eligible level type are treated as 4D and vertical level -information is not added to the variable names. -Error is generetad if data for other then first found eligible level type -are met in the input stream. -Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space -with the possible level information included into the variable names or with the user-specified names -(see -nc_table option description below for how to do it). -

    -The -nc_nlev option has not -no_... option, -please use instead the max_number_of_vertical_levels equal to 0. -In this case all data from the input stream will be threated as 3D. -

    -When existing netcdf file is updated in the -append mode -the value of max_number_of_vertical_levels must not exceed -initial value provided when the netcdf file was first created (defined). -By default when first creating the netcdf file, vertical level values are not fixed -(are undefined) and these are defined one-by-one when data at new level are added -to the netcdf file, up to the max_number_of_vertical_levels. -To overcome this feature please use the -nc_table option. - -

    -The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is -default and do not assume data packing, only data range is checked. Data outside of -specified range are replaced by missing value code for all types of packing. -This replacement is done in the local copy of unpacked data, so main data array -stays unchanged. -Values of min and max could be any -signed float. Packing is applied to all new variables in the input stream. -If some variable was already defined in the netcdf file and now is appended to it -in the -append mode the initially defined and fixed in the netcdf file -valid range and packing parameters are used. -

    -The packing is possible to the short (2 bytes) -or byte (1 byte) values with potential loss of precision. -Both zero values of min and max -packing parameters for the short or -byte packing activate 'auto' packing when -min and max -values are defined from the first entered field. - -

    -PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file -is open with 'sdfopen' command. But by some reasons using the GrADS -data description file (catalog) for the same netcdf file helps in this situation. - -

    -The -nc_grads option activates some tests for the created -netcdf file to be GrADS (version 1.9b4) compatible, -or to be open by sdfopen in gradsnc or gradsdods. -The GrADS support only COARDS convention netcdf files; -it do not support non-constant data time stepping -and silently generates wrong time stamps for such netcdf files. -Packing to byte also is not directly recognized by GrADS v1.9b4. -With this option an error is raised and processing stops -if any of criterias above is determined. - -

    -The -nc_table option followed by the file_name is most usefull for the advanced users -as it specifies the file where user can customize many features of created netcdf file. -Next examples demonstrate which directives and conversion rules could be given -in the -nc_table file. -Almost all of them are optional with exception of $nlev for the case -when user explicitly specifies the vertical level values $levs. -

    -$lev_type 100:pressure:pressure level:mb:0.01 -

    This directive explicitly defines the type of vertical level -in the grib2 file that becomes eligible for treating data at these levels as 4D data -and some it attributes for netcdf file. -Default, first found level type listed in the wgrib2 build-in table -of eligible levels is selected if no $lev_type directive found. -

    Fields here include: -

    -
    -
    100-the grib2 level type code number -for treating data as 4D. In this example it is the code number for pressure levels, integer -
    pressure- -short_name for the vertical axis in the netcdf file, string -
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces -
    mb-vertical axis units as written in the netcdf file, string -
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file -
    -
    - -$nlev X -

    This directive is an equivalent of the -nc_nlev command line option -but value in the -nc_table file has precedence over the command line option if both are found. -It is required if next $levs directive is specified. -

    - -
    $levs lev(1) lev(2) lev(3)... -
    ...lev(I-1) lev(I) lev(I+1)... -
    ...lev(X-1) lev(X) -
    -

    -This directive explicitly specifies the vertical level values to be exported -to the netcdf file, in the netcdf units. -If this directive exists in the -nc_table file and there is found the grib2 data -eligible for the 4D presentation but defined on other then listed level - -these data are skipped from export and work is silently continued. -All data conversion parameters are checked before the $levs is checked. -List of level values could consist of multiple lines; -max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); -use space, ',', ';' or ':' as lev(i) fields separator. -

    -Impact of $nlev and $levs directives is different depending on -does the netcdf file is first created or it is updated. -When the netcdf file is first created these values are written -to the netcdf file fixing 4D data vertical structure. -When updating an existing netcdf file in the -append mode -these parameters will work like filter limiting possible -updates of 4D data by these that satisfy to the given $levs only and -ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. -

    -The $nlev and $levs directives could be necessary if records -in the grib2 file have randomly changing vertical level values -that makes it impossible sequentionally define valid order of vertical levels. - -

    -$grads 1 -

    This directive is an equivalent of the -nc_grads command line option -if passed value is 1 or to the -no_nc_grads if value is 0. -Directive in the -nc_table file has precedence over the command line option. - -

    -wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] -

    -All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' -are treated as grib2 to netcdf conversion rules for the specified variables. -In these strings the wgib2_name and wgrib2_level -are strings as returned by the wgrib2 inventory; -* used as the wgrib2_level will apply -to all levels not given explicitly. -The valid range and packing information is optional but it overwrites common -packing rule if such is specified by the -nc_pack command line option. -Absence of packing information means no packing for this variable. -Min and max values are any signed float values. Both could be omitted or put to zero. -Last case means that automatic scaling will be estimated from the first entered -wgib2_name field at the wgrib2_level -or at the first level in case of * as level value. -

    -If the keyword ignore is found as a netcdf variable name or -as a packing type value, the corresponding data are ignored -and do not written to the netcdf file. -Impact from this keyword is similar to the wgrib2 -not option -or filtering data with the grep utility. -

    -The ignore keyword is recommended if the data from the same -grib2 file are exported in number of output files (netcdf or other) -by the same wgrib2 process. Then the same decoded data could be passed -for the output in other file of any supported type. -Doing export to the single netcdf file it is not recommended to use the -ignore keyword -as corresponding data are first decoded and after that skipped from writing -to the netcdf file. -

    -In the next example two lines from the -nc_table file instruct -the wgrib2 utility export to the netcdf file the geopotential height changing name -from HGT (wgrib2) to -geopotential in the netcdf file, -at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: -

    -
    -HGT:*:geopotential
    -HGT:975 mb:ignore
    -
    -
    -All other variables not listed in the -nc_table file but found in the input stream -are processed as regular 3D data. - - -

    Example 2

    -

    -Next example shows the content of user-defined -nc_table file -for one special case of Japan Meteorological Agency MSM system grib2 data conversion. -Same -nc_table file includes the rules for -conversion of both 'surface' and upper air data although -the input grib2 files are different. - -

    -
    -#
    -# File name: jma_msm_g2nc.table
    -# Description: Specifies parameters for conversion to Netcdf format
    -# hourly analyses and forecasts of JMA MSM system as best suited to
    -# my purposes: forcing of ocean model and reference data for analysis
    -# of meteorological conditions with GrADS-based visualization tools.
    -# Sergey Varlamov, July 2007
    -#
    -$lev_type  100:p:pressure level:mb:0.01
    -$nlev      16
    -$levs  1000 975 950 925 900 850 800 700 600 500
    -        400 300 250 200 150 100
    -$grads 1
    -#
    -# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    -#
    -UGRD:*:u
    -VGRD:*:v
    -#UGRD:*:u:ignore
    -#VGRD:*:v:ignore
    -TMP:*:temp
    -#write HGT at any level as hgtprs:
    -HGT:*:hgtprs
    -#but skip HGT at 100 mb, now commented - example and test
    -#HGT:100 mb:hgtprs:ignore
    -RH:*:rh:short:-2:110
    -VVEL:*:omega
    -#
    -# JMA MSM model surface data conversion rules
    -#
    -PRMSL:mean sea level:prmsl
    -PRES:surface:prsfc
    -UGRD:10 m above ground:u10m
    -VGRD:10 m above ground:v10m
    -TMP:1.5 m above ground:t2m
    -RH:1.5 m above ground:rh2m:short:-5:110
    -TCDC:surface:ncld:short:-5:110
    -LCDC:surface:ncld_low:short:-5:110
    -MCDC:surface:ncld_mid:short:-5:110
    -HCDC:surface:ncld_upper:short:-5:110
    -APCP:surface:r1h
    -# End of file
    -
    -
    -Using above file we could create the daily file with 3h analyses
    -at the 'surface' layers from the input grib2 files
    -with the next simple shell script:
    -
    -
    -date=20070715
    -for (( j=0; j<=21; j+=3 )) #hour of day loop
    -do
    -  if [ $j -lt  10 ]
    -  then
    -    h=0$j
    -  else
    -    h=$j
    -  fi
    -  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    -
    -  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    -  code=$?
    -  if [ $code -eq 0 ]
    -  then
    -    echo ${date}${h}': created/added to Netcdf'
    -  else
    -    echo ${date}${h}': wgrib2 failed...'
    -    exit $code
    -  fi
    -done
    -
    -
    -Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    -
    -gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    -
    -and change the name for the output file:
    -
    -./msm_s_${date}.nc to the ./msm_p_${date}.nc
    -
    -Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    -utility for data visualization and analyses.
    -
    - -

    Example 3

    - -In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, -convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf -option doesn't support appending, the netcdf conversion cannot be in a loop. - -
    -Version 1, using loops and a temporary file
    -
    -rm tempfile
    -for f in gfs.t00z.pgrb2f[01]?
    -do
    -   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    -done
    -wgrib2 tempfile -netcdf ~/myfile.nc
    -rm tempfile
    -
    -Version 2, data-flow 
    -
    -1:   cat gfs.t00z.pgrb2f[01]? | \
    -2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    -3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    -4:   wgrib2 - -netcdf ~/myfile.nc
    -
    -
    -Line 1 (cat), takes all the desired grib files and writes to stdout
    -Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    -Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    -Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    -
    -

    -See also: --bin, --ieee --text --spread - --append -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan. 27, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/nc_pack.html b/web_docs/nc_pack.html deleted file mode 100644 index d396341..0000000 --- a/web_docs/nc_pack.html +++ /dev/null @@ -1,552 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -netcdf - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end - -
     
    - -

    wgrib2: -netcdf

    -
    - -

    Introduction

    - -

    -The -netcdf option writes the grid values to a specified -file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator -and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic -projection grids. Other grid templates and projections are not supported yet. - -

    -Default the grid values are written as 4 bytes float having {TIME,LAT,LON} -dimension shape (3D data) and possible vertical LEV information added to the name of variables. -For example, V wind component defined at 10 m level in atmosphere will have default name -VGRD_10maboveground. -With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data -with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical -structure analysis etc. -

    -3D and 4D data could be mixed in the same netcdf file if both have the same horizontal -grid shapes. Practically any number of variables could be placed in to the single netcdf file -as well as time dimension can be almost arbitrary extended. For these purposes -please use the wgrib2 -append option. -All missing values in data are replaced by the _FillValue defined in wgrib2 as -9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. - - - -

    Simple usage

    -

    - -

    --netcdf file_name
    -
    - -

    Example 1

    -

    - -

    -$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    -
    -The above line converts the grib2 file into a netcdf file.
    -
    -
    - -

    Sub-options for -netcdf

    - -

    -Next sub-options could help to customize created netcdf file(s). -All sub-options must preceed the -netcdf option as it is the wgrib2 rule. -More then one -netcdf option could be given on the wgrib2 command line, -please read the documentation for wgrib2. -Almost all sub-options have -no_... version that annulates previous -assignment. -For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table -with the -nc_table sub-option or combine the command line options -with instructions in the -nc_table conversion file. - -

    -The -append option makes possible to create single -large data set for long time series of gridded data. Time dimension of data in the netcdf file -is "unlimited", it could be extended "forward" when adding new data but not "backward" before -the first defined time value. If data for the same time step already exist in the updated -netcdf file these will be silently overwritten. - -

    -The -nc_nlev option is needed to export data to netcdf -as 4D data defined in {TIME,LEV,LAT,LON} space. -It must be followed by integer max_number_of_vertical_levels -which defines the vertical dimension size of 4D data exported to the netcdf file. -This value can not be found from each single grib2 message or sub-message, -usually it has to be scanned the entire grib2 file or even number of files. -It is the reason why the max_number_of_vertical_levels -value must be provided by user. -

    -Grib2 types of vertical levels eligible for export to the netcdf as 4D data -are defined in the wgrib2 internal table and now include next types of GRIB2 levels: -

    -
    -
    20:K level -
    100:pressure level -
    104:sigma level -
    105:hybrid level -
    107:K isentropic level -
    160:ocean depth below sea level -
    -
    -

    -Data for the first found eligible level type are treated as 4D and vertical level -information is not added to the variable names. -Error is generetad if data for other then first found eligible level type -are met in the input stream. -Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space -with the possible level information included into the variable names or with the user-specified names -(see -nc_table option description below for how to do it). -

    -The -nc_nlev option has not -no_... option, -please use instead the max_number_of_vertical_levels equal to 0. -In this case all data from the input stream will be threated as 3D. -

    -When existing netcdf file is updated in the -append mode -the value of max_number_of_vertical_levels must not exceed -initial value provided when the netcdf file was first created (defined). -By default when first creating the netcdf file, vertical level values are not fixed -(are undefined) and these are defined one-by-one when data at new level are added -to the netcdf file, up to the max_number_of_vertical_levels. -To overcome this feature please use the -nc_table option. - -

    -The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is -default and do not assume data packing, only data range is checked. Data outside of -specified range are replaced by missing value code for all types of packing. -This replacement is done in the local copy of unpacked data, so main data array -stays unchanged. -Values of min and max could be any -signed float. Packing is applied to all new variables in the input stream. -If some variable was already defined in the netcdf file and now is appended to it -in the -append mode the initially defined and fixed in the netcdf file -valid range and packing parameters are used. -

    -The packing is possible to the short (2 bytes) -or byte (1 byte) values with potential loss of precision. -Both zero values of min and max -packing parameters for the short or -byte packing activate 'auto' packing when -min and max -values are defined from the first entered field. - -

    -PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file -is open with 'sdfopen' command. But by some reasons using the GrADS -data description file (catalog) for the same netcdf file helps in this situation. - -

    -The -nc_grads option activates some tests for the created -netcdf file to be GrADS (version 1.9b4) compatible, -or to be open by sdfopen in gradsnc or gradsdods. -The GrADS support only COARDS convention netcdf files; -it do not support non-constant data time stepping -and silently generates wrong time stamps for such netcdf files. -Packing to byte also is not directly recognized by GrADS v1.9b4. -With this option an error is raised and processing stops -if any of criterias above is determined. - -

    -The -nc_table option followed by the file_name is most usefull for the advanced users -as it specifies the file where user can customize many features of created netcdf file. -Next examples demonstrate which directives and conversion rules could be given -in the -nc_table file. -Almost all of them are optional with exception of $nlev for the case -when user explicitly specifies the vertical level values $levs. -

    -$lev_type 100:pressure:pressure level:mb:0.01 -

    This directive explicitly defines the type of vertical level -in the grib2 file that becomes eligible for treating data at these levels as 4D data -and some it attributes for netcdf file. -Default, first found level type listed in the wgrib2 build-in table -of eligible levels is selected if no $lev_type directive found. -

    Fields here include: -

    -
    -
    100-the grib2 level type code number -for treating data as 4D. In this example it is the code number for pressure levels, integer -
    pressure- -short_name for the vertical axis in the netcdf file, string -
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces -
    mb-vertical axis units as written in the netcdf file, string -
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file -
    -
    - -$nlev X -

    This directive is an equivalent of the -nc_nlev command line option -but value in the -nc_table file has precedence over the command line option if both are found. -It is required if next $levs directive is specified. -

    - -
    $levs lev(1) lev(2) lev(3)... -
    ...lev(I-1) lev(I) lev(I+1)... -
    ...lev(X-1) lev(X) -
    -

    -This directive explicitly specifies the vertical level values to be exported -to the netcdf file, in the netcdf units. -If this directive exists in the -nc_table file and there is found the grib2 data -eligible for the 4D presentation but defined on other then listed level - -these data are skipped from export and work is silently continued. -All data conversion parameters are checked before the $levs is checked. -List of level values could consist of multiple lines; -max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); -use space, ',', ';' or ':' as lev(i) fields separator. -

    -Impact of $nlev and $levs directives is different depending on -does the netcdf file is first created or it is updated. -When the netcdf file is first created these values are written -to the netcdf file fixing 4D data vertical structure. -When updating an existing netcdf file in the -append mode -these parameters will work like filter limiting possible -updates of 4D data by these that satisfy to the given $levs only and -ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. -

    -The $nlev and $levs directives could be necessary if records -in the grib2 file have randomly changing vertical level values -that makes it impossible sequentionally define valid order of vertical levels. - -

    -$grads 1 -

    This directive is an equivalent of the -nc_grads command line option -if passed value is 1 or to the -no_nc_grads if value is 0. -Directive in the -nc_table file has precedence over the command line option. - -

    -wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] -

    -All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' -are treated as grib2 to netcdf conversion rules for the specified variables. -In these strings the wgib2_name and wgrib2_level -are strings as returned by the wgrib2 inventory; -* used as the wgrib2_level will apply -to all levels not given explicitly. -The valid range and packing information is optional but it overwrites common -packing rule if such is specified by the -nc_pack command line option. -Absence of packing information means no packing for this variable. -Min and max values are any signed float values. Both could be omitted or put to zero. -Last case means that automatic scaling will be estimated from the first entered -wgib2_name field at the wgrib2_level -or at the first level in case of * as level value. -

    -If the keyword ignore is found as a netcdf variable name or -as a packing type value, the corresponding data are ignored -and do not written to the netcdf file. -Impact from this keyword is similar to the wgrib2 -not option -or filtering data with the grep utility. -

    -The ignore keyword is recommended if the data from the same -grib2 file are exported in number of output files (netcdf or other) -by the same wgrib2 process. Then the same decoded data could be passed -for the output in other file of any supported type. -Doing export to the single netcdf file it is not recommended to use the -ignore keyword -as corresponding data are first decoded and after that skipped from writing -to the netcdf file. -

    -In the next example two lines from the -nc_table file instruct -the wgrib2 utility export to the netcdf file the geopotential height changing name -from HGT (wgrib2) to -geopotential in the netcdf file, -at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: -

    -
    -HGT:*:geopotential
    -HGT:975 mb:ignore
    -
    -
    -All other variables not listed in the -nc_table file but found in the input stream -are processed as regular 3D data. - - -

    Example 2

    -

    -Next example shows the content of user-defined -nc_table file -for one special case of Japan Meteorological Agency MSM system grib2 data conversion. -Same -nc_table file includes the rules for -conversion of both 'surface' and upper air data although -the input grib2 files are different. - -

    -
    -#
    -# File name: jma_msm_g2nc.table
    -# Description: Specifies parameters for conversion to Netcdf format
    -# hourly analyses and forecasts of JMA MSM system as best suited to
    -# my purposes: forcing of ocean model and reference data for analysis
    -# of meteorological conditions with GrADS-based visualization tools.
    -# Sergey Varlamov, July 2007
    -#
    -$lev_type  100:p:pressure level:mb:0.01
    -$nlev      16
    -$levs  1000 975 950 925 900 850 800 700 600 500
    -        400 300 250 200 150 100
    -$grads 1
    -#
    -# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    -#
    -UGRD:*:u
    -VGRD:*:v
    -#UGRD:*:u:ignore
    -#VGRD:*:v:ignore
    -TMP:*:temp
    -#write HGT at any level as hgtprs:
    -HGT:*:hgtprs
    -#but skip HGT at 100 mb, now commented - example and test
    -#HGT:100 mb:hgtprs:ignore
    -RH:*:rh:short:-2:110
    -VVEL:*:omega
    -#
    -# JMA MSM model surface data conversion rules
    -#
    -PRMSL:mean sea level:prmsl
    -PRES:surface:prsfc
    -UGRD:10 m above ground:u10m
    -VGRD:10 m above ground:v10m
    -TMP:1.5 m above ground:t2m
    -RH:1.5 m above ground:rh2m:short:-5:110
    -TCDC:surface:ncld:short:-5:110
    -LCDC:surface:ncld_low:short:-5:110
    -MCDC:surface:ncld_mid:short:-5:110
    -HCDC:surface:ncld_upper:short:-5:110
    -APCP:surface:r1h
    -# End of file
    -
    -
    -Using above file we could create the daily file with 3h analyses
    -at the 'surface' layers from the input grib2 files
    -with the next simple shell script:
    -
    -
    -date=20070715
    -for (( j=0; j<=21; j+=3 )) #hour of day loop
    -do
    -  if [ $j -lt  10 ]
    -  then
    -    h=0$j
    -  else
    -    h=$j
    -  fi
    -  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    -
    -  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    -  code=$?
    -  if [ $code -eq 0 ]
    -  then
    -    echo ${date}${h}': created/added to Netcdf'
    -  else
    -    echo ${date}${h}': wgrib2 failed...'
    -    exit $code
    -  fi
    -done
    -
    -
    -Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    -
    -gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    -
    -and change the name for the output file:
    -
    -./msm_s_${date}.nc to the ./msm_p_${date}.nc
    -
    -Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    -utility for data visualization and analyses.
    -
    - -

    Example 3

    - -In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, -convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf -option doesn't support appending, the netcdf conversion cannot be in a loop. - -
    -Version 1, using loops and a temporary file
    -
    -rm tempfile
    -for f in gfs.t00z.pgrb2f[01]?
    -do
    -   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    -done
    -wgrib2 tempfile -netcdf ~/myfile.nc
    -rm tempfile
    -
    -Version 2, data-flow 
    -
    -1:   cat gfs.t00z.pgrb2f[01]? | \
    -2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    -3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    -4:   wgrib2 - -netcdf ~/myfile.nc
    -
    -
    -Line 1 (cat), takes all the desired grib files and writes to stdout
    -Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    -Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    -Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    -
    -

    -See also: --bin, --ieee --text --spread - --append -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan. 27, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/nc_table.html b/web_docs/nc_table.html deleted file mode 100644 index 3b9115a..0000000 --- a/web_docs/nc_table.html +++ /dev/null @@ -1,557 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -nc_table - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end - -
     
    - -

    wgrib2: -nc_table

    -
    - -

    Introduction

    -

    -The -nc_table option modifies how the --netcdf option works. Look at "Example 2" -for details on using -nc_table. - - -

    -The -netcdf option writes the grid values to a specified -file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator -and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic -projection grids. Other grid templates and projections are not supported yet. - -

    -Default the grid values are written as 4 bytes float having {TIME,LAT,LON} -dimension shape (3D data) and possible vertical LEV information added to the name of variables. -For example, V wind component defined at 10 m level in atmosphere will have default name -VGRD_10maboveground. -With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data -with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical -structure analysis etc. -

    -3D and 4D data could be mixed in the same netcdf file if both have the same horizontal -grid shapes. Practically any number of variables could be placed in to the single netcdf file -as well as time dimension can be almost arbitrary extended. For these purposes -please use the wgrib2 -append option. -All missing values in data are replaced by the _FillValue defined in wgrib2 as -9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. - - - -

    Simple usage

    -

    - -

    --netcdf file_name
    -
    - -

    Example 1

    -

    - -

    -$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    -
    -The above line converts the grib2 file into a netcdf file.
    -
    -
    - -

    Sub-options for -netcdf

    - -

    -Next sub-options could help to customize created netcdf file(s). -All sub-options must preceed the -netcdf option as it is the wgrib2 rule. -More then one -netcdf option could be given on the wgrib2 command line, -please read the documentation for wgrib2. -Almost all sub-options have -no_... version that annulates previous -assignment. -For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table -with the -nc_table sub-option or combine the command line options -with instructions in the -nc_table conversion file. - -

    -The -append option makes possible to create single -large data set for long time series of gridded data. Time dimension of data in the netcdf file -is "unlimited", it could be extended "forward" when adding new data but not "backward" before -the first defined time value. If data for the same time step already exist in the updated -netcdf file these will be silently overwritten. - -

    -The -nc_nlev option is needed to export data to netcdf -as 4D data defined in {TIME,LEV,LAT,LON} space. -It must be followed by integer max_number_of_vertical_levels -which defines the vertical dimension size of 4D data exported to the netcdf file. -This value can not be found from each single grib2 message or sub-message, -usually it has to be scanned the entire grib2 file or even number of files. -It is the reason why the max_number_of_vertical_levels -value must be provided by user. -

    -Grib2 types of vertical levels eligible for export to the netcdf as 4D data -are defined in the wgrib2 internal table and now include next types of GRIB2 levels: -

    -
    -
    20:K level -
    100:pressure level -
    104:sigma level -
    105:hybrid level -
    107:K isentropic level -
    160:ocean depth below sea level -
    -
    -

    -Data for the first found eligible level type are treated as 4D and vertical level -information is not added to the variable names. -Error is generetad if data for other then first found eligible level type -are met in the input stream. -Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space -with the possible level information included into the variable names or with the user-specified names -(see -nc_table option description below for how to do it). -

    -The -nc_nlev option has not -no_... option, -please use instead the max_number_of_vertical_levels equal to 0. -In this case all data from the input stream will be threated as 3D. -

    -When existing netcdf file is updated in the -append mode -the value of max_number_of_vertical_levels must not exceed -initial value provided when the netcdf file was first created (defined). -By default when first creating the netcdf file, vertical level values are not fixed -(are undefined) and these are defined one-by-one when data at new level are added -to the netcdf file, up to the max_number_of_vertical_levels. -To overcome this feature please use the -nc_table option. - -

    -The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is -default and do not assume data packing, only data range is checked. Data outside of -specified range are replaced by missing value code for all types of packing. -This replacement is done in the local copy of unpacked data, so main data array -stays unchanged. -Values of min and max could be any -signed float. Packing is applied to all new variables in the input stream. -If some variable was already defined in the netcdf file and now is appended to it -in the -append mode the initially defined and fixed in the netcdf file -valid range and packing parameters are used. -

    -The packing is possible to the short (2 bytes) -or byte (1 byte) values with potential loss of precision. -Both zero values of min and max -packing parameters for the short or -byte packing activate 'auto' packing when -min and max -values are defined from the first entered field. - -

    -PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file -is open with 'sdfopen' command. But by some reasons using the GrADS -data description file (catalog) for the same netcdf file helps in this situation. - -

    -The -nc_grads option activates some tests for the created -netcdf file to be GrADS (version 1.9b4) compatible, -or to be open by sdfopen in gradsnc or gradsdods. -The GrADS support only COARDS convention netcdf files; -it do not support non-constant data time stepping -and silently generates wrong time stamps for such netcdf files. -Packing to byte also is not directly recognized by GrADS v1.9b4. -With this option an error is raised and processing stops -if any of criterias above is determined. - -

    -The -nc_table option followed by the file_name is most usefull for the advanced users -as it specifies the file where user can customize many features of created netcdf file. -Next examples demonstrate which directives and conversion rules could be given -in the -nc_table file. -Almost all of them are optional with exception of $nlev for the case -when user explicitly specifies the vertical level values $levs. -

    -$lev_type 100:pressure:pressure level:mb:0.01 -

    This directive explicitly defines the type of vertical level -in the grib2 file that becomes eligible for treating data at these levels as 4D data -and some it attributes for netcdf file. -Default, first found level type listed in the wgrib2 build-in table -of eligible levels is selected if no $lev_type directive found. -

    Fields here include: -

    -
    -
    100-the grib2 level type code number -for treating data as 4D. In this example it is the code number for pressure levels, integer -
    pressure- -short_name for the vertical axis in the netcdf file, string -
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces -
    mb-vertical axis units as written in the netcdf file, string -
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file -
    -
    - -$nlev X -

    This directive is an equivalent of the -nc_nlev command line option -but value in the -nc_table file has precedence over the command line option if both are found. -It is required if next $levs directive is specified. -

    - -
    $levs lev(1) lev(2) lev(3)... -
    ...lev(I-1) lev(I) lev(I+1)... -
    ...lev(X-1) lev(X) -
    -

    -This directive explicitly specifies the vertical level values to be exported -to the netcdf file, in the netcdf units. -If this directive exists in the -nc_table file and there is found the grib2 data -eligible for the 4D presentation but defined on other then listed level - -these data are skipped from export and work is silently continued. -All data conversion parameters are checked before the $levs is checked. -List of level values could consist of multiple lines; -max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); -use space, ',', ';' or ':' as lev(i) fields separator. -

    -Impact of $nlev and $levs directives is different depending on -does the netcdf file is first created or it is updated. -When the netcdf file is first created these values are written -to the netcdf file fixing 4D data vertical structure. -When updating an existing netcdf file in the -append mode -these parameters will work like filter limiting possible -updates of 4D data by these that satisfy to the given $levs only and -ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. -

    -The $nlev and $levs directives could be necessary if records -in the grib2 file have randomly changing vertical level values -that makes it impossible sequentionally define valid order of vertical levels. - -

    -$grads 1 -

    This directive is an equivalent of the -nc_grads command line option -if passed value is 1 or to the -no_nc_grads if value is 0. -Directive in the -nc_table file has precedence over the command line option. - -

    -wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] -

    -All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' -are treated as grib2 to netcdf conversion rules for the specified variables. -In these strings the wgib2_name and wgrib2_level -are strings as returned by the wgrib2 inventory; -* used as the wgrib2_level will apply -to all levels not given explicitly. -The valid range and packing information is optional but it overwrites common -packing rule if such is specified by the -nc_pack command line option. -Absence of packing information means no packing for this variable. -Min and max values are any signed float values. Both could be omitted or put to zero. -Last case means that automatic scaling will be estimated from the first entered -wgib2_name field at the wgrib2_level -or at the first level in case of * as level value. -

    -If the keyword ignore is found as a netcdf variable name or -as a packing type value, the corresponding data are ignored -and do not written to the netcdf file. -Impact from this keyword is similar to the wgrib2 -not option -or filtering data with the grep utility. -

    -The ignore keyword is recommended if the data from the same -grib2 file are exported in number of output files (netcdf or other) -by the same wgrib2 process. Then the same decoded data could be passed -for the output in other file of any supported type. -Doing export to the single netcdf file it is not recommended to use the -ignore keyword -as corresponding data are first decoded and after that skipped from writing -to the netcdf file. -

    -In the next example two lines from the -nc_table file instruct -the wgrib2 utility export to the netcdf file the geopotential height changing name -from HGT (wgrib2) to -geopotential in the netcdf file, -at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: -

    -
    -HGT:*:geopotential
    -HGT:975 mb:ignore
    -
    -
    -All other variables not listed in the -nc_table file but found in the input stream -are processed as regular 3D data. - - -

    Example 2

    -

    -Next example shows the content of user-defined -nc_table file -for one special case of Japan Meteorological Agency MSM system grib2 data conversion. -Same -nc_table file includes the rules for -conversion of both 'surface' and upper air data although -the input grib2 files are different. - -

    -
    -#
    -# File name: jma_msm_g2nc.table
    -# Description: Specifies parameters for conversion to Netcdf format
    -# hourly analyses and forecasts of JMA MSM system as best suited to
    -# my purposes: forcing of ocean model and reference data for analysis
    -# of meteorological conditions with GrADS-based visualization tools.
    -# Sergey Varlamov, July 2007
    -#
    -$lev_type  100:p:pressure level:mb:0.01
    -$nlev      16
    -$levs  1000 975 950 925 900 850 800 700 600 500
    -        400 300 250 200 150 100
    -$grads 1
    -#
    -# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    -#
    -UGRD:*:u
    -VGRD:*:v
    -#UGRD:*:u:ignore
    -#VGRD:*:v:ignore
    -TMP:*:temp
    -#write HGT at any level as hgtprs:
    -HGT:*:hgtprs
    -#but skip HGT at 100 mb, now commented - example and test
    -#HGT:100 mb:hgtprs:ignore
    -RH:*:rh:short:-2:110
    -VVEL:*:omega
    -#
    -# JMA MSM model surface data conversion rules
    -#
    -PRMSL:mean sea level:prmsl
    -PRES:surface:prsfc
    -UGRD:10 m above ground:u10m
    -VGRD:10 m above ground:v10m
    -TMP:1.5 m above ground:t2m
    -RH:1.5 m above ground:rh2m:short:-5:110
    -TCDC:surface:ncld:short:-5:110
    -LCDC:surface:ncld_low:short:-5:110
    -MCDC:surface:ncld_mid:short:-5:110
    -HCDC:surface:ncld_upper:short:-5:110
    -APCP:surface:r1h
    -# End of file
    -
    -
    -Using above file we could create the daily file with 3h analyses
    -at the 'surface' layers from the input grib2 files
    -with the next simple shell script:
    -
    -
    -date=20070715
    -for (( j=0; j<=21; j+=3 )) #hour of day loop
    -do
    -  if [ $j -lt  10 ]
    -  then
    -    h=0$j
    -  else
    -    h=$j
    -  fi
    -  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    -
    -  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    -  code=$?
    -  if [ $code -eq 0 ]
    -  then
    -    echo ${date}${h}': created/added to Netcdf'
    -  else
    -    echo ${date}${h}': wgrib2 failed...'
    -    exit $code
    -  fi
    -done
    -
    -
    -Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    -
    -gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    -
    -and change the name for the output file:
    -
    -./msm_s_${date}.nc to the ./msm_p_${date}.nc
    -
    -Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    -utility for data visualization and analyses.
    -
    - -

    Example 3

    - -In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, -convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf -option doesn't support appending, the netcdf conversion cannot be in a loop. - -
    -Version 1, using loops and a temporary file
    -
    -rm tempfile
    -for f in gfs.t00z.pgrb2f[01]?
    -do
    -   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    -done
    -wgrib2 tempfile -netcdf ~/myfile.nc
    -rm tempfile
    -
    -Version 2, data-flow 
    -
    -1:   cat gfs.t00z.pgrb2f[01]? | \
    -2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    -3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    -4:   wgrib2 - -netcdf ~/myfile.nc
    -
    -
    -Line 1 (cat), takes all the desired grib files and writes to stdout
    -Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    -Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    -Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    -
    -

    -See also: --bin, --ieee --text --spread - --append -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan. 27, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/nc_time.html b/web_docs/nc_time.html deleted file mode 100644 index d396341..0000000 --- a/web_docs/nc_time.html +++ /dev/null @@ -1,552 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -netcdf - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end - -
     
    - -

    wgrib2: -netcdf

    -
    - -

    Introduction

    - -

    -The -netcdf option writes the grid values to a specified -file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator -and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic -projection grids. Other grid templates and projections are not supported yet. - -

    -Default the grid values are written as 4 bytes float having {TIME,LAT,LON} -dimension shape (3D data) and possible vertical LEV information added to the name of variables. -For example, V wind component defined at 10 m level in atmosphere will have default name -VGRD_10maboveground. -With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data -with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical -structure analysis etc. -

    -3D and 4D data could be mixed in the same netcdf file if both have the same horizontal -grid shapes. Practically any number of variables could be placed in to the single netcdf file -as well as time dimension can be almost arbitrary extended. For these purposes -please use the wgrib2 -append option. -All missing values in data are replaced by the _FillValue defined in wgrib2 as -9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. - - - -

    Simple usage

    -

    - -

    --netcdf file_name
    -
    - -

    Example 1

    -

    - -

    -$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    -
    -The above line converts the grib2 file into a netcdf file.
    -
    -
    - -

    Sub-options for -netcdf

    - -

    -Next sub-options could help to customize created netcdf file(s). -All sub-options must preceed the -netcdf option as it is the wgrib2 rule. -More then one -netcdf option could be given on the wgrib2 command line, -please read the documentation for wgrib2. -Almost all sub-options have -no_... version that annulates previous -assignment. -For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table -with the -nc_table sub-option or combine the command line options -with instructions in the -nc_table conversion file. - -

    -The -append option makes possible to create single -large data set for long time series of gridded data. Time dimension of data in the netcdf file -is "unlimited", it could be extended "forward" when adding new data but not "backward" before -the first defined time value. If data for the same time step already exist in the updated -netcdf file these will be silently overwritten. - -

    -The -nc_nlev option is needed to export data to netcdf -as 4D data defined in {TIME,LEV,LAT,LON} space. -It must be followed by integer max_number_of_vertical_levels -which defines the vertical dimension size of 4D data exported to the netcdf file. -This value can not be found from each single grib2 message or sub-message, -usually it has to be scanned the entire grib2 file or even number of files. -It is the reason why the max_number_of_vertical_levels -value must be provided by user. -

    -Grib2 types of vertical levels eligible for export to the netcdf as 4D data -are defined in the wgrib2 internal table and now include next types of GRIB2 levels: -

    -
    -
    20:K level -
    100:pressure level -
    104:sigma level -
    105:hybrid level -
    107:K isentropic level -
    160:ocean depth below sea level -
    -
    -

    -Data for the first found eligible level type are treated as 4D and vertical level -information is not added to the variable names. -Error is generetad if data for other then first found eligible level type -are met in the input stream. -Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space -with the possible level information included into the variable names or with the user-specified names -(see -nc_table option description below for how to do it). -

    -The -nc_nlev option has not -no_... option, -please use instead the max_number_of_vertical_levels equal to 0. -In this case all data from the input stream will be threated as 3D. -

    -When existing netcdf file is updated in the -append mode -the value of max_number_of_vertical_levels must not exceed -initial value provided when the netcdf file was first created (defined). -By default when first creating the netcdf file, vertical level values are not fixed -(are undefined) and these are defined one-by-one when data at new level are added -to the netcdf file, up to the max_number_of_vertical_levels. -To overcome this feature please use the -nc_table option. - -

    -The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is -default and do not assume data packing, only data range is checked. Data outside of -specified range are replaced by missing value code for all types of packing. -This replacement is done in the local copy of unpacked data, so main data array -stays unchanged. -Values of min and max could be any -signed float. Packing is applied to all new variables in the input stream. -If some variable was already defined in the netcdf file and now is appended to it -in the -append mode the initially defined and fixed in the netcdf file -valid range and packing parameters are used. -

    -The packing is possible to the short (2 bytes) -or byte (1 byte) values with potential loss of precision. -Both zero values of min and max -packing parameters for the short or -byte packing activate 'auto' packing when -min and max -values are defined from the first entered field. - -

    -PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file -is open with 'sdfopen' command. But by some reasons using the GrADS -data description file (catalog) for the same netcdf file helps in this situation. - -

    -The -nc_grads option activates some tests for the created -netcdf file to be GrADS (version 1.9b4) compatible, -or to be open by sdfopen in gradsnc or gradsdods. -The GrADS support only COARDS convention netcdf files; -it do not support non-constant data time stepping -and silently generates wrong time stamps for such netcdf files. -Packing to byte also is not directly recognized by GrADS v1.9b4. -With this option an error is raised and processing stops -if any of criterias above is determined. - -

    -The -nc_table option followed by the file_name is most usefull for the advanced users -as it specifies the file where user can customize many features of created netcdf file. -Next examples demonstrate which directives and conversion rules could be given -in the -nc_table file. -Almost all of them are optional with exception of $nlev for the case -when user explicitly specifies the vertical level values $levs. -

    -$lev_type 100:pressure:pressure level:mb:0.01 -

    This directive explicitly defines the type of vertical level -in the grib2 file that becomes eligible for treating data at these levels as 4D data -and some it attributes for netcdf file. -Default, first found level type listed in the wgrib2 build-in table -of eligible levels is selected if no $lev_type directive found. -

    Fields here include: -

    -
    -
    100-the grib2 level type code number -for treating data as 4D. In this example it is the code number for pressure levels, integer -
    pressure- -short_name for the vertical axis in the netcdf file, string -
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces -
    mb-vertical axis units as written in the netcdf file, string -
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file -
    -
    - -$nlev X -

    This directive is an equivalent of the -nc_nlev command line option -but value in the -nc_table file has precedence over the command line option if both are found. -It is required if next $levs directive is specified. -

    - -
    $levs lev(1) lev(2) lev(3)... -
    ...lev(I-1) lev(I) lev(I+1)... -
    ...lev(X-1) lev(X) -
    -

    -This directive explicitly specifies the vertical level values to be exported -to the netcdf file, in the netcdf units. -If this directive exists in the -nc_table file and there is found the grib2 data -eligible for the 4D presentation but defined on other then listed level - -these data are skipped from export and work is silently continued. -All data conversion parameters are checked before the $levs is checked. -List of level values could consist of multiple lines; -max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); -use space, ',', ';' or ':' as lev(i) fields separator. -

    -Impact of $nlev and $levs directives is different depending on -does the netcdf file is first created or it is updated. -When the netcdf file is first created these values are written -to the netcdf file fixing 4D data vertical structure. -When updating an existing netcdf file in the -append mode -these parameters will work like filter limiting possible -updates of 4D data by these that satisfy to the given $levs only and -ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. -

    -The $nlev and $levs directives could be necessary if records -in the grib2 file have randomly changing vertical level values -that makes it impossible sequentionally define valid order of vertical levels. - -

    -$grads 1 -

    This directive is an equivalent of the -nc_grads command line option -if passed value is 1 or to the -no_nc_grads if value is 0. -Directive in the -nc_table file has precedence over the command line option. - -

    -wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] -

    -All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' -are treated as grib2 to netcdf conversion rules for the specified variables. -In these strings the wgib2_name and wgrib2_level -are strings as returned by the wgrib2 inventory; -* used as the wgrib2_level will apply -to all levels not given explicitly. -The valid range and packing information is optional but it overwrites common -packing rule if such is specified by the -nc_pack command line option. -Absence of packing information means no packing for this variable. -Min and max values are any signed float values. Both could be omitted or put to zero. -Last case means that automatic scaling will be estimated from the first entered -wgib2_name field at the wgrib2_level -or at the first level in case of * as level value. -

    -If the keyword ignore is found as a netcdf variable name or -as a packing type value, the corresponding data are ignored -and do not written to the netcdf file. -Impact from this keyword is similar to the wgrib2 -not option -or filtering data with the grep utility. -

    -The ignore keyword is recommended if the data from the same -grib2 file are exported in number of output files (netcdf or other) -by the same wgrib2 process. Then the same decoded data could be passed -for the output in other file of any supported type. -Doing export to the single netcdf file it is not recommended to use the -ignore keyword -as corresponding data are first decoded and after that skipped from writing -to the netcdf file. -

    -In the next example two lines from the -nc_table file instruct -the wgrib2 utility export to the netcdf file the geopotential height changing name -from HGT (wgrib2) to -geopotential in the netcdf file, -at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: -

    -
    -HGT:*:geopotential
    -HGT:975 mb:ignore
    -
    -
    -All other variables not listed in the -nc_table file but found in the input stream -are processed as regular 3D data. - - -

    Example 2

    -

    -Next example shows the content of user-defined -nc_table file -for one special case of Japan Meteorological Agency MSM system grib2 data conversion. -Same -nc_table file includes the rules for -conversion of both 'surface' and upper air data although -the input grib2 files are different. - -

    -
    -#
    -# File name: jma_msm_g2nc.table
    -# Description: Specifies parameters for conversion to Netcdf format
    -# hourly analyses and forecasts of JMA MSM system as best suited to
    -# my purposes: forcing of ocean model and reference data for analysis
    -# of meteorological conditions with GrADS-based visualization tools.
    -# Sergey Varlamov, July 2007
    -#
    -$lev_type  100:p:pressure level:mb:0.01
    -$nlev      16
    -$levs  1000 975 950 925 900 850 800 700 600 500
    -        400 300 250 200 150 100
    -$grads 1
    -#
    -# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    -#
    -UGRD:*:u
    -VGRD:*:v
    -#UGRD:*:u:ignore
    -#VGRD:*:v:ignore
    -TMP:*:temp
    -#write HGT at any level as hgtprs:
    -HGT:*:hgtprs
    -#but skip HGT at 100 mb, now commented - example and test
    -#HGT:100 mb:hgtprs:ignore
    -RH:*:rh:short:-2:110
    -VVEL:*:omega
    -#
    -# JMA MSM model surface data conversion rules
    -#
    -PRMSL:mean sea level:prmsl
    -PRES:surface:prsfc
    -UGRD:10 m above ground:u10m
    -VGRD:10 m above ground:v10m
    -TMP:1.5 m above ground:t2m
    -RH:1.5 m above ground:rh2m:short:-5:110
    -TCDC:surface:ncld:short:-5:110
    -LCDC:surface:ncld_low:short:-5:110
    -MCDC:surface:ncld_mid:short:-5:110
    -HCDC:surface:ncld_upper:short:-5:110
    -APCP:surface:r1h
    -# End of file
    -
    -
    -Using above file we could create the daily file with 3h analyses
    -at the 'surface' layers from the input grib2 files
    -with the next simple shell script:
    -
    -
    -date=20070715
    -for (( j=0; j<=21; j+=3 )) #hour of day loop
    -do
    -  if [ $j -lt  10 ]
    -  then
    -    h=0$j
    -  else
    -    h=$j
    -  fi
    -  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    -
    -  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    -  code=$?
    -  if [ $code -eq 0 ]
    -  then
    -    echo ${date}${h}': created/added to Netcdf'
    -  else
    -    echo ${date}${h}': wgrib2 failed...'
    -    exit $code
    -  fi
    -done
    -
    -
    -Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    -
    -gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    -
    -and change the name for the output file:
    -
    -./msm_s_${date}.nc to the ./msm_p_${date}.nc
    -
    -Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    -utility for data visualization and analyses.
    -
    - -

    Example 3

    - -In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, -convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf -option doesn't support appending, the netcdf conversion cannot be in a loop. - -
    -Version 1, using loops and a temporary file
    -
    -rm tempfile
    -for f in gfs.t00z.pgrb2f[01]?
    -do
    -   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    -done
    -wgrib2 tempfile -netcdf ~/myfile.nc
    -rm tempfile
    -
    -Version 2, data-flow 
    -
    -1:   cat gfs.t00z.pgrb2f[01]? | \
    -2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    -3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    -4:   wgrib2 - -netcdf ~/myfile.nc
    -
    -
    -Line 1 (cat), takes all the desired grib files and writes to stdout
    -Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    -Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    -Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    -
    -

    -See also: --bin, --ieee --text --spread - --append -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan. 27, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ncep_norm.html b/web_docs/ncep_norm.html deleted file mode 100644 index 1e12ab8..0000000 --- a/web_docs/ncep_norm.html +++ /dev/null @@ -1,303 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ncep_norm - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ncep_norm -
     
    - -

    wgrib2: -ncep_norm

    -
    - - -

    Introduction

    - -

    -The GFS model, for example, produces precipitation with a -hard-to-use time step. If you gathered the precip forecasts -from the GFS, it would look like, - -

    -$ wgrib2 apcp.grb
    -1:0:d=2009042400:APCP:surface:0-3 hour acc fcst:
    -2:3340:d=2009042400:APCP:surface:0-6 hour acc fcst:
    -3:5534:d=2009042400:APCP:surface:6-9 hour acc fcst:
    -4:7239:d=2009042400:APCP:surface:6-12 hour acc fcst:
    -5:9304:d=2009042400:APCP:surface:12-15 hour acc fcst:
    -6:12378:d=2009042400:APCP:surface:12-18 hour acc fcst:
    -
    - -If you obtained the 6 hourly forecasts, everthing would be -quite useful. But if you obtained the 3 hourly forecasts, you -would notice the averaging period is either 3 or 6 hours. To -create 3-hour accumulations, you can use the --ncep_norm option. - -
    -$ wgrib2 apcp.grb -ncep_norm new_apcp.grb
    -1:0:d=2009042400:APCP:surface:0-3 hour acc fcst:
    -2:3340:d=2009042400:APCP:surface:0-6 hour acc fcst:
    -3:5534:d=2009042400:APCP:surface:6-9 hour acc fcst:
    -4:7239:d=2009042400:APCP:surface:6-12 hour acc fcst:
    -5:9304:d=2009042400:APCP:surface:12-15 hour acc fcst:
    -6:12378:d=2009042400:APCP:surface:12-18 hour acc fcst:
    -7:14396:d=2009042400:APCP:surface:18-21 hour acc fcst:
    -$
    -$ wgrib2 new_apcp.grb
    -1:0:d=2009042400:APCP:surface:0-3 hour acc fcst:
    -2:7769:d=2009042400:APCP:surface:3-6 hour acc fcst:
    -3:13271:d=2009042400:APCP:surface:6-9 hour acc fcst:
    -4:18773:d=2009042400:APCP:surface:9-12 hour acc fcst:
    -5:24275:d=2009042400:APCP:surface:12-15 hour acc fcst:
    -6:32044:d=2009042400:APCP:surface:15-18 hour acc fcst:
    -7:38301:d=2009042400:APCP:surface:18-21 hour acc fcst:
    -
    - -

    The -ncep_norm option is not limited -to 3 hour intervals. It can be used with the CFSv2 which has -1 hour intervals. Some restrictions are: - -

      -
    1. time units of forecast time and statistical processing must be the same -
    2. only works with averages and accumulations (Code Table 4.10) -
    3. the grid must be the same -
    4. the meta-data must be the same except for the forecast timing. -
    5. Does not work for CRAIN, CSNOW, CICEP, CFRZR -
    - - -

    Usage

    -

    - -

    --ncep_norm output_file
    -
    - -

    Conditions

    -

    -The input grib file must have a very specific format. -Each field must be grouped together in time series format. -That is because the program scans the file in sequential order. -Of course, you can alter the order by the -i -option. For example, - -

    -$ wgrib2 -match ':APCP:' mixed_up -vt | sort -t: -k3,3 | \
    -   wgrib2 -i mixed_up -ncep_norm new_apcp.grb
    -1:0:d=2009042400:APCP:surface:0-0 day acc fcst:
    -6:26940:d=2009042400:APCP:surface:0-3 hour acc fcst:
    -11:56805:d=2009042400:APCP:surface:0-6 hour acc fcst:
    -16:85235:d=2009042400:APCP:surface:6-9 hour acc fcst:
    -51:281962:d=2009042400:APCP:surface:6-12 hour acc fcst:
    -61:338477:d=2009042400:APCP:surface:12-15 hour acc fcst:
    -66:367933:d=2009042400:APCP:surface:12-18 hour acc fcst:
    -71:396448:d=2009042400:APCP:surface:18-21 hour acc fcst:
    -...
    -$ wgrib2 new_apcp.grb
    -1:0:d=2009042400:APCP:surface:0-3 hour acc fcst:
    -2:7769:d=2009042400:APCP:surface:3-6 hour acc fcst:
    -3:13271:d=2009042400:APCP:surface:6-9 hour acc fcst:
    -4:18773:d=2009042400:APCP:surface:9-12 hour acc fcst:
    -5:24275:d=2009042400:APCP:surface:12-15 hour acc fcst:
    -6:32044:d=2009042400:APCP:surface:15-18 hour acc fcst:
    -7:38301:d=2009042400:APCP:surface:18-21 hour acc fcst:
    -...
    -
    - -

    Using GFS forecast files

    -

    -The typical GFS forecast file has a name like, -

    -GFS:
    -    gfs.t(HH)z.(type).(resolution).f(fhour)
    -
    -    gfs.t06z.pgrb2b.0p25.f006
    -    gfs.t18z.pgrb2.0p25.f006
    -
    -So to get the "normalized" APCP, you can do - -
    -   $ test.sh
    -
    -where test.sh is
    -
    -#!/bin/sh
    -#
    -# example of calculating GFS APCP for custom periods
    -#  want 06-09, 09-12, 12-15, 15-24, 24-48 hours
    -#  need the 06, 09, 12, 15, 24 and 48 hour forecasts
    -#
    -# the output iis in apcp.grb
    -# the calculated APCP fields may have a small negative because of
    -# finite precision is used
    -
    -dir=/gpfs/dell1/nco/ops/com/gfs/prod/gfs.20211212/00/atmos/
    -
    -cat $dir/gfs.t00z.pgrb2.0p25.f006 $dir/gfs.t00z.pgrb2.0p25.f009 \
    -      $dir/gfs.t00z.pgrb2.0p25.f012 $dir/gfs.t00z.pgrb2.0p25.f015 \
    -      $dir/gfs.t00z.pgrb2.0p25.f024 $dir/gfs.t00z.pgrb2.0p25.f048 | \
    -wgrib2 - -match ":APCP:" -match ":0-[0-9]* [a-z]* acc fcst:" -set_grib_type c1 -ncep_norm apcp.grb
    -
    -
    -The above script uses several techniques to speed up the processing.
    -
    -"cat (list of files)"   This writes the grib files to stdout.  This avoids a temporary disk file.
    -
    -"wgrib2 -"   This reads the grib file from stdin
    -
    -"-match "(regex)"    This avoids decoding grib messages that do not match 
    -             the regular expression
    -
    - - -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Feb 20, 2018, 12/2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ncep_uv.html b/web_docs/ncep_uv.html deleted file mode 100644 index 8ee8714..0000000 --- a/web_docs/ncep_uv.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lon - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ncep_uv -
     
    - -

    wgrib2: -ncep_uv

    -
    - - -

    Introduction

    - -

    -Operatinal NCEP grib files often have the U and corresponding V fields in the same grib message. -(U and V are submessages.) Typically wgrib2 converts all the submessages into individual messages. -In order to combine the U and V fields together, you replace the -grib option -with -ncep_uv. Options like --grib_out and -new_grid do not have the capability -to combine the U and V fields. For theses cases, you run the output through wgrib2. - -Note that -ncep_uv is more like -grib than --grib_out. The option --ncep_uv uses the compressed grid point values from the original file. -Neither the grid point values nor the packing is changed. - - -

    Usage

    -

    - -

    --ncep_uv output_file
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -match ":500 mb:" -ncep_uv output.grb
    -
    -$ wgrib2 test.grb2 -inv /dev/null -new_grid_winds earth -new_grid ncep grid 221 - | wgrib2 - -ncep_uv output.grb
    -

    -In the above example, the first wgrib2 regrids the file and writes it into stdout. -The second wgrib2 reads the new grib file from stdout and combines the U and V -records together into one message. - -

    - -See also: --tosubmsg --submsg --submsg_uv --grib --grib_out --GRIB -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Oct 3, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ncpu.html b/web_docs/ncpu.html deleted file mode 100644 index 336e1dd..0000000 --- a/web_docs/ncpu.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ncpu - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -ncpu -
     
    - -

    wgrib2: -ncpu

    -
    - - -

    The number of threads

    - -

    -Wgrib2 can be compiled to use multiple threads. By -default, an OpenMP-enabled version of wgrib2 will use the environement -variable OMP_NUM_THREADS to control the number of threads. -If the environment variable OMP_NUM_THREADS is not -defined, the number of threads created is usually the same as the number -of cores. The -ncpu option controls the number of threads -that will be used by wgrib2. If wgrib2 is not compiled to use OpenMP, this -option is quietly ignored. The -ncpu option overrides -the OMP_NUM_THREADS environment variable. - -

    -When you run an OpenMP-enabled wgrib2 version on a shared system, the -performance may be suboptimal if you use too many threads. For example, on one of -our linux systems, we have 32 cores. The system is shared by many users and -during a busy time, there may only be a few cores free at any one time. When -using 32 threads, there is often a thread that doesn't get much time in the beginning -and is slow to finish. - -

    -The main usage of the -ncpu option is to allocate -threads/cpus when you are running multiple copies of wgrib2. - - -

    Usage

    -

    -

    --ncpu N
    -  N = number of threads
    -
    - -

    Example

    -
    -   $ wgrib2 IN.grb -ncpu 3 -new_grid_winds grid -new_grid ncep grid 221 - | wgrib2 - -ncpu 1 -set_grib_type j -ncep_uv OUT.grb
    -
    -

    -The above line uses 3 threads for regridding and one thread for jpeg2000 compression. The jpeg2000 -compression routines can't take advantage of more than one thread. -

    -See also: -about openmp, - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 10, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ndate.html b/web_docs/ndate.html deleted file mode 100644 index e035ab6..0000000 --- a/web_docs/ndate.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ndate - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ndate -
     
    - -

    wgrib2: -ndate (v2.0.8)

    -
    - - -

    Introduction

    - -

    -The NCEP utility, ndate, will add or subtract hours from a date code. -Wgrib2 already has routines to do these calculations. So instead of -porting the ndate fortran code and the NCEP libraries, how about -a simple-to-write option that would allow wgrib2 to do the same -calculation (and more)? In my case, installing wgrib2 is a probably a given. -So adding -ndate saves me time. - - -

    -The ndate utility allows you to add or subtract a integer number of hours -from a YYYYMMDDHH date code, -The -ndate option allows you to add or -subtract an integer number of minutes, hours, days, months or years from -a date code. The output format has the precision necessary for the input date code -and offset. Sure you could do all this with the gnu date program but -the -ndate option is easier to use. - -

    -The feature of the ndate utility that is not in wgrib2, is the ability -to print the current UTC date code when there is no argument. Of course, you -can do the same by "date -u +%Y%m%d%H". For users of the ndate utility, note that -the order of arguments are reversed between the utility and wgrib2 option. - -

    -The -ndate option is an odd -option because it does its output in the initialization phase. -In order to to trigger an "missing input file" error, you need -to run wgrib2 on a valid file. For linux/unix systems, using -the file /dev/null is a convenient, always present file. - -

    Usage

    -

    - -

    --ndate DATE OFFSET
    -       DATE = YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm, YYYYMMDDHHmmss
    -       OFFSET=(integer)(yr|mo|dy|hr|mn)
    -                integer can be positive or negative
    -                yr = year  (0000..9999)
    -                mo = month (01..12)
    -                dy = day   (01..31)
    -                hr = hour  (00..23)
    -                mn = minute (not to be confused with month)  (00..59)
    -
    -      The output format has the precision to reflects the maximum precision of 
    -      the date code and the offset
    -
    -     Priority of the output format of the date code
    -   output date code: YYYYMMDDHHmmss      if input date code is YYYYMMDDHHmmss
    -   output date code: YYYYMMDDHHmm        if input date code is YYYYMMDDHHmm   or OFFSET is in minutes (mn)
    -   output date code: YYYYMMDDHH          if input date code is YYYYMMDDHH     or OFFSET is in hours (hr)
    -   output date code: YYYYMMDD            if input date code is YYYYMMDD       or OFFSET is in days (dy)
    -   output date code: YYYYMM              if input date code is YYYYMM         or OFFSET is in months (mo)
    -   output date code: YYYY                if input date code is YYYY           or OFFSET is in years (yr)
    -
    - -

    Example

    -

    - -

    -$ wgrib2 /dev/null -ndate  2016010212 -6hr
    -2016010206
    -
    - -

    -See also: -ndates -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Feb 1, 2019 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ndates.html b/web_docs/ndates.html deleted file mode 100644 index 33c2821..0000000 --- a/web_docs/ndates.html +++ /dev/null @@ -1,389 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ndates - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ndates -
     
    - -

    wgrib2: -ndates

    -
    - - -

    Introduction

    - -

    -The -ndates option creates a list of date codes -using a do-loop syntax. This option has nothing to do with grib, but -adding it to wgrib2 was trivial, and this option has been so helpful -in scripting. Anyways, if a Swiss army knife can have a -bottle opener, wgrib2 can have a date code routine. Anyways one less -program to port is helpful. - -

    Note that until wgrib2 v3.0.3, the number of date codes was limited -by the stdout buffer size. (See wgrib2 -config.) Wgrib2 v3.1.4 allows -the optional equal sign option to include the terminating date code. - -

    -The -ndate and -ndates options -are initialization routines. They are run when all the options are -initialized. Therefore they are run before reading the grib file. -The -ndates_fmt option has to preceed the --ndates option to alter the output format. - -

    The wgrib2 command line can have multple -ndates options. - -

    --ndates DATE DATE2 DT2     lt form
    --ndates DATE DT1 DT2       lt form
    --ndates DATE =DATE2 DT2    le form     wgrib2 v3.1.4
    --ndates DATE =DT1 DT2      le form     wgrib2 v3.1.4
    -
    - DATE, DATE2 = YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm, YYYYMMDDHHmmss
    - DT1, DT2 = (integer)(unit)  unit=yr,mo,dy,hr,mn   (same as GrADS)
    -            note: DT must be positive and greater than zero
    -
    -If DT1 is given, then DATE2=DATE+DT1
    -
    -lt form:
    -    C-meta:          for (date=DATE; date < DATE2; date += DT2) print date;
    -    Fortran-meta:    date=DATE
    -  		     while (date < DATE2)
    -                        print date
    -                        date=date+DT2
    -                     endwhile
    -
    -le form:
    -    C-meta:          for (date=DATE; date<= DATE2; date += DT2) print date;
    -    Fortran-meta:    date=DATE
    -                     while (date <= DATE2)
    -                        print date
    -                        date=date+DT2
    -                     endwhile
    -
    -The only differences between the lt and le forms is the do-loop test clause.
    -
    -
    -DATE=integer of the form YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm, YYYYMMDDHHmmss
    -                note: leading zeros cannot be replaced by spaces
    -                YYYY = year (0000..9999), there were changes in the calendar (ex in 1752) which are ignored
    -                MM = month (01..12)
    -                DD = day (01..31)
    -                HH = hour (00..23)
    -                mm = minute (00..59)
    -                ss = second (00..59), there are no provisions for leap seconds
    -DT = (integer)(time unit)           "time unit" follows the GrADS convention
    -               integer > 0
    -               time unit = yr (year)
    -                           mo (month)
    -                           dy (day)
    -                           hr (hour)
    -                           mn (minute)
    -                           there is no seconds time unit defined by GrADS
    -
    - -One useful feature of -ndates is the format of the output date is -appropriate for the input date code and DT2. The format has the most precision for -both the input date code and DT2. - -
    -      Priority of the output format of the date codes (high to low)
    -   output date code: YYYYMMDDHHmmss      if input date code is YYYYMMDDHHmmss
    -   output date code: YYYYMMDDHHmm        if input date code is YYYYMMDDHHmm   or DT2 is in minutes (mn)
    -   output date code: YYYYMMDDHH          if input date code is YYYYMMDDHH     or DT2 is in hours (hr)
    -   output date code: YYYYMMDD            if input date code is YYYYMMDD       or DT2 is in days (dy)
    -   output date code: YYYYMM              if input date code is YYYYMM         or DT2 is in months (mo)
    -   output date code: YYYY                if input date code is YYYY           or DT2 is in years (yr)
    -
    - -

    Examples

    - -Suppose you want a list of days for 2003. -
    -$ wgrib2 /dev/null -ndates 2003 2004 1dy
    - 20030101 20030102 ... 20231231
    -
    - You could get the same result by
    -$ wgrib2 /dev/null -ndates 2003 1yr 1dy
    -
    -Now suppose you want the output to include the hours, then
    -
    -$ wgrib2 /dev/null -ndates 2003 2004 24hr
    - 2003010100 2003010200 ... 2023123100
    -
    - -Suppose that you want the list of day from April 2000 to December 2000 inclusive. -Then you can use the inclusive form of -ndates. - -
    -$ wgrib2 /dev/null -ndates 200004 =200012 1mo
    - 200004 ... 200012
    -
    - - - -

    Usage

    -

    - -

    -  lt form
    --ndates DATE DATE2 DT2
    --ndates DATE DT1 DT2
    -  le form
    --ndates DATE =DATE2 DT2
    --ndates DATE =DT1 DT2
    -
    -Usually wgrib2 is given the null file of "/dev/null".  For windows,
    -try using NUL.
    -
    -    DATE: YYYYMMDDHH or YYYYMMDDHHmm or YYYYMMDDHHmmss
    -    DATE2: if DT1 is given, then DATE2 = DATE + DT1
    -
    -    DT1: ending dt
    -    DT2: step dt
    -    dt: (integer)Time_unit,   integer > zero
    -    Time_unit: yr (year)
    -               mo (month)
    -               dy (day)
    -               hr (hour)
    -               mn (minute)
    -
    -    prints a list of date codes
    -
    -    C-meta:    for (date=DATE; date < DATE2; date += DT2) print date;
    -    C-meta:    for (date=DATE; date <= DATE2; date += DT2) print date;
    -
    -    the output date code has the precision necessary for DATE and DT2 and 
    -    is converted into a string.  The date is printed out using the 
    -    "ndates_fmt" format.  The default format is " %s".  (C format)
    -
    - - - -

    Example

    -
    -        print date codes for 1 month, every day
    -
    -$ wgrib2 /dev/null -ndates 2019020100 1mo 1dy
    - 2019020100 2019020200 2019020300 2019020400 2019020500 2019020600 2019020700 2019020800 
    -2019020900 2019021000 2019021100 2019021200 2019021300 2019021400 2019021500 2019021600 
    -2019021700 2019021800 2019021900 2019022000 2019022100 2019022200 2019022300 2019022400 
    -2019022500 2019022600 2019022700 2019022800
    -
    -$ wgrib2 /dev/null -ndates 201902 1mo 1dy
    - 20190201 20190202 20190203 20190204 20190205 20190206 20190207 20190208 20190209 20190210 
    -20190211 20190212 20190213 20190214 20190215 20190216 20190217 20190218 20190219 20190220 
    -20190221 20190222 20190223 20190224 20190225 20190226 20190227 20190228
    -
    -        print date codes for 1 day, every 6 hours
    -
    -$ wgrib2 /dev/null -ndates 2019020100 1dy 6hr
    - 2019020100 2019020106 2019020112 2019020118
    -
    -$ wgrib2 /dev/null -ndates 20190201 1dy 6hr
    - 2019020100 2019020106 2019020112 2019020118
    -
    -$ wgrib2 /dev/null -ndates 20190201 1dy 6hr
    -2019020100 2019020106 2019020112 2019020118
    -
    -$ wgrib2 /dev/null -ndates 2019020100 1dy 6hr
    - 201902010000 201902010600 201902011200 201902011800
    -
    -      print the months from 202001 to 202012
    -
    -$ wgrib2 /dev/null -ndates 202001 202101 1mo
    - 202001 202002 202003 202004 202005 202006 202007 202008 202009 202010 202011 202012
    -$ wgrib2 /dev/null -ndates 202001 12mo 1mo
    - 202001 202002 202003 202004 202005 202006 202007 202008 202009 202010 202011 202012
    -
    - -

    Finding the Julian date (ordinal date)

    - -The ordinal date is the year and day of the year ranging -from 1 and 366. To get the day of the year from YYYYMMDD, -you can use -ndates. - -
    -wgrib2 /dev/null -ndates {YYYY-1}1231 {YYYYMMDD} 1dy | wc -w
    -wgrib2 /dev/null -ndates {YYYY} ={YYYYMMDD} 1dy | wc -w               wgrib2 v3.1.4
    -
    - -

    Date from the Julian date (ordinal date)

    - -Using wgrib2 to convert the date code to the Julian day is easy. -
    -year YYYY
    -julian_date N
    -
    -wgrib2 /dev/null -ndate {YYYY} {N-1}dy`
    -
    - - -

    Length Limitations of wgrib2 v2.8.0-v3.0.2

    - -

    -The text output of options is stored in a stdout buffer and written -after the options are finished. This speeds up processing because only -one large write is done rather than many smaller writes and allows you -to copy the output of inv options to other files by the -last and -last0 options. -This limits the output of -ndates to 30000 bytes (wgrib2 v2.0.8) and 100,000 bytes -(wgrib2 v3.0.0). Most people can live within the limitation. However, I -wanted to process years of data with hourly resolution encountered this -limitation. With wgrib2 v3.0.3+, ndates writes it output directly -to stdin. -This has no effect on -last and -last0 because this options only works when processing a -file, and -ndates works prior to processing the file. - - -

    -See also: -ndates_fmt, --ndate -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 1, 2019, Feb 12, 2020, March 20, 2021, June 23, 2021, july 1, 2021, Nov 2023, Mar 2024 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/ndates_fmt.html b/web_docs/ndates_fmt.html deleted file mode 100644 index 5bab73b..0000000 --- a/web_docs/ndates_fmt.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ndates_fmt - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ndates_fmt -
     
    - -

    wgrib2: -ndates_fmt (v2.0.8+)

    -
    - - -

    Introduction

    - -

    -The -ndates_fmt option changes the default format -that the -ndates prints the date codes. The default -format is written in C as " %s". (The date code is converted into a string, -and a blank and the string is printed out.) - -

    The -ndates_fmt option is an initialization option, -so it runs prior to the processing of the grib file. -The -ndates_fmt option needs to preceed the --ndates option. - -

    -Default ndates format is " %s"
    -
    -$ wgrib2 /dev/null -ndates 201802 1dy 6hr
    - 2018020100 2018020106 2018020112 2018020118$ 
    -
    -A list of files on one line
    -
    -$ wgrib2 /dev/null -ndates_fmt " pgb%s" -ndates 201802 1dy 6hr
    - pgb2018020100 pgb2018020106 pgb2018020112 pgb2018020118$ 
    -
    -A list of files, one file per line
    -
    -$ wgrib2 /dev/null -ndates_fmt "pgb%s\n" -ndates 201802 1dy 6hr
    -pgb2018020100
    -pgb2018020106
    -pgb2018020112
    -pgb2018020118
    -$ 
    -
    -Making a script to process a list of files
    -
    -bash-4.1$ wgrib2 /dev/null -ndates_fmt "cp pgb%s ~/data\n" -ndates 201802 1dy 6hr >cmd
    -bash-4.1$ cat cmd
    -cp pgb2018020100 ~/data
    -cp pgb2018020106 ~/data
    -cp pgb2018020112 ~/data
    -cp pgb2018020118 ~/data
    -bash-4.1$ 
    -
    - -

    -The -ndates_fmt option understands three back-slash characters. -

    -   \n gets converted into a new-line character
    -   \t gets converted into tab character
    -   \\ gets converted into a back-slash character
    -
    -   Windows will be addressed later with respect to the end of line termination.
    -
    - -

    Usage

    -

    - -

    --ndates_new C_FORMAT
    -   C_FORMAT is a C-language format which includes a %s to print
    -   the date code.  The only back slash sequences allowed are \n, \t, and \\.
    -
    - - - -See also: -ndates -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 1, 2019, March 20, 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/netcdf.html b/web_docs/netcdf.html deleted file mode 100644 index 9569a9d..0000000 --- a/web_docs/netcdf.html +++ /dev/null @@ -1,642 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -netcdf - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end - -
     
    - -

    wgrib2: -netcdf

    -
    - -

    Introduction

    - -

    -The -netcdf option writes the grid values to a specified -file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator -and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic -projection grids. Other grid templates and projections are not supported yet. - -

    -Default the grid values are written as 4 bytes float having {TIME,LAT,LON} -dimension shape (3D data) and possible vertical LEV information added to the name of variables. -For example, V wind component defined at 10 m level in atmosphere will have default name -VGRD_10maboveground. -With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data -with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical -structure analysis etc. -

    -3D and 4D data could be mixed in the same netcdf file if both have the same horizontal -grid shapes. Practically any number of variables could be placed in to the single netcdf file -as well as time dimension can be almost arbitrary extended. For these purposes -please use the wgrib2 -append option. -All missing values in data are replaced by the _FillValue defined in wgrib2 as -9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. - - - -

    Simple usage 1

    -

    - -

    --netcdf file_name
    -
    - -

    Example 1

    -

    - -

    -$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    -
    -The above line converts the grib2 file into a netcdf file.
    -
    - -

    Simple usage 2

    - -
    --set_ext_name 1 -netcdf file_name
    -
    - -

    -The first simple usage was good for simple variables like HGT (geopotential height) -and TMP (temperature). Using the grib name identifies the field. However, -some grib fields cannot be identified by the grib name. For example, - -

    -$ wgrib2 massmr.grb2 -netcdf junk_simple_name.nc
    -1:0:d=2015072700:MASSMR:64 hybrid level:12 hour fcst:aerosol=Dust Dry:aerosol_size >=2e-07,<2e-06:
    -      The grib name is MASSMR (mass mixing ratio.  If you make a netcdf file with
    -      this name, you get an ambigous netcdf field.
    -$ ncdump -h junk_simple_name.nc
    -...
    -	float MASSMR_64hybridlevel(time, latitude, longitude) ;
    -		MASSMR_64hybridlevel:_FillValue = 9.999e+20f ;
    -		MASSMR_64hybridlevel:short_name = "MASSMR_64hybridlevel" ;
    -		MASSMR_64hybridlevel:long_name = "Mass Mixing Ratio (Mass Fraction in Air)" ;
    -		MASSMR_64hybridlevel:level = "64 hybrid level" ;
    -		MASSMR_64hybridlevel:units = "kg/kg" ;
    -
    - -The netcdf file, junk_simple_name.nc, contains the mass missing ratio of some unknown substance. -For this case we need to use the extend name. - -

    Example 2

    -
    -$ wgrib2 massmr.grb2 -set_ext_name 1 -netcdf junk_ext_name.nc
    -1:0:d=2015072700:MASSMR.aerosol=Dust_Dry.aerosol_size_>=2e-07,<2e-06.:64 hybrid level:12 hour fcst:
    -$ ncdump -h junk_ext_name.nc
    -...
    -	float MASSMR_aerosol_EQ_Dust_Dry_aerosol_size_GE_2eM07_LT_2eM06_64hybridlevel(time, latitude, longitude) ;
    -		MASSMR_aerosol_EQ_Dust_Dry_aerosol_size_GE_2eM07_LT_2eM06_64hybridlevel:_FillValue = 9.999e+20f ;
    -		MASSMR_aerosol_EQ_Dust_Dry_aerosol_size_GE_2eM07_LT_2eM06_64hybridlevel:short_name = "MASSMR_aerosol_EQ_Dust_Dry_aerosol_size_GE_2eM07_LT_2eM06_64hybridlevel" ;
    -		MASSMR_aerosol_EQ_Dust_Dry_aerosol_size_GE_2eM07_LT_2eM06_64hybridlevel:long_name = "Mass Mixing Ratio (Mass Fraction in Air)" ;
    -		MASSMR_aerosol_EQ_Dust_Dry_aerosol_size_GE_2eM07_LT_2eM06_64hybridlevel:level = "64 hybrid level" ;
    -		MASSMR_aerosol_EQ_Dust_Dry_aerosol_size_GE_2eM07_LT_2eM06_64hybridlevel:units = "kg/kg" ;
    -
    - -

    Sub-options for -netcdf

    - -

    -Next sub-options could help to customize created netcdf file(s). -All sub-options must preceed the -netcdf option as it is the wgrib2 rule. -More then one -netcdf option could be given on the wgrib2 command line, -please read the documentation for wgrib2. -Almost all sub-options have -no_... version that annulates previous -assignment. -For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table -with the -nc_table sub-option or combine the command line options -with instructions in the -nc_table conversion file. - -

    -The -append option makes possible to create single -large data set for long time series of gridded data. Time dimension of data in the netcdf file -is "unlimited", it could be extended "forward" when adding new data but not "backward" before -the first defined time value. If data for the same time step already exist in the updated -netcdf file these will be silently overwritten. - -

    -The -nc_nlev option is needed to export data to netcdf -as 4D data defined in {TIME,LEV,LAT,LON} space. -It must be followed by integer max_number_of_vertical_levels -which defines the vertical dimension size of 4D data exported to the netcdf file. -This value can not be found from each single grib2 message or sub-message, -usually it has to be scanned the entire grib2 file or even number of files. -It is the reason why the max_number_of_vertical_levels -value must be provided by user. -

    -Grib2 types of vertical levels eligible for export to the netcdf as 4D data -are defined in the wgrib2 internal table and now include next types of GRIB2 levels: -

    -
    -
    20:K level -
    100:pressure level -
    104:sigma level -
    105:hybrid level -
    107:K isentropic level -
    160:ocean depth below sea level -
    -
    -

    -Data for the first found eligible level type are treated as 4D and vertical level -information is not added to the variable names. -Error is generetad if data for other then first found eligible level type -are met in the input stream. -Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space -with the possible level information included into the variable names or with the user-specified names -(see -nc_table option description below for how to do it). -

    -The -nc_nlev option has not -no_... option, -please use instead the max_number_of_vertical_levels equal to 0. -In this case all data from the input stream will be threated as 3D. -

    -When existing netcdf file is updated in the -append mode -the value of max_number_of_vertical_levels must not exceed -initial value provided when the netcdf file was first created (defined). -By default when first creating the netcdf file, vertical level values are not fixed -(are undefined) and these are defined one-by-one when data at new level are added -to the netcdf file, up to the max_number_of_vertical_levels. -To overcome this feature please use the -nc_table option. - -

    -The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is -default and do not assume data packing, only data range is checked. Data outside of -specified range are replaced by missing value code for all types of packing. -This replacement is done in the local copy of unpacked data, so main data array -stays unchanged. -Values of min and max could be any -signed float. Packing is applied to all new variables in the input stream. -If some variable was already defined in the netcdf file and now is appended to it -in the -append mode the initially defined and fixed in the netcdf file -valid range and packing parameters are used. -

    -The packing is possible to the short (2 bytes) -or byte (1 byte) values with potential loss of precision. -Both zero values of min and max -packing parameters for the short or -byte packing activate 'auto' packing when -min and max -values are defined from the first entered field. - -

    -PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file -is open with 'sdfopen' command. But by some reasons using the GrADS -data description file (catalog) for the same netcdf file helps in this situation. - -

    -The -nc_grads option activates some tests for the created -netcdf file to be GrADS (version 1.9b4) compatible, -or to be open by sdfopen in gradsnc or gradsdods. -The GrADS support only COARDS convention netcdf files; -it do not support non-constant data time stepping -and silently generates wrong time stamps for such netcdf files. -Packing to byte also is not directly recognized by GrADS v1.9b4. -With this option an error is raised and processing stops -if any of criterias above is determined. - -

    -The -nc_table option followed by the file_name is most usefull for the advanced users -as it specifies the file where user can customize many features of created netcdf file. -Next examples demonstrate which directives and conversion rules could be given -in the -nc_table file. -Almost all of them are optional with exception of $nlev for the case -when user explicitly specifies the vertical level values $levs. -

    -$lev_type 100:pressure:pressure level:mb:0.01 -

    This directive explicitly defines the type of vertical level -in the grib2 file that becomes eligible for treating data at these levels as 4D data -and some it attributes for netcdf file. -Default, first found level type listed in the wgrib2 build-in table -of eligible levels is selected if no $lev_type directive found. -

    Fields here include: -

    -
    -
    100-the grib2 level type code number -for treating data as 4D. In this example it is the code number for pressure levels, integer -
    pressure- -short_name for the vertical axis in the netcdf file, string -
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces -
    mb-vertical axis units as written in the netcdf file, string -
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file -
    -
    - -$nlev X -

    This directive is an equivalent of the -nc_nlev command line option -but value in the -nc_table file has precedence over the command line option if both are found. -It is required if next $levs directive is specified. -

    - -
    $levs lev(1) lev(2) lev(3)... -
    ...lev(I-1) lev(I) lev(I+1)... -
    ...lev(X-1) lev(X) -
    -

    -This directive explicitly specifies the vertical level values to be exported -to the netcdf file, in the netcdf units. -If this directive exists in the -nc_table file and there is found the grib2 data -eligible for the 4D presentation but defined on other then listed level - -these data are skipped from export and work is silently continued. -All data conversion parameters are checked before the $levs is checked. -List of level values could consist of multiple lines; -max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); -use space, ',', ';' or ':' as lev(i) fields separator. -

    -Impact of $nlev and $levs directives is different depending on -does the netcdf file is first created or it is updated. -When the netcdf file is first created these values are written -to the netcdf file fixing 4D data vertical structure. -When updating an existing netcdf file in the -append mode -these parameters will work like filter limiting possible -updates of 4D data by these that satisfy to the given $levs only and -ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. -

    -The $nlev and $levs directives could be necessary if records -in the grib2 file have randomly changing vertical level values -that makes it impossible sequentionally define valid order of vertical levels. - -

    -$grads 1 -

    This directive is an equivalent of the -nc_grads command line option -if passed value is 1 or to the -no_nc_grads if value is 0. -Directive in the -nc_table file has precedence over the command line option. - -

    -wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] -

    -All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' -are treated as grib2 to netcdf conversion rules for the specified variables. -In these strings the wgib2_name and wgrib2_level -are strings as returned by the wgrib2 inventory; -* used as the wgrib2_level will apply -to all levels not given explicitly. -The valid range and packing information is optional but it overwrites common -packing rule if such is specified by the -nc_pack command line option. -Absence of packing information means no packing for this variable. -Min and max values are any signed float values. Both could be omitted or put to zero. -Last case means that automatic scaling will be estimated from the first entered -wgib2_name field at the wgrib2_level -or at the first level in case of * as level value. -

    -If the keyword ignore is found as a netcdf variable name or -as a packing type value, the corresponding data are ignored -and do not written to the netcdf file. -Impact from this keyword is similar to the wgrib2 -not option -or filtering data with the grep utility. -

    -The ignore keyword is recommended if the data from the same -grib2 file are exported in number of output files (netcdf or other) -by the same wgrib2 process. Then the same decoded data could be passed -for the output in other file of any supported type. -Doing export to the single netcdf file it is not recommended to use the -ignore keyword -as corresponding data are first decoded and after that skipped from writing -to the netcdf file. -

    -In the next example two lines from the -nc_table file instruct -the wgrib2 utility export to the netcdf file the geopotential height changing name -from HGT (wgrib2) to -geopotential in the netcdf file, -at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: -

    -
    -HGT:*:geopotential
    -HGT:975 mb:ignore
    -
    -
    -All other variables not listed in the -nc_table file but found in the input stream -are processed as regular 3D data. - - -

    Example 3

    -

    -Next example shows the content of user-defined -nc_table file -for one special case of Japan Meteorological Agency MSM system grib2 data conversion. -Same -nc_table file includes the rules for -conversion of both 'surface' and upper air data although -the input grib2 files are different. - -

    -
    -#
    -# File name: jma_msm_g2nc.table
    -# Description: Specifies parameters for conversion to Netcdf format
    -# hourly analyses and forecasts of JMA MSM system as best suited to
    -# my purposes: forcing of ocean model and reference data for analysis
    -# of meteorological conditions with GrADS-based visualization tools.
    -# Sergey Varlamov, July 2007
    -#
    -$lev_type  100:p:pressure level:mb:0.01
    -$nlev      16
    -$levs  1000 975 950 925 900 850 800 700 600 500
    -        400 300 250 200 150 100
    -$grads 1
    -#
    -# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    -#
    -UGRD:*:u
    -VGRD:*:v
    -#UGRD:*:u:ignore
    -#VGRD:*:v:ignore
    -TMP:*:temp
    -#write HGT at any level as hgtprs:
    -HGT:*:hgtprs
    -#but skip HGT at 100 mb, now commented - example and test
    -#HGT:100 mb:hgtprs:ignore
    -RH:*:rh:short:-2:110
    -VVEL:*:omega
    -#
    -# JMA MSM model surface data conversion rules
    -#
    -PRMSL:mean sea level:prmsl
    -PRES:surface:prsfc
    -UGRD:10 m above ground:u10m
    -VGRD:10 m above ground:v10m
    -TMP:1.5 m above ground:t2m
    -RH:1.5 m above ground:rh2m:short:-5:110
    -TCDC:surface:ncld:short:-5:110
    -LCDC:surface:ncld_low:short:-5:110
    -MCDC:surface:ncld_mid:short:-5:110
    -HCDC:surface:ncld_upper:short:-5:110
    -APCP:surface:r1h
    -# End of file
    -
    -
    -Using above file we could create the daily file with 3h analyses
    -at the 'surface' layers from the input grib2 files
    -with the next simple shell script:
    -
    -
    -date=20070715
    -for (( j=0; j<=21; j+=3 )) #hour of day loop
    -do
    -  if [ $j -lt  10 ]
    -  then
    -    h=0$j
    -  else
    -    h=$j
    -  fi
    -  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    -
    -  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    -  code=$?
    -  if [ $code -eq 0 ]
    -  then
    -    echo ${date}${h}': created/added to Netcdf'
    -  else
    -    echo ${date}${h}': wgrib2 failed...'
    -    exit $code
    -  fi
    -done
    -
    -
    -Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    -
    -gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    -
    -and change the name for the output file:
    -
    -./msm_s_${date}.nc to the ./msm_p_${date}.nc
    -
    -Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    -utility for data visualization and analyses.
    -
    - -

    Example 4

    - -In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, -convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf -option doesn't support appending, the netcdf conversion cannot be in a loop. - -
    -Version 1, using loops and a temporary file
    -
    -rm tempfile
    -for f in gfs.t00z.pgrb2f[01]?
    -do
    -   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    -done
    -wgrib2 tempfile -netcdf ~/myfile.nc
    -rm tempfile
    -
    -Version 2, data-flow 
    -
    -1:   cat gfs.t00z.pgrb2f[01]? | \
    -2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    -3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    -4:   wgrib2 - -netcdf ~/myfile.nc
    -
    -
    -Line 1 (cat), takes all the desired grib files and writes to stdout
    -Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    -Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    -Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    -
    -

    Problem 1

    -

    -The -netcdf option uses the "verification" time (-vt) as -the time coordinate in the netcdf file. Unlike in grib, the definition of -new "time" values has to go chronologically. For example, the analysis, -6-hour forecast and then the 12-hour forecast. Allocation of new time values -in a different order will result in error messages. If your grib file -doesn't follow the order, you can sort the file by the verification time. - -

    -wgrib2 FILE.old -vt -s | sort -k3,3 -t: | wgrib2 -i FILE.old -grib FILE.new
    -wgrib2 FILE.new -netcdf FILE.nc
    -
    - -

    Problem 2

    -

    -Another problem is that netcdf-3 files are limited to 4GB in size. The -grib2 format supports compression so that conversion to uncompressed netcdf3 or -the poorly compressed netcdf4 can increase the file size dramatically. -I am sure that Western Digital, Seagate, Hitachi and Toshiba all appreciate -your support. - -

    Problem 3

    -

    -The -netcdf option is limited to "normal" wens grids. -The COARDS convention only allows lat-lon, mercator and Gaussian grids. -The rotated, thinned and staggered grids are not supported. Netcdf can support -more grids than the COARDS convention but -netcdf was written to that convention. -

    -To handle thinned Gaussian grids, you must first convert it to full Gaussian grid. -

    - $ wgrib2 IN.grb -reduced_gaussian_grid OUT.grb -1 linear
    - $ wgrib2 OUT.grib -netcdf OUT.nc
    -
    - -

    -To handle rotated lat-lon grids, you must first convert the file to a lat-lon file -using -new_grid. - -

    -To handle non-wesn lat-lon/mercator/Gaussian grids, you must first convert the file -to a wens file. You can use -new_grid. The -new_grid option may not work with -thinned or staggered grids. - - -

    -See also: --bin, --ieee, --new_grid, --text, --reduced_gaussian_grid, --set_ext_name, --spread, - --append -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 26, 2017, March 2024 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/netcdf_2_grib_ostia.html b/web_docs/netcdf_2_grib_ostia.html deleted file mode 100644 index e3eaaa3..0000000 --- a/web_docs/netcdf_2_grib_ostia.html +++ /dev/null @@ -1,331 +0,0 @@ - - - - Climate Prediction Center netcdf vs grib2: ostia to grib2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > netcdf vs grib2: ostia sst to grib2 - -
     
    - -

    Example: converting netcdf to grib

    -
    - -

    Step 1: What is in the OSTIA NetCDF file?

    -

    -The OSTIA SST are produced the the UK MetOfice. We had the need to -convert the SST files from netcdf to grib2. This page will show -how wgrib2 (v3.0.0) was used to convert the daily files into grib2. -The grib files had the same grid point values. The new files were -8% of the netcdf file sizes. The files were not 8% smaller but 8% of -the original files. Such compressions are rare but happen -when the fields are smooth and have many undefined values like sea ice. - -

    -To start off, the file - -

    -$ ncdump -h 20191201120000-UKMO-L4_GHRSST-SSTfnd-OSTIA-GLOB-v02.0-fv02.0.nc
    -netcdf \20191201120000-UKMO-L4_GHRSST-SSTfnd-OSTIA-GLOB-v02.0-fv02.0 {
    -dimensions:
    -	time = 1 ;
    -	lat = 3600 ;
    -	lon = 7200 ;
    -
    -   the file has 1 time step, with a 3600x7200 grid
    -
    -	short analysed_sst(time, lat, lon) ;
    -		analysed_sst:long_name = "analysed sea surface temperature" ;
    -		analysed_sst:standard_name = "sea_surface_foundation_temperature" ;
    -		analysed_sst:units = "kelvin" ;
    -		analysed_sst:coordinates = "lon lat" ;
    -		analysed_sst:_FillValue = -32768s ;
    -		analysed_sst:add_offset = 273.15f ;
    -		analysed_sst:scale_factor = 0.01f ;
    -		analysed_sst:valid_min = -300s ;
    -		analysed_sst:valid_max = 4500s ;
    -		analysed_sst:source = "(not shown)"
    -		analysed_sst:comment = " OSTIA foundation SST" ;
    -
    -   the sst is in Kelvin, storted as a scaled short integer (2 bytes), to 1/100 of a degree
    -
    -	short analysis_error(time, lat, lon) ;
    -		analysis_error:long_name = "estimated error standard deviation of analysed_sst" ;
    -		analysis_error:standard_name = "sea_surface_foundation_temperature standard_error" ;
    -		analysis_error:units = "kelvin" ;
    -		analysis_error:coordinates = "lon lat" ;
    -		analysis_error:_FillValue = -32768s ;
    -		analysis_error:add_offset = 0.f ;
    -		analysis_error:scale_factor = 0.01f ;
    -		analysis_error:valid_min = 0s ;
    -		analysis_error:valid_max = 32767s ;
    -		analysis_error:comment = " OSTIA foundation SST analysis standard deviation error" ;
    -
    -   the sst error is like the sst, scaled short integer, 1/100 of adegree
    -
    -	byte sea_ice_fraction(time, lat, lon) ;
    -		sea_ice_fraction:long_name = "sea ice area fraction" ;
    -		sea_ice_fraction:standard_name = "sea_ice_area_fraction" ;
    -		sea_ice_fraction:units = "1" ;
    -		sea_ice_fraction:coordinates = "lon lat" ;
    -		sea_ice_fraction:_FillValue = -128b ;
    -		sea_ice_fraction:add_offset = 0.f ;
    -		sea_ice_fraction:scale_factor = 0.01f ;
    -		sea_ice_fraction:valid_min = 0b ;
    -		sea_ice_fraction:valid_max = 100b ;
    -		sea_ice_fraction:source = "EUMETSAT OSI-SAF" ;
    -		sea_ice_fraction:comment = " Sea ice area fraction" ;
    -
    -   the sea ice fraction is stored as a scaled byte, values to 1/100.
    -
    -	byte mask(time, lat, lon) ;
    -		mask:long_name = "land sea ice lake bit mask" ;
    -		mask:coordinates = "lon lat" ;
    -		mask:_FillValue = -128b ;
    -		mask:valid_min = 1b ;
    -		mask:valid_max = 31b ;
    -		mask:flag_masks = 1b, 2b, 4b, 8b, 16b ;
    -		mask:flag_meanings = "water land optional_lake_surface sea_ice optional_river_surface" ;
    -		mask:source = "NAVOCEANO_landmask_v1.0 EUMETSAT_OSI-SAF_icemask ARCLake_lakemask" ;
    -		mask:comment = " Land/ open ocean/ sea ice /lake mask" ;
    -
    -   the mask is stored as a byte values 0..31
    -
    -   The grid definition can be obtained by using
    -
    -$ ncdump 20191201120000-UKMO-L4_GHRSST-SSTfnd-OSTIA-GLOB-v02.0-fv02.0.nc
    -
    - -

    Step 2: Making a Template File

    -

    -To convert from netcdf to grib, we will use the -import_netcdf option -in wgrib2 (v3.0.0). The first step in using wgrib2 for conversion, is -to make a template file which the same grid definition as the netcdf -fields as well as using a suitable Product Definition Template (PDT) set to -zero. Obviously you would not want an ensemble PDT, a aerosol PDT or -any other "fancy" PDT. - -

    -# making the template file
    -wgrib2 ~/grib2/examples/gep19.aec -d 1  -set_pdt +0 -set_var HGT  -new_grid_winds earth \
    -   -new_grid latlon 180.025000:7200:0.050000 -89.975000:3600:0.05 ostia.template.tmp
    -
    -# setting grid == 0 to save space
    -wgrib2 ostia.template.tmp -rpn 0 -set_lev surface -grib_out ostia.template
    -
    - - -

    Step 3: wgrib2 script

    - -

    -To convert from netcdf to grib2, we will "wgrib2 ostia.template" and use --import_netcdf to replace the grid point values. Then -change some metadata like the variable name, -and write out the data in grib format using -grib_out. The -translation is not automatic, and you will have to script the translation for each grid. The script -fragment to translate is, - -

     (fragment of script to convert years of SST files) 
    -    19  $wgrib2 ~/home/fv3/fixed/ostia.template \
    -    20   -import_netcdf $file  \
    -    21    "sea_ice_fraction" "0:1:0:3600:0:7200" \
    -    22    -set_var ICEC -set_scaling -2 0 -set center 254 -set_grib_type c1 -set_date $date \
    -    23    -grib_out $new_file \
    -    24   -import_netcdf $file  \
    -    25    analysed_sst "0:1:0:3600:0:7200" \
    -    26    -set_var TMP -set center 74 -set center 74 -set_date $date \
    -    27     -set_scaling -2 0 -set_grib_type c3 -grib_out $new_file \
    -    28   -import_netcdf $file  \
    -    29    mask "0:1:0:3600:0:7200" \
    -    30    -set_var MASK -set center 74 -set_date $date \
    -    31     -set_scaling -2 0 -set_grib_type c1 -grib_out $new_file \
    -    32   -import_netcdf $file \
    -    33     analysis_error "0:1:0:3600:0:7200" \
    -    34    -set_var TMP -set table_4.3 7 -set center 74 -set_date $date \
    -    35     -set_scaling -2 0 -set_grib_type c3 -grib_out $new_file
    -
    -        19:     ostia.template is a grib with the same grid as the ostia sst
    -                was created using wgrib2's -new_grid option (see step 2)
    -        20-23:  read sea_ice_fraction (netcdf name) and write as grib
    -        22:     set grib name to ICEC
    -                set to 2 digits after the decimal point
    -                set center to 254
    -                set complex packing version 1 (best)
    -        23:     write grib to $new_file
    -
    -        24-27:  read analysed_sst, write as TMP:sfc
    -        27:     set scaling to 2 digits after the decimal place
    -                set to complex packing version 3  (best)
    -
    -        28:31:  read mask (netcdf name), write out MASK
    -
    -        32:35:  read analyis_error (netcdf name), write out at TMP:sfc with type set to error
    -        34:     to signify error, table 4.3 has to have the value 7
    -
    - -

    Results: Compression

    -

    -The NetCDF4 file was 15952413 bytes (20191201120000), and after -comversion to grib2, the file was 13872380 bytes. Converting -to grib reduces the size by 13%. The grib2 compression will depend -on the the program that does the encoding and which compression -method is used. The above conversion requires wgrib2 v3.0.0+. - - - -

    -See also: --grib_out, --import_netcdf, --new_grid, --set, --set_lev, --set_var, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created 1/9/2020. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/new_grib.html b/web_docs/new_grib.html deleted file mode 100644 index 3ac9d88..0000000 --- a/web_docs/new_grib.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - Climate Prediction Center - wgrib2: new grib - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: new grib -
     
    - -

    wgrib2: new grib

    -
    - - -

    Introduction

    - -

    -When wgrib2 is processing a field, it has a copy of the grid point values -and grib (sub-)message in memory. There are options that allow you to -change the in-memory grid point values (ex. -rpn, -undefine). After -changing the grid point values, you can write out new grib message -using the updated in-memory grid point values using the --grib_out option. The packing/comprression -using by -grib_out option is selected by the --set_grib_type option. - -

    -wgrib2 also has options for modifying the meta-data of the -in-memory grib (sub-)message. Options like -set_var will set -the variable name, -set_lev will change the level, -set_date will -change the date code in the in-memory grib (sub-)message. -Once you have modified the meta-data, you can write out a new grib -message using the -grib_out or --grib options. The former will write out the -message using the in-memory grid point values and the latter will use the -in-memory grib message and original gridded values. The former -is slower because it has to pack or compress the data. - - -

    Why

    - -

    -Making grib-1 files was a pain because you had to specify much -meta-data and had to worry about the packing. Making grib-2 -files is even more painful because there is more meta-data -to specify and more libraries are needed for packing/compression. -One way to get around the meta-data problem is to use a -template (a grib file with all the common metadata) and -use some routines to modify the variable/level/date/etc codes. -You still have to put the metadata into the template but -you should be able to reuse the template. - -

    -The approach described in the first two paragraphs is a way -to make new grib2 files using the template approach. For -example, one may want to convert a data set into grib. After -making a template, one could use the - --import options. - - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/new_grid.html b/web_docs/new_grid.html deleted file mode 100644 index daefd9f..0000000 --- a/web_docs/new_grid.html +++ /dev/null @@ -1,671 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -new_grid - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid -
     
    - -

    wgrib2: -new_grid

    -
    - - -New! -

    -Recently discovered bug in IPOLATES. To avoid the bug, all grids should have a size of greater -than 1 degree longitude. For example, delta_longitude = 0.1 degree, then number of longitude points -needs to be ≥ 11 to make grid > 1 degree. -The IPOLATES library wanted to handle the case of a global grid going from -xE to (x+360)E which is be encoded as going from xE to xE. To allow for rounding errors, -a grid from xE to yE (y-x ≤ 1) was condsidered to be a grid from xE to (360+x)E. -This causes a problem when the grids are ≤ than 1 degree in longitude. This bug will occur -occur for both the input and output grids. - - -

    Introduction

    - -

    Beginners are encouraged to read the new_grid introduction. -

    -The -new_grid option interpolates the fields to a new -grid. The default interpolation is bilinear but that can be changed using the --new_grid_interpolation option. This option uses -scalar and vector interpolation as appropriate. Vector interpolation is needed -for interpolating zonal and meridional winds near the poles. - -

    In order for the vector -interpolation to work, the vector quantities must be in a (U,V) order. -For example: Z200, U200, V200, Z500, U500, V500 is good. If the data -are not in (U,V) order, you can either convert the file to the -right order by the -new_grid_order option. -The other method is to sort the inventory into (U,V) order, -and interpolate the file using the sorted inventory. (See -"Example: Sorting the Inventory" to use this technique.) -If the vector quanties are not in (U,V) order, the vector quantites will -not be interpolated. - -

    -The option is not part of the default configuration but it included with many distributions. -The interpolation code is written -in fortran and combining fortran and C code can require some work. (gcc/gfortran and -clang/gfortran are already handled by the makefile.) Getting the C and Fortran code to cooperate -requires some system-specific knowledge and may not be possible in all cases. Consequently -you are on your own in getting the -new_grid option installed. - -

    -Operations often has to use the -new_grid option to produce a large number -of user grids. Fortunately the interpolation can be made embarrassingly parallel. A -portable single-node solution is described in here. A -multi-node solution is possible using MPI and the wgrib2 library. - -

    Caution

    - -

    The -new_grid option works in raw scan mode, so data are not -converted to sn:we order. Conequently options that only work in sn:we order cannot -work at the same time as the -new_grid option. Any option -that uses geolocation (ex. -rpn, -lon) -is incompatible with -new_grid. - -

    Winds

    - -Before you do an interpolation, you need to define the wind directions. -Most people want the the V winds to be in the direction of the North Pole. -With a verbose wgrib2 inventory, you will seee winds(N/S). However, some -meteorologists want the V winds to go from grid point (i,j) to (i,j+1). -The corresponding wgrib2 notation is "winds(grid)". See the --new_grid_winds option for more details. - -

    Usage

    -
    --new_grid_winds W -new_grid A B C outfile
    -    W = earth or grid
    -        earth means that the U wind goes eastward, V goes northward
    -        grid means that U wind goes from grid (i,j) to (i+1,j)
    -          which is not eastward in a Lambert-conformal or polar stereographic grids
    -    A, B, C are the output grid description
    -    outfile is an output file.  The grib2 interpolated records are written in outfile
    -
    - - -

    Grid description format

    - -

    -The nx and ny parameters are integers such that nx*ny < 2147483648. -Angles and delta-angles are in degrees, and are rounded to micro-degrees unless -otherwise specified. Dx and Dy are in meters and are usually rounded -to the nearest mm. - -

    The interpolation library does not handle non-spherical grids. The library -also has problems with grid smaller than 1 degree in longitudinal width. It assumes -that the calculations are not precise, and the grid is global. - -

    -

    General Format

    --new_grid A B C outfile General format - - A grid name with parameters - B X or longitude description (ex lon0:nlon:dlon) - C Y or latitude description (ex lat0:nlat:dlat) - -

    Selected NCEP Grids (not in general format)

    --new_grid ncep grid I outfile I = 2,3,4,45,98,126-129,170,173,184,194,221,230,242,249 - (NCEP grid defintions) - t62,t126,t170,t190,t254,t382,t574,t1148,t1534 - (NCEP Gaussian grids definitions) - Want more ncep grids? Modify ncep_grids.c - - -

    Latitude-Longitude Grid

    --new_grid latlon lon0:nlon:dlon lat0:nlat:dlat outfile lat-lon grid - lat0, lon0 = degrees of lat/lon for 1st grid point - nlon = number of longitudes - nlat = number of latitudes - dlon = grid cell size in degrees of longitude - dlat = grid cell size in degrees of latitude - - -

    Rotated Latitude-Longitude Grid (requires ip2lib_d)

    --new_grid rot-ll:sp_lon:sp_lat:sp_rot lon0:nlon:dlon lat0:nlat:dlat outfile - rotated latitude-longitude grid - sp_lon = longitude of the South pole (for rotation) - sp_lat = latitude of the South pole (for rotation) - sp_rot = angle of rotation (degrees) - The grid is defined in the rotated coordinates. - eat0, lon0 = degrees of lat/lon for 1st grid point - nlat = number of longitudes - nlon = number of latitudes - dlon = grid cell size in degrees of longitude - dlat = grid cell size in degrees of latitude - - -

    Lambert Conic Grid

    --new_grid lambert:lov:latin1:latin2:lad lon0:nx:dx lat0:ny:dy outfile Lambert conic conformal --new_grid lambert:lov:latin1:latin2 lon0:nx:dx lat0:ny:dy outfile lad = latin2 --new_grid lambert:lov:latin1 lon0:nx:dx lat0:ny:dy outfile latin2 = latini lad = latin1 - lov = longitude (degrees) where y axis is parallel to meridian - latin1 = first latitude from pole which cuts the secant cone - latin2 = second latitude from pole which cuts the secant cone - lad = latitude (degrees) where dx and dy are specified - lat0, lon0 = degrees of lat/lon for 1st grid point - nx = number of grid points in X direction - ny = number of grid points in Y direction - dx = grid cell size in meters in x direction - dy = grid cell size in meters in y direction - note: if latin2 >= 0, the north pole is on proj plane - if latin2 < 0, the south pole is on proj plane - - -

    Lambert Conic Grid with Centered Location

    --new_grid lambertc:lov:latin1:latin2:lad lonc:nx:dx latc:ny:dy outfile Lambert conic conformal with centered position --new_grid lambertc:lov:latin1:latin2 lonc:nx:dx latc:ny:dy outfile like lambert except lonc and latc replace lon0 and lat0 --new_grid lambertc:lov:latin1 lonc:nx:dx latc:ny:dy outfile latc, lonc = degrees of lat/lon for center of the grid - - -

    Polar Stereographic Grid

    --new_grid nps:lov:lad lon0:nx:dx lat0:ny:dy outfile north polar stereographic --new_grid sps:lov:lad lon0:nx:dx lat0:ny:dy outfile south polar stereographic - lov = longitude (degrees) where y axis is parallel - to meridian - lad = latitude (degrees) where dx and dy are specified - note: grib1 uses lad = 60N (nps) or 60S (sps) - lad must be 60 (nps) or -60 (sps) (library limitation) - lat0, lon0 = degrees of lat/lon for 1st grid point - nx = number of grid points in X direction - ny = number of grid points in Y direction - dx = grid cell distance meters in x direction at lad - dy = grid cell distance meters in y direction at lad - - -

    Global Gaussian Grid

    --new_grid gaussian lon0:nx:dlon lat0:ny outfile global Gaussian grid - lat0, lon0 = degrees of lat/lon for 1st grid point - note: lon1 = -lon0, lat1 = lat0 + (nx-1)*dlon; - nx = number of grid points in X direction - ny = number of grid points in Y direction - ny must be even - dlon = degrees of longitude between adjacent grid points - - note: wgrib2 supports regional Gaussian grids, but - the interpolation library doesn't. - -

    Mercator Grid

    --new_grid mercator:lad lon0:nx:dx:lonn lat0:ny:dy:latn outfile mercator grid - lad = latitude (degrees) where dx and dy are specified - lat0, lon0 = degrees of lat/lon for 1st grid point - latn, lonn = degrees of lat/lon for last grid point - nx = number of grid points in X direction - ny = number of grid points in Y direction - dx = grid cell distance in meters in x direction at lad (double precision) - dy = grid cell distance in meters in y direction at lad (double precision) - - see grib2 template for the Mercator grid - - note: dx and dy are in meters unlike the grib template which is in mm (integer). - note: dx and dy depend on the radius of the earth as specified by the grib message - note: interpolation library assumes that earth will be spherical - note: the mercator grid description is over specified - User must make sure (nx,dy) is consistent with lonn - as well as (ny,dy) is consistent with latn - -lambert, nps, sps, mercator only support we:sn ordering -latlon, gaussian only support we:sn and we:ns ordering - -

    Grib (wgrib 3.0.0, ip2lib_d)

    --new_grid grib file Y grid definition from a grib file - file=grib2 file - Y (ignored) - - note: this option is only available on wgrib2 v3.0.0+ - using ip2lib_d (IPOLATES=3) - note: default wind rotation is obtained from file - note: support for grib files is limited by ip2lib_d - -

    Location (wgrib 3.0.0, ip2lib_d)

    --new_grid location list UUID unstructured grid - list = lon1:lat1:lon2:lat2:...:lon-n:lat-n - UUID = UUID for this grid, 0 if none - - note: wind rotation is set to earth - The locations are saved to the grib file as the first - and second grib messages. (3 decimal digits precision) - -
    - -

    -Sometimes one wants to convert grib files to a common grid. You already -have a sample grib file and you have to figure out the grid format. -For common grids, you can use the perl script -grid_defn.pl -to determine the grid format. -

    -$ grid_defn.pl small.grb2
    -latlon 0.000000:2:10.000000 20.000000:2:8$ 
    -
    -grid_defn.pl does not add a newline at the end of its output.
    -Not all grids are supported.
    -
    - - -

    Examples

    -
    -  wgrib2 IN.grb -set_grib_type same -new_grid_winds earth -new_grid latlon 100:10:1 30:20:1 OUT.grb
    -    Interpolates from IN.grb to OUT.grb
    -    Uses the same grib packing as in the input file
    -    Makes a 10x20, 1x1 degree lat-lon grid, lower left corner: 100E 30N
    -
    -
    -  wgrib2 IN.grb -set_grib_type same -new_grid_winds earth -new_grid ncep grid 221 OUT.grb
    -    Interpolates from IN.grb to OUT.grb
    -    Uses the same grib packing as in the input file
    -    Interpolates to NCEP grid 221.
    -
    -  wgrib2 IN.grb -set_grib_type same -new_grid_winds earth -new_grid `grid_defn.pl OLD.grb` OUT.grb
    -    Interpolates from IN.grb to OUT.grb
    -    Uses the same grib packing as in the input file
    -    Interpolates using the grid format of OLD.grb (1st record)
    -
    -

    Example: Sorting the Inventory

    - In this example, U and V are not in the required order. This -shows a sorting to the required order for -new_grid to work. - - wgrib2 201201.A | sed -e 's/:UGRD:/:UGRDa:/' -e 's/:VGRD:/:UGRDb:/' | \ - sort -t: -k3,3 -k5,8 -k4,4 | \ - wgrib2 201201.A -i -new_grid_winds earth -new_grid ncep grid 2 201201.A.grd2 - - The first line creates an inventory with new variable names: UGRD -> UGRDa and VGRD -> UGRDb - The second line sorts the inventory so that UGRDb follows UGRDB. - The third line regrids the file, with the order of processing controlled by the inventory. -
    - -

    Type of Interpolation

    - -The IPOLATES library (either iplib or ip2lib_d) supports a number of interpolation schemes including bilinear (default), -bicubic, neighbor and budget. (In addition, ip2lib_d will support spectral.) -The interpolation method can be selected by using the -new_grid_interpolation -option before the -new_grid option. Some of the interpolation -options need numeric parameters which are set by the --new_grid_ipopt option. IPOPT is defined in the iplib library documentation. - -

    -You can use different interpolations for different variables. For example, a -bilinear interpolation of soil or vegetation type is meaningless. So -nearest neighbor interpolation is used instead. - -

    -    wgrib2 IN.grb -new_grid_winds earth \
    -      -new_grid_interpolation bilinear \
    -      -if ":(VGTYP|SOTYP):" -new_grid_interpolation neighbor -fi \
    -      -new_grid latlon 0:360:1 90:181:-1 OUT.grb
    -
    -   line 2: set default interpolation to bilinear
    -   line 3: if VGTYP or SOTYP then set the interpolation to nearest neighbor
    -   line 4: do the interpolation
    -
    -

    -Comments (4/2018): When you convert from a high resolution grid -to a lower resolution grid, you have to be consider changing from -the default interpolation (bilinear) to a budget interpolation. -The budget gives a better estimate of the cell average (the default -is 25 bilinear interpolations). - -

    Changing from grid-relative to Earth-relative winds and vice versa

    - -

    -Most NCEP grib files use grid-relative winds. If you want to convert to Earth-relative winds -or grid-relative winds, you can use the -new_grid option. - -

    -   To Earth relative:
    -     wgrib2 IN.grb -set_grib_type same -new_grid_winds earth -new_grid_interpolation neighbor \
    -      -new_grid `grid_defn.pl IN.grb` OUT.grb
    -
    -   To Grid relative:
    -     wgrib2 IN.grb -set_grib_type same -new_grid_winds grid -new_grid_interpolation neighbor \
    -      -new_grid `grid_defn.pl IN.grb` OUT.grb
    -
    -"-set_grib_type same" preserves the grib packing or compression
    -"-new_grid_interpolation neighbor" should be faster than the default bilinear
    -`grid_defn.pl IN.grb` returns the grid definition of the first grib message in IN.grb
    -
    - -The limitations of the above command are -
      -
    • IN.grb can only have one grid type -
    • OUT.grb will have any submessages converted into messages -
    - - -

    Changes from copygb

    - -People may want to convert from copygb and copygb2 to wgrib2's -new_grid. Some differences -to keep in mind. -
      -
    1. copygb default vectors: UGRD/VGRD -
    2. wgrib2 default vectors: depends on version of wgrib2. See new_grid_vectors. -
    3. copygb can have vectors in any order -
    4. wgrib2 must have V follow U for vectors pairs -
    5. copygb has bilinear, bicubic, nearest neighbor, budget, neighbor budget, and spectral interpolations. -
    6. wgrib2 has bilinear, bicubic, nearest neighbor, and budget interpolations. (Spectral is in development.) -
    7. wgrib2 can select the interpolation type depending on the variable (ex soil type) -
    8. copygb uses fixed Earth's radius -
    9. wgrib2 uses Earth's radius based on grib message -
    10. wgrib2 doesn't have merging, mapthreshold or map files -
    11. copygb by default, ignores the binary scaling and preserves decimal scaling -
    12. wgrib2 by default, preserves binary and decimal scaling -
    13. copygb does grib1. -
    14. copygb2 does grib2. -
    15. wgrib2 does grib2. -
    - - -

    Speed: Interpolation Weights

    - -

    The first step of the -new_grid interpolation is -to calculate the interpolation weights. (Each grid point on the new grid -is a weighted average of a small set of the old grid points.) -To save time for future interpolations, the last set of weights is saved. -Consequently interpolation is fastest when the input and output grids remain -don't change. While one can have multiple -new_grid options on -the command line, it is not recommended because the caching of the weights -wouldn't work and weights would have to be recalculated every time. - -

    Installation

    - -
    -With wgrib2 v2.0.8+, you have an option of compiling with the old iplib or
    -the new ip2lib_d library.  With the older versions of wgrib2, you are limited
    -to the old iplib or an hwrf version of that library.  It is recommended that
    -you use the newer ip2lib_d because it support latitude and longitudes to 
    -micro-degrees and the WMO definition of rotated lat-lon grids.  However,
    -the new library doesn't suport the NCEP local grids such as 32769 as used
    -by the NAM native files.
    -
    -

    With wgrib2 v2.0.8+, you set USE_IPOLATES to 3 in the makefile -for ip2lib_d. To use the old iplib, you set USE_IPOLATES to 1. If you -don't want the -new_grid options, you can set USE_IPOLATES to 0. -

    - -

    Converting from WE:SN to WE:NS Grids

    -Many of wgrib2 grib2 writing options will write the grid -in WE:SN order. This natural because geolocation is -only enabled when the internal grids are in WE:SN order. -However, some codes need the grid in WE:NS order. To -convert a grib file from WE:SN order to WE:NS order, the -simplest way is to use -new_grid. Lat0 and lon0 need -to be lat/lon of the top left corner of the grid. Dlon -will a positive number and dlat will be negative. - -

    If you want to be tricky, you can do a variation of the -"NDFD work arounds" technique. It will be faster and -more generic. - -

    Thinned Gaussian Grids to other Grids

    -Converting from a thinned Gaussian grid is a two step process -using wgrib2. First you convert from the thinned grid to full -grid using -reduced_gaussian_grid. -Then you can use -new_grid to interpolate to your desired grid. - -

    Quilting tiles - Merging files

    - -

    Yes, it has been done using -new_grid, -import_grib -rpn/merge, and -the -grib_out options. Yes, at least 3 people have done it. The best -application combined a global oceanic and various regional oceanic forecasts. -Priority was given to the model with the highest resolution. This is convenient -for the user who is on a route that covers different model domains. - -

    Limitations of the iplib library

    - -The iplib library has its limitations. -Grids types used by NCEP get supported and others don't. The library has a grib1 interface, so -new features of grib2 are not supported and the precision of the grid parameters -are limited to the grib1 values. For example, latitude and longitude -values are limited to millidegrees instead of microdegrees. Note: during -the installation of ip2, I noticed that the longitude was reduced when -reducing the range to [0,360). (longitude = amod(longitude + 3600.0, 360.0)) -For single precision numbers, this reduces the precision to about two digits after -the decimal place. - -
      -
    1. not all grid types are supported by iplib -
    2. only common grids are supported by the wgrib2 "wrapper" for iplib -
    3. latitude, longitude values are nomially in millidegrees (affects interpolation) -
    4. Single precision reals are used. The effective precision of the - longitudes is to a hunderdth of a degree. -
    5. only grib1 scan order are supported (i.e., WE:SN and WE:NS) -
    6. NDFD/Glahn scan order is not supported (i.e., WE|EW:SN) -
    7. Earth is assumed to be spherical -
    8. Lambert conformal: LatD must follow grib1 conventions -
    9. Polar Stereographic: LatD must be 60 latitude (grib1 convention) -
    10. nx, ny, npts must be ≤ 2147483647. (Grib2 standard is 4294967295.) -
    11. Spectral interpolation is not supported. -
    12. grids should be at least 1 degree by 1 degree. -
    - -

    Limitations of the ip2lib_d library

    - -As of wgrib2 v2.0.8, ip2lib_d is the default interpolation library. -Ip2lib_d is the double-precision grib2-interface IPOLATES library. The -old ip2lib will remain a compile time option. The advantages of -ip2lib_d that it supports grib2 precision (one millionth of a degree), -at rotated lat-lon grids (Grid Definition Template 3.1). - -

    The speed of the single precision iplib was originally faster than -the double precision ip2lib_d. To remove this objection from converting -to the new library, a effort was made to increase the OpenMP threading. -Consequently the run time of ip2lib_d will be similar (bilinear) to much -faster (budget) than iplib in a multiprocessor environment. - -

    Wgrib2 v3.0.0 adds an optional spectral interpolation. - -

      -
    1. supports more grids than iplib including WMO defined rotated lat-lon. -
    2. latitude, longitude values are in microdegrees (affects interpolation) -
    3. Double precision reals are used. (Wgrib2 stores is grid point values - as single precision.) -
    4. grib1 polar stereographic projection, LaD = 60N or 60S has been removed -
    5. NDFD/Glahn scan order (i.e., WE|EW:SN) may be supported in the future. -
    6. staggering will be supported unlike iplib -
    7. Some interpolations support an ellipical earth. -
    8. Lambert conformal: LatD must follow grib1 conventions -
    9. nx, ny, npts must be ≤ 2147483647. (Grib2 standard is 4294967295.) - This is a limitation of compiling using 4 byte integers. -
    10. Does not support local NCEP grid definitions such as 32769 -
    11. Spectral interpolation is limited to global fields with no undefined values. -
    12. grids should be at least 1 degree by 1 degree. -
    - -

    NDFD work arounds

    -

    *** FATAL ERROR: mk_kgds: unsupported scan mode 80 ***

    - -The new_grid option will give the following error -
    -*** FATAL ERROR: mk_kgds: unsupported scan mode 80
    -
    -when trying to regrid a field that is written in (WE|EW):SN order. -The (WE|EW):SN order means that the odd rows -are in WE order and the even rows are EW order. -The rows go from south to north. -This scan order is commonly used by NDFD in order to make newbies -brain hurt. Try writting a program to get the lat-lon of the Nth -grid point. - -

    -The (WE|EW):SN order -is not supported by the ipolates library which does the regridding for -the -new_grid option. The simplest work around is to convert -the grid to a WE:SN order. - -

      Version 0 -
    1. for data in input=WE|EW:SN scan order (wgrib2 IN -scan) -
    2. read data, change order scan order of data, change flag table 3.4, save data -
    3. wgrib2 IN.grb -rpn alt_x_scan -set table_3.4 64 -grib_out OUT.grb -
    - -
      Version 1 -
    1. Read trick 55 in wgrib2 tricks -
    -

    -A variation of the previous trick can be used to put WE:SN data to (WE|EW):SN packing. -

    -See also: --new_grid_format, -new_grid introduction, --new_grid_interpolation, -new_grid order, --new_grid_winds, --new_grid_vectors, --lola, --bin, --import_bin, --rpn, --grib_out, -new_grid multi-core usage, - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modifications: June 17, 2019, Nov 5, 2019, Feb 14, 2020, Feb 2, 2021, June 7, 2021. Feb 2024, april 2024, July 2024 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/new_grid_format.html b/web_docs/new_grid_format.html deleted file mode 100644 index 142bdc3..0000000 --- a/web_docs/new_grid_format.html +++ /dev/null @@ -1,253 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -new_grid_formatr - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid_format -
     
    - -

    wgrib2: -new_grid_format

    -
    - - -

    Introduction

    - -

    -The option -new_grid_format specifies the output format. -for the -new_grid option. -The default is grib, with options for bin and ieee. The bin format is the -machine's native single precision floating point format. The ieee format is -single precision IEEE 754 format. The bin format can have optional f77-style -header. The ieee format be in big endian or little endian with an optional f77-style -header. The formats are the same as produced by --bin and -ieee. -Headers are specified by --header and -no_header. -The ieee format defaults to big endian (network order) and specified by --little_endian and -big_endian. -The f77-style header is prepends and appends a 32-bit integer of the number -of bytes in the data field. The integer is appropriate to the endian of -the data and is stored in the native 32-bit integer format. Outputing in the -ieee format is slower than in the native bin format because there is a conversion -from the native format to ieee even if the native format happens to be ieee. - -

    The output order of the fields may differ from the input order -of the fields. The problem occurs when -new_grid encounters -a vector interpolation. To do a vector interpolation, both the U and V must -be interpolated together. (Vector interpolation is needed so that the winds near the poles remain accurate.) -In order for the input order to be the same as the output order, the V field -must follow the corresponding U field. Wgrib2 allows a -sequence of "U-any number of scalar fields-V" to work with -new_grid -even though it is undocumented. To make sure the the input order is the same -as the output order, make sure V directly follows U, and also make sure you know -which fields are specified to be vector fields. (The default vectors are version specific.) - -

    The -new_grid_format option was introduced with wgrib2 v3.0.0, -for support of the python interface. It requires the IPOLATES library to be set to ip2lib_d -rather than the older iplib library. - -

    Usage

    -

    - -

    --new_grid_format FORMAT
    -                 FORMAT = grib, the output format of -new_grid is grib2 (default)
    -                 FORMAT = bin, the output format is in native single precision format like -bin
    -                 FORMAT = ieee, the output format is in IEEE single precision like -ieee
    -
    - -

    Example

    -

    -

    -    Creates a grib output file "new.grb"
    -
    -$ wgrib2 gep19.aec -for 1:5  -new_grid_winds earth -new_grid ncep grid 3 new.grb
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -2:70707:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    -3:96843:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    -4:125750:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    -5:166391:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    -
    -
    -    Creates a binary formated output file "new.bin", the scan order is we:ns
    -    U and V are paired, so the input order is the same as the output order
    -
    -$ wgrib2 gep19.aec -for 1:5  -new_grid_format bin -new_grid_winds earth -new_grid ncep grid 3 new.bin
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -2:70707:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    -3:96843:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    -4:125750:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    -5:166391:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    -
    -    
    -   Comparing the binary and grib output files.
    -
    -$ wgrib2 new.grb  -rpn sto_0 -import_bin new.bin -rpn 'raw2:rcl_0:print_corr'
    -1:0:rpn_corr=1:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -2:130502:rpn_corr=1:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    -3:203989:rpn_corr=1:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    -4:261186:rpn_corr=1:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    -5:350963:rpn_corr=1:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    -
    -   The binary file was written in we:ns, and -import_bin does not change 
    -   the scan order.  Therefore we have to change the order we:sn by raw2.
    -   rpn_corr=1 .. new.grb == new.bin upto a grib rounding error
    -
    - -See also: --big_endian --bin --header --ieee --little_endian --new_gridr --no_header -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page: Oct 2019 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/new_grid_interpolation.html b/web_docs/new_grid_interpolation.html deleted file mode 100644 index d0d2f71..0000000 --- a/web_docs/new_grid_interpolation.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -new_grid_interpolation - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid_interpolation -
     
    - -

    wgrib2: -new_grid_interpolation

    -
    - - -

    Introduction

    - -

    -The -new_grid_interpolation option selects the type of -interpolation used by the -new_grid option. -The possible values are bilinear, bicubic, nearest neighbor, spectral, neighbor-budget and -budget. The -new_grid_interpolation option must appear before the --new_grid option. If the -new_grid_interpolation -option is not used, the interpolation defaults to bilinear. - -

      -
    1. bilinear, interpolate linearly in X and then linearly in Y -
    2. bicubic, -
    3. nearest neighbor, value of closest source grid point in X-Y space -
    4. budget, make 5x5 grid, find the 25 bilinear values and average -
    5. neighbor-budget, make 5x5 grid, find 25 nearest neighbor values and average -
    6. spectral, convert to spectral space (user specified) and then to grid values -
    - - - -

    Some fields may require different types of interpolation such as the soil type should -be found using a nearest neighbor interpolation. (A fractional soil type is meaningless.) -It is common practice to use -if and -fi options -to control the setting of the the interpolation type as shown by the following command. - -

    -    wgrib2 IN.grb -new_grid_winds earth -new_grid_interpolation bilinear \
    -      -if ":(VGTYP|SOTYP):" -new_grid_interpolation neighbor -fi \
    -      -new_grid latlon 0:360:1 90:181:-1 OUT.grb
    -
    - -

    Budget or neighbor-budget is often used for precipitation in order to -roughly conserve global averages. The budget interpolations are slower -because the output grid cell is covered with a 5x5 grid, and interpolations -are done for each point of the 5x5 grid. So the budget interpolations do -25 times more interpolations. - -

    -Spectral interpolation is specialized interpolation scheme. A global field -is transformed into spherical harmonics (user specified truncation), and -the grid point values are determined from the spherical harmonics. This -interpolation is unlike other interpolation scheme. For example, the -nearest neighbor is based on the 1 grid point, the bilinear internpolation -is based on 4 grid points. The spectral interpolation is based on all -the grid points. So the interpolation scheme will act as noise reduction -when projected to a fewer spherical harmonics than the number of grid points. -

    -The limiting zonal wave number is specified and should not be prime as it makes -the Fast Fourier Transform into a slow -Fourier Transform. The limiting zonal wave number should be a product -of many 2s, 3s, 5s and other small primes. The limiting zonal wave number -may need to be compatible with the Fast Fourier Transform (FFT) code used. - -

    Usage

    -
    --new_grid_interpolation X
    -    X = bilinear, bicubic, neighbor, budget, neighbor-budget, spectral-(trun)(num)
    -         spectral-*  is alpha
    -          
    -
    -        bilinear:          linear interpolation in X and then Y.
    -        neighbor:          Values from nearest grid point.
    -        budget:            Preserves large-scale means. Good for precipitation.
    -        neighbor-budget:   Preserves large-scale means. Good for precipitation.
    -        spectral:          Converts a global field into spectral harmonics
    -                           and derives values from the spectral harmonics.
    -                           trun = 't', 'T', 'r' or 'R' for triangular or rhomboidal trunction
    -                          (num) = max zonal wave number
    -                          The input has to be a global field and contain valid values for all grid points.
    -                          If undefined values are found, bilinear interpolation is used.
    -
    - -See also: -new_grid, --new_grid_winds --new_grid_ipopt --if --fi - -Updated Nov, 2022 -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 2, 2010 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/new_grid_intro.html b/web_docs/new_grid_intro.html deleted file mode 100644 index de345d7..0000000 --- a/web_docs/new_grid_intro.html +++ /dev/null @@ -1,436 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -new_grid intro - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid intro -
     
    - -

    wgrib2: -new_grid intro

    -
    - - -

    Introduction

    - -

    The wgrib2 -new_grid option can regrid grib2 files which means it can convert from one grid -to another. For example, it can change from a global 0.25 degree grid to a -one degree regional grid, or from a Lambert conformal grid to a lat-lon grid. The -new_grid -option can change winds between earth relative and grid relative. You can use -new_grid -to get point values using bilinear interpolation rather than the simple nearest neighbor -interpolation that the -lon uses. - -

    How to Interpolate

    - -

    For many packages, interpolation is simple. You give a field and the desired output -grid. Call the routine with the right arguments and the interpolation is done. No fuss and no mess. -But was there any problems? - -

    Problem 1: Integer values

    -

    Some fields have integer values such as soil type and vegetation type. Fractional -values have no meaning. For such fields, you have to change the interpolation method to -nearest neighbor or most common value. - -

    Problem 2: Vector Fields

    -

    Near the poles, the zonal and meridional winds are discontinous. Methods such as -bilinear interpolation have problems. One method is to convert the winds to vector, -interpolate the vectors, and then convert the interpolated vectors into the zonal -and meridional components. - -

    Problem 3: Global Conservation

    - -

    When changing from one global grid to another global grid, you -don't want to change the global precipitation or other global averages. -The global precipitation is one of the more difficult fields to interpolate -because of the small scale features of the precipitation. - -

    Problem 4: Extreme Values

    - -

    Some fields have physical limatations on the extreme values. For example, -the relative humidity will never be less than 0%, and will not be greater than 100% -except in cases of super-saturation which is unexpected for large-scale fields. -Some interpolation schemes can produce non-physical extreme values in regions of -large gradients. - -

    Problem 5: Ringing

    -

    -Spectral interpolation methods can producing "ringing" because of ->Gibbs phenomenon. - -

    Problem 6: Unequal Variance

    - -

    With bilinear interpolation, the new grid point values -are weighted average of the 4 surrounding grid points. Suppose -we take a simple model: - -

    -   grid_value(i) = LS + e(i)   e(i) = Gaussian random error, mean 0, variance 1
    -      grib_value are the 4 surrouding grids point from the original grid
    -
    -   new_grid_value = LS + sum(i=1..4) (a(i)*e(i))   where a(i) > 0 and sum of a(i) = 1
    -                   = LS + a * e             e = Gaussian random error, mean 0, variance 1, '
    -                                            0.5 <= a <= 1.0
    -
    - -From this simple model, we see that the variance from the LS will vary depending whether the new grid point -is in the exact middle of 4 points (a(i) = 0.25) or coincides with one of the points . This unequal variance can -show up in some calculations. - -

    Problem 7: High to Low Resolutions: What do you want?

    - -

    Suppose your forecast model has a 0.1 degree resolution and you want -to convert it into 1x1 degree grid. Each "grid cell" of the 1x1 degree -grid will have about 100 model grid points. Do you want a grid cell -average (100 model grid points), bilinear interpolation (weighted -average of 4 model grid points) or something else. The grid cell -average will give you the large-scale field appropriate to the output grid. -The bilinear interpolation will include small scales that are not -resolved by the output grid. Some users may want the grid cell average, -some users may want the exact point values. - - -

    How problems are addressed with IPOLATES and wgrib2

    - -

    Answer 1: Integer-valued fields

    - -

    -To interpolate integer-valued fields like vegetation type and soil type, you -add code fragment to wrib2 prior to interpolation; - -

    -  -new_grid_interpolation bilinear \
    -      -if ":(VGTYP|SOTYP):" -new_grid_interpolation neighbor -fi \
    -
    -  This code fragment set the interpolation type to bilinear.  For vegitation 
    -   and soil types, the interpolation is changed to nearest neighbor.
    -
    -
    -

    Answer 2: Scalar vs Vector

    - -

    Wgrib2 has a built-in list of vector fields. This list can be changed by the -the new_grid_vectors option. The vectors -fields will be interpolated using vector interpolation routines in the IPOLATES library. - - -

    Answer 3: Global Conservation

    - -

    To conserve the global mean, the interpolation needs to be changed to "budget" by - -

    --new_grid_interpolation budget
    -
    - -This interpolation scheme figures out the size of the grid cell and divides in to -a 5x5 grid and finds the interpolated value on the 5x5 grid using bilinear interpolation. -The average of the 25 samples becomes the budget value. As you would expect, the budget -interpolation is much slower than the default bilinear interpolation. - -

    Problem 4: Extreme Values

    -

    -To avoid extreme values with non-physical values, you should avoid spectral and -bicubic interpolation methods. - - -

    Answer 5: Ringing

    -

    -Avoid spectral interpolation. - - -

    Answer 6: Unequal Variance

    - -

    Spectral interpolation uses all the input grid points to derive any -particular output grid point. Probably a spectral interpolation with some -spectral truncation will not show this unequal variance. Of course, -answers 4 and 5 suggested that you avoid spectral interpolation, while answer 8 -says the opposite. - - -

    Answer 7: High to Low Resolutions: What do you want?

    - -The answer to problem 7 is to know what you want and choose the -appropriate interpolation method. - -

    Summary: Answers 1-7

    -

    -From answers 1-7, you learn that there is no universal interpolation method. -You need to know your problem and choose the best method for that problem. - -

    - - -

    What are Earth and Grid Relative Winds

    -

    -In school, you learn that north was the direction to the North Pole which -according to Google is a small Alaskan city near Fairbanks. (Google "North -Pole location") The non-numerical weather modellers would define a V -(meridional) wind as a wind that is in the direction of the North Pole. -This definition of North which is referred to as -earth relative. - -

    -When you do numerical modelling, you think in terms of winds into the grid box. -Here you can define north to be from point (i,j) to (i,j+1). It makes life -easier when doing the calculations in the numerical model. The conversion -between earth and grid relative winds requires a rotation of the wind vector -by a location dependant angle. For the lat-lon, Mercator and Gaussian grids, -the grid and earth relative winds are the same. For the polar stereographic, -Lambert Conformal, rotated latlon grids, there is a location dependant rotation -angle. - -

    -Grib specifies whether the vectors are earth or grid relative. To transform -to earth or grid relative winds, you use the --new_grid_winds option. - -Strangely -the grib standard doesn't specify which fields are vectors. - - -

    Specifying Earth vs Grid Relative Winds

    - -

    -It seems obvious that the default would to be regrid should write -earth relative winds. However, I work at NCEP and the default -at NCEP is to use grid relative winds. The only solution is to make -everyone specify whether the output uses earth or grid relative winds. -See. - -

    --new_grid_winds earth
    --new_grid_winds grid
    -
    - -

    Example

    - -The hard part of using the -new_grid option is that meridional component of -the vector must follow the zonal component of the vector. However, - -
    -$ wgrib2 test
    -1:0:d=2015101200:UGRD:1 hybrid level:anl:
    -2:414580:d=2015101200:PRMSL:mean sea level:anl:
    -3:956558:d=2015101200:UGRD:2 hybrid level:anl:
    -4:1357519:d=2015101200:VGRD:2 hybrid level:anl:
    - Note that "UGRD:1 hybrid level" is not followed  by VGRD,
    -    so it will not be interpolated.  "UGRD:2 hybrid level" is followed by VGRD 
    -    and will be interpolated.
    -$ wgrib2 test -new_grid_winds earth -new_grid latlon 0:360:1 -90:181:1 gbl
    -    0:360:1  start at 0E, 360 longitudes at 1 degree spacing
    -    -90:181:1  start at 90S, 181 latitudes at 1 degree spacing 
    -1:0:d=2015101200:UGRD:1 hybrid level:anl:
    -2:414580:d=2015101200:PRMSL:mean sea level:anl:
    --new_grid: missing V, UGRD not interpolated
    - VGRD:1 hybrid level was not found (previous vector)
    -3:956558:d=2015101200:UGRD:2 hybrid level:anl:
    -4:1357519:d=2015101200:VGRD:2 hybrid level:anl:
    -$ wgrib2 gbl
    -1:0:d=2015101200:PRMSL:mean sea level:anl:
    -2:41287:d=2015101200:UGRD:2 hybrid level:anl:
    -3:73163:d=2015101200:VGRD:2 hybrid level:
    - As expected UGRD 1 hybrid level is not regridded
    -$ wgrib2 gbl -d 1 -grid
    -1:0:grid_template=0:winds(N/S):
    -	lat-lon grid:(360 x 181) units 1e-06 input WE:SN output WE:SN res 48
    -	lat -90.000000 to 90.000000 by 1.000000
    - Worked, earth relative winds = winds(N/S) 
    -
    - -

    For of the operational NCEP model grib output, the vector fields are in -the proper order. If the vector fields are not in the correct order, -the vector fields that are not in the correct order will be ignfored -unless they are put into the right order. (See -wgrib2 tricks. If you are lucky, the vector fields that are -not in the right order is something that you don't need such as -gravity wave drag or wind stresses. - -

    Simple Command to Regrid

    -
    -
    - wgrib2 IN.grb -set_grib_type PACKING -new_grid_winds earth -new_grid latlon LON0:NLON:DLON LAT0:NLAT:DLAT
    -
    -    set grib type PACKING
    -        PACKING = s simple, fast, poor compression, very large software support
    -                = c1  complex 1, large software support
    -                = c2  complex 2, large software support
    -                = c3  complex 3, large software support
    -                = j   jpeg2000, slow, very good compression, very large software support
    -                = a   aec, fast, new, small software support
    -     -new_grid_winds earth
    -               set output vectors to earth relative
    -     -new_grid 
    -         latlon = write a lat-lon grid
    -         LON0 = left longitude, 0..360
    -         NLON = number of longitude in grid
    -         DLON = spacing of longitudes (degrees), greater than zero
    -         LAT0 = northern most or southern most latitude of grid
    -         NLAT = number of latitudes
    -         DLAT = spacing of latiudes,
    -                  if LAT0 is the northern most latitude, DLAT should be negative
    -                  if LAT0 is the northern most latitude, DLAT should be positive
    -
    - -

    -This ends this introduction. For more information, see -the regular new_grid documentation, - -

    -See also: --new_grid, --new_grid_interpolation, --new_grid_winds, --new_grid_vectors, --lola, --bin, --import_bin, --rpn, --grib_out, -new_grid multi-core usage, - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page written April 27, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/new_grid_ipopt.html b/web_docs/new_grid_ipopt.html deleted file mode 100644 index 3f522c7..0000000 --- a/web_docs/new_grid_ipopt.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -new_grid_ipopt - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid_ipipt -
     
    - -

    wgrib2: -new_grid_ipopt

    -
    - - -

    Introduction

    - -

    -The -new_grid option interpolates from one grid into another. -The -new_grid_interpolation option selects the interpolation method. -The -new_grid_ipopt option modifies the parameters used by -the interpolation method. -The -new_grid_ipopt option MUST FOLLOW -the -new_grid_interpolation option because the latter will -overwrite the IPOPT values with the default values for that interpolation method. - -

      -
    1. bilinear: ipopt is not used -
    2. bicubic: -
        -
      1. ipopt(1) = 0: straight bicubic -
      2. ipopt(1) = 1: constrained to range of 4 neighboring points -
      3. ipopt(2) = %data converage for output point, default=50% -
      -
    3. nearest neighbor: ipopt is not used -
    4. budget: ipopt is not used -
    5. spectral: (alpha) -
        -
      1. ipopt(1) = 0: triangular truncation -
      2. ipopt(1) = 1: rhomboidal truncation -
      3. ipopt(2) = N: truncation number -
      4. ipopt(2) = -1: sensible truncation number, based on grid - (default for now, will be changed) -
      -
      -    note: should specify these values by -new_grid_interpolation
      - 
      -    when ipopt(2) == -1, sensible trunction number
      -            IROMB = ipopt(1)
      -            IDRT=4 FOR GAUSSIAN GRID
      -            IDRT=0 FOR EQUALLY-SPACED GRID INCLUDING POLES
      -            IDRT=256 FOR EQUALLY-SPACED GRID EXCLUDING POLES
      -
      -            IF(IROMB.EQ.0.AND.IDRTI.EQ.4) MAXWV=(JMAXI-1)
      -            IF(IROMB.EQ.1.AND.IDRTI.EQ.4) MAXWV=(JMAXI-1)/2
      -            IF(IROMB.EQ.0.AND.IDRTI.EQ.0) MAXWV=(JMAXI-3)/2
      -            IF(IROMB.EQ.1.AND.IDRTI.EQ.0) MAXWV=(JMAXI-3)/4
      -            IF(IROMB.EQ.0.AND.IDRTI.EQ.256) MAXWV=(JMAXI-1)/2
      -            IF(IROMB.EQ.1.AND.IDRTI.EQ.256) MAXWV=(JMAXI-1)/4
      -
      -    Note: The values are appropriate for the spectral GFS Gaussian grid
      -          because the grid values were derived from the spherical harmonics.
      -          The values are not appropriate for the FV3 GFS Gaussian grid
      -          because the grid values were derived by a bilinear interpolation
      -          (mostly) from the cubed sphere grid.
      -
      -          Since NCEP is transitioning to a FV3 model, the grid point values
      -          are not the exact representation of the model fields but rather
      -          a bilinear interpolation from the cubed sphere.  So a high-wavenumber
      -          noise is being added to the grid values.  So the appropriate spectral
      -          representation will have filter applied to the spectral represenation.
      -          The math hasn't been worked out.
      -
      - -
    6. neighbor-budget: not enabled by wgrib2 -
    - - -

    Usage

    -
    --new_grid_ipopt X
    -    X = integer or integer:integer
    -
    - -See also: -new_grid, --new_grid_winds --new_grid_vectors -new_grid usage --if --fi -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sept 18, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/new_grid_order.html b/web_docs/new_grid_order.html deleted file mode 100644 index 7a87db6..0000000 --- a/web_docs/new_grid_order.html +++ /dev/null @@ -1,244 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -new_grid_order - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid_order -
     
    - -

    wgrib2: -new_grid_order

    -
    - - -

    Introduction

    - -

    -The option -new_grid requires that the grib -file be processed in a certain order. When vector fields are encountered, -the specifications are that the U field must be followed by the corresponding V field. -(The -new_grid implementation allows any number of scalars to in between the U and -corresponding V fields.) If you do not follow the specification, some U or V -fields may not be interpolated. - -

    -Regridding grib files by the -new_grid is very common, and -a technique have been developed to speed up this task. Basically you put scalar -fields in its own grib message, and corresponding vector fields in their own grib -message (U and V are in submessages). Then you can regrid each grib message independantly. -If you have N cores, you run N copies of wgrib2 that regrids 1/N of the file. -The -new_grid_order is designed to put the data in this structure. - - -

    -The option -new_grid_order rearranges the file so that -the fields follow the specification for use by -new_grid_order. -Note that the order depends on the fields that are specified as vectors by -the -new_grid_vector option. -The output of -new_grid_order puts the U and corresponding V -grib message into the same grib message, like -submsg_uvr. -The vector fields that cannot be pair with the corrsponding U or V fields are written -to a secondary file. - - - -

    Usage

    -

    - -

    --new_grid_order GRIB_A GRIB_B
    -                GRIB_A is a grib output file with data in order compatible with -new_grid
    -                GRIB_B is a grib output file with data that cannot be processed by -new_grid
    -                   because corresponding U or V fields were missing
    -
    - -

    Example

    -

    - -

    -$ wgrib2 gep19.badorder -new_grid_winds earth -new_grid ncep grid 3 test.grb
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -2:70707:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    -3:111348:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    --new_grid: VGRD doesn't pair with previous vector field, field ignored
    -4:137484:d=2009060500:VGRD:250 mb:180 hour fcst:ENS=+19
    -5:182284:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    -6:211191:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    -7:254630:d=2009060500:HGT:250 mb:180 hour fcst:ENS=+19
    -8:325988:d=2009060500:TMP:250 mb:180 hour fcst:ENS=+19
    -9:351022:d=2009060500:UGRD:250 mb:180 hour fcst:ENS=+19
    -10:393024:d=2009060500:RH:250 mb:180 hour fcst:ENS=+19
    -11:424624:d=2009060500:HGT:500 mb:180 hour fcst:ENS=+19
    --new_grid: last field UGRD was not interpolated (missing V)
    -
    -(failed, U and V are not in the proper order)
    -
    -$ wgrib2 gep19.badorder -new_grid_order - junk | \
    -   wgrib2 - -new_grid_winds earth -new_grid ncep grid 3 test.grb
    -1:3:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -2:70820:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19
    -3:97067:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19
    -4.1:126028:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    -4.2:126028:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    -5:210051:d=2009060500:HGT:250 mb:180 hour fcst:ENS=+19
    -6:281464:d=2009060500:TMP:250 mb:180 hour fcst:ENS=+19
    -7.1:306553:d=2009060500:UGRD:250 mb:180 hour fcst:ENS=+19
    -7.2:306553:d=2009060500:VGRD:250 mb:180 hour fcst:ENS=+19
    -8:393299:d=2009060500:RH:250 mb:180 hour fcst:ENS=+19
    -9:424954:d=2009060500:HGT:500 mb:180 hour fcst:ENS=+19
    -
    -(worked)
    -
    - -See also: --new_grid --new_grid_vectors --submsg_uv -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page: Oct 2019 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/new_grid_usage.html b/web_docs/new_grid_usage.html deleted file mode 100644 index 9b68503..0000000 --- a/web_docs/new_grid_usage.html +++ /dev/null @@ -1,285 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -new_grid usage - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid usage -
     
    - -

    wgrib2: -new_grid usage

    -
    - - -

    Introduction

    - -

    -In an operational center, the model output has to be converted -from the model grid to the various user grids. Since the needs of -the users are diverse, there are going to be many different grids. -This page will show the steps for a fast (wall clock) interpolation. - - -

    Step 1: Combine the Vector Quantities

    - -

    -There are two basic types of interpolations, scalar and vector. -Processing can be made faster by combining the vectors into -their own grib message. The following script will -use wgrib2 to put the various vectors into their own grib message. - -

    -#!/bin/sh
    -
    -vectors="UGRD:VGRD:VUCSH:VVCSH:UFLX:VFLX:UGUST:VGUST:USTM:VSTM:VDFUA:VDFVA:MAXUV:MAXVW:UOGRD:VOGRD:UICE:VICE"
    -
    -wgrib2 $1 | sed -e 's/:UGRD:/:UGRDu:/' -e 's/:VGRD:/:UGRDv:/' \
    -     -e 's/:VUCSH:/:VUCSHu:/' -e 's/:VVCSH:/:VUCSHv:/' \
    -     -e 's/:UFLX:/:UFLXu:/' -e 's/:VFLX:/:UFLXv:/' \
    -     -e 's/:UGUST:/:UGUSTu:/' -e 's/:VGUST:/:UGUSTv:/' \
    -     -e 's/:USTM:/:USTMu:/' -e 's/:VSTM:/:USTMv:/' \
    -     -e 's/:VDFUA:/:VDFUAu:/' -e 's/:VDFVA:/:VDFUAv:/' \
    -     -e 's/:MAXUW:/:MAXUWu:/' -e 's/:MAXVW:/:MAXUVv:/' \
    -     -e 's/:UOGRD:/:UOGRDu:/' -e 's/:VOGRD:/:UOGRDv:/' \
    -     -e 's/:UICE:/:UICEu:/' -e 's/:VICE:/:UICEv:/' \
    -| sort -t: -k3,3 -k5 -k4,4 | \
    -        wgrib2 -i -mem_init 0 $1 @mem:0 -new_grid_vectors "$vectors" -submsg_uv $2.tmp
    -
    - -

    -One optimization is "-mem_init 0 $1" in the last wgrib2. This option -reads the file $1 and saves into the memory file "@mem:0". Then wgrib2 processes the memory -file which is much faster than the disk file when doing random access. - - -

    Step 2a: Slow

    - -

    -A typical, one thread, interpolation will look like this, - -

    -config="-new_grid_winds earth -new_grid_interpolation bilinear -if :(VGTYP|SOTYP): -new_grid_interpolation neighbor -fi"
    -vectors="UGRD:VGRD:VUCSH:VVCSH:UFLX:VFLX:UGUST:VGUST:USTM:VSTM:VDFUA:VDFVA:MAXUV:MAXVW:UOGRD:VOGRD:UICE:VICE"
    -grid="latlon 0:360:1 -90:181:1"
    -
    -wgrib2 $2.tmp $config -new_grid_vectors "$vectors" -new_grid $grid $2
    -
    - -

    Step 2b: Faster, Non-operational

    - -

    -Step 1 puts the vector quantities into their own grib message. After Step 1, you can interpolate -all the grib messages independently. This embarrassingy parallel job can be run using the wgrib2mv. -Wgrib2mv is an easy-to-use perl script that runs N copies of wgrib2 and combines the results. Converting -the above wgrib2 script into a parallel command is easy. - -

    -config="-new_grid_winds earth -new_grid_interpolation bilinear -if :(VGTYP|SOTYP): -new_grid_interpolation neighbor -fi "
    -vectors="UGRD:VGRD:VUCSH:VVCSH:UFLX:VFLX:UGUST:VGUST:USTM:VSTM:VDFUA:VDFVA:MAXUV:MAXVW:UOGRD:VOGRD:UICE:VICE"
    -grid="latlon 0:360:1 -90:181:1"
    -
    -wgrib2mv 2 $2.tmp $config -new_grid_vectors "$vectors" -new_grid $grid $2
    -
    - -The only difference between the two script fragments is that "wgrib2" is replaced by "wgrib2mv N". -(N is 2 for this example.) -By using wgrib2mv, you are breaking the interpolation into 2 pieces. Each wgrib2 does 50% of the -interpolations and the program "gmerge" combines the output from the 2 copies of wgrib2. -Wgrib2mv does trivial parallelism and is limited by the number of cores on the node, the speed of -the pipes and I/O speed. - -

    Step 2c: Faster, Operational

    - -

    -Step 2b works on my linux box, why isn't it ready for operations? The perl script, wgrib2mv, -creates temporary files on /tmp which aren't allowed in NCEP operational jobs. Some HPC -machines require you to run the executables on a compute node. For example, the cray machines -require you to use "aprun". Finally the output of wgrib2mv has all the vector quantities -in their own grib message. This unusual configuration will have to be changed for -operations. - -

    The first part is to modify the script from "wgrib2mv 2" to "wgrib2mv -2". (2 is used -in my example.) Now wgrib2mv will write a script fragment, - -

    -export OMP_NUM_THREADS=1
    -mkfifo /tmp/11938.pipe.1.1 /tmp/11938.pipe.1.1.b
    -wgrib2 -inv /dev/null /tmp/11938.pipe.1.1 -new_grid_vectors "UGRD:VGRD:VUCSH:VVCSH:UFLX:VFLX:UGUST:VGUST:
    - USTM:VSTM:VDFUA:VDFVA:MAXUV:MAXVW:UOGRD:VOGRD:UICE:VICE" -submsg_uv /tmp/11938.pipe.1.1.b &
    -mkfifo /tmp/11938.pipe.2.1 /tmp/11938.pipe.2.1.b
    -wgrib2 -inv /dev/null /tmp/11938.pipe.2.1 -new_grid_vectors "UGRD:VGRD:VUCSH:VVCSH:UFLX:VFLX:UGUST:VGUST:
    - USTM:VSTM:VDFUA:VDFVA:MAXUV:MAXVW:UOGRD:VOGRD:UICE:VICE" -submsg_uv /tmp/11938.pipe.2.1.b &
    -gmerge junk.mv  /tmp/11938.pipe.1.1.b /tmp/11938.pipe.2.1.b &
    -wgrib2 -for 1::2 -new_grid_vectors "UGRD:VGRD:VUCSH:VVCSH:UFLX:VFLX:UGUST:VGUST:USTM:VSTM:VDFUA:VDFVA:
    - MAXUV:MAXVW:UOGRD:VOGRD:UICE:VICE" "junk.tmp" "-new_grid_winds" "earth" "-new_grid_interpolation"
    - "bilinear" "-if" ":(VGTYP|SOTYP):" "-new_grid_interpolation" "neighbor" "-fi" "-new_grid" "latlon" "0:360:1" 
    - "-90:181:1" /tmp/11938.pipe.1.1 &
    -wgrib2 -for 2::2 -new_grid_vectors "UGRD:VGRD:VUCSH:VVCSH:UFLX:VFLX:UGUST:VGUST:USTM:VSTM:VDFUA:VDFVA:
    - MAXUV:MAXVW:UOGRD:VOGRD:UICE:VICE" "junk.tmp" "-new_grid_winds" "earth" "-new_grid_interpolation"
    - "bilinear" "-if" ":(VGTYP|SOTYP):" "-new_grid_interpolation" "neighbor" "-fi" "-new_grid" "latlon" "0:360:1" 
    - "-90:181:1" /tmp/11938.pipe.2.1 &
    -wait
    -rm  /tmp/11938.pipe.1.1 /tmp/11938.pipe.1.1.b /tmp/11938.pipe.2.1 /tmp/11938.pipe.2.1.b
    -
    -

    -The number 11938 is the PID (process ID) that ran the wgrib2mv script. The PID was -used to create a unique filename for the various pipes. However, on a multi-node -machine, the PID is no longer a unique value and a different scheme will have to -be used to create unique filenames. - -

    The script fragment should be considered a starting point to writing -a job that will run in operations. On a cray HPC, you will have to translate -the various "(wgrib2/gmerge) ... &" in to a single aprun command. - -

    -See also: -mem_final, - wgrib2mv - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: June 17, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/new_grid_v2.html b/web_docs/new_grid_v2.html deleted file mode 100644 index 773d161..0000000 --- a/web_docs/new_grid_v2.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -new_grid v2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid v2 -
     
    - -

    wgrib2: -new_grid v2

    -
    - - -

    Introduction

    - -

    -Wgrib2 has been using the interpolation library iplib (IPOLATES) in the -new_grid -option. The problem with this library is that it passes angles in millidegrees, does computations -in single precision and is purely spherical. The big problem is not the millidegree limitation -but the single precision limitation as the accuracy is limited to centidegrees in some computations. -With todays models. The next version of this library is called ip2lib and passes angles in microdegrees. -This library only supports a spherical earth. - -

    -Wgrib2 v2.0.8 introduces the compile time option to test -new_grid -with the ip2lib. Unfortunately there isn't the possibilitiy of linking both iplib and ip2lib -because of naming conflicts. So for testing purposes, you should build one version using iplib -and a second using ip2lib. - -

    Differences

    -

    -The first difference is that ip2lib is compiled using double precision math, so the angles -are more precise. The second difference is that WMO-defined rotated lat-lon grids are supported. -The third difference is the code is slower, perhaps 20% slower. - -

    -See also: --new_grid, - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page written April 27, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/new_grid_vectors.html b/web_docs/new_grid_vectors.html deleted file mode 100644 index 75581f2..0000000 --- a/web_docs/new_grid_vectors.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -new_grid_vectors - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid_vectors -
     
    - -

    wgrib2: -new_grid_vectors

    -
    - - -

    Introduction

    - -

    -The -new_grid_winds option selects the wind rotation/orientation -for the -new_grid option. This orientation should apply to all -vector quantities. However, the grib format doesn't have a flag specifying which fields -are vector fields. Sometimes you like to treat vector quanties as scalars because it -makes interpolation easier (for example a time series of tropical U fields). Another -complication is that one often wants to duplicate the default action of copygb -which is to only treat U and V as vectors. - - -

    -The -new_grid_vectors option allows you to select which fields -will be interpolated as vectors. The options are, -

      -
    1. none              -all fields are interpolated as scalars -
    2. UGRD:VGRD  -only UGRD and VGRD are interpolated as vectors (like default copygbfault behavior) -
    3. default (2.0.1 and prior)     UGRD,VGRD,UVCSH,VVCSH,UFLX,VFLX,UGUST, -VGUST,USTM,VSTM,VDFUA,VDFVA,UOGRD,VOGRD are interpolated as vectors -
    4. default (2.0.2)         UGRD,VGRD,UVCSH,VVCSH,UFLX,VFLX,UGUST, -VGUST,USTM,VSTM,VDFUA,VDFVA,UOGRD,VOGRD,MAXUW,MAXVW are interpolated as vectors -
    5. default (2.0.3-2.0.6)         UGRD,VGRD,UVCSH,VVCSH,UFLX,VFLX,UGUST, -VGUST,USTM,VSTM,VDFUA,VDFVA,UOGRD,VOGRD,MAXUW,MAXVW,UICE,VICE,U-GWD,V-GWD -are interpolated as vectors -
    6. default (2.0.7+)         UGRD,VGRD,UVCSH,VVCSH,UFLX,VFLX,UGUST, -VGUST,USTM,VSTM,VDFUA,VDFVA,UOGRD,VOGRD,MAXUW,MAXVW,UICE,VICE,U-GWD,V-GWD,USSD,VSSD -are interpolated as vectors -
    - - -

    Usage

    -
    --new_grid_vectors X
    -    X = none, default, UGRD:VGRD, UV list
    -    example UV list:   "UGRD:VGRD:UICE:VICE"
    -
    - -See also: -new_grid, --new_grid_interpolation -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: June 23,2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/new_grid_winds.html b/web_docs/new_grid_winds.html deleted file mode 100644 index 2056e7f..0000000 --- a/web_docs/new_grid_winds.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -new_grid_winds - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-new_grid_winds -
     
    - -

    wgrib2: -new_grid_winds

    -
    - - -

    Introduction

    - -

    -The -new_grid_winds option selects the wind rotation/orientation -for the -new_grid option. Most users will want the winds -to be oriented to the earth's north and south directions. This is done by using the --new_grid_winds earth option. Many of NCEP grids have the -winds being rotated so that north direction is relative to the grid; i.e., -grid point (i,j) to (i,j+1). For lat-lon, Mercator and Gaussian grids, the grid -and earth relative directions are the same. For the Lambert conformal, polar -stereographic and various rotated grids, the directions are different. -

    -To make the interpolated wind fields have a earth (grid) orientation, you have -to use the -new_grid_winds earth or to use the --new_grid_winds grid option before doing the interpolation. -The exception is the "-new_grid grib". In this case, the grid definition and default -wind rotation is read from a grib file. In this case, a -new_grid_winds option -will override the wind rotation read from the file. - - -

    -The wind orientation applies to all the identified vector fields: -"UGRD", "VGRD", "VUCSH", "VVCSH","UFLX", "VFLX", "UGUST","VGUST","USTM","VSTM","VDFUA", "VDFVA", - "UOGRD","VOGRD". - - - -

    -In the future, the wind orientation will be a part of the -new_grid option. -However, the current systax will still work. - - -

    Usage

    -
    --new_grid_winds X
    -    X = earth, grid
    -
    - -See also: -new_grid, --new_grid_vectors --new_grid_interpolation -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: June 17, 2019 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/nl.html b/web_docs/nl.html deleted file mode 100644 index 8b2ed3e..0000000 --- a/web_docs/nl.html +++ /dev/null @@ -1,189 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -nl - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-nl -
     
    - -

    wgrib2: -nl

    -
    - - -

    Introduction

    - -

    -The -nl option prints a new-line -into the inventory. It is used to make the inventory prettier. -

    - -

    Usage

    - -

    -

    --nl
    -
    - -

    Example

    -
    -$ wgrib2 -gdt png.grb2 -s
    -1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev
    -$ wgrib2 -gdt png.grb2 -s -stats
    -1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev:ndata=65160:undef=0:mean=6.24625:min=0:max=29.3:cos_wt_mean=6.01318
    -$ wgrib2 -gdt png.grb2 -s -nl -stats
    -1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev:
    -:ndata=65160:undef=0:mean=6.24625:min=0:max=29.3:cos_wt_mean=6.01318
    -
    - - -See also: --print -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 30, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/nl_out.html b/web_docs/nl_out.html deleted file mode 100644 index 8b2ed3e..0000000 --- a/web_docs/nl_out.html +++ /dev/null @@ -1,189 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -nl - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-nl -
     
    - -

    wgrib2: -nl

    -
    - - -

    Introduction

    - -

    -The -nl option prints a new-line -into the inventory. It is used to make the inventory prettier. -

    - -

    Usage

    - -

    -

    --nl
    -
    - -

    Example

    -
    -$ wgrib2 -gdt png.grb2 -s
    -1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev
    -$ wgrib2 -gdt png.grb2 -s -stats
    -1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev:ndata=65160:undef=0:mean=6.24625:min=0:max=29.3:cos_wt_mean=6.01318
    -$ wgrib2 -gdt png.grb2 -s -nl -stats
    -1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev:
    -:ndata=65160:undef=0:mean=6.24625:min=0:max=29.3:cos_wt_mean=6.01318
    -
    - - -See also: --print -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 30, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/nlons.html b/web_docs/nlons.html deleted file mode 100644 index 05241ed..0000000 --- a/web_docs/nlons.html +++ /dev/null @@ -1,214 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -nlons - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-nlons -
     
    - -

    wgrib2: -nlons

    -
    - - -

    Introduction

    - -

    -The -nlons option prints the number -of grid points for each row of the grid. This -is necessary for a thinned grid where the number of -grid points per row decreases as you approach the poles. -

    - -

    Usage

    - -

    -

    --nlons
    -
    - -

    Example

    -
    -png.grib is on a 360x181 grid
    -
    -$ wgrib2 -grid png.grb2
    -1:4:grid_template=0:winds(N/S):
    -	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output WE:SN res 48
    -	lat 90.000000 to -90.000000 by 1.000000
    -
    -$ wgrib2 -nlons png.grb2
    -1:4:nlon (S/N)=360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360 360
    -
    -Each row has 360 grid points.
    -
    -reduced_gaussian_surface_jpeg.grib2 is on a Gaussian thinned (reduced) grid.
    -
    -$ wgrib2 reduced_gaussian_surface_jpeg.grib2 -grid
    -bash-4.1$ wgrib2 reduced_gaussian_surface_jpeg.grib2 -grid
    -1:0:grid_template=40:winds(N/S):
    -	thinned global Gaussian grid: (-1 x 64) units 1e-06 input WE:NS output raw
    -:: NX = -1 because the number of grid points varies by latitude
    -	number of latitudes between pole-equator=32 #points=6114
    -	lat 87.864000 to -87.864000
    -	lon 0.000000 to 357.188000 by -2147.483647
    -	#grid points by latitude: 20 27 36 40 45 50 60 64 72 75 80 90 90
    -	 96 100 108 108 120 120 120 128 128 128 128 128 128 128 128 128 128 128 128 128
    -	 128 128 128 128 128 128 128 128 128 128 128 120 120 120 108 108 100 96 90 90
    -	 80 75 72 64 60 50 45 40 36 27 20
    -:: number of grid points varies from 20 to 128.
    -
    -$ wgrib2 reduced_gaussian_surface_jpeg.grib2 -nlons
    -1:0:nlon (S/N)=20 27 36 40 45 50 60 64 72 75 80 90 90 96 100 108 108 120 120 120 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 120 120 120 108 108 100 96 90 90 80 75 72 64 60 50 45 40 36 27 20
    -
    - -See also: --grid -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 30, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/no_append.html b/web_docs/no_append.html deleted file mode 100644 index 0dfb2fd..0000000 --- a/web_docs/no_append.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -append, -no_append - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-append -
     
    - -

    wgrib2: -append, -no_append

    -
    - - -

    Introduction

    - -

    -The -append and -no_append options -sets/clears the append flag. The out options are -expected to respect this flag when opening output files. So an -append option -before writing (-text, -bin, etc) should append to a currently existing file. -The -no_append directs the file to be created before use which is the default. - -

    -$ wgrib2 grb2 -d 1 -append -text all.txt -no_append -text rec.txt
    -
    - -The above line will append record #1 to all.txt and write record #1 to new file rec.txt - -

    Usage

    -

    - -

    --append
    -      append to output files
    -
    --no_append
    -      over-write the output files
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/no_flush.html b/web_docs/no_flush.html deleted file mode 100644 index 76feef7..0000000 --- a/web_docs/no_flush.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -flush -no_flush - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-flush -
     
    - -

    wgrib2: -no_flush

    -
    - - -

    Introduction

    - -

    -The -no_flush option causes wgrib2 to flush -the output buffers when the buffers are full or the program ends. -This is the opposite of the The -flush option. - -

    The only practical use of this option would be in a non-POSIX -system where the flush mode is turned on, you are not using output -pipes, and you wanted to speed up the output. For this option -to be effective, the option has to be the last option that -uses a file. (Opening a file can update the flush mode.) - -

    Usage

    -

    - -

    --no_flush
    -  should the last option
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/no_header.html b/web_docs/no_header.html deleted file mode 100644 index 157c944..0000000 --- a/web_docs/no_header.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -header - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-header/no_header -
     
    - -

    wgrib2: -header, -no_header

    -
    - - -

    Introduction

    - -

    -The -header and --no_header options -sets and clears the header flag. When the -header flag is set, binary and ieee is read and written -using f77-style header and trailers. -When a text file (as opposed to spread sheet or csv) is written, -a preliminary line with the grid dimension, "nx ny", -is written. The default is -header. - - -

    Usage

    -

    - -

    --header
    --no_header
    -
    - -

    Example

    -

    - -

    -$ wgrib2 -ens ens.grb -header -ieee data.ieee
    -1:0:HGT:ENS=+1
    -
    - -See also: --no_header, --big_endian, --little_endian, --ieee, --bin, --import_ieee, --import_bin -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/no_nc_grads.html b/web_docs/no_nc_grads.html deleted file mode 100644 index d396341..0000000 --- a/web_docs/no_nc_grads.html +++ /dev/null @@ -1,552 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -netcdf - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end - -
     
    - -

    wgrib2: -netcdf

    -
    - -

    Introduction

    - -

    -The -netcdf option writes the grid values to a specified -file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator -and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic -projection grids. Other grid templates and projections are not supported yet. - -

    -Default the grid values are written as 4 bytes float having {TIME,LAT,LON} -dimension shape (3D data) and possible vertical LEV information added to the name of variables. -For example, V wind component defined at 10 m level in atmosphere will have default name -VGRD_10maboveground. -With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data -with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical -structure analysis etc. -

    -3D and 4D data could be mixed in the same netcdf file if both have the same horizontal -grid shapes. Practically any number of variables could be placed in to the single netcdf file -as well as time dimension can be almost arbitrary extended. For these purposes -please use the wgrib2 -append option. -All missing values in data are replaced by the _FillValue defined in wgrib2 as -9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. - - - -

    Simple usage

    -

    - -

    --netcdf file_name
    -
    - -

    Example 1

    -

    - -

    -$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    -
    -The above line converts the grib2 file into a netcdf file.
    -
    -
    - -

    Sub-options for -netcdf

    - -

    -Next sub-options could help to customize created netcdf file(s). -All sub-options must preceed the -netcdf option as it is the wgrib2 rule. -More then one -netcdf option could be given on the wgrib2 command line, -please read the documentation for wgrib2. -Almost all sub-options have -no_... version that annulates previous -assignment. -For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table -with the -nc_table sub-option or combine the command line options -with instructions in the -nc_table conversion file. - -

    -The -append option makes possible to create single -large data set for long time series of gridded data. Time dimension of data in the netcdf file -is "unlimited", it could be extended "forward" when adding new data but not "backward" before -the first defined time value. If data for the same time step already exist in the updated -netcdf file these will be silently overwritten. - -

    -The -nc_nlev option is needed to export data to netcdf -as 4D data defined in {TIME,LEV,LAT,LON} space. -It must be followed by integer max_number_of_vertical_levels -which defines the vertical dimension size of 4D data exported to the netcdf file. -This value can not be found from each single grib2 message or sub-message, -usually it has to be scanned the entire grib2 file or even number of files. -It is the reason why the max_number_of_vertical_levels -value must be provided by user. -

    -Grib2 types of vertical levels eligible for export to the netcdf as 4D data -are defined in the wgrib2 internal table and now include next types of GRIB2 levels: -

    -
    -
    20:K level -
    100:pressure level -
    104:sigma level -
    105:hybrid level -
    107:K isentropic level -
    160:ocean depth below sea level -
    -
    -

    -Data for the first found eligible level type are treated as 4D and vertical level -information is not added to the variable names. -Error is generetad if data for other then first found eligible level type -are met in the input stream. -Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space -with the possible level information included into the variable names or with the user-specified names -(see -nc_table option description below for how to do it). -

    -The -nc_nlev option has not -no_... option, -please use instead the max_number_of_vertical_levels equal to 0. -In this case all data from the input stream will be threated as 3D. -

    -When existing netcdf file is updated in the -append mode -the value of max_number_of_vertical_levels must not exceed -initial value provided when the netcdf file was first created (defined). -By default when first creating the netcdf file, vertical level values are not fixed -(are undefined) and these are defined one-by-one when data at new level are added -to the netcdf file, up to the max_number_of_vertical_levels. -To overcome this feature please use the -nc_table option. - -

    -The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is -default and do not assume data packing, only data range is checked. Data outside of -specified range are replaced by missing value code for all types of packing. -This replacement is done in the local copy of unpacked data, so main data array -stays unchanged. -Values of min and max could be any -signed float. Packing is applied to all new variables in the input stream. -If some variable was already defined in the netcdf file and now is appended to it -in the -append mode the initially defined and fixed in the netcdf file -valid range and packing parameters are used. -

    -The packing is possible to the short (2 bytes) -or byte (1 byte) values with potential loss of precision. -Both zero values of min and max -packing parameters for the short or -byte packing activate 'auto' packing when -min and max -values are defined from the first entered field. - -

    -PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file -is open with 'sdfopen' command. But by some reasons using the GrADS -data description file (catalog) for the same netcdf file helps in this situation. - -

    -The -nc_grads option activates some tests for the created -netcdf file to be GrADS (version 1.9b4) compatible, -or to be open by sdfopen in gradsnc or gradsdods. -The GrADS support only COARDS convention netcdf files; -it do not support non-constant data time stepping -and silently generates wrong time stamps for such netcdf files. -Packing to byte also is not directly recognized by GrADS v1.9b4. -With this option an error is raised and processing stops -if any of criterias above is determined. - -

    -The -nc_table option followed by the file_name is most usefull for the advanced users -as it specifies the file where user can customize many features of created netcdf file. -Next examples demonstrate which directives and conversion rules could be given -in the -nc_table file. -Almost all of them are optional with exception of $nlev for the case -when user explicitly specifies the vertical level values $levs. -

    -$lev_type 100:pressure:pressure level:mb:0.01 -

    This directive explicitly defines the type of vertical level -in the grib2 file that becomes eligible for treating data at these levels as 4D data -and some it attributes for netcdf file. -Default, first found level type listed in the wgrib2 build-in table -of eligible levels is selected if no $lev_type directive found. -

    Fields here include: -

    -
    -
    100-the grib2 level type code number -for treating data as 4D. In this example it is the code number for pressure levels, integer -
    pressure- -short_name for the vertical axis in the netcdf file, string -
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces -
    mb-vertical axis units as written in the netcdf file, string -
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file -
    -
    - -$nlev X -

    This directive is an equivalent of the -nc_nlev command line option -but value in the -nc_table file has precedence over the command line option if both are found. -It is required if next $levs directive is specified. -

    - -
    $levs lev(1) lev(2) lev(3)... -
    ...lev(I-1) lev(I) lev(I+1)... -
    ...lev(X-1) lev(X) -
    -

    -This directive explicitly specifies the vertical level values to be exported -to the netcdf file, in the netcdf units. -If this directive exists in the -nc_table file and there is found the grib2 data -eligible for the 4D presentation but defined on other then listed level - -these data are skipped from export and work is silently continued. -All data conversion parameters are checked before the $levs is checked. -List of level values could consist of multiple lines; -max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); -use space, ',', ';' or ':' as lev(i) fields separator. -

    -Impact of $nlev and $levs directives is different depending on -does the netcdf file is first created or it is updated. -When the netcdf file is first created these values are written -to the netcdf file fixing 4D data vertical structure. -When updating an existing netcdf file in the -append mode -these parameters will work like filter limiting possible -updates of 4D data by these that satisfy to the given $levs only and -ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. -

    -The $nlev and $levs directives could be necessary if records -in the grib2 file have randomly changing vertical level values -that makes it impossible sequentionally define valid order of vertical levels. - -

    -$grads 1 -

    This directive is an equivalent of the -nc_grads command line option -if passed value is 1 or to the -no_nc_grads if value is 0. -Directive in the -nc_table file has precedence over the command line option. - -

    -wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] -

    -All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' -are treated as grib2 to netcdf conversion rules for the specified variables. -In these strings the wgib2_name and wgrib2_level -are strings as returned by the wgrib2 inventory; -* used as the wgrib2_level will apply -to all levels not given explicitly. -The valid range and packing information is optional but it overwrites common -packing rule if such is specified by the -nc_pack command line option. -Absence of packing information means no packing for this variable. -Min and max values are any signed float values. Both could be omitted or put to zero. -Last case means that automatic scaling will be estimated from the first entered -wgib2_name field at the wgrib2_level -or at the first level in case of * as level value. -

    -If the keyword ignore is found as a netcdf variable name or -as a packing type value, the corresponding data are ignored -and do not written to the netcdf file. -Impact from this keyword is similar to the wgrib2 -not option -or filtering data with the grep utility. -

    -The ignore keyword is recommended if the data from the same -grib2 file are exported in number of output files (netcdf or other) -by the same wgrib2 process. Then the same decoded data could be passed -for the output in other file of any supported type. -Doing export to the single netcdf file it is not recommended to use the -ignore keyword -as corresponding data are first decoded and after that skipped from writing -to the netcdf file. -

    -In the next example two lines from the -nc_table file instruct -the wgrib2 utility export to the netcdf file the geopotential height changing name -from HGT (wgrib2) to -geopotential in the netcdf file, -at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: -

    -
    -HGT:*:geopotential
    -HGT:975 mb:ignore
    -
    -
    -All other variables not listed in the -nc_table file but found in the input stream -are processed as regular 3D data. - - -

    Example 2

    -

    -Next example shows the content of user-defined -nc_table file -for one special case of Japan Meteorological Agency MSM system grib2 data conversion. -Same -nc_table file includes the rules for -conversion of both 'surface' and upper air data although -the input grib2 files are different. - -

    -
    -#
    -# File name: jma_msm_g2nc.table
    -# Description: Specifies parameters for conversion to Netcdf format
    -# hourly analyses and forecasts of JMA MSM system as best suited to
    -# my purposes: forcing of ocean model and reference data for analysis
    -# of meteorological conditions with GrADS-based visualization tools.
    -# Sergey Varlamov, July 2007
    -#
    -$lev_type  100:p:pressure level:mb:0.01
    -$nlev      16
    -$levs  1000 975 950 925 900 850 800 700 600 500
    -        400 300 250 200 150 100
    -$grads 1
    -#
    -# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    -#
    -UGRD:*:u
    -VGRD:*:v
    -#UGRD:*:u:ignore
    -#VGRD:*:v:ignore
    -TMP:*:temp
    -#write HGT at any level as hgtprs:
    -HGT:*:hgtprs
    -#but skip HGT at 100 mb, now commented - example and test
    -#HGT:100 mb:hgtprs:ignore
    -RH:*:rh:short:-2:110
    -VVEL:*:omega
    -#
    -# JMA MSM model surface data conversion rules
    -#
    -PRMSL:mean sea level:prmsl
    -PRES:surface:prsfc
    -UGRD:10 m above ground:u10m
    -VGRD:10 m above ground:v10m
    -TMP:1.5 m above ground:t2m
    -RH:1.5 m above ground:rh2m:short:-5:110
    -TCDC:surface:ncld:short:-5:110
    -LCDC:surface:ncld_low:short:-5:110
    -MCDC:surface:ncld_mid:short:-5:110
    -HCDC:surface:ncld_upper:short:-5:110
    -APCP:surface:r1h
    -# End of file
    -
    -
    -Using above file we could create the daily file with 3h analyses
    -at the 'surface' layers from the input grib2 files
    -with the next simple shell script:
    -
    -
    -date=20070715
    -for (( j=0; j<=21; j+=3 )) #hour of day loop
    -do
    -  if [ $j -lt  10 ]
    -  then
    -    h=0$j
    -  else
    -    h=$j
    -  fi
    -  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    -
    -  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    -  code=$?
    -  if [ $code -eq 0 ]
    -  then
    -    echo ${date}${h}': created/added to Netcdf'
    -  else
    -    echo ${date}${h}': wgrib2 failed...'
    -    exit $code
    -  fi
    -done
    -
    -
    -Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    -
    -gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    -
    -and change the name for the output file:
    -
    -./msm_s_${date}.nc to the ./msm_p_${date}.nc
    -
    -Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    -utility for data visualization and analyses.
    -
    - -

    Example 3

    - -In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, -convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf -option doesn't support appending, the netcdf conversion cannot be in a loop. - -
    -Version 1, using loops and a temporary file
    -
    -rm tempfile
    -for f in gfs.t00z.pgrb2f[01]?
    -do
    -   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    -done
    -wgrib2 tempfile -netcdf ~/myfile.nc
    -rm tempfile
    -
    -Version 2, data-flow 
    -
    -1:   cat gfs.t00z.pgrb2f[01]? | \
    -2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    -3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    -4:   wgrib2 - -netcdf ~/myfile.nc
    -
    -
    -Line 1 (cat), takes all the desired grib files and writes to stdout
    -Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    -Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    -Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    -
    -

    -See also: --bin, --ieee --text --spread - --append -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan. 27, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/no_nc_pack.html b/web_docs/no_nc_pack.html deleted file mode 100644 index d396341..0000000 --- a/web_docs/no_nc_pack.html +++ /dev/null @@ -1,552 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -netcdf - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end - -
     
    - -

    wgrib2: -netcdf

    -
    - -

    Introduction

    - -

    -The -netcdf option writes the grid values to a specified -file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator -and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic -projection grids. Other grid templates and projections are not supported yet. - -

    -Default the grid values are written as 4 bytes float having {TIME,LAT,LON} -dimension shape (3D data) and possible vertical LEV information added to the name of variables. -For example, V wind component defined at 10 m level in atmosphere will have default name -VGRD_10maboveground. -With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data -with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical -structure analysis etc. -

    -3D and 4D data could be mixed in the same netcdf file if both have the same horizontal -grid shapes. Practically any number of variables could be placed in to the single netcdf file -as well as time dimension can be almost arbitrary extended. For these purposes -please use the wgrib2 -append option. -All missing values in data are replaced by the _FillValue defined in wgrib2 as -9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. - - - -

    Simple usage

    -

    - -

    --netcdf file_name
    -
    - -

    Example 1

    -

    - -

    -$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    -
    -The above line converts the grib2 file into a netcdf file.
    -
    -
    - -

    Sub-options for -netcdf

    - -

    -Next sub-options could help to customize created netcdf file(s). -All sub-options must preceed the -netcdf option as it is the wgrib2 rule. -More then one -netcdf option could be given on the wgrib2 command line, -please read the documentation for wgrib2. -Almost all sub-options have -no_... version that annulates previous -assignment. -For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table -with the -nc_table sub-option or combine the command line options -with instructions in the -nc_table conversion file. - -

    -The -append option makes possible to create single -large data set for long time series of gridded data. Time dimension of data in the netcdf file -is "unlimited", it could be extended "forward" when adding new data but not "backward" before -the first defined time value. If data for the same time step already exist in the updated -netcdf file these will be silently overwritten. - -

    -The -nc_nlev option is needed to export data to netcdf -as 4D data defined in {TIME,LEV,LAT,LON} space. -It must be followed by integer max_number_of_vertical_levels -which defines the vertical dimension size of 4D data exported to the netcdf file. -This value can not be found from each single grib2 message or sub-message, -usually it has to be scanned the entire grib2 file or even number of files. -It is the reason why the max_number_of_vertical_levels -value must be provided by user. -

    -Grib2 types of vertical levels eligible for export to the netcdf as 4D data -are defined in the wgrib2 internal table and now include next types of GRIB2 levels: -

    -
    -
    20:K level -
    100:pressure level -
    104:sigma level -
    105:hybrid level -
    107:K isentropic level -
    160:ocean depth below sea level -
    -
    -

    -Data for the first found eligible level type are treated as 4D and vertical level -information is not added to the variable names. -Error is generetad if data for other then first found eligible level type -are met in the input stream. -Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space -with the possible level information included into the variable names or with the user-specified names -(see -nc_table option description below for how to do it). -

    -The -nc_nlev option has not -no_... option, -please use instead the max_number_of_vertical_levels equal to 0. -In this case all data from the input stream will be threated as 3D. -

    -When existing netcdf file is updated in the -append mode -the value of max_number_of_vertical_levels must not exceed -initial value provided when the netcdf file was first created (defined). -By default when first creating the netcdf file, vertical level values are not fixed -(are undefined) and these are defined one-by-one when data at new level are added -to the netcdf file, up to the max_number_of_vertical_levels. -To overcome this feature please use the -nc_table option. - -

    -The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is -default and do not assume data packing, only data range is checked. Data outside of -specified range are replaced by missing value code for all types of packing. -This replacement is done in the local copy of unpacked data, so main data array -stays unchanged. -Values of min and max could be any -signed float. Packing is applied to all new variables in the input stream. -If some variable was already defined in the netcdf file and now is appended to it -in the -append mode the initially defined and fixed in the netcdf file -valid range and packing parameters are used. -

    -The packing is possible to the short (2 bytes) -or byte (1 byte) values with potential loss of precision. -Both zero values of min and max -packing parameters for the short or -byte packing activate 'auto' packing when -min and max -values are defined from the first entered field. - -

    -PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file -is open with 'sdfopen' command. But by some reasons using the GrADS -data description file (catalog) for the same netcdf file helps in this situation. - -

    -The -nc_grads option activates some tests for the created -netcdf file to be GrADS (version 1.9b4) compatible, -or to be open by sdfopen in gradsnc or gradsdods. -The GrADS support only COARDS convention netcdf files; -it do not support non-constant data time stepping -and silently generates wrong time stamps for such netcdf files. -Packing to byte also is not directly recognized by GrADS v1.9b4. -With this option an error is raised and processing stops -if any of criterias above is determined. - -

    -The -nc_table option followed by the file_name is most usefull for the advanced users -as it specifies the file where user can customize many features of created netcdf file. -Next examples demonstrate which directives and conversion rules could be given -in the -nc_table file. -Almost all of them are optional with exception of $nlev for the case -when user explicitly specifies the vertical level values $levs. -

    -$lev_type 100:pressure:pressure level:mb:0.01 -

    This directive explicitly defines the type of vertical level -in the grib2 file that becomes eligible for treating data at these levels as 4D data -and some it attributes for netcdf file. -Default, first found level type listed in the wgrib2 build-in table -of eligible levels is selected if no $lev_type directive found. -

    Fields here include: -

    -
    -
    100-the grib2 level type code number -for treating data as 4D. In this example it is the code number for pressure levels, integer -
    pressure- -short_name for the vertical axis in the netcdf file, string -
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces -
    mb-vertical axis units as written in the netcdf file, string -
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file -
    -
    - -$nlev X -

    This directive is an equivalent of the -nc_nlev command line option -but value in the -nc_table file has precedence over the command line option if both are found. -It is required if next $levs directive is specified. -

    - -
    $levs lev(1) lev(2) lev(3)... -
    ...lev(I-1) lev(I) lev(I+1)... -
    ...lev(X-1) lev(X) -
    -

    -This directive explicitly specifies the vertical level values to be exported -to the netcdf file, in the netcdf units. -If this directive exists in the -nc_table file and there is found the grib2 data -eligible for the 4D presentation but defined on other then listed level - -these data are skipped from export and work is silently continued. -All data conversion parameters are checked before the $levs is checked. -List of level values could consist of multiple lines; -max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); -use space, ',', ';' or ':' as lev(i) fields separator. -

    -Impact of $nlev and $levs directives is different depending on -does the netcdf file is first created or it is updated. -When the netcdf file is first created these values are written -to the netcdf file fixing 4D data vertical structure. -When updating an existing netcdf file in the -append mode -these parameters will work like filter limiting possible -updates of 4D data by these that satisfy to the given $levs only and -ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. -

    -The $nlev and $levs directives could be necessary if records -in the grib2 file have randomly changing vertical level values -that makes it impossible sequentionally define valid order of vertical levels. - -

    -$grads 1 -

    This directive is an equivalent of the -nc_grads command line option -if passed value is 1 or to the -no_nc_grads if value is 0. -Directive in the -nc_table file has precedence over the command line option. - -

    -wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] -

    -All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' -are treated as grib2 to netcdf conversion rules for the specified variables. -In these strings the wgib2_name and wgrib2_level -are strings as returned by the wgrib2 inventory; -* used as the wgrib2_level will apply -to all levels not given explicitly. -The valid range and packing information is optional but it overwrites common -packing rule if such is specified by the -nc_pack command line option. -Absence of packing information means no packing for this variable. -Min and max values are any signed float values. Both could be omitted or put to zero. -Last case means that automatic scaling will be estimated from the first entered -wgib2_name field at the wgrib2_level -or at the first level in case of * as level value. -

    -If the keyword ignore is found as a netcdf variable name or -as a packing type value, the corresponding data are ignored -and do not written to the netcdf file. -Impact from this keyword is similar to the wgrib2 -not option -or filtering data with the grep utility. -

    -The ignore keyword is recommended if the data from the same -grib2 file are exported in number of output files (netcdf or other) -by the same wgrib2 process. Then the same decoded data could be passed -for the output in other file of any supported type. -Doing export to the single netcdf file it is not recommended to use the -ignore keyword -as corresponding data are first decoded and after that skipped from writing -to the netcdf file. -

    -In the next example two lines from the -nc_table file instruct -the wgrib2 utility export to the netcdf file the geopotential height changing name -from HGT (wgrib2) to -geopotential in the netcdf file, -at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: -

    -
    -HGT:*:geopotential
    -HGT:975 mb:ignore
    -
    -
    -All other variables not listed in the -nc_table file but found in the input stream -are processed as regular 3D data. - - -

    Example 2

    -

    -Next example shows the content of user-defined -nc_table file -for one special case of Japan Meteorological Agency MSM system grib2 data conversion. -Same -nc_table file includes the rules for -conversion of both 'surface' and upper air data although -the input grib2 files are different. - -

    -
    -#
    -# File name: jma_msm_g2nc.table
    -# Description: Specifies parameters for conversion to Netcdf format
    -# hourly analyses and forecasts of JMA MSM system as best suited to
    -# my purposes: forcing of ocean model and reference data for analysis
    -# of meteorological conditions with GrADS-based visualization tools.
    -# Sergey Varlamov, July 2007
    -#
    -$lev_type  100:p:pressure level:mb:0.01
    -$nlev      16
    -$levs  1000 975 950 925 900 850 800 700 600 500
    -        400 300 250 200 150 100
    -$grads 1
    -#
    -# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    -#
    -UGRD:*:u
    -VGRD:*:v
    -#UGRD:*:u:ignore
    -#VGRD:*:v:ignore
    -TMP:*:temp
    -#write HGT at any level as hgtprs:
    -HGT:*:hgtprs
    -#but skip HGT at 100 mb, now commented - example and test
    -#HGT:100 mb:hgtprs:ignore
    -RH:*:rh:short:-2:110
    -VVEL:*:omega
    -#
    -# JMA MSM model surface data conversion rules
    -#
    -PRMSL:mean sea level:prmsl
    -PRES:surface:prsfc
    -UGRD:10 m above ground:u10m
    -VGRD:10 m above ground:v10m
    -TMP:1.5 m above ground:t2m
    -RH:1.5 m above ground:rh2m:short:-5:110
    -TCDC:surface:ncld:short:-5:110
    -LCDC:surface:ncld_low:short:-5:110
    -MCDC:surface:ncld_mid:short:-5:110
    -HCDC:surface:ncld_upper:short:-5:110
    -APCP:surface:r1h
    -# End of file
    -
    -
    -Using above file we could create the daily file with 3h analyses
    -at the 'surface' layers from the input grib2 files
    -with the next simple shell script:
    -
    -
    -date=20070715
    -for (( j=0; j<=21; j+=3 )) #hour of day loop
    -do
    -  if [ $j -lt  10 ]
    -  then
    -    h=0$j
    -  else
    -    h=$j
    -  fi
    -  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    -
    -  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    -  code=$?
    -  if [ $code -eq 0 ]
    -  then
    -    echo ${date}${h}': created/added to Netcdf'
    -  else
    -    echo ${date}${h}': wgrib2 failed...'
    -    exit $code
    -  fi
    -done
    -
    -
    -Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    -
    -gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    -
    -and change the name for the output file:
    -
    -./msm_s_${date}.nc to the ./msm_p_${date}.nc
    -
    -Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    -utility for data visualization and analyses.
    -
    - -

    Example 3

    - -In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, -convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf -option doesn't support appending, the netcdf conversion cannot be in a loop. - -
    -Version 1, using loops and a temporary file
    -
    -rm tempfile
    -for f in gfs.t00z.pgrb2f[01]?
    -do
    -   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    -done
    -wgrib2 tempfile -netcdf ~/myfile.nc
    -rm tempfile
    -
    -Version 2, data-flow 
    -
    -1:   cat gfs.t00z.pgrb2f[01]? | \
    -2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    -3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    -4:   wgrib2 - -netcdf ~/myfile.nc
    -
    -
    -Line 1 (cat), takes all the desired grib files and writes to stdout
    -Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    -Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    -Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    -
    -

    -See also: --bin, --ieee --text --spread - --append -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan. 27, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/no_nc_table.html b/web_docs/no_nc_table.html deleted file mode 100644 index d396341..0000000 --- a/web_docs/no_nc_table.html +++ /dev/null @@ -1,552 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -netcdf - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end - -
     
    - -

    wgrib2: -netcdf

    -
    - -

    Introduction

    - -

    -The -netcdf option writes the grid values to a specified -file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator -and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic -projection grids. Other grid templates and projections are not supported yet. - -

    -Default the grid values are written as 4 bytes float having {TIME,LAT,LON} -dimension shape (3D data) and possible vertical LEV information added to the name of variables. -For example, V wind component defined at 10 m level in atmosphere will have default name -VGRD_10maboveground. -With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data -with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical -structure analysis etc. -

    -3D and 4D data could be mixed in the same netcdf file if both have the same horizontal -grid shapes. Practically any number of variables could be placed in to the single netcdf file -as well as time dimension can be almost arbitrary extended. For these purposes -please use the wgrib2 -append option. -All missing values in data are replaced by the _FillValue defined in wgrib2 as -9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. - - - -

    Simple usage

    -

    - -

    --netcdf file_name
    -
    - -

    Example 1

    -

    - -

    -$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    -
    -The above line converts the grib2 file into a netcdf file.
    -
    -
    - -

    Sub-options for -netcdf

    - -

    -Next sub-options could help to customize created netcdf file(s). -All sub-options must preceed the -netcdf option as it is the wgrib2 rule. -More then one -netcdf option could be given on the wgrib2 command line, -please read the documentation for wgrib2. -Almost all sub-options have -no_... version that annulates previous -assignment. -For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table -with the -nc_table sub-option or combine the command line options -with instructions in the -nc_table conversion file. - -

    -The -append option makes possible to create single -large data set for long time series of gridded data. Time dimension of data in the netcdf file -is "unlimited", it could be extended "forward" when adding new data but not "backward" before -the first defined time value. If data for the same time step already exist in the updated -netcdf file these will be silently overwritten. - -

    -The -nc_nlev option is needed to export data to netcdf -as 4D data defined in {TIME,LEV,LAT,LON} space. -It must be followed by integer max_number_of_vertical_levels -which defines the vertical dimension size of 4D data exported to the netcdf file. -This value can not be found from each single grib2 message or sub-message, -usually it has to be scanned the entire grib2 file or even number of files. -It is the reason why the max_number_of_vertical_levels -value must be provided by user. -

    -Grib2 types of vertical levels eligible for export to the netcdf as 4D data -are defined in the wgrib2 internal table and now include next types of GRIB2 levels: -

    -
    -
    20:K level -
    100:pressure level -
    104:sigma level -
    105:hybrid level -
    107:K isentropic level -
    160:ocean depth below sea level -
    -
    -

    -Data for the first found eligible level type are treated as 4D and vertical level -information is not added to the variable names. -Error is generetad if data for other then first found eligible level type -are met in the input stream. -Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space -with the possible level information included into the variable names or with the user-specified names -(see -nc_table option description below for how to do it). -

    -The -nc_nlev option has not -no_... option, -please use instead the max_number_of_vertical_levels equal to 0. -In this case all data from the input stream will be threated as 3D. -

    -When existing netcdf file is updated in the -append mode -the value of max_number_of_vertical_levels must not exceed -initial value provided when the netcdf file was first created (defined). -By default when first creating the netcdf file, vertical level values are not fixed -(are undefined) and these are defined one-by-one when data at new level are added -to the netcdf file, up to the max_number_of_vertical_levels. -To overcome this feature please use the -nc_table option. - -

    -The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is -default and do not assume data packing, only data range is checked. Data outside of -specified range are replaced by missing value code for all types of packing. -This replacement is done in the local copy of unpacked data, so main data array -stays unchanged. -Values of min and max could be any -signed float. Packing is applied to all new variables in the input stream. -If some variable was already defined in the netcdf file and now is appended to it -in the -append mode the initially defined and fixed in the netcdf file -valid range and packing parameters are used. -

    -The packing is possible to the short (2 bytes) -or byte (1 byte) values with potential loss of precision. -Both zero values of min and max -packing parameters for the short or -byte packing activate 'auto' packing when -min and max -values are defined from the first entered field. - -

    -PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file -is open with 'sdfopen' command. But by some reasons using the GrADS -data description file (catalog) for the same netcdf file helps in this situation. - -

    -The -nc_grads option activates some tests for the created -netcdf file to be GrADS (version 1.9b4) compatible, -or to be open by sdfopen in gradsnc or gradsdods. -The GrADS support only COARDS convention netcdf files; -it do not support non-constant data time stepping -and silently generates wrong time stamps for such netcdf files. -Packing to byte also is not directly recognized by GrADS v1.9b4. -With this option an error is raised and processing stops -if any of criterias above is determined. - -

    -The -nc_table option followed by the file_name is most usefull for the advanced users -as it specifies the file where user can customize many features of created netcdf file. -Next examples demonstrate which directives and conversion rules could be given -in the -nc_table file. -Almost all of them are optional with exception of $nlev for the case -when user explicitly specifies the vertical level values $levs. -

    -$lev_type 100:pressure:pressure level:mb:0.01 -

    This directive explicitly defines the type of vertical level -in the grib2 file that becomes eligible for treating data at these levels as 4D data -and some it attributes for netcdf file. -Default, first found level type listed in the wgrib2 build-in table -of eligible levels is selected if no $lev_type directive found. -

    Fields here include: -

    -
    -
    100-the grib2 level type code number -for treating data as 4D. In this example it is the code number for pressure levels, integer -
    pressure- -short_name for the vertical axis in the netcdf file, string -
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces -
    mb-vertical axis units as written in the netcdf file, string -
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file -
    -
    - -$nlev X -

    This directive is an equivalent of the -nc_nlev command line option -but value in the -nc_table file has precedence over the command line option if both are found. -It is required if next $levs directive is specified. -

    - -
    $levs lev(1) lev(2) lev(3)... -
    ...lev(I-1) lev(I) lev(I+1)... -
    ...lev(X-1) lev(X) -
    -

    -This directive explicitly specifies the vertical level values to be exported -to the netcdf file, in the netcdf units. -If this directive exists in the -nc_table file and there is found the grib2 data -eligible for the 4D presentation but defined on other then listed level - -these data are skipped from export and work is silently continued. -All data conversion parameters are checked before the $levs is checked. -List of level values could consist of multiple lines; -max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); -use space, ',', ';' or ':' as lev(i) fields separator. -

    -Impact of $nlev and $levs directives is different depending on -does the netcdf file is first created or it is updated. -When the netcdf file is first created these values are written -to the netcdf file fixing 4D data vertical structure. -When updating an existing netcdf file in the -append mode -these parameters will work like filter limiting possible -updates of 4D data by these that satisfy to the given $levs only and -ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. -

    -The $nlev and $levs directives could be necessary if records -in the grib2 file have randomly changing vertical level values -that makes it impossible sequentionally define valid order of vertical levels. - -

    -$grads 1 -

    This directive is an equivalent of the -nc_grads command line option -if passed value is 1 or to the -no_nc_grads if value is 0. -Directive in the -nc_table file has precedence over the command line option. - -

    -wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] -

    -All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' -are treated as grib2 to netcdf conversion rules for the specified variables. -In these strings the wgib2_name and wgrib2_level -are strings as returned by the wgrib2 inventory; -* used as the wgrib2_level will apply -to all levels not given explicitly. -The valid range and packing information is optional but it overwrites common -packing rule if such is specified by the -nc_pack command line option. -Absence of packing information means no packing for this variable. -Min and max values are any signed float values. Both could be omitted or put to zero. -Last case means that automatic scaling will be estimated from the first entered -wgib2_name field at the wgrib2_level -or at the first level in case of * as level value. -

    -If the keyword ignore is found as a netcdf variable name or -as a packing type value, the corresponding data are ignored -and do not written to the netcdf file. -Impact from this keyword is similar to the wgrib2 -not option -or filtering data with the grep utility. -

    -The ignore keyword is recommended if the data from the same -grib2 file are exported in number of output files (netcdf or other) -by the same wgrib2 process. Then the same decoded data could be passed -for the output in other file of any supported type. -Doing export to the single netcdf file it is not recommended to use the -ignore keyword -as corresponding data are first decoded and after that skipped from writing -to the netcdf file. -

    -In the next example two lines from the -nc_table file instruct -the wgrib2 utility export to the netcdf file the geopotential height changing name -from HGT (wgrib2) to -geopotential in the netcdf file, -at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: -

    -
    -HGT:*:geopotential
    -HGT:975 mb:ignore
    -
    -
    -All other variables not listed in the -nc_table file but found in the input stream -are processed as regular 3D data. - - -

    Example 2

    -

    -Next example shows the content of user-defined -nc_table file -for one special case of Japan Meteorological Agency MSM system grib2 data conversion. -Same -nc_table file includes the rules for -conversion of both 'surface' and upper air data although -the input grib2 files are different. - -

    -
    -#
    -# File name: jma_msm_g2nc.table
    -# Description: Specifies parameters for conversion to Netcdf format
    -# hourly analyses and forecasts of JMA MSM system as best suited to
    -# my purposes: forcing of ocean model and reference data for analysis
    -# of meteorological conditions with GrADS-based visualization tools.
    -# Sergey Varlamov, July 2007
    -#
    -$lev_type  100:p:pressure level:mb:0.01
    -$nlev      16
    -$levs  1000 975 950 925 900 850 800 700 600 500
    -        400 300 250 200 150 100
    -$grads 1
    -#
    -# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    -#
    -UGRD:*:u
    -VGRD:*:v
    -#UGRD:*:u:ignore
    -#VGRD:*:v:ignore
    -TMP:*:temp
    -#write HGT at any level as hgtprs:
    -HGT:*:hgtprs
    -#but skip HGT at 100 mb, now commented - example and test
    -#HGT:100 mb:hgtprs:ignore
    -RH:*:rh:short:-2:110
    -VVEL:*:omega
    -#
    -# JMA MSM model surface data conversion rules
    -#
    -PRMSL:mean sea level:prmsl
    -PRES:surface:prsfc
    -UGRD:10 m above ground:u10m
    -VGRD:10 m above ground:v10m
    -TMP:1.5 m above ground:t2m
    -RH:1.5 m above ground:rh2m:short:-5:110
    -TCDC:surface:ncld:short:-5:110
    -LCDC:surface:ncld_low:short:-5:110
    -MCDC:surface:ncld_mid:short:-5:110
    -HCDC:surface:ncld_upper:short:-5:110
    -APCP:surface:r1h
    -# End of file
    -
    -
    -Using above file we could create the daily file with 3h analyses
    -at the 'surface' layers from the input grib2 files
    -with the next simple shell script:
    -
    -
    -date=20070715
    -for (( j=0; j<=21; j+=3 )) #hour of day loop
    -do
    -  if [ $j -lt  10 ]
    -  then
    -    h=0$j
    -  else
    -    h=$j
    -  fi
    -  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    -
    -  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    -  code=$?
    -  if [ $code -eq 0 ]
    -  then
    -    echo ${date}${h}': created/added to Netcdf'
    -  else
    -    echo ${date}${h}': wgrib2 failed...'
    -    exit $code
    -  fi
    -done
    -
    -
    -Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    -
    -gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    -
    -and change the name for the output file:
    -
    -./msm_s_${date}.nc to the ./msm_p_${date}.nc
    -
    -Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    -utility for data visualization and analyses.
    -
    - -

    Example 3

    - -In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, -convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf -option doesn't support appending, the netcdf conversion cannot be in a loop. - -
    -Version 1, using loops and a temporary file
    -
    -rm tempfile
    -for f in gfs.t00z.pgrb2f[01]?
    -do
    -   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    -done
    -wgrib2 tempfile -netcdf ~/myfile.nc
    -rm tempfile
    -
    -Version 2, data-flow 
    -
    -1:   cat gfs.t00z.pgrb2f[01]? | \
    -2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    -3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    -4:   wgrib2 - -netcdf ~/myfile.nc
    -
    -
    -Line 1 (cat), takes all the desired grib files and writes to stdout
    -Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    -Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    -Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    -
    -

    -See also: --bin, --ieee --text --spread - --append -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan. 27, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/no_nc_time.html b/web_docs/no_nc_time.html deleted file mode 100644 index d396341..0000000 --- a/web_docs/no_nc_time.html +++ /dev/null @@ -1,552 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -netcdf - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-end - -
     
    - -

    wgrib2: -netcdf

    -
    - -

    Introduction

    - -

    -The -netcdf option writes the grid values to a specified -file in netcdf format using COARDS convention for the Latitude-Longitude, Mercator -and Gaussian grids and the CF-1.0 convention for Lambert and Polar stereographic -projection grids. Other grid templates and projections are not supported yet. - -

    -Default the grid values are written as 4 bytes float having {TIME,LAT,LON} -dimension shape (3D data) and possible vertical LEV information added to the name of variables. -For example, V wind component defined at 10 m level in atmosphere will have default name -VGRD_10maboveground. -With some minimal efforts and using the sub-options described below it is also possible to write data as a 4D data -with the {TIME,LEV,LAT,LON} dimension shape that could be usefull for the vertical -structure analysis etc. -

    -3D and 4D data could be mixed in the same netcdf file if both have the same horizontal -grid shapes. Practically any number of variables could be placed in to the single netcdf file -as well as time dimension can be almost arbitrary extended. For these purposes -please use the wgrib2 -append option. -All missing values in data are replaced by the _FillValue defined in wgrib2 as -9.999e+20 for the float data, 32767 for short-packed data and 127 for byte-packed data. - - - -

    Simple usage

    -

    - -

    --netcdf file_name
    -
    - -

    Example 1

    -

    - -

    -$ wgrib2 ../example/eta.t00z.awphys18.grb2 -netcdf eta.nc
    -
    -The above line converts the grib2 file into a netcdf file.
    -
    -
    - -

    Sub-options for -netcdf

    - -

    -Next sub-options could help to customize created netcdf file(s). -All sub-options must preceed the -netcdf option as it is the wgrib2 rule. -More then one -netcdf option could be given on the wgrib2 command line, -please read the documentation for wgrib2. -Almost all sub-options have -no_... version that annulates previous -assignment. -For the advanced users it is recommended to use the GRIB2 to NETCDF conversion table -with the -nc_table sub-option or combine the command line options -with instructions in the -nc_table conversion file. - -

    -The -append option makes possible to create single -large data set for long time series of gridded data. Time dimension of data in the netcdf file -is "unlimited", it could be extended "forward" when adding new data but not "backward" before -the first defined time value. If data for the same time step already exist in the updated -netcdf file these will be silently overwritten. - -

    -The -nc_nlev option is needed to export data to netcdf -as 4D data defined in {TIME,LEV,LAT,LON} space. -It must be followed by integer max_number_of_vertical_levels -which defines the vertical dimension size of 4D data exported to the netcdf file. -This value can not be found from each single grib2 message or sub-message, -usually it has to be scanned the entire grib2 file or even number of files. -It is the reason why the max_number_of_vertical_levels -value must be provided by user. -

    -Grib2 types of vertical levels eligible for export to the netcdf as 4D data -are defined in the wgrib2 internal table and now include next types of GRIB2 levels: -

    -
    -
    20:K level -
    100:pressure level -
    104:sigma level -
    105:hybrid level -
    107:K isentropic level -
    160:ocean depth below sea level -
    -
    -

    -Data for the first found eligible level type are treated as 4D and vertical level -information is not added to the variable names. -Error is generetad if data for other then first found eligible level type -are met in the input stream. -Data on the non-eligible levels are treated as 3D data defined in the {TIME,LAT,LON} space -with the possible level information included into the variable names or with the user-specified names -(see -nc_table option description below for how to do it). -

    -The -nc_nlev option has not -no_... option, -please use instead the max_number_of_vertical_levels equal to 0. -In this case all data from the input stream will be threated as 3D. -

    -When existing netcdf file is updated in the -append mode -the value of max_number_of_vertical_levels must not exceed -initial value provided when the netcdf file was first created (defined). -By default when first creating the netcdf file, vertical level values are not fixed -(are undefined) and these are defined one-by-one when data at new level are added -to the netcdf file, up to the max_number_of_vertical_levels. -To overcome this feature please use the -nc_table option. - -

    -The -nc_pack option makes it possible to limit the range of defined values and pack data in the netcdf file specifying data range and packing type as min:max[:float|byte|short]. Type float here is -default and do not assume data packing, only data range is checked. Data outside of -specified range are replaced by missing value code for all types of packing. -This replacement is done in the local copy of unpacked data, so main data array -stays unchanged. -Values of min and max could be any -signed float. Packing is applied to all new variables in the input stream. -If some variable was already defined in the netcdf file and now is appended to it -in the -append mode the initially defined and fixed in the netcdf file -valid range and packing parameters are used. -

    -The packing is possible to the short (2 bytes) -or byte (1 byte) values with potential loss of precision. -Both zero values of min and max -packing parameters for the short or -byte packing activate 'auto' packing when -min and max -values are defined from the first entered field. - -

    -PS: packing in 'byte' is not directly accepted by GrADS v1.9b4 if netcdf file -is open with 'sdfopen' command. But by some reasons using the GrADS -data description file (catalog) for the same netcdf file helps in this situation. - -

    -The -nc_grads option activates some tests for the created -netcdf file to be GrADS (version 1.9b4) compatible, -or to be open by sdfopen in gradsnc or gradsdods. -The GrADS support only COARDS convention netcdf files; -it do not support non-constant data time stepping -and silently generates wrong time stamps for such netcdf files. -Packing to byte also is not directly recognized by GrADS v1.9b4. -With this option an error is raised and processing stops -if any of criterias above is determined. - -

    -The -nc_table option followed by the file_name is most usefull for the advanced users -as it specifies the file where user can customize many features of created netcdf file. -Next examples demonstrate which directives and conversion rules could be given -in the -nc_table file. -Almost all of them are optional with exception of $nlev for the case -when user explicitly specifies the vertical level values $levs. -

    -$lev_type 100:pressure:pressure level:mb:0.01 -

    This directive explicitly defines the type of vertical level -in the grib2 file that becomes eligible for treating data at these levels as 4D data -and some it attributes for netcdf file. -Default, first found level type listed in the wgrib2 build-in table -of eligible levels is selected if no $lev_type directive found. -

    Fields here include: -

    -
    -
    100-the grib2 level type code number -for treating data as 4D. In this example it is the code number for pressure levels, integer -
    pressure- -short_name for the vertical axis in the netcdf file, string -
    pressure level-long_name for the vertical axis in the netcdf file, string, could include spaces -
    mb-vertical axis units as written in the netcdf file, string -
    0.01-decimal scale to convert grib2 level values to the netcdf-stored values, float. In this example we convert Pa to mb (hPa). It is default conversion scale for the pressure levels when exporting to the netcdf file -
    -
    - -$nlev X -

    This directive is an equivalent of the -nc_nlev command line option -but value in the -nc_table file has precedence over the command line option if both are found. -It is required if next $levs directive is specified. -

    - -
    $levs lev(1) lev(2) lev(3)... -
    ...lev(I-1) lev(I) lev(I+1)... -
    ...lev(X-1) lev(X) -
    -

    -This directive explicitly specifies the vertical level values to be exported -to the netcdf file, in the netcdf units. -If this directive exists in the -nc_table file and there is found the grib2 data -eligible for the 4D presentation but defined on other then listed level - -these data are skipped from export and work is silently continued. -All data conversion parameters are checked before the $levs is checked. -List of level values could consist of multiple lines; -max line length in the -nc_table file is limited by _MAX_PATH symbols (about 255 symbols); -use space, ',', ';' or ':' as lev(i) fields separator. -

    -Impact of $nlev and $levs directives is different depending on -does the netcdf file is first created or it is updated. -When the netcdf file is first created these values are written -to the netcdf file fixing 4D data vertical structure. -When updating an existing netcdf file in the -append mode -these parameters will work like filter limiting possible -updates of 4D data by these that satisfy to the given $levs only and -ignoring other. 3D (TIME,LAT,LON) data are not affected by these directives. -

    -The $nlev and $levs directives could be necessary if records -in the grib2 file have randomly changing vertical level values -that makes it impossible sequentionally define valid order of vertical levels. - -

    -$grads 1 -

    This directive is an equivalent of the -nc_grads command line option -if passed value is 1 or to the -no_nc_grads if value is 0. -Directive in the -nc_table file has precedence over the command line option. - -

    -wgib2_name:wgrib2_level|*:nc_name|ignore[:ignore|no|float|short|byte[:min:max]] -

    -All non-empty lines in the -nc_table file not starting from the '$' symbol or from the comment mark '#' -are treated as grib2 to netcdf conversion rules for the specified variables. -In these strings the wgib2_name and wgrib2_level -are strings as returned by the wgrib2 inventory; -* used as the wgrib2_level will apply -to all levels not given explicitly. -The valid range and packing information is optional but it overwrites common -packing rule if such is specified by the -nc_pack command line option. -Absence of packing information means no packing for this variable. -Min and max values are any signed float values. Both could be omitted or put to zero. -Last case means that automatic scaling will be estimated from the first entered -wgib2_name field at the wgrib2_level -or at the first level in case of * as level value. -

    -If the keyword ignore is found as a netcdf variable name or -as a packing type value, the corresponding data are ignored -and do not written to the netcdf file. -Impact from this keyword is similar to the wgrib2 -not option -or filtering data with the grep utility. -

    -The ignore keyword is recommended if the data from the same -grib2 file are exported in number of output files (netcdf or other) -by the same wgrib2 process. Then the same decoded data could be passed -for the output in other file of any supported type. -Doing export to the single netcdf file it is not recommended to use the -ignore keyword -as corresponding data are first decoded and after that skipped from writing -to the netcdf file. -

    -In the next example two lines from the -nc_table file instruct -the wgrib2 utility export to the netcdf file the geopotential height changing name -from HGT (wgrib2) to -geopotential in the netcdf file, -at all levels except at 975 mb if these data would be found in the grib2 decoded input data stream: -

    -
    -HGT:*:geopotential
    -HGT:975 mb:ignore
    -
    -
    -All other variables not listed in the -nc_table file but found in the input stream -are processed as regular 3D data. - - -

    Example 2

    -

    -Next example shows the content of user-defined -nc_table file -for one special case of Japan Meteorological Agency MSM system grib2 data conversion. -Same -nc_table file includes the rules for -conversion of both 'surface' and upper air data although -the input grib2 files are different. - -

    -
    -#
    -# File name: jma_msm_g2nc.table
    -# Description: Specifies parameters for conversion to Netcdf format
    -# hourly analyses and forecasts of JMA MSM system as best suited to
    -# my purposes: forcing of ocean model and reference data for analysis
    -# of meteorological conditions with GrADS-based visualization tools.
    -# Sergey Varlamov, July 2007
    -#
    -$lev_type  100:p:pressure level:mb:0.01
    -$nlev      16
    -$levs  1000 975 950 925 900 850 800 700 600 500
    -        400 300 250 200 150 100
    -$grads 1
    -#
    -# Upper air data on pressure levels, 05.2007 - 16 pressure levels
    -#
    -UGRD:*:u
    -VGRD:*:v
    -#UGRD:*:u:ignore
    -#VGRD:*:v:ignore
    -TMP:*:temp
    -#write HGT at any level as hgtprs:
    -HGT:*:hgtprs
    -#but skip HGT at 100 mb, now commented - example and test
    -#HGT:100 mb:hgtprs:ignore
    -RH:*:rh:short:-2:110
    -VVEL:*:omega
    -#
    -# JMA MSM model surface data conversion rules
    -#
    -PRMSL:mean sea level:prmsl
    -PRES:surface:prsfc
    -UGRD:10 m above ground:u10m
    -VGRD:10 m above ground:v10m
    -TMP:1.5 m above ground:t2m
    -RH:1.5 m above ground:rh2m:short:-5:110
    -TCDC:surface:ncld:short:-5:110
    -LCDC:surface:ncld_low:short:-5:110
    -MCDC:surface:ncld_mid:short:-5:110
    -HCDC:surface:ncld_upper:short:-5:110
    -APCP:surface:r1h
    -# End of file
    -
    -
    -Using above file we could create the daily file with 3h analyses
    -at the 'surface' layers from the input grib2 files
    -with the next simple shell script:
    -
    -
    -date=20070715
    -for (( j=0; j<=21; j+=3 )) #hour of day loop
    -do
    -  if [ $j -lt  10 ]
    -  then
    -    h=0$j
    -  else
    -    h=$j
    -  fi
    -  gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_Lsurf_FH00-15_grib2.bin
    -
    -  wgrib2 $gpath -match ":anl:" -nc_table ./jma_msm_g2nc.table -append -netcdf ./msm_s_${date}.nc
    -  code=$?
    -  if [ $code -eq 0 ]
    -  then
    -    echo ${date}${h}': created/added to Netcdf'
    -  else
    -    echo ${date}${h}': wgrib2 failed...'
    -    exit $code
    -  fi
    -done
    -
    -
    -Or create the netcdf file with the 4D 3h analyses at 16 pressure levels if replace:
    -
    -gpath=../example/Z__C_RJTD_${date}${h}0000_MSM_GPV_Rjp_L-pall_FH00-15_grib2.bin
    -
    -and change the name for the output file:
    -
    -./msm_s_${date}.nc to the ./msm_p_${date}.nc
    -
    -Resulting netcdf files could be used directly at least from the GrADS (gradsnc or gradsdods)
    -utility for data visualization and analyses.
    -
    - -

    Example 3

    - -In this example, we want to take some grib files, extract the 200, 500 and 700 height fields, -convert to a regional subset and finally convert it into a netcdf file. Since the -netcdf -option doesn't support appending, the netcdf conversion cannot be in a loop. - -
    -Version 1, using loops and a temporary file
    -
    -rm tempfile
    -for f in gfs.t00z.pgrb2f[01]?
    -do
    -   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -append -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 tempfile
    -done
    -wgrib2 tempfile -netcdf ~/myfile.nc
    -rm tempfile
    -
    -Version 2, data-flow 
    -
    -1:   cat gfs.t00z.pgrb2f[01]? | \
    -2:   wgrib2 - -match ':HGT:' -match ':(200|500|700) mb:'  -inv /dev/null \
    -3:      -new_grid_winds earth -new_grid latlon 0:40:2 20:20:2 - | \
    -4:   wgrib2 - -netcdf ~/myfile.nc
    -
    -
    -Line 1 (cat), takes all the desired grib files and writes to stdout
    -Line 2 (wgrib2), reads the grib file from stdin and selects the desired fields
    -Line 3 (-new_grid), is a continuation of the wgrib2 command and writes the new grid to stdout
    -Line 4 (wgrib2), reads the new grid from stdin and writes out a netcdf file (myfile.nc)
    -
    -

    -See also: --bin, --ieee --text --spread - --append -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan. 27, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/not.html b/web_docs/not.html deleted file mode 100644 index cf41e28..0000000 --- a/web_docs/not.html +++ /dev/null @@ -1,242 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -not - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-not -
     
    - -

    wgrib2: -not

    -
    - - -

    Introduction

    - -

    -The -not option selects records which should -be processed. The -not is a not --match. When multiple -match/-not options are -used, all must be satisfied. - - -

    -
    -    wgrib2 -not X (...)
    -
    -is the same as 
    -
    -    wgrib2 -match_inv file | egrep -v X | wgrib2 -i (...)
    -
    -
    -
    -    wgrib2 -match X  -not Y (...)
    -
    -is the same as 
    -
    -    wgrib2 -match_inv file | egrep X | egrep -v Y | wgrib2 -i (...)
    -
    -where X, and Y are regular expressions.  Note, X and Y will not match 
    -the second (byte location) field of the short inventory.
    -
    -
    - -

    Usage

    -

    - -

    --not X
    -
    -X is a POSIX extended regular expression
    -
    - -

    - -The -match, and -not selection -facility is more limited than the "wgrib2 | filter | wgrib2 -i" syntax. -However, it can be more efficient especially when combined with the --end option. - -

    Future Changes

    -

    -The format of the "match inventory" has evolved and will continue to evolve. -The rule for future changes is that new items in the "match inventory" will be added -as the second last item. Consequently the last item in the inventory will always -be ":vt=YYYYMMDDHH:". In order to future proof your --match, and -not selections, you -must not include any item before the ":vt=YYYYMMDD:" field. - -

    -    -match ":vt=2011111500:"                  good
    -    -not ":vt=2011111500:$"                   good (dollar sign matches the end of the line)
    -    -not ":n=10:vt=2011111500:"               bad (item before :vt=)
    -    -match ":RH:975 mb:anl::vt=2010050806:"   bad (item before :vt=)
    -
    - -Some recent changes (as of Nov 2011) to the match inventory include: - -
      -
    • adding the "extended name of the variable", ex. TMP.prob_<273 -
    • adding the inventory number, ex. n=10 -
    • adding ensemble/chemical/probability information (-misc) -
    - - -

    -See also: -not_if, --not_fs, --match, --match_fs, --match_inv, --end, --i, --if, --set_regex. -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Nov 16, 2011 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/not_fs.html b/web_docs/not_fs.html deleted file mode 100644 index 5da4b94..0000000 --- a/web_docs/not_fs.html +++ /dev/null @@ -1,240 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -not_fs - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-not_fs -
     
    - -

    wgrib2: -not_fs

    -
    - - -

    Introduction

    - -

    -The -not option and the -not_fs option -are very similar. The -not_fs is a not --match_fs. The difference between --not and -not_fs is the the former -uses (extended) regular expressions and the latter uses "Fixed Strings" (fs). - -

    -
    -    wgrib2 -not_fs X (...)
    -
    -is the same as 
    -
    -    wgrib2 -match_inv file | fgrep -v X | wgrib2 -i (...)
    -
    -    wgrib2 -match_fs X  -not_fs Y (...)
    -
    -is the same as 
    -
    -    wgrib2 -match_inv file | fgrep X | fgrep -v Y | wgrib2 -i (...)
    -
    -where X, and Y are strings. Note, X and Y will not match 
    -the second (byte location) field of the short inventory.
    -
    -
    - -

    Usage

    -

    - -

    --not_fs X
    -
    -X is string
    -
    - -

    - -The -match, and -not selection -facility is more limited than the "wgrib2 | filter | wgrib2 -i" syntax. -However, it can be more efficient especially when combined with the --end option. - -

    Future Changes

    -

    -The format of the "match inventory" has evolved and will continue to evolve. -The rule for future changes is that new items in the "match inventory" will be added -as the second last item. Consequently the last item in the inventory will always -be ":vt=YYYYMMDDHH:". In order to future proof your --match, and -not selections, you -must not include any item before the ":vt=YYYYMMDD:" field. - -

    -    -match ":vt=2011111500:"                  good
    -    -not ":vt=2011111500:$"                   good (dollar sign matches the end of the line)
    -    -not ":n=10:vt=2011111500:"               bad (item before :vt=)
    -    -match ":RH:975 mb:anl::vt=2010050806:"   bad (item before :vt=)
    -
    - -Some recent changes (as of Nov 2011) to the match inventory include: - -
      -
    • adding the "extended name of the variable", ex. TMP.prob_<273 -
    • adding the inventory number, ex. n=10 -
    • adding ensemble/chemical/probability information (-misc) -
    - - -

    -See also: - -not, - -not_if, --match, --match_inv, --end, --i, --if, --set_regex. -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 7, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/not_if.html b/web_docs/not_if.html deleted file mode 100644 index 794540c..0000000 --- a/web_docs/not_if.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -not_if - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-not_if -
     
    - -

    wgrib2: -not_if

    -
    - - -

    Introduction

    - -

    -The -not_if option returns true or false and is the start of the IF -block structure. The - -not_if option is like the - -if option except the results are reversed. -For example, - -if ':HGT:' is true if the match inventory contains the string ':HGT:', and -the next block is executed. The option -not_if ':HGT:' does the opposite -and does not execute the next block. -See -if for details about the IF block structure. - - -

    Usage

    -

    - -

    --not_if X
    -   X is a regular expression
    -   returns true if X is not in the match inventory, false otherwise
    -
    - - - -

    -See also: -not, --end, --i, --if, --if_fs, --match, --match_inv, --not_if_fs, --fi. --endif. --else. --set_regex. -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 8, 2015, March 16, 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/not_if_fs.html b/web_docs/not_if_fs.html deleted file mode 100644 index 232b1e8..0000000 --- a/web_docs/not_if_fs.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -if_fs, -not_if_fs - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -if_fs,-not_if_fs -
     
    - -

    wgrib2: -if_fs, -not_if_fs

    -
    - - -

    Introduction

    - -

    -The -if_fs option is the same as the -the -if option except it takes "fixed strings" -rather than extended regular expressions. The same hold -for the -not_if_fs and -not_if options. - -

    Usage

    -

    - -

    --if_fs X
    --not_if_fs X
    -
    -X is a fixed string (not a regular expression)
    -
    - - - -

    -See also: -if, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/npts.html b/web_docs/npts.html deleted file mode 100644 index ea246c2..0000000 --- a/web_docs/npts.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -npts - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-npts -
     
    - -

    wgrib2: -npts

    -
    - - -

    Introduction

    - -

    -The -npts option prints the number of grid points -in the grid. The total include both defined and undefined grid points. - -

    --sh-2.05b$ ./wgrib2 test.grb2 -s -npts -d 1
    -1:0:d=2005090200:HGT:1000 mb:60 hour fcst:npts=259920
    -
    - -

    Usage

    -

    - -

    --npts
    -
    - -See also: -nxny -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/number_of_coordinate_values_after_template.html b/web_docs/number_of_coordinate_values_after_template.html deleted file mode 100644 index 3352573..0000000 --- a/web_docs/number_of_coordinate_values_after_template.html +++ /dev/null @@ -1,226 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -number_of_coordinate_values_after_template - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-number_of_coordinate_values_after_template -
     
    - -

    wgrib2: -number_of_coordinate_values_after_template

    -
    - - -

    Introduction

    - -

    -Vertical coordinates can be easy like "400 hPa", "2 meters above ground" or -"sigma=0.4". However, the situation is more complicated with the vertical -coordinates in the models. In these model coordinates, the -vertical are usually an integer. You need some extra information to locate -the level in physical space. This information is stored in the PDT (section -4) as the "optional list of coordinate values" at the end of the product -defintion template. -

    -The -number_of_coordinate_values_after_template option -prints the number of values (4 byte) in the "optional list of coordinate values". -The WMO documentation only specifies the hybrid coordinate values should be -in pairs of IEEE single precision floats. -

    - -

    Usage

    -

    - -

    --number_of_coordinate_values_after_template
    -   prints section 4, octets 6-7 as an unsigned integer
    -   it is expected that each value uses 4 octets of storage a the end of Section 4.
    -
    - -

    Example

    -

    - -

    -$  wgrib2 -number_of_coordinate_values_after_template COSMO_EU_1rec.grib2 -get_byte 4 6 2
    -1:0:number_coordinates_values_in_pdt=45:4-6=0,45
    -
    -
    -

    -See also: -

    - - - - - - - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - - - -

    -See also: -undefine -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: August 15, 2014, July 2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/nxny.html b/web_docs/nxny.html deleted file mode 100644 index cb40b20..0000000 --- a/web_docs/nxny.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -nxny - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-nxny -
     
    - -

    wgrib2: -nxny

    -
    - - -

    Introduction

    - -

    -The -nxny option prints the size of a "rectangular" grid. -Of course not all grids are rectangular. - -

    -$ ./wgrib2 test.grb2 -s -nxny -d 1
    -1:0:d=2005090200:HGT:1000 mb:60 hour fcst:(720 x 361)
    -
    -The above grid is a 0.5 x 0.5 degree global grid. - -
    -$ ./wgrib2 ../ecmwf/gaussian_reduced.grib2 -s -nxny -d 1
    -1:0:d=2006081712:var discipline=0 master_table=4 parmcat=0 parm=0:500 mb:12 hour 
    -fcst:(-1 x 800)
    -
    - -Here, the thinned Gaussian grid has 800 latitudes and a varying number -of longitude points. - -

    Usage

    -

    - -

    --nxny
    -
    - -See also: -npts -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/one_line.html b/web_docs/one_line.html deleted file mode 100644 index c0b232e..0000000 --- a/web_docs/one_line.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -one_line - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-one_line -
     
    - -

    wgrib2: -one_line

    -
    - - -

    Introduction

    - -

    -The -one_line option changes the format of the inventory -so all the items are one line. This is useful in using -grid, for example, in -making inventories that can be grepped. - -

    -Suppose we want select fields by the grid type. -

    --sh-2.05b$ ./wgrib2 eta.t00z.awphys18.grb2 -d 1 -s -grid
    -1:0:d=2003090300:MSLET:mean sea level:18 hour fcst:grid_template=30:
    -        Lambert Conformal: (614 x 428) scan WE:SN res 8
    -        Lat1 12.19 Lon1 226.541 Lov 265
    -        Latin1 25 Latin2 25 LatSP 0 LonSP 0
    -              North Pole (614 x 428) Dx 12.191 Dy 12.191 mode 8
    -
    -The above format doesn't work with grep. By using the -one_line option, -we can easily extract specific grids. -
    --sh-2.05b$ ./wgrib2 eta.t00z.awphys18.grb2 -d 1 -s -grid -one_line
    -1:0:d=2003090300:MSLET:mean sea level:18 hour fcst:grid_template=30: 
    -Lambert Conformal: (614 x 428) scan WE:SN res 8 Lat1 12.19 Lon1 226.541 
    -Lov 265 Latin1 25 Latin2 25 LatSP 0 LonSP 0       North Pole (614 x 428) 
    -Dx 12.191 Dy 12.191 mode 8
    -
    - -

    Usage

    -

    - -

    --one_line
    -      change format so that all the information/field is on one line
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/openmp.html b/web_docs/openmp.html deleted file mode 100644 index 49b05da..0000000 --- a/web_docs/openmp.html +++ /dev/null @@ -1,254 +0,0 @@ - - - - Climate Prediction Center - wgrib2: all about OpenMP - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 all about OpenMP -
     
    - -

    wgrib2: all about OpenMP

    -
    - - -

    Introduction

    - -

    -Wgrib2 needs to run fast, and the only way to make wgrib2 run fast -is to use multiple cores. Wgrib2 uses "OpenMP" to multithread its -calculations. Some parts of wgrib2 are scalar (jpeg2000, -I/O) and see no speedup for using mutiple cores. While other parts -(-new_grid, -ens_processing, complex unpacking) see large speedups. -Much effort has been made to parallelize time-consuming parts -of the code. In order to use OpenMP, the compilers must support -at least OpenMP v3.1. Some additional speedups can be obtained -by compiling with AVX512 or AVX2 enabled and using a version of -OpenMP that supports SIMD. -

    -To check that your wgrib2 executable is OpenMP enabled, examine -the output of $ wgrib2 -config - -

    -ebis@landing2:~$ wgrib2 -config
    -wgrib2 v3.1.4beta1 11/2023  Wesley Ebisuzaki, Reinoud Bokhorst, John Howard, Jaakko Hyvätti, Dusan Jovic, Daniel Lee, Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Gregor Schee, Arlindo da Silva, Niklas Sondell, Sam Trahan, George Trojan, Sergey Varlamov
    -..
    -OpenMP: control number of threads with environment variable OMP_NUM_THREADS
    -..
    -
    - -If you don't have the line "OpenMP: control ..", then your copy of wgrib2 is not OpenMP enabled. - -

    Using OpenMP

    -

    -You control the number of cores that OpenMP-enabled programs will use by the -environment variable OPM_NUM_THREADS. - -

    -bash, sh
    -   $ export OMP_NUM_THREADS=4
    -csh
    -   $ setenv OMP_NUM_THREADS 4
    -
    -

    -There is no hard-and-fast rule for the optimum number of -threads to allocate to wgrib2. For example, if I am -running 4 copies of wgrib2 on a 4 core cpu, I would -set OMP_NUM_THREADS to 1. If I am running wgrib2 on -a 128 core CPU with 30 other users, I may set OMP_NUM_THREADS -to 4. Generally the wgrib2 speed up is minimal for greater -than 5 cores unless you are in heavy compute options -that are well parallelized such as -new_grid and -ens_processing. - - -

    -Wgrib2 uses 1 core in serial sections of the code and up -to OMP_NUM_THREADS in the parallel sections of the code. -Under normal situations, you want the unused cores -(up to OMP_NUM_THREADS-1) to be made available for other -jobs. You do this by - -

    -bash, sh
    -  $ export OMP_WAIT_POLICY=PASSIVE
    -csh
    -  $ setenv OMP_WAIT_POLICY PASSIVE
    -
    - -

    -On a HPC node where your jobs have sole use of the -(physical) CPU, you may want to set the OMP_WAIT_POLICY to ACTIVE. - -

    -ncpu

    -The environment variable $OMP_NUM_THREADS can be overridden by the -option -ncpu N. -

    - -

    SIMD

    -

    -OpenMP v4.0+ supports SIMD. The current wgrib2 (5/2024) prefers -multi-threading over SIMD because multi-threading can be used -in more cases and SIMD has a limited vector length. There are -a limited number of cases where the outer loop is parallelized -by multi-threading and the inner loop is parallelized by SIMD. -It is hard to generalize about speed of multi-threading vs -SIMD. Multi-threading could have speed advantages when more -than two memory controllers are present. -

    -To best take advantage of SIMD, wgrib2 should be compiled with -AVX-512 or AVX2 enabled (x86 cpus). - -

    -See also: -ncpu, -speed, - - - - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: June 2024 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/order.html b/web_docs/order.html deleted file mode 100644 index 495d540..0000000 --- a/web_docs/order.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -order - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-order -
     
    - -

    wgrib2: -order

    -
    - - -

    Introduction

    - -

    -Grids can be stored in GRIB files in one of 16 different orders. -The default configure is for wgrib2 to convert all data into WE:SN order. -That is, the first point is at the bottom left, the second point is -to the right and so on until it finishes up the row. Then the next point -is slightly north of the first point and the process repeats until -the NE point of the grid is reached. - -

    The -order raw option keeps the data in -the original order as specified the grib header. Note, latitude, -longitude is available when the data are in we:sn order. - -

    -You must use the default -order we:sn option -in order to get latitude, longitude information. - - -

    --order raw
    -      data is the order as specified by the grib file
    -      this was the order that wgrib used
    -
    --order we:ns
    -      data is in WE:NS order
    -
    --order we:sn
    -      data is in WE:SN order (default)
    -
    - -See also: --scan, - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/packing.html b/web_docs/packing.html deleted file mode 100644 index 279a177..0000000 --- a/web_docs/packing.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -packing - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-packing -
     
    - -

    wgrib2: -packing

    -
    - - -

    Introduction

    - -

    -The grib format is for storing gridded data. Usually gridded data is -stored as an scaled integer that has been packed or compressed. -Exceptions are spectral data and tabular data (data are entries to a -table). -

    - -

    -The -packing option shows how the gridded -data was packed. The most common packing methods are jpeg2000, -one of the various complex packing schemes. If you increase -the verbosity by -v -packing, you -see the packing method, scaling factors and range of possible -integers. -

    - - -

    Usage

    - -

    -

    --packing
    -
    - -

    Example

    -
    -$ wgrib2 png.grb2 -packing
    -bash-4.1$ wgrib2 png.grb2 -packing
    -1:4:packing=grid point data - png compression,_
    -$ wgrib2 png.grb2 -v -packing
    -bash-4.1$ wgrib2 png.grb2 -v -packing
    -1:4:packing=grid point data - png compression,_ val=(0+i*2^0)*10^-1, i=0..65535 (#bits=16)
    -
    -The file, png.grb2, was packed using the obsolete png compression. The
    -grid point values can have the values (0+i*2^0)*10^-1 where i is an integer 
    -that ranges from 0..65535.
    -
    -$ wgrib2 small.grb2 -packing
    -1:0:packing=grid point data - simple packing,s
    -$ wgrib2 small.grb2 -v -packing
    -1:0:packing=grid point data - simple packing,s val=(1.22666e+06+i*2^2)*10^-2, i=0..4095 (#bits=12)
    -
    -The file small.grb2 is using simple packing, integers are stored using 
    -12 bits (#bits=12). The grid points can have values of (1.22666e+06+i*2^2)*10^-2 
    -where i is an integer that ranges from 0..4095.
    -
    - - -See also: - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 30, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/pds_fcst_time.html b/web_docs/pds_fcst_time.html deleted file mode 100644 index bf03c98..0000000 --- a/web_docs/pds_fcst_time.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -pds_fcst_time - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-pds_fcst_time -
     
    - -

    wgrib2: -pds_fcst_time

    -
    - - -

    Introduction

    - -

    -Most grib messages include a forecast time which is stored -in the Product Definition Templates (PDT). When the PDT -has a forecast time, it stores the number as a 4 byte -integer and the units in Code Table 4.4. For example, -a 12 hour forecast could be stored with the number 12 -and the units of 1 which corresponds hour. Note that -the same forecast time can be stored in several ways. -For example, 12 hours can be stored as -

      -
    • value=720 , units = 0 (minutes) -
    • value=12 , units = 1 (hours) -
    • value=4 , units = 10 (3-hours) -
    • value=2 , units = 11 (6-hours) -
    • value=1 , units = 12 (12-hours) -
    • value=43299, units = 13 (seconds) -
    - -The unusual 3-hour, 6-hour and 12-hour time units are a legacy -of the grib version 1 standard. Note that the value is - a signed integer because the grib standard allows negative -forecast hours which can make sense in data assimilation. - -

    -The -pds_fcst_time option prints out the -value of the forecast time and the --code_table_4.4 option prints out the -units of the forecast time. - - -

    Usage

    -
    --pds_fcst_time
    -
    - -

    Example

    -
    -$ wgrib2 percentile_precip.grib2 -s -pds_fcst_time -code_table_4.4
    -1:0:d=2014101012:TPRATE:surface:2@1 hour max(13-14 hour acc fcst)++,missing=0:75% level:pds_fcst_time1=13:code table 4.4=1 (hour)
    -2:315649:d=2014101012:TPRATE:surface:2@1 hour max(13-14 hour acc fcst)++,missing=0:90% level:pds_fcst_time1=13:code table 4.4=1 (hour)
    -
    - - -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Oct 16, 2017. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/pdt.html b/web_docs/pdt.html deleted file mode 100644 index 604a51e..0000000 --- a/web_docs/pdt.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -pdt - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-pdt -
     
    - -

    wgrib2: -pdt

    -
    - - -

    Introduction

    - -

    -Section 4 contains the product definition template (PDT) -and the -pdt option prints the PDT. -

    -

    -The -pdt option is an alias to - -code_table_4.0t. -

    - -

    Usage

    - -

    -

    --pdt
    -
    - -

    Example

    -
    -$ wgrib2 -pdt png.grb2
    -1:4:code table 4.0=2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time.
    -
    - - -See also: --Sec4, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 30, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/persistent.html b/web_docs/persistent.html deleted file mode 100644 index 52ffbf1..0000000 --- a/web_docs/persistent.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lon - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-persistent -
     
    - -

    wgrib2: -persistent

    -
    - - -

    Introduction

    - -

    -When wgrib2 opens a file, the file may be marked as persistent or -transient. If a file is marked as transient, wgrib2 will close -the file as part of its normal "finalize" procedure. If a file -is marked as persistent, the file will closed when the system -terminates the program. If you run the wgrib2 utility, it makes -no difference who closes the files. However, when you use the -C/Fortran API, it makes a major difference. When you write -C/Fortran programs that calls the wgrib2 API, you may want to -use the same file thousands of times. It is better to open -the file once rather than thousands of times. -The -persistent option marks an already -open file as persistent. -The -transient option marks an already -open file as transient. When opening a file, the default -is to mark the file as persistent. - -

    Usage

    -

    - -

    --persistent FILE
    -  FILE must be already opened
    -
    - -See also: --transient -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 15, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/pipes.html b/web_docs/pipes.html deleted file mode 100644 index 7657c02..0000000 --- a/web_docs/pipes.html +++ /dev/null @@ -1,250 +0,0 @@ - - - - Climate Prediction Center - wgrib2: pipes and named pipes - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: pipes and named pipes, POSIX only -
     
    - -

    wgrib2: pipes and named pipes (fifo), POSIX only

    -
    - - -

    Introduction

    - -

    This web page applies to POSIX compliant operating systems. -Linux and Unix are either fully or mostly POSIX-compliant. -Windows may or may not be POSIX compliant. To quote the POSIX Wiki, -"The UNIX Subsystem is built in to the Enterprise and Ultimate -editions of Windows Vista and 7, and cannot be added separately -to the other editions." Third-party add-ons may or may not provide -POSIX pipe support. Windows provides support for unnamed pipes, "|". -However, using these pipes for binary data will be compiler and -perhaps OS dependent. Note: prior to the 5/2011 version of wgrib2, the --flush option was needed in the following examples. - -

    Pipes are used in the old-style selection of fields. In the -following example, the first wgrib2 creates and inventory, the grep -selects the HGT field and the second wgrib extracts the HGT based -on the input inventory. - -

    -  wgrib2 IN.grb | grep ":HGT:" | wgrib2 IN.grb -i -grib OUT.grb
    -
    - -

    A more modern example of pipes is to extract all the HGT fields -from a set of files. In the following example, the "cat" writes -all the 2016 grib files to the pipe. The wgrib2 reads the pipe (file=-) -and writes all the HGT fields to the file HGT2016.grb. - -

    -  cat pgb.2016????? | wgrib2 - -match ":HGT:" -grib HGT2016.grb
    -
    - -Pipe are great because this they avoid the slow disk I/O and allow -two processes to run at the same time. For example, the above -line could be executed as, - -
    -  cat pgb.2016????? tmpfile
    - wgrib2 tmpfile -match ":HGT:" -grib HGT2016.grb
    - rm tmpfile
    -
    - -An example where two process run at the same time is -given below. The first wgrib2 regrids the fields and writes it -to stdio. The second wgrib2 reads the regridded fields and -writes a CSV file. On a multi-core system, both processes -and be computing at the same time. - -
    -  wgrib2 IN.grb -inv processed.txt  -new_grid_winds earth -new_grid ncep grid 2  - | wgrib2 - -csv out.csv
    -
    - - -Another usage of pipes is to avoid the 2GB limit on input grib2 file when using a 32-bit machine. - -
    - cat BIGFILE | wgrib2 - -match ':HGT:' -grib HGT.grb
    -
    - -

    Named Pipes

    - -Named pipe are also useful. Consider the following line -which converts the file into jpeg2000 packing. - -
    -   wgrib2 IN.grb -set_grib_type jpeg -grib_out JPEG.grb
    -
    - -Jpeg2000 packing is slow and you can convert the file using -3 cpus and named pipes. - -
    -1  mkfifo pipe.1.$$ pipe.2.$$ pipe.3.$$
    -2  wgrib2 IN.grb -for_n 1::3 -set_grib_type jpeg -grib_out pipe.1.$$ &
    -3  wgrib2 IN.grb -for_n 2::3 -set_grib_type jpeg -grib_out pipe.2.$$ &
    -4  wgrib2 IN.grb -for_n 3::3 -set_grib_type jpeg -grib_out pipe.3.$$ &
    -5  gmerge JPEG.grb pipe.1.$$ pipe.2.$$ pipe.3.$$
    -6  rm pipe.1.$$ pipe.2.$$ pipe.3.$$
    -
    -  line 1: makes the named pipes
    -  line 2: wgrib2 command process fields 1,4,7.., writes to pipe.1.$$
    -  line 3: wgrib2 command process fields 2,5,8.., writes to pipe.2.$$
    -  line 4: wgrib2 command process fields 3,6,9.., writes to pipe.3.$$
    -  line 5: gmerge copies to JPEG.grb grib messeages from pipe.1, 
    -          pipe.2 and then pipe.3, and starts at pipe.1 again.
    -          This round robin selection preserves the order of fields.
    -  line 6: cleanup
    -
    -  * versions of wgrib2 prior to 5/2011 needed the -flush option for lines 2-4.
    -
    - -The above is a simple example of multitasking a wgrib2 job. - - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Oct 18, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/precision.html b/web_docs/precision.html deleted file mode 100644 index e1d2549..0000000 --- a/web_docs/precision.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -precision - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -u -
     
    - -

    wgrib2: -precision

    -
    - - -

    Precision

    - -

    -Except for grid values stored in IEEE format, grid values are -stored with user-defined precision. By having a variable precision, -the space required can be reduced. For having the temperature -stored to a thousandth of a degree would be wasteful as thermometers -typically give a result to a tenth of a degree. - -

    Grid point values are stored as scaled integers, the scaling -determines the precision. - -

    -val = (base+i*2^bin_scaling)*10^dec_scaling
    -       base = real*4
    -       bin_scaling = integer from -127 .. 127
    -       dec_scaling = integer from -127 .. 127
    -
    - -

    The -precision option prints the bin_scaling -and dec_scaling values. -The -precision output can be read by --set_metadata and --set_metadata_str options to set the precision. - - -

    Usage

    -

    -

    --precision
    -
    - -

    Examples

    -
    -$ wgrib2 ecmwf.tp.hc -precision
    -1:0:encode i*2^-4*10^0
    -
    -$ wgrib2 wind.grb -precision
    -1:0:encode i*2^0*10^-1
    -2:97922:encode i*2^0*10^-1
    -3:179554:encode i*2^0*10^-1
    -
    - -

    -See also: --packing, --scale, --set_bin_prec, --set_metadata, --set_metadata_str, --set_scale, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 10, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/print.html b/web_docs/print.html deleted file mode 100644 index e06e569..0000000 --- a/web_docs/print.html +++ /dev/null @@ -1,184 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -print - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-print -
     
    - -

    wgrib2: -print

    -
    - - -

    Introduction

    - -

    -The -print option prints a string -into the inventory. It is used to make the inventory prettier. -

    - -

    Usage

    - -

    -

    --print "string"
    -
    - -

    Example

    -
    -$ wgrib2 png.grb2 -print "VAR is" -var -print "LEV is" -lev
    -1:4:VAR is:RH:LEV is:2 m above ground
    -
    - - -See also: --nl -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 30, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/print_out.html b/web_docs/print_out.html deleted file mode 100644 index d0ab01d..0000000 --- a/web_docs/print_out.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -print_out - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-print_out -
     
    - -

    wgrib2: -print_out

    -
    - - -

    Introduction

    - -

    -The -print_out option prints a string -to a file. -

    - -

    Usage

    - -

    -

    --print_out "string" FILE
    -     Writes "string" to FILE
    -
    - -

    Example

    -
    -$ wgrib2 LIS.c3 -if ':SNOD:' \
    -  -s -last junk \
    -  -print_out ' (found snod)' junk \
    -  -nl_out junk
    -1:0
    -2:661778
    -3:903352
    -4:4108932
    -5:9512902:d=2014030500:SNOD:surface:anl:d=2014030500:SNOD:surface:anl:
    -6:14281104
    -7:14925511
    -$ cat junk
    -d=2014030500:SNOD:surface:anl: (found snod)
    -
    - -s -last junk                        -last prints the output from the last option (-s) to junk
    - -print_out ' (found snod)' junk      writes string to junk
    - -nl_out junk                         writes a new-line to junk
    -
    - - -See also: -last -last0 -print -nl_out -s_out -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page: 6/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/prob.html b/web_docs/prob.html deleted file mode 100644 index efe315b..0000000 --- a/web_docs/prob.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -prob - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-prob -
     
    - -

    wgrib2: -prob

    -
    - - -

    Introduction

    - -

    -The TMP (temperature) field usually contains the temperature -in Kelvin. However, with the right options, the TMP field -could contain the probability of the temperature being - -

      -
    • below a specified value -
    • above or a specified value -
    • between a two limits (lower limit <= V < upper limit) -
    - -The -prob option prints out the probability -field, if any. - - -

    Usage

    -

    -

    --prob
    -
    - -

    Example

    -

    -

    -sh-2.05b$ wgrib2 sref.t03z.pgrb243.prob.grib2 -prob
    -1:0:prob <273
    -2:1378:prob <273
    -3:2756:prob >500
    -4:6309:prob >1000
    -5:8800:prob >2000
    -6:9801:prob >3000
    -7:10262:prob >4000
    -
    - -Normally -prob in invoked by other -inventory functions like -misc and --s. -

    -See also: --set_prob -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/problems.html b/web_docs/problems.html deleted file mode 100644 index b0d0c72..0000000 --- a/web_docs/problems.html +++ /dev/null @@ -1,284 +0,0 @@ - - - - Climate Prediction Center - wgrib2: Problems - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-Problems -
     
    - -

    wgrib2: error messages

    -
    - - -*** FATAL ERROR: unknown option -xyz *** - -
    -bash-4.1$ wgrib2 small.grb -nosuchoption
    -
    -*** FATAL ERROR: unknown option -nosuchoption ***
    -
    - -

    -In this case, there is no option, -nosuchoption, and wgrib2 rightly complains. -Sometimes options may not exist in older versions of wgrib2. -Sometimes options will be available in the next public release. To see -the list of options that are available with your installed version, type wgrib2 -help all. By the -way, the grib file must not start with a dash or minus sign otherwise -it will be confused with an option. - -

    -xyz package not installed -

    -Wgrib2 has several optional packages. You will get this error message -if you are requesting an option from a package that was not enabled -at compile time. - -

    -bash-4.1$ wgrib2 small.grb -mysql host user password db table
    -mysql package not installed
    -
    - - *** FATAL ERROR: missing arguments option=ij *** - - -Every option requires a fixed number of arguments. You will get -this error message when you last option has too few arguments. -In this case, -ij requires two arguments - -
    - bash-4.1$ wgrib2 small.grb -ij 19 
    -
    -*** FATAL ERROR: missing arguments option=ij ***
    -
    - - *** FATAL ERROR: too many grib files .. 1st=small.grb 2nd=11 *** - -

    -Every option requires a fixed number of arguments. If you have too many or -too few arguments, you can get this error message. In the following -example, -ij, requires two arguments. For the first -ij, the arguments -are 10 and -ij. The "11" doesn't start with a dash, so it is assumed to -be a grib file. Since there was already a grib file found, error message. - -

    -bash-4.1$ wgrib2 small.grb -ij 10 -ij 11 12
    -
    -*** FATAL ERROR: too many grib files .. 1st=small.grb 2nd=11 ***
    -
    - -grib1 message ignored (use wgrib) - -

    -If wgrib2 encounters a grib1 message, it will print the above warning. -Some ECMWF files will include both grib1 and grib2 data. Some -decoders can handle both formats at the same time, but wgrib2 is -not one of them. - -

    -bash-4.1$ wgrib2 z500.grib1
    -grib1 message ignored (use wgrib)
    -
    - - *** FATAL ERROR: missing input file non-existant-file *** - -

    -You get this error message you wgrib2 cannot open the grib file. - -

    -bash-4.1$ wgrib2 non-existant-file
    -
    -*** FATAL ERROR: missing input file non-existant-file ***
    -
    - -*** FATAL ERROR: no input file defined *** -

    - -You get this error message when wgrib2 cannot find the input grib file on -the command line. This usually happens when the preceeding option doesn't -have enough arguments. In this example, -ij requires two arguments. The -grib file becomes the second argument. - -

    -bash-4.1$ wgrib2 -ij 10 small.grb2
    -
    -*** FATAL ERROR: no input file defined ***
    -
    - -*** FATAL ERROR: rdieee: bad header *** -

    -Wgrib2 is trying to read a f77-style binary file (-import_ieee). - -

    -(header)		4 byte integer, 4*n
    -(ieee floating point)   grid point 1
    -(ieee floating point)   grid point 2
    -...
    -(ieee floating point)   grid point n
    -(trailer)		4 byte integer, 4*n
    -
    -

    -However, either the header is missing or the header has an unexpected value. -The size of the record (4*n) should be the same as the size of the -grib message that was read in. -

    -

    -(No Output) - -

    -bash-4.1$ wgrib2 open.gs
    -bash-4.1$ 
    -
    - -

    If wgrib2 fails to find a grib2 message, nothing is written out to stdout. -If wgrib2 finds a grib1 message, a warning is written to stderr. - - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 19, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/process.html b/web_docs/process.html deleted file mode 100644 index b06cf4d..0000000 --- a/web_docs/process.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -process - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-process -
     
    - -

    wgrib2: -process

    -
    - - -

    Introduction

    - -

    -The -process option prints out - -Code Table 4.3. Code Table 4.3 is important because it defines -the product such as analysis, forecast, or forecast error. The -table also change the units of the field as in a probabilty forecast. -You may encounter products that have identical metadata -except for this table (analysis vs analysis error). In the default -wgrib2 inventory, values of Code Table 4.3 which are not -probabiity forecasts, analysis errors or forecast errors are noted. -

    - -

    Usage

    - -

    -

    --process
    -
    - -

    Example

    -
    -$ wgrib2 -process png.grb2
    -1:4:code table 4.3=4 ens fcst
    -
    - -See also: - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: September 5, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/processid.html b/web_docs/processid.html deleted file mode 100644 index e2e0d84..0000000 --- a/web_docs/processid.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -processid - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-processid -
     
    - -

    wgrib2: -processid

    -
    - - -

    Introduction

    - -

    -The -processid option prints - -

    -Background generating process identifier (defined by originating centre)
    -Analysis or forecast generating process identified (see Code ON388 Table A)
    -
    - -which are octets 13 and 14 in section 4 in many of the Product Definition Templates -such 4.0. - -

    Usage

    -
    --processid
    -
    - -

    Example

    -

    - -

    -$ wgrib2 png.grb2 -pdt
    -1:4:background generating process=0 forecast generating process=80
    -
    -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 28, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/proj4.html b/web_docs/proj4.html deleted file mode 100644 index 24a5ded..0000000 --- a/web_docs/proj4.html +++ /dev/null @@ -1,317 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -gctpc, -proj4 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -gctpc,-proj4 -
     
    - -

    wgrib2 geolocation: -gctpc, -proj4

    -
    - - -

    Introduction

    - -

    -Wgrib2 has 3 sets of geolocation libraries. Geolocation libraries -can convert the grid points (i,j) to (lon,lat). -Some geolocation libraries can convert (lon,lat) to (lat,lon). -There is no "best" set of routines. Some grids can only be handled -by a one library. Some calculations are a specific library. - -

    -Internal Routines -

      -
    1. Spherical Earth only -
    2. Very fast and multithreaded, 3.5/12.7 sec on test case 1* -
    3. Very fast and multithreaded, 3.5/12.7 sec on test case 2* -
    4. Needed for NWP grids such as Gaussian grids and rotated lat-lon -
    5. Common projections -
    6. C, no configure file needed -
    7. Can transform (i,j) to (lon,lat) -
    8. Many of the codes trace their origins to operational codes at NCEP -
    - - -

    -GCTPC library -

      -
    1. Handles ellipsoidal Earth -
    2. Slow and multithreaded (OpenMP), 5.5/19.5 sec on test case 1* -
    3. Slow and multithreaded (OpenMP), 15.7/58.7 sec on test case 2* -
    4. More projections than internal routines but not the NWP grids -
    5. C, no configure file needed -
    6. Can transform (i,j) to (lon,lat) -
    7. Can transform (X,Y) to (lon,lat) -
    8. Can transform (lon,lat) to (X, Y) -
    9. Library is old but working, no recent development -
    10. Support for library is unknown -
    -

    -Proj4 library -

      -
    1. Handles ellipsoidal Earth -
    2. Slow and no support for OpenMP, 17.8/19.7 sec on test case 1* -
    3. Slow and no support for OpenMP, 62.8/64.7 sec on test case 2* -
    4. Proj4 supports pthreads, wgrib2 uses OpenMP -
    5. More projections than GCTPC, ex. ellipsoidal Lambert Azimuthal Equal Area grid -
    6. C, requires config script -
    7. Can transform (i,j) to (lon,lat) -
    8. Can transform (X,Y) to (lon,lat) -
    9. Can transform (lon,lat) to (X, Y) -
    10. Library has active development -
    11. Support for library is good -
    12. The first choice by many people. -
    - -
    -* test case 1 - read large Lambert conformal grid (6887 x 6610) and 
    -calculate lon/lat for the entire grid and print lon/lat for 1 grid point.
    -This uses a spherical Earth.
    -
    -* test case 2 - read large Lambert conformal grid (6887 x 6610) and 
    -calculate lon/lat for the entire grid and print lon/lat for 1 grid point.
    -This uses a ellipsoidal Earth.
    -
    -The timing code is
    -
    -  time wgrib2 burned_area_20120131_12_23_1km.grib2.c0 -ijlat 4 3
    -  time wgrib2 burned_area_20120131_12_23_1km.grib2.c0 -ijlat 4 3 -gptpc 1
    -  time wgrib2 burned_area_20120131_12_23_1km.grib2.c0 -ijlat 4 3 -proj4 1
    -
    -and the two numbers correspond to the wall clock and CPU times for a 4
    -core Intel Xeon E5506 with OMP_NUM_TREADS=4.
    -
    -grid:
    -  Lambert Conformal: (6887 x 6610) input WE:NS output WE:SN res 0
    -  Lat1 64.997800 Lon1 180.492400 LoV 264.000000
    -  LatD 40.000000 Latin1 20.000000 Latin2 60.000000
    -  LatSP 0.000000 LonSP 0.000000
    -  North Pole (6887 x 6610) Dx 1000.000000 m Dy 1000.000000 m mode 0
    -
    -Earth:
    -  case 1: code3.2=0 sphere predefined radius=6367470.0 m
    -  case 2: code3.2=4 IAG-GRS80 ave radius=6367444.5 m
    -
    -Packing: grid point data - complex packing,c1 
    -
    - -

    -The internal routines are fast, multithreaded but only handle -a spherical earth and cannot transform from (lon,lat) -> (X,Y). -The internal routines include grids not included with GCTPC. - -

    -The GCTPC routines can handle an ellipsoidal Earth. They are -50% slower than the internal routines for a spherical earth and -are acceptable for NOMADs. For an ellipsoidal Earth, the speed is -probably adequate for NOMADS. The lack of support is not a major factor -because the codes are tested and relatively simple. By supporting -both GCTPC and Proj4, I am comfortable that the codes can be -adequately tested. - -

    -Proj4 is the Gold standard; it used by many projects, it has -good support and updates appear on a regular basis. Proj4 supports -more projections than GCTPC. Unfortunately Proj4 is slow. For a -spherical Earth, Proj4 is probably adequate (slower than gctpc -for a spherical earth). For an ellipsoidal Earth, Proj4 is -too slow for Nomads. There have been some efforts to make Proj4 -thread safe. Another difficulty with Proj4 is that compiling -uses a config script. Config scripts can cause problems -when cross-compiling for compute nodes (some HPC computers). -

    - -

    -Wgrib2 needs the internal routines for grids not supported by -GCTPC/Proj4. Wgrib2 needs GCTPC/Proj4 for handling ellipsoidal -Earths. The current policy is that Proj4 will be an optional -package and GCTPC will be come the default package in the -near future. Support for Proj4 is useful for debugging and -for "keeping the options open". -

    - - -

    Usage

    - -

    -

    --gctpc 0
    -   do not use gctpc for geolocation
    --gctpc 1
    -   enable gctpc for geolocation
    --proj4 0
    -   do not use Proj4 for geolocation
    --proj4 1
    -   enable Proj4 for geolocation
    -
    -   Priority up to wgrib2 v3.1.1:
    -     Try Proj4 if Proj4 is enabled (not default) and installed (not default)
    -     Try gctpc if gctpc is enabled (default)
    -     try internal routines  
    -
    -   Priority wgrib2 v3.1.2+:
    -     ?? Try gctpc if gctpc is enabled (default)
    -     ?? Try Proj4 if Proj4 is enabled (not default) and installed (not default)
    -     ?? try internal routines  
    -
    -
    -     note: older version of the priority was wrong.
    -
    -   Note: some grids are only  supported by the internal routines
    -
    - - - -See also: --geolocation - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 30, 2014, April 13, 2020, 10/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/py_wgrib2api.html b/web_docs/py_wgrib2api.html deleted file mode 100644 index 17e64d6..0000000 --- a/web_docs/py_wgrib2api.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - Climate Prediction Center - wgrib2: py_wgrib2api - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 py_wgrib2api -
     
    - -

    wgrib2: py_wgrib2api

    -
    - - -

    Introduction:

    - -

    -Pywgrib2_s calls the C library, wgrib2lib. It is limited to calling these wgrib2 routines -specific routines. Sure the python code could call other routines in wgrib2lib but it -is not advised. The other routines in wgrib2lib should be considered internal routines -that may change or even disappear. - -

    -Convention: pywgrib2_s only uses routines that start with wgrib2.
    -
    -
    -int wgrib2(int argc, char **argv)
    -  call to wgrib2 routine
    -
    -int wgrib2_free_file(char *filename)
    -  frees the file, filename
    -
    -
    -REGISTER
    -
    -int wgrib2_get_regsize(int i)
    -  return number of elements in register i
    -
    -int wgrib2_get_reg_data(float *data, size_t size, int i)
    -  size = number of elements of data
    -  gets contents of register i
    -
    -int wgrib2_set_reg(float *data, size_t size size, int i)
    -  size = number of elements of data
    -  sets contents of register i
    -  
    -
    -MEMORY BUFFER
    -
    -
    -int wgrib2_get_mem_buffer_size(int i)
    -  return size in bytes of buffer i
    -
    -int wgrib2_set_mem_buffer(unsigned char *buffer, size_t size, int ii)
    -  size = size of buffer (bytes)
    -  i = buffer number
    -
    -int wgrib2_get_mem_buffer(unsigned char *buffer, size_t size, int i)
    -  size = size of buffer (bytes)
    -  i = buffer number
    -
    -
    - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 29, 2016. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/pywgrib2.html b/web_docs/pywgrib2.html deleted file mode 100644 index 96a7f99..0000000 --- a/web_docs/pywgrib2.html +++ /dev/null @@ -1,251 +0,0 @@ - - - - Climate Prediction Center - pywgrib2_* - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2 -
     
    - -

    pywgrib2

    -
    - - -

    Introduction

    - -

    -The wgrib2 utility can handle many grib tasks without programming. For more -complicated tasks, wgrib2 now has IF-ELSE-ENDIF blocks. However, -for some tasks, you need to drive wgrib2 from another program. Calling -the wgrib2 utility has been done, but it requires many CPU cycles -(call shell, initialize shell, call wgrib2, free resources), and all communications have -to be done through files or pipes. Reading and writing of grib files -can be done but the performance is suboptimal. - -

    -One day, a user sent me revisions to make wgrib2 a C subroutine. He was -able to call the new wgrib2 subroutine from a C program to read and write grib files. -This development lead to a fortran API -for reading and writing grib files. This fortran API is higher level -interface than direct calls to wgrib2 and makes reading and writing grib easy. -Performance was good if the introduced memory files were used. - -

    Another day, another user sent me code for a python interface to wgrib2. -This interface also builds on the wgrib2 subroutine. Since the users/developers have -varied needs, there will different levels of the python interface. - -

      -
    1. pywgrib2_s .. s is for simple -
        -
      • simple, minimal requirements -
      • Requirements: python3.5+, numpy, and wgrib2 shared library -
      • read, write grib, based on an extension of the ftn wgrib2api -
      • Inventory file is optional for reading but can speed up processing -
      • Simple python code, guts in 1-3 weeks by person with minimal Python experience. -
      • Most of the development time was spent on learning python, polishing and documentation. -
      • See pywgrib2_s main page -
      • pywgrib2_s is in beta testing. -
      -
    2. pywgrib2_lite .. lite version -
        -
      • Requirements: python3.6+, numpy, and wgrib2 shared library -
      • more conventional python experience -
      • alpha testing started, request info to be tester -
      -
    3. pywgrib2_xr .. for xarray - - -
    4. Common Features of various versions of pywgrib2_* -
        -
      • Based on wgrib2 v3.0.0+ library. -
      • OpenMP for faster processing of large grids -
      -
    - -

    Expected Reliability

    - -

    -Software has errors because the code in the routines have a problem -or because how the routines are called have problems. Problems can -be simple coding errors to invalid assumptions. Testing is important, -and writting test code is both error prone and often covers too few cases. - -

    -The pywgrib2_s is expected to have higher reliability than expected by -its age and utility because, -

      -
    • The wgrib2 library is used by the wgrib2 utility which is widely used and operational at NCEP. -
    • Wgrib2 is open source which encourages users to find and debug errors. -
    • Only a handful of routines in the wgrib2 library are called by pywgrib2_s. -
    • Only a few routines in the wgrib2 library are called by pywgrib2_s but not by the -wgrib2 utility. Thereby - reducing the number of codes that are infrequently used. Even the infrequently used - codes are called by the fortran wgrib2api. -
    • Only a handful of routines in the wgrib2 library are directly called by pywgrib2_s reducing - the errors in "calling the routines". -
    • Much of the testing can be done by running the wgrib2 utility reducing errors in - coding testing programs. -
    • pywgrib2_s.py started small (5-13-2020: 292 lines including 51 blank lines, and 63 lines of comments) -
    • pywgrib2_s.py is still small (9-16-2020: 668 lines including 92 blank lines, and 100 lines of comments) -
    - -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sep 16, 2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/pywgrib2_s.html b/web_docs/pywgrib2_s.html deleted file mode 100644 index 93b5dfb..0000000 --- a/web_docs/pywgrib2_s.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - Climate Prediction Center - pywgrib2_s: top page - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2_s: -
     
    - -

    pywgrib2_s: Home Page

    -
    - - -

    Introduction

    - -

    -Pywgrib2_s is a python package for reading and writing grib2 which is a World -Meterological Organization (WMO) format for exchanging meteorological and oceanographic -gridded data. The specifications for the grib2 (grib version 2) format are available from -the WMO, and several libraries are available for reading and writing grib2. Pywgrib2_s -is based on the fortran wgrib2api and the wgrib2 library. - -

    The design goals of pywgrib2_s are a simple interface, minimal requirements for -additional python modules/packages, and the ability to program for efficient I/O. -Since pywgrib2_s is uses the wgrib2 library, search terms are based on wgrib2 terms. -For example, searching for the 2 meter temperature is done by, var="TMP", lev="2 m above ground". - -

    8/2020: I am using the alpha pywgrib2_s in my work, with no problems. The problems -that I am using it are a bit too complicated for a wgrib2 script, and not so resource -intensive that I that I need fortran. - - -

    Basics: Grib Data Model

    - -

    The grib data model is more complicated than the data model for the natural world. -For example, the earth's temperature is defined by a location and time (x,y,z,t). Grib was developed -for forecast centers has more characteristics such as forecast time, averaging period, -ensemble member, and numerical model that created the forecast. When you consider -tracer gases, you add chemical type. Aerosols add the composition and size of the pariculate matter. -Forecasts can be deterministic or probabalistic. - - -

    Grib files often have multiple vertical coordinate systems. Meteorologists often -use pressure or isentropic coordinates. The aviation community often use height above a -constant geopotential. The people on the ground often want meters above ground. -The ocean fields and soil fields will have their own vertical coordinates. - -

    A grib file does not include an index, usually a software package includes -a mechanism for making an index file. Pywgrib2_s uses the human-readable wgrib2 -inventory. Not having a included index has its advantages and disavantages. -Having a human-readable index has been very advantageous. - -

    -A grib field has many characteristics to uniquely identify it. So pywgrib2_s has -taken the approach that characteristics of the field will be text string which -grow in time as the grib standard adds more characteristics. To find a field, -you provide search terms that compared with the inventory. - - -

    Naming Convention

    -

    -Grib is an international standard which doesn't specify a naming standard. For -example a pressure surface of 1000 Pascals, could be called "10 mb" (non-SI unit), -"10 hPa" (used in scientific literature), "1 kPa" (SI unit) or even 0.2953 inch of nercury. -At NCEP, geopotential height has the name HGT. This is a local convention. -Pywgrib2_s, like wgrib2, use the NCEP -NCEP naming convention. Grib allows locally defined tables, and pywgrib_s/wgrib2 wgrib2 -follows the recommendation of the defining site. - - - -

    Reading and Writing Grib

    - -
    - mk_inv(grib, inv_file)                   makes inventory file
    - read_inv(inv_file)                       reads inventory file, returns list
    - inq(grib,...)                            inquire about grib2 file
    -                                            read metadata, grid point data,
    -                                            calculate lat-lon of grid points for common grids
    - write(grib,...)                          write grib2
    - close(file)                              close file, used to flush, free up resources,
    -
    - -

    Memory Files

    -The above routines read and write files. Using the the filesystem would be a bottleneck for many -applications, so wgrib2 added memory files. These memory files resided in the memory space -of wgrib2 and can be accessed from python. - -
    - memory file:  @mem:N   N = 0,1,..,29   memory files 10-29 are reserved for use by pywgrib2_s
    -
    - get_bytes_mem(fileno)                    returns bytes (buffer) from from memory file number "fileno"
    - get_dbl_mem(fileno)                      reserved for future use
    - get_flt_mem(fileno)                      returns numpy.ndarray (numpy array) with float32 values
    - get_str_mem(fileno)                      returns text string from memory file number "fileno"
    - mem_size(fileno)                         returns size of memory file number "fileno" in bytes
    - set_mem(fileno,buffer)                   copy buffer to memory file number "fileno"
    -                                          buffer can be type bytes, str or numpy.ndarray
    -                                          set_mem(12,'') will empty @mem:12
    -
    -

    Multi-Threading

    -Pywgrib2_s uses the multi-threaded wgrib2 library to speed up execution. You control the number -of threads by setting the environment variable OMP_NUM_THREADS. You rarely set the number -of threads greater than 5 because the speedup becomes minor in most cases. - -

    -There are a few wgrib2 operations that can use as many cores as possible -(ex. -ensemble processing, -lola for certain grids). For calls to wgrib2(..), -the number of threads can be controlled by -ncpu option. - -

    Global Variables

    - -

    Pywgrib2_s uses global variables for the - -

      -
    1. configuration -
    2. -output of pywgrib2_s.inq(..) -
    - -

    Low level Access: wgrib2

    -

    -The pywgrib2_s is a python module that calls wgrib2. Sometimes you may -need to know the version and configuration of the wgrib2 library. -The pywgrib2_s.wgrib2(..) will let you directly call wgrib2. - - -

    - wgrib2_version()                           returns a string with the version of the
    -                                            wgrib2 library. Same as wgrib2 -version
    -
    - wgrib2_config()                            returns list of strings with the configuration 
    -                                            of the wgrib2 library. Same as wgrib2 -config
    -
    - wgrib2( [ (list of wgrib2 arguments) ] )   call wgrib2
    -
    -
    -
    - -

    Low Level Access: Registers

    -Registers are part of the reverse polish notation calculator (-rpn). They are used by the internals -of pywgrib2_s, and should only be used by programs that make direct calls to wgrib2. - -
    - reg_size(regno)                            returns size of register number "regno" in elements
    - reg_shape(regno)                           reserved for future use
    - get_flt_reg(regno)                         returns numpy.ndarray (numpy array) with floating point 32 value
    - get_dbl_reg(regno)                         reserved for future use
    - set_reg(regno, array)                      copy array (numpy.ndarray) to RPN register "regno"
    -
    - -

    Requirements:

    - -

    The requirements for pywgrib2_s are - -

      -
    1. python 3.5+, numpy -
    2. Linux (tested: Ubuntu, Redhat, SUSE), MacOS, Windows (tested: Cygwin-64) -
    3. shared wgrib2 library created using wgrib2 v3.0.2 -
    4. Linux compilers: gcc/gfortran, AOCC clang/flang, NVidia HPD sdk nvc/nvfortran -
    5. MacOS compilers: homebrew gcc/gfortran (gcc may be a wrapper for clang) -
    6. Windows compilers: cygwin gcc/gfortran -
    - -

    Cookbook

    - -

    A living cookbook of pywgrib2_s "recipes" is being maintained. -The cookbook serves as a learning tool for beginners, a simple -validation tool, testbed for testing the utility of the API, and -and starting point for writing some code. - -Li Xu of CPC has provided some documentation for the -cookbook and pywgrib2_s routines. - - - - - -

    Installation:

    - -See Installation directions - - -

    Code Timeline

    -
      -
    • wgrib2: released 2004 -
    • wgrib2 can be built as subroutine that can be called from C or Fortran, wgrib2 library (2015) -
    • alpha version of pywgrib2 using wgrib2 library by George Trojan (2/2020) -
    • wgrib2 v3.0.0 with alpha-beta pywgrib2_s (9/2020) and pywgrib2_xr afterwards -
    • wgrib2 v3.0.2 with updates for pywgrib2_* including Windows support (3/2021) -
    - -

    -See also: -pywgrib2_s conventions -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Created: Aug 11, 2020, Modified: 6/2021, 7/2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/pywgrib2_s_close.html b/web_docs/pywgrib2_s_close.html deleted file mode 100644 index 164ecb8..0000000 --- a/web_docs/pywgrib2_s_close.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - Climate Prediction Center - pywgrib2: close(file) - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2: close(file) -
     
    - -

    pywgrib2: close(file)

    -
    - - -

    Introduction

    - -

    -Pywgrib_s opens a file when you use it, and automatically closes -the file when the program ends. You may want to manually close file -because - -

      -
    1. the system limits the number of open files, and you - need to close some files before reaching the system limit. -
    2. You need to flush the file buffes so a program other than pywgrib2_s - can read the file. -
    3. pywgrib2_s had an error and the file state needs to be cleaned. -
    4. free up memory used to buffer the reads or writes to a no longer used file -
    - - -

    Example

    -
    ->>> pywgrib2_s.mk_inv('a.grb','a.inv',Short=True)
    -0
    ->>> pywgrib2_s.close('a.grb')
    -0
    ->>> pywgrib2_s.close('not-a-file')
    -1
    -
    -

    Usage

    -
    -     a=pywgrib2_s.close(file)
    -         if file is a memory file, the memory file is set to zero length
    -         if file is open, it closes the file, frees the resources, and returns 0
    -                closing the file will flush any write buffers
    -         if file not open, it returns 1
    -
    - - -

    -overview -back - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 10, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/pywgrib2_s_conventions.html b/web_docs/pywgrib2_s_conventions.html deleted file mode 100644 index ceee73b..0000000 --- a/web_docs/pywgrib2_s_conventions.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - Climate Prediction Center - pywgrib2_s: conventions - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2_s: conventions -
     
    - -

    pywgrib2_s: conventions

    -
    - - -

    Conventions

    - -

    -What is a convention? In the year 2020, a convention is a gathering to -decide who runs for political office. In bridge, a convention is an -understanding that certain artifical bids have special meanings. For example, -a opening 4 no trump bid asks the partner to disclose the number aces in his hand. -The pywgrib2_s conventions are more like the bridge conventions. - -

    Optional Parameter name starts with an uppercase

    -

    The optional parameter expects a logical value, and the default value is False. - -

    Optional Parameter has a default value of "" (empty string)

    - -

    The optional parameter expects a string value, and an empty string turns off -the option. - - -

    Optional Parameter has a default value of None

    - -

    The optional parameter expects something besides a string or logical value. -It may exoect a number, a numpy array, or mutiple types of input. - - - -

    Undefined Grid Values

    - -Most reasonable computers have floating values that can be NaN (not a number). -Using NaN can be a problem because "if (x == NaN)" is not the way to test -if x is a NaN. Pywgrib2_s uses the numpy.nan for the NaN. Some codes may -be based on wgrib2 scripts which use 9.999e20 as the value for undefined grid point value. -You can change pwgrib2_s to use the wgrib2 convention by setting pywgrib2_.s.use_numpy.nan to False. -Note that numpy.nan is not the same as math.nan; for example (math.nan is numpy.nan) is false. - -

    Numpy Arrays

    -The grid values, lat and lon arrays are returned as numpy arrays. The arrays -are in Fortran order, and in WE:SN order. In english, -
      -
    • a[i+1,j] is stored after a[i,j] in memory -
    • for a lat-lon grid: a[i,j] and a[i+1,j] have the same latitude -
    • for a lat-lon grid: a[i+1,j] is east of a[i,j] by delta-longitude degrees -
    • for a lat-lon grid: a[i,j] and a[i,j+1] have the same longitude -
    • for a lat-lon grid: a[i,j+1] is north of a[i,j+1] by delta-latitude degrees -
    - - -

    Debugging

    - -Change the global variable pywgrib2_s.debug to True. - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created July 12, 2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/pywgrib2_s_global_variables.html b/web_docs/pywgrib2_s_global_variables.html deleted file mode 100644 index 2121157..0000000 --- a/web_docs/pywgrib2_s_global_variables.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - Climate Prediction Center - pywgrib2: global variables - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2: global variables -
     
    - -

    pywgrib2: global variables

    -
    - - -

    Introduction

    - -

    -Pywgrib_s has two types of global variables. The first type is the -output of the pywgrib2_s.inq(..) routine, such as the size of -the grid, the grid values and grid locations. The second type -are the configuration options of pywgrib2_s. - - -

    Output global variables

    - -
      -
    1. nx: integer, size of matched grid in zonal direction -
    2. ny: integer, size of grid in meridional direction -
    3. ndata: integer, size of grid -
    4. nmatch: integer, number of matches by inq(..) -
    5. msgno: integer, grib message number -
    6. submsgno: integer, submessage message number -
    7. data: float32s, grid point values -
    8. lat: float32s, grid point latitudes -
    9. lon: float32s, grid point longitudes -
    10. secN: bytes, byte values of secN N=0..8 -
    11. matched: list of strings of matched fields -
    12. grid_defn: string of grid definition -
    - -

    Configuration global variables

    - -
      -
    1. use_numpy_nam: logical, undefined grid value is numpy.nan (true) or 9.999e20 (False) -
    2. names: string, either 'ncep', 'ecmwf' or 'dwd', convention for WMO grib names -
    3. debug: logical, print debug statements (True) -
    - -overview - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - modified: 7, 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/pywgrib2_s_inq.html b/web_docs/pywgrib2_s_inq.html deleted file mode 100644 index 0e57c0a..0000000 --- a/web_docs/pywgrib2_s_inq.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - Climate Prediction Center - pywgrib2: inq(..) - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2: inq(..) -
     
    - -

    pywgrib2: inq(..)

    -
    - - -

    Introduction

    - -

    -Pywgrib_s.inq(..) does an inquiry about a grib file. At its most basic level, -you give zero or more search terms, and the inquiry says how many fields matched -your search terms. You can also get the metadata and grid information for all the matched -fields. For the last match, you can get additonal information like, - -

      -
    1. nx number of grid points in longitudinal direction -
    2. ny number of grid points in latitudinal irection -
    3. ndata number of grid points in grid -
    4. msgno grib messsage number -
    5. submsgno grib submessage number -
    6. data (optional) grid point values in WE:SN order -
    7. lon (optional) longitude values of grid in WE:SN order -
    8. lat (optional) latitude values of grid in WE:SN order -
    - -

    Arguments to inq()

    - -

    File to Read: Grib file

    -

    The function, inq, has only one positional parameter, a name of a grib file. -All other parameters are optional. If you call inq with no options, then -there are no constraints of the fields that match. The call will return the -number of fields in the file. - -

    ->>> import pywgrib2_s
    -finished loading libraries
    -pywgrib2_s v0.0.10 11-9-2020 w. ebisuzaki
    ->>> pywgrib2_s.inq('a.grb')
    -9796
    ->>> 
    -
    - -

    Specifying Fields to Examine

    - -

    By Search Terms: Text Searchs

    -

    -After the grib file, you can enter any number of text search terms. -The search terms will be compared with the inventory file or automatically -generated inventory file if an inventory is not provided. - -

    Each line of the inventory file corresponds to a grib message or submessage. -For a search to be sucessful, each search term must be found in the same line. -The comparison is done as a text string unless the option Regex is set to True. -In that case, a regular expression comparison is done. - -

    By Record number, byte location: select='select string'

    - -The optional select='select string', allows one to select a specific field by grib message -number or byte location. Since a grib message may have submessages, you may have -to indicate which submessage is being selected. The byte location option is faster -because the routine doesn't have to read from the start of the file to find the selected -grib message. - -

    You can select the grib message to process by the select string option. -The format of the string is - -

  • 'N.M' where N is the grib message number and M is the submessage number -
  • 'N' where N is the grib message number (M is assumed to be one) -
  • 'N.M:byte_location where the byte location of the message starting from zero, N is unused -
  • 'N:byte_location where the byte location of the message starting from zero and M is one - - -

    Faster with inv file

    - -

    Optional: inv='inv file name'

    - -

    The inv file is a human readable index file. With experience, -the inventory becomes comprehensible. -If a inv file is specified, the inventory file will be used to find -the matching messages. This is much faster than reading the grib -file to find the matching grib messages. -

    You can use any 1-line/field wgrib2 inventory for your "inv file". -However, it is recommended that you use the inventory from the --Match_inv option from wgrib2 because then the match results with/without -an inventory file will be the same. - -

    Inquires: What's in selected fields

    - - -

    Grid point values: Data=Logical

    -

    -If Data is True, the grid point values of the last match are saved -in pywgrib2_s.data as a numpy ndarray in WE:SN order. -The default value is Data=False. If no grid point values are saved, -the value of pywgrib2_s.data is None. Currently the ndarray uses -float32 but that will change to float64 if/when wgrib2 moves to float64 -data. - -

    Latitude, Longitude for grid points: Latlon=Logical

    -

    -If Latlon is True, the latitude and longitude values of the last match are saved -in pywgrib2_s.lat and pywgrib2_s.lon as a numpy ndarray in WE:SN order. -The default value is Latlon=False. If the locations are not requested -or cannot be calculated, the value of pywgrib2_s.lat and pywgrib2_s.lon are None. -Currently the ndarray uses float32 but that will change to float64 in the future. - -

    Contents of Grib Sections: SecN=Logical, N=0..8

    -

    -A grib message (record) consists of sections 0..8. If SecN is True, the -byte values of SecN are stored in pywgrib2_s.secN. The default value -of SecN is False. Using the data in pywgrib2_s.secN requires a knowledge -about grib. - - -

    List of the matched fields: Matched=Logical

    -

    -If Matched is True, a list of the fields matched are saved in -pywgrib2_s.matched. The number of matches is given by the -return value if pywgrib2_s.inq(..) and by len(match) when Matched is True. -The default value of Matched is False. - -

    List of the grid definitions of the matched fields: Grid_defn=Logical

    -

    -If Grid_defn is True, a list of the grid definitinos of the matched fields is -saved as a list in pywgrib2_s.grid_defn. The number of matches is given by the -return value if pywgrib2_s.inq(..) and by len(grid_defn) when Grid_defn is True. -The default value of Matched is False. - -

    Saving the matched fields

    - -

    Save matched fields in grib: grib='output grib file'

    -If grib is not '', the grib messages that are matched are copied to the 'output grib file'. -If the 'output grib file' has been not opened, the default is to create a new file. -If the input grib message has submessages, only the submessage that is matched is written -to the file grib. - -

    Open 'grib file' as append: Append_grib=Logical

    -If you wish to append grib message to an existing 'output grib file', -you need to add the parameter Append_grib=True. The default value is False. -Otherwise the initial open of 'output grib file' will create a new file. - -

    Saving matched fields in binary: bin='binary file'

    -If bin is not '', the grid point data will be written to 'binary file'. The format is the native -single precision with no headers or trailers. The data will be written in WE:SN order. -If the 'binary file' has not been opened, the default is to create a new file. - -

    Open 'binary file' as append: Append_bin=Logical

    -If you wish to append binary data to an existing 'binary file', -you need to add the parameter Append_bin=True. The default value is False, and -the initial open of 'binary file' will create a new file. - - -

    Misc

    - - -

    Text search terms are regular expressions: Regex=Logical

    -

    -By default, the text search is done using "fixed strings". The search is -done using no wildcards or metacharacters like the fgrep utility. If Regex is set to True, -the search term is a "regular" expression like the egrep utility. - -

    Read/Search sequentially: Sequential=integer

    -

    -Often you need to process a file sequentially; for example, copy all the -temperatures fields to another file. Sometimes, you want to process a file -sort of sequentially; for example, find the next zonal wind, find the -corresponding meridional wind and write both files to a file, and repeat -until there are now more zonal winds. Pywgrib2_s handles the second -set which is a superset of the first. - -

    Pywgrib2_s.write(..) can read a inventory file sequentially. To handle -the above second case, you create two inventory files. The first inventory -file is read sequentially. The second inventory file is to find the associated -fields. - -

    To start a sequential read, you add "sequential=0" in the call to pywgrib2_s.write(..). -For the remainder of the sequential reads, "sequential=N" where N is a integer greater than zero. - - - -

    - -Add more text here. - -

    - -overview -back -next - - -

  • - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: 8/2020 8/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/pywgrib2_s_install.html b/web_docs/pywgrib2_s_install.html deleted file mode 100644 index ae7c8c2..0000000 --- a/web_docs/pywgrib2_s_install.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - Climate Prediction Center - pywgrib2_s: installation - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2_s: installation -
     
    - -

    Installation

    - -

    Requirements:

    - -
      -
    1. python 3.5+, numpy -
    2. Linux (tested: Ubuntu, Redhat, SUSE), MacOS -
    3. wgrib2 v3.0.2+ shared library -
    - -

    Installation:

    - -
      Step 1: Make or obtain a wgrib2 shared library -
    1. To make the wgrib2 shared library -
    2. cd to the directory where you want to place the wgrib2 source code: cd XYZ -
    3. get the latest source code to wgrib2 (wgrib2.tgz): -
    4. $ wget "https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz" -
    5. untar the source code: $ tar -xzvf wgrib2.tgz -
    6. cd to the grib2 directory: $ cd grib2 -
    7. edit makefile, change "MAKE_SHARED_LIB=0" to "MAKE_SHARED_LIB=1" -
    8. optional edit makefile to user customizations -
    9. set the C and fortran compilers (must be gcc and gfortran), this is the bash compile -
    10. $ export CC=gcc -
    11. $ export FC=gfortran -
    12. $ make lib -
    13. check for the shared library, linux: lib/libwgrib2.so, mac: lib/libwgrib2.dylib -
    - -
      Step 2: find a directory on the python path (PYDIR) -
    1. try .local/lib/pythonN.M/site-packages/ N.M = python version N.M >= 3.5 (lowest version tested) -
      -   # .local/lib/pythonN.M/site-packages will not appear on search path unless already created
      -   cd
      -   mkdir -p .local/lib/pythonN.M/site-packages
      -
      -
    2. query python for directories -
      -   >>> import sys
      -   >>> sys.path
      -
      -
    3. The above script will not show missing directories on the path. -
    4. Choose an appropriate directory with write permission. -
    5. If you cannot find a writable directory, change the python path to create such a directory. -
    - -
      Step 3: Get pywgrib2_s.py PYDIR -
    1. download https://ftp.cpc.ncep.noaa.gov/wd51we/pywgrib2_s/pywgrib2_s.tgz -
    2. extract contents, tar -xzvf pywgrib2_s.tgz -
    - -
      Step 4: install wgrib2 shared library -
    1. shared library is named libwgrib2.so (use libwgrib2.dylib for Darwin) -
    2. for pywgrib2_s version 0.0.x, copy shared wgrib2 lib to PYDIR -
    3. pywgrib2_s 1.0.0+ has a search order for the shared library. -
        -
      1. name of shared library is given by environment varible $WGRIB2_LIB -
      2. shared library (libwgrib2.so) is saved in PYDIR -
      3. shared library (libwgrib2.so) is found in system defined library -
      -
    -
      Step 5: test using the cookbook -
    1. wget https://ftp.cpc.ncep.noaa.gov/wd51we/pywgrib2_s/pywgrib2_s_cookbook.tgz -
    2. Try running the cookbook_*.py scripts from the shell. -
    - -

    Multiple versions of shared wgrib2 library:

    -

    -The libraries used by pywgrib2_s may conflict with those used by -the calling program. In such cases, you have to compile wgrib2 without -the offending libraries. This may reduce the functionality of pywgrib2_s/wgrib2 -but you will have to work around this problem. The end result can be -multiple versions of libwgrib2.so. In such cases, -the environment variable $WGRIB2_LIB will have to be used to specify -except for the default library. - -

    System Installations

    -

    -The above instructions suggested that .local/lib/pythonN.M/site-packages -may work for PYDIR. This suggestion is for an person to install on one's account. For -a system install, you need to be root and place it in a root owned -directory on the python path. - -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Created: Aug 11, 2020, Modified: Oct 6, 2020, June 2021. 11/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/pywgrib2_s_mk_inv.html b/web_docs/pywgrib2_s_mk_inv.html deleted file mode 100644 index 148552e..0000000 --- a/web_docs/pywgrib2_s_mk_inv.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - Climate Prediction Center - pywgrib2_s: mk_inv - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2: read_inv(inv_file) -
     
    - -

    pywgrib2_s: mk_inv

    -
    - - -

    Introduction

    - -

    -The routine pywgrib2_s.mk_inv(grib_file, inv_file) reads a grib_file and writes -the inventory to inv_file. Both the grib_file and inv_file can be memory files. -The inventory will change with the version of wgrib2 by the addition of new fields. - -

    Example 1

    -
    ->>> pywgrib2_s.mk_inv('a.grb','a.inv')
    -0
    ->>> a=pywgrib2_s.read_inv('a.inv')
    ->>> print(a[0])
    -1:0:D=20200101000000:CDCON:high cloud layer:0-6 hour ave fcst::CDCON:n=1: ..
    ->>> print(a[1])
    -2:2808:D=20200101000000:CDCON:middle cloud layer:0-6 hour ave fcst::CDCON: ..
    -
    - -

    Example 2

    -
    ->>> pywgrib2_s.mk_inv('a.grb','a.inv',Short=True)
    -0
    ->>> a=pywgrib2_s.read_inv('a.inv')
    ->>> a[0]
    -'1:0:D=20200101000000:CDCON:high cloud layer:0-6 hour ave fcst:'
    ->>> a[1]
    -'2:2808:D=20200101000000:CDCON:middle cloud layer:0-6 hour ave fcst:'
    -
    - -

    Usage

    -
    -     err=pywgrib2_s.mk_inv(grib_file, inv_file [, optional arguments])
    -         grib_file = name of a grib file
    -         inv_file = name of the inventory file to be created
    -         err = 0 if no error
    -               non-zero for error
    -
    -     Optional arguments:
    -         Short =          False (default) make standard long inventory, wgrib2 -Match_inv
    -                          True make short inventory, wgrib2 -S
    -         Use_ncep_table = False (default) grib table as defined by center in the grib file
    -                          True, use NCEP grib tables, for centers that adopt NCEP grib tables
    -
    -

    Usage

    -

    -overview -next - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Oct 2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/pywgrib2_s_read_inv.html b/web_docs/pywgrib2_s_read_inv.html deleted file mode 100644 index fc9d04b..0000000 --- a/web_docs/pywgrib2_s_read_inv.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - Climate Prediction Center - pywgrib2: read_inv(inv_file) - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2: read_inv(inv_file) -
     
    - -

    pywgrib2: read_inv

    -
    - - -

    Introduction

    - -

    -The routine pywgrib2_s.read_inv(inv) reads an inventory file, inv. It -returns a list of the entries of the inventory file. The -inventory file can be a memory file or regular file. - -

    Example

    -
    ->>> pywgrib2_s.mk_inv('a.grb','a.inv')
    -0
    ->>> a=pywgrib2_s.read_inv('a.inv')
    ->>> print(a[0])
    -1:0:D=20200101000000:CDCON:high cloud layer:0-6 hour ave fcst::CDCON:n=1:npts=18048:var0_1_0_7_6_2:pdt=8:d=2020010100:
    -start_FT=20200101000000:end_FT=20200101060000:scaling ref=0 dec_scale=0 bin_scale=0 nbits=6:vt=2020010106:
    ->>> print(a[1])
    -2:2808:D=20200101000000:CDCON:middle cloud layer:0-6 hour ave fcst::CDCON:n=2:npts=18048:var0_1_0_7_6_2:pdt=8:d=202001
    -0100:start_FT=20200101000000:end_FT=20200101060000:scaling ref=0 dec_scale=0 bin_scale=0 nbits=6:vt=2020010106:
    -
    -

    Usage

    -
    -     a=pywgrib2_s.read_inv(inv_file)
    -         if inv_file cannot be read, returns an empty list.  Otherwise 
    -         returns the inventory file as a list.  The length the list 
    -         (len(a)) is the number of lines in inv_file.
    -
    - - -

    -overview -back -next - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 10, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/pywgrib2_s_wgrib2.html b/web_docs/pywgrib2_s_wgrib2.html deleted file mode 100644 index 88cd19c..0000000 --- a/web_docs/pywgrib2_s_wgrib2.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - Climate Prediction Center - pywgrib2_s: calling wgrib2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2_s: calling wgrib2 routine -
     
    - -

    pywgrib2_s: calling wgrib2 subroutine

    -
    - - -

    Introduction

    - -

    -Wgrib2 is a program that can be called called using various computer languages. -This provides an easy way to read and create grib files. - -

      -
    • shell: wgrib2 GFS.grb -match ':HGT:200 mb:' -netcdf hgt200.nc -
    • C: i = system("wgrib2 GFS.grb -match ':HGT:200 mb:' -netcdf hgt200.nc"); -
    • Fortran: call execute_command_line('wgrib2 GFS.grb -match '':HGT:200 mb:'' -netcdf hgt200.nc') -
    • perl: i = system "wgrib2 GFS.grb -match ':HGT:200 mb:' -netcdf hgt200.nc" -
    • python: os.system("wgrib2 GFS.grb -match ':HGT:200 mb:' -netcdf hgt200.nc") -
    - -Calling the wgrib2 utility has much overhead (see list below); however, this is a reasonable -procedure if you are not time constrained or you are calling wgrib2 a few times. -Except for second and third items, all the following overheads involve the I/O system. Therefore, -a solution needs to address these overheads. - -
      wgrib2 utility overhead -
    1. loading the shell and wgrib2 utility for every call to wgrib2 (sometimes avoidable) -
    2. "compiling" the wgrib2 command line -
    3. initialization of wgrib2, "compiling" the wgrib2 command line -
    4. unnecessary opening and closing of files -
    5. all communication of data is through disk files -
    - -Making wgrib2 a routine can fix all these overheads except for the second. - -
      callable wgrib2 overhead -
    1. Fixed: direct subroutine call to wgrib2. No loading shell/wgrib2 utility -
    2. Reduced impact: after first call to wgrib2, initialization of wgrib2 is reduced -
    3. Not fixed: "compiling" the wgrib2 command line -
    4. Fixed: by default, files are not closed between calls to wgrib2 -
    5. Fixed: can communicate using memory files and RPN registers -
    - -The only overhead that can't be fixed is the initialization and "compiling" -by wgrib2. This overhead does not involve -the I/O system, and becomes relatively small as the grid size increases. - - -
    -#!/usr/bin/env python3
    -
    -# this version does a call to wgrib2 to netcdf files
    -# does not make or use inventory file
    -
    -import pywgrib2_s
    -in_file='gfs.t00z.master.grb2f048'
    -outa='gfs_1a.nc'
    -outb='gfs_1b.nc'
    -
    -err = pywgrib2_s.wgrib2( [in_file, '-rewind_init', in_file, '-match',':HGT:500 mb:', "-netcdf", outa] )
    -print("write netcdf-a=",err)
    -err = pywgrib2_s.wgrib2( [in_file, '-rewind_init', in_file, '-match',':TMP:850 mb:', "-netcdf", outb] )
    -print("write netcdf-b=",err)
    -
    - -

    Usage

    -
    -ierr = pywgrib2_s.wgrib2( [ (list of wgrib2 arguments) ] )
    -      note: output files remain open and may not be flushed
    -            previously opened output files will continue writing after last write
    -            input files remain open
    -            previously opened input files will continue reading after last read
    -
    -      note: you can flush the output file by closing the file by pywgrib2_s.close(file)
    -      note: you can read from the beginning of a file by '-rewind_init', file after the
    -            file has been opened
    -
    - -

    Version and Configuration of Wgrib2 Routine

    - -

    -

    -result = pywgrib2_s.wgrib2_version()
    -         result is a string with the wgrib2 version (same as wgrib2 -version)
    -
    -result = pywgrib2_s.wgrib2_configuration()
    -         result is a list of strings
    -         the same as wgrib2 -config
    -
    - -

    How it works

    - -

    -John Howard (2014) submitted changes that -optionally make wgrib2 a routine rather than a program. -The arguments to the wgrib2 routine were the same as the arguments to the wgrib2 -the program. Since wgrib2 is written in C, the arguments to -wgrib2 are the length of the array of strings followed by -an array of pointers to strings. Being a C program, the strings -are terminated by a zero. - -

    -The pywgrib2_s loads a shared wgrib2 library and calls the "wgrib2" -using the following python code. - -

    -def wgrib2(arg):
    -    #
    -    #    call wgrib2
    -    #        ex.  pywgrib2.wgrib2(["in.grb","-inv","@mem.0"])
    -    #
    -    #    uses C calling convention: 1st arg is name of program
    -    #
    -    global debug
    -    arg_length = len(arg) + 1
    -    select_type = (c_char_p * arg_length)
    -    select = select_type()
    -    item = "pywgrib2"
    -    select[0] = item.encode('utf-8')
    -
    -    for key, item in enumerate(arg):
    -        select[key + 1] = item.encode('utf-8')
    -
    -    if debug: print("wgrib2 args: ", arg)
    -    ierr = my_wgrib2.wgrib2(arg_length, select)
    -    if debug: print("wgrib2 err=", ierr)
    -    return ierr
    -
    - -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 10, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/pywgrib2_s_write.html b/web_docs/pywgrib2_s_write.html deleted file mode 100644 index 6768364..0000000 --- a/web_docs/pywgrib2_s_write.html +++ /dev/null @@ -1,312 +0,0 @@ - - - - Climate Prediction Center - pywgrib2: write(..) - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2: write(..) -
     
    - -

    pywgrib2: write

    -
    - - -

    Introduction

    - -

    -The routine pywgrib2_s.write(..) writes a grib message to a file or memory file. -To write a grib message, you need a "template", a grib message with -the correct grid and most of the metadata. Often these templates are created interactively -using wgrib2. The procedure is to take an existing grib message, and then modify it to -have the correct grid and metadata. - -

    -Once you have a template, pywgrib2_s writes grib files by modifying the template by -adding grid point data, changing the date codes, and other metadata. Pywgrib2_s can -not write a grib file from scratch, you always need a template. Templates are -quite small when you replace the grib point values with zero, with a size often less -than 200 bytes. - -

    Example

    -
    -
    -

    Usage

    -
    -     a=pywgrib2_s.write(file,template,msg_no [, optional arguments])
    -
    -     file     = output file
    -     template = file containing template
    -     msg_no   = message number of the template, the template cannot be in a submessage
    -
    -     Optional Arguments
    -
    -     new_data = None (default)
    -                ndarray          use grid point data from numpy's ndarrray
    -     Append   = False            when opening file, make a new file
    -                True             when opening file, append to the end of the file
    -     metadata = ''
    -              = 'METADATA'       sets metadata to 'METADATA', format is given by
    -                                 https://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/set_metadata.html
    -     sec0     = None (default)
    -                byte array       replace grib section 0 with byte array
    -     sec1     = None (default)
    -                byte array       replace grib section 1 with byte array
    -     sec2     = None (default)
    -                byte array       replace grib section 2 with byte array
    -     sec3     = None (default)
    -                byte array       replace grib section 3 with byte array
    -     sec4     = None (default)
    -                byte array       replace grib section 4 with byte array
    -     sec5     = None (default)
    -                byte array       replace grib section 5 with byte array
    -     sec6     = None (default)
    -                byte array       replace grib section 6 with byte array
    -     sec7     = None (default)
    -                byte array       replace grib section 7 with byte array
    -     sec8     = None (default)
    -                byte array       replace grib section 8 with byte array
    -                                 useless option, included for completeness
    -     var      = '' (default)
    -                'NAME'           set grib variable (ex, 'HGT')
    -                                   uses wgrib2 naming convention
    -     lev      = '' (default)
    -              = 'level'          set level to 'level', ex. '2 m above ground', or '500 mb'
    -                                   uses wgrib2 naming convention
    -     time0    = None (default)
    -              = YYYYMMDDHHmmSS   sets reference time to YYYYMMDDHHmmSS
    -              = YYYYMMDDHH       sets reference time to YYYYMMDDHH (mmSS=0)
    -     ftime    = '' (default)
    -              = 'FTIME'          sets the forecast time, ex '12 hour fcst'
    -                                   uses wgrib2 naming convention
    -     packing  = '' (default)     simple
    -                'same'           use same packing as template
    -                's'              simple
    -                'simple'         simple
    -                'c1'             complex type 1
    -                'complex1'       complex type 1
    -                'c2'             complex type 2
    -                'complex2'       complex type 2
    -                'c3'             complex type 3
    -                'complex3'       complex type 3
    -                'a'              AEC packing
    -                'aec'            AEC packing
    -                'j'              jpeg2000
    -                'jpeg'           jpeg2000
    -                                 Codes written using the NCEP's g2lib and g2clib do not understand AEC packing
    -
    -     var      = '' (default)
    -                'NAME'           set grib variable (ex, 'HGT')
    -                                   uses wgrib2 naming convention
    -     lev      = '' (default)
    -              = 'level'          set level to 'level', ex. '2 m above ground', or '500 mb'
    -                                   uses wgrib2 naming convention
    -     time0    = None (default)
    -              = YYYYMMDDHHmmSS   sets reference time to YYYYMMDDHHmmSS
    -              = YYYYMMDDHH       sets reference time to YYYYMMDDHH (mmSS=0)
    -     ftime    = '' (default)
    -              = 'FTIME'          sets the forecast time, ex '12 hour fcst'
    -                                   uses wgrib2 naming convention
    -     packing  = '' (default)     simple
    -                'same'           use same packing as template
    -                's'              simple
    -                'simple'         simple
    -                'c1'             complex type 1
    -                'complex1'       complex type 1
    -                'c2'             complex type 2
    -                'complex2'       complex type 2
    -                'c3'             complex type 3
    -                'complex3'       complex type 3
    -                'a'              AEC packing
    -                'aec'            AEC packing
    -                'j'              jpeg2000
    -                'jpeg'           jpeg2000
    -                                 Codes written using the NCEP's g2lib and g2clib do not
    -                                   handle AEC packing.
    -                                 Codes written using the NCEP's g2lib and g2clib will have
    -                                   problems with complex packing if they haven't been 
    -                                   programmed to handle undefined grid points without a bitmap.
    -     pdt     = None (default)
    -               integer           Product Definition Template (code table 4.0) is set to integer
    -                                 see https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-0.shtml
    -     d_scale = None (default)    decimal scaling for packing
    -               'same'
    -               (integer)
    -     b_scale = None (default)    binary scaling for packing
    -               'same'
    -               (integer)
    -                                 if d_scale and b_scale are not defined, the wgrib2 default value is used
    -                                      12 bits of binary precision (ECMWF style)
    -                                 If d_scale or b_scale is set to 'same' then
    -                                      -set_scaling same same is done.
    -                                 If d_scale or b_scale are not None
    -                                      if d_scale is None then d_scale = 0
    -                                      if b_scale is None then b_scale = 0
    -                                      -set_scaling d_scale b_scale is done.
    -                                 If d_scale and b_scale are None, then default wgrib2 scaling is used
    -                                      This is 12 bits binary in ECMWF style precision.
    -                                 See https://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/
    -                                          set_scaling.html
    -
    - -
      Order of setting values -
    1. template -
    2. secN -
    3. pdt -
    4. metadata -
    5. time0, var, lev, ftime, packing -
    - - -

    -overview -back -next - - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: 2/2023 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - diff --git a/web_docs/quit.html b/web_docs/quit.html deleted file mode 100644 index 4855a8e..0000000 --- a/web_docs/quit.html +++ /dev/null @@ -1,211 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -quit - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-quit -
     
    - -

    wgrib2: -quit

    -
    - - -

    Introduction

    - -

    -The -quit option forces a quit and the -end of the processing of the current line. You would use -the -quit option to save time (see -2nd example). - - -

    Usage

    -

    - -

    --quit
    -
    - -

    Examples

    -

    - -

    -$ wgrib2 /tmp/pgb.f0009031206.g2 -quit
    -1:4:d=2009031206:HGT:1000 mb:anl:
    -
    -This has the same effect as -d 1. - -

    -

    -$ wgrib2 /tmp/pgb.f0009031206.g2 -match ":RH:1000 mb:" -quit
    -64:466700:d=2009031206:RH:1000 mb:anl:
    -
    -This forces a quit after the first "RH:1000 mb" is processed. This can save time -when there is only one match. - -

    -

    -$ wgrib2 /tmp/pgb.f0009031206.g2  -if "^3:" -quit -if
    -1:4:d=2009031206:HGT:1000 mb:anl:
    -2:5399:d=2009031206:HGT:925 mb:anl:
    -3:10589:d=2009031206:HGT:850 mb:anl:
    -
    - -This forces the quit after the third line. This has the same effect as --for 1:3. - -

    -See also: -if, --for --alarm --limit - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 3, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/radius.html b/web_docs/radius.html deleted file mode 100644 index 7de24a1..0000000 --- a/web_docs/radius.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -radius - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-radius -
     
    - -

    wgrib2: -radius

    -
    - - -

    Introduction

    - -

    -Most grib2 Grid Definition Templates (PDT) include the -shape and dimensions of Earth. Such information is -necessary for finding the latitude and longitude of -the grid points in various projections. The --radius option shows the -shape and size of Earth. -

    - -

    Usage

    - -

    -

    --radius
    -
    - -

    Example

    -
    -$ wgrib2 -radius png.grb2
    -1:4:code3.2=6 sphere predefined radius=6371229.0 m
    -
    - - -See also: --set_radius_inv -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 8, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/range.html b/web_docs/range.html deleted file mode 100644 index 96db49b..0000000 --- a/web_docs/range.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -range - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-range -
     
    - -

    wgrib2: -range

    -
    - - -

    Introduction

    - -

    -The -range option shows the starting and ending byte of -the grib message. If the range field is used by partial http downloading -of grib files. - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/read_sec.html b/web_docs/read_sec.html deleted file mode 100644 index 27f426d..0000000 --- a/web_docs/read_sec.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -read_sec - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-read_sec -
     
    - -

    wgrib2: -read_sec

    -
    - - -

    Introduction

    - -

    -The -read_sec option will replace the section (0-8) of the current grib message -with the contents from a file. The only options that applies to the file are the -header -and -no_header options. -The default -header option put a 4-byte unsigned integer header and trailer around the section data. -The header and trailer are the number of bytes of the section. - -

    -The -read_sec option is used to create grib files where you do not an appropriate template. - -

    Usage

    -
    --read_sec N file            N = 0..8
    -                            file = file to read
    -
    - -

    Example 1

    -
    -wgrib2 IN.grb -read_sec 0 sec0.dat -read_sec 1 sec1.dat -read_sec 2 sec2.dat -read_sec 3 sec3.dat \
    -  -read_sec 4 sec4.dat -read_sec 5 sec5.dat -read_sec 6 sec6.dat -read_sec 7 sec7.dat -grib OUT.grb
    -
    - -

    -See also: --write_sec, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created: 12/2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/reduced_gaussian_grid.html b/web_docs/reduced_gaussian_grid.html deleted file mode 100644 index 808a9a5..0000000 --- a/web_docs/reduced_gaussian_grid.html +++ /dev/null @@ -1,264 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -reduced_gaussian_grid - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-reduced_gaussian_grid -
     
    - -

    wgrib2: -reduced_gaussian_grid

    -
    - - -

    Introduction

    - -

    -Regular Gaussian grids are not space efficient because the number of grid points on a Gaussian latitude -does not vary with latitude. For example, you don't need as many points near the poles as -next to the equator to describe the same spatial scales. With a reduced Gaussian grid, the number of grid points on a Gaussian -latitude varys from large near the equator to small near the poles. This reduces the number -of grid points, reduces calculations and speeds up the model. One draw back for the users -are they often have convert the grid to a regular Gaussian grid for plotting, -interpolation to another grid or making a regional subset. - -

    -The -reduced_gaussian_grid option converts from a reduced -Gaussian grid to a regular Gaussian grid. This option has two interpolation options. -The "linear" interpolation means that the grid points are interpolated linearly -from the surrounding two points on the Gaussian latitude. "Neighbor" interpolation -will use the value from the nearest grid point on the Gaussian latutude. - -

    Interpolation

    - -The -reduced_gaussian_grid option interpolates -using points on the same Gaussian latitude. There are two basic -interpolation techniques, linear and neighbor. - -
      -
    1. linear interpolates linearly using the two surrounding grid points -on the same Gaussian latitude assuming that both grid points have -valid values. -
    2. neighbor interpolation will take the value of the nearest grid point -on the same Gaussian latitude assuming that both grid points have valid -values. -
    - -

    Some fields have undefined values. Therefore, in some cases -you may have to extrapolate a value. - -

    -         D------x-------U         (Gaussian latitude)
    -                              D=defined value, U=undefined values
    -                              x=location of value that is desired
    -
    -Option 1: no extrapolation, value at x is undefined
    -Option 2: extrapolation, value at x is the value D
    -Option 3: x has the value D if x is closer to "D" than "U"
    -          otherwise it has a undefined values
    -
    -Option 1: default, Option 2: extrapolate, Option 3: not supported
    -

    - -The supported interpolation types are - -

      -
    1. linear : linear, no extrapolation -
    2. linear-extrolate : linear, extrapolation -
    3. neighbor : nearest neighbor, no extrapolation -
    4. neighbor-extrapolate : nearest neighbor, extrapolation -
    - - -

    Example

    -
    -See that reduced_gaussian_surface_jpeg.grib2 is a reduced Gaussian grid
    -bash-4.1$ wgrib2 reduced_gaussian_surface_jpeg.grib2 -grid
    -1:0:grid_template=40:winds(N/S):
    -	thinned global Gaussian grid: (-1 x 64) units 1e-06 input WE:NS output raw
    -	number of latitudes between pole-equator=32 #points=6114
    -	lat 87.864000 to -87.864000
    -	lon 0.000000 to 357.188000 by -2147.483647
    -	#grid points by latitude: 20 27 36 40 45 50 60 64 72 75 80 90 90
    -	 96 100 108 108 120 120 120 128 128 128 128 128 128 128 128 128 128 128 128 128
    -	 128 128 128 128 128 128 128 128 128 128 128 120 120 120 108 108 100 96 90 90
    -	 80 75 72 64 60 50 45 40 36 27 20
    -
    -Write regular Gaussian grid in new.grb
    -bash-4.1$ wgrib2 reduced_gaussian_surface_jpeg.grib2 -reduced_gaussian_grid new.grb -1 linear
    -1:0:d=2007032312:TMP:surface:anl:
    -
    -Check that new.grb is a regular Gaussian grid
    -bash-4.1$ wgrib2 new.grb -grid
    -1:0:grid_template=40:winds(N/S):
    -	Gaussian grid: (128 x 64) units 1e-06 input WE:NS output WE:SN
    -	number of latitudes between pole-equator=32 #points=8192
    -	lat 87.864000 to -87.864000
    -	lon 0.000000 to 357.187500 by 2.812500
    -
    - -

    Usage

    -

    - -

    --reduced_gaussian_grid OUT -1 INTERPOLATION
    -      OUT = output file
    -            grib2, regular Gaussian grid
    -          The interpolation is linear on the Gaussian latitude
    -          but will be made selectable in the future
    -      -1 = means interpolate to a regular Gaussian grid
    -           In the future, this parameter will extened 
    -           for convertion to a reduced Gaussian grid.
    -       INTERPOLATION = linear, neighbor, linear-extrapolate, neighbor-extrapolate
    -
    -

    -See also: -grid, - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: November, 29, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/reset_delayed_error.html b/web_docs/reset_delayed_error.html deleted file mode 100644 index aa978f8..0000000 --- a/web_docs/reset_delayed_error.html +++ /dev/null @@ -1,229 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -reset_delayed_error - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-reset_delayed_error -
     
    - -

    wgrib2: -reset_delayed_error

    -
    - - -

    Introduction

    - -

    -Wgrib2 (v3.0.1+) has two behaviors for fatal errors. The first behavior is -to quit immediately. The second behavior (delayed error) is for wgrib2 to -quit after processing the error-causing grib message. This second behavior -is useful because it allows you to examine the bad grib message, and to fix -the grib message. - -

    -The -reset_delayed_error option is an inventory -option that clears the delayed-error flags. Note that options after the --reset_delayed_error option may also raise delayed -errors. -

    -Processing grib files with delayed errors can cause seg faults and other -errors. For example, a delayed error can be raised when Section 3 is not of the correct -size. If wgrib2 is processing Section 3 assuming it has the right size, -and the actual size is smaller than the right size, you could have seg faults. - -

    Example

    -

    -In this example, a delayed error causes processing to stop at the end of the message. - -

    -$ wgrib2 sfcu.grb 
    -
    -*** FATAL ERROR, local grib table=255, replaced by 1
    -1:0:d=2020120500:var discipline=0 center=74 local_table=1 parmcat=2 parm=192:10 m above ground:3 hour fcst:
    -
    -*** FATAL ERROR (delayed): local grib table undefined (255)
    -
    - -To see the inventory without the error messages (note -s had to be added), -
    --sh-4.2$ wgrib2 sfcu.grb -s -reset_delayed_error 2>/dev/null
    -1:0:d=2020120500:var discipline=0 center=74 local_table=1 parmcat=2 parm=192:10 m above ground:3 hour fcst::delayed_error=4
    -2:3327157:d=2020120500:var discipline=0 center=74 local_table=1 parmcat=2 parm=192:10 m above ground:6 hour fcst::delayed_error=4
    -3:6654314:d=2020120500:var discipline=0 center=74 local_table=1 parmcat=2 parm=192:10 m above ground:9 hour fcst::delayed_error=4
    -4:9981471:d=2020120500:var discipline=0 center=74 local_table=1 parmcat=2 parm=192:10 m above ground:12 hour fcst::delayed_error=4
    -
    - -To change the locally define field to a standard WMO name which needs no local grib table. -
    --sh-4.2$ wgrib2 sfcu.grb -if ":var0_22_1_74_2_192:" -set_var UGRD -endif -s -reset_delayed_error 2>/dev/null
    -1:0:d=2020120500:UGRD:10 m above ground:3 hour fcst::delayed_error=4
    -2:3327157:d=2020120500:UGRD:10 m above ground:6 hour fcst::delayed_error=4
    -3:6654314:d=2020120500:UGRD:10 m above ground:9 hour fcst::delayed_error=4
    -4:9981471:d=2020120500:UGRD:10 m above ground:12 hour fcst::delayed_error=4
    -
    -

    Usage

    -

    - -

    --reset_delayed_error
    -                    delayed error flag = 0    no error
    -                                       > 0    see wgrib2.h for values
    -
    -The delayed-error flag is the sum of the following errors (12/8/2020)
    -
    -#define DELAYED_PDT_SIZE_ERR            2
    -#define DELAYED_LOCAL_GRIBTABLE_ERR     4
    -#define DELAYED_GRID_SIZE_ERR           8
    -#define DELAYED_FTIME_ERR               16
    -
    -See also: - -if_delayed_error, - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/rewind_final.html b/web_docs/rewind_final.html deleted file mode 100644 index 18f7462..0000000 --- a/web_docs/rewind_final.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lon - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rewind_final -
     
    - -

    wgrib2: -rewind_final CW2

    -
    - - -

    Introduction

    - -

    -The wgrib2 library can either close or not close the files after -calls to the wgrib2 subroutine. Closing the file frees up resources -and helps prevent you from getting the "Too Many Files Open" error -message. However, reopening files is a slow operation and you -usually keep the files open if you plan to read/write to the file again. - - -

    If you are reading from a previously opened and not-closed file, -you will normally continue reading from where the last call to -the wgrib2 subroutine stopped. Sometimes this the preferred behavior. -Sometimes, you want the library to start reading the file from the -beginning. - -

    The -rewind_final option rewinds an -already open file in the final or after-all-processing phase. It -is commonly used rewind the inventory when searching from matching -records. - -

    Usage

    -

    - -

    --rewind_final FILE
    -  FILE must be already opened
    -  This command is only useful in callable wgrib2
    -
    - -See also: --persistent --rewind_init --rewind_proc --transient -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sep 9, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/rewind_init.html b/web_docs/rewind_init.html deleted file mode 100644 index 7866157..0000000 --- a/web_docs/rewind_init.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lon - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rewind_init -
     
    - -

    wgrib2: -rewind_init CW2

    -
    - - -

    Introduction

    - -

    -The wgrib2 library can either close or not close the files after -calls to the wgrib2 subroutine. Closing the file frees up resources -and helps prevent you from getting the "Too Many Files Open" error -message. However, reopening files is a slow operation and you -usually keep the files open if you plan to read/write to the file again. - - -

    If you are reading from a previously opened and not-closed file, -you will normally continue reading from where the last call to -the wgrib2 subroutine stopped. Sometimes this is the preferred behavior. -Sometimes, you want the library to start reading the file from the -beginning. - -

    The -rewind_init option rewinds an -already open file in the setup or pre-processing phase. It -is commonly used to rewind the inventory when searching from matching -records. - -

    Usage

    -

    - -

    --rewind_init FILE
    -  FILE must be already opened
    -  This command is only useful in callable wgrib2
    -
    - -See also: --persistent --rewind_final --rewind_proc --transient -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sep 9, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/rewind_proc.html b/web_docs/rewind_proc.html deleted file mode 100644 index 10a208a..0000000 --- a/web_docs/rewind_proc.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lon - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rewind_proc -
     
    - -

    wgrib2: -rewind_proc CW2

    -
    - - -

    Introduction

    - -

    -The wgrib2 library can either close or not close the files after -calls to the wgrib2 subroutine. Closing the file frees up resources -and helps prevent you from getting the "Too Many Files Open" error -message. However, reopening files is a slow operation and you -usually keep the files open if you plan to read/write to the file again. - - -

    If you are reading from a previously opened and not-closed file, -you will normally continue reading from where the last call to -the wgrib2 subroutine stopped. Sometimes this the preferred behavior. -Sometimes, you want the library to start reading the file from the -beginning. - -

    The -rewind_proc option rewinds an -already open file during the processing phase. - -

    Usage

    -

    - -

    --rewind_proc FILE
    -  FILE must be already opened
    -  This command is only useful in callable wgrib2
    -
    - -See also: --persistent --rewind_final --rewind_init --transient -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sep 9, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/rpn.html b/web_docs/rpn.html deleted file mode 100644 index e2bccbd..0000000 --- a/web_docs/rpn.html +++ /dev/null @@ -1,579 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -rpn - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rpn -
     
    - -

    wgrib2: -rpn

    -
    - - -

    Introduction

    - -

    -The -rpn option runs a reverse polish notation -(RPN) -calculator. Having a built-in calculator is quite handy. We use it to convert -units (ex. geopotential to geopotential meters, accumulations to rates), -compute simple quantities (net flux from downward and upward fluxes), -and even compute the plant hardiness index from the 2 m temperatures. The goal -of the calculator is to reduce the need to write simple grib programs that -do simple calculations. - -

    The "hardware" of the rpn calculator consists of 20 registers -and a stack (10 entries deep). (Wgrib2 prior to 2.0.6 has 10 registers.) -Stack entries and registers are arrays rather floating point numbers on -your store-bought calculator. - -

    -The conceptual model of the >-rpn calculator is the -grid values array is the top of the stack. The calculator has -a statck that is 10 entries deep and 20 registers. When -ever you enter rpn mode, the stack is cleared except for the -top of the stack. The registers are only clears when you -"turn on" the calculator; that is start the wgrib2 utility -or the first call to wgrib2 if you are using calling wgrib2 -through wgrib2api or pywgrib2. - -

    To save the calculations, you can save them in a register -or write them out by -grib_out, -bin, -ieee, -text, etc. - - -

    Callable wgrib2, wgrib2api

    - -

    Callable Wgrib2 and wgrib2api use the -rpn registers to transfer -gridded data between the calling program and the wgrib2 subroutine. A Fortran or C -program can read and write the wgrib2's RPN registers. For example, if a program -wants to write a grib2 file, it would first place the grid values into a register. -The calling program would then call the wgrib2 subroutine with instructions to -read a template, replace the grid values with the register values, and then -write a grib message. - -

    Implementation Details

    - -

    The size of a registers may differ as the size of grids can also vary in a grib file. -However the size of the register has to match the size of the stack entry in order -"recall" the register. - -

    Wgrib2 always reads a grib message before processing it using commmands like -rpn. -This sets the size of the data array. Thus the size of the stack entries is always -the size of the grib message that is being processed. - -

    The conceptual moddel is the data array (grid values) is the -top of the stack. The implmentation is that the data array is copied -to the top of the stack when -rpn is run, and the top of the stack is -copied to the data array when -rpn is finished. An error message -will occur if the top of the stack is empty when -rpn finishes. - -

    Limitations of -rpn

    - -

    -The -rpn option was designed for -simple calculations. For more complicated calculations, you -should use a real programming language. You can do the -calculations in another step and then import the results -using one of the various -import_* options. You can -use wgrib2api (Fortran and C) to read the data into a Fortran -or C program, do the calculation and then write the data out -using wgrib2. Finally you can use python and one of the pywgrib2 -packages to do the calculation using Python, numpy and - pywgrib2. - -

    Uses

    -
      -
    • change of units when importing data (gribifying data) -
    • computations: ex, U,V -> wind speed, wind direction, potential temperature -
    • merging data -
    • complex masking of data -
    • changing units before writing text/ieee files -
    • removing extreme data values -
    • finding min and max values -
    • finding the globally averaged precipitation -
    • comparing fields -
    - - -

    Usage

    -

    - -

    --rpn  "A:B:C:..."
    -    A,B,C,.. = number, rpn function, or rpn operator
    -
    - -

    -Operators and Functions: -

    -Pop X, Push Fn(X)
    -
      -
    • abs: absolute value -
    • acos: arc cos, [0, pi] radians -
    • alt_x_scan: changes alternate x scanning to regular x scanning and vice versa -
    • asin: arc sin, result is [-pi/2, pi/2] radians -
    • atan: arc tan, result is [-pi/2, pi/2] radians, see atan2 -
    • abs: absolute value -
    • ceil: smallest integer >= X -
    • cos: cosine, argument in radians -
    • exp: e^X -
    • floor: largest integer <= X -
    • ln: natural logorithm -
    • raw2: convert from input scan order to output scan order -
    • sin: sine, argument in radians -
    • smth9g: smth9 for global fields, 9 point smoothing, undefined values adjacent to defined values are defined -
    • smth9r: snth9 for regional fields, 9 point smoothing, undefined values adjacent to defined values are defined -
    • sq: X*X -
    • sqrt: square root -
    • tan: tangent, argument in radians -
    • xave: for nx-ny grids, averages in the x direction (normally zonal mean) -
    • xdev: for nx-ny grids, remove x average (normally deviation from zonal mean) -
    • yrev: for nx-ny grids, changes we:sn to we:ns and vice versa -
    • 1/x: 1/X -
    • 2raw: convert from output scan order to input scan order -
    -Pop Y, Pop X, push Fn(X,Y) -
      -
    • +: push X+Y -
    • -: push X-Y -
    • *: push X*Y -
    • /: push X/Y -
    • <: push X < Y (1/0 if true/false) -
    • <=: push X <= Y (1/0 if true/false) -
    • ==: push X == Y (1/0 if true/false) -
    • !=: push X != Y (1/0 if true/false) -
    • >=: push X >= Y (1/0 if true/false) -
    • >: push X > Y (1/0 if true/false) -
    • atan2: push arctan(X/Y), result is [-pi, pi] radians, see atan -
    • pow: push X**Y (X^Y) -
    • mask: if (Y != 0) push(X) else push(UNDEFINED) -
    • max: push max(X,Y), for logical values, max is the same as OR -
    • merge: if (Y != UNDEFINED) push(Y) else push(X) -
    • min: push min(X,Y), for logical values, min is the same as AND -
    -Note: an operation involving an UNDEFINED is UNDEFINED -
    - - - -Stack Operators: -
    -
      -
    • clr, clear the stack (stack is emptied) -
    • dup, duplicate the top of the stack -
    • pop, remove the top of the stack -
    • exc/swap, exchange the top 2 stack entries -
    -
    -Register Operators: (note: CW2 v2.0.6+ uses registers 7,8,9 prior versions 0,1,2) -
    -
      -
    • clr_I, clear register I, I=0,1..,9 (19 for v2.0.6+) -
    • rcl_I, push register I on top of stack, I=0,1..,9 (19 for v2.0.6+) -
    • sto_I, save top of stack in register I, I=0,1..,9 (19 for v2.0.6+) -
    • rcl_lat, push latitudes onto the top of the stack (degrees) -
    • rcl_lon, push longitudes onto the top of the stack (degrees) -
    • sto_lon, save top of stack as longitudes (degrees) (wgrib2 v3.0.0+) -
    • sto_lat, save top of stack as latitudes (degrees) (wgrib2 v3.0.0+) -
    • note: latitudes and longitudes are double precision values, the stack is single precision -
    -
    - -Variables and Constants: put on the top of the stack -
    -
      -
    • number number = floating point or integer number like 0, 10.1, -1.23e-4 -
    • days_in_ref_month number of days in the month for the reference date (conversion between monthly acc. and rates) -
    • days_in_verf_month number of days in the month for the verification time (conversion betwee monthly acc. and rates) -
    • pi 3.1415.... -
    • rand random number uniformly distributed between 0 and 1, each grid point has a different random number -
    -
    - -Printing Operators: -
    -
      -
    • print_corr, write cosine weighted spatial correlation, data[TOP] data[TOP-1] -
    • print_max, print_min, data[TOP] -
    • print_rms, write cosine weighted RMS, data[TOP]-data[TOP-1] -
    • print_diff, write cosine weighted difference, data[TOP-1]-data[TOP] -
    • print_ave, write cosine weighted average, grid_ave(data[TOP]*cos(grid))/grid_ave(cos(grid)) -
    • print_wt_ave, write weighted average grid_ave, data[TOP] is the weighting - print grid_ave(data[TOP]*data[TOP-1])/grid_ave(data[TOP]) -
    -
    - - -

    Example 1

    -

    -The standard units of grib temperature is K but you want the text output in Celcius. -

    -$ wgrib2 a.grb -match ":TMP:850 mb:" -rpn "273.15:-" -text C.dat
    -
    - -

    -Fahrenheit is easy too (F = (K-273.15)*9/5+32). -

    -$ wgrib2 a.grb -match ":TMP:850 mb:" -rpn "273.15:-:9:*:5:/:32:+" -text F.dat
    -
    - -

    Example 2

    -

    -Suppose you want to limit the relative humidity values to 100. This example only -affect the RH fields. All submessages will be converted into messages. -

    -$ wgrib2 a.grb -if ":RH:" -rpn "100:min" -fi -grib_out out.grb -not_if ":RH:" -grib out.grb
    -
    - -

    Example 3

    -

    -Suppose that you wanted the 500 to 1000 mb thickness, and the file only contained -one field of Z1000 and one field of Z500. - -

    -$ wgrib2 IN.grb -match ":HGT:" -match ":(500|1000) mb:" \
    -     -if ":500 mb:" -rpn sto_1 -fi \
    -     -if ":1000 mb:" -rpn sto_2 -fi \
    -     -if_reg "1:2" \
    -         -rpn "rcl_1:rcl_2:-:clr_1:clr_2" \
    -         -set_var THICK -set_lev "500-1000 mb" \
    -         -set_grib_type c3 -grib_out OUT.grb
    -
    -     line 1: only process the HGT at 500 and 1000 mb which save processing time
    -     line 2: store HGT at 500mb in register 1
    -     line 3: store HGT at 1000mb in register 2
    -     line 4: if (register 1 and register 2 have values then
    -     line 5: calculate the thickness: reg_1 - reg_2
    -     line 6: set variable type to THICK, and level to "500-1000 mb"
    -     line 7: write out the WIND data to a grib file with complex compression
    -
    -     Note: this is a very simple script and that doesn't check the matching
    -     date code, grid type, etc.
    -
    - -

    Example 4

    -

    -Write out the 500 mb wind speed. -

    -$ wgrib2 IN.grb -match ":[UV]grd:500 mb:" \
    -     -if ":UGRD:" -rpn "sto_1" -fi \
    -     -if ":VGRD:" -rpn "sto_2" -fi \
    -     -if_reg 1:2 \
    -         -rpn "rcl_1:sq:rcl_2:sq:+:sqrt:clr_1:clr_2" \
    -         -set_var WIND \
    -         -grib_out out.grb
    -
    -     line 1: only process the U and V at 500 mb
    -     line 2: store U 500mb in register 1
    -     line 3: store V 500mb in register 2
    -     line 4: if (register 1 and register 2 have values then
    -     line 5: calculate the wind speed: sqrt(reg_1**2 + reg_2**2)
    -     line 6: set variable type to WIND (wind speed)
    -     line 7: write out the WIND data to a grib file
    -
    -     Note: this is a very simple script and that doesn't check the matching
    -     date code, grid type, etc.
    -
    -     Note: there are options to calculate wind speed and wind direction
    -
    - - -

    Example 5

    -

    -Suppose someone made a mistake and the latent heat flux (LHTFL) had the wrong sign. RPN to the rescue. - -

    -$ wgrib2 IN.grb -match ":LHTFL:" -rpn "-1:*" -grib_out new_lhtfl.grb
    -
    - -The file, new_lhtfl, only contained the LHTFL fields. You duplicate the file with the -fixed LHTFL fields by - -
    -$ wgrib2 IN.grb -if ":LHTFL:" -rpn "-1:*" -fi -grib_out new.grb
    -
    - -It would be faster if you only compressed the LHTFL fields. (-grib uses the -original compressed data and -grib_out uses the "data" register.) - -
    -$ wgrib2 IN.grb -set_grib_type jpeg \
    -   -not_if ":LHTFL:" -grib new.grb -if ":LHTFL:" -grib_out new.grb
    -
    - - -If both the latent and sensible heat fluxes needed a sign reversal, you could do, - -
    -$ wgrib2 IN.grb -if ":(LHTFL|SHTFL):" -rpn "-1:*" -fi -grib_out new.grb
    -
    -

    Example 6

    -If you want to set certain values to undefined, you define a mask and then -apply the mask. In this example, values below 20 are set to undefined. - -
    -$ wgrib2 a.grb -rpn "dup:20:>=:mask" -grib_out -set_grib_type c3 new.grb 
    -
    -The RPN calculator is used:
    -    dup       the data is duplicated
    -    20        20 is pushed on the stack
    -    >=        test data >= 20, top of stack is 1/0 depending on test >= 20
    -    mask      apply mask to the data
    -
    --set_grib_type c3    sets the grib compression to complex3
    --grib_out new.grb    writes a grib message using the decoded data
    -
    - -Don't forget to enclose the argument to rpn in quotes because the shell can do unexpect things. - -Printing operators -
    -   print_corr   write cosine weighted spatial correlation R(TOP-1), R(TOP)
    -   print_max    write max(R(TOP)) to stdout
    -   print_min    write min(R(TOP)) to stdout
    -   print_rms    write cosine weighted RMS(R(TOP-1)-R(TOP))
    -
    - -

    Example 7: Merging

    - -

    -Suppose that we have a nested model, we have a low resolution TMP2m from the -the outer model and a high-resolution TMP2m from the nested model. Now we -want a field that uses the TMP2m in the nested-model domain and the TMP2m from -the outer model elsewhere. To do this, you need to convert both fields to a -common grid. Then you use "-rpn merge". Make sure that both domains are -contained in the common grid as this is a requirement of the interpolation library. - -

    -   wgrib2 OUTER.T2m -new_grid_winds earth -new_grid A B C A1.grb
    -   wgrib2 NESTED.T2m -new_grid_winds earth -new_grid A B C A2.grb
    -   wgrib2 A2.grb -rpn sto_1 -import_grib A1.GRB -rpn "rcl_1:merge" \
    -    -grib_out MERGED.T2m
    -
    - - -

    Example 8: Land Mask

    -The file mask.grb contains the values 0 for water, 1 for land and -2 for sea ice. I wanted a small file with 0 for water+sea-ice and 1 for land. - -
    -wgrib2 mask.grb -rpn "1:==" -set_scaling 0 1 -set_grib_type c1 -grib_out land.grb
    -
    -  -rpn "1:=="        if grid value is 1, the new value is 1 else 0
    -  -set_scaling 0 1   1 bit for storing the grib values
    -  -set_grib_type c1  complex packing 1 is good for long runs of the same value.
    -   The file sizes  16 bits/point 16 bits precision simple packing (mask.grb)
    -                   0.7 bits per point 16 bits precision complex packing 1 (mask.grb)
    -                   0.2 bits per point complex packing 1 (land.grb)
    -   grid size: 131K points, land.grb is 3331 bytes
    -
    - - -

    Example 9: Total-total index

    -

    -An example of calculating the dewpoint and -total-total index is more involved. Using an on-line infix to postfix (reverse polish) -calculator is helpful. - -

    Example 10: global precipitation

    -

    The model has the precipitation in the variable PRATE -which has units of mm/sec (assuming 1 gm H2O = 1cc). Suppose -I wanted the globally averaged precip in the non-metric unit -of mm/day. It's one command away -

    -  wgrib2 gfsfile -match PRATE -s -rpn "86400:*" -stats
    -
    - -

    Changes

    - -

    Wgrib2 v3.0.0+ adds error chechking to floating point values, -

    -   wgrib2 prior to 3.0.0
    -
    -      wgrib2 IN.grb -rpn "2cars:+" -grib_out OUT.grb
    -           adds 2 to the grid point values as atof("2cars") returns 2.0
    -
    -   wgrib2 v3.0.0+
    -
    -      wgrib2 IN.grb -rpn "2cars:+" -grib_out OUT.grb
    -          will result in an error message as "2cars" is not a legal floating point value
    -
    -

    Comments

    -

    -Warning: Reverse Polish notation can cause headaches if you try something -too complicated. An infix -> postfix calculator is the suggested -remedy. Another approach is to use pywgrib2_s, pywgrib2_xy, or pywgrib2_lite. - - -

    -The -rpn option is a piece of easy to -understand and modify code (RPN.c). If you want to add -a specialized function (ex. wind chill calculation), you many -consider adding it to the RPN calculator. The another method -is to code your calculation in python and use pywgrib2_s, -pywgrib2_xy or pywgrib2_lite. - -

    -Why an RPN calculator? Well, wgrib2 is heavily influenced by the stack language Forth. -It's only natural that the calculator would be based on reverse -Polish notation. - -

    -See also: --if, --if_reg, --fi, --grib_out, --rpn_rcl, --rpn_sto, - - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Aug 4, 2016, Oct 10, 2018, July 11, 2020, July 11, 2021, April 2024 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/rpn_non-trivial_example.html b/web_docs/rpn_non-trivial_example.html deleted file mode 100644 index c60a11f..0000000 --- a/web_docs/rpn_non-trivial_example.html +++ /dev/null @@ -1,293 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -rpn example - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rpn example -
     
    - -

    wgrib2: -rpn to Calculate Dewpoint and Total-Total Index

    -
    - - -

    Introduction

    - -

    -The -rpn option runs a reverse Polish notation -(RPN) -calculator. In this example, I will show how to -calculate the dewpoint and total-total index in wgrib2. The total-total index -correlates with the thunderstorm strength and coverage. - -

    - -
    -TT = (T850-T500) + (Td850 - T500)
    -
    -Td850 = dewp point temperature at 850 mb in C
    -T500 = temperature at the 500 mb level in C
    -T850 = temperature at the 850 mb level in C
    -
    - -

    -The above expression for TT can be written in reverse Polish (postfix) -notation as, - -

    - T850 T500 - Td850 T500 - +
    -
    - -The conversion to reverse Polish is not unique and can be done without electronic aids. -However, we will be doing more complicated expressions and on-line converters -are handy. In a web search, the first two sites that I found were, -

    - -https://www.mathblog.dk/tools/infix-postfix-converter/
    - - -https://scanftree.com/Data_Structure/prefix-postfix-infix-online-converter
    - -

    -To use these sites, enter the expression in the infix box and press the convert -button. By the way, this list is not a endorsement. If I had more patience, I could have found -more sites. With a different search engine, I may have found two different -sites. Anyways with the above postfix expression, the sh script to calculate -the total-total index is, - -

    -     1	#!/bin/sh
    -     2	# calculate total total index
    -     3	#
    -     4	#  file = grib2 file with T850 T500 and Td850 (DPT)
    -     5	#
    -     6	# calulate total total index by
    -     7	# TT = (T850 - T500) + (Td850 - T500)
    -     8	# TT in reverse polish is T850 T500 - Td850 T500 - +
    -     9	
    -    10	file=gdas1.t00z.pgrbanl.grib2
    -    11	
    -    12	wgrib2 $file \
    -    13	  -grib out.grb2 \
    -    14	  -if ":TMP:500 mb:" -rpn "273.15:-:sto_1" -print "saved T500 in reg1" -fi \
    -    15	  -if ":TMP:850 mb:" -rpn "273.15:-:sto_2" -print "saved T850 in reg2" -fi \
    -    16	  -if ":DPT:850 mb:" -rpn "273.15:-:sto_3" -print "saved Td850 in reg3" -fi \
    -    17	  -if_reg "1:2:3" -print ":ready to do work"  \
    -    18	      -rpn "rcl_2:rcl_1:-:rcl_3:rcl_1:-:+" \
    -    19	      -set_var TOTALX -grib_out out.grb2 \
    -    20	  -if_reg "1:2:3" -rpn "clr_1:clr_2:clr_3" -fi
    -
    -Line 13 saves each field in file out.grb2
    -Line 14 saves T500 (C) in register 1, converts from K to C.
    -Line 15 saves T850 (C) in register 2
    -Line 16 saves Td850 (C) in register 3
    -Line 17 if register 1, 2 and 3 are defined then
    -Line 18 calculates TT
    -Line 19 writes TT to out.grb2
    -Line 20 clears registers so that lines 17-19 are only done once
    -
    - -

    -The problem with using the above script with the GFS is that the standard -GFS output does not include dewpoint temperature. You have to compute the -dewpoint from the relative or specific humidity. See the comments -in the following script for the formula used. - -

    -     1	#!/bin/sh
    -     2	# calculate total total index
    -     3	#
    -     4	#  file = grib2 file with T850 T500 and RH850
    -     5	#
    -     6	# step 1: calculate 850 mb dewpoint temp
    -     7	# got formula from here: https://en.wikipedia.org/wiki/Dew_point (retrieved 12/2013)
    -     8	#
    -     9	#     gamma = (ln(RH / 100) + (b * T) / (c + T)
    -    10	#         let r3 = ln(RH/100)
    -    11	#         gamma:  r3 b T * c T + / +
    -    12	#     Td = (c*gamma) / (b-gamma)
    -    13	#       Td: c gamma * b gamma - /
    -    14	#
    -    15	#  some values of (b,c):   18.678, 257.14C  Bolton 1980 MWR
    -    16	#  some values of (b,c):   17.62, 243.12C   Sontag 1990
    -    17	#  some values of (b,c):   17.27, 2137.7C   Paroscientific
    -    18	#
    -    19	#
    -    20	# calulate total total index by
    -    21	# TT = (T850 - T500) + (Td850 - T500)
    -    22	
    -    23	file=gdas1.t00z.pgrbanl.grib2
    -    24	
    -    25	wgrib2 $file \
    -    26	  -grib out.grb2 \
    -    27	  -if ":TMP:500 mb:" -rpn "273.15:-:sto_1" -print "saved T500 in reg1" -fi \
    -    28	  -if ":TMP:850 mb:" -rpn "273.15:-:sto_2" -print "saved T850 in reg2" -fi \
    -    29	  -if ":RH:850 mb:"  -rpn "100:/:ln:sto_3" -print "saved LN(RH850/100) in reg3" -fi \
    -    30	  -if_reg "1:2:3" -print ":calc Td850"  \
    -    31	      -rpn "rcl_3:18.678:rcl_2:*:257.14:rcl_2:+:/:+:sto_4:" \
    -    32	      -rpn "257.14:rcl_4:*:18.678:rcl_4:-:/:sto_5:273.15:+" -set_var DPT -grib_out out.grb2 \
    -    33	  -if_reg "5"  -rpn "rcl_2:rcl_1:-:rcl_5:rcl_1:-:+" -set_var TOTALX -grib_out out.grb2 \
    -    34    -if_reg "5"  -rpn "clr_1:clr_2:clr_3:clr_4:clr_5" -fi
    -
    -Line 26 saves each field in file out.grb2
    -Line 27 saves T500 (C) in register 1, converts from K to C.
    -Line 28 saves T850 (C) in register 2
    -Line 29 saves ln(RH850/100) in register 3
    -Line 30-32 computes dewpoint and saves in register 5 (C) and writes to grib file (K)
    -Line 33 computes total-total index and writes it out
    -Line 34 clears registers
    -
    - -

    -Note that the above script requires wgrib2 v2.0.0 to run. Previous versions -had a problem with the ln function. In hindsight, -if should have been -always closed by -fi rather than an output or a -fi. - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 10, 2013 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/rpn_raw2_2raw.html b/web_docs/rpn_raw2_2raw.html deleted file mode 100644 index 63ce2aa..0000000 --- a/web_docs/rpn_raw2_2raw.html +++ /dev/null @@ -1,277 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -rpn raw2, -rpn 2raw - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -rpn raw2, -rpn 2raw -
     
    - -

    wgrib2 macros: -rpn raw2, -rpn 2raw

    -
    - - -

    Introduction

    - -

    -Mosts of the operators for -rpn are simple and need minimal explanation. -However, the raw2, and 2raw require more explanation. -

    -In grib2 files, the grid point data is stored sequentially and have to be mapped to the grid. -Grib2 defines many methods (scan orders) of mapping the grid point. There are fortran order, -C order, West to east, east to west, south to north and north to south. The rows can -have a uniform direction or the even rows have a direction and the odd rows have another -direction. Then you can add on the various Arakawa grids, and everything is messy. - -

    -To avoid this mess, the default mode in wgrib2 is to convert the internal grids to WE:SN order. -It makes life easier for the users and easier for the -developers. You are encouraged to use WE:SN order because it is a requirement for wgrib2's -geolocation routines. (I.e., wgrib2 requires WE:SN order in order to calculate the grid's -latitude and longitude.) The only exception to this rule is the -new_grid -option which requires the data to be in raw order (output order=raw). This option is -an exception because -new_grid expects that data to be in raw order. - -

    -To alter the internal scan order, you can use the -order option. - -

    --sh-4.1$ wgrib2 gep19.t00z.pgrb2af180 -d 1 -V
    -1:0:vt=2009061212:200 mb:180 hour fcst:HGT Geopotential Height [gpm]:ENS=+19
    -    ndata=65160:undef=0:mean=11760.3:min=10393.5:max=12525
    -    grid_template=0:winds(N/S):
    -	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output WE:SN res 48
    -	lat 90.000000 to -90.000000 by 1.000000
    -	lon 0.000000 to 359.000000 by 1.000000 #points=65160
    - -- the grib files is WE:NS order (input WE:NS)
    - -- the internal grid is WE:SN order (output WE:SN)
    -
    --sh-4.1$ wgrib2 gep19.t00z.pgrb2af180 -d 1 -V -order raw
    -1:0:vt=2009061212:200 mb:180 hour fcst:HGT Geopotential Height [gpm]:ENS=+19
    -    ndata=65160:undef=0:mean=11760.3:min=10393.5:max=12525
    -    grid_template=0:winds(N/S):
    -	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output raw res 48
    -	lat 90.000000 to -90.000000 by 1.000000
    -	lon 0.000000 to 359.000000 by 1.000000 #points=65160
    - -- the grib files is WE:NS order (input WE:NS)
    - -- the internal grid is raw order (output raw), which means the same as input scan order
    -
    --sh-4.1$ wgrib2 gep19.t00z.pgrb2af180 -d 1 -V -order we:sn
    -1:0:vt=2009061212:200 mb:180 hour fcst:HGT Geopotential Height [gpm]:ENS=+19
    -    ndata=65160:undef=0:mean=11760.3:min=10393.5:max=12525
    -    grid_template=0:winds(N/S):
    -	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output WE:SN res 48
    -	lat 90.000000 to -90.000000 by 1.000000
    -	lon 0.000000 to 359.000000 by 1.000000 #points=65160
    - -- the grib files is WE:NS order (input WE:NS)
    - -- the internal grid is WE:SN order (output WE:SN)
    -
    --sh-4.1$ wgrib2 gep19.t00z.pgrb2af180 -d 1 -V -order we:ns
    -1:0:vt=2009061212:200 mb:180 hour fcst:HGT Geopotential Height [gpm]:ENS=+19
    -    ndata=65160:undef=0:mean=11760.3:min=10393.5:max=12525
    -    grid_template=0:winds(N/S):
    -	lat-lon grid:(360 x 181) units 1e-06 input WE:NS output WE:NS res 48
    -	lat 90.000000 to -90.000000 by 1.000000
    -	lon 0.000000 to 359.000000 by 1.000000 #points=65160
    - -- the grib files is WE:NS order (input WE:NS)
    - -- the internal grid is WE:SN order (output NS)
    -
    --sh-4.1$ wgrib2 reduced_gaussian_surface_jpeg.grib2 -d 1 -V
    -1:0:vt=2007032312:surface:anl:TMP Temperature [K]:
    -    ndata=6114:undef=0:mean=285.342:min=210.255:max=317.485
    -    grid_template=40:winds(N/S):
    -	thinned global Gaussian grid: (-1 x 64) units 1e-06 input WE:NS output raw
    -	number of latitudes between pole-equator=32 #points=6114
    -	lat 87.864000 to -87.864000
    -	lon 0.000000 to 357.188000 
    -	#grid points by latitude: 20 27 36 40 45 50 60 64 72 75 80 90 90
    -	 96 100 108 108 120 120 120 128 128 128 128 128 128 128 128 128 128 128 128 128
    -	 128 128 128 128 128 128 128 128 128 128 128 120 120 120 108 108 100 96 90 90
    -	 80 75 72 64 60 50 45 40 36 27 20
    - -- in this file, the grid dimension is -1 x 64.  This is a thinned Gaussian grid, and
    -    nlongitude is variable.  The output scan order is raw.
    -
    -
    - - -

    -The raw2 operator is short for "raw scan order 2 output scanning order", and -2raw is short for "output scanning mode 2 raw scan mode". -The raw2 applies the mapping that goes from the file's scanning mode -to the interal scanning mode (default WE:SN). -The 2raw applies the inverse mapping. - - -

    Example 1

    - -
    -$ wgrib2 IN.grb -d 1 -rpn "rcl_lon:2raw" -set_var geolon -bin out \
    -   -rpn "rcl_lat:2raw" -set_var geolat -bin out 
    -
    -This write the longitude and latitude in binary format to file "out".
    -The lon/lat are written in the same format as the input file.
    -
    - -

    Example 2

    - -
    -SST0.grb - SST in grib format (template) in WE:NS order
    -SST.bin  - new SST in binary format, and WE:NS scan order
    -SST.grb  - new SST in grib format
    -
    -$ wgrib2 SST0.grb -import_bin SST.bin -rpn "raw2" -set_date 2020010100 -grib_out SST.grb
    -
    -or 
    -
    -$ wgrib2 SST0.grb -order raw -import_bin SST.bin -set_date 2020010100 -grib_out SST.grb
    -
    - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created 3/30/2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/rpn_rcl.html b/web_docs/rpn_rcl.html deleted file mode 100644 index 93cc876..0000000 --- a/web_docs/rpn_rcl.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -rpn_rcl - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rpn_rcl -
     
    - -

    wgrib2: -rpn_rcl

    -
    - - -

    Introduction

    - -

    -The -rpn_rcl N is option that behaves like --rpn "rcl_N". The only difference is the -the latter will automatically compute the longitudes and latitudes -of all the grid points. -The -rpn_rcl and --rpn_sto do not initiate the geolocation -calculations which make them ideal for CW2 applications. -

    Usage

    -

    -

    --rpn_rcl N     N=0..9
    -   replaces the memory-copy of the grid values with register N
    -
    - -

    -See also: --rpn, --rpn_sto, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Aug 3, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/rpn_smth9.html b/web_docs/rpn_smth9.html deleted file mode 100644 index 88b91a6..0000000 --- a/web_docs/rpn_smth9.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -rpn smth9g smth9r - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rpn smth9g smth9r -
     
    - -

    wgrib2: -rpn smth9g smth9r

    -
    - - -

    Introduction

    - -

    -The RPN operators smth9g and smth9r do a 9 point -smoothing of a spatial field. These operators are based on the GrADS's smth9 operator. There -are two differences. (1) GrADS knows whether the fields are global or regional whereas RPN -has a regional and global operator. (2) GrADS's smth9 function will not convert undefined -grid point to defined whereas RPN's smth9 will. - -

    Smth9 Weighting

    -

    -Smth9 considers a 3x3 box centered about the grid point in question (i,j). -The following weights are used. Points that are outside of the domain -or have undefined values are naturally not included. - -

    -       0.3   0.5   0.3
    -       0.5   1.0   0.5
    -       0.3   0.5   0.3
    -
    - -

    Reasons for differences from GrADS smth9

    - -

    You often want to run GCMs with observed SST and sea-ice fields. -A problem can occur when the land-water mask of the model is not the -same as for the SST or sea-ice analyses. For example, if the land -masks differ, there may be a grid point where the SST analyses considers -to be land and the model considers to be water. By using smth9g, you can -minimize this problem. - - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sep 15, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/rpn_sto.html b/web_docs/rpn_sto.html deleted file mode 100644 index de7dee7..0000000 --- a/web_docs/rpn_sto.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -rpn_sto - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rpn_sto -
     
    - -

    wgrib2: -rpn_sto

    -
    - - -

    Introduction

    - -

    -The -rpn_sto N is option that behaves like --rpn "sto_N". The only difference is the -the latter will automatically compute the longitudes and latitudes -of all the grid points. -The -rpn_rcl and --rpn_sto do not initiate the geolocation -calculations which make them ideal for CW2 applications. - -

    Usage

    -

    -

    --rpn_sto N     N=0..9
    -   saves the memory-copy of the grid values in to register N
    -
    - -

    -See also: --rpn, --rpn_rcl, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Aug 3, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/rpn_wind-chill.html b/web_docs/rpn_wind-chill.html deleted file mode 100644 index e97f54c..0000000 --- a/web_docs/rpn_wind-chill.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -rpn example: wind-chill - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-rpn example -
     
    - -

    wgrib2: -rpn to Calculate Wind-Chill

    -
    - - -

    Introduction

    - -

    -The -rpn option runs a reverse Polish notation -(RPN) -calculator. In this example, I will show how to calculate the -wind-chill with wgrib2. The formula for wind chill (Environment Canada) -depends on the temperature (2 m) and wind speed (10 m). -

    - -
    -# from formula from wikipedia (retrieved 12/2013)
    -#
    -# wind chill formula used by Environment Canada
    -#
    -# Twc = 13.12 + 0.6216*T - 11.37*V^0.16 + 0.3965 * T * V^0.16
    -#  Twc = wind chill in C
    -#  T = air temp in C
    -#  V = 10 m wind speed in m/s
    -
    - -Using an online infix -> postfix converter, one finds -
    -Twc is 13.12 0.6216 T * + 11.37 V 0.16 ^ * - 0.3965 T * V 0.16 ^ * +
    -
    - -Here is the script. - -
    -     1	#!/bin/sh
    -     2	#
    -     3	# from formula from wikipedia (retrieved 12/2013)
    -     4	#
    -     5	# wind chill formula used by Environment Canada
    -     6	#
    -     7	# Twc = 13.12 + 0.6216*T - 11.37*V^0.16 + 0.3965 * T * V^0.16
    -     8	#  Twc = wind chill in C
    -     9	#  T = air temp in C
    -    10	#  V = 10 m wind speed in m/s
    -    11	#
    -    12	# using online infix -> postfix converter
    -    13	#      Twc is 13.12 0.6216 T * + 11.37 V 0.16 ^ * - 0.3965 T * V 0.16 ^ * +
    -    14	#
    -    15	# for grib2 wind chill is in K
    -    16	#
    -    17	file=$1
    -    18	out=out.grb2
    -    19	
    -    20	wgrib2 $file \
    -    21	  -grib $out \
    -    22	  -if ":TMP:2 m above ground:" -rpn "273.15:-:sto_1" -print "saved T2m in reg1" -fi \
    -    23	  -if ":UGRD:10 m above ground:" -rpn "sto_2" -print "saved U10m in reg2" -fi \
    -    24	  -if ":VGRD:10 m above ground:" -rpn "sto_3" -print "saved V10m in reg3" -fi \
    -    25	  -if_reg "1:2:3" -rpn "rcl_2:rcl_2:*:rcl_3:rcl_3:*:+:sqrt:sto_4" -print "wind speed calculated" \
    -    26	      -rpn "13.12:0.6216:rcl_1:*:+:11.37:rcl_4:0.16:^:*:-:0.3965:rcl_1:*:V:0.16:^:*:+:273.15:+" \
    -    27	      -set_var WCF -grib_out $out  \
    -    28	  -if_reg "1:2:3" -rpn "clr_1:clr_2:clr_3" -fi
    -
    -Line 21 copies all fields to file $out
    -Line 22 saves 2 m temperature (C) register 1
    -Line 23 saves 10 m U (m/s) in register 2
    -Line 24 saves 10 m V (m/s) in register 3
    -Line 25 calculates and saves wind speed in register 4
    -Line 25-27 writes out WCF, wind chill (factor) in K.
    -Line 28 clears registers so that lines 24-27 are only done once
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 10, 2013 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/s.html b/web_docs/s.html deleted file mode 100644 index 35473d3..0000000 --- a/web_docs/s.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -s - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-s -
     
    - -

    wgrib2: -s

    -
    - - -

    Introduction

    - -

    -The -s option prints out a simple inventory. - -

    --sh-2.05b$ wgrib2 new.grb2 -s 
    -1:0:d=2007032600:HGT:1000 mb:anl:
    -2:125535:d=2007032600:HGT:1000 mb:3 hour fcst:
    -
    - -

    -The -s option is coded like a macro, the option -call other options like -t, -var, -lev, -ftime, and -misc. The last option, --misc, changes with time. For example, when chemical tracers were added, -misc -was expanded to print out the characteristics of the tracers. - -

    -The output of the options, including -s, can be saved by the -inv option. -

    Usage

    -

    - -

    --s
    -
    - -See also: --ftime, --inv, --lev, -macros, --match_inv --misc --t --var -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, Nov, 2019 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/s_out.html b/web_docs/s_out.html deleted file mode 100644 index 30600da..0000000 --- a/web_docs/s_out.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -s_out - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -s_out -
     
    - -

    wgrib2: -s_out

    -
    -

    The -s_out option is obsolete with the introduction of the --last option. -

    -    old:  -s_out FILE
    -    new:  -s -last FILE -nl_out FILE
    -
    - - - - -

    Introduction

    - -

    -The -s_out option prints out a simple inventory (-s) to a file. - -

    --sh-2.05b$ wgrib2 new.grb2 -s inv.dat
    -1:0:d=2007032600:HGT:1000 mb:anl:
    -2:125535:d=2007032600:HGT:1000 mb:3 hour fcst:
    --sh-2.05b$ cat inv.dat
    -d=2007032600:HGT:1000 mb:anl:
    -d=2007032600:HGT:1000 mb:3 hour fcst:
    -
    - -

    Usage

    -

    - -

    --s_out FILE
    -
    - -See also: -s, --s_f77, --inv, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/scale.html b/web_docs/scale.html deleted file mode 100644 index bc37c83..0000000 --- a/web_docs/scale.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -scale - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-scale -
     
    - -

    wgrib2: -scale

    -
    - - -

    Introduction

    - -

    -In grib, grid values are usually stored as - -

    -  grid_value = (ref_value + I*2**bin_scaling)) * 10**decimal_scaling.
    -    ref_value = 32-bit IEEE floating point number
    -    I is a positive integer
    -    binary_scaling = -127..127
    -    decimal_scaling = -127..127
    -
    - -This is not an absolute as the grid point values can be stored as -a spectral coefficients, IEEE floating point values and other formats. -The -scale option prints the binary and -scaling factors. - -

    Usage

    -

    -

    --scale
    -
    - -

    Example

    -

    -

    -bash-4.1$ wgrib2 gep19.t00z.pgrb2af180  -scale -for 13:14
    -13:473374:scale=-3,4
    -14:528630:scale=-1,0
    -bash-4.1$ wgrib2 gep19.t00z.pgrb2af180  -scale -for 13:14 -v -packing
    -13:473374:scale=-3,4:packing=grid point data - jpeg2000 compression,j val=(2.32109e+06+i*2^4)*10^-3, i=0..65535 (#bits=16)
    -14:528630:scale=-1,0:packing=grid point data - jpeg2000 compression,j val=(2215+i*2^0)*10^-1, i=0..1023 (#bits=10)
    -
    - -

    -See also: --scaling --set_scaling -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 21, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/scaling.html b/web_docs/scaling.html deleted file mode 100644 index 7d83039..0000000 --- a/web_docs/scaling.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -scaling - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-scaling -
     
    - -

    wgrib2: -scaling

    -
    - - -

    Introduction

    - -

    -In grib, grid values are usually stored as - -

    -  grid_value = (ref_value + I*2**bin_scaling)) * 10**decimal_scaling.
    -    I is an positive integer
    -    ref_value = 32-bit IEEE floating point number
    -    binary_scaling = -127..127
    -    decimal_scaling = -127..127
    -    number_of_bits = the smallest N such that I < 2**N
    -      note: WMO does not place a maximum value of the number of bits
    -            however, implementations do have limits.  The limits will
    -            vary by software package and procedure.  
    -
    - -This is not an absolute as the grid point values can be stored as -a spectral coefficients, IEEE floating point values and other formats. -The -scaling option -prints the binary and scaling factors, the reference value and the number -of bits used for the integer I. - -

    Usage

    -

    -

    --scaling
    -
    - -

    Example

    -

    -

    -$ wgrib2 gep19.t00z.pgrb2af180  -scaling -for 13:14 -v -packing
    -13:473374:scaling ref=2.32109e+06 dec_scale=-3 bin_scale=4 nbits=16:packing=grid point data - jpeg2000 compression,j val=(2.32109e+06+i*2^4)*10^-3, i=0..65535 (#bits=16)
    -14:528630:scaling ref=2215 dec_scale=-1 bin_scale=0 nbits=10:packing=grid point data - jpeg2000 compression,j val=(2215+i*2^0)*10^-1, i=0..1023 (#bits=10)
    -
    - -

    -See also: --scale --set_scaling --grib_max_bits -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 21, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/scaling_0001.html b/web_docs/scaling_0001.html deleted file mode 100644 index aa9a131..0000000 --- a/web_docs/scaling_0001.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ncpu - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -scaling_0001 -
     
    - -

    wgrib2: -scaling_0001

    -
    - - -

    Scaling_0001

    - -

    -The standard NCEP post-processor uses data files that specify the -precision of every field (grid values have values of i*10^j*2^k, -where j and k are specified by the data file). Different models -may have different precisions even though they use the -same NCEP post-processor. - -

    Wgrib2, by default, writes new fields using the ECMWF-style -which specifies the binary precision, n. (grid values have values -i*2^j, where the values of i ranges from 0 to 2^(n+1) - 1) - -

    The --scaling_0001 option converts a field from ECMWF-style -precision to NCEP-style precision. Since everybody has a different scaling, --scaling_0001 was designed to be an example on how -to write an option that applies your precisions. I am assuming -that are creative enough that there will be no duplicate names. I will -include scaling_* to the wgrib2 distributions. - -

    Usage

    -

    -

    --scaling_0001
    -
    - -

    Example

    -
    -wgrib2 IN.grb -scaling_0001 -set_grib_type c3 -grib_out OUT.grb
    -
    - -

    To add your own Scaling

    -
    -1) cd (wherever)/grib2/wgrib2
    -2) cp Scaling_0001.c Scaling_mymodelv1.c
    -          (note code needs to start with a capital)
    -3) edit Scaling_mymodelv1.c
    -     don't forget to change scaling_0001 to scaling_mymodelv1 everywhere
    -4) cd ..
    -(compile wgrib2 using directions)
    -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 10, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/scan.html b/web_docs/scan.html deleted file mode 100644 index 11c59bf..0000000 --- a/web_docs/scan.html +++ /dev/null @@ -1,249 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -scan - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -scan -
     
    - -

    wgrib2: -scan

    -
    - - -

    Introduction:

    - -

    -A grib message contains the grid point values. If you are a C programmer, the grid would -naturally be in "C" order. A fortran programmer would have the grid in fortran order. -Some people would start from the NW corner and others would start from the SW corner. -In grib1, all these scan orders are possible. The grib1 scan orders are, - -

      -
    1. WE:SN -
    2. WE:NS -
    3. EW:SN -
    4. EW:NS -
    5. SN:WE -
    6. NS:WE -
    7. SN:EW -
    8. NS:EW -
    - -You read the above notation (WE:SN) by first go from W to E then go from S to N. - -
    -AB:CD
    -   do i = C to D
    -     do j = A to B
    -       data
    -     enddo
    -   enddo
    -
    - -Grib2, includes the above 8 scan orders and adds 4 more useful -scan orders. - -
      -
    1. WE|EW:SN -
    2. WE|EW:NS -
    3. EW|WE:SN -
    4. EW|WE:NS -
    - -
    -AB|BA:CD
    -   odd_row=true
    -   do i = C to D
    -     if (odd_row) {
    -       do j = A to B
    -         data
    -       enddo
    -     }
    -     else {
    -       do j = B to A
    -         data
    -       enddo
    -     }
    -     odd_row = not odd_row
    -   enddo
    -
    -

    -This "plow the field" order reduces the file size when using -regional grids and saving the increments. -

    - -

    -Grib2 has 16 scan orders of which 3 are common: WE:SN, WE:NS and WE|EW:SN. -Wgrib2 simplfies life by internally converting fields to WE:SN by default. - -

    Usage

    -

    - -

    --scan
    -
    -

    Example

    -

    -

    --$ wgrib2 ds_ens.grb -scan
    -1:0:scan=5 input=WE|EW:SN output=WE:SN
    -2:218709:scan=5 input=WE|EW:SN output=WE:SN
    -3:434276:scan=5 input=WE|EW:SN output=WE:SN
    -...
    -input=WE|EW:SN   the grib file is in WE|EW:SN scan order
    -output=WE:SN     the internal registers and output files except for grib
    -                 will be in WE:SN order, use the -order option to change
    -                 the output scan order
    -
    - -See also: --order, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/selecting_messages.html b/web_docs/selecting_messages.html deleted file mode 100644 index ff4b0db..0000000 --- a/web_docs/selecting_messages.html +++ /dev/null @@ -1,189 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lola - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 selecting messages -
     
    - -

    wgrib2: selecting messages

    -
    - - -

    Introduction

    - -

    -

    - -Grib files contain many grib messages (records, fields). Often you only want to -process selected fields. With wgrib, you could process all "-d all", specific -message number, "-d N", or by using "grep" and the "-i" option. - -

    -   wgrib -d all grb                            writes all records to binary file to "dump"
    -   wgrib -d 10  grb                            write record 10 to binary file "dump"
    -   wgrib grb | grep ":HGT:" | wgrib -i grb     write HGT fields to "dump"
    -
    - -

    -Wgrib2 is very similar. The differences is that "-d all" is gone and writing -to binary file is not a default option. - -

    -

    -   wgrib2 -bin dump grb                       write all records to binary file "dump"
    -   wgrib2 -d 10   -bin dump grb               write record 10 to binary file "dump"
    -   wgrib2 -d 10.1 -bin dump grb               write record 10.1 to binary file "dump"
    -   wgrib2 grb | grep ":HGT:" | wgrib2 -i grb -bin dump    write HGT fields to "dump"
    -   wgrib2 -match ":HGT:" grb -bin dump        new syntax: write HGT fields to "dump"
    -
    - -One difference is record numbers may have a "decimal point". With grib2, for example, -the U and V winds may be in the same grib2 record. In the wgrib2 notation, -the first submessage would be N.1 (or N) and the second submessage would be N.2. - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set.html b/web_docs/set.html deleted file mode 100644 index 3e59053..0000000 --- a/web_docs/set.html +++ /dev/null @@ -1,261 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set -
     
    - -

    wgrib2: -set

    -
    - - -

    Introduction

    - -

    -Please see new grib for the basic -concepts of making new grib files. - - -

    -The -set option changes specific metadata -of the in-memory grib (sub-)message. Expect the list of -supported fields to expand as needed. At present, the --set option only changes fields -within the grib file. There is some overlap between various --set_* options and the -set option. (Ex. -set_center N, and -set center N.) -The -set option is the newer method. -

    - -

    Parameters that can be set

    -

    The available parameters that can be set will depend on the version of wgrib2 being used. -To see the parameter available, - -

    -$ wgrib2 grib_file -set junk junk
    -*** FATAL ERROR: set: allowed values: discipline, center, subcenter, master_table, local_table, 
    -background_process_id, analysis_or_forecast_process_id, model_version_date, chemical, table_1.2, 
    -table_1.3, table_1.4, table_3.0, table_3.1/GDT, table_3.2, table_3.3, table_3.4, table_4.0/PDT, 
    -table_4.1, table_4.2, table_4.3, table_4.5a, table_4.5b, table_4.6, table_4.7, table_4.8, 
    -table_4.10, table_4.11, table_4.230, table_5.0/DRT, table_6.0, % ***
    -
    -"grib_file" has to be a grib file, and "junk" is any non-supported parameter. -

    - -

    - -

    Usage

    -
    --set X Y             X=field, Y=integer/float/long long int
    -                     depending on X
    -
    -                     To find the values of X, use: wgrib2 - -set help all
    -
    - -

    Fields (as of wgrib2 v2.0.1)

    - -
      -
    1. discipline or table_0.0 (fixed v2.0.5) -
    2. center -
    3. subcenter -
    4. master_table or table_1.0 -
    5. local_table or table_1.1 -
    6. background_process_id -
    7. analysis_or_forecast_process_id -
    8. model_version_date -
    9. table_1.2 -
    10. table_1.3 -
    11. table_1.4 -
    12. table_3.0 -
    13. table_3.1 or GDT -
    14. table_3.3 -
    15. table_3.4 -
    16. table_4.0 or PDT -
    17. table_4.1 -
    18. table_4.2 -
    19. table_4.3 -
    20. table_4.6 -
    21. table_4.10 -
    22. table_4.11 -
    23. table_5.0 or DRT -
    24. table_6.0 -
    - -

    Fields (as of wgrib2 v2.0.8)

    -
      -
    1. most are obvious and take an integer argument -
    2. %: integer 0..100, percentage forecast -
    3. model_version_date: YYYYMMDDHHmmss, for PDT 4.60 and 4.61 -
    - -

    Example

    -
    -$ wgrib2 -set center 99 -center
    -1:0:center=De Bilt, Netherlands
    -2:46042:center=De Bilt, Netherlands
    -3:63079:center=De Bilt, Netherlands
    -4.1:86046:center=De Bilt, Netherlands
    -...
    -
    - -The -set_var option will rename -all the fields in a grib file. If you only want to rename -specific fields, you will have to use the --if and -fi options. -

    -See also: - --fi, --grib, --grib_out, --if --set_metadata -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, April 13, 2018, April 8, 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_ave.html b/web_docs/set_ave.html deleted file mode 100644 index 0cbc6ed..0000000 --- a/web_docs/set_ave.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_ave - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_ave -
     
    - -

    wgrib2: -set_ave

    -
    - - -

    Introduction

    - -

    -Prior to 7/2016, ftime v1 was used to print the "ftime" values. -One used set_time v1 and set_ave to modify the "ftime" values. -After 7/2016, the version 1 routines because -ftime1, -set_ftime1 and -set_ave. -The version 2 routines became -ftime2 and -set_ftime2. The -set_ave was -not used. For -ftime and -set_ftime options called -ftime2 and -set_ftime2 -by default. - -

    -Eventually the version 1 routines will be removed. - -

    -See also: --set_ftime --set_ftime1 --set_ftime2 -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sept 12, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_bin_prec.html b/web_docs/set_bin_prec.html deleted file mode 100644 index 42727a0..0000000 --- a/web_docs/set_bin_prec.html +++ /dev/null @@ -1,240 +0,0 @@ - efficiently. - - - Climate Prediction Center - wgrib2: -set_bin_prec - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_bin_prec -
     
    - -

    wgrib2: -set_bin_prec

    -
    - - -

    Introduction

    - -

    -The values at the grid points points are stared in a general format, - -

    -
    -  Y = (R + i*2**B)*(10**D)
    -
    -  R = reference value (32-bit IEEE floating point number)
    -  i = integer, 0..2**N-1
    -  N = binary bit precision
    -  B = binary scaling, -127..127
    -  D = decimal scaling, -127..127
    -
    - -There are 3 sytems for storing the number which I have called - -
    -
    -ECMWF convention: D = 0, N = parameter
    -
    -  Y = R + i*2**B
    -  R = reference value
    -  i = integer, 0..2**N-1
    -  N = binary bit precision, a parameter
    -  B = binary scaling, determined by grib routines
    -
    -NCEP convention: B = parameter, D = parameter
    -
    -  R = reference value
    -  i = integer, 0..2**N-1
    -  N = binary bit precision, determined by grib routines
    -  B = binary scaling, a parameter
    -  D = decimal scaling, a parameter
    -
    -  Note, global model uses a variant: B = 0, D = parameter
    -
    - -

    -Both the ECMWF and NCEP conventions have their advantages and -disadvantages. The ECMWF method is easier to use, you just -set the binary precision to N bits (12? 16?) for all variables -and you are done. With the NCEP convention, you have to -set the scaling for each variable separately. For some variables -such as specific humidity, the scaling should be pressure -dependent. On the other hand, if you are trying to get the smallest -files, the NCEP convention is better. For example, you want to -get the RH to the nearest integer. With the NCEP method, you simply -set D = B = 0. For general use, I suggest that you use the ECMWF -convention because people time is usually more valuable than disk space. -Ok, I value my time more than a few GB. On the othe hand, I've been -involved with more than my share of projects were disk space -has been the critical issue. -

    -By the way, the wgrib2 default for encoding grib is 12-bits using -the ECMWF convention. - -

    Usage

    -The -set_bin_prec option is used to -set wgrib2 to encode data using the ECMWF convention. - -

    - -

    --set_bin_prec N
    -  N = number of bits to encode grid point data
    -  N should be ≤ 25 for the current version of wgrib2
    -
    -  if N is > 12, you need to increase the maximum bits of allowed
    -  precision by -set_grib_max_bits
    -
    - -

    -See alse: --scale --scaling --set_grib_max_bits --set_scaling -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 21, 2015, Marcy 11, 2019 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_bitmap.html b/web_docs/set_bitmap.html deleted file mode 100644 index 99d1367..0000000 --- a/web_docs/set_bitmap.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_betmap - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_bitmap -
     
    - -

    wgrib2: -set_bitmap

    -
    - - -

    Introduction

    - -

    -Complex packed grib files can have undefined grid values stored in -the grib files as either a bitmap or a special value. You should use -the special value method because it results in significantly smaller -files. If software is a concern, you should use whatever is compatible -with the decoding software. Note: only complex packing allows for -using a special value for undefined grid values. - -

    Wgrib2's will store undefined grib values using a special -value when using complex packing unless the --set_bitmap 1 option is used. -The option -set_grib_type same will not -enable the bitmap option. - -

    Software Concerns

    - -

    -NDFD (National Digital Forecast Database) which is produced by NOAA has -used complex packing with a special value since the beginning (many years ago). -Consequently many decoders will be able to handle special-value undefineds. -Many codes will handle bitmaps because bitmaps were used in -jpeg2000 packed grib2 files which have been used by NCEP for many -years. At least one organization has codes that will not read -special-value undefineds. - -

    Usage

    -

    - -

    --set_bitmap X   X=0, 1   0=do not use bitmap (default) 1=use bitmap
    -                when packing undefined values with complex packing
    -
    - -

    Example

    -

    - -

    -$ wgrib2 in.grb -set_bitmap 1 -set_grib_type complex3 -grib_out out.grb 
    -
    -The above line rewrites a file using complex3 packing and a bitmap. -A bitmap is not used if all the grid values are defined. - -

    -See also: -grib_out, -See also: -set_grib_type, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan 14, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_byte.html b/web_docs/set_byte.html deleted file mode 100644 index 241835a..0000000 --- a/web_docs/set_byte.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_byte - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_byte -
     
    - -

    wgrib2: -set_byte

    -
    - - -

    Introduction

    - -

    -The -set_byte option sets 1 octet (byte) to a -a specified integer value. The integer value ranges from 0 to 255. - - -

    --set_byte I J K
    -  I = section number = 1..7
    -  J = location in the section = 1..(section length)
    -  K = 0 .. 255
    -would set 
    -  Section I, Octet J to the value K
    -
    - -

    -Multiple octets can be set by making the third argument a colon seperated list. - -

    Usage

    -

    - -

    --set_byte  SECTION STARTING_OCTET_LOCATION I-1:I-2:..:I-N
    -SECTION=0 .. 7
    -STARTING_OCTET_LOCATION ≥ 1
    -I-M = Mth octet
    -
    - -

    Example

    - -

    -See also: --set_hex --set_ieee --set_int --set_int2 --set_ieee -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: June 1, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_center.html b/web_docs/set_center.html deleted file mode 100644 index c291fbe..0000000 --- a/web_docs/set_center.html +++ /dev/null @@ -1,170 +0,0 @@ - efficiently. - - - Climate Prediction Center - wgrib2: -set_center - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_center -
     
    - -

    wgrib2: -set_center

    -
    - - -

    Introduction

    - -

    -The -set_center option is deprecated, please use -the -set center option. - -

    -See alse: --set -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: August 11, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_date.html b/web_docs/set_date.html deleted file mode 100644 index 3a3ef1d..0000000 --- a/web_docs/set_date.html +++ /dev/null @@ -1,246 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_date - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_date -
     
    - -

    wgrib2: -set_date

    -
    - - -

    Introduction

    - -

    -The -set_date option changes the reference -date of the in-memory grib (sub-)message. You can write out the message -with the new date by the -grib option. If you use --grib_out option to write out the changed grib message, you -will write the grib message with the compression method and precision that -is in effect at the time. This is slower and may lose precision. -Of course if the in-memory grid values have been modified, you have to use the --grib_out. - -

    -The option -set_date X sets the reference time -to "date code" X, where X is -YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm or YYYYMMDDHHmmSS. -(YYYY=year, MM=month, DD=day, HH=hour, mm=minute, SS=second) -If MM/DD/HH/mm/SS is missing, the original MM/DD/mm/SS is unaltered. - - -

    -You can set the reference time to a unix time (number of seconds after -the start of January 1, 1970 by the argument "u(signed integer)". -This is convenient for converting netcdf files to grib because -netcdf files use unix time. - -

    -You can change the reference time by an offset. To change the reference time -by an offset, the argument has to start with either a negative sign or positive sign, -followed by an integer and ending with a units (yr, mo, dy, hr, or mn). Note: minutes -abreviation "mn" is easily confused as the abreviation for month and was added with wgrib2 v2.0.8. - -

    Usage

    -

    - -

    --set_date X            X = reference time, usually starting date
    -                       X=YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm or YYYYMMDDHHmmSS
    -                       YYYY=year, MM=month, DD=day, HH=hour, mm=minute, SS=second
    -                       if MM/DD/HH/mm/SS is missing, the original MM/DD/mm/SS is unaltered
    -
    --set_date uN           N is a signed integer containing the number of seconds after the start 
    -                       of January 1, 1970.  N follows the local OS convention of unix time such 
    -                       as ignoring leep seconds.  The limitation on N is OS dependent.
    -
    -                       Newer linux: N is signed 64 bit integer. However N is limited by the
    -                        wgrib2 implementation which stores N in a double precision variable.
    -                       Older linux: N is a signed 32 bit integer (problem in 2037)
    -                       Other OS:  varies, one OS uses N as a unsigned-32 bit integer.
    -
    --set_date -N(units)    negative offset (wgrib2 v2.0.5+)
    --set_date +N(units)    positive offset (wgrib2 v2.0.5+)
    -                       N = unsigned integer
    -                       units = hr, dy, mo or yr  (GrADS time units for hour, day, month and year)
    -                          mn (minutes) was added with v2.0.8.
    -
    - -

    Example

    -
    -$ wgrib2 png.grb2
    -1:4:d=2009060500:RH:2 m above ground:330 hour fcst:ens std dev
    -$ wgrib2 png.grb2 -set_date 20180101 -grib OUTFILE -s
    -:4:d=2018010100:RH:2 m above ground:330 hour fcst:ens std dev
    -$ wgrib2 png.grb2 -set_date +12hr -grib OUTFILE -s
    -1:4:d=2009060512:RH:2 m above ground:330 hour fcst:ens std dev
    -$ wgrib2 png.grb2 -set_date -12hr -grib OUTFILE -s
    -1:4:d=2009060412:RH:2 m above ground:330 hour fcst:ens std dev
    -
    -Note: wgrib2 png.grb2 -set_date -12hr -grib OUTFILE -s 
    -has a different inventory than
    -      wgrib2 png.grb2 -s -set_date -12hr -grib OUTFILE
    -because the latter prints the inventory before the date has been modified.
    -Note: wgrib2 png.grb2 -set_date -12hr -grib OUTFILE is the same as
    -      wgrib2 png.grb2 -set_date -12hr -grib OUTFILE -s 
    -because wgrib2 will add a "-s" to the command line when it detects
    -that the command line has no inventory options.
    -
    - -See also: - --grib, --grib_out, --s, --t, --T, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 10, 2016, July 2, 2018, March 2022. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_ens_num.html b/web_docs/set_ens_num.html deleted file mode 100644 index 54f69e0..0000000 --- a/web_docs/set_ens_num.html +++ /dev/null @@ -1,217 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_ens_num - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_ens_num -
     
    - -

    wgrib2: -set_ens_num

    -
    - - -

    Introduction

    - -

    -The -set_ens_num option changes PDT 0,1 -> 1 and -8,11 -> 11. PDT 1 and 11 are for "forecasts from a specified member of an ensemble. -Effectively this option add an "ensemble member ID" to the forecast. - -

    With wgrib2 v3.1.1, more PDTs can be promoted to ensemble-member PDTs. - -

    Merging ensembles, Adding New Members

    - -

    When ensembles are made, each member has a unique perturbation/member -number. When you want to merge ensembles, the member numbers -may no longer be unique. You would want to renumber the forecasts -sp that they would be unique. Sometimes you would want to add a forecast -with no ensemble information; you need a way to add a ensemble member number. - - -

    Usage

    -

    - -

    --set_ens_num X Y Z
    -X = 0..255 type of ensemble member (Code Table 4.6)
    -Y = 0..255 perturbation number
    -Z = 0..255  number of forecasts in the ensemble
    -
    - -

    Example

    -
    -$ wgrib2 ds.td.bin -set_ens_num 3 1 10 -grib ds_ens.grb
    -1:80:d=2009062918:DPT:surface:60 hour fcst:ENS=+1
    -2:218826:d=2009062918:DPT:surface:66 hour fcst:ENS=+1
    -3:434430:d=2009062918:DPT:surface:72 hour fcst:ENS=+1
    -4:652869:d=2009062918:DPT:surface:78 hour fcst:ENS=+1
    -5:871866:d=2009062918:DPT:surface:84 hour fcst:ENS=+1
    -6:1088694:d=2009062918:DPT:surface:90 hour fcst:ENS=+1
    -7:1304003:d=2009062918:DPT:surface:96 hour fcst:ENS=+1
    -8:1549304:d=2009062918:DPT:surface:102 hour fcst:ENS=+1
    -...
    -
    --set_ens_num 3 1 10
    -    3 = positive perturbed forecast
    -    1 = perturbation number
    -   10 = number of ensemble members
    -
    --grib ds_ens.grb
    -   save the new grib file in ds_ens.grb
    -
    - - -See also: --set_ensm_derived_fcst, --ens, --N_ens - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_ensm_derived_fcst.html b/web_docs/set_ensm_derived_fcst.html deleted file mode 100644 index 6b7a3dc..0000000 --- a/web_docs/set_ensm_derived_fcst.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_ensm_derived_fcst - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_ensm_derived_fcst -
     
    - -

    wgrib2: -set_ensm_derived_fcst

    -
    - - -

    Introduction: set ensemble mean derived forecast

    - -

    -The -set_ensm_derived_fcst option changes -Product Definition Template (PDT) 0,1,2 -> 2 or 8,11,12 -> 12. PDT 2, and 12 -are for "ensemble mean derived forecasts". Effectively this options describes the forecast -as being derived from an ensemble of forecasts. The types derived forecasts is listed in -code table 4.7. -The "cluster" derived forecast should not be used with this option as PDT 2 and 12 do not -have metadata to describe the cluster that was used. - - -

    Usage

    -

    - -

    --set_ensm_derived_fcst X Y
    -X = code table 4.7
    -Y = 0..255  number of forecasts in the ensemble
    -
    - -

    Example

    -
    -$ wwgrib2 sst.grb2  -set_ensm_derived_fcst 1 10 -grib newsst.grb
    -1:0:d=1981110100:TMP:surface:0-1 month ave anl:wt ens-mean
    -
    --set_ensm_derived_fcst 1 10
    -    1 = weighted mean of all members (code table 4.7)
    -   10 = number of ensemble members
    -
    --grib newsst.grb
    -   save the new grib file in newsst.grb
    -
    - - -See also: --set_ens_num, --ens, --N_ens - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_ext_name.html b/web_docs/set_ext_name.html deleted file mode 100644 index 55fb8bf..0000000 --- a/web_docs/set_ext_name.html +++ /dev/null @@ -1,264 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_ext_name - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_ext_name -
     
    - -

    wgrib2: -set_ext_name

    -
    - - -

    Introduction

    - -

    In the beginning, grib fields were identified by a name, a level -and some timing information. Life was simple and the people were -happy. This was soon to pass. A hoard of ensemble members appeared -in the distance. A dust storm rolled in from the plains. The new -power plants started putting sulfar dioxide into the air. All this -had to added to the grib format. So names had to have modifiers, -the percentile of some particulates of some chemical between size -A and B microns. So wgrib2 added "extended names". -So you could -switch beween the old simpler names and the newer extended names. - - -

    Extended Names

    - -

    -The extended name includes modifiers like the ensemble information, -dust information and probabilities. Optionally you can include -the level and forecast information (wgrib2 v3.0.2+). More details -are given here. - -

    Usage

    -To select between the regular and extended name, you use - -
    -   -set_ens_name N
    -      
    -      N == 0                 default
    -      N == 1                 add misc terms like ensemble or probability
    -                               extension for wgrib2 v3.0.2+
    -      and(N,1) == 1          add misc terms like ensemble or probability
    -      and(N,2) == 2          add level information
    -      and(N,4) == 4          add forecast information
    -      ex N == 3              misc + level information
    -      ex N == 5              misc + forecast information
    -      ex N == 6              level information + forecast information
    -      ex N == 7              misc + level information + forecast information
    -      N > 7                  for future use
    -
    - -

    Extended Extended Names

    - -

    The extended name facility was extended with wgrib2 v3.0.2 in order -to fix a problem with converting grib to netcdf with some of the newer -NCEP files. When wgrib2 writes netcdf files, the -netcdf concatinates -the level information to the extended name to produce the netcdf name -for the field. For some of the newer NCEP forecast files, this name -wasn't unique. So the extended name needs to optionally include -the forecast time information. With this extension, the level -information was added as another option field to the extended name. - - -

    -  $ wgrib2.v3.0.2 FCST.grb -set_ext_num 1 -netcdf FCST.nc
    -     lost fields because the field names were not unque
    -
    -  $ wgrib2.v3.0.2 FCST.grb -set_ext_num 5 -netcdf FCST.nc
    -     extended name include misc-info and forecast-time-info.
    -
    - -

    -The final modification to the extended name, was to make the field and space -character a run-time parameter by the option, -set_ext_name_chars. The default -values are '.' and '_' for backwards compatibilty. The modification was needed -we now are seeing level-info and misc-info with periods in them like "0.5 mb". - - - - - -

    -match, -if, and other string matches

    - -

    The extended names also applies the match inventory. So string matches will have -to be rewritten. Fortunately the process is mechanical. - -

    -  -match ":RH:"         ->     -match ":RH(:|.)"
    -  -match ":RH:500 mb:"  ->     -match ":RH(:|.)" -match ":500 mb:"
    -
    - - -Many options use the extended name if enabled by -set_ext_name. For example, the --netcdf uses the extended name if enabled. - - - -

    Examples

    - -
    --sh-2.05b$ ./wgrib2 chem.grb2 -var
    -1:0:MASSDEN
    --sh-2.05b$ ./wgrib2 chem.grb2 -ext_name
    -1:0:MASSDEN.hi-res_ctl.Water_Vapour
    --sh-2.05b$ ./wgrib2 chem.grb2 -set_ext_name 1 -ext_name
    -1:0:MASSDEN.hi-res_ctl.Water_Vapour
    -
    - - - -See also: --ext_name --set_ext_name_chars. -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, July 8, 2021. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_ext_name_chars.html b/web_docs/set_ext_name_chars.html deleted file mode 100644 index 222f902..0000000 --- a/web_docs/set_ext_name_chars.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_ext_name_chars - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_ext_name_chars -
     
    - -

    wgrib2: -set_ext_name_chars

    -
    - - -

    Introduction

    - -

    The extended names have a simple format. Options of wgrib2 are executed, -and the fields are combined - -

    --set_ext_name 1             -var -misc         field separator = '.', space replacement = '_'
    -
    -PRMSL.ENS=+19               PRMSL:ENS=+19
    -PRATE.90%_level             TPRATE:90% level
    -
    --set_ext_name 2             -var -lev          field separator = '.', space replacement = '_'
    -
    -HGT.200_mb                  HGT:200 mb
    -TPRATE.surface              TPRATE:surface
    -
    --set_ext_name 2             -var -ftime        field separator = '.', space replacement = '_'
    -
    -HGT.180_hour_fcst           HGT:180 hour fcst
    -
    - -

    -The default field separator and space replacement can may be used -in the various fields such as "1.5 mb. The -set_ext_name_chars -allows you to alter the field separator and space replacement characters. - -

    Usage

    - -
    --set_ext_name_chars 'X' 'Y'
    -    X and Y are characters
    -    The default field separator '.' is replaced by 'X'.
    -    The default space separator '_' is replaced by 'Y'.
    -
    -
    -

    Example

    - -
    -$ wgrib2 gep19.aec -set_ext_name 3 -ext_name  -set_ext_name_chars '=' '~' -var -misc -lev
    -1:0:HGT=ENS=+19=200~mb:HGT:ENS=+19:200 mb
    -2:70707:TMP=ENS=+19=200~mb:TMP:ENS=+19:200 mb
    -3:96843:RH=ENS=+19=200~mb:RH:ENS=+19:200 mb
    -
    - The -var -misc -lev fields:  HGT:ENS=+19:200 mb
    - are converted to an extended name: HGT=ENS=+19=200~mb
    - using the field separater '=' and space replacement of '~'
    -
    - -See also: -s --set_ext_name. --set_ext_name_chars. --ext_names. -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created: July 14, 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_ftime.html b/web_docs/set_ftime.html deleted file mode 100644 index 5cf3ff9..0000000 --- a/web_docs/set_ftime.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_ftime - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_ftime (new version v2.0.7) -
     
    - -

    wgrib2: -set_ftime

    -
    - - -

    Introduction

    - -

    The wgrib2 inventory has a fragment that looks like - -

    -   :d=2014122500:12 hour fcst:vt=2014122512
    -
    -   d=2014122500 is the Reference time, usually the analysis or start of the forecast time.
    -   12 hour fcst is the "ftime", the time is 12 hours after the reference time
    -   vt=2014122512 is the verification time (ref time + 12 hours)
    -
    - -Wgrib2 has options to change the reference time (-set_time) and to set the ftime. -The -set_ftime v2 (introduced with wgrib2 v2.0.7) is easier to use and will -change the Product Definition Templates as needed. For compatibility, -set_ftime v1 -is still available on wgrib2 v2.0.7+. However, -set_ave and -set_ftime v1 -should not be used as they will be eventually removed. - -

    -To change the ftime, you add the option -set_ftime FTIME. What are the allowed formats -of FTIME? The formats are the same as ftimes from a wgrib2 inventory. - -

    -Original: :d=2014113018:6 hour fcst:
    -options:  -set_date 2014122500 -set_ftime "12 hour fcst"
    -New:      :d=2014122500:12 hour fcst:
    -
    -
    -Original: :d=2014113018:6 hour fcst:
    -options:  -set_date 2014122500 -set_ftime "0-6 hour ave fcst"
    -New:      :d=2014122500:0-6 hour ave fcst:
    -
    -Original: :d=2014113018:6 hour fcst:
    -options:  -set_date 2014122500 -set_ftime "124@6 hour ave(0-6 hour ave fcst),missing=0"
    -New:      :d=2014122500:124@6 hour ave(0-6 hour ave fcst),missing=0:
    -
    -After changing the time stamp, you can save the file with -grib NEW.grb
    -
    - -

    -With wgrib2 v2.0.6 or earlier, you have to use -set_ave and -set_ftime (v1). -Only a subset of PDTs were supported by -set_ave and -set_ftime (v1). - -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, April 2020, Nov 2023 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_ftime1.html b/web_docs/set_ftime1.html deleted file mode 100644 index eafd9dc..0000000 --- a/web_docs/set_ftime1.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_ftime1 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_ftime1 -
     
    - -

    wgrib2: -set_ftime1

    -
    - - -

    Introduction

    - -

    -With wgrib2 v2.0.7, routines for generating started -to shift from -ftime1 to -ftime2. Since wgrib2 needs -the ability to read the time stamps, the routines -that wrote the time stamps also had to shift from -from -set_ftime1/-set_ave -> -set_ftime2. - -

    -The -set_ftime1 calls the -old routines to set time stamp. One should not -use this option because the old ftime routines could -not handle more complicated time stamps and needed a rewrite (ftime2 routines). - -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, 6/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_ftime_mode.html b/web_docs/set_ftime_mode.html deleted file mode 100644 index 58e579b..0000000 --- a/web_docs/set_ftime_mode.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_ftime_mode - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_date -
     
    - -

    wgrib2: -set_ftime_mode

    -
    - - -

    Introduction (wgrib2 v3.1.2)

    - -

    -The wgrib2 divides the timing information into two pieces, -the reference time and "ftime". In the following example, -the reference time is the third column (red, bold), and ftime -is the sixth column (green, italic). - -

    -$ wgrib2 small.grb2
    -1:0:d=2009060500:HGT:200 mb:24 hour fcst:ENS=+19
    -2:22346:d=2009060500:PRATE:surface:0-1 day ave fcst:ENS=+19
    -
    - -When the ftime consists of two times (ex 0-1 day ave fcst), the default mode is to -"simplfy" the ftime. For example "0-24 day ave fcst" gets simplified to "0-1 day ave fcst". - -
    - Simplifications done on ftime:
    -
    -  M*60-N*60 sec -> M-N min
    -  M*60-N*60 min -> M-N hour 
    -  M*24-N*24 min -> M-N day
    -  M*12-N*12 mon -> M-N year
    -
    - -Originally the wgrib2 inventories were designed for human readability, -so the simplifications were reasonable. Now inventories -are used as index files, and the "simplifications" can lead to complications -for programs that use the index files. - -

    Easing the problems with Simplifications (wgrib2 v3.1.2)

    -

    -Programs may want to search for "24-48 hour ave fcst" instead of the simple "1-2 day ave fcst". -Now the match_inventory includes both terms. - -

    -old:  wgrib2 file.grb -match ":1-2 day ave fcst"
    -old:  wgrib2 file.grb -if ":1-2 day" -grib day_1_2.grb -endif
    -
    -with wgrib2 v3.1.2, this also works
    -new:  wgrib2 file.grb -match ":24-48 hour ave fcst"
    -new:  wgrib2 file.grb -if ":24-48 hour" -grib day_1_2.grb -endif
    -
    -Note that: wgrib2 file.grb -match ":TMP:500 mb:24-48 hour ave fcst"
    -requires a specific order of the match_inventory.  This will require 
    -the option "-set_ftime_mode 1" (simplifications turned off).
    -
    - -

    -The simplifcations can be turned off using -the -set_ftime_mode 1 option.
    -Note: the -set_ftime_mode option is a setup option. -The option is ignored during the execution and cleanup phases. - -

    Usage

    -

    - -

    --set_ftime_mode X            X = 0, 1       requires wgrib2 v3.1.2+
    -                                 0:  simpifications are done (default)
    -                                 1:  simpifications are not done
    -
    - -

    Example

    -
    -$ wgrib2 small.grb2
    -1:0:d=2009060500:PRATE:surface:0-1 day ave fcst:ENS=+19
    -
    -$ wgrib2 -set_ftime_mode 1 small.grb2
    -1:0:d=2009060500:PRATE:surface:0-24 hour ave fcst:ENS=+19
    -
    - -See also: - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 10, 2016, July 2, 2018, March 2022. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_grib_max_bits.html b/web_docs/set_grib_max_bits.html deleted file mode 100644 index d3bdd36..0000000 --- a/web_docs/set_grib_max_bits.html +++ /dev/null @@ -1,226 +0,0 @@ - efficiently. - - - Climate Prediction Center - wgrib2: -set_grib_max_bits - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_grib_max_bits -
     
    - -

    wgrib2: -set_grib_max_bits

    -
    - - -

    Introduction

    - -

    -With most grib packing methods, the grid values are -usually stored as scaled integers. The grib format allows -the scaled integers to have up to 254 bits (simple packing). -This is an unreasonably high precision as wgrib2 converts -the data to a single-precision floating point number which -typically has only 25 bits of precision. To speed up -the encoding and decoding processing, wgrib2 uses 32 bit -integers which limits the maximum size of scaled integers -to 25 after accounting for the limits of the packing and -unpacking routines. - -

    Grib fields are usually stored as a scaled integers, -and usually you don't need 25 bits of precision. For -example, temperature to the nearest 0.1 degree, means -that the a temperature range of 50 C can be stored as -500 descrete values and only 7 bits are needed to store -the temperature to the nearest 0.1 degree. - -

    The problem is that people can set the scaling factors -to inappropriate values, using 25 bits of precision will -was (disk) space. Consequently wgrib2 has a resetable limit -of the precision of the scaled integers allowed. If you -exceed the limit, the scaling factors are change so -that the scaled integers are limited. - -

    -The -set_grib_max_bits option sets the maximum -number of bits that the scaled integers can have when -encoding data into grib. The value -should never be greater than 25 as that is the limit for wgrib2 encoding. -However, some grib packages may not support 25 bit precision in decoding, -so you may want to limit the precision to 24 to remain compatible with -other software packages. - -

    -The -set_grib_max_bits option does not set the -binary precision of the grib output but sets the maximum possible precision -of the numbers. - - - -

    Usage

    -

    - -

    --set_grib_max_bits N
    -  N = maximum number of bits used to encode data
    -  the default value is 16, N = 1..25
    -
    - -

    Comments

    -

    -The -set_grib_max_bits option does not affect -grib data written using the -grib option because the --grib option does not encode data but copies -the input grib message. - -

    -See alse: --set_scaling --set_bin_prec --grib_max_bits -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Feb 21, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_grib_type.html b/web_docs/set_grib_type.html deleted file mode 100644 index edca145..0000000 --- a/web_docs/set_grib_type.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_grib_type - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_grib_type -
     
    - -

    wgrib2: -set_grib_type

    -
    - - -

    Introduction

    - -

    -wgrib2 can write grib files by either copying an existing -packed grib message (-grib) or by -taking floating point values and packing them into a new grib -message. (For example, -grib_out, --small_grib, -ij_small_grib, -and -wind_speed). -For the latter, one has a choice of packing methods. -Generally methods that are faster methods create larger files -and slower methods make smaller files. For fields with no -undefined values, the jpeg2000 produces the smallest files. -With bitmaps, one of the complex packings is usually the best -(of the supported packing). Complex3 is often the best trade off -between speed and compression for smooth fields. For other fields -complex1 is often the best trade off between speed and compression. -The (-set_grib_type) option controls the -packing method. - -

    Complex packing has the option of using special values -or bitmap for undefined grid values. Special values produce -significantly smaller files than using the bitmap. You should -only use the bitmap and complex packing when trying to remain -compatible with certain codes. (Bitmaps and special values were -part of the original grib2 specification, so it is possible that -some codes can handle special values and not bitmaps.) If you want -to alter the default (special values) to bitmaps, you -can use the option -set_bitmap. - -

    AEC is an implementation of CCSDS compression using libaec. -This new compression has very fast compression speeds and good -compression. As of 7/2016, only ecCodes (ECMWF) and wgrib2 support -AEC compression. More support is expected after it is -part of the offical standard (expected 9/2016). - -

    Usage

    -

    - -

    --set_grib_type X   X=ieee,simple,complex1,complex2,complex3,jpeg,aec,same
    -                     s, c1, c2, c3, j, a are short for simple .. aec
    -                     v2.0.7 adds complex1-bitmap, complex2-bitmap, complex3-bitmap
    -                       with c1b, c2b and c3b being the short forms
    -                 
    -                  
    -
    -ieee = data is ieee format (4 bytes per data point)
    -simple = no compression, packed scaled integers
    -complex1 = complex packing
    -complex1-bitmap = complex and using bitmap for undefined grid points
    -complex2 = complex packing, pack increments (deltas)
    -complex2-bitmap = complex packing, pack increments (deltas) and using bitmap for undefined
    -complex3 = complex packing, pack increments after linear extrapolation
    -complex3-bitmap = complex packing, pack increments after linear extrapolation and using bitmap for undefined
    -jpeg = jpeg2000 compression
    -aec = aec/CCSDS compression
    -same = try to keep same packing type as input
    -       if input is in an unsupported output packing, complex1 is used
    -
    -note: to use bitmap for undefined values in complex packing, you can use
    - -set_bitmap 1 or you can use the complexN-bitmap.
    -
    - -

    Example

    -

    - -

    -$ wgrib2 in.grb -set_grib_type complex3 -grib_out out.grb 
    -
    -The above line rewrites a file using complex3 packing. - -

    -See also: -grib_out, --set_bitmap, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 6, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_hex.html b/web_docs/set_hex.html deleted file mode 100644 index 3bfb8fd..0000000 --- a/web_docs/set_hex.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_hex - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_hex -
     
    - -

    wgrib2: -set_hex

    -
    - - -

    Introduction

    - -

    -The -set_hex option sets 1 octets (byte) to a -a specified hex value. The hex value ranges from 0 to ff. - - -

    --set_hex I J K
    -  I = section number = 1..7
    -  J = location in the section = 1..(section length)
    -  K = 00 .. ff
    -would set 
    -  Section I, Octet J to hex value K
    -
    --set_hex I J K1:K2:K3:..KN
    -  I = section number = 1..7
    -  J = location in the section = 1..(section length)
    -  Ki = 00 .. ff
    -
    -  Sets Section I, Octet J to K1
    -  Sets Section I, Octet J+1 to K2
    -  etc
    -
    --set_hex I J K1K2K3..KN           for v2.0.8+
    -  I = section number = 1..7
    -  J = location in the section = 1..(section length)
    -  Ki = 00 .. ff
    -  Sets Section I, Octet J to K1
    -  Sets Section I, Octet J+1 to K2
    -  etc
    -
    - -

    - - -

    Usage

    -

    - -

    --set_hex  SECTION STARTING_OCTET_LOCATION (I-1):(I-2):..:(I-N)
    --set_hex  SECTION STARTING_OCTET_LOCATION (I-1)(I-2)..(I-N)
    -SECTION=0 .. 7
    -OCTET_LOCATION = 1..N
    -I-M = Mth octet as 2 digit hex number
    -
    - -

    Example

    - -

    -This examples requires wgrib2 v2.0.8+ -

    -The file, template_512.grb, was converted from grib1, and the -delta-lon, and the extreme latitudes were only to the nearest -millidegree (grib1 precision). -

    -wgrib2 template_512.grb -grid
    -1:0:grid_template=40:winds(N/S):
    -	Gaussian grid: (512 x 256) units 1e-06 input WE:NS output WE:SN
    -	number of latitudes between pole-equator=128 #points=131072
    -	lat 89.463000 to -89.463000
    -	lon 0.000000 to 359.233000 by 0.703000
    -
    - -The grid with full precision can be obtained by using -new_grid, -and the contents of sec3 (grid definition) can be obtained by -0xSec 3. - -
    --sh-4.1$ wgrib2 template_512.grb -new_grid_winds earth -new_grid ncep grid 170 junk
    -+ wgrib2 template_512.grb -new_grid_winds earth -new_grid ncep grid 170 junk
    -1:0:d=2016010109:PRES:mean sea level:2390 hour fcst:
    --sh-4.1$ wgrib2 junk -0xSec 3
    -+ wgrib2 junk -0xSec 3
    -1:0:Sec3(1..72)=0x0000004803000002000000000028060000000000000000000000000000000000020000000
    -10000000000ffffffff05551826000000003085551826156a6f6b000aba950000008000
    -
    - -The script to change the precision of the Gaussian grid is given by - -
    -sec3='000000480300000200000000002806000000000000000000000000000000000002000000010000000000ffffffff05551826000000003085551826156a6f6b000aba950000008000'
    -wgrib2 $1 -set_hex 3 1 "$sec3" -grid -grib $1.new
    -
    - -

    -The above script assumes that the size of the original section 3 is greater or equal to the size of the new section 3. -If it isn't, you have to use the option -set_sec_size 3 72. Of course, you cannot make arbitrary changes -to the grid definition because the number of grid points has to match the grid points in the data section. - -

    -See also: --set_byte --set_ieee --set_int --set_int2 -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 22, 2016, Nov 6, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_ieee.html b/web_docs/set_ieee.html deleted file mode 100644 index 79b546b..0000000 --- a/web_docs/set_ieee.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_ieee - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_ieee -
     
    - -

    wgrib2: -set_ieee

    -
    - - -

    Introduction

    - -

    -The -set_ieee option sets 4 octets to a -single precision IEEE floating point value. The IEEE floating point standard -is often used grib2. - -

    --set_ieee I J X
    -  I = Section = 1..7
    -  J = 1..(section length-3)
    -  X = single precision floating point number
    -
    - -

    -Multiple floats can be set by making the third argument a colon seperated list. - -

    Usage

    -

    - -

    --set_int  SECTION STARTING_OCTET_LOCATION I-1:I-2:..:I-N
    -SECTION=0 .. 7
    -OCTET_LOCATION = 1..N
    -I-M = Mth floating point number
    -
    - -

    Example

    - -

    -See also: --get_int --set_byte --set_hex --set_int2 -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_ijval.html b/web_docs/set_ijval.html deleted file mode 100644 index ae01a02..0000000 --- a/web_docs/set_ijval.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_ijval - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_ijval -
     
    - -

    wgrib2: -set_ijval

    -
    - - -

    Introduction

    - -

    -The -set_ijval option is used to change one grid point value -of the decoded grid. After changing the grid value, one usually writes out the grid using --grib_out FILE. -The -set_ijval option only works when the grid is -a rectangular array. For example, staggered and thinned grids are not stored an an array. - -

    Usage

    -

    -

    --set_ijval I J VAL
    -    grid(I,J) = VAL
    -    I = 1..NX
    -    J = 1..NY
    -
    - -

    Example

    -
    -$ wgrib2 small.grb2 small.grb2 -set_ijval 1 1 91 -set_ijval 2 1 92 -set_ijval 1 2 93 -set_ijval 2 2 94 -grib_out new.grb2
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -$ wgrib2 new.grb2 -csv new.csv
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -$ cat new.csv
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",0,20,91
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",10,20,92
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",0,28,93
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",10,28,94
    -
    -

    -See also: --csv --grib_out --set_ival -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 27, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_int.html b/web_docs/set_int.html deleted file mode 100644 index ed5aeda..0000000 --- a/web_docs/set_int.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_int - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_int -
     
    - -

    wgrib2: -set_int

    -
    - - -

    Introduction

    - -

    -The -set_int option sets 4 octets to an -signed integer value as commonly use by grib for signed integers. -The integer must range from -2147483647 to 2147483647, - -

    --set_int I J K
    -  I = 1..7
    -  J = 1..(section length-3)
    -  K = -(2**23-1) .. (2**23-1)
    -would set 
    -  Section I, Octet J+0:  if (K >= 0) (K >> 24) & 255
    -  Section I, Octet J+0:  if (K < 0) ((abs(K) >> 24) && 255) | 128
    -  Section I, Octet J+1:  (abs(K) >> 16) & 255
    -  Section I, Octet J+2:  (abs(K) >> 8) & 255
    -  Section I, Octet J+3:   abs(K) & 255;
    - The above is using C syntax.
    -
    - -

    -Multiple integers can be set by making the third argument a colon seperated list. - -

    Usage

    -

    - -

    --set_int  SECTION STARTING_OCTET_LOCATION I-1:I-2:..:I-N
    -SECTION=0 .. 7
    -OCTET_LOCATION = 1..N
    -I-M = Mth integer
    -
    - -

    Example

    - -

    -See also: --get_int --set_byte --set_hex --set_ieee --set_int2 -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_int2.html b/web_docs/set_int2.html deleted file mode 100644 index 1b78440..0000000 --- a/web_docs/set_int2.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_int2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_int2 -
     
    - -

    wgrib2: -set_int2

    -
    - - -

    Introduction

    - -

    -The -set_int2 option sets 2 octets to a -signed integer value which is commonly used by grib. -The integer must range from -32767 to 32767. - - -

    --set_int2 I J K
    -  I = 1..7
    -  J = 1..(section length-1)
    -  K = -(2**15-1) .. (2**15-1)
    -would set 
    -  Section I, Octet J+0:  if (K >= 0) (K >> 8) & 255
    -  Section I, Octet J+0:  if (K < 0) ((abs(K) >> 8 ) && 255) | 128
    -  Section I, Octet J+3:   abs(K) & 255;
    - The above is using C syntax.
    -
    - -

    -Multiple integers can be set by making the third argument a colon seperated list. - -

    Usage

    -

    - -

    --set_int2  SECTION STARTING_OCTET_LOCATION I-1:I-2:..:I-N
    -SECTION=0 .. 7
    -OCTET_LOCATION = 1..N
    -I-M = Mth integer
    -
    - -

    Example

    - -

    -See also: --get_int --set_byte --set_hex --set_ieee --set_int -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_ival.html b/web_docs/set_ival.html deleted file mode 100644 index bdb216f..0000000 --- a/web_docs/set_ival.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_ival - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_ival -
     
    - -

    wgrib2: -set_ival

    -
    - - -

    Introduction

    - -

    -The -set_ival option is used to change one or more the grid point values -of the decoded grid. After changing values, one usually writes out the grid using --grib_out FILE. - -

    Usage

    -

    -

    --set_ival I VAL
    --set_ival I1:I2:..:In VAL1:VAL2:..:VALn
    -    I, I1, .. In is the grid point index from 1 to npnts
    -    VAL, VAL1, .. VALn are floating point values
    -
    - -

    Example

    -
    -$ wgrib2 small.grb2 -set_ival 1:2:3:4 91:92:93:94 -gribout new.grb2
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -$ wgrib2 new.grb2 -csv new.csv
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19
    -$ cat new.csv
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",0,20,91
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",10,20,92
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",0,28,93
    -"2009-06-05 00:00:00","2009-06-12 12:00:00","HGT","200 mb",10,28,94
    -
    - -

    -See also: --csv --grib_out --set_ijval -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 27, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_lev.html b/web_docs/set_lev.html deleted file mode 100644 index 9391a67..0000000 --- a/web_docs/set_lev.html +++ /dev/null @@ -1,251 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_lev - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_lev
     
    - -

    wgrib2: -set_lev

    -
    - - -

    Introduction

    - -

    -The -set_lev option changes the level/layer - of field. By design, the level/layer used by --set_lev option is the same level/layer as used -in the inventory. - -

    The code used to set the level/layer are used by --set_lev, --set_metadata, and --set_metadata_str. So if you are unsure of the format -of the level description, you first look for a file with the same or similar level. -Failing to find such a file, you can try the --set_lev option or look at the tables in level.c source code. - - -

    Usage

    -

    - -

    --set_lev LEVEL
    -  LEVEL is either a level or layer description (12/2015)
    -
    - "surface",
    - "cloud base",
    - "cloud top",
    - "0C isotherm",
    - "level of adiabatic condensation from sfc",
    - "max wind",
    - "tropopause",
    - "top of atmosphere",
    - "sea bottom",
    - "entire atmosphere",
    - "cumulonimbus base",
    - "cumulonimbus top",
    - "%g K level",
    - "%g mb",
    - "mean sea level",
    - "%g m above mean sea level",
    - "%g m above ground",
    - "%g sigma level",
    - "%g hybrid level",
    - "%g m underground",
    - "%g K isentropic level",
    - "%g mb above ground",
    - "PV=%g (Km^2/kg/s) surface",
    - "%g Eta level",
    - "logarithmic hybrid level",
    - "snow level",
    - "mixed layer depth",
    - "hybrid height level",
    - "hybrid pressure level",
    - "%g generalized vertical height coordinate",
    - "%g m below sea level",
    - "%g m below water surface",
    - "lake or river bottom",
    - "bottom of sediment layer",
    - "bottom of thermally active sediment layer",
    - "bottom of sediment layer penetrated by thermal wave",
    - "maxing layer",
    - "bottom of root zone",
    - "top surface of ice on sea, lake or river",
    - "top surface of ice, und snow on sea, lake or river",
    - "bottom surface ice on sea, lake or river",
    - "deep soil",
    - "top surface of glacier ice and inland ice",
    - "deep inland or glacier ice",
    - "grid tile land fraction as a model surface",
    - "grid tile water fraction as a model surface",
    - "grid tile ice fraction on sea, lake or river as a model surface",
    - "grid tile glacier ice and inland ice fraction as a model surface",
    -   ** NCEP specific special levels are not listed **
    - "%g-%g mb above ground",
    - "%g-%g mb"
    - "%g-%g m below ground"
    - "%g-%g m above ground"
    - "%g-%g sigma layer",
    - "%g-%g m below sea level", 
    - "%gC ocean isotherm%n", NCEP only
    - "atmos col"
    -
    - -

    Example

    -
    -$ wgrib2 png.grb22 -set_lev "9.1 mb"
    -1:4:d=2009060500:RH:9.1 mb:330 hour fcst:ens std dev
    -
    - - - See also: --lev, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified Jan 26, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_lvl1.html b/web_docs/set_lvl1.html deleted file mode 100644 index 6af4597..0000000 --- a/web_docs/set_lvl1.html +++ /dev/null @@ -1,265 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_lvl1 and -set_lvl2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_lvl1,-set_lvl2 -
     
    - -

    wgrib2: -set_lvl1, set-set_lvl2

    -
    - - -

    Introduction: levels, should I use lev or lvl

    -

    -The standard method of displaying and altering the level/layer metadata is by the --lev and -set_lev options. -This method is high level and you don't need to know the details on how grib stores -the level/layer information. The problems with a high level interface are when you -are using a new type of level information. Then the --lev and -set_lev options don't help. -The "lvl" method is low level and are for cases when a high level interface doesn't work. - -

    The Problem with Ambiguity of Numbers

    - -The grib standard stores the level as a (signed 32-bit integer)*10**(signed 8-bit integer). -Nothing wrong with this format but numbers can be stored in multiple ways. For example, - -
    -   500 can be stored as 5*10**2
    -   500 can be stored as 50*10**1
    -   500 can be stored as 500*10**0
    -   500 can be stored as 5000*10**-1
    -
    - -All are valid representations and libraries should treat them as equivalent. -So if you search for the wind speed at "50 meters above the ground", you -should not have to worry wheter 50 is stored at 50*10**0 or 5*10**1 in -the grib file. However, there are some libraries will only match one variant -of "50". So to make your grib files compatible with this library, -you may have to use the "lvl" interface. (With wgrib2, you match "50m above ground", -which independent of the internal respresentation.) - -

    -Another example of ambiguity is for "0.1 meters above the ground". Now 0.1 is not -a nice number when stored as a binary floating point number. You can only save an approximate -value when using a finite number of digits. It is like 1/3 when written -as a decimal number. (1/3=0.3333333333333..) -

    -  0.1 can be stored as 1*10**-1
    -  0.1 can be stored as 1000000015*10**-10
    -
    -Obviously the former is the preferred format but the latter is -the result trying to get the best scaled number for double -precision number "0.1". - -

    The "lvl" interface can be used to remove ambiguities in the level information -using -set_lvl1 and -set_lvl2. - - -

    lvl format

    - - -The "lvl" format is based on the grib standard. - -
    - 1 octet  unsigned 8-bit integer   type of first fixed surface (see Code Table 4.5) lv1l type
    - 1 octet  8-bit signed integer     scale factor of first fixed surface              lvl1 scale_factor
    - 4 octets 32-bit signed integer    scaled value of first fixed surface              lvl1 scaled_value
    -                            
    - 1 octet  unsigned 8-bit integer   type of 2nd fixed surface (see Code Table 4.5)   lvl2 type
    - 1 octet  8-bit signed integer     scale factor of 2nd surface                      lvl2 scale_factor
    - 4 octets 32-bit signed integer    scaled value of 2nd fixed surface                lvl2 scaled_value
    -
    - value = scaled_value * 10**(-scale_factor)
    - Note: missing is denoted by scale factor and scale value having all bits set to one
    -
    -lvl format   value is not missing
    -             lvl1=(type,scaled_value*10**(-scale_factor), scale_factor, scaled_value)
    -             lvl2=(type,scaled_value*10**(-scale_factor), scale_factor, scaled_value)
    -
    -lvl format   value is missing
    -             lvl1=(type,missing,missing,missing)
    -             lvl2=(type,missing,missing,missing)
    -
    -	     type = 0..255
    -
    - - -

    Usage

    -

    - -

    --set_lvl1 (type,X,Y,Z)
    -	   type=0..255  Code Table 4.5
    -	   X=missing if missing values
    -	     value ignored if not missing
    -           Y=scaled value, ignored if X is 'missing'
    -	   Z=integer, ignored if X is 'missing'
    --set_lvl2  same as -set_lvl1
    -
    - - -

    Example

    -
    -$ wgrib2 small.grb2 -s -lvl
    -[wd51we@cpc-lw-webisuzaki grib2_examples]$ wgrib2 small.grb2 -s -lvl
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19:lvl1=(100,20000,0,20000):lvl2=(255,missing,missing,missing)
    -$ wgrib2 small.grb2 -set_lvl1 "(100,0,0,12345)" -s -lvl
    -1:0:d=2009060500:HGT:123.45 mb:180 hour fcst:ENS=+19:lvl1=(100,12345,0,12345):lvl2=(255,missing,missing,missing)
    -
    - - - -See also: -lvl1, --lev, - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page 11/2023 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_metadata.html b/web_docs/set_metadata.html deleted file mode 100644 index 1f3b21b..0000000 --- a/web_docs/set_metadata.html +++ /dev/null @@ -1,285 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_metadata - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_metadata -
     
    - -

    wgrib2: -set_metadata

    -
    - - -

    Introduction

    - -

    -Whenever -set_metadata option is "executed", one -line of the data file is read, the metadata is then applied to the current -(sub-)message. For example, your grib file has 3 messages and you -want to alter the metadata. Here is a metadata file -that could be used to alter the grib file. - -

    -0:0:d=2009010100:HGT:500 mb:anl:scale=0,0:
    -0:0:d=2009010100:TMP:2 m above ground:anl
    -0:0:d=2009010106:HGT:500 mb:12 hour forecast:scale=0,0
    -
    - -

    -The format of the metadata file resembles the wgrib2 inventory by design. -The first and second fields are ignored by by -set_metadata. -In practice, the first first is the record number and the second field -is the byte location of the template to be used. (A template file -could be a collection of templates.) The third through sixth fields -are the date code, variable name, level and ftime. Finally the remaining -fields are optional and order independent. - -

    The date field has been extended from the default d=YYYYMMDDHH. The date -field can be d=format-N or D=format-N -

    -                         Format 1
    -
    -    YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm or YYYYMMDDHHmmss
    -    where YYYY = 4 digit year
    -            MM = 2 digit month
    -            DD = 2 digit day of month
    -            mm = 2 digit minute
    -            ss = 2 digit second
    -    If MM, DD, mm, ss are missing, the values are unchanged.
    -
    -                         Format 2
    -
    -  +N(units)  N is an integer, units = hr, dy, mo or yr
    -             this adds N units to the reference time
    -             ex. +6hr, +1dy
    -
    -                         Format 3
    -
    -  -N(units)  N is an integer, units = hr, dy, mo or yr
    -             this subtracts N units to the reference time
    -             ex. -6hr, -1dy
    -
    - -
    -		Optional fields
    -
    -    scale=I,J			set decimal scaling (I) and binary scaling (J) for encoding
    -    encode i*2^J*10^I           set decimal scaling (I) and binary scaling (J) for encoding
    -                                   same as scale=I,J  v2.0.6+
    -    encode I bits               store grid values using I bits, no decimal scaling (ECMWF style) v2.0.6+
    -    grib_max_bits=I             set maximum number of bits used to store grid point data (max 25) v2.0.6+
    -    packing=S                   set compression/packing to S
    -                                S=simple,complex1,complex2,complex3,jpeg,aec (long form)
    -                                S=s,c1,c2,c3,j (short form)
    -    N%d level                   set percentile
    -    prob ...                    set probability
    -    XYZ                         XYZ=ens mean, wt ens mean, ens std dev, cluster std dev, normalized ens std dev,
    -                                normalizedd cluster std dev, ens spread, ens large anom index, wt ens mean,
    -                                unwt custer mean, 25%-75% range, min all members, max all members
    -    ENS=...                     set ensemble member info
    -                                ENS=hi-res, low-res, +N, or -N
    -    N ens members               set number of ensemble members
    -                                ex. 22 ens members
    -    code table X.Y=Z            set code table, equivalent -set table_X.Y Z   requires wgrib2 v2.0.5+
    -    flag table X.Y=Z            set flag table, equivalent -set table_X.Y Z   requires wgrib2 v2.0.5+
    -                                note: not all X.Y have been implemented
    -
    -             Following options follows -set VAR VAL and do not follow the wgrib2 inventory format
    -    disciple=
    -    local_table=
    -    master_table=
    -    center=                     set center
    -    subcenter=                  set sub-center
    -    background_process_id=
    -    analysis_or_forecast_process_id=
    -    table_M.N=                  only for selected M.N
    -
    - - - -

    -To change the metadata, you can do - -

    -wgrib2 in.grb -s >meta
    -(change meta)
    -wgrib2 in.grb -set_metadata  meta -grib out.grb
    -
    -Note: that -grib does not change the grid point data/packing.
    -
    - -

    The -set_metadata option is used for creating -grib2 files. Note that both --set_metadata and the various --import options will change the output -precision. Consequently the --import option should preceed the --set_metadatda option. - -

    Note: only a subset of levels and ftime parameters is currently implemented. -The -set_metadatda option -does not support all metadata. - -

    To format of the levels and ftime are - the same was used by wgrib2 inventories. - -

    -See also: --set_ave, --set_date, --set_ftime, --set_lev, --set_metadata_str, --set_scale, -set_var, - - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Nov 23, 2016. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_metadata_str.html b/web_docs/set_metadata_str.html deleted file mode 100644 index 2cd374c..0000000 --- a/web_docs/set_metadata_str.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_metadata_str - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_metadata_str -
     
    - -

    wgrib2: -set_metadata_str

    -
    - - -

    Introduction

    -

    -The -set_metadata_str "string" option is similar to the -older -set_metadata FILE option. Instead of reading -the metadata from a file, the metadata is on the command line. The latter -option is generally more useful as each grib message can have its own -set of metadata. The former option is only useful for specifying the metadata -for a single grib message. The -set_metadata_str option -was added to facilitate the creation of an "callable wgrib2" API for writing grib2. -See -set_metadata for the format of the metadata string. - - -

    Usage:

    -
    --set_metadata_str "metadata"
    -metadata is a string 
    -
    - -

    Example:

    -
    -sh-4.1$ wgrib2 small.grb2  -set_metadata_str "1:0:d=2001020304:TMP:10 mb:anl:"
    -1:0:d=2001020304:TMP:10 mb:anl:ENS=+19
    -
    - - - -

    -See also: --set_metadata, - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: April 4, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_pdt.html b/web_docs/set_pdt.html deleted file mode 100644 index 54d2640..0000000 --- a/web_docs/set_pdt.html +++ /dev/null @@ -1,229 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_pdt - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_pdt -
     
    - -

    wgrib2: -set_pdt

    -
    - - -

    Introduction

    - -

    -Section 4 of a grib message -contains the product definition and the product is -defined through the Product Definition Template (PDT). -There are many different PDTs but only some are in common usage. The --set_pdt option changes the current PDT to -another. For example, you want to add ensemble information to a -forecast with no ensemble information. To do this, you have -to change the template to one that has ensemble information -and then fill in the various parts of the PDT. -Another use of the -set_pdt option is -when you have a PDT that is unsupported by a program such -as GrADS. You can use this option to -convert an unsupported PDT to a supported PDT. -To retain metadata, prefix the PDT with a plus sign. The amount of -metadata copied depends on the version of wgrib2. - -

    Usage

    - -

    -

    --set_pdt X      X=product defintion template number (example 8, not 4.8), default size, PDT is cleared
    --set_pdt +X     X=product defintion template number (example 8, not 4.8), copy metadata from current PDT
    -                  size may vary depending on current PDT
    --set_pdt X:Y    X=product defintion template number (example 8, not 4.8), Y=byte size of PDT if variable-sized PDT
    -                  PDT is cleared
    --set_pdt +X:Y   X=product defintion template number (example 8, not 4.8), Y=byte size of PDT if variable-sized PDT
    -                  copy metadata
    -                Note: using the wrong value of Y can produce errors
    -
    - -

    Example

    -
    -wgrib2 prior to v2.0.2
    -$ wgrib2 p.grb -set_pdt 0 -grib OUT.grb
    -1:0:d=2010111618:var discipline=0 center=7 local_table=0 parmcat=255 parm=255:no_level:-1 missing fcst:
    -$ wgrib2 p.grb -set_pdt +0 -grib OUT.grb
    -1:0:d=2010111618:PRMSL:no_level:-1 missing fcst:
    -
    -wgrib2 v2.0.2
    -$ wgrib2 png.grb -grib OUT.grb
    -1:4:d=2009060500:RH:2 m above ground:330 hour fcst:std dev
    -$ wgrib2 png.grb -set_pdt 0 -grib OUT.grb
    -1:4:d=2009060500:var discipline=0 center=7 local_table=1 parmcat=255 parm=255:no_level:-1 missing fcst:
    -$ wgrib2 png.grb -set_pdt +0 -grib OUT.grb
    -1:4:d=2009060500:RH:2 m above ground:330 hour fcst:
    -
    - -Suppose a program has problems with pdt 60 and 61. Changing the pdt to -1 and 11 will solve the incompatibility with only a little loss of metadata. -
    -$ wgrib2 IN.grb -if ":pdt=60:" -set_pdt +1 -fi \
    -                -if ":pdt=61:" -set_pdt +11 -fi \
    -                -grib OUT.grb
    -  requires wgrib2 v2.0.2+
    -
    - - -See also: --fi, --grib, --if, --Sec4, --pdt, - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 8, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_percentile.html b/web_docs/set_percentile.html deleted file mode 100644 index bd4e853..0000000 --- a/web_docs/set_percentile.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_percentile - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_percentile -
     
    - -

    wgrib2: -set_percentile

    -
    - - -

    Introduction

    - -

    -Probabilistic forecasts can be presented as percentiles. For example, 10% forecast -of temperature means that 1 time out of 10, the expected temperature will less than -the forecasted temperature. -The -set_percentile option adds or changes the percentile of -a forecast. - -

    -Percentile forecasts use product definition templates (PDT) of 6 or 10 depending -whether the forecast is for a single time or a time interval. -The -set_percentile option converts pdt 0..6 -> 6 and 8..15 -> 10. - -

    Percentiles are also supported by the --set_metadata option. -

    Usage

    -

    - -

    --set_percentile X         X = percentile 0..100
    -
    - -

    Example

    -
    -$ wgrib p.grb -set_percentile 50 -grib_out new.grb
    -1:0:d=2010020304:PRMSL:mean sea level:6 hour fcst:50% level
    -2:17960:d=2010020304:PRES:1 hybrid level:3 hour fcst:50% level
    -
    - -See also: - --grib, --grib_out, --set_metadata, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_prob.html b/web_docs/set_prob.html deleted file mode 100644 index a12dafb..0000000 --- a/web_docs/set_prob.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_prob - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_prob -
     
    - -

    wgrib2: -set_prob

    -

    set values for Product Definition Templates 4.5 and 4.9

    -
    - - -

    Introduction

    - -

    -The -set_prob option converts some -common non-probability Product Definition Template (PDT) to -a probability PDT. Then it adds the metadata for the probability -part of the PDT. - -

    -Step 1:
    -  If current PDT is 0,1,2,3,4 or 6, then the PDT is converted to 6 (4.6)
    -  using the -set_pdt +5 option.
    -
    -  If current PDT is 8,10,11,12,13,14 or 15, the he PDT is converted to 9 (4.9)
    -  using the -set_pdt +9 option.
    -
    -Step 2:
    -  If the current PDT does not have Code Table 4.9 entry, print a warning
    -  and return.
    -
    -Step 3:
    -  Fill in the various probability metadata using arguments to the option.
    -
    -  X=Forecast probability number
    -  Y=Total number of forecast probabilities
    -  Z=Probability Type (see Code Table 4.9)
    -  A=lower limit
    -  B=upper limit
    -
    - -

    Usage

    -
    --set_prob X Y Z A B
    - where X, Y, Z, A and B are defined above
    - for wgrib2 v3.0.0+, X, Y, Z, A or B can have the value "".
    -  When the value "" is used, the previous value is not changed.
    -
    -

    Example

    -

    -

    -$ wgrib2 test2.grb 
    -1:0:d=2009060500:TMP:2 m above ground:180 hour fcst:ENS=+19
    -$ wgrib2 -set_prob 10 20 2 10.1 10.4  test2.grb 
    -1:0:d=2009060500:TMP:2 m above ground:180 hour fcst:prob >=10.1 <10.4
    -
    -X=10 Forecast probabilty number
    -Y=20 Total number of forecat probabilities (Number of intervals for probability forecasts?)
    -Z=2  Code Table 4.9
    -A=10 Lower limit (may not be used depending on Code Table 4.9)
    -B=10 Upper limit (may not be used depending on Code Table 4.9)
    -
    - - -

    -See also: --prob, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 8, 2015, Aug 23, 2019 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_radius.html b/web_docs/set_radius.html deleted file mode 100644 index 53a2b44..0000000 --- a/web_docs/set_radius.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_radius - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_radius -
     
    - -

    wgrib2: -set_radius

    -
    - - -

    Introduction

    - -

    -Most grib2 Grid Definition Templates (PDT) include the -shape and size of Earth. Such information is -necessary for finding the latitude and longitude of -the grid points in various projections. The --set_radius option sets the -shape and size of Earth and the -radius option -shows the the shape and size. - -

    -The geolocation of the grid points is done prior to the execution of -the run-time options. So the --set_radius will not affect calculations of -the lat-lon of the grid points. To get the correction locations -after using the --set_radius option, you must write the file -with the new shape of the Earth. Then you can use this new file. - -

    Usage

    -

    -

    --set_radius N      N=0,2,4,5,6,8,9
    -                   Code Table 3.2 is set to N
    --set_radius 1:R    R=radius in meters (spherical)
    -                   Code Table 3.2 is set to 1
    --set_radius 3:X:Y  X=major axis Y=minor axis (oblate spheroid), X, Y in km
    -                   Code Table 3.2 is set to 3
    --set_radius 7:X:Y  X=major axis Y=minor axis (oblate spheroid), X, Y in m
    -                   Code Table 3.2 is set to 7
    -
    - -

    Example

    -
    -$ wgrib2 small.grb2 -set_radius 0 -radius
    -1:0:code3.2=0 sphere predefined radius=6367470.0 m
    -$ wgrib2 small.grb2 -set_radius 1:6300000 -radius
    -1:0:code3.2=1 sphere user defined radius=6300000.0 m
    -
    - - -See also: --radius -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 8, 2015, Oct 2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_regex.html b/web_docs/set_regex.html deleted file mode 100644 index f6e6363..0000000 --- a/web_docs/set_regex.html +++ /dev/null @@ -1,273 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_regex - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_regex -
     
    - -

    wgrib2: -set_regex

    -
    - - -

    Introduction

    - -

    -One common feature of many Unix/Linux commands is the support of -regular expressions (regex). Several of wgrib2's options support -regex (-if, -not_if, -match, -not, -egrep, -egrep_v) which make the various string -comparisons much more versatile (compare egrep vs windows find command). -The -set_regex option changes the flavor -of regex evaluation. - -

    -NOTE: the -set_regex option MUST preceed the -match/-not/-if/-not_if/-egrep/-egrep_v options. All these -options are "setup" options and the processing the the -set_regex must occur before the -processing of the -match and other regex options. - -

    -Grib files can have hundreds of records and most people only want a few of -the records. Rather than processing everything, you can select the -specific records to process by the -match, --not, --if and -not if options. These options -take an extended POSIX regular expression (regex) as their sole argument. These -options check the regex with the "match inventory" (see -match_inv). -Some examples are - -

    -  wgrib2 input.grb -match ':UGRD:200 mb:' -grib u.grb
    -  wgrib2 input.grb -match ':(UGRD|VGRD|TMP):200 mb:' -grib uvt.grb
    -
    - -

    -Now regex are powerful but can produce some surprises. For example, you want -the 19th (positive perturbation) ensemble member which is denoted by -'ENS=+19' in the match inventory. You try, - -

    -  wgrib2 input.grb -match ':ENS=+19:' -grib e19.grb
    -
    - -

    -Surprise, the above line does not work. The plus sign is a regex -metacharacter indicating that the previous character would be -matched 1 or more times. Consequently the plus sign wouldn't -be matched. To get the above match to work, you can quote the plus sign -with a backslash. - -

    -  wgrib2 input.grb -match ':ENS=\+19:' -grib e19.grb
    -
    - -Alternatively you could change the regex match into fixed-string mode. -In fixed-string mode, the regex metacharacters are considered to be -ordinary characters. - -
    -  wgrib2 -set_regex 1 input.grb -match ':ENS=+19:' -grib e19.grb
    -
    - -Most of the regex options have a fs (fixed string) version, -such as -match and -match_fs. -It is better to used the fixed-string versions are equivalent to -the regex mode set to "fixed string". The fixed string versions -were added because regex library may be unavaible on non-POSIX -systems. - - -
    -  wgrib2 input.grb -match_fs ':ENS=+19:' -grib e19.grb
    -
    - - -The third mode is the metacharacters have to be quoted. -Here is an example that gets the 19th, 20th and -21th ensemble members. This mode was added because it is easier to remember -to quote the '(|)' metacharacters than to quote the ordinary characters -correspond to metacharacters. - -
    -  wgrib2 -set_regex 2 input.grb -match ':ENS=+\(19\|20\|21\):' -grib e19_20_21.grb
    -
    - -

    Usage

    -

    - -

    --set_regex X              X=0, 1, 2
    -                            0 = extended regular expressions
    -                            1 = fixed string mode, no metacharacters
    -                            2 = metacharacters need to be quoted
    -
    - -

    Example

    -
    -$ wgrib2 gep.grb -match ':UGRD:200 mb:' -match ':ENS=+19:'
    -        (no output)
    -$ wgrib2 gep.grb -set_regex 1 -match ':UGRD:200 mb:' -match ':ENS=+19:'
    -4.1:86046:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    -
    - - -See also: - --egrep --egrep_v --if --if_fs --match, --match_fs, --not, --not_fs, --not_if --not_if_fs -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 10, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_scaling.html b/web_docs/set_scaling.html deleted file mode 100644 index a2e7b19..0000000 --- a/web_docs/set_scaling.html +++ /dev/null @@ -1,257 +0,0 @@ - efficiently. - - - Climate Prediction Center - wgrib2: -set_scaling - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_scaling -
     
    - -

    wgrib2: -set_scaling

    -
    - - -

    Introduction

    - -

    -The values at the grid points points are usually stored in in this format, - -

    -
    -  Y = (R + i*2**B)*(10**D)
    -
    -  R = reference value (32-bit IEEE floating point number)
    -  i = integer, 0..2**N-1
    -  N = binary bit precision
    -  B = binary scaling, -127..127
    -  D = decimal scaling, -127..127
    -
    - -There are 3 sytems for storing the number which I call - -
    -
    -ECMWF convention: D = 0, N = parameter
    -
    -  Y = R + i*2**B
    -  R = reference value
    -  i = integer, 0..2**N-1
    -  N = binary bit precision, a parameter
    -  B = binary scaling, determined by grib routines
    -
    -NCEP convention: B = parameter, D = parameter
    -
    -  R = reference value
    -  i = integer, 0..2**N-1
    -  N = binary bit precision, determined by grib routines
    -  B = binary scaling, a parameter
    -  D = decimal scaling, a parameter
    -
    -  Note, global model uses a variant: B = 0, D = parameter
    -
    - -

    -Both the ECMWF and NCEP conventions have their advantages and -disadvantages. The ECMWF method is easier to use, you just -set the binary precision to N bits (12? 16?) for all variables -and you are done. With the NCEP convention, you have to -set the scaling for each variable separately. For some variables -such as specific humidity, the scaling should be pressure -dependent. On the other hand, if you are trying to get the smallest -files, the NCEP convention is better. For example, you want to -get the RH to the nearest integer. With the NCEP method, you simply -set D = B = 0. For general use, I suggest that you use the ECMWF -convention because people time is usually more valuable than disk space. -Ok, I value my time more than a few GB. On the othe hand, I've been -involved with more than my share of projects were disk space -has been the critical issue. -

    -By default, wgrib2 will encode using the ECMWF convention using 12 bits. -The number of bits can be changed by the -set_bin_prec option. -The -set_grib_max_bits option will have to be -used if the binary precision is set to more than 16. - -

    Default Scaling

    -

    -When you read a field, the scaling of the field (B, D) are saved as -the scaling parameter. However, Some options such as -the -rpn option can -change the magnitude of the field and scaling from the -input field may not longer be appropriate. So these -options will revert to the default scaling (ECMWF-style using -the N bits). However, in some cases such as time-interpolation -or smoothing, the original scaling is appropriate. In this -case you can set the B and D scaling to text string, same. - -

    Usage

    -The -set_scaling option is used to -change the binary and decimal scaling parameters for the next -write. (The binary and decimal scaling parameters will be -reset by reads and calls to RPN.) This will set wgrib2 to -to encode data using the NCEP convention. If you want to -encode data using the ECMWF convention, you need to use -the -set_bin_prec option perhaps with the --set_grib_max_bits option. - -

    - -

    --set_scaling D B
    -  D = decimal scaling or the text 'same' with no quotes
    -  B = binary scaling or the text 'same' with no quotes
    -
    - -

    -See alse: --set_bin_prec --set_grib_max_bits --scale --scaling -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 11, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_sec_size.html b/web_docs/set_sec_size.html deleted file mode 100644 index dcc9ae8..0000000 --- a/web_docs/set_sec_size.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_sec_size - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_sec_size -
     
    - -

    wgrib2: -set_sec_size

    -
    - - -

    Introduction

    - -

    -The -set_sec_size option is DANGEROUS. -Grib messages are made of sections where the section number varies from -0 to 8. Suppose you want to modify a grib message by changing -section 4 (Product Definition Section). You would -use -set_sec_size to change the size of section 4 -if necessary and then use -set_byte to change the contents -of your new section 4. This is not pretty but when testing a new template, -you have to do ugly things. - -

    -After you have altered the grib message, you can save the -message by either -grib or -the -grib_out. You need to use -the latter option if the grid values were altered because the -data section needs to be updated. - -

    Usage

    -

    - -

    --set_sec_size  SECTION SIZE
    -SECTION=0 .. 8
    -SIZE=integer, size of new section
    -     can be zero for a missing section
    -     generally greater than 5
    -
    - -

    Results

    - -

    -The -set_sec_size option expands -or contracts a section. For expansions, the new octets -are filled with 255. This option puts the size of the -new section in octets 1..4 and the section number in octet 5 -assuming the size is greater than equal to 5. Some -sections can be missing. -

    -See also: --set_byte -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_subcenter.html b/web_docs/set_subcenter.html deleted file mode 100644 index 545d588..0000000 --- a/web_docs/set_subcenter.html +++ /dev/null @@ -1,170 +0,0 @@ - efficiently. - - - Climate Prediction Center - wgrib2: -set_subcenter - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -set_subcenter -
     
    - -

    wgrib2: -set_subcenter

    -
    - - -

    Introduction

    - -

    -The -set_subcenter option is deprecated, please use -the -set subcenter option. - -

    -See alse: --set -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: August 11, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_ts_dates.html b/web_docs/set_ts_dates.html deleted file mode 100644 index dd37afd..0000000 --- a/web_docs/set_ts_dates.html +++ /dev/null @@ -1,216 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_ts_dates - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_ts_dateis -
     
    - -

    wgrib2: -set_ts_dates

    -
    - - -

    Introduction

    - -

    -The -set_ts_dates and -set_date options -changes the reference date of the in-memory grib (sub-)message. You can write out the message -with the new date by the -grib (fast) and --grib_out (slow) options. Of course if the in-memory -grid values have changed, you have to use the latter option. - -

    -The -set_date X option changes the date code to X. -For time series, you want the date code to increment, and you use the --set_ts_dates X:Y:Z option. Here, X is the date code, -Y is the time increment and Z is number of fields to have the same -date code. - -

    Usage

    -

    - -

    --set_ts_dates  X:Y:Z
    -                    X = starting date
    -                    Y = time increment
    -                    Z = block size
    -
    -                    X=YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm, YYYYMMDDHHmmSS
    -                    YYYY=year, MM=month, DD=day, HH=hour, mm=minute, SS=second
    -                    MM=01 if MM is not specified
    -                    DD=01 if DD is not specified
    -                    HH=00 if HH is not specified
    -                    mm=00 if mm is not specified
    -                    SS=00 if SS is not specified
    -
    -                    Y=IS
    -                      I = positive integer
    -                      S = year, month, day, hour, minute, second
    -
    -                    Z=# fields / date code (must be one or greater)
    -
    -
    - -

    Example

    -
    -# date code increments by 1 hour
    -$ wgrib p.grb -set_ts_dates 2010020304:1hour:1
    -1:0:d=2010020304:PRMSL:mean sea level:anl:
    -2:17960:d=2010020305:PRSML:mean sea level:anl:
    -3:34248:d=2010020306:PRMSL:mean sea level:anl:
    -4:48055:d=2010020307:PRMSL:mean sea level:anl:
    -
    - -See also: - --grib, --grib_out, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/set_var.html b/web_docs/set_var.html deleted file mode 100644 index 562a638..0000000 --- a/web_docs/set_var.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -set_var - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-set_var -
     
    - -

    wgrib2: -set_var

    -
    - - -

    Introduction

    - -

    -Please see new grib for the basic -concepts of making new grib files. - - -

    -The -set_var option changes the variable -name of the in-memory grib (sub-)message. You can write -out the message with the new name by the --grib (fast) and --grib_out (slow) options. Of course -if the in-memory grid values have changed, you have to use -the latter option. - -

    You can set the name to a locally defined variable name only if -the center is set correctly. For example, you can use an NCEP-defined -variable name only if the center is already defined as NCEP. If the -center is undefined, you cannot use any locally defined names. - -

    The search order is for WMO definitions and then the locally -defined definitions. The search order has implications for NCEP -users. NCEP often have WMO and NCEP definitions for the same -variable name/type. -The -set_var option will choose -the WMO definition. This will cause problems with programs that -expect the NCEP definition. - -

    The default is to search the NCEP defined names. However, wgrib2 -will use the dwd or ecmwf names if the -set_names dwd -or -set_names ecmwf options are used. - -

    The -set_var option will alter the master table. -The grib2 standard says that variable definitions are only valid for -specified master tables. Wgrib2 keeps track of range of tables for which each -variable name is valid. In addition, there is an entry for the master table -used by the -set_var option. - -

    Usage

    -

    - -

    --set_var X              X=valid grib variable name such
    -                        1. text name such as HGT or TMP
    -			   For WMO defined variables, either DWD, ECMWF, NCEP names are used
    -			      depending on -set_names  (default is NCEP)
    -                            local variable names have to consistent with the local center
    -                        2. varA_B_C_D_E_F
    -                        3. var discipline=A master_table=B parmcat=E parm=F
    -                        4. var discipline=A center=D local_table=C parmcat=E parm=F
    -                           use 3 for WMO defined variables, 4 for locally defined variables 
    -
    -                           A = discipline
    -                           B = version of master table
    -                           C = version of local table
    -                           D = center
    -                           E = parameter category
    -                           F = parameter
    -
    -                        formats 2-4 were introduced with wgrib2 v2.0.7
    -			they intended to allow manipulation of variables which are not
    -			in the grib table.  Format 2 is the inverse of -set_varX
    -			and formats 3 and 4 are the inverse of the verbose -set_varX
    -
    - -

    Example

    -
    -$ wgrib2 p.grb
    -1:0:d=2009072100:PRES:mean sea level:anl:
    -$ wgrib2 p.grb -set_var TMP -grib out.grb
    -1:0:d=2009072100:TMP:mean sea level:anl:
    -$ wgrib2 out.grb
    -1:0:d=2009072100:TMP:mean sea level:anl:
    -
    -You can use -set_var to change from old variable names to the new variable names
    -by the appropriate use of the -if option.
    -Convert TSOIL (old) to SOILTMP (new)
    -
    -$ wgrib2 old.grb -if ":TSOIL:" -set_var SOILTMP -fi -grib new.grb
    -
    -
    - -The -set_var option will rename -all the fields in a grib file. If you only want to rename -specific fields, you will have to use the --if and -fi options. - -See also: - --fi, --grib, --grib_out, --if --set_metadata --set_var --set_varX -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: April 28, 2017 April 12, 2018, 10/2023 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/short_cmd_list.html b/web_docs/short_cmd_list.html deleted file mode 100644 index 0806fc2..0000000 --- a/web_docs/short_cmd_list.html +++ /dev/null @@ -1,463 +0,0 @@ - - - - Climate Prediction Center - wgrib2: - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - -
     
    -
    -wgrib2 v3.1.1rc1 4/2022  Wesley Ebisuzaki, Reinoud Bokhorst, John Howard, Jaakko Hyvätti, Dusan Jovic, Daniel Lee, Kristian Nilssen, Karl Pfeiffer, Pablo Romero, Manfred Schwarb, Gregor Schee, Arlindo da Silva, Niklas Sondell, Sam Trahan, George Trojan, Sergey Varlamov
    -   stock build
    - -else            else         else, -if ... -else ... -endif
    - -elseif          elif  X      elseif X (POSIX regular expression) conditional on match, -if ... -elseif ... -endif
    - -elseif_fs       elif  X      elseif X (fixed string) conditional execution
    - -elseif_n        elif  X      elseif (inv numbers in range), X=(start:end:step)
    - -elseif_rec      elif  X      elseif (record numbers in range), X=(start:end:step)
    - -elseif_reg      elif  X      elseif rpn registers defined, X = A, A:B, A:B:C, etc A = register number
    - -endif           endif        terminates if block
    - -if              if    X      if X (POSIX regular expression), conditional execution on match
    - -if_delayed_error if           if delayed error
    - -if_fs           if    X      if X (fixed string), conditional execution on match
    - -if_n            if    X      if (inv numbers in range), X=(start:end:step)
    - -if_rec          if    X      if (record numbers in range), X=(start:end:step)
    - -if_reg          if    X      if rpn registers defined, X = A, A:B, A:B:C, etc A = register number
    - -not_if          if    X      not_if X (regular expression), conditional execution on not match
    - -not_if_fs       if    X      if X (fixed string) does not match, conditional execution up to next output/fi
    - -0xSec           inv   X      Hex dump of section X (0..8)
    - -aerosol_size    inv          optical properties of an aerosol
    - -aerosol_wavelength inv          optical properties of an aerosol
    - -bitmap          inv          bitmap mode
    - -center          inv          center
    - -checksum        inv   X      CRC checksum of section X (0..8), whole message (X = -1/message) or (X=data)
    - -disc            inv          discipline (code table 0.0)
    - -domain          inv          find rectangular domain for g2ctl/GrADS plots
    - -end_ft          inv          verf time = reference_time + forecast_time + stat. proc time (YYYYMMDDHH) (same as -vt)
    - -end_FT          inv          verf time = reference_time + forecast_time + stat. proc time (YYYYMMDDHHMMSS) (same as -VT)
    - -ens             inv          ensemble information
    - -ext_name        inv          extended name, var+qualifiers
    - -ftime           inv          either ftime1 or ftime2 dep on version_ftime
    - -ftime1          inv          forecast time
    - -ftime2          inv          timestamp -- will replace -ftime in the future TESTING
    - -ftn_api_fn0     inv          n npnts nx ny msg_no submsg i11,5(1x,i11)
    - -full_name       inv          extended name, var+misc+lev (depreciated)
    - -gdt             inv          contents of Grid Definition Template (g2c)
    - -geolocation     inv          package (proj4,gctpc,internal,not_used) to get lat/lon of grid points
    - -get_byte        inv   X Y Z  get bytes in Section X, Octet Y, number of bytes Z (decimal format)
    - -get_hex         inv   X Y Z  get bytes in Section X, Octet Y, number of bytes Z (bytes in hexadecimal format)
    - -get_ieee        inv   X Y Z  get ieee float in Section X, Octet Y, number of floats Z
    - -get_int         inv   X Y Z  get 4-byte ints in Section X, Octet Y, number of ints Z
    - -get_int2        inv   X Y Z  get 2-byte ints in Section X, Octet Y, number of ints Z
    - -grib_max_bits   inv          maximum bits used in grib encoding
    - -grid            inv          grid definition
    - -grid_id         inv          show values from grid_id
    - -hybrid          inv          shows vertical coordinate parameters from Sec4 (assuming 2 var per level
    - -ij              inv   X Y    value of field at grid(X,Y) X=1,..,nx Y=1,..,ny (WxText enabled)
    - -ijlat           inv   X Y    lat,lon and grid value at grid(X,Y) X=1,..,nx Y=1,..,ny (WxText enabled)
    - -ilat            inv   X      lat,lon and grid value at Xth grid point, X=1,..,npnts (WxText enabled)
    - -JMA             inv          inventory for JMA locally defined PDT
    - -lev             inv          level (code table 4.5)
    - -ll2i            inv   X Y    x=lon y=lat, converts to (i), 1..ndata
    - -ll2ij           inv   X Y    x=lon y=lat, converts lon-lat to (i,j) using gctpc
    - -lon             inv   X Y    value at grid point nearest lon=X lat=Y (WxText enabled)
    - -match_inv       inv          inventory used by -match, -not, -if and -not_if
    - -Match_inv       inv          same as -match_inv except d=YYYYMMDDHH <-> D=YYYYMMDDHHmmss
    - -max             inv          print maximum value
    - -min             inv          print minimum value
    - -misc            inv          variable name qualifiers like chemical, ensemble, probability, etc
    - -MM              inv          reference time MM
    - -model_version_date inv          prints model date code
    - -n               inv          prints out inventory number
    - -N_ens           inv          number of ensemble members
    - -nl              inv          inserts new line into inventory
    - -nlons           inv          number of longitudes for each latitude
    - -npts            inv          number of grid points
    - -nxny            inv          nx and ny of grid
    - -packing         inv          shows the packing mode (use -v for more details)
    - -pdt             inv          Product Definition Table (Code Table 4.0)
    - -precision       inv          precision of packing
    - -print           inv   X      inserts string (X) into inventory
    - -prob            inv          probability information
    - -process         inv          Process type (code table 4.3)
    - -processid       inv          process id (locally defined)
    - -proj4_ij2ll     inv   X Y    X=x Y=y, converts to (i,j) to lon-lat using proj.4 (experimental) we:sn
    - -proj4_ll2i      inv   X Y    x=lon y=lat, converts to (i) using proj.4 (experimental) 1..ndata
    - -proj4_ll2ij     inv   X Y    x=lon y=lat, converts lon-lat (i,j) using proj.4 (experimental)
    - -pyinv           inv          miscelaneous metadata for pywgrib2_XXX (experimental)
    - -radius          inv          radius of Earth
    - -range           inv          print out location of record in bytes, 0 = first byte
    - -reset_delayed_error inv          clear reset_delayed_error flag
    - -RT              inv          type of reference Time
    - -s               inv          simple inventory
    - -S               inv          simple inventory with minutes and seconds (subject to change)
    - -s2              inv          simple inventory .. for testing ftime2
    - -scale           inv          scale for packing
    - -scaling         inv          scaling for packing (old format)
    - -scan            inv          scan order of grid
    - -Sec0            inv          contents of section0
    - -Sec3            inv          contents of section 3 (Grid Definition Section)
    - -Sec4            inv          Sec 4 values (Product definition section)
    - -Sec5            inv          Sec 5 values (Data representation section)
    - -Sec6            inv          show bit-map section
    - -Sec_len         inv          length of various grib sections
    - -spatial_proc    inv          show spacial processing, pdt=4.15
    - -spectral_bands  inv          spectral bands for satellite, pdt=4.31 or 4.32
    - -start_ft        inv          verf time = reference_time + forecast_time (YYYYMMDDHH) : no stat. proc time
    - -start_FT        inv          verf time = reference_time + forecast_time (YYYYMMDDHHMMSS) - no stat. proc time
    - -stats           inv          statistical summary of data values
    - -subcenter       inv          subcenter
    - -t               inv          reference time YYYYMMDDHH, -v2 for alt format
    - -T               inv          reference time YYYYMMDDHHMMSS
    - -table           inv          parameter table
    - -timer           inv          reads OpenMP timer
    - -unix_time       inv          print unix timestamp for rt & vt
    - -V               inv          diagnostic output
    - -var             inv          short variable name
    - -varX            inv          raw variable name - discipline mastertab localtab center parmcat parmnum
    - -vector_dir      inv          grid or earth relative winds
    - -verf            inv          simple inventory using verification time
    - -vt              inv          verf time = reference_time + forecast_time, -v2 for alt format
    - -VT              inv          verf time = reference_time + forecast_time (YYYYMMDDHHMMSS)
    - -warn_old_g2     inv          warn if old g2lib would have problem
    - -wave_partition  inv          ocean surface wave partition (pdt=4.52)
    - -YY              inv          reference time YYYY
    - -inv_f77         inv>  X Y Z  match inventory written to Z with character*(Y) and X=(bin,ieee)
    - -last            inv>  X      write last inv item to file X
    - -last0           inv>  X      write last inv item to beginning of file X
    - -nl_out          inv>  X      write new line in file X
    - -print_out       inv>  X Y    prints string (X) in file (Y)
    - -s_out           inv>  X      simple inventory written to X
    - -big_endian      misc         sets ieee output to big endian (default is big endian)
    - -box_ave         misc  X Y Z  box average X=odd integer (lon) Y=odd integer (lat) critical_weight
    - -check_pdt_size  misc  X      check pdt size X=1 enable/default, X=0 disable
    - -colon           misc  X      replace item deliminator (:) with X
    - -config          misc         shows the configuration
    - -count           misc         prints count, number times this -count was processed
    - -end             misc         stop after first (sub)message (save time)
    - -error_final     misc  X Y Z  error if at end X=count Y=ne,eq,le,lt,gt,ge Z=integer
    - -export_lonlat   misc  X      save lon-lat data in binary file
    - -fix_CFSv2_fcst  misc  X Y Z  fixes CFSv2 monthly fcst X=daily or 00/06/12/18 Y=pert no. Z=number ens fcsts v1.0
    - -fix_ncep        misc         fix ncep PDT=8 headers produced by cnvgrib
    - -gctpc           misc  X       X=0,1 use gctpc library (default=1)
    - -grid_changes    misc         prints number of grid changes
    - -grid_def        misc         read lon and lat data from grib file -- experimental
    - -h               misc         help, shows common options
    - -header          misc         f77 header or nx-ny header in text output (default)
    - -help            misc  X      help [search string|all], -help all, shows all options
    - -ijundefine      misc  X Y Z  sets grid point values to undefined X=(in-box|out-box) Y=ix0:ix1 Z=iy0:iy1 ix=(1..nx) iy=(1..ny)
    - -import_bin      misc  X      read binary file (X) for data
    - -import_grib     misc  X      read grib2 file (X) for data
    - -import_grib_fs  misc  X Y    read grib2 file (Y) sequentially for record that matches X (fixed string)
    - -import_ieee     misc  X      read ieee file (X) for data
    - -import_lonlat   misc  X      read lon-lat data from binary file
    - -import_netcdf   misc  X Y Z  alpha X=file Y=var Z=hyper-cube specification
    - -import_text     misc  X      read text file (X) for data
    - -limit           misc  X      stops after X fields decoded
    - -little_endian   misc         sets ieee output to little endian (default is big endian)
    - -mem_del         misc  X      delete mem file X
    - -mem_final       misc  X Y    write mem file X to file Y at cleanup step
    - -mem_init        misc  X Y    read mem file X from file Y (on initialization)
    - -new_grid_format misc  X      new_grid output format X=bin,ieee,grib
    - -new_grid_interpolation misc  X      new_grid interpolation X=bilinear,bicubic,neighbor,budget
    - -new_grid_ipopt  misc  X      new_grid ipopt values X=i1:i2..:iN N <= 20
    - -new_grid_vectors misc  X      change fields to vector interpolate: X=none,default,UGRD:VGRD,(U:V list)
    - -new_grid_winds  misc  X      new_grid wind orientation: X = grid, earth (no default)
    - -no_header       misc         no f77 header or nx-ny header in text output
    - -proj4           misc  X      X=0,1 use proj4 library for geolocation (testing)
    - -read_sec        misc  X Y    read grib message section (0-8) X from binary file (Y)
    - -rewind_final    misc  X      rewinds file X on cleanup step if already opened, CW2
    - -rewind_proc     misc  X      rewinds file X on processing step if already opened, CW2
    - -rpn             misc  X      reverse polish notation calculator
    - -rpn_rcl         misc  X      data = register X .. same as -rpn rcl_X .. no geolocation calc needed
    - -rpn_sto         misc  X      register X = data.. same as -rpn sto_X .. no geolocation calc needed
    - -scaling_0001    misc         changes scaling testing (sample)
    - -set             misc  X Y    set X = Y, X=local_table,etc (help: -set help help)
    - -set_ave         misc  X      set ave/acc .. only use on pdt=4.0/4.8 (old code)
    - -set_bin_prec    misc  X      X use X bits and ECMWF-style grib encoding
    - -set_bitmap      misc  X      use bitmap when creating complex packed files X=1/0
    - -set_byte        misc  X Y Z  set bytes in Section X, Octet Y, bytes Z (a|a:b:c)
    - -set_date        misc  X      changes date code, X=(+|-)N(hr|dy|mo|yr), YYYYMMDDHHmmSS, u(UNIX TIME)
    - -set_ensm_derived_fcst misc  X Y    convert PDT 0,1,2 -> 2, 8,11,12 -> 12, X=code table 4.7 Y=num ens members
    - -set_ens_num     misc  X Y Z  ensemble member info, X=code table 4.6 Y=pert num Z=num ens members -1=No Change
    - -set_ftime       misc  X      either set_ftime1 or set_ftime2 dep on version_ftime
    - -set_ftime1      misc  X      set ftime
    - -set_ftime2      misc  X      set ftime2 .. will be replace -set_ftime/ave in the future -- TESTING ---
    - -set_gds         misc  X      makes new gds (section 3), X=size in bytes
    - -set_grib_max_bits misc  X      sets scaling so number of bits does not exceed N in (new) grib output
    - -set_grib_type   misc  X      set grib type = jpeg, simple, ieee, complex(1|2|3), aec, same
    - -set_hex         misc  X Y Z  set bytes in Section X, Octet Y, bytes Z (a|a:b:c|abc) in hexadecimal
    - -set_ieee        misc  X Y Z  set ieee float in Section X, Octet Y, floats Z (a|a:b:c)
    - -set_ijval       misc  X Y Z  sets grid point value X=ix Y=iy Z=val
    - -set_int         misc  X Y Z  set 4-byte ints in Section X, Octet Y, signed integers Z (a|a:b:c)
    - -set_int2        misc  X Y Z  set 2-byte ints in Section X, Octet Y, signed integers Z (a|a:b:c)
    - -set_ival        misc  X Y    sets grid point value X=i1:i2:.. Y=va1:val2:.. grid[i1] = val1,etc i>0
    - -set_lev         misc  X      changes level code .. not complete
    - -set_metadata    misc  X      read meta-data for grib writing from file X
    - -set_metadata_str misc  X      X = metadata string
    - -set_pdt         misc  X      makes new pdt, X=(+)PDT_number or X=(+)PDT_number:size of PDT in octets, +=copy metadata
    - -set_percentile  misc  X      convert PDT 0..6 -> 6, 8..15 -> 10, X=percentile (0..100)
    - -set_prob        misc  5 args X/Y forecasts Z=Code Table 4.9 A=lower limit B=upper limit
    - -set_radius      misc  X      set radius of Earth X= 0,2,4,5,6,8,9 (Code Table 3.2), X=1:radius , X=7:major:minor
    - -set_scaling     misc  X Y    set decimal scaling=X/same binary scaling=Y/same new grib messages
    - -set_sec_size    misc  X Y    resizes section , X=section number, Y=size in octets, DANGEROUS
    - -set_ts_dates    misc  X Y Z  changes date code for time series X=YYYYMMDDHH(mmss) Y=dtime Z=#msgs/date
    - -set_var         misc  X      changes variable name
    - -start_timer     misc         starts OpenMP timer
    - -status          misc  X      X X=file
    - -submsg          misc  X      process submessage X (0=process all messages)
    - -sys             misc  X      run system/shell command, X=shell command
    - -text_col        misc  X      number of columns on text output
    - -text_fmt        misc  X      format for text output (C)
    - -udf             misc  X Y    run UDF, X=program+optional_args, Y=return file
    - -udf_arg         misc  X Y    add grib-data to UDF argument file, X=file Y=name
    - -undefine        misc  X Y Z  sets grid point values to undefined X=(in-box|out-box) Y=lon0:lon1 Z=lat0:lat1
    - -undefine_val    misc  X      grid point set to undefined if X=val or X=low:high
    - -v               misc         verbose (v=1)
    - -v0              misc         not verbose (v=0)
    - -v2              misc         really verbose (v=2)
    - -version         misc         print version
    - --version        misc         print version
    - -AAIG            out          writes Ascii ArcInfo Grid file, lat-lon grid only (alpha)
    - -AAIGlong        out          writes Ascii ArcInfo Grid file, lat-lon grid only long-name *.asc (alpha)
    - -ave             out   X Y    average X=time step Y=output v2
    - -ave0            out   X Y    average X=time step, Y=output grib file needs file is special order
    - -ave_var         out   X Y    average/std dev/min/max X=time step, Y=output
    - -bin             out   X      write binary data to X
    - -cress_lola      out   X..Z,A lon-lat grid values X=lon0:nlon:dlon Y=lat0:nlat:dlat Z=file A=radius1:radius2:..:radiusN
    - -csv             out   X      make comma separated file, X=file (WxText enabled)
    - -csv_long        out   X      make comma separated file, X=file (WxText enabled)
    - -cubeface2global out   X Y    write faces X as global cubed grid to Y: X=list of faces to exclude
    - -ens_processing  out   X Y    ave/min/max/spread X=output Y=future use
    - -ens_qc          out   X..Z,A simple qc ensemble members X=stats.grb Y=extreme.grb Z=extreme.txt A=1 (qc_version)
    - -fcst_ave        out   X Y    average X=time step Y=output v2
    - -fcst_ave0       out   X Y    average X=time step, Y=output grib file needs file is special order
    - -fi              out          depreceated, used in old IF structure
    - -grib            out   X      writes GRIB record (one submessage) to X
    - -GRIB            out   X      writes entire GRIB record (all submessages)
    - -grib_ieee       out   X      writes data[] to X.grb, X.head, X.tail, and X.h
    - -grib_out        out   X      writes decoded/modified data in grib-2 format to file X
    - -grib_out_irr    out   X Y    writes irregular grid grib (GDT=130 not adopted) X=(all|defined) Y=(output file)
    - -grib_out_irr2   out   5 args writes irregular grid grib GDT 101 X=npnts Y=grid_no Z=grid_ref A=UUID B=(output file)
    - -gribtable_used  out   X      write out sample gribtable as derived from grib file, X=file
    - -gridout         out   X      text file with grid: i j lat lon (1st record)
    - -ieee            out   X      write (default:big-endian) IEEE data to X
    - -ijbox           out   X..Z,A grid values in bounding box X=i1:i2[:di] Y=j1:j2[:dj] Z=file A=[bin|text|spread]
    - -ijsmall_grib    out   X Y Z  make small domain grib file X=ix0:ix1 Y=iy0:iy1 Z=file
    - -irr_grid        out   X Y Z  make irregular grid (GDT=130 not adopted), nearest neighbor, X=lon-lat list Y=radius (km) Z=output grib file
    - -lola            out   X..Z,A lon-lat grid values X=lon0:nlon:dlon Y=lat0:nlat:dlat Z=file A=[bin|text|spread|grib]
    - -merge_fcst      out   X Y    merge forecast ave/acc/min/max X=number to intervals to merge (0=every) Y=output grib file
    - -mysql           out   5 args H=[host] U=[user] P=[password] D=[db] T=[table]
    - -mysql_dump      out   7 args H=[host] U=[user] P=[password] D=[db] T=[table] W=[western_lons:0|1] PV=[remove unlikely:0|1]
    - -mysql_speed     out   7 args H=[host] U=[user] P=[password] D=[db] T=[table] W=[western_lons:0|1] PV=[remove unlikely:0|1]
    - -ncep_norm       out   X      normalize NCEP-type ave/acc X=output grib file
    - -ncep_uv         out   X      combine U and V fields into one message like NCEP operations
    - -netcdf          out   X      write netcdf data to X
    - -new_grid        out   X..Z,A bilinear interpolate: X=projection Y=x0:nx:dx Z=y0:ny:dy A=grib_file alpha
    - -new_grid_order  out   X Y    put in required order for -new_grid, X=out Y=out2 no matching vector
    - -reduced_gaussian_grid out   X Y Z  reduced Gaussian grid, X=outputfile Y=-1 Z=(neighbor|linear)[-extrapolate]
    - -small_grib      out   X Y Z  make small domain grib file X=lonW:lonE Y=latS:latN Z=file
    - -spread          out   X      write text - spread sheet format into X (WxText enabled)
    - -submsg_uv       out   X      combine vector fields into one message
    - -text            out   X      write text data into X
    - -time_processing out   X..Z,A average X=CodeTable 4.10 Y=CodeTable 4.11 Z=time step A=output
    - -tosubmsg        out   X      convert GRIB message to submessage and write to file X
    - -unmerge_fcst    out   X Y Z  unmerge_fcst X=output Y=fcst_time_0 Z: 0->result 1->+init 2->+all
    - -wind_dir        out   X      calculate wind direction, X = output gribfile (direction in degrees, 0=wind from north, 90=wind from east)
    - -wind_speed      out   X      calculate wind speed, X = output gribfile (U then V in datafile)
    - -wind_uv         out   X      calculate UGRD/VGRD from speed/dir, X = output gribfile
    - -write_sec       out   X Y    write grib msessage section X (0-8) to binary file Y
    - -alarm           init  X      terminate after X seconds
    - -append          init         append mode, write to existing output files
    - -crlf            init         make the end of the inventory a crlf (windows) instead of newline (unix)
    - -d               init  X      dump message X = n, n.m, n:offset, n.m:offset, only 1 -d allowed
    - -egrep           init  X      egrep X | wgrib2 (X is POSIX regular expression)
    - -egrep_v         init  X      egrep -v X | wgrib2 (X is POSIX regular expression)
    - -eof_bin         init  X Y    send (binary) integer to file upon EOF: X=file Y=integer
    - -eof_string      init  X Y    send string to file upon EOF: X=file Y=string
    - -err_bin         init  X Y    send (binary) integer to file upon err exit: X=file Y=integer
    - -err_string      init  X Y    send string to file upon err exit: X=file Y=string
    - -fgrep           init  X      fgrep X | wgrib2
    - -fgrep_v         init  X      fgrep -v X | wgrib2
    - -fix_ncep_2      init         ncep bug fix 2, probability observation < -ve number
    - -fix_ncep_3      init         sets flag to fix ncep bug 3 (constant fields)
    - -fix_ncep_4      init         fixes NCEP grib2 files where DX and DY are undefined
    - -fix_undef       init         set unused values to undef
    - -for             init  X      process record numbers in range, X=(start:end:step), only one -for allowed
    - -for_n           init  X      process inv numbers in range, X=(start:end:step), only one -for allowed
    - -g2clib          init  X      X=0/1/2 0=WMO std 1=emulate g2clib 2=use g2clib
    - -i               init         read Inventory from stdin
    - -i_file          init  X      read Inventory from file
    - -inv             init  X      write inventory to X
    - -match           init  X      process data that matches X (POSIX regular expression)
    - -match_fs        init  X      process data that matches X (fixed string)
    - -match_inv_add   init  X Y Z  add new options to match_inventory
    - -names           init  X      grib name convention, X=DWD, dwd, ECMWF, ecmwf, NCEP, ncep
    - -nc3             init         use netcdf3 (classic)
    - -nc4             init         use netcdf4 (compressed, controlled endianness etc)
    - -nc_grads        init         require netcdf file to be grads v1.9b4 compatible (fixed time step only)
    - -nc_nlev         init  X      netcdf, X = max LEV dimension for {TIME,LEV,LAT,LON} data
    - -nc_pack         init  X      pack/check limits of all NEW input variables, X=min:max[:byte|short|float]
    - -ncpu            init  X      number of threads, default is environment variable OMP_NUM_THREADS/number of cpus
    - -nc_table        init  X      X is conversion_to_netcdf_table file name
    - -nc_time         init  X      netcdf, [[-]yyyymmddhhnnss]:[dt{s[ec]|m[in]|h[our]|d[ay]}], [-] is for time alignment only
    - -ndate           init  X Y    X=date Y=dt print date + dt
    - -ndates          init  X Y Z  X=date0 Y=(date1|dt1) Z=dt2 for (date=date0; date<(date1|date0+dt1); date+=dt2) print date
    - -ndates_fmt      init  X      X = C format for ndates option ex. 'date=%s'
    - -no_append       init         not append mode, write to new output files (default)
    - -no_nc_grads     init         netcdf file may be not grads v1.9b4 compatible, variable time step
    - -no_nc_pack      init         no packing in netcdf for NEW variables
    - -no_nc_table     init         disable previously defined conversion_to_netcdf_table
    - -no_nc_time      init         netcdf, disable previously defined initial or relative date and time step
    - -not             init  X      process data that does not match X (POSIX regular expression)
    - -not_fs          init  X      process data that does not match X (fixed string)
    - -one_line        init         puts all on one line (makes into inventory format)
    - -order           init  X      decoded data in X (raw|we:sn|we:ns) order, we:sn is default
    - -persistent      init  X      makes file X persistent if already opened (default on open), CW2
    - -rewind_init     init  X      rewinds file X on initialization if already opened, CW2
    - -set_ext_name    init  X      X=type ext_name (1*misc+2*level+4*ftime)
    - -set_ext_name_chars init  X Y    extended name characters X=field Y=space
    - -set_regex       init  X      set regex mode X = 0:extended regex (default) 1:pattern 2:extended regex & quote metacharacters
    - -set_version_ftime init  X      set version of ftime X=1, 2
    - -tigge           init         use modified-TIGGE grib table
    - -transient       init  X      make file X transient, CW2
    -
    -
    -
    - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5200 Auth Road
    - Camp Springs, Maryland 20746
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/single_dual_stream.png b/web_docs/single_dual_stream.png deleted file mode 100644 index 3fc2bb7b8376ffcfd81314342c813e9a8dd725bf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 28920 zcma&Ob9iN6mo-{du~D&Y+jhlvDz@#4ZQHh;RBW?ivts-1-`nrgef#_R_H+L@$=YY_ zv(Ls_bB;O2SSL(gRvZo*3;N5KFL06)B8p$Wd>sZ}KOw<^ziqqz4nPN#orH!X(Es_* z>+4;3eb|>TcIA>Hg34~I=UHGsQN_Oxf7YR^?Gi$LB?5)KSj`86MoBRUYF3ZC5zLdX zNP4CrC|7@$hp>!(4*UimM1|}wS%dB!toK^>mG`K(YD?@TtQ>Gq*G-K8xkZm3=D|;Ny3E`)0GR|*}?|n?~X>wXf z{~RqBFtpSoj-MFEmdaNL-UOcn-`qQUyS(CPcUI`1WeS?{8rihJYPUInp;D_#H&u(r z;HkGc6sadOQ+&rpjSldY4gOJ9ZdbF82tH(TnJDXlS%k3IYQMLck>>7gx!W;V(vUoA zXla_Kd!$cUqXCYIQY4@EtzIc*hMh_DwtJpw{X*X~_Tr_|C{}_#0MkTq>ZeVf;ya567}T22lR2HQ zsu*2~{v|^>1fQ;-!)2k z3KWd`H{`>+vcha>lO|(<4S91)ly zCcC#{{AQiIal4KjUk25fCz5;1x63oCbjHJ+Uws32{J3x1m~3)mPt<>PDuN`QRrf~6 zAbK~KZnDt07Mt_kLCy*}iCn?Go3+62?(dPXu`>=}`P$sEj$Eq+LgJ{mAD__vZb(%e z=pUMo|H|yW<9m17X~d*eEiRVG2VG3;^{Rj^HJKS6hFGrAQ!{B4+iEJ+=u$2oj(O?( zzH}H2R^l&<2@3^<=YUa9}ua+v8#bbnv9cpfMd)K*MZu;j)LO?(O(?aun>&5!YRiEk?r9U{@&|5qJK}w^7O-VxmN?0vt{zs&HJIb+8E3CC}NOEBcXkA#OPD`S3T* z0#{`QonE){IgN#x+0zz0tPzvshAZH$-GOZ0ul=Ibv|`5i=I&&^RHLC7Lyz3Fb}&`v zismHo#6AYU=l3BLEem&ovW1I_%UHEDmLB=C(pHLK-(;0paDzJw8PHQ6Ks>Vl@)1LQ znJ!`KLP*Jo)NT4mz(j($LH?d#@p>Qf^@>tIfj_PDngxYAhG)t?h?^L@UODRUGhOW@ zrgu~Z{MKn{BVROPrbe$v8vl3fplPmQ>_=`0x}5IM_os!Mr(t~GT(uhAQto4X<+9Z7 zYn~=cjRUt%9$y{iv0N(0m!%P-vku#D##cv+DI(wr@yPa1m*xy?Ekh9N5*X-Ua`f&t+A7uxsHZLejPq}R|EmS?&8kFy#!Q7b%_UshqYezm4b zJn^=N&1<0*Vfm-;C4c1%P%4ofELAAj{PXcAhI{8+fu(=1%j*8hxnb_4`-1v$y)TOW zdd!)OYczF+b}w%|QBX+#Crvtk{lZWJ?mp~T&CK>eN?t`pmN__--ltm;v?Oz z?ctf`(jw0|7j@T;$qls#rt-mdxun^Op>(jJ31tB%W>e-ya->xX$p(tI{&JO8h~aRw zaXY=p(^+>%#W}`KNicSzgZ=(e7MONNa36yXQ+|w6`6wN9lG6K8ViOE zuT-cQ)Pbkf4&Z;X|8t^{n8q`gxu?Bh3@u%+joAqvva719LPA6L0g)<5vd81z0*A*9 z@%Ct1ygwL@(QaGd?d7cI>2{hwsLa;JhAx=Z=i~Y4>h`w(vgea-9o#|C=VvJ*6qcz} zSnjt%lH2#ktq2lfVRm}m&JpBMGdn?(VJKnMk+L<(L*j&ybdaS2F;uyx%(JO3^c7yx zORlE|<|VF*5x5?(dIIi`P6W}c^MU$y=s1c41?6W^k9RIaOEFd&ZDe6HBGDWFxQlIB6I_j%B*#e;32e`xh0{|@SN~#=!ouDP!;}5xR^0GeGB89 zlWTbRKaO^^2w)?W*rq-(I=tQo4caq3(RQadcT1cL=KK=8U>dg(A7clNxUJ7Rp*Kf` zi!p2RbHs+Oby?yy9;P}y?&9@MKHLE!k;jR=uKaD3B1BcLSzlq~3ST>6vZB}7Nbijz zTAxH%@R~7E$J&Lo4PQ!!7sm(EL$7b{u#Dh^d!skp%=Wolrfbh)_L$sKdX4%c{1 zTu(vP;;eiav}0k>NtAxU%#Dsh(d%`i%qO#1t^Dc_K_F&iMB?J&qR{K+sn(TYoH#h& z2fG9Az7P2?B$*T*E{B|Tw(ko1F%qSX7-C>2Lu z5wts>se(d4?1kX_$a@T`8UJ24Y`v#IoD!|lx3tc_XdA)2pFjEv2@f@Vn4{G<)b|TU zF{@Ie0bHlu32B^IEb{lm`IFbos7PnljrH3Wm$X}s7L$jgKhK2@*jYv#p5yhaPnb>8&VX}LD z3yUXNLK7(mrsfYeb(URnvH?MH_C3QcDb(?0&X#B0SeErAgW0ZlVfZ8VX(9{ zq;KXhaTb;4)LfkUuW97!p2u`=0Ypehm;oeZeTG(r2wFc3S;}|AYckxAjyt!SDTsZH zb!0ARjnL5p%MlQQ^6blda3@hQ9z;*iOjJWf*7RXME6V6OvUeJmIJlXt3F*{p3HmwQ za(sF)QN6-V-ROq%T@*cByJ~#3gI|ts7DG6gjy5DV&4)Ke+S`AtxYX|{3SEHT z>SLAB(=;ZuC{iNj;p0&%$5aK=Y8cP{wp2;GturpHxh=yM!S#Ii7@FTf??u!{P+E7zQn@Fou(Flod)uL?{;rM zk|P6@3VSZfdpOx(Jhwa%C8cB}cKqj||J$!h^*W(DLo96Uh}s)vd66p3CcD!GN=95i zuF5cQIIN$4>W$6j3d63>q#AM~P$>J5%b?cVoqx1R6R%Px!wUwLwr4>n#^Dy*T2kUcVC@7o{5}zB88%c|LJQS#_kYw-ZtAto+1KGD!q(Cf6JeRF)TNJAvVfa) z!um>5Nh8B__cu<*jL!%ZRwVC`?3fYVh>c%CIn+G}XXUwoVx$r@dkVISMz&LOP3L7E z|EMtFe#>)x3atP7;oeaF54y0I6-%SD6Cx^JBs{U&_Q=-!OzHB9bPRsyHir+kJp1_b z=mdly8gu!bRD228^UVh;$FgXxvH8)1jj?>!B0Fd6W#+vpISI)(4L9FYSKP1P zVXzrly?5k#Mq_~}T0MnKe=EnI@!WnFZ7@m7K>BFw^;q zs=1Gse7z54Re#<_Y};Axgi?G{j%>UAZy&$u8`>ru?4e55xnZLO7kwt+UL@1kPUp`w z{)M$t`ijq72F*mjr^w(wb5ZHQckxaUiTod95J*qJaQxSR3@Rmfe|!6BVggQF@Hw<7 z-%1>=b8vY{4-Suj#Uf$7Two`Sq8HIV+1S|FO0Wopx(k4J(X0A{@f7Oiwbj*d0TZC2 zM7iY{ipHfrG&Zxej5s$OibNvr8&#pO=Jx&QIP&TFC}+N_#$P+MlK6QZz(Bxk11=8T$Va$WXGEWOk>fzJ zO!_O8g!?agFjvB(JC-vJT5_AN-cT^{pQeU{-=Y;VNA9i=UF*7`rwk4z{r#B&L z|4>dd_bM@`fT9~lg8%LG(A&_sEW}?Lj!Gn7w=I9ghxDrJ=)U|T?Ma9E`iB$dt84RR zL@@-)e%wJCnvw31nrcwrito)Rd7rFwO^Ck>HUGC~P0J+f zK{}mwqjvl>NM+12W;@<;)d%IZ`wi=;nWk=R>8Otc5h@W*CmWB4vxwgkjkpbPi`1S_ zJs>B7#WLeqHc!QEEhZ91y68V$Oz*N&w-nwK?{0PHAN#w_9<)598+Vb&y_-vXl(_r7 z_uHa^gM%UA;n7g*CQGt+7v6u?b-OrUKBlv|f+!M=WOF%Uo2EEXW`d7s_34!EXb_=cb>Q5+e@7tWd5JK3u((l8EnLvxzV9FrRwWgI=FP!Zf>r+hs;vkF!~ z;CLo1Kr7bWP$Y30jgZ!iSSF-W^8Rz3vje+n6?PyR>{Gak{$=l_PKH9Y7~BSDD_oZU zBX6C*svz99`x*R43f*F)zj6zLpFgNdDaGfsO;$jYlB9y!ovV;`WTOhT3Ssf^D>Ne; z*Eedh#$Sd|_ygS6|&^>s=3cX!hExaqep3j zavUx6^Mz!>omZY_~0_>l(UC@m@CvT+v;qlhx^AVzizfZyne)do zBLkzTKH)S>{3=rjET%set3{|BMv&?8D(fv?oN+(jU?wjD^G1nH2qEQAO96HyZRKEn zc}0Dt-9xxC;i*O#3{%D5wHCRzi_I=AjZg<+XAh3GwB4NmbP9!=cT}7hswf91Il86b z)O#(@s;2l8g)R?gHxG~S z6MM&_VjIerHo3{fQ9s*$YF9E;Xbj!+Z?88-|Ak`#@g2e^~wcKC{QE<(HavHatla{20%00A8=&K z+YJ^{f@}ve#a81$;U?lSxtu6Ym#Qi<$%4{{!fzn&yfC~8~=r-9R3~df!zwVVn;cnh^HA~eKjzH!Q%BX&?JKO{fzi9 z^!4@oremU_-~e=;Vh$_Axq0|HRcEnCrQPlnhEE4WlAseA6(yRh)8TS2$r|VI1x^g&ZL`+)247rTewInvE>S{fdQ3%EEmgwOcEK` z)Wixy44eZh3N+YM7WXiM|9_o3h8QteyaB?Y+Ddz-!G93Jba!C)WE@y)(|m*X5Fc)L zT%dk}NCHf`B{Kol(QHoljd>*{A^U|S1B0XlgoFy9$OWpZ#2{eds~H7Obwp;`f54J> zt)Sm;Em*v$g@lM%U+}0~*9=as#3~6{<3=m!^@m4a?dW$1@*7P9`xanzi#cJ$ZrR|~ zJzt6>%n1p7t_BcHURKo^_7iX*LgrBn%c?E${c(lq>f0kmZyin#$e1 zYdsYyoOa%AwKL1KE~u7!+}_c2UBptaRN&}1nh9YvSWkVmwv~otXnZAh#^FVA!v)H5 zBEBfo>w+0PurKbIS@#8vek+~vKi$O#I{?6{ z0;_I^gYHrzl4Qa=*zFK%xl9RRK&eauGu@N@p4ASA%N>H>l{V*sEj&_X=CIRJ@>4p;r03c_z#J6IGqzyZ#=#WfNKMPhaR8zKz6%lH%+}pGX);c z2kC*$m3m_sfIKHDCN?)W-NK3(tarjCqA zq^718az*R9A(viV+115#X6HWPpwN^!oy@g5pP>P%CBozW6l#alZu`q>lO;Lm1;BQS zCsC;=%0Lz)K>R~qAvyfw`xb-GFLr;rXn(%SinJHN2kxM&Jbisql9LZy`mW(%t-v8> zA+GIaXPU(ZaN&vLz@7N<$bk%=w$@@>vMRR9(6u)o5hvJ}x@lj}P^=>tn;f6U9@%zK~Ro;~8X zegh;7tf49EzrEsFur62TTmrpUOHtoiOC>PnTv!1zAivagPIh_ z-8P-dL?YJs_U&8Xb{xUnuP?h5HQmTP)N0jUN11B)A=_&w9SUt;qss8H5$LWHk8g3? z<9+--{l4BM3JUhE9=C)p($+fL1sZh%Xm%#k*-?4IA<%?coo;oZ!-B*LfLutL49HCM zVmmZC?aGCbpmIqwBOHxbT_8zgDTuzy)fZK>)4xX~{L)o^P!?$DbiaHNKWyA<$p&Nc zEzbh7dY|i-cL*RPLPv=U_e*>Sm`yb^NlavE|MC)zqNU&WrMiEVC?mn*!sFRWC{$f- z`1>v}acDxom=Fl{3mG#O5QY0FSTxN_pRAWEHJYbH_q5Fs*^zK?A`4pl0~yK##FwM@ zcC%H8;D_s+dx)+M0%#ySp5H^JuNUud+qy#(HwW$C^}l#Yt<-`7qYaKl*k3V&jq~+J z3H33C{{u0KqkK<0Y^jN+_I+1UJ^hG}ZkJkeMgjxfM@rew^6Z`l8C=gnGoQR$7 z?iOz~Xy}(V1_SSB^W67!%3c%6mv`bNb*0WO@4_pRV77Ui+ zUfoUTsJE@2D+*o3F(7L|-6`hjlgBOej+f9gT53BwU2f`35RA$;brA@uILU+vWsLh6 z@rSFb*3*|!QM0egb8w~;r|G!JzH7g^(cStHL(2-I+LqC6;D@9y7^kb znaadMJGr!k_VMwd5$&Fa2^BWFV*daYt>@`CTqA^phZ=Ic!Z9#R9)1OZawDK82eFha zMxi%{CR5&;?-fQ=i3d|4u-WDa0YnW{KfW^0fK+bRYR#JKqvOv*m?25}KfgFb_}y}G zFsZ-uf=?q);i>G(%0^N(?60 zSRN7ww;X@pkl~|UsFSi3t=jF-5#aIQgP{&uktwOKRqY>Yb{; z_3kh0_>QlOD1Kq;1ZkOF%5y1MeeGqzF4Pk86!w3bi!IESF+&s3Zz^;^HDdNt;d00XE2Zc@Fu~Y*noJ-!6mezYm~18kFY|3v6`OLO0{?G-)7B1Q!C6?--fk@hzQR+-$tBGPXOMv zj4XEDYrP;^==xVjoc(%NYlX95dO}B|J?2NsWv^0^aTd5&Dg4U_CBX3s-zV!u#Pnw| zcg)y4ArnT1L0ucXcBAf*1jRGGDQannLl#Vg`5xxWz6z$3#ui?4#XK`d4a^P1`**kpM z4-A+txMzR|D0=At)Wkk&>?qSogpmu)&NH@$Z12e283`0;ns48~gEYZ1eFhjwejTfIFcWswy>0JJ_@t}w=u>;vlR z{4{g2>Qs4bHhrUt`mqmwP+J1hN~;2SPu|x9cfwo}H*500f(D9AJU_ZEP2D|ER6KRf zwmC>W*H9)=k`q0OA&^jT{9Y0C^mk_D99Wn_z~xr{{0W==VFXuX@u!ZkOIJQpet%-< z_td(Zj9DnM4W&|(l+Q17wafmoInYHa&!3B7De-x?$dYpqdxurx91IoK?XOCodu@(K zi69i&Jnr#(mI=R`DpiC?#NfVZ0NSm1{~UC{uQ@Bkn;I_f7pJ$YeuOem$EUf5(0SF+ zuV3mJ&`=tinzogi12JS>gpnuSnU!K*i$28L5aRXW(uiFyH>1*7Eum9BPAznb$Q-52 zhnu56_Gsc!z}tMx>J)Z3u7*V#F&MsA3^fKg&&EqgNeEouINLq0`?RXr{0dQvCZZ#Q z28aW*+xKtBbI$iDyRBkfLx)^3#y`-9U2miHH(l?c?_qQa62r%M(ZZ>y?}Zh9P~A($ ziD5Gu1e)m-l_{NC>3i>>gIk8Iv+G)A^CIRTJb`H)!HUI5V%J$;AbLIA8?E;^NtCOS zEy-x-FYUA72qPK^92clmAeatR!57Q6WE|Dq6=Et)r%}gN?Ez zrC@*?Y#OPutHxTyV1=j@j-t|S0SK$|I5sx#gl&kBR?=TWF>;5syYrhIBr z4LZ>_251P^S)9nGDJ-}9j|webg= zxl5J_&{vo)v8EvlC-`ru2m3GB2cSOy_Wk$v|Ah+w$L@c94A^zT6O<_}-wr^Kt8oC= zAr`E!4^$UHar){QKy?AM|9R`5c2L|X=hD&=BrGh-&JsF}dhAIzt!CqIfNNmp9R{p3 z`bI`1OYjxRoVm6!aI(7Z`53`%QJ0)17^V!l$yE8RVn9zeJfIa|)NoZIY(pOUe#v>sk z`vY1*E@0fzCZLJLr+*>D5|3n6XfEVd-IS*urzrw`85Xh7N-Pb2%g@Ax?)b~^WtyQDh3RAU4 zHwu|lsu236oXRVU%UMy(2#?!^hDxnE5{MuMKxDqm4DjK9-v54ld>m?xV$!8rr72Xv z=Wz!Ka1DKN#Nvuj%>8{M60rDu03s-Dm%2M&LkCQAs6q=}p006_LIx&S7-HaQ1MR*M0QVFB>#c&(J`Sq` zm8j|8*YhoQ`sQkMlEJLR36CTsWP3A9TsCYf_gUmgMB4UH#`ZmzKlqY9GYMM)P zOJW8>M7z7lg@*Bn_~;0?I926-j;alvAs=Z(x1DbAknm5V^;Vi|@;TK!xNzXr3G&1rP!R&_@?x7KC7l!Yx zCU%W%JN}0HG(4S9(PABS-11HF5Yn`?EFV5iO-%z`0JsDZ)2vHnuH{1~f-&qp+8now zRQFKqTnB?wQW8GV6K27#!|X6^-03sYr&)nbcLgo#(uQ`zlX6EFzdU)Z+YK4g&ZUV= z|H|p;;OaX3a(||fClvH}v1PY{mPmb;O#k=*cpOMb$$k%Zq&sZ+JB@hmmmuBflLO*T*MCf4;;SFyk?@uAFgrUln$VmNV3_cBI(F@=Pjmy8ZF~TB_T{ z_3^Za0MxLg^WHMju!|0p2mKlUV3d^>100JMY*1k(n97U=5VYng3auKrsSEXB3tGj_ z_H*q!5F+7kv-S(niMBIHi(1|RXX5O=B|dA~8z2Vf( zqYW9^fUr2b@oy22%cdd7z5n8%Fou^t!#{4L!?AtbKg(Bq^dF^^&6jSsg1_R%X{1>@ zhU72i{%Q3v%evcj8k-NPj9#g=T&i@h`BH9Ro|m0G!gUToxc%%sFg&<@mmI`US1XuO z=WBR*Q#Z4;DEf-@BWb!xwCAMN-K#>Kje&8veAar_@P@2u9U=;JY&-_{*|Uhncnl>H ziv!5N=64~^mX2uxFIEhK+3*(|v~)B#ynq}yWf_t9e@ zLwj-=;Yae8{xk96zAj(Cp`K)TaG(ONf2pc|A@*968OgerMG0jl$s6;#Wg`|3dB36a z-CeDXgIr@m_uqDpa3NEeP7hp2aR}k3&x8WZcl?3}|5$gH>OY*p)72upJ35RJHn0J`{u_*&OL7$Sk7p$M8D@{7Lrfpqa{ z+x~~|#pclrr`TykEZbn6mQ9FZBc-yuKX<~EeV45^nu_mO#wm>j{P}0M)tJ`WxoKvc@qyS5aeLKv#!o7-8 z>e<3H+h51ry~1BXi%tS#xbq8Kr{<#$N%OrG?m^bY;3076J8H1hCLP8`G+10v9b&z; z6!pL$dANPK%Y*1olWGmzlb3c)NMGzgDZJ+6XAK=X2DG6*TXDb-t4UJ>=;rR&HNV#y zC}?Q-BY$F1HX>b-A?E4Nrn2T{D;LoX2MzQ+UC$QfrAQ3KQBT)B#L{QK1obzx;x?iL ze@@+~(WAZm{?S9A-SY@;edf8HG5rJG!xaZej?GVn{tXgL%2{38ui$`k)_X7R*Gfr> z&h3a&#}FT=4AIWDN|am>-B?*u5)v2)N$)lS%%Ui=EfD$hA&);8=vL^s;t+J#Q_B8zZiEk>0Kc-xz zqPwBncB@+*;9PDlf#jbL5PX05dMtDuJm7>w~(qy@8Fq<#>bUlp!kB^>^0+3UX zU-9_7)H7=&6UfG5Anb4UB@=12RM%m2TJ(B+b}?3K%;$?kLqmU;DV5az?EMyr%`Uqy zdXEEOn0^3PSIyyQ7o#&f_ zL3${%fBch;mdmp4oqm3PZgI3UGy@L+2U$c=%v-HcAodS$8jZ)BZovyhDu^E@l|%(~ zE&(XNHaglpK01)ZqS9o?YI5{VHA;?-j)Zn3kt7q}$)pj7FV|WS{_#t^0&0|G8v3GR zEP>*=U!aP(ct}w|kivUxZX%@;c#hXi*o;#l;mh4gz&`{hoG3j3R8d7m#Z9X5c(Oh~ zWl|{Q2R;=U9-u4h>EQ!WqYog=6mjL~eKq%E4b5ZL8qE`C0?n5znA~rS6nLw3I@kan zc<{MGxs2!{tkvZ_ea5TMUIp{NgQQaRIwC-p^BWiti8~5_K-g`V=JPzlA-Qtup$Vml zbT3Cz$xBfv)@rdi!4tMWpe(bH$DCtJ3>{CQ?{WN_KrT0M8A~WEB6Z0zmtW{UU!8Ip z^;c-|v}7U(20d}S9xaJ5FG-=wrNlMn##woKwnB|Q8S=ky>;DdG>#pj7>J>bx1WEOyKsH~7rGC_LJaXVz%5{l|7_kWTlk~#HAonz@ z4w<&-{bt)Er-_!Ar5ZD z@7XD2aB%2EC;IUCwoZO)Yg)a?gPV&k&&PrGEuUAJw>gqMfNl#r0N8M2kLn_jJ#J$9K~o3y(TmZ6oQ^uK^T^=?C;3y}1X$aM==saSpmDTYK$bZiB zk2%cw!_jD4bzsHBpgW^wht_4(7)q_dd~P)`Zkq*z8*!hZi}X$l$tT6DVMbHR{$|HD z8o0RMvq2A;YcjzQEl_z5(_`%@Tm!&;uO%ml(KgqD!d&Q-8VCrKfbK)ibw2uO=0Z3r zg||2|p3&UQmYlUL?4E=CoSb6XGTjRR(3{JiAs3Mrs586EzOQb|)|uRJ=2oG8j_~@6 zF*48Rruq}ur8QT8gmS#z)_}p9fL%HsKoGNAsF0$!nxE{s{y7ZFa>0p)UHs@bO@5wN zRRHsUilx_8i3ma>6wy^VQDj}i1#1KMkPn{eQUZ>`R$jGU+pp+-aN4!%i6^9~mT$)Mg+;?`8NH4?N3e-?)#bV&cIKXlJLku!d@1|Px z08;l~9X4_%N~VL5kx;kwgT1acuJNZ7 zOo=vXQWGiT&mE{H-UdY%@Z-&UC7)ZEc!qd_rK++&dpI#U-AM&|W;o?FH8nH-<{+De zAwuO#D)!8S@3|ziL}heNPWLkaAi6ns=hVQI0L!Mh5$^Reqp{I19%HXy{lKl>vkq8N z$>Qs_pn?OJIH^-1V_XE_aSC%s`BNaHEA+N<+SZF)c+bK~xx_}kwjumnE3 z;`zcS=BuB!{j|87K2BdPf;?Qv2Esr(eqtZ)r8{0A_V%tfsexf zuN^lwOk8N%+U4F<*Ac~$D(F0EFHjE(bk? z0t%cHA|6h-(sGWWRSj1B7qtFTSx$UUseZ8c_jl15Yu%YgoJ;!k!uGj`*#r5NY+#sx>W;QO@*UeV zCC1y-(8&=^cmh-nEiKOq)PyaPtn8yA@+&QM|KbNy5rsFcEX+Uc8d#EKy0d9QDZhE@ zBCnKlJRKRa{N>YR4!lk({OU@J1qFCH%<)u_Khi!}HQ}-ocIvo1Jk;6S$XBD(p>?`4 zogrp0lpL6(WkWS67GtW?e2Uk8ESkXw`NbjD11617=U_6l(nXVB4*1W8Yk)?Q#~M`J zV6SMA^XMHZbLY%>zs7Z0IUPlS>^FUBY)+*mcF7B6XalBD)mLh36h89{{i=FVh=hn3 zHQNPEXmaUYWDIV9K3HsZ=88St?CtH@u_!`}?D6f{@VghA19oTEoa>ONBg+AnqACMR z6G{)R7~OO`c*i4(F?WiB=Vp2HaY9j<)rp|W?c(=#iRK!Z^v8^1%)Zn$Yz1_ZM3&jq zz_~wv(t;GD{-!NKM+I9WSEWCP6@`6kvE}bwwV%A*e=~A5F{a8uO!c+2DGx6OJS*wO z%obSXLguEXA;2ORvp{)8j9=Jt{&u@V)K7eH{(ABx`G$K)sJJmJt)L`iWI|dVoTY-o za&qDmW6LS!rmDrkS59>zaJHTcxAy+k(Mu3*z80f6ZTlqO^5gaO&C?&zBcX+jZP6pm zQ(UVGpLvtc3%-k~hH$V|;_;Ms30JLVvx zAzbue2BxULLc+x){@s`8yn*p==mP7uIEG{xpYMWM zLTx((h7)gRES)^zKC#>EOe`mVwAvvIZpif3eea+}BQOlEXa08l$(0;7a-477;{SYO zp7-X>qOH60jY{;Lx9hP)0I|Dxuw?v92z~(z79nO}!IE7fV_;Ry4Nc4As20N%zotIE zw@3K$Y!=dA23-^r69egzpaU^X{kSzaw!yAY<^>hycqx!R+F&#WdQ5MMC+cR0(JW*B zytzklB^QOoI?&**2U;D8Xd}ghkuqM(U_zC+@9!U24^*B)6y|&+D(1`;(M!0EUl*y| zAq5wl_S^hvhcAXcSCfS|98NqbDO4*lqH#FmcW}gj%2_WczR^fqI}x}0-N2YaP{L)Xcd?cwuyvbNCRZ{m2HT=W5gsC>r;0Yi}wW?+e-Y8%$rd%lULJmo@Sq65WapI7>giKyMT;In~(4a=sL=6BjmEW zkVRQlqSez1CGP~FJUuZ_tr(e`_42U2@g>OSXQ%n^p+#dS#wu%h0Sk&d2U04;(`>sy?|AXwe|JLS#$d-3F!xAqOqD{qjKe3K}+&QL; zWCjk_S@6PkUj0@m_mvb&^UC@4_uUdrw%XDpy1boa;FL9Q*D!aP^`ceN(f#2K4CP6H z>_Cy?`+Ckk%PP1iIhP739fJUUyT~?oc;e{0vUc#HeS=ca+>chAE|usK%QX8h;?73U zsg6->c{Q8nD}a(gpoj!D2taV zrp)!O)~5SXA7gXl2;yhr;3RQZ9Wvo=;^rF7m1ehvH^0_v1>w%NF`?OX1yfHG0gFDg zbF*RE-g;c#zdpRrC2x754ZWdD39)X&Mb#4u7N$W0W9)mhhl+QA30SyUrR#{iGi zV5Kw%sxDRYjhNvgh8Z$OGB7LP90FDPN0$f=$K%!3Hv3>9E9#Ssss4htY&H+24?5s< zTjz;qi2nBiMIGV=HOa+4l|tSw3mw4eO()P&A)c^1-=#|U`R{F8#}3I&~!auOqrXmLq^(7S|0+f=C5L{KFciS8o- zR}>!}8rjR-BmWd4(p%EXO69(qXU&U%ln|h=Poo@b>2~ufv_VKx2>kp3DjR8(C$Gny zS@o36H6gTRBqR_%*7Wv-`+>q?vni|E19~4LeqcN#BqZW{ ze9z}cM=iebBMu-vJ$(&~FE0ayGSCesHN`+1qKVJq0}RstO(^`|373D%jQ^o2{{Pzb z|5K6tA3yznikI~Sk)z0O7#P9&7{Qk1u>B0M{bRs60IDV@pn5XEQj7o7qkjO1YW)nA zIDqPj5u5}lZGh(HV1zNL4w{#;) zgMd=fD52C)dyU`uu5a(N_daKD|3j{s>t$xWYdz2X{O+PkOYreenDkzQw_o6A#e_Y($aE3d*e?JC#P%VgTZWO z%ae4qE&D=IB+Qc8;=v&F)!uXoJ3ITxwEyH)i{o-Qa3>Z3O*KQ*UvOh%W3tW7+VA#k zVK3J}M~A?~{|pakq12~vWRY2~{*k`EJ|&w*sgn3;GL7rSFC$m<60rBL0W;QOlRd%V z&!1OYrr?A5G#p)1!vfYP7`9U4f+=kT93lMlP5?(b24Cw}8KA>~EX{1(se2=0F@kBP z)&+P#T`zZZ@v#`(L`EDsl>wkRtncqL-gWt3H$!ZIZ+>FhKlX))KK*;339bJaO^J+; z9|HUmrwAX7dcAuf7%p$TdoJky5(ul(#v_6>RT=Q}j@7XB0SO5Sm^(c_SokmuaL|8V z;TX`1!$K(RfyAs$nKUOmKhv@rkZrfxsF1+SQ{M%4Z?cm&y1InV$V6koySV}rGoQ4hxAAm?)s^L|Z+-z_R@y-fAfNCw5B(;)5<%Ie&hop7Tv{US zc=X>%GwmMsNt#5Weyy)FnOO=!kVN60dN>RxDk$i|6jUK2D=T_iUOl6++mHD+d5ezA zWv$0ybr?**XFevxel}`*ZMh{_@9;Jx1e6;B=fA#H-CV=7K(@f~f1=n6Uv0E+AQ~1x zR!W^;0HncH!T)b{g0%{+?4N5D{KUgJ%tm)K_^r(O3Z*hwA=gt^xSB%jNw`@?$a_+G zj`|E+ERdq;YV1l*m96?Eq-RWO>IY%>CH8On{pr+oA7kkSWf=T>>L9eMx0v~0WatPcP)cSMGy$UJt4Ja&X zlkc|Heb{5gpY#D8G7|$H7QW8tMm!})MQT}7YNi~gj`6_Sr#v0ZV_tOU?~i)Ridkel zD$r%^aRN-?I}L+ewZQ3vm=?p}%uFo97q$$Gb zF3K#OH=7Xy@KvY$qrl`5?2G6l;;4-+V_Yr9_TQ4DRJf={t@rjGWS!4LXgWM4`2-&R zj_@19r-ARD+z8B0xOozvB%;!hC+Q{PeLo6~lA9K~QQ=e^c* zt!=4hTNxMlecu#YJuk_iH5W*%M<#LelG|Mu857;lUTW%M+BN@*0sX$kfiCSE5J>Q9 z`%@-m#m28+@nB~t0%0NaT9umdU%IdRxISI)VB2Y)FdJg93J^^yWD;B*p0}Z|F6?v> zxVld$0iPm)yZfJ7V0eetTq6lr^4_hb6-SgYY5(j%gWMCaH`PbPzkgvkt{I_+C2P3&5j!gChD=(p7XxA7kvmf^u@g4*&{_6d!>QW*GyxcXR#-Sws-T? zH$LorE z&Nn7DmtE-h-jWRS7X7RZi;Ro!sU%y@*Io{;t#uoMs}{aPD!U|E^r_~9Lq;dSE;1k$ z+SfBcdaWHBkt)dnX7)IrjZ>!_H(=1{$W@Kd$DNo*?WHf@zDfJpskR2)1T`y1z|G|w zM)w?{H!@#xMb@{qk88~Cw(&8yyqvB%ab4--xBbhax-VGC(1Ho=QO>=&+8eL=`C_W>Kqmgql<5c8wzaid8)J#5C$7$WdG6?s=5cCDVi(30x zB|F_dSpLlk)1I5>7%=t~QPIE>WBiuX^hl8HJu|_obs4 z<1?c>Fk-)3Z9-7_#ek2(AiltP&%?Le?iKA}Tla>E1($05hq1AGnvSO3dAjT6hl)$T zH6=eD{|FfoG-M{KPCp{u{8ckO22Ws&*Qp`BnP4GYHH_1U*R=0?v;I=yC$%8W zrVS{9{Jke)?za>>&LjvS;pSYweXZ-s$hpV!Z{tx1&9|$RYHsa5HqS{FE^D=!$ldJ? zQM+&480Ow}VmxK2E6l}n{dxTOPgc7YcM>bbAnj&3e zBj+zBWfcYN7Y^sFByW%N`9Qph%=l3N-tv1=!-$z|f}Vk~XUjYHs@1>We>JRU^tBym zc;ZJAj?WWA(0XCF(&|cyXLXrv@Dlo}j*}-WlQnA%JvNj9NkS^@+@tS-t4s}4*chs#xFh-yP0UB zY0rl?HBJV8SKH!c*>m=%(io5mi?V|F3w>979;l|b#iF|mELbFeGYRc zi}Y~gn?gHs@TroIO-;^X1CgIWj24J9J1yy>*dke8MH2EP=vltFgE2zI2l&cGxDlEL zPT!sN3s^8(C?78d{J|eOt5#cs5sT6O{j;e0e>~2^=H-VO_!=Ic^-o?6uWg$n8yKJk zuwO++#EJ4g?~0?%VSII8-F)*BzBd&yXr9y$gFFr_kmQl4lha?~>%6vRgNBCoDu92# zImmXSyGHaprz;^@1^=>BU*2!I6IbkSfoQ{sD)RhhrL0t!R=Vx>kK|3$(KF_WI8!^P z$6>*uV#TEN{TuV)UgwMtWZ6U{6TT=E$s)e-`v$$ng;x_A zVzsoEK@m1m=C^wfmn+JgyZSN>KDbU@Jawp!H8mMPk6KD@-QC3#9JIA8M5Z31Vx%Od zFq>*Up?}G($OqCn#&SIm3BX1Rir-L98@;Mf;Lfv8f$lU#JZ$w5dysG|aq`0>!^W<$ zDY;q&5eXMngxb~?h*Si1QTmj2(g6bWoZLD}2o8)458%ZlwkO z8zCq)3L!AgX$(VRhULHQ1O9VY@UOb-f6+?(`xjj$US3@l0OpZiufF)T(eLdEu$Ov) z3exJ@@85M3Z<-xfTCupSJ_Uh!9VI0tq*9ZC*`OI6A0J=0!Rl$d``)RV@bBVcYA;{k zO@LxfPEY$B-GPQc8jSL%8mzxKIF74wZ;8SeY!R=Vz!eNu3iI;y@i7O#hbKINb^>m` zs;dDeG59!J&|^RJLl+D+;f08VpPw+O;Uj1i(=5E61_lQH`Ss1faQJWk;`FT@J|9|a zan8GJRml^5?&|6ahJsvOcQAX9O(;(P?Z*!bTsC7;U|bJ-|K6#6fzHzH#|V}Z;CAV6 zK%W!+ivC-xE8GUw4;TVdXJ@warx+L!QBm@h*YZa`9{aPs&fT}+U``wDPt5BOY1SXU z4xjUogC{uBi!oeE^!I@Ey=4O551b zOGrozbb(Z(K42c>aNAb;ulk+=*Z;dqx}4NdID!>7?iQ(d>o(dX@t5k>nYX&EBRDuX zz}b+TTJdT+Bq}c3>0#vqznrp;0#1L%wf5e7lwh$?FF5dFEJrY<(n7BI*5 ze=fI}ljtGte9pm1+hps$p`3rt@A8sfO`WtDeWXwkqh5HAN?H4NvF0 z=9Ws4IO0tAS2ih~lt4|8P*RJPd=0w=;t^`uI_`lBkUsj>dBT(^cfL1bglSVoY~Xso z{VS?DU2{{fX;^tNX7b2(QkhEN>osQmmMT>Yr{vY=k? ziK-U0Rwd_wQBq zEq_AUwLowurG>`W2WWDN`e&-7#0>fx#N?7d^G)nT`kIBAnXrl|QD!A{Fr17m9@H)C`DA5nm`aqz)q1Ewf^fiaxj<09W?+xux2q9DT# zh3151MitLC-V4bYkPYEOMGv{o(qB~EH_#gD5{v*g=0e%a96BrAiL2w z5CugSgxXsL@@8Yym;a$vy{yh6=_=PU)Ghj}jLkk^5Uxk9*h|Thww*-R^M|{XCQ5L> z-GVL8++?4M8c9yMxRH!ON?%qv26s38ylfU^z!`pH)~C=oc#Qt;LN zxY>cDQ=||@)8k`91D8xZX%zgJ0C$@Cq!JKOrkWiMII^J7;%Zz+2L}k)wxwibHu3`R zu$F&)>nKa}MURW^Phk4IF`c7RTgNNOVQr8hH`cCCgT~t9K(EZCh?5lA!*6;zwCr_G z`M~*Y--*%k>F!ET3>hw1A~%=h<3}I?4>OH~L2Mtb)9Zw?5o;-}GA-uKJnq@o~!GKG!_)74MSYqO6aM(s$X=Kr!0BxL#pPw+B&l#Ue zLLO_{Gz*A?(Mg5eYuh0G_{tp5YUtR~+GWQUlM(8{q-l8yCQ*h$HyC5{*9hqsA7lezO90uL(pr53jXh|>6Y&Gn3OL2>XJ0o1(SiDH5!aEJ>sSgj3VqV|l9-Zks)J9@%5|E}W z7nvXl+=yx*cg(ySF;Hm$jIP!-x@%;F(X4flKP~$qzI~kjq znYqgb#Uq?hvy(}jUN{6>5Yo7;8u|FV^9&;;rKN z{CVRppAmD)sZjel0ryWXtacyNq?;G3eWH89%Ecb%P9;3sden+nuba5~2Ri})0nLR* z3~nT5FF$%3ddZ14?#fis$QjNvJrLTgr`yP_lZ@-BudnIWTkojDvoGMI?HDqSJWqan z<~T$K?V-Cz zqv)mo2x0)Q;}Z3@*tBL6C=8>D6|4|_N8A)IXiI9Z`_Q1w1pk$OUlag{8p6_3lfsoR0JD>m0>Pos1Ck5kGDBYOCMjSF;64@M(%fB} zdP{KGr9tDQZkf@k9*gRsDxlZaZ>C_q2Ph>QNf zj#qcOY%al2;MX&qhm8Z4SpMgMCQfR2@uYAix5AaAA{uC@+1!sZQc@qX8hS?_3295< zvH5b8D|+I7!F5w4-a}-uj*5gylY?Jy+S|`sQ`` zBJF4ELjtfNXJ)^q*rG_IMb+JcYmI&xSO*A>1F-NF5Ja``W``@8VLl7`inqw31s&z%i(I`KzSXvR>@&Im+CsUfWfJk`Xe0TDJ}PzeAkHjA{@6bma?_Ay*)Z;LC-dt#**K9 z{HcS`FD5-3SZzZS=I33Oni`0tLe`TeCrIHnRN$T(d)WU2`I;l4@yBP$W5W-{0GwOL zt0%zejno!IHJ+H&R4#BJ$!+Uz6ZRGE?WlyL9K!XGvrCrTE|mT`GZ;Rrl{c$>}W+H5iEYu2K{BBR=itD zTu*#`eWCPf2p31I1P8gI{?VWdF9M|tAc-R&<+gYms!U%t7q{qKJnFDirmD36&>tT$ zGALQo*(a6PotMq=9dDF$Yt~H-#&$Ic4AC;l%H&L9`YI^dmCL7~L#nzDgsU2TBI1|8CMH4%C1k!sw;R9k ze^{*lq4-b`-5aw8i8XwUFw<4@`}?h};M249X~WsZi5W0C0S22&7WELu>%hDq>z2|+kc@zSZC+w#^)r$Qc>(o`&gNs2 z1`4p;p|Bm9^a4qK@I=))NBM&I&&Sc-%Xj9sw((r)M^W2%7f%m z_=F(AtUj`?>zRakvYVgZ+Hc>!7M22M8%k(iEIdw74}UpU$;_Y{s>{n=hxvKUpsaah?rh@qmFJatskuwP_1+oI1WE^Mcy zu|Sr+c)ih%s}*b{I0ZQk&2sK`NT!vGPA5|53Dd%2I#b57O|ZDMt)Yq(|UcMofyOFV}wB zh0TfaN-xO!LfSPsIHI|PY;0{&s@Q26(F-23g|7H6*ikf34QrKtVe3d82RV%p*1v|g z#_|9$&JG!wVQYft73PVgM32KNQ0^8QWP<5C627rdd2L;CNGXgk&K4IELo%RSK$8mX z;D3#JyqO^O+8s$|)1{ef@WlK1@$wMUqUSz^g14acS1odX((H@uw6crz^ab(~o6_eA zzgvvgTEz44%adlvI?M`B#*#)2_3psKJ}RIzSDG}I0$#_a+G*a8lr1oxC4{xr83*T; zW#pkd>4+C=@EMyO9+jCH4WOT&&xcJfC&iS!_-yDOVt#H#xKbmi)Lm`3cG?q;!Za*V z!mQvC~3|-tpe%N|)$>Jo6D)rI^J*2M?6N@NfH-jI@X{c!7xbKn*x-PT(Y;6_E z5OM;=7Ju~U8z_=2EipW+u2^MuT+OWHI-s`YU=WaR)xdd%SnSv+LcxGl$8i!Fr}|RK zof$OX#g0+z+?qWrQe@gz;q>b^6f|5=Hru!AtVn_N{8#rM{jTa=yyd8vw^)Nf9G9z& zr%>Gu;LojUI-aZ&^wRHHVSsc4;>2o6SvREIkLW#LN!X@7R`3CEF|4~7T3ZA~ zHfj{`u*ykWd$hLEK+hnOdivUgzcoHKHYuQ}cvW}3ZFpu7HTC1+R7F>Zj6gdr-6a4C z0vNBJAT%F1ZAwDgmB@8dk)3{Oyf6jzxHClK9-Xhid2Th)z=%6ie6x4so!W^|KUKV zZYJUB^7P;h732~&YMh%K|CT zbh-kUl0zPy2=bptS2O;H1mRqKChH)Sdc`0AQFp%F`o5m22Q?^v_GQMifN*4 zCsb%Avi0XF$uv!A@0ghbsp%vL@1|Gv^+)BB&u3<)!g-T1Sr|6+CvB$Mj~U4khQfW0 zlNqT7Nk6GA)yQ=T`B;P6rJ7koFVv0KsQ>c}Mj{ArCa@-1#N~*1Ux(tS(D2)e2zIQo z6_otxTM)m}_aA88L8hGn&mT#KJ%cr|Mx^n??2L*)Vr5bDZ!b??foK6_03Zo1vC!Nu~d5oG%~<0f>Lvdg|O>(F+8an2G8|I`jjbukEfc~CBEEFGi6fG*kJw~c={jp_V#A*IueIJd(MardLKUw z6=`&}!g8AUyskl2wscLGg~LdsV&;lA4?w|;c>r16=6k1iS}JuI>%QpO0|`p=HH~({ zO8mODkT0^#6UwH0uR^ZHBNTJohmKCh8lr+9P-;+ z#+8_8qQ9h7z@&_(D+=Da?maiLd}`E#htYJNRt9b zVkuGK8N)^PR)yn>-T6gD5y}m)B8P8mYidn(G8U4m1;}vv-xv1KA!G99ZLGWHZ2$Cn z+$Dug^43UsI^cQwR#r&!{LeEX(X(F`z*oV+9uD1(e=dY-(PdTr@yW$T);hB1JsA$9 zeuIwwmj*Jh9AO=dMAaX)ef0W$$xEsL11ydFGdHOz5{nYuI#->}&Okg4tO9mm7zfm; z*%ky{E9(rmi@rlyX|Lt!xi6#Nn=z+)?$PLKwO+i2d6T|bXS)VWPEZ+4^aE`TJ)~g$ zm=m|f5$=#Q614n9;QgY)q`Rw@5o9?Sk)Ptdz(QoQpCAl3`R5q=#-yh#KxjZJ9F!zR zt+l>*?Kgi2J|F2PnPpH5d{WZ~PryMNl;dwpCpbZ{G+y}_+aIVrxPxfDQMH$)*T!IO z6?xDl&Kv}qc{MI?@BkM=bl1ycvvnuM_*EI4YJ+BnD3Al255$;OfY&~;mPUOIpe6Hr zJSOc(6Xjy>32bxD?x^frK#jivRcyF4CMHk3yEyEvNm-$~k0Zyh4!6;u?G zRgywKjt`Lw@5W_Ben0In8EgjC$@-sdB=)-c{`0GQoP$n#-t_7*V`44QyN3lfYW;CY ziQu-dW925Kbc8yq$ATC*EVpM-AfpcDh@Cqtk@W&D;-4o4)eg4n`!!g_Wa;G;JNCYgz z>OZlS`T>)Cb25A&16L{-m&2E2mVB$;W^=kLH~o!%_5yq9f9={W;UI-V`^^x$iVmDO`kZ&e(&fQ zCPlD#tIz$@CHIPGiW)B`PPh*Fq@Zi4F@Oz4J$Cj`Av%d!4wen$s>q9DmQye1=1hZ9 z^Nc1hv#YnhW)}6(7#x4GT-t~|zCiZabnl!51i#{b{tRLiEM+$Z2FIi@N|&Pez1Fdq zm7h*FI9WnjevSTB={WbqHKaAcAgmXpL_!fgM=H1{Y8qQw2(;>Y2elE%)#1&}MXf>_c#1L^V{%m}_7YBle6Gb%Nv&Rk!B;=Bfm(;%fy5#j92NbNjl%? zzQ@I|?cy=d7=NJ}o=!a12>9wVJA5wC0JH21F|4;hf!meASdHq`i5 z0HbwK(z5gM2Gv2$ae}BFjYeU!S8Mn-uhlux&(uRzNKoVylm-rho~#67p}#^j@@m&D zaB#K9vRN1}dBXJaA3DFKd~iI&D1?0(Sl~BKx5oP@dco&CX!8|B&7df1d`~Y;Pu!r! z5Vg=#m%0Qa-)-*{X7RDNFm?t@B=yn{-(@1pk1Ucze`63}?bzx$B*aTP7#8XhFqO21 zQtxH(S5PKKUJg*#VMr%|$w<=s9L|k-&1uilA%<~SG6HYXJPEx!WZ=^S&$J=Rw8Ew^ z3R0S|iLv;<$0BL{c%ExhO4Zft^#X2f5D5hz)4bec* z%k&|3b@%>D-P%z*%29D~aTTCfM5W=Db$55$6qf8!&NjjakLybGn~iG z6qe>Of8zah~eca++9qsOF%%dE|&Iptn_<|g0DtBg)uI?L?DGbD57YL3v3lh zW{I3VbT!Vp|9 - - - Climate Prediction Center - how to make small fast grib2 databases - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2:how-to-make-fast-small-grib2-files -
     
    - -

    How to make small fast grib2 databases

    -
    - - -

    Introduction

    - -

    -The old joke is that an engineer tells his client that he -can design a gizmo that is fast, cheap and reliable, and -the client gets to choose two. The same principle applies -to many projects including making a grib-2 database. Here, -the desired qualities are small file size, speed for the users -and effort required to set up the database. For small databases, -you probably want to minimize the set-up effort. For larger -databases, all three factors come into play. Here are some -hints for minimizing size/speed-of-use. They all require some -set-up effort. - -

    Making a smaller database

    - -
      -
    1. -Have unneeded fields?
      -Use wgrib2 to remove records
      -
    2. Smaller grids take less space
      -Use wgrib2 or some other program to make regional subsets
      -
    3. Data stored at higher than needed precision?
      -Use wgrib2 to reduce the precision
      -
    4. Better compression available?
      -Use wgrib2 or cnvgrib
      -
    5. use submessages
      -Use wgrib2 -
    - -

    Faster to read

    - -
      -
    1. Jpeg2000 compression is makes small files but very slow to read.
      -I am finding that complex packing with spatial differencing is a
      -good trade off between speed and size. If the field has undefined values
      -then complex packing is smaller than Jpeg2000 and faster to read.
      -
    2. Decode routines that have been parallelized are faster. Wgrib2 has
      -parallel packing and complex packing without bitmaps routines.
      -
    3. Smaller grids are faster
      -
    4. Reorder the records to maximize sequential access
      -Use sort and wgrib2. This is important for optical media.
      -
    5. Use an index/inventory.
      -
    6. Too many submessages can use up available memory. -
    - - -

    Minimizing Effort in Setting up the Database

    - -
      -
    1. Save grib data as provided
      -
    2. Writing grib encoding software?
      - IEEE Grib-2 is the easiest format to write. It's produces - big files and is not compatible with some grib-2 decoders. -
      - You can use wgrib2 to convert from ieee grib2 to a more common packing. -
    - -

    Effects of Compression on Sample Files

    -
    -
    -45x91 grid, 5 fields
    -
    -         simple complex1 complex2 complex3    jpeg
    -size      21884    16030    13623    13917   11514  bytes
    -read      0.001    0.001    0.001    0.001   0.012  seconds user time
    -write     0.002    0.006    0.006    0.006   0.017  seconds user time
    -
    -note: write time includes a "simple" read operation
    -note: the creating of the complex packing is heuristic
    -and different algorithms will produce different results.
    -
    -4320x2160 high resolution SST field
    -
    -         simple complex1 complex2 complex3    jpeg
    -size      11054    4076      2365     2280    3252  K bytes
    -read       0.38    0.41      0.42     0.42    2.66  seconds user time
    -write      0.78    2.06      1.76     1.68    4.20  seconds user time
    -
    -note: write time includes a "simple" read operation
    -note: the creating of the complex packing is heuristic
    -and different algorithms will produce different results.
    -
    -The commands to change the packing:
    -
    -wgrib2 in.grb -set_grib_type X -grib_out out.grb
    -X=simple, complex1, complex2, complex3, jpeg
    -
    -
    - - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Aug 7, 2009 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/small_grib.html b/web_docs/small_grib.html deleted file mode 100644 index b5456b2..0000000 --- a/web_docs/small_grib.html +++ /dev/null @@ -1,242 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -small_grib - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-small_grib -
     
    - -

    wgrib2: -small_grib

    -
    - - -

    Introduction

    - -

    -The -small_grib option writes the grid values -to a grib2 file with the same grid spacing but a smaller domain. -The grid point locations are unchanged. This option is used -to make a regional subset and only works for certain grids -such as the lat-lon, rotated lat-lon, Mercator, Lambert conformal, and polar stereographic. - - -

    -When -small_grib option has problems, the grid is not subsetted -and the original grid is written. Some reasons for problems are -

      -
    1. Unsupported grid type -
    2. Thinned grid -
    3. The bounding box is outside of the grid domain -
    4. The bounding box is too small and does not include a grid point -
    5. The bounding box definition is not right (ex. LatN < LatS) -
    - -

    -The -ijsmall_grib option is similar to the --small_grib option except it uses the grid coordinates. The former is -faster as it doesn't have to compute the latitudes and longitudes of the grid points and find -a bounding box. - -

    -There are other ways of making a grib file which only includes the data for a -subregion. You can set the points outside of your region of interest to UNDEFINED -using the -undefine or -ijundefine options. -Once the grid points are set to UNDEFINED, many of the packing methods will reduce the -size of the new grib file. (Complex packing without bitmaps is very good.) One can also interpolate -the field to a new grid using the -new_grid option. - -

    Limitations

    -
      -
    1. rotated lat-lon grids: must use WMO grid template and not the NCEP locally defined template -
    2. rotated lat-lon grids: lat and lon values must be in the rotated coordinates -
    3. staggered grids are not supported -
    -

    Usage

    -

    - -

    --small_grib LonW:LonE LatS:LatN file_name
    -
    - -For west longitudes and south latitudes, you can use negative values. -The file_name is the output file. LonE must have a numerical -value greater than LonW. For example for left boundary=20W and -the right boundary=60E, you can use LonE=340 and LonW=420. -You can also use LonE=-20 and LonW=60. - -

    Example

    -

    - -

    -$ wgrib2 fcst.grb2 -small_grib 10:20 -20:20 small.grb
    -1:0:d=2007032600:HGT:1000 mb:anl:
    -
    -$ wgrib2 small.grb -grid
    -1:0:grid_template=0:
    -        lat-lon grid:(21 x 81) units 1e-06 input WE:SN output WE:SN res 48
    -        lat -20.000000 to 20.000000 by 0.500000
    -        lon 10.000000 to 20.000000 by 0.500000 #points=1701
    -
    - -The first line writes a small grib file from 10E-20E and 20S-20N. Often -you want to preserve the grib compression. In this case, you would -add the option -set_grib_type same to the wgrib2 -command line. - - -

    -See also: --ijsmall_grib --ijundefine, --new_grid --set_grib_type --undefine, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page modified: July 11, 2017, Aug 18, 2018, Feb 2024 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/spatial_proc.html b/web_docs/spatial_proc.html deleted file mode 100644 index 8ca4b23..0000000 --- a/web_docs/spatial_proc.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -spatial_proc - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-spatial_proc -
     
    - -

    wgrib2: -spatial_proc

    -
    - - -

    Introduction

    - -

    -Product Definition Template 4.15 is used to describe spatial processing -of a forecast or analysis. For example, you interpolate a model -grid to an output grid. For some fields you may use nearest neighbor -interpolation and for other fields you may use bilinear interpolation. -The North American Regional Reanalysis used both types of interpolation -for surface and near surface fields. Another use of PDT 15 is in -aviation. You might want the maximum clear air turbulence when -the interpolate from a fine grid to a coarse grid. - - - -

    -The option, -spatial_proc, prints the -spatial properties that are encoded in PDT 4.15. This output is -part of the of the standard inventory, -s. -

    - -

    Usage

    - -

    -

    --spatial_proc
    -
    - -

    Example

    -
    -$ wgrib2 file1 -spatial_proc
    -1:0:d=2015101200:CAT:200 mb:12 hour fcst:spatial max:missing interpolation
    -
    -$ wgrib2 file2 -spatial_proc
    -1:0:d=2015101200:PRMSL:mean sea level:anl:spatial none:bilinear interpolation
    -
    - - -See also: - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 18, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/special_file_names.html b/web_docs/special_file_names.html deleted file mode 100644 index 7791c08..0000000 --- a/web_docs/special_file_names.html +++ /dev/null @@ -1,305 +0,0 @@ - - - - Climate Prediction Center - wgrib2: special files - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 special files -
     
    - -

    wgrib2: special files

    -
    - - -

    Introduction: Special Files

    - -

    Wgrib2 has some special files. They are - -

      -
    1. - (negative sign) -
    2. @tmp:STRING where STRING is a alphanumeric string -
    3. @mem:N N=0..19 -
    4. Unix/Linux: /dev/null -
    - -

    1. - (negative sign)

    - -This special file name is often used by unix/linux utilities to denote either -stdin or stdout. The context will determine whether stdin or stdout is used. -This special file name is often used to pipe data between processes. - -
    -Example:  wgrib2 IN.grb -set_grid_winds earth -set_grid ncep grid 3  - | \
    -            wgrib2 - -ncep_uv OUT.grb
    -
    -          The first wgrib2 regrids the file to ncep grid #3 and uses -
    -            to send the output to stdout.
    -          The second wgrib2 combines U and V into the same grib message.
    -            In this case, the - indicates that the input file is stdin.
    -          This form is fast because both processes run in parallel and
    -          there is no temporary disk file.
    - 
    - -

    2. @tmp:STRING (temporary files)

    - -This special file name is used for creating temporary files which will disappear -after the process is finished. Multiple wgrib2 processes can use the same -@tmp:STRING file without conflict. These files are only useful with callable wgrib2. - -
    -Example:
    -!  make a temporary inventory file
    -  i = wgrib2('ds.td.bin', '-inv', '@tmp:abc.inv')
    -! inquire how many grid point the "150 hour fcst" has
    -  i = grb2_inq('ds.td.bin', '@tmp:abc.inv', ':150 hour fcst:',npts=j)
    -  write(*,*) 'error code=',i,' number of grid points=',j
    -
    - -

    3. @mem:N (memory files) (alpha)

    - -

    @mem:N where N=0..9 are memory files which are stored in -computer's random-access memory. Memory files are fast but -are limited by the size of the computer's memory. -Memory files can be used -almost everywhere that files can be used (see below for exceptions). -Memory files are transient; whenever the wgrib2 ends, the memory files -are lost. Memory files can be read/written to disk files prior/after -processing by using the options -mem_init and -mem_final. -For callable wgrib2, the memory files are lost when the calling program finishes. - - -

    Memory files were implimented so that callable wgrib2 could be -used for HPC. For example, decoding can be done by calling a routine puts a -grib message into a memory file. The wgrib2 subroutine can then -process the memory file and writes the decoded field to either a -memory file or a RPN register. -Finally the program can call another routine -that reads the memory file or RPN register. - -

    Memory files are often used by CW2 to store grib inventories. -They are also used internally by grep Fortran API (memory file 19). - -

    -Memory files can be used to speed up processing. Suppose you -are going to re-order a grib file. Without memory files, you -would create an inventory (sequential read), sort the inventory, -and do a random-access read and a sequential write. With memory -files, you could copy the grib file into memory and then -avoid the slow random-access read. - -

    -wgrib2 IN.grb | sort -t: -k3.3 -k4,4 -k5,5 | \
    -   wgrib2 -i IN.grb -grib sorted.grb
    -
    -wgrib2 IN.grb | sort -t: -k3.3 -k4,4 -k5,5 | \
    -   wgrib2 -i -mem_init 0 IN.grb @mem:0 -grib sorted.grb
    -
    - - -

    4. /dev/null

    - -Don't ask your Linux system admin to recover data sent to /dev/null. - -

    Options that don't support memory files

    - -
      -
    1. -AAIG -
    2. -csv -
    3. -err_bin -
    4. -err_bin -
    5. -grib_ieee -
    6. -grid_out -
    7. -ijbox -
    8. -import_text -
    9. -spread -
    10. -text -
    - -

    Generic Behavior:

    - -

    When a file is opened by wgrib2, both the file handle and file name -are saved. This allows wgrib2 supports multiple opens to the same file. For example, - -

    -  wgrib2 IN.grb -if ":HGT:" -grib OUT.grb \
    -                -if ":TMP:" -grib OUT.grb \
    -                -if ":UGRD:" -grib OUT.grb \
    -                -if ":VGRD:" -grib OUT.grb
    -
    - -writes the HGT, TMP, UGRD and VGRD to OUT.grb as you would expect. Technically -the 4 -grib options use the same file handle. Now if you change the above command -so that the last -grib writes to ./OUT.grb instead of OUT.grb. - -
    -  wgrib2 IN.grb -if ":HGT:" -grib OUT.grb \
    -                -if ":TMP:" -grib OUT.grb \
    -                -if ":UGRD:" -grib OUT.grb \
    -                -if ":VGRD:" -grib ./OUT.grb
    -
    -You and I know that all 4 -grib options refer to the same file. However, wgrib2 -only does a string check and uses two file handles to refer to the same file. -Confusion occurs and the resultant OUT.grb will be corrupted. Therefore, -you must use consistent naming when referring to the same file. - -

    Persistance:

    - -By default, wgrib2 saves the file name and file handle for opened files. -This can be handy with callable wgrib2. You can save the time required -for multiple opens of the same file. However, this persistence of the -file name and file handle can require some care. Operating systems -can have a limit on the number of open files, so you may have to close files that -are no longer needed. For some operations, you may want to -rewind a file. - - -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Aug 2, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/speed.html b/web_docs/speed.html deleted file mode 100644 index 0f65bd7..0000000 --- a/web_docs/speed.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - Climate Prediction Center - wgrib2: SPEED - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: SPEED -
     
    - -

    wgrib2: SPEED

    -
    - -

    Introduction

    - -

    -Here are some techniques to make wgrib2 faster. - - -

    Stop using JPEG2000 and PNG compression

    - -

    -Complex packing (c1, c2 and c3) are much faster. For fields with undefined -grid points, complex packing produces smaller files. For global fields, the -optimum complex packing is typically 20% larger than jpeg2000 compression. -Converting is easy, - -

    -    wgrib2 IN.grb -set_grib_type c2 -grib_out OUT.grb
    -      on a 4 core CPU, this is very fast
    -    wgrib2ms 4 IN.grb -set_grib_type c2 -grib_out OUT.grb
    -
    - - -

    When you make complex packed files, do not uses a bitmap to store -undefined values, use the special-value method. If you use special -value method, the resulting files will be smaller and the decoder -is very parallelized. Using bitmaps with complex packed files -will result in larger files that are slightly slower to decode. -Wgrib2 can make both flavors of complex-packed files. The comments -about parallelization apply to the wgrib2-internal decoders. - -

    The best complex packing (c1, c2, c3) depends on the field. -C3 is best for smooth fields and c1 is best for more noisy fields -like precipitation. Once in a while, c2 produces the smallest fields. -Multitasking scripts that convert the grib file int c1, c2 and c3 packing -and then choses the smallest grib message. - -

    -AEC compression is much faster than jpeg2000 and png compression. Before -you use AEC, make sure that any of your essential grib software supports -this brand new compression (9/2016). Converting is easy, -

    -    wgrib2 IN.grb -set_grib_type aec -grib_out OUT.grb
    -
    - - -

    Minimize the decoding

    -

    -Decoding the grid point values is an expensive operation especially for jpeb2000 compressed files. -It is useful to count the number of decodes, - -

    -Decodes all records:   wgrib2 IN.grb -if "HGT:200 mb:" -csv csv.txt
    -Decodes one record:    wgrib2 IN.grb -match "HGT:200 mb:" -csv csv.txt
    -
    -Decodes 3M records:    wgrib2 IN.grb -lon 0 10 >lon1.txt
    -                       wgrib2 IN.grb -lon 0 20 >lon2.txt
    -                       wgrib2 IN.grb -lon 0 30 >lon2.txt
    -Decodes  M records:    wgrib2 IN.grb -lon 0 10 -lon 0 20 -lon 0 20  >lons.txt
    -
    -note: the number of locations is limited by the number of command line 
    -arguments (5000 v1.9.8).  Other limitations include the number of
    -allowed regular expressions (1000 v1.9.8) and any system limitations
    -on the length of the command line.  (Cygwin 32K, XP=8K linux=varies 
    -but 2.5MB on RHEL 6)
    -
    - -

    Don't use the wgrib2 | egrep | wgrib2 -i syntax

    -

    -The "wgrib2 | egrep | wgrib2" syntax can be optimized. - -

    -M sequential reads + N random-access reads, N writes
    -     wgrib2 file | grep ":TMP:" | wgrib2 -i file -grib tmp.grb
    -
    -M sequential reads, N writes  
    -     wgrib2 file -match ":TMP:" -grib tmp.grb
    -
    - -

    Making an inventory/index file

    - -If you process the same grib files many times, an inventory/index file is faster. -
    -3M reads, N writes
    -     wgrib2 file -match ":TMP:" -grib tmp.grb
    -     wgrib2 file -match ":HGT:" -grib hgt.grb
    -     wgrib2 file -match ":(UGRD|VGRD):" -grib winds.grb
    -
    -M+N reads, N writes + i/o for file.inv
    -     wgrib2 file >file.inv
    -     grep <file.inv ":TMP:" | wgrib2 -i file -grib tmp.grb
    -     grep <file.inv ":HGT:" | wgrib2 -i file -grib hgt.grb
    -     grep <file.inv ":(UGRD|VGRD):" | wgrib2 -i file -grib winds.grb
    -
    -
    -

    Do alot on one line

    - -The above example can be made faster by doing it all on one command line. - -
    -M reads, N writes
    -     wgrib2 file \
    -         -if ":TMP:" -grib tmp.grb \
    -         -if ":HGT:" -grib hgt.grb \
    -         -if ":(UGRD|VGRD):" -grib winds.grb
    -
    - -

    Use -bin instead of -ieee

    - -

    --bin writes/reads the grid values using the native floating point format.
    --ieee writes/reads the grid values using the ieee format (big-endian is default).
    --ieee uses software to convert from the native format to ieee even when the native -format is ieee. - -

    Fast Averaging

    -

    -If you are averaging, use -fast averaging - -

    Compile wgrib2 with OpenMP Enabled

    -

    -More cores are better for large grids. For large grids, use complex packing -without bitmaps. The decoder is parallelized for this case and runs 3x faster -for 3 km global grids on a 6-core machine. - -

    Run wgrib2 without OpenMP Enabled for Small Grids

    -

    -For small grids, OpenMP can slow the program. You can compile -with OpenMP turned off or with "OMP_NUM_THREADS" set to one. - - -

    Use multple cores

    -

    -See here -and over there - - -

    Use pipes instead of temporary files

    - -

    -Wgrib2 can read and write through pipes. This is both a programming convenience -as well as faster. - -

    -cat gfs*201201*grb2 | wgrib2 - -match ":HGT:500 mb:" -grib Z500.grb
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Aug 22, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/spread.html b/web_docs/spread.html deleted file mode 100644 index 019c10b..0000000 --- a/web_docs/spread.html +++ /dev/null @@ -1,232 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -spread - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-spread -
     
    - -

    wgrib2: -spread

    -
    - - -

    Introduction

    - -

    -The -spread option writes the grid values to a specified -file as a comma separated values (text) which can be imported into a spread sheet. -

    -   lon,lat,(VARIABLE DESCRIPTION)
    -   lon-1,lat-1,val-1
    -   lon-2,lat-2,val-2
    -   ...
    -   lon-N,lat-N,val-N
    -
    - -The latitudes and longitudes are only available for supported grids -and only the default WE:SN order is supported. The undefined value is 9.999e20. - -

    -Use the -undefine option to limit the output to -specified regions. - -

    -

    Usage

    -
    --spread output_file_name
    -
    -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -s | grep ":RH:2 m" | wgrib2 -i test.grb2 -spread data.txt
    -285:36796469:d=2005090200:RH:2 m above ground:60 hour fcst
    -
    - -The above line extracts the 2 meter RH from file test.grb2 and writes it in data.txt. - -

    Warning #1

    - -

    -The options -csv, --csv_long, --spread and --text do not support memory files. -You can blame sloth or lack of need. I like to think that -text files with grid point values are are insanely large -and shouldn't be saved in memory. - - -

    Warning #2

    - -

    It may be tempting to take a grib file, convert it into a CSV file -and then deal with the CSV file. After all, everybody can read -a CSV file. Sure there is a litte overhead of reading a CSV file -but who cares. Suppose you want to read some GFS forecasts files -(20 forecast times, 5 days every 6 hours) at 0.25 x 0.25 degree global resolution. -Your CSV file is going to be about 720 GBs. Suppose that our hard -drive can write/read at 70 MB/s. Then we are talking about 3 hours to -write the CSV file and 3 hours to read the CSV file not including CPU time -which will slow down the process. Converting grib into CSV is a -viable strategy if the conversion is limited. You need to restrict -the number of fields converted and should consider only converting -a regional domain. Note, I wrote "viable" and not optimal. - - -

    -See also: --csv, --netcdf, --text, --bin, --ieee, --undefine -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/start_FT.html b/web_docs/start_FT.html deleted file mode 100644 index 3ea3ded..0000000 --- a/web_docs/start_FT.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -start_ft, start_FT, -end_ft, -end_FT - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -start_ft, -start_FT, -end_ft, -end_FT -
     
    - -

    wgrib2: -start_ft, -start_FT, -end_ft, -end_FT

    -
    - - -

    Introduction

    - -

    -Suppose you make a forecast starting from initial conditions of 00Z January 1 for the average -conditions from the month of February. In this forecast, there are three time stamps. - -

    -   Name                        date           YYYYMMDDHH option  (HH)Z(DD)(MON)YYYY option      with minutes and seconds
    -
    -   reference time              00Z Jan 1     -t                  -v2 -t                         -T
    -   start of forecast period    00Z Feb 1     -start_ft           -v2 -start_ft                  -start_FT
    -   end of forecast period      00Z Mar 1     -end_ft             -v2 -end_ft                    -end_FT
    -
    - -For common ftimes, - -
    -
    -analysis:                      reference time == start_ft == end_ft
    -6 hour forecast:               reference time + 6 == start_ft == end_ft
    -30 year monthly climatology:   reference time = start_ft = start of 1st month used to make climatology
    -                               end_ft = end of the last month used to make the climatology
    -

    Usage

    -
    --start_ft
    --end_ft
    --start_FT
    --end_FT
    -
    - -

    Example

    -

    - -

    -$ wgrib2 a.grb -start_ft
    -1:0:start_FT=20111101000000
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/start_ft.html b/web_docs/start_ft.html deleted file mode 100644 index 3ea3ded..0000000 --- a/web_docs/start_ft.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -start_ft, start_FT, -end_ft, -end_FT - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -start_ft, -start_FT, -end_ft, -end_FT -
     
    - -

    wgrib2: -start_ft, -start_FT, -end_ft, -end_FT

    -
    - - -

    Introduction

    - -

    -Suppose you make a forecast starting from initial conditions of 00Z January 1 for the average -conditions from the month of February. In this forecast, there are three time stamps. - -

    -   Name                        date           YYYYMMDDHH option  (HH)Z(DD)(MON)YYYY option      with minutes and seconds
    -
    -   reference time              00Z Jan 1     -t                  -v2 -t                         -T
    -   start of forecast period    00Z Feb 1     -start_ft           -v2 -start_ft                  -start_FT
    -   end of forecast period      00Z Mar 1     -end_ft             -v2 -end_ft                    -end_FT
    -
    - -For common ftimes, - -
    -
    -analysis:                      reference time == start_ft == end_ft
    -6 hour forecast:               reference time + 6 == start_ft == end_ft
    -30 year monthly climatology:   reference time = start_ft = start of 1st month used to make climatology
    -                               end_ft = end of the last month used to make the climatology
    -

    Usage

    -
    --start_ft
    --end_ft
    --start_FT
    --end_FT
    -
    - -

    Example

    -

    - -

    -$ wgrib2 a.grb -start_ft
    -1:0:start_FT=20111101000000
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/stats.html b/web_docs/stats.html deleted file mode 100644 index 96c065d..0000000 --- a/web_docs/stats.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -stats, max, min - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-stats, -mmax, -min -
     
    - -

    wgrib2: -stats, -max, -min

    -
    - - -

    Introduction

    - -

    -The -stats option writes a statistical summary -of the field into the inventory. -The -max option writes the maximum value and -the -min option writes the minimum. -These option are useful for quickly determining if the field has reasonable numbers. - -

    Usage

    -

    - -

    --stats
    --max
    --min
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -stats
    -1:0:ndata=65160:undef=0:mean=83.8696:min=-428.1:max=317.8
    -
    -ndata = number of grid points
    -undef = number of grid points with an undefined value
    -mean = grid point average (not area weighted)
    -min = minimum value
    -max = maximum value
    -
    -$ wgrib2 test.grb2 -max
    -1:0:max=317.8
    -
    -$ wgrib2 test.grb2 -min
    -1:0:min=-428.1
    -
    -
    - -The -stats option can be combined with -the -undefine option to produce -statistics for a box.
    - -
    -$ wgrib2 test.grb2 -stats
    -1:4:ndata=10512:undef=0:mean=77.5081:min=-370:max=340.2:cos_wt_mean=97.267
    -
    -produces the global statistics. By setting grid points to undefined, -we can produce the statistics for a box.
    -
    -$ wgrib2 test.grb2 -undefine outobx 0:90 -10:10 -stats
    -1:4:ndata=10512:undef=10179:mean=79.8829:min=41:max=144:cos_wt_mean=79.8688
    -
    - -Note, if we reverse the order of the --stats and --undefine options, we get the global mean. -That is because the -stats option is excuted -before the -undefine options. - - -$ wgrib2 test.grb2 -stats -undefine out-box 0:10 -10:10 -1:4:ndata=10512:undef=0:mean=77.5081:min=-370:max=340.2:cos_wt_mean=97.267 - - -

    If all the data are undefined, -the -stats option will produce values -of zero for the the mean, min and max. -The -min and -max -options will yield a text string of "undefined". - - -

    -See also: -undefine -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/status.html b/web_docs/status.html deleted file mode 100644 index 498cfe5..0000000 --- a/web_docs/status.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -status - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-status -
     
    - -

    wgrib2: -status

    -
    - - -

    Introduction

    - -

    -The -status option is for developers. -It allows the developer to query the status at various -points in the processing. - -

    - -

    Usage

    -
    --status file
    -        the status of the various opened files
    -
    - - -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: December 21, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/subcenter.html b/web_docs/subcenter.html deleted file mode 100644 index a27627d..0000000 --- a/web_docs/subcenter.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -subcenter - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -subcenter -
     
    - -

    wgrib2: -subcenter

    -
    - - -

    Introduction

    - -

    -The -subcenter option prints out the subcenter. -For example, within NCEP, the subcenters include NCO, EMC, HPC, MPC, CPC, etc. - -

    Usage

    -

    -

    --subcenter
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -subcenter
    -1:0:subcenter=NCEP Ensemble Products
    -2:46042:subcenter=NCEP Ensemble Products
    -3:63079:subcenter=NCEP Ensemble Products
    -4.1:86046:subcenter=NCEP Ensemble Products
    -...
    -
    - -See also: -center, - -set - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Aug 19, 2011 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/submessages.html b/web_docs/submessages.html deleted file mode 100644 index 023d818..0000000 --- a/web_docs/submessages.html +++ /dev/null @@ -1,233 +0,0 @@ - - - - Climate Prediction Center - wgrib2: submessages - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > - wgrib2 > wgrib2: submessages -
     
    - -

    Submessages vs Messages in wgrib2

    - - -

    -In grib-2 format was designed for transmission of meteorologial data. So -it breaks up the information into messages. If you have a message, you -have the complete information about the field or fields. In theory, -one could save a space by having hundred of fields in one message. -However, the space savings are minor vs the cost of needing much -free memory to decode the file. So modern convention is -to put one field per message (no submessages) unless you have -multiple field need to be grouped together. For example, U and V -can be placed in the same message because you need both to know -the winds at any level. The use of submessages has become less common -because the space saving (maybe 100 bytes per field) is minor when -the models started outputing high resolution grids. - - -

    How does wgrib2 handle submessages

    - -When you want an inventory of the file, you want to see all the -fields. If you want to extract the 500 hPa heights, you doesn't care whether it is -in a submessage. The only difference when using wgrib2 is that record number -may have decimal point and the submessage number if needed. -Most of the time, one can igore whether the data are in submessages. - -

    -In this wgrib2 inventory, the data are in one message with four submessages. -

    -1.1:0:d=2000070312:HGT:500 mb:24 hour fcst
    -1.2:0:d=2000070312:TMP:850 mb:24 hour fcst
    -1.3:0:d=2000070312:UGRD:850 mb:24 hour fcst
    -1.4:0:d=2000070312:VGRD:850 mb:24 hour fcst
    -
    - -

    -In this wgrib2 inventory, the data are in four messages. -

    -1:0:d=2000070312:HGT:500 mb:24 hour fcst
    -2:114221:d=2000070312:TMP:850 mb:24 hour fcst
    -3:195862:d=2000070312:UGRD:850 mb:24 hour fcst
    -4:277503:d=2000070312:VGRD:850 mb:24 hour fcst
    -
    - -

    -For either file, we can do - -

    -wgrib2 grib2_file -match ":HGT:500 mb:" -text z500.txt
    -or
    -wgrib2 grib2_file | grep ":HGT:500 mb:" | wgrib2 grib2_file -i -text z500.txt
    -
    - -

    -Wgrib2 "ignores" the submessage feature and makes the -the file look and handle like a file without submessages. -However, there are two options that allow you to preserve -the "submessage" character of the original grib file. The -option "-GRIB" writes out the entire grib message including -all submessages. The companion option "-submsg N", only -allows inventory processing of submessage N. (Usually N is set to one.) - -

    Message mode

    -

    -Wgrib2 has a few options that work with messages. -

    --GRIB [file]              .. write grib message that was just read to [file]
    --if_n I:J:K               .. if message number is in do-loop I:J:K
    --match "^[0-9]*\.1:"      .. only process first submessage
    --match "^[0-9]*(:|\.1:)"  .. only process grib messages or first submessage
    --ncep_uv                  .. combine ugrd, vgrd into one message
    --submsg_uv                .. combine vectors into one message
    --tosubmsg                 .. combine into one message
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - updated: May 15, 2005, 1/2023 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/submsg.html b/web_docs/submsg.html deleted file mode 100644 index 59a52a8..0000000 --- a/web_docs/submsg.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -submsg - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-submsg -
     
    - -

    wgrib2: -submsg

    -
    - - -

    Introduction

    - -

    -Usually wgrib2 ignores the distinction between messages and submessages; wgrib2 treats -sugmessages like messages except that the "message number" in the inventory is replaced -by a "message number.submessage number" in the inventory. If you want to work with -submessages, the following options are availble. - -

      -
    1. -GRIB FILE : copy a message to FILE -
    2. -ncep_uv FILE : combine U,V into a message like in NCEP operations -
    3. -tosubmsg FILE : create a file with submessages -
    4. -submsg N : process by submessage number -
    - - -

    -The -tosubmsg N option allows to process by submessage number. -If the N is zero, all the submessages are processed which pretty pointless -as this the default operation. If N is one, then all the messages are processed once. -(Messages with only one field are considered to have one submessage.) The following -will copy from IN.grb to OUT.grb and preserve the submessage structure. - -

    -$ wgrib2 IN.grb -submsg 1 -GRIB OUT.grb
    -
    - -This will copy all the 200 mb fields assuming U/V are in the same message and -keep U/V in the same message. - -
    -$ wgrib2 IN.grb -submsg 1 -if ":200 mb:" -GRIB 200mb.grb
    -
    - - -

    Usage

    -

    - -

    --submsg N
    -N is an integer, usually 1
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -submsg 1 -if ":200 mb:" -GRIB 200.grb2 -if ":100 mb:" -GRIB 100.grb2
    -
    - - -

    -See also: -ncep_uv, - -GRIB, - -tosubmsg -

    - - - - - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/submsg_uv.html b/web_docs/submsg_uv.html deleted file mode 100644 index b398fbe..0000000 --- a/web_docs/submsg_uv.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lon - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-submsg_uv -
     
    - -

    wgrib2: -submsg_uv

    -
    - - -

    Introduction

    - -

    -The option -submsg_uv is like the option --ncep_uv. The latter option puts UGRD and VGRD into -the same grib message. The former combines all the vector fields into -their own grib message. -The option -submsg_uv may be important for -parallel processing. For example, you want to regrid from a Gaussian -grid to a polar stereographic grid that covers the North Pole. -For scalar fields, the grid can be regridded independently which -allows a possibility of parallel processing. Vector fields have -to processed together (U and V). One approach is to put the -vector fields into their own grib message (combine the corresponding -U/V fields). Then all the grib messages can be regridded independently. - -

    -The vector fields are the same as used by the --new_grid option. The vector list can -be changed using the -new_grid_vectors option. - - - - -

    Usage

    -

    - -

    --submsg_uv output_file
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -match ":500 mb:" -submsg_uv output.grb
    -
    - -See also: --tosubmsg --submsg --submsg_uv --ncep_uv --new_grid_vectors -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Oct 3, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/sys.html b/web_docs/sys.html deleted file mode 100644 index c1a453a..0000000 --- a/web_docs/sys.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -sys - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-sys -
     
    - -

    wgrib2: -sys

    -
    - - -

    Introduction

    - -

    -The -sys option is only available when the UDF -(User Defined Function) extension is installed. -The -sys option runs a shell command. - - -

    Usage

    -

    - -

    --sys STRING
    -
    -STRING is a shell command
    -
    - -

    Comments

    -

    -The UDF options may not work in windows. - -

    -The use of the UDF options is limited and the UDF options should, IMHO, -not be enabled unless the UDF options are needed. - - -

    -See alse: -udf_arg, --udf, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/t.html b/web_docs/t.html deleted file mode 100644 index f39ee5a..0000000 --- a/web_docs/t.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -t -T -vt -VT - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -t -T -vt -VT -
     
    - -

    wgrib2: -t -T -vt -VT

    -
    - - -

    Introduction

    - -

    -The -t -T -vt -VT options prints various time flags. -The -t -T prints the reference time -and -vt -VT prints the verification time. -The capitalized versions print the time with the seconds -and the lower case options print the time with out the seconds. -In conjuntion with -v2 verbose mode, the -format of the time will change to be GrADS compatible. - -

    Usage

    -
    --t
    --T
    --vt
    --VT
    -
    - -

    Example

    -

    - -

    -$ wgrib2 g720_360.grb2 -t
    -1:4:d=2009010100
    -$ wgrib2 g720_360.grb2 -t -v2
    -1:4:00Z01jan2009
    -$ wgrib2 g720_360.grb2 -T
    -1:4:D=20090101000000
    -$ wgrib2 g720_360.grb2 -vt
    -1:4:vt=2009010600
    -$ wgrib2 g720_360.grb2 -vt -v2
    -1:4:00Z06jan2009
    -$ wgrib2 g720_360.grb2 -VT
    -1:4:vt=20090106000000
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/table.html b/web_docs/table.html deleted file mode 100644 index d84f01a..0000000 --- a/web_docs/table.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -table - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-table -
     
    - -

    wgrib2: -table

    -
    - - -

    Introduction

    - -

    -The -table option prints the values of -discipline, master table and local table. -

    Usage

    -

    - -

    --set_table
    -
    - -

    Example

    -
    -$ wgrib2 f.grb -table
    -1:0:discipline=0 master_table=2 local_table=1
    -
    - - - See also: -Sec0, -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified Nov 19, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/text.html b/web_docs/text.html deleted file mode 100644 index e854a7e..0000000 --- a/web_docs/text.html +++ /dev/null @@ -1,214 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -text - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-text -
     
    - -

    wgrib2: -text

    -
    - - -

    Introduction

    - -

    -The -text option writes the grid values to a specified -file as a text (ascii) file. The default format (-header) is (per decoded grib message) - -

    -   NX NY
    -   val-1
    -   val-2
    -   ...
    -   val-(NX*NY)
    -
    - -Where NX and NY are the dimension of the grid and val-N is the Nth grid -point in WE:SN order. When the -no_header option is used, the format is - -
    -   val-1
    -   val-2
    -   ...
    -   val-(NX*NY)
    -
    - -The default order of the data is WE:SN which differs from -wgrib's order which is equivalent to the "-order raw" in wgrib2. -Another difference is that wgrib's -text option requires a filename. -The undefined value is 9.999e20. The format of the output is unchanged -from wgrib except the order, number of columns and precision can -be altered by the user. - -

    Usage

    -
    --text file_name
    -      "-" sends the data to the terminal/stdout
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -s | grep ":RH:2 m" | wgrib2 -i test.grb2 -text data.txt
    -285:36796469:d=2005090200:RH:2 m above ground:60 hour fcst
    -
    - -The above line extracts the 2 meter RH from file test.grb2 and writes it in data.txt -

    - -See also: --netcdf, --spread, --bin, --ieee -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/text_col.html b/web_docs/text_col.html deleted file mode 100644 index c68335f..0000000 --- a/web_docs/text_col.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -text_col - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -text_col -
     
    - -

    wgrib2: -text_col

    -
    - - -

    Introduction

    - -

    -Wgrib2's -text and -ijbox options -will/can write text files. The default is to write one number per line of output. -By using -text_col option, you can write N numbers per line. - -

    Usage

    - -
    --text_col N
    -          N is an integer greater than zero
    -
    - -

    Example

    -
    -$ wgrib2 cdas.t00z.sfluxgrbf06.grib2 -d 1 -text_col 3 -text junk 
    -1:0:d=2016122700:UFLX:surface:0-6 hour ave fcst:
    -$ head junk
    -192 94
    -0.037 0.035 0.034
    -0.032 0.031 0.029
    -0.028 0.026 0.025
    -0.023 0.022 0.019
    -0.016 0.015 0.014
    -0.013 0.015 0.015
    -0.013 0.012 0.011
    -0.009 0.008 0.006
    -0.005 0.003 0.002
    -
    - - -See also: --text, --ijbox - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 30, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/tigge.html b/web_docs/tigge.html deleted file mode 100644 index 836cbfd..0000000 --- a/web_docs/tigge.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -tigge - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-tigge -
     
    - -

    wgrib2: -tigge

    -
    - - -

    Introduction

    - -

    -The -tigge option changes the names of the -variables to a table inspired by TIGGE. - -

    Usage

    -

    - -

    --tigge
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/time.html b/web_docs/time.html deleted file mode 100644 index f39ee5a..0000000 --- a/web_docs/time.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -t -T -vt -VT - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -t -T -vt -VT -
     
    - -

    wgrib2: -t -T -vt -VT

    -
    - - -

    Introduction

    - -

    -The -t -T -vt -VT options prints various time flags. -The -t -T prints the reference time -and -vt -VT prints the verification time. -The capitalized versions print the time with the seconds -and the lower case options print the time with out the seconds. -In conjuntion with -v2 verbose mode, the -format of the time will change to be GrADS compatible. - -

    Usage

    -
    --t
    --T
    --vt
    --VT
    -
    - -

    Example

    -

    - -

    -$ wgrib2 g720_360.grb2 -t
    -1:4:d=2009010100
    -$ wgrib2 g720_360.grb2 -t -v2
    -1:4:00Z01jan2009
    -$ wgrib2 g720_360.grb2 -T
    -1:4:D=20090101000000
    -$ wgrib2 g720_360.grb2 -vt
    -1:4:vt=2009010600
    -$ wgrib2 g720_360.grb2 -vt -v2
    -1:4:00Z06jan2009
    -$ wgrib2 g720_360.grb2 -VT
    -1:4:vt=20090106000000
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/time_interpolation.html b/web_docs/time_interpolation.html deleted file mode 100644 index f7a8bb0..0000000 --- a/web_docs/time_interpolation.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - Climate Prediction Center - wgrib2: time interpolation - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: time interpolation -
     
    - -

    wgrib2: time interpolation

    -
    - - -

    Introduction

    - - -

    -Sometime we have to do time interpolation. We may have the May 1st analysis and -the May 3rd analysis but are missing the May 2nd analysis. Or we may hourly forecasts -and want to make forecasts every 15 minutes in order to make a smooth animation. - -

    -The following shell script reads the 2 hour forecast ($1), the 3 hour forecast ($2) -and writes the 2:15, 2:30 and 2:45 hour forecast to the output file ($3). -The type of grib packing is retained by the option "-set_grib_type same". -The scaling of the numbers is retained by the option "set_scaling same same". -The latter option requires wgrib2 v2.0.5. - -

    -#!/bin/sh
    -# use wgrib2 to interpolate to time interpolate two forecast files
    -#
    -# ASSUMPTION: THE TWO FORECAST FILES MUST HAVE THE RECORDS IN THE
    -# SAME ORDER
    -#
    -# Yes, I am shouting.
    -# 
    -# $1 = 2 hour forecast
    -# $2 = 3 hour forecast
    -# $3 = output   (2:15, 2:30 and 2:45 hour forecasts)
    -#
    -# note: wgrib2 v2.0.5 is needed for the -set_scaling same same
    -#    for older versions of wgrib2, remove the "-set_scaling same same"
    -#    the output will be written in the default mode .. 12 bits
    -#
    -wgrib2=wgrib2
    -in1=$1
    -in2=$2
    -out=$3
    -
    -a="2 hour fcst"
    -b1=0.75
    -c1=0.25
    -d1="135 min fcst"
    -
    -b2=0.5
    -c2=0.5
    -d2="150 min fcst"
    -
    -b3=0.25
    -c3=0.75
    -d3="165 min fcst"
    -
    -$wgrib2 $in1 -rpn sto_1 -import_grib $in2 -rpn sto_2 -set_grib_type same \
    -  -if ":$a:" \
    -     -rpn "rcl_1:$b1:*:rcl_2:$c1:*:+" -set_ftime "$d1" -set_scaling same same -grib_out $out \
    -  -if ":$a:" \
    -     -rpn "rcl_1:$b2:*:rcl_2:$c2:*:+" -set_ftime "$d2" -set_scaling same same -grib_out $out \
    -  -if ":$a:" \
    -     -rpn "rcl_1:$b3:*:rcl_2:$c3:*:+" -set_ftime "$d3" -set_scaling same same -grib_out $out
    -
    - -

    -The script requires the the 2 and 3 hour forecast have the fields in -the same order. Otherwise you may be subtracting HGT from the TMP which -would be silly. The script only processes the fields with an inventory -line of ":2 hour fcst:". You could add lines to process accumulations and -averages. Note that the "-if" is ended by an output option which happens to be "-grib_out". - -

    -The script preserves the packing method and the scaling of the 2 hour forecast. - - - - - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 27, 2016. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/time_processing.html b/web_docs/time_processing.html deleted file mode 100644 index bd68f67..0000000 --- a/web_docs/time_processing.html +++ /dev/null @@ -1,526 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -ave, -fcst_ave - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-time_processing -
     
    - -

    wgrib2: -time_processing

    -
    - -News -The -time_processing option is being -introduced with wgrib2 v2.0.7 and has a superset of the capablities of --ave and -fcst_ave. -The new -ave and -fcst_ave -options just call the -time_processing option. - -

    Introduction

    - -Product Definintion Templates (PDT) come in 3 variaties. Type A is an uncommon PDT -and only has a reference time with no forecast information. Typically they are for observations -such as radar or satellite data. Type B has a reference time with a forecast time. -For example, the reference time could be Januay 1, 2000 at 00Z. The forecast time -could be a 120 hour forecast. Typically the reference time is initial time of the forecast but -Table 1.2 allows you to specify the significance of the reference time. Type B specifies -a point in time. Finally Type C is similar to Type B except it is for a continous or -non-continuous time interval. Some examples of type C PDTs, - -
      -
    • average temperature of a 0-6 hour forecast -
    • maximum temperature of 00Z-24Z observations taken every hour -
    • maximum temperature of 00Z-24Z observations (as from a min-max thermometer) -
    • average 00Z temperature for the month of May (analysis) -
    • standard deviation of 00Z temperature of month of May 120 hour forecast -
    • 30 year climatalogy of average June temperature analyses -
    - -

    The interesting part of Type C PDTs is that the format is in terms of -a stackable temporal operator. For example, a simple height forecast (ex 12 hour forecast) -can be thought of as a height(time1, time2) where time1 is the intitial time of the -forecast and time2 is the forecast time. The possible temporal averaging operators -can be - -

    -    ave1 = 1/N(H(t0,t1) + H(t0+dt,t1) + ... + H(t0+(N-1)*dt,(N-1)))
    -    ave2 = 1/N(H(t0,t1) + H(t0,t1+dt) + ... + H(t0,(N-1)*dt))
    -    ave3 = 1/N(H(t0,t1) + H(t0+dt,t1-dt) + ... + H(t0+(N-1)*dt, t1-(N-1)*dt))
    -    ave4 = 1/N(H(t0,t1) + H(t0-dt,t1+dt) + ... + H(t0-(N-1)*dt, t1+(N-1)*dt))
    -
    -    the continous case is denoted by having dt == 0
    -
    - -By stacking the averaging operator, a monthly climatology can be described by a 30 year average -of a monthly average. - -

    The Type C PDTs allow 11 standard temporal operations (code table 4.10) which -include the commonly used average, accumulation, maximum, minimum, RMS and standard -deviation. - -

    -The -time_processing option will allow you to calculate the -average/minimum/maximum/standard_deviation of a time series of Type B or Type C PDTs. -Only a limited number of operators are supported. The total set is given by - -Code Table 4.10 -Only a limited number of types of time intervals as defined by -Code Table 4.11 -are supported. - -

    Usage

    -

    - -

    --time_processing Code_Table_4.10 Code_Table_4.11 (time interval)  (output grib file)
    -  Code_Table_4.10:  0 or ave, computes average
    -                    2 or max, computes maximum
    -                    3 or min, computes minimum
    -                    5 or rms, computes the root mean square
    -                    6 or std_dev, computes sample standard deviation
    -  Code_Table_4.11:  1 or analyses,  time series of set of analyses/forecasts
    -                    2 or forecast,  time series from one (long) forecast
    -  (time interval):  (integer)(units)
    -  units:            hr, dy, mo, yr, mn (minutes, v2.0.8)
    -
    - - -

    Code Table 4.11 = 1 (analyses)

    - -When Code Table 4.1 is set to 1, the input fields have to be processed in a special order. -Suppose that you want to make a daily average from 4 analyses spaced at 6 hours. Then -you process 4 fields with reference times incrementing by 6 hours with the same forecast time, variable, -level and grid. Whenever the field is unexpected, a new average is made. Note: -the -time_processing option will handle missing fields. For example, - -
    -Code Table 4.10 = 0, Code Table 4.11 = 1
    -
    -U500 2000-01-02 00Z             start ave
    -U500 2000-01-02 06Z
    -U500 2000-01-02 12Z
    -U500 2000-01-02 18Z             end ave
    -V500 2000-01-02 00Z             start ave
    -V500 2000-01-02 06Z
    -V500 2000-01-02 12Z
    -V500 2000-01-02 18Z             end ave
    -Z500 2000-01-02 00Z             start ave
    -Z500 2000-01-02 06Z
    -Z500 2000-01-02 12Z
    -Z500 2000-01-02 18Z             end ave
    -
    - -Code Table 4.1 = 1 is good for making means of many analyses. - - -

    Code Table 4.11 = 2 (forecast)

    -

    -When Code Table 4.1 is set to 1, the input fields have to be processed in a special order. -Suppose that you want to make a daily average from one forecast with using forecast hour = -0, 6, 12 and 18. (The forecast for the first day.) - -

    -Code Table 4.10 = 0, Code Table 4.11 = 2
    -
    -U500 start 2000-01-02 00Z fhour=00 hours    start ave
    -U500 start 2000-01-02 00Z fhour=06 hours
    -U500 start 2000-01-02 00Z fhour=12 hours
    -U500 start 2000-01-02 00Z fhour=18 hours    end ave
    -V500 start 2000-01-02 00Z fhour=00 hours    start ave
    -V500 start 2000-01-02 00Z fhour=06 hours
    -V500 start 2000-01-02 00Z fhour=12 hours
    -V500 start 2000-01-02 00Z fhour=18 hours    end ave
    -T500 start 2000-01-02 00Z fhour=00 hours    start ave
    -T500 start 2000-01-02 00Z fhour=06 hours
    -T500 start 2000-01-02 00Z fhour=12 hours
    -T500 start 2000-01-02 00Z fhour=18 hours    end ave
    -
    - - -Code Table 4.11 = 2 is good for processing a single forecast run. - - -

    Code Table 4.11 = 3, 4, 5

    - -

    -These values of Code Table 4.11 are not commonly used and are not supported. - -

    Code Table 4.10 = 0 (average)

    - -Code Table 4.11 = 0 means the -time_processing option will compute the mean. -This is the most common usage. If you are trying to compute the average and some fields are missing, -then average will be computed from the available fields and the missing field value will reflect the -number of missing fields. If some grid values are undefined, then the average for the grid value -will be undefined as there is no mechanism to so show that the average was computed with fewer fields. - -

    Code Table 4.10 = 2 (maximum)

    - -Code Table 4.11 = 2 means the -time_processing option will find the maximum value. -If you are trying to find the maximum and some fields are missing, then the maximum will -be found available fields and the missing field value will reflect the number of missing fields. -If some grid values are undefined, then the maximum for the grid value -will be undefined as there is no mechanism to so show that the maximum was derived from fewer fields. - -

    Code Table 4.10 = 3 (minimum)

    - -Code Table 4.11 = 3 means the -time_processing option will find the minimum value. -If you are trying to find the minimum and some fields are missing, then the minimum will -be found available fields and the missing field value will reflect the number of missing fields. -If some grid values are undefined, then the minimum for the grid value -will be undefined as there is no mechanism to so show that the minimum was derived from fewer fields. - -

    Code Table 4.10 = 3 (root mean square)

    - -Code Table 4.11 = 3 means the -time_processing option will compute the root mean -square (rms). The mean of the square of the grid values is computed. Then the square root is -saved in the grib message. The value is marked as undefined if any of the individual values -is undefined. - -

    Code Table 4.10 = 6 (standard deviation)

    - -Code Table 4.11 = 6 means the -time_processing option will find the sample standard -devation. Welford's method for computing the mean and variance is used because it is a one-pass scheme -with the accuracy of a two-pass algorithm. - -

    Code Table 4.10 = 1, 4, 7 8, 9, ..

    - -These are not supported. Although adding support for 1, 4, 7, 8 and 11 seems easy. -However, I have not seen these values used. - -

    -ave (dt) (output)

    - -This option has been replaced by a macro that calls "-time_processing 0 1 (dt) (output)". - -

    -fcst_ave (dt) (output)

    - -This option has been replaced by a macro that calls "-time_processing 0 2 (dt) (output)". - -

    Minutes and Seconds

    - -There is no minutes time unit. Wgrib2 uses the standard GrADS -names for time units which means the "mn" is the unit for minutes. -Unfortunately it is too easy to confuse "mn" with the month time unit. -When there is a real need for minutes, then "mn" will be added. - -

    Fast Averaging

    -

    -Suppose we have a month of analyses at 3 hour intervals and want -to make a monthly mean for Nov. 2014. Using the above approach, the steps -would be - -

    -1.  cat narr.201411????.grb2 >tmp.grb2
    -2.  wgrib2 tmp.grb2 |  \
    -3.     sort -t: -k4,4 -k5,5 -k6,6 -k3,3 | \
    -4.     wgrib2 tmp.grb -i -set_grib_type c3 -ave 3hr narr.201411
    -
    -The first line creates a file with all the data.
    -The second line make an inventory.
    -The third line sorts the inventory in the order for -ave to process.
    -The fourth line makes the average by processing data in the order
    -  determined by the inventory created by line 3.
    -
    - -

    -The above approach processes one average at a time and requires a -minimal amout of memory. However, if you count the I/O operations, -you find that there are 4 I/O operations for every field as well as -the writes of the monthly means. In addition, the read (line 4) is -random access. - -

    HPC file systems are very fast for large files that are read -sequentially. On the other hand, HPC file systems are horrible for -small random access reads like in the previous example. Making -monthly means by averaging 3 hourly NARR data was taking about -three quarters of an hour on a multi-million dollar machine. -The problem was that the file system was optimized for large -sequential reads rather than small random-access reads. -The following shows another approach. - - -

    -1.  cat narr.201411????.grb2 | \
    -2.     wgrib2 - \
    -3.        -if_fs ":HGT:200 mb:" -ave 3hr narr.201411 \
    -4.        -if_fs ":UGRD:200 mb:" -ave 3hr narr.201411 \
    -5.        -if_fs ":VGRD:200 mb:" -ave 3hr narr.201411 \
    -6.        -if_fs ":TMP:200 mb:" -ave 3hr narr.201411 
    -
    -The first line copies the data in chronological order and
    -   writes it to the pipe.
    -The second line has wgrib2 read the grib data from the pipe.
    -The third line selects the Z200 fields and runs the averaging
    -  option on it.  We are assuming the narr.* fields only have
    -  one Z200 field and narr.201411???? puts the data into
    -  chronological order.
    -Lines 4-6 apply the averaging option to other fields.
    -
    - -

    -The above approach computes the mean of Z200, U200, V200 and T200 data -at the same time with the use of more memory. -The I/O consists of sequential read of all the files and the -writes of the monthly means. The above script only creates -the mean of Z200, U200, V200 and T200 but you could write a -very long command line and compute the mean of all the fields in -the file. Here are the guts of a -bash script, fast_grib2_mean.sh, which creates and runs the command line. - -

    -1.  wgrib2 $1 -match_inv | cut -f4- -d: | sed -e 's/:n=.*//' >$tmp
    -2.  cmd="cat $* | $wgrib2 - -set_grib_type c3 "
    -3.  while read line
    -4.  do
    -5.    cmd="$cmd -if_fs '$line' -ave $dt $out "
    -6.  done <$tmp
    -7.  eval $cmd
    -
    -1. $1 is the first file to average.
    -   Line 1 creates a file with the field names (minus date codes)
    -2. cmd is the command line that is being built
    -3. loop over all the lines in file $tmp
    -5. generate the "-if_fs/-ave" for the cmd line
    -   Older versions of the web paged used -if but that caused problems when
    -   $line included metacharacters such as parentheses.
    -6. bash syntax to have the while loop read from $tmp
    -7. run the command line
    -
    - -

    -Making the NARR monthly means using the above approach uses large -sequential reads which is optimal for the HPC file system. The run -time went from 3/4 of an hour to maybe a minute. - -

    Fast Forecast Averaging

    - -

    -The previous shell script was for a fast averaging of many analyses. -Sometimes one want to average several forecasts starting from -the same initial time. An example would producing a week-4 forecast. - -

    -1.  $wgrib2 $1 -match_inv | cut -f4-5 -d:  >$tmp
    -2.  cmd="cat $* | $wgrib2 - -set_grib_type c3 "
    -3.  while read line
    -4.  do
    -5.    cmd="$cmd -if_fs '$line' -fcst_ave $dt $out "
    -6.  done <$tmp
    -7.  eval $cmd
    -
    -1. $1 is the first file to average.
    -   Line 1 creates a file with the name and level for each field
    -   It is assumed that the name and level is unique in the file.
    -2. cmd is the command line that is being built
    -3. loop over all the lines in file $tmp
    -5. generate the "-if_fs/-fcst_ave" for the cmd line
    -   Older versions of the web paged used -if but that caused problems when
    -   $line included metacharacters such as parentheses.
    -6. bash syntax to have the while loop read from $tmp
    -7. run the command line
    -
    -

    -Using the -merge_fcst option in a like -manner to the -fcst_ave option. in a like - -

    Monthly Climatologies

    - -Once you can make an average, making a monthly climatology should be easy. Except -it isn't. Here are some of the problems that I encountered. - -
      -
    1. February has 28 days except when it doesn't. This causes problems because - wgrib2 -ave will not average 28 and 29 day intervals. -
    2. '116@6 hour ave(anl)' includes a regex metacharacter -
    3. the process id changed -
    4. the subcenter changed -
    - -The solutions were: - -
      -
    1. rewrite the grib file with
      - -if_fs '116@6 hour ave(anl)' -set_ftime2 '112@6 hour ave(anl)' -fi \
      - -if_fs '116@6 hour ave(6 hour fcst)' -set_ftime2 '112@6 hour ave(6 hour fcst)' -fi \
      - -if_fs '116@6 hour ave(3-6 hour acc fcst)' -set_ftime2 '112@6 hour ave(3-6 hour acc fcst)' -fi \
      -
    2. Use -if_fs instead of -if -
    3. rewrite the file with -set analysis_or_forecast_process_id 180 -
    4. rewrite the file with -set subcenter 0 -
    - -

    -Finding items 3 and 4 was a pain. Using undocumented option v98 helps. However, the mismatches can -now be uncoverted by using a verbose mode (>0) and wgrib v2.0.6. - - -

    Limitations

    -

    -Fast averaging has limits impossed by wgrib2. For example, -there is a limit in the maximum number of -if/-if_fs clauses. -Wgrib2 v2.0.6 can process up to 2000 -if and 2000 -if_fs options. -Wgrib2 v2.0.6 can -accept 10000 words on the command line. Since each -if_fs/-ave clause takes 5 -words on the command line and you need to include the name of the -input file, you get a limit of 999 -if_fs/-ave clauses. To speed up -the code, the evaluation of the -if/-if_fs options are done in parallel. - -

    -Fast averaging has limits impossed by the computer memory because -Fast averaging uses multiple calls to the time_processing option. Each -time_processing option requires computer memory. For -example, to compute the average, you need to keep arrays for the -running sum and number of times the sum was incremented. So it is -possible for the fast averaging could use up too much memory. - - -

    -See also: --merge_fcst -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last created: April 3, 2017, modified Sep 13, 2017. May 4, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/timer.html b/web_docs/timer.html deleted file mode 100644 index 6ff58f2..0000000 --- a/web_docs/timer.html +++ /dev/null @@ -1,215 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -timer - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -timer -
     
    - -

    wgrib2: -timer (requires wgrib2 v3.0.0+)

    -
    - - -

    Introduction

    - -

    -The -start_timer -and -timer options were designed for developers -and people who want to know how fast wgrib2 is running. Most users -can ignore these options. - -

    -The -timer option prints out the -time in seconds since the last -start_timer -or -timer -option was executed. The -timer option is -executed in the initialization phase (no output) and the -finalization phase (extra output). The timer is active -in the finalization phase in order to time the finialization of -options. - -

    -This option uses the OpenMP funcion omp_get_wtime(), and require -compilation with OpenMP. - -

    Usage

    -

    -

    --start_timer
    -   sets timer_time=0
    --timer
    -   prints timer_time in seconds.  
    -   sets timer_time = 0;
    -   at end of processing, prints the average if these results
    -
    -  note: there is only one instance of timer_time
    -        timer_time is set to 0 in the initialization of wgrib2
    -
    - -

    Example

    -

    - -

    -$ wgrib2 gep19.aec -s -start_timer -csv junk.csv -timer
    -1:0:d=2009060500:HGT:200 mb:180 hour fcst:ENS=+19:time=0.068086
    -2:70707:d=2009060500:TMP:200 mb:180 hour fcst:ENS=+19:time=0.064850
    -3:96843:d=2009060500:RH:200 mb:180 hour fcst:ENS=+19:time=0.055596
    -...
    -51:2278237:d=2009060500:PRMSL:mean sea level:180 hour fcst:ENS=+19:time=0.065116
    -finalize-time=0.000015:ave_time=0.061512 count=51
    -
    -Writing of the CSV is taking about 0.06 seconds per field.
    -
    - -

    -See also: --alarm, --start_timer, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created: March 21, 2019 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/tosubmsg.html b/web_docs/tosubmsg.html deleted file mode 100644 index 0512a75..0000000 --- a/web_docs/tosubmsg.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -tosubmsg - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-tosubmsg -
     
    - -

    wgrib2: -tosubmsg

    -
    - - -

    Introduction

    - -

    -The -tosubmsg option writes out the current field as a -submessage in a larger grib message. This can save space as various -sections do not have to be repeated. For example, often you only -need one grid definition section for all the submessages. This -feature can save space when the bitmaps are repeated. By combining -the fields into one message, only one copy of the bitmap is needed. -The -tosubmsg option will only write out one grib message. -Fields that cannot be added to the grib message will be ignored with warning. -Fields cannot be added to the the submessage if section 0 (except the message length) -or section 1 differ. -

    -Note that the -tosubmsg is the only grib output option which cannot -write to a pipe. However, the somewhat similar -ncep_uv option -is pipe compatible. - -

    -By combining several grib messages into one big message, you can save -space. The practical drawbacks include - -

      -
    • A few codes cannot handle submessages -
    • Decoders tend to load the entire grib message into memory. - Loading a 2+ GB grib message would be a problem on 32-bit machines and - machines with limited memory. -
    • Inefficient with "partial-http downloading" (of concern to web servers) -
    - -However, submessages can be very important for some grids. One grid template stores -the latitude and longitude of each grid point. This is a large overhead per grib -message but by using submessages, the total overhead is reduced. - -

    Usage

    -

    - -

    --tosubmsg OUTPUT_FILE
    -NOTE: OUTPUT_FILE cannot be a pipe.
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -tosubmsg new.grb2
    -
    -1:0:d=2008120200:TMP:800 mb:anl:
    -2:4786:d=2008120200:TMP:750 mb:anl:
    -3:9572:d=2008120200:RH:800 mb:anl:
    -4:13335:d=2008120200:RH:750 mb:anl:
    -5:17098:d=2008120200:TMP:2743 m above mean sea level:anl:
    -
    -Submessage statistics:
    -- # submessages written  : 5
    -- Kbytes saved           : 0
    -- Kbytes written         : 20
    -$ wgrib2  new.grb2
    -1.1:0:d=2008120200:TMP:800 mb:anl:
    -1.2:0:d=2008120200:TMP:750 mb:anl:
    -1.3:0:d=2008120200:RH:800 mb:anl:
    -1.4:0:d=2008120200:RH:750 mb:anl:
    -1.5:0:d=2008120200:TMP:2743 m above mean sea level:anl:
    -
    - - -

    -See also: --GRIB, --ncep_uv, --submsg -

    - - - - - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Feb. 20, 2014. -
    - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/transient.html b/web_docs/transient.html deleted file mode 100644 index 2024f9b..0000000 --- a/web_docs/transient.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -lon - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-transient -
     
    - -

    wgrib2: -transient

    -
    - - -

    Introduction

    - -

    -When wgrib2 opens a file, the file may be marked as persistent or -transient. If a file is marked as transient, wgrib2 will close -the file as part of its normal "finalize" procedure. If a file -is marked as persistent, the file will closed when the system -terminates the program. If you run the wgrib2 utility, it makes -no difference who closes the files. However, when you use the -C/Fortran API, it makes a major difference. When you write -C/Fortran programs that calls the wgrib2 API, you may want to -use the same file thousands of times. It is better to open -the file once rather than thousands of times. -The -persistent option marks an already -open file as persistent. -The -transient option marks an already -open file as transient. When opening a file, the default -is to mark the file as persistent. - -

    Usage

    -

    - -

    --transient FILE
    -  FILE must be already opened
    -
    - -See also: --persistent -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 15, 2016 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/type_reftime.html b/web_docs/type_reftime.html deleted file mode 100644 index 8dacff8..0000000 --- a/web_docs/type_reftime.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -type_reftime - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ndate -
     
    - -

    wgrib2: -type_reftime (v3.1.3)

    -
    - - -

    Introduction

    - -

    -The reference time in a grib message is usually the analysis (0) or the -start of forecast (1). For NCEP, the analysis as produced by the data -assimilation system is used as the initial conditions for the forecast. -(It is possible that other sites may using an initialization step.) - -

    -Grib allows the reference time to refer to other quantities such as - -

      Code Table 1.2 (entries 0 and 1 not shown)
    -  2 Verifyting Time
    -  3 Observation Time
    -  4 Local Time
    -
    - -

    -The ultraviolet index (UVI) as produced is the value that verifies at noon local time. -It is not the maximum value as the conditions may be cloudy at noon and cloud free -at 1pm. The UVI field will have a hour of 12Z with a code table 1.2 = 4, saying -the the reference time is "local time". - -

    Usage

    -

    - -

    --type_reftime
    -
    - -

    Example

    -

    - -

    -$ wgrib2 small.grb2 -type_reftime
    -1:0:type_reftime=start of forecast
    -
    - -

    - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page: started 2/2023 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/types.html b/web_docs/types.html deleted file mode 100644 index a9a7f8a..0000000 --- a/web_docs/types.html +++ /dev/null @@ -1,400 +0,0 @@ - - - - Climate Prediction Center - wgrib2: options - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 options -
     
    - -

    Options

    -
    - - -

    Introduction

    - -

    -The wgrib2 command line consists of a list of options and a grib file -to be processed. The options like --if, --else, and --endif can alter the 'run_flag' which is the basis -of the IF-ELSE-ENDIF blocks. - -

    Types of Options

    - - -
    -wgrib2:      *.c:
    -------       ---
    -if           If                For IF/ELSE/ELSEIF/ENDIF type options
    -else         Else
    -elseif       Elseif
    -endif        Endif
    -
    -init         setup             only called in the beginning, for set up
    -
    -inv          inv               print output to stdout (make an inventory)
    -inv>         inv_output        print to a file (make an inventory)
    -out          output            write to a file with a non-inventory output, ex binary
    -misc         misc              any thing else
    -
    - - -

    How "Options" are called

    -

    What is "mode"

    - -

    -Each option is associated with a subroutine. Each option is "called" -for setup (mode == -1). This allows -the option to do initialization such as setting up the flags, -checking the arguments and opening files. This is the only -time that init or setup options are called. -The -match and -d options are init options because -it sets up the grib processor to only accept certain grib messages. - -

    -The options are then called for every grib message that is processed. -In the grib-processing phase, mode ≥ 0 and the mode will indicate the -verbosity level. Mode == 0 is the lowest verbosity. and mode == 2 -is normally the highest verbosity. These verbosity modes can be set by -v, --v1 and -v2. Modes 97, 98 and 99 are used in debugging. - -

    -When the program has finished processing the grib data, the -option subroutines are called to cleanup the processing -(mode == -2). The -cleanup step is used to finish calculations (ex. averaging), -close files and free memory. Freeing memory and closing files -may seem a wasted effort because the operating system will do that -when a program finishes. However, wgrib2 is also a subroutine so -memory recovery and closing files is a must otherwise you -may run out of memory or file handles. -By the way, if you don't want a file closed, you can mark the file as persistant. - - -

    Custom Options

    - -

    -Writing your own option can be easy. That is why there -are so many options in wgrib2 (387 in 7/2022). You just have -to follow some rules. - -

    Setup: mode = -1

    -

    -In the setup phase, you have to request services. For -example if you want the grid point values or locations, -you set at flag in this step. -

    You can also parse the arguments in the setup phase -or grib-processing step. If you process the arguments -in setup phase will save time. Processing the arguments -in the grib-processing step is necessary if the -processing depends on the grib message. In addition, -macro options can only call options that have -no setup. Here is an example of setting the options. - -

    -extern decode, latlon, save_translation;
    -..
    -    if (mode == -1) {
    -        decode = 1;             /* decode the grid point values */
    -        latlon = 1;             /* calculate the lat lon values */
    -        save_tranlation = 1;    /* save the translation from external to internal scan order */
    -        return 0;
    -    }
    -
    - -

    Setup: flags

    -

    -The following flags request a service. Set the flag to -one if you want the service. Do not set the flag to zero because -another option may want the service. - -

    -extern int decode             grid point values are decoded
    -extern int latlon             latitude and longitudes are calculated
    -extern int save_translation   save trnsalation from grib file to internal scan order
    -
    - -

    -Some flags are set by other options, and all options are expected -to obey the flag. These flags may change. -

    -file_append                    Open an file for writing in append mode 
    -ieee_little_endian             if writing ieee, use little endian
    -header                         files use write in "header" mode
    -flush_mode                     flush the output after writes (all output files)
    -
    - -

    Grib Processing: mode ≥ 0

    -

    -In this phase, the option routine is called one -time each grib (sub)message is processed. The -routine has potential access (if requested) to the grid -point data and locations. Of course, the routine -is not called if prevented by if/else/endif block. - -

    Grib Processing: mode = -2

    -

    -In the cleanup phase, calcuations, I/O are finished, -files are closed and allocated memory - -

    FILE I/O

    -

    -Wgrib2 allows multiple options to read and write to a file. - - - $ wgrib2 IN.grb -if ':TMP:' -bin OUT.bin -endif -if ':HGT:' -bin OUT.bin -endif - - -If each -bin option were allowed to open the file, the writes would -not work correctly. So opening, closing, writing, reading and fseeks -have to be done by a special set of routines. - -

    -    fopen_file(..)
    -    fclose_file(..)
    -    fread_file(..)
    -    fwrite_file(..)
    -    fseek_file(..)
    -    ftell_file(..)
    -    fflush_file(..)
    -
    -    the only difference from the normal I/O is FILE *file is replaced by struct seq_file *file
    -
    - -

    Static Variables

    -

    -An option gets called for initialization, grib-processing, and cleanup. So -the option routine needs static variables to retain information such -as the open file handles. The situation is more difficult because an -option can be used more than once on a command line. - -

    - $ wgrib2 IN.grb -if ':TMP:' -bin TMP.bin -endif -if ':HGT:' -bin HGT.bin -endif
    -
    - -So the option routine needs a set static variables for each use of the -option on the command line. - - -
    -struct static_vars {
    -    struct seq_file out;
    -    int num_run;
    -}
    -...
    -    struct  static_vars *save;
    -    if (mode == -1) {
    -        decode = 1;
    -        *local = save = (struct static_vars *) malloc( sizeof(struct static_vars));
    -        /* local is defined as the subroutine argument, the i-th option on the command line
    -           is passed local[i] */
    -        if (save == NULL) fatal_error("memory allocation in XYZ);
    -        save->num_run = 0;
    -        if (fopen_file(&(save->out), arg1, "wb") != 0) fatal_error("open file %s", arg1);
    -        return 0;
    -    }
    -    save = *local;	/* *local is passed from calling routine */
    -    if (mode == -2) {
    -        fprintf(stderr,"XYZ called %d times\n", save->num);
    -        fclose(&(save->out));
    -        free(*local);
    -    }
    -    if (mode >= 0) {
    -        fwrite_file(data, ndata, sizeof(float), &(save->out));
    -        save->num_run += 1;
    -    }
    -    return 0; 
    -
    - -

    Stdout

    -

    -Normally options do not write to stdout but write their output to a buffer. -This allows the option routines to be called by other routines and return -a string value. For example, -you wanted the name of the variable. You can call the -the -var option, and the name would be returned -in the buffer. - - -

    Adding a New Option

    -

    -Adding a new option involves updating tables with -(1) option name and corresponding subroutine name, -(2) number of arguments the option takes and the - (3) description of the option for the help command. -On a POSIX machine (has a POSIX shell and utilities), -the process is process is automatic. You need to do, - -

      -
    1. The name of the source code needs to start with a capital letter - and be written in C. -
    2. Source code file needs to be added to grib2/wgrib2/ ex. grib2/wgrib2/File.c -
    3. Each option needs a HEADER line -
        -
      • ex. * HEADER:100:text:output:1:write text data into X -
      • The line must start with '* HEADER:' -
      • then a 3 digit number which display priority -
      • then the name of the option, ex. 'text' -
      • then comes the type of option, ex. 'output' -
      • then by the number of arguments (only 0..8 are allowed) -
      • finished by a description of the option -
      -
    4. The name of the routine associated with the option is int f_OPTION(ARGN) -
    5. OPTION is replaced by the option name in the header line -
    6. N is replaced by the number of arguments in the header line -
    7. The script function.sh will read the header lines and generate fnlist.h and fnlist.c -
    - - - - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/udf.html b/web_docs/udf.html deleted file mode 100644 index 9d8b6d9..0000000 --- a/web_docs/udf.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -udf - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-udf -
     
    - -

    wgrib2: -udf

    -
    - - -

    Introduction

    - -

    -The -udf option is only available when the UDF -(User Defined Function) extension is installed. -The -udf option runs a shell command (arg1) and then -sets the grid point so to contends of a binary file (arg2). - - -

    Usage

    -

    - -

    --udf STRING FILE
    -
    -STRING is a shell command
    -FILE is a binary file which contains the contents of grid points
    -
    - -

    -Some functions can be written in RPN and others are more -conveniently writen is a language like C for Fortran. -The idea behind UDF is that the input file to the user -define function is prepared while scanning the grib file. -When the input file is complete, the user defined function -is called. If the user defined function returns no results, then -the -sys option is used to run the user -defined function otherwise -udf is used. - -

    Comments

    -

    -The UDF options may not work in windows. - -

    -The use of the UDF options is limited and the UDF options should, IMHO, -not be enabled unless the UDF options are needed. - - -

    -See alse: -udf_arg, --udf, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/undefine.html b/web_docs/undefine.html deleted file mode 100644 index b57154e..0000000 --- a/web_docs/undefine.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -undefine - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-undefine -
     
    - -

    wgrib2: -undefine

    -
    - - -

    Introduction

    - -

    -The -undefine option sets the selected the decoded grid -values to undefined. The grid points are have to be inside or outside -a user defined lat-lon box. This option can be used to limit the output -when writing text output. For example, you were only interested in -the UK, you could use this option to undefine the grid points outside -the of UK. Then when you write the data in spread-sheet format, you -would get a much smaller output. This option can also be used to -find the regional average using the stat option. - - -

    Usage

    -

    - -

    --undefine (in-box|out-box) lon0:lon1 lat0:lat1
    -
    -in-box:  decoded grid points inside the box are set to undefined
    -out-box: decoded grid points outside the box are set to undefined
    -lon0:lon1  west-east longitudes of the box
    -lat0:lat1  south-north latitudes of the box
    -
    -Points on the box boundary are considered to be in the box.
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -undefine out-box 350:10 -10:10 -stats
    -1:0:ndata=65160:undef=64719:mean=94.1229:min=58.1:max=125.2
    -
    - -The above line calculates the statistics for the box -10W-10E 10S-10N - -
    -$ wgrib2 test.grb2 -undefine out-box 10:30 20:40 -undefine in-box 12:28 22:38 -bin boundary.bin
    -
    - -The above line undefines the grid points outside of a box and then undefines the grid points of a smaller -box that is contained in the first box. Then it writes the data as a binary file. The data file contains -the data points for a perimeter of a box. Why would someone want to do that? Think "horizontal boundary -conditions for a regional model". For this to work well, a module to write the data out in grib-2 needs -to be written. To work in the (i,j) coordinates, see the -ijundefine option. - -

    -See also: --ijundefine, --spread, --stats, --undefine_val, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/undefine_val.html b/web_docs/undefine_val.html deleted file mode 100644 index 4214089..0000000 --- a/web_docs/undefine_val.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -undefine_val - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-undefine_val -
     
    - -

    wgrib2: -undefine_val

    -
    - - -

    Introduction

    - -

    -The -undefine_val option sets the grid points to undefined -depending on the value of the grid point. If a single value is specified, grid -values within 0.1 percent are set to undefined. If two values are specified, -the values that are within that range are set to undefined. - -

    Note: the ability to handle ranges was always available but undocumented. -My mistake. That's what you get when you delay writing the documentation. - -

    Usage

    -

    - -

    --undefine_val value
    -   grid values within 0.1 percent are set to undefined
    -
    --undefine_val "value1:value2"
    -   grid value that are within the rage are set to undefined
    -   i.e.,   value1 <= grid_value <= value2
    -
    - -

    Example

    -

    -Suppose a non-standard grib file uses -999.9 as special value to -indicate an undefined grid point value. This is unfortunate as grib -readers will not know that -999.9 is a special value for undefined -values. (Grib2 uses a bitmap, NaN or out-of-range values.) -The best way to deal with these files is to convert -values of -999.9 to undefined values and then write them out. - -

    -$ wgrib2 IN.grb2 -undefine_val -999.9 -set_grib_type same -grib_out OUT.grb
    -
    - -

    -See also: --undefine, --ijundefine, --rpn, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Aug 8, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/unix_time.html b/web_docs/unix_time.html deleted file mode 100644 index 5f27b15..0000000 --- a/web_docs/unix_time.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -unix_time - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-unix_time -
     
    - -

    wgrib2: -stats, -max, -min

    -
    - - -

    Introduction

    - -

    -The -unix_time option writes unix time in the inventory. -Unix time is defined by the number of seconds after 00:00 UTC Januay 1, 1970. -Unix time is used by the many operating systems, and by NetCDF files. -The -unix_time option depends on system/library functions -to calculate the unix time. It requires ansi C compatibility and it is -subject to overflows depnding on the definition of time_t. -

    -The unix time is stored in time_t integer-type variable. -If time_t is a signed 32-bit integer, the integer will overflow in 1/19/2038 -and is only valid between 12/13/1901 and 1/19/2038. -One valid solution to the year 2038 overflow problem is to define time_t as an unsigned 32-bit integer. -Then valid unix time are from 1/1/1970 to 2/7/2106. This solves the year 2038 overflow problem -but makes time prior to 1970 invalid. -The most common solution -is to make time_t a signed 64-bit integer which limits the largest year to 2,147,485,547. -That's enough time for dinosaurs to come and go. Here are the list -of systems which may have problems with unix_time. - -

      -
    • wgrib2 prior to v3.1.1, unix_time is converted to int (typically 32-bit int) -
    • 32-bit linux systems, time_t is 32-bit signed int until kernel 5.6, API needs to be fixed -
    • 32-bit QNX: 32-bit ONX use unsigned 32-bit integer for time_t -
    • old versions of BSD varients use signed 32-bit int for time_t -
    • Windows: depends on the compiler -
    - -

    Usage

    -

    - -

    --unix_time
    -   unix_time is the number of seconds after 00:00 UTC 1/1/1970
    -   prints the unix time for the reference and verification times
    -
    -   v3.1.1+: if the code detects a problem with the reference time, a fatal error occurs
    -   prior to v3.1.1: if the code detects a problem with the time, -1 is printed
    -      if there is no forecast time (ex. radar), the verification time is -1
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -unix_time
    -1:0:unix_rt=1228176000:unix_vt=1228176000
    -
    -unix_rt is the reference time
    -unix_vt is the verification time
    -
    - -

    -See also: --t (reference time), --vt (verification time), -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005, Jan, 2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/unmerge_fcst.html b/web_docs/unmerge_fcst.html deleted file mode 100644 index e56bf4b..0000000 --- a/web_docs/unmerge_fcst.html +++ /dev/null @@ -1,302 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -unmerge_fcst - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-ncep_norm -
     
    - -

    wgrib2: -unmerge_fcst (v3.0.0+)

    -
    - - - -

    Introduction

    -Prior to GFS-FV3, the precipitation was stored in the "old-style". This style -handled 6 hour accumulations in a simple manner. - -
    -  0-6, 6-12, 12-18, 18-24, etc
    -
    - - -Eventually someone wanted to store 3 hour accumulations. However, people who had code -that read the 6 hour accumulations said that they couldn't change the code. So the -the file still had to contain the 6 hour accumulations. So the code to read the -3 hour accumulations had to a subtraction for some of the interval. They stored -the accumulations like this. - - -
    -  0-3, 0-6, 6-9, 6-12, 12-15, 12-18, 18-21, 18-24, etc
    -
    - -Now the FV3-GFS model developers agreed to store precipitation accumulations in -the easy-to-use format, - -
    -  0-3, 0-6, 0-9, 0-12, 0-15, 0-18, 0-21, 0-24, etc
    -
    - -However, people who had code that read the accumulation in the old style said that -they could not change their code. So they had put old style and new style accumulated -precipitation in the files. - -

    -To process the precip with wgrib2, you want to eliminate the old-style precip. -It is surprisingly difficult because the old style can have to same name as -the new style (ex. 3 hour forecast). You have to eliminate the old style but -not the new style even though they have the same name. - - -

    The -unmerge_fcst option helps deal with the -FV3-GFS precip problem when trying to make time series. - - -

    Example usage

    - - -
    -# make a file with the APCP from cat gfs.t00z.pgrb2.0p25.f(N) N=000..029 
    -$ cat gfs.t00z.pgrb2.0p25.f00? gfs.t00z.pgrb2.0p25.f01? gfs.t00z.pgrb2.0p25.f02? | wgrib2 - -match APCP -grib $stmp/all_apcpc.grb
    -
    -
    -# Lets see the new-style precip. in the file
    -$ cd $stmp
    -$ wgrib2 all_apcpc.grb -match ':0-'
    -1:0:d=2020101600:APCP:surface:0-1 hour acc fcst:
    -2:225707:d=2020101600:APCP:surface:0-1 hour acc fcst:
    -3:451414:d=2020101600:APCP:surface:0-2 hour acc fcst:
    -4:726257:d=2020101600:APCP:surface:0-2 hour acc fcst:
    -5:1001100:d=2020101600:APCP:surface:0-3 hour acc fcst:
    -6:1307459:d=2020101600:APCP:surface:0-3 hour acc fcst:
    -7:1613818:d=2020101600:APCP:surface:0-4 hour acc fcst:
    -8:1940346:d=2020101600:APCP:surface:0-4 hour acc fcst:
    -9:2266874:d=2020101600:APCP:surface:0-5 hour acc fcst:
    -10:2610484:d=2020101600:APCP:surface:0-5 hour acc fcst:
    -11:2954094:d=2020101600:APCP:surface:0-6 hour acc fcst:
    -12:3311989:d=2020101600:APCP:surface:0-6 hour acc fcst:
    -14:3894753:d=2020101600:APCP:surface:0-7 hour acc fcst:
    -16:4539821:d=2020101600:APCP:surface:0-8 hour acc fcst:
    -18:5222224:d=2020101600:APCP:surface:0-9 hour acc fcst:
    -20:5934324:d=2020101600:APCP:surface:0-10 hour acc fcst:
    -22:6672253:d=2020101600:APCP:surface:0-11 hour acc fcst:
    -24:7431863:d=2020101600:APCP:surface:0-12 hour acc fcst:
    -26:8071608:d=2020101600:APCP:surface:0-13 hour acc fcst:
    -28:8767119:d=2020101600:APCP:surface:0-14 hour acc fcst:
    -30:9496847:d=2020101600:APCP:surface:0-15 hour acc fcst:
    -32:10253719:d=2020101600:APCP:surface:0-16 hour acc fcst:
    -34:11034026:d=2020101600:APCP:surface:0-17 hour acc fcst:
    -36:11835057:d=2020101600:APCP:surface:0-18 hour acc fcst:
    -38:12515832:d=2020101600:APCP:surface:0-19 hour acc fcst:
    -40:13250721:d=2020101600:APCP:surface:0-20 hour acc fcst:
    -42:14017034:d=2020101600:APCP:surface:0-21 hour acc fcst:
    -44:14807995:d=2020101600:APCP:surface:0-22 hour acc fcst:
    -46:15623322:d=2020101600:APCP:surface:0-23 hour acc fcst:
    -48:16460745:d=2020101600:APCP:surface:0-1 day acc fcst:
    -50:17171481:d=2020101600:APCP:surface:0-25 hour acc fcst:
    -52:17933059:d=2020101600:APCP:surface:0-26 hour acc fcst:
    -54:18724060:d=2020101600:APCP:surface:0-27 hour acc fcst:
    -56:19538757:d=2020101600:APCP:surface:0-28 hour acc fcst:
    -58:20377109:d=2020101600:APCP:surface:0-29 hour acc fcst:
    -
    - -As you can see, 0-1, 0-2, 0-3, 0-4, 0-5 and 0-6 accumulations are duplicated. -

    -The -unmerge_fcst option is used to find the precipitation time series. - -

    -$ wgrib2 all_apcpc.grb -unmerge_fcst precip_ts.grb 0hr 1
    -1:0:d=2020101600:APCP:surface:0-1 hour acc fcst:
    -2:225707:d=2020101600:APCP:surface:0-1 hour acc fcst:
    -3:451414:d=2020101600:APCP:surface:0-2 hour acc fcst:
    -4:726257:d=2020101600:APCP:surface:0-2 hour acc fcst:
    -5:1001100:d=2020101600:APCP:surface:0-3 hour acc fcst:
    -6:1307459:d=2020101600:APCP:surface:0-3 hour acc fcst:
    -...
    -
    - -

    -The first argument is the output file. The second argument is -the start of the accumulations to start, i.e., 0hr. Finally the -third argument is 1 to include the 0-1 accumulation. The output is - -

    -$ wgrib2 precip_ts.grb 
    -1:0:d=2020101600:APCP:surface:0-1 hour acc fcst:
    -2:225707:d=2020101600:APCP:surface:1-2 hour acc fcst:
    -3:2302390:d=2020101600:APCP:surface:2-3 hour acc fcst:
    -4:2302593:d=2020101600:APCP:surface:3-4 hour acc fcst:
    -5:2302796:d=2020101600:APCP:surface:4-5 hour acc fcst:
    -,,
    -26:2307059:d=2020101600:APCP:surface:25-26 hour acc fcst:
    -27:2307262:d=2020101600:APCP:surface:26-27 hour acc fcst:
    -28:2307465:d=2020101600:APCP:surface:27-28 hour acc fcst:
    -29:2307668:d=2020101600:APCP:surface:28-29 hour acc fcst:
    -
    - - -

    Usage

    -

    - -

    --unmerge_fcst (output file) (N)(time unit) I
    -   output file: name of output grib file
    -   N: integer,  usually 0
    -   time unit:  the forecast time unit, hr, dy, mo, etc
    -      If you want to process A-B hour acc fcst
    -      then N=1, time unit = hr
    -  I = 1 
    -
    - -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created: Oct 16, 2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/update_2.0.8.html b/web_docs/update_2.0.8.html deleted file mode 100644 index 0891c42..0000000 --- a/web_docs/update_2.0.8.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - Climate Prediction Center - wgrib2: v2.0.8 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 v2.0.8 -
     
    - -

    wgrib2: v2.0.8

    -
    - - -

    Introduction

    - -

    -Wgrib2 v2.0.8 has the typical bug fixes, updates for tables, minor enhancements. -All these can found in the change log. Here are the bigger changes. - -

    The interpolattion library has been changed from the single precision -grib1 to the newer double precision grib2 library. The newer library -is more accurate and supports rotated lat-lon grids. Both Canada and NCEP -plan to join the Europeans in making rotated lat-lon grib files. - -

    I am working with 80 member ensembles, so gmerge had to be -modified to handle 80 input files, and -ens_processing option -was written to get the ensemble statistics. - -

    Everybody has a program/script to add an offset to a date code. -Unlike other solutions, the offset can be in minutes, hours, days, -months and even years. (-ndate) - -

    The -ndate option was ok, but puting it into a do loop makes -scripting much easier when doing time loops (-ndates). I -immediately rewrote scriopts to use -ndates. It isn't the best -design to have -ndate and -ndates in wgrib2. However, it was -a low cost solution assuming wgrib2 has to be ported to the new -machine. - -

    I learned how to use the unix command "seq" to generate a -list of 80 ensemble members by changing the seq format. So I added --ndates_fmt to generate lists of files of uniformly varying dates. - -

    The time has come to support minute units. Originally wgrib2 -did not supoort minute units because the minutes units is "mn" which -could be confused with month. (wgrib2 uses GrADS units.) - -

    -NetCDF4 is not working well. The problem is compiling the HDF5 library -with newer versions of gcc. You may use the -Intel compiler. Another option is to find the system HDF5 library -and modify the makefile. I expect the next version of HDF5 will address -the problems. - -

    -Compiling wgrib2 with LLVM worked with Ubuntu 14.04LTS. However, this -version becomes unsupported in April 2019. With Ubuntu 18.04LTS, there -is no LLVM fortran. Clang will compile wgrib2 but you will not have -the interpolation library or the fortran wgrib2api. - - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 10, 2016, July 2, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/usage_questions.html b/web_docs/usage_questions.html deleted file mode 100644 index 9793e40..0000000 --- a/web_docs/usage_questions.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -text - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 questions -
     
    - -

    wgrib2: questions

    -
    - - -

    -Question: I use -small_grib to make a smaller domain. Why is the "smaller" -file almost 3x larger? - -

    -Answer: -small_grib creates a new grib message. The default compression is "off". -You can use c3 (complex number 3) compression by "-set_grib_type c3". BTW -this is why grib_filter on the nomads.ncep.noaa.gov server can create -larger files when making a regional subset. - - -

    -Question: Why does wgrib2 create smaller complex-packed files -than cnvgrib? - -

    -Answer: Complex packing can be done in different ways. wgrib2 uses -a slower algorithm than cnvgrib and makes a smaller file. - -

    Question: I get a warning about the decode may differ from the WMO standard, why? - -

    Answer: Some software/libraries may differ from the WMO standard when encoding and decoding a constant field. -The warning is based on the center and testing of software/libraries developed by that center. -The testing was done many years ago and may no longer be appropriate. If any center -feels that the warning is inaccurate, let me know and I will remove the warning. - -

    The common bug is that when encoding a constant field, the decimal scaling -factor modifies the field reference value. Some codes ignore the decimal scaling which -was the case in the grib1 standard. To turn off -the wgrib2 warning, make sure the decimal scale factor is zero when the field is constant. - - - - - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Dec 21, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/user_grib2tables.html b/web_docs/user_grib2tables.html deleted file mode 100644 index 89198c3..0000000 --- a/web_docs/user_grib2tables.html +++ /dev/null @@ -1,323 +0,0 @@ - - - - Climate Prediction Center - wgrib2: user grib2tables - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: user grib2tables -
     
    - -

    wgrib2: user grib2tables

    -
    - - -

    Introduction

    - -

    -Grib2 messages have variable names such as HGT or TMP. The table built into wgrib2 -can be agumented using "user defined grib tables". This allows you to add locally -defined variables as well, update the grib table, and change the names of pre-existing -variables. Wgrib2 looks for the user defined gribtable in (in order of search) - -

    -   environment varible: GRIB2TABLE
    -   environment varible: grib2table
    -   file: grib2table (in current working directory)
    -
    -   Assuming your user definitions are in a file called "/home/my_name/my_grib2table"
    -
    -   for sh/bash
    -     export GRIB2TABLE=/home/my_name/my_grib2table
    -   and for people who have a broken caps lock key
    -     export grib2table=/home/my_name/my_grib2table
    -
    -   for csh
    -     setenv GRIB2TABLE /home/my_name/my_grib2table
    -   or
    -     setenv grib2table /home/my_name/my_grib2table
    -
    -   You can also always put the user defined gribtable in the "grib2table" in 
    -   the "current working directory".
    -
    - -

    -The user defined gribtable is searched before the built-in gribtable. - -

    Format of the user defined gribtable

    - -
    -   Comments
    -       start with the first column staring with #, *, !
    -       any line that is not a definition line
    -
    -   definitions:
    -       I1:I2:I3:I4:I5:I6:I7:I8:NAME:DESC:UNITS
    -       I1=discipline
    -       I2=master table set: used when using -set_var
    -       I3=master table low:
    -       I4=master table high:
    -            According to WMO, the WMO grib definitions depend on the master table 
    -          (Table 1.0).  For example, a (discipline, parameter category, parameter)
    -          triple may mean different things depending on the master table. Common
    -          sense suggests that you minimize the number of redefinitions.
    -            To conform to WMO, the grib variable definitions are valid for a
    -          range of master table values (I3 and I4).  When setting the variable
    -          name, the master table is set to I2 for that field.
    -
    -          defintion valid for low <= mastertable <= high
    -          want I3 ≤ I2 ≤ I4
    -          must have I2, I3 and I4 in the range of [0..255]
    -       I5=center  (use -1 for a wild card)
    -       I6=local table number
    -       I7=parameter category (code table 4.1)
    -       I8=parameter (code table 4.2)
    -
    -       when a field is not used, use a value of -1
    -       for locally defined fields, I5 (center) must not be -1
    -
    -   all other lines are not used.  Warnings will be given when the number of colons suggest an error. 
    -
    - -

    -For each variable, there is a master table set, low and high. The master table is a master -version number. Each definition has a range of version numbers for which it is recognized. -If you want the variable to defined for all version numbers, set "low" to zero and "high" -to some large positive integer. The "set" value is master table number used when the "-set_var" -option is used change the variable name. -

    - -

    Locally Defined Variables

    -

    The grib2 standard usually allows locally defined variable definitions. -They are defined when the Discipline, or Parameter Category or Parameter Number -ranges from 192-254. When the variable is locally defined, then the -center has to be set (not -1) in the user grib table.. The variable is only -defined for the center. Note: WMO does not not allow the local table to have -a value of zero. - -

    -Locally defined variables: a or b or c
    -  a) Discipline: 192-254
    -  b) Parameter Category: 192-254
    -  c) Parameter Number: 192-254
    -
    - - - - -

    Sample grib2table

    -
    -/*
    - * sample user grib table
    - */
    -/*
    -
    -  struct gribtable_s {
    -    int disc;   /* Section 0 Discipline                                */
    -    int mtab_set;    /* Section 1 Master Tables Version Number used by set_var      */
    -    int mtab_low;    /* Section 1 Master Tables Version Number low range of tables  */
    -    int mtab_high;   /* Section 1 Master Tables Version Number high range of tables */
    -    int cntr;   /* Section 1 originating centre, used for local tables */
    -    int ltab;   /* Section 1 Local Tables Version Number               */
    -    int pcat;   /* Section 4 Template 4.0 Parameter category           */
    -    int pnum;   /* Section 4 Template 4.0 Parameter number             */
    -    const char *name;
    -    const char *desc;
    -    const char *unit;
    -  };
    -
    -*/
    -0:1:0:10:8:0:190:190:TEST1:Critcal Fire Weather:??
    -0:1:0:10:8:0:190:191:TEST2:Dry lightning:??
    -0:1:0:10:0:0:2:2:Utest:utest:m/s
    -
    - - - - - -

    Uses

    -
      -
    1. update tables with new or local variables -
    2. convert the variable names to another convention, language -
    3. change the variable names that are produced by g2ctl -
    4. in the conversion to netcdf, you may want a different set of variable names -
    - -

    Caution

    - -

    -The user-defined grib tables allow you to use your own names for variables. -However, you have to be careful. Suppose you want to define a new variable -name and you didn'r realize the name was already defined for another variable. -Then the inventory could be confusing and the results of -set_var would be -unpredictable. - -

    The option, -ncep_uv, combines the UGRD and VGRD fields into one -grib message. This option will not work when UGRD and VGRD are renamed. - -

    The option, -new_grid, does vector interpolation of vector fields and -scalar interpolation on the other fields fields. The -new_grid option will -not identify the vector fields if their names get changed and scalar -interpolations will be used. The identification of maxx and wind fields -in the Arakawa E grid will also not work. - -

    Add a grib table to wgrib2

    - -

    -To add a grib table to the wgrib2 source code, you need to send a copy of -the grib table in the format shown above to wesley.ebisuzaki@noaa.gov. The -advantage is that you get to test the grib table as a "user defined gribtable" -before finalizing the table. You can submit that grib table as - -

      -
    1. for only the locally defined variables -
    2. for all the variables (local and WMO defined) -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Aug 25, 2015 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/v.html b/web_docs/v.html deleted file mode 100644 index 485c11c..0000000 --- a/web_docs/v.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -v, v0, v2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-v -
     
    - -

    wgrib2: -v -v0 -v2

    -
    - - -

    Introduction

    - -

    -Wgrib2 has multiple levels of verbosity. The lowest level (0) is -the default and set by --v0. The next level is 1 and is set by --v. Really verbose is set by --v2. Debugging is set by level 99. -Note that the verbosity can be changed multiple times on -the command line. - -

    Usage

    -

    -

    --v0
    --v
    --v2
    -
    - -

    Example

    -

    -

    --$ wgrib2 fcst.grb
    -1:4:d=2007032600:HGT:1000 mb:anl:
    -2:422561:d=2007032600:HGT:1000 mb:3 hour fcst:
    --$ wgrib2 fcst.grb -v
    -1:4:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:anl:
    -2:422561:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:3 hour fcst:
    --$ wgrib2 fcst.grb -v2
    -1:4:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:anl:
    -2:422561:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:3 hour fcst:
    -
    - - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/v0.html b/web_docs/v0.html deleted file mode 100644 index 485c11c..0000000 --- a/web_docs/v0.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -v, v0, v2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-v -
     
    - -

    wgrib2: -v -v0 -v2

    -
    - - -

    Introduction

    - -

    -Wgrib2 has multiple levels of verbosity. The lowest level (0) is -the default and set by --v0. The next level is 1 and is set by --v. Really verbose is set by --v2. Debugging is set by level 99. -Note that the verbosity can be changed multiple times on -the command line. - -

    Usage

    -

    -

    --v0
    --v
    --v2
    -
    - -

    Example

    -

    -

    --$ wgrib2 fcst.grb
    -1:4:d=2007032600:HGT:1000 mb:anl:
    -2:422561:d=2007032600:HGT:1000 mb:3 hour fcst:
    --$ wgrib2 fcst.grb -v
    -1:4:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:anl:
    -2:422561:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:3 hour fcst:
    --$ wgrib2 fcst.grb -v2
    -1:4:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:anl:
    -2:422561:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:3 hour fcst:
    -
    - - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/v1.html b/web_docs/v1.html deleted file mode 100644 index 485c11c..0000000 --- a/web_docs/v1.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -v, v0, v2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-v -
     
    - -

    wgrib2: -v -v0 -v2

    -
    - - -

    Introduction

    - -

    -Wgrib2 has multiple levels of verbosity. The lowest level (0) is -the default and set by --v0. The next level is 1 and is set by --v. Really verbose is set by --v2. Debugging is set by level 99. -Note that the verbosity can be changed multiple times on -the command line. - -

    Usage

    -

    -

    --v0
    --v
    --v2
    -
    - -

    Example

    -

    -

    --$ wgrib2 fcst.grb
    -1:4:d=2007032600:HGT:1000 mb:anl:
    -2:422561:d=2007032600:HGT:1000 mb:3 hour fcst:
    --$ wgrib2 fcst.grb -v
    -1:4:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:anl:
    -2:422561:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:3 hour fcst:
    --$ wgrib2 fcst.grb -v2
    -1:4:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:anl:
    -2:422561:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:3 hour fcst:
    -
    - - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/v2.html b/web_docs/v2.html deleted file mode 100644 index 485c11c..0000000 --- a/web_docs/v2.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -v, v0, v2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-v -
     
    - -

    wgrib2: -v -v0 -v2

    -
    - - -

    Introduction

    - -

    -Wgrib2 has multiple levels of verbosity. The lowest level (0) is -the default and set by --v0. The next level is 1 and is set by --v. Really verbose is set by --v2. Debugging is set by level 99. -Note that the verbosity can be changed multiple times on -the command line. - -

    Usage

    -

    -

    --v0
    --v
    --v2
    -
    - -

    Example

    -

    -

    --$ wgrib2 fcst.grb
    -1:4:d=2007032600:HGT:1000 mb:anl:
    -2:422561:d=2007032600:HGT:1000 mb:3 hour fcst:
    --$ wgrib2 fcst.grb -v
    -1:4:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:anl:
    -2:422561:d=2007032600:HGT Geopotential Height [gpm]:1000 mb:3 hour fcst:
    --$ wgrib2 fcst.grb -v2
    -1:4:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:anl:
    -2:422561:00Z26mar2007:HGT Geopotential Height [gpm]:lvl1=100000*10**0 lvl2=missing lvl1=(100,100000) lvl2=(255,missing):1000 mb:3 hour fcst:
    -
    - - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/var.html b/web_docs/var.html deleted file mode 100644 index 09e445d..0000000 --- a/web_docs/var.html +++ /dev/null @@ -1,240 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -var - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-var -
     
    - -

    wgrib2: -var, -ext_name, -set_ext_name

    -
    - - -

    Introduction

    - -

    In the beginning, grib fields were identified by a name, a level -and some timing information. Life was simple and the people were -happy. This was soon to pass, for the ensemble people had to -specify the ensemble number and the probability of events. -The dust people needed to specify dust density by -composition and by size. Thinking big, ensembles of dust -models were in the future albeit obscured by the haze. -Consequently the old name (ex. HGT, TMP) was often no longer -a good way to specify a specific field. For example, a -TMP field could be measured in degrees K or fraction -if the TMP had a probability modifier. The - -set_ext_name and -ext_name -options are a way to help fix this problem. Using these -two options, you can get a extended name with many of the -modfiers added to the name. This option will have to be -updated when more modifiers are used to distiguish the fields. - - - -

    -The -var option prints the VARIABLE name of -the grib message. Common names would be HGT and TMP for the geopotential -height and the temperature. For most knowing the variable name, -the level and the timimg information is all you need. Then things -became more complicated. Eventually a file came along which had only -one variable type (MASSDEN, mass density) but had a couple of -important qualifier chemical type (H2O/O3/N02) and ensemble member ID. -The -AAIG output was useless because its output -used the variable name. - -

    -To fix the -AAIG output, an extended name -was introduced. You can see the extended name by -the -ext_name option. - - -

    --sh-2.05b$ ./wgrib2 chem.grb2 
    -1:0:d=2009012600:MASSDEN:surface:anl:ENS=hi-res ctl chemical=Water Vapour
    --sh-2.05b$ ./wgrib2 chem.grb2 -ext_name
    -1:0:MASSDEN.hi-res_ctl.Water_Vapour
    --sh-2.05b$ ./wgrib2 chem.grb2 -misc 
    -1:0:ENS=hi-res ctl:chemical=Water Vapour
    -
    - -The extended name takes the output of -misc, -changes the colons to periods, spaces to underscores and removes the -text up to the equal size and appends it to the variable name. As of -wgrib2 v1.9.0, the extended name is used with --AAIGc, -csv, and -netcdf. -To stop using the extended name in -AAIG, -csv and -netcdf, use the option --set_ext_name 0. - - - -

    Usage

    - -
    --ext_var
    --set_ext_name 0/1
    --var
    -
    - -

    Examples

    - -
    --sh-2.05b$ ./wgrib2 chem.grb2 -var
    -1:0:MASSDEN
    --sh-2.05b$ ./wgrib2 chem.grb2 -ext_name
    -1:0:MASSDEN.hi-res_ctl.Water_Vapour
    -
    - - - -See also: --s, --varX -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/varX.html b/web_docs/varX.html deleted file mode 100644 index 5a031b5..0000000 --- a/web_docs/varX.html +++ /dev/null @@ -1,252 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -varX - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -varX -
     
    - -

    wgrib2: -varX

    -
    - - -

    Introduction

    - -

    -The -varX option writes a raw variable name. It -shows the discipline, master table, local table, center, parameter category -and parameter number. The default format is -

    - -
    -var{discipline}_{master table}_{local table}_{center}_{parameter_category}_{parameter}
    -
    -ex.  var0_10_1_57_1_51
    -       discipline = 0
    -       master table = 10
    -       local table = 1
    -       parameter category = 1
    -       parameter = 51
    -
    - -When you use verbose mode > 0 (-v, -v2, -v98, -v99), then the format -of -varX changes to - - -
    -(WMO defined variables)
    -
    -ex. var discipline=0 master_table=2 parmcat=2 parm=3
    -
    -For locally defined variables, the local table is important and the format is
    -
    -ex.  var discipline=0 local_table=1 center=7 parmcat=1 parm=195
    -
    - -One would use the -varX option when -the built-in tables have a problem. For example, suppose SGP -is a new parameter this is not in your version of wgrib2. -However, you want to write a script that will extract SGP -and work with both the -old and future versions of wgrib2. By using --varX, your inventories will have a variable -name that is the same in both versions of wgrib2. The varX name -has been added to the match_inventory (2.0.2 3/2015) and is -understood by -set_var and -set_metadata (2.0.7 12/2017). - - -

    Usage

    - -

    -

    --varX
    -
    - -

    Example

    -

    - -

    -$ wgrib2 test.grb2 -varX
    -1:0:var0_2_1_7_3_5
    -
    - -

    -See also: -var -

    - - - - - - - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page May 15, 2005, updated Jan 28, 2018 -
    - - - -

    -See also: -undefine -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/vector_dir.html b/web_docs/vector_dir.html deleted file mode 100644 index f1e1ca5..0000000 --- a/web_docs/vector_dir.html +++ /dev/null @@ -1,215 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -vector_dir - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-vector_dir -
     
    - -

    wgrib2: -vector_dir

    -
    - - -

    Introduction

    - -

    -Bit 5 of the flag 3.3 indicates whether vector quantities are relative to the -grid or the North/South poles. -The -vector_dir option writes out "winds(N/S)" or "winds(grids)" -depending on the value of the flag. Note there is no flag that indicates whether -the quantity is a U/V component of a vector. - - -

    Usage

    -

    - -

    --vector_dir
    -
    - -

    Example

    -

    - -

    -$wgrib2 png.grb2 -vector_dir
    -1:4:winds(N/S)
    -
    - -

    -See also: -

    - - - - - - - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/verf.html b/web_docs/verf.html deleted file mode 100644 index ad31c5c..0000000 --- a/web_docs/verf.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -s -verf - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -s -verf -
     
    - -

    wgrib2 macros: -s -verf -V

    -
    - - -

    Introduction

    - -

    -The -s, --verf -and -V -options are really macros -which are defined in the Macro.c file. The -s option is special because if there is no -"inv" option used, wgrib2 will add a -s option to the end of the argument list. - - -

    Usage

    -

    - -

    --s
    -      equivalent to -t -var -lev -ftime -ens
    -
    --verf
    -      equivalent to -vt -var -lev -ftime -ens
    -
    --V
    -      equivalent to -vt -lev -ftime -var -ens -stats -grid
    -
    -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/version.html b/web_docs/version.html deleted file mode 100644 index 4df5c4f..0000000 --- a/web_docs/version.html +++ /dev/null @@ -1,186 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -version - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-version, --version -
     
    - -

    wgrib2: -version, --version

    -
    - - -

    Introduction

    - -

    -The -version option prints the version, release date -and people who contributed code. The alias, ---version, was added 5/2016. - -

    Usage

    -

    - -

    --version
    ---version
    -
    - -

    Example

    -
    -$ wgrib2 -version
    -v0.1.7.7h-beta2 11/2008 Wesley Ebisuzaki, Jaakko Hyvätti, Kristian Nilssen
    -Karl Pfeiffer, Manfred Schwarb, Arlindo da Silva, Niklas Sondell, Sergey
    -Varlamov
    -
    - - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/vt.html b/web_docs/vt.html deleted file mode 100644 index f39ee5a..0000000 --- a/web_docs/vt.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -t -T -vt -VT - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 -t -T -vt -VT -
     
    - -

    wgrib2: -t -T -vt -VT

    -
    - - -

    Introduction

    - -

    -The -t -T -vt -VT options prints various time flags. -The -t -T prints the reference time -and -vt -VT prints the verification time. -The capitalized versions print the time with the seconds -and the lower case options print the time with out the seconds. -In conjuntion with -v2 verbose mode, the -format of the time will change to be GrADS compatible. - -

    Usage

    -
    --t
    --T
    --vt
    --VT
    -
    - -

    Example

    -

    - -

    -$ wgrib2 g720_360.grb2 -t
    -1:4:d=2009010100
    -$ wgrib2 g720_360.grb2 -t -v2
    -1:4:00Z01jan2009
    -$ wgrib2 g720_360.grb2 -T
    -1:4:D=20090101000000
    -$ wgrib2 g720_360.grb2 -vt
    -1:4:vt=2009010600
    -$ wgrib2 g720_360.grb2 -vt -v2
    -1:4:00Z06jan2009
    -$ wgrib2 g720_360.grb2 -VT
    -1:4:vt=20090106000000
    -
    - -See also: -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2_dev.html b/web_docs/wgrib2_dev.html deleted file mode 100644 index b6488fe..0000000 --- a/web_docs/wgrib2_dev.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - Climate Prediction Center - wgrib2 dev - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 dev -
     
    - -

    Developing wgrib2 code

    -
    - - - -

    Types of wgrib2 development

    -
    - -

    -There are 3 categories of wgrib2 development. -

      -
    1. Core development: ex grib encoders, geolocation, the "wgrib2" machine -
    2. Options: creating new wgrib2 options, can involve some core development -
    3. Interfaces for other languages to call the wgrib2 library. -
    - -

    Core Development

    - -

    -This type of development is the most critical to get right because -it can affect all uses of wgrib2. Typical changes to the core would -be a new table, new compression scheme or updating the grib variable table. -Send changes directly to wesley.ebisuzaki@noaa.gov. - -

    Options

    -Options are are not as critical as the core because problems in a -new or modified option are usually limited to that option. Consequently -options can have an alpha or beta status independant of wgrib2. - -

    Options can be added quite easy. You add the source code of the option to -the directory with the other options, and build wgrib2. The build -system integrates the option into wgrib2. -Writing options requires you to follow some rules but once you -learn the rules, it is easy. That is why wgrib2 has over 300 options. - -

    More details are given here - - -

    Allowing external programs to use wgrib2

    - -fortran: ftn_wgrib2api
    -python: pywgrib2_s
    -Developting code that uses libwgrib2 -

    - - -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sep 16, 2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2_hello_world.html b/web_docs/wgrib2_hello_world.html deleted file mode 100644 index 478bd7e..0000000 --- a/web_docs/wgrib2_hello_world.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - Climate Prediction Center - wgrib2 dev - hello world - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 dev -
     
    - -

    Hello World as an option

    -
    - -

    -The file, Hello_world.c, is the source code for a wgrib2 option -that prints "hello world", the size of grid, and the contents of -a user-selected grid point. To install this option, you -copy Hello_world.c to (whatever)/grib/wgrib2/ and then build wgrib2. - - - -

    Hello_world.c

    - - -
    -#include <stdio.h>
    -#include <stdlib.h>
    -#include <string.h>
    -#include "wgrib2.h"			needed
    -#include "fnlist.h"                     needed
    -
    -/*
    - * HEADER:100:hello_world:inv:1:print hello world and data[x]   HEADER SECTION
    - */HEADER:display number:name:type:num args:description
    -
    -extern int decode;
    -
    -int f_hello_world(ARG1) {     option is hello_world with one argument
    -    long int i;
    -
    -    if (mode == -1) {
    -        // open files, allocate memory, request services
    -        decode = 1;	      have wgrib2 decode the grid values
    -    }
    -    else if (mode >= 0) {     verbosity when ≥ 0
    -        // processing phase
    -        i = atol(arg1);
    -        if (data && i < ndata && i >= 0) {
    -            sprintf(inv_out,"hello world ndata=%u data[%ld]=%f",
    -                ndata, i, data[i]);
    -        }
    -        else sprintf(inv_out,"hello world no data");
    -
    -    }
    -    else if (mode == -2) {
    -        // close files, free memory
    -    }
    -    return 0;
    -}
    -
    -Navigation: back -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created Nov 5, 2020. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2_memory.html b/web_docs/wgrib2_memory.html deleted file mode 100644 index f17783b..0000000 --- a/web_docs/wgrib2_memory.html +++ /dev/null @@ -1,251 +0,0 @@ - - - - Climate Prediction Center - wgrib2api: grb2_free_file - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api: memory buffers/files -
     
    - -

    wgrib2api: memory buffers/files

    -
    - - -

    Introduction

    -

    -Wgrib2api can be used to read from and write to grib files which -is great for non-HPC applications. For HPC, you want to parallelize the -encoding and decoding of the grib messages. This can be done -using memory buffers (memory files in wgrib2 terminology) instead of disk files. -As a practical matter, wgrib2api does not support filelocks and only one -instance of wgrib2api should be allowed to write to any disk file. Instead -you have to use memory files where each instance of wgrib2api has its own independent -copy of the memory files. For example, -writing the inventory to memory file 0 can be done by, - - -

    -   i = grb2_mk_inv('MYDATA.GRB', '@mem:0')         ! write index/inventory memory file 0
    -
    - - -Suppose that you want to copy grib data to memory file 0, create an -inventory using memory file 1 and then read the Z500 field from memory -file 0. The code segment will go like, - - -
    -    use wgrib2api
    -    real, allocatable :: grid(:,:)
    -
    -!   character (len=1) buff(1000000)
    -!   buff contains a grib message
    -
    -!   copy buff to memory buffer/file 0
    -    i = wgrib2_set_mem_buffer(buf, 1000000, 0)
    -    if (i.ne.0) stop 1
    -
    -    i = grb2_mk_inv('@mem:0', '@mem:1')
    -    if (i.ne.0) stop 2
    -
    -    i = grb2_read('@mem:0', '@mem:1', ':HGT:500 mb:', data2=grid)
    -    if (i.ne.1) stop 3
    -
    -    write(*,*) ' read Z500 from buf(*) z(20,20)=', grid(20,20)
    -    stop
    -    end
    -
    -
    - -You can encode grib to a memory file by, - -
    -    use wgrib2api
    -    real, allocatable :: grid(:,:)
    -    character, (len=1), allocatable :: buffer(:)
    -
    -    nx=360
    -    ny=181
    -    allocate(grid(nx,ny))
    -    read(11) grid
    -    i = grb2_wrt('@mem:0','TEMPPLATE.grb',1,data2=grid,meta='D=20170102030000:HGT:500 mb:anl:')
    -    if (i .ne. 0) stop 1
    -    n = wgrib2_get_mem_buffer_size(0)
    -    allocate (buffer(n))
    -    i = wgrib2_get_mem_buffer(buffer, n, 0)
    -
    -
    - -

    Usage

    -
    -   SIZE = wgrib2_get_mem_buffer_size(FILE_NUM)
    -       returns the size of memory file '@mem:FILE_NUM'
    -       FILE_NUM:   integer, memory file number, 0..19
    -       SIZE:       integer, size of memory buffer
    -
    -   i = wgrib2_get_mem_buffer(BUFFER, SIZE, FILE_NUM)
    -       copies memory file '@mem:FILE_NUM' to BUFFER(1:SIZE)
    -       BUFFER:     character (len=1) BUFFER(1:SIZE), read from memory file
    -       SIZE:       integer size to transfer, use get_mem_buffer_size(FILE_NUM)
    -       FILE_NUM:   integer, memory file number
    -       i:          integer, return code, 0 = worked
    -
    -   i = wgrib2_set_mem_buffer(BUFFER, SIZE, FILE_NUM)
    -       copies BUFFER to memory file '@mem:FILE_NUM'
    -       BUFFER:     character (len=1) BUFFER(1:SIZE), write to memory file
    -       SIZE:       integer size to transfer
    -       FILE_NUM:   integer, memory file number
    -       i:          integer, return code, 0 = worked
    -
    -

    Wgrib2api is made of a high level (grb2_*) functions -and low_level functions. The low level routines can be -found in wgrib2lowapi and are named wgrib2_*. - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 13, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2_options.html b/web_docs/wgrib2_options.html deleted file mode 100644 index dff163b..0000000 --- a/web_docs/wgrib2_options.html +++ /dev/null @@ -1,279 +0,0 @@ - - - - Climate Prediction Center - wgrib2 dev options - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 dev -
     
    - -

    Developing wgrib2 code

    -
    - - - -

    Writing Options

    -
    - -

    -Every programming book has a "hello world" program. It's -there to give you a flavor of the language and show the -reader that writting a program is not hard. - -

    -Adding -hello_world - - -

    Ruiles

    - -
      -
    1. C source code file name must start with a capital. -
    2. Option has to have a Header section, and specific includes. -
    3. Option routine has to have a specific name and arguments. -
    4. Static variables for the option routine have to be done in a special way. -
    5. option routine is called before processing with mode == -1 for initialization. -
    6. option routine is called for each grib field with mode >= 0 (mode = verbosity) -
    7. option is called after before processing with mode == -2 for cleanup. -
    8. I/O is done differently to handle memory files and other special files. -
    9. extra processing such a decoding the grib message has to be requested by the option. -
    - -

    HEADER

    - -

    The build system uses wgrib2/function.sh to scan for -all C source files starting with an upper case. Function.sh -looks for lines starting with "/* HEADER:", can then -gnerates wgrib2/fnlist.c and wgrib2/fnlist.h which -contains a list of all the options and the prototypes. -Wgrib2, when it "compiles" the command line, will search -the list to find the number of arguments and location of -the option code. The fields in the HEADER line are - -

    -/* HEADER:NUM:OPTION:TYPE:NARGS:TXT
    -   NUM = integer for determining whether shown in -h
    -         in the future, it may be used for sorting list of options
    -   OPTION = string, the name of the option
    -            note: the option function is named f_OPTION
    -   TYPE = string, type of option    see enum fntype in wgrib2.h
    -          inv = write to inventory
    -          output = write to an output file
    -          setup = change setup (only called in the initialization phase)
    -          misc = not one of the above
    -          IF = if type option
    -          Else = Else option
    -          Elseif =  elseif type option
    -          Endif = endif option
    -          Null = nothing
    -          misc = not one of the above
    -   NARGS = integer, number of arguments the option takes
    -   TXT = string, description of the option
    -
    - -

    C option code

    - -

    -Wgrib2 assumes that the option will be - -

    -int f_OPTION(ARGN) {
    -   ...
    -   return status
    -}
    -
    -   ARGN = ARG0 (no argument)
    -          ARG1 (one argument)
    -          ..
    -          ARG8 (eight arguments)
    -   status == 0 if sucessful
    -          != 0 if error
    -
    -
    - -

    Arguments to f_OPTION

    - -

    -The argument to f_OPTION is ARGN which is defined in wgrib2.h. -ARGN provides -

    -    unsigned char **sec;   grib message
    -    float *data;           decoded grid point values (if an option requests it)
    -    unsigned int ndata     number of grid points
    -    char *inv_out          buffer that will be printed to inventory
    -    void **local           used for static variables
    -
    - - -

    Static variables

    - -

    -C and fortran allow functions to have static variables but -each static variable unique to that function. -Wgrib2 allows the same option to be repeated many times on -the command line. For example, - -

    -  wgrib2 in.grb -lon 0 0 -lon 10 12 -lon 22 -49
    -    calculate nearest neighbor once for each call to f_lon
    -  wgrib2 in.grb -if ':HGT:' -bin H.grb -else -bin rest.grb -endif
    -    open file once
    -  wgrib2 in.grb -if ":HGT:500 mb:' -fcst_ave 6hr z500.grb -elseif ":TMP:500 mb:" -fcst_ave 6hr t500.grb -endif
    -
    - -So each option on the command line may need to have its own static variables. -So the static variables provided by C are insufficient. Wgrib2 calls each -option with a unique pointer that the can be used by the option to provide -static variables. - - - -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Sep 16, 2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2_scripts.html b/web_docs/wgrib2_scripts.html deleted file mode 100644 index 447a633..0000000 --- a/web_docs/wgrib2_scripts.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - Climate Prediction Center - wgrib2 script library - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 library -
     
    - -

    wgrib2 script library

    -
    - - -

    Introduction

    - -

    -Embedding wgrib2 into scripts is useful for a couple of reasons, - -

      -
    1. use wgrib2 as building block -
        -`
      • grib reader for other programs (ex matlab) -
      • grib writer for other programs (ex GrADS) -
      • extracting metadata (ex. making control files for GrADS) -
      • processing files (ex. NOMAD's g2subset) -
      -
    2. Special wgrib2 processing needs to process the grib data in a special order -
        -
      • -wnd_speed needs (U,V) (U,V) (U,V) order -
      • -ave needs (A0..An) (B0..Bn) (C0..Cn) .. order -
      • -merge_fcst needs (A0..An) (B0..Bn) (C0..Cn) .. order -
      • -ncep_norm needs (A0..An) (B0..Bn) (C0..Cn) .. order -
      • -wind_speed needs (A0..An) (B0..Bn) (C0..Cn) .. order -
      • -ncep_norm needs (A_t0, A_t1, .. A_tn) (B_t0, B_t1, .. B_tn) .. order -
      • -wind_speed needs (U,V) (U,V) (U,V) order -
      • -new_grid (U,V) (U,V) (U,V) order -
    -

    Building block scripts

    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: May 15, 2005 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2_utility_callable.html b/web_docs/wgrib2_utility_callable.html deleted file mode 100644 index fca3f97..0000000 --- a/web_docs/wgrib2_utility_callable.html +++ /dev/null @@ -1,244 +0,0 @@ - - - - Climate Prediction Center - wgrib2: callable_wgrib2 vs utility - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 utility vs library -
     
    - -

    Callable wgrib2 vs utility

    -
    - - -

    Introduction

    - -

    -Wgrib2 can either be used as a utility or as library which can be called -by a C, Fortran or Python programs. This wgrib2 library is a high -level interface, for grib encoding and decoding based on the wgrib2 utility. -To avoid being I/O bound, the calling program can read and -write the RPN registers as well as the memory files through library -routines. There are some differences between wgrib2 the utility and -the library. The differences are based on the persistance or lifetime -of objects. - -

    Opening and Closing of files is slow

    - -Needless opening and closing of files can be time consuming. To a PC with -a SSD directly connected to the system bus, it is fast. - - -Open Files are not closed - -Suppose a Python program did the following, - -
    - err = pywgrib2_s.wgrib2( ['gfs.grb', '-match', ':HGT:500 mb:',  '-grib' , 'out.grb' ] )
    - err = pywgrib2_s.wgrib2( ['gfs.grb', '-match', ':HGT:200 mb:',  '-grib' , 'out.grb' ] )
    -
    -On the first line, the files 'gfs.grb' and 'out.grb' are opened but not closed when the
    -first line is finished. If the first line will take all messages that match ':HGT:200 mb:"
    -and write them to 'out.grb'.
    -
    -The second line, uses the already opened files 'gfs.grb' and 'out.grb'.  The intent
    -was to copy the 200 mb HGT fields to 'out.grb', but the line does nothing.  The problem
    -was the first line opened 'gfs.grb', and left the file pointer at the end of the file.
    -The correct solution is,
    -
    - err = pywgrib2_s.wgrib2( ['gfs.grb', '-match', ':HGT:500 mb:',  '-grib' , 'out.grb' ] )
    - err = pywgrib2_s.wgrib2( ['gfs.grb', '-rewind_init', 'gfs.grb', '-match', ':HGT:200 mb:',  
    -        '-grib' , 'out.grb' ] )
    -
    -The equivalent wgrib2 commands are
    -
    -   wgrib2 gfs.grb -match ':HGT:500 mb;' -grib out.grb
    -   wgrib2 gfs.grb -match ':HGT:200 mb;' -append -grib out.grb
    -
    -You can get the equivalent in python by closing the files after every call to wgrib2
    -
    - err = pywgrib2_s.wgrib2( ['gfs.grb', '-match', ':HGT:500 mb:',  '-grib' , 'out.grb' ] )
    - err = pywgrib2_s.close('gfs.grb')
    - err = pywgrib2_s.close('out.grb')
    - err = pywgrib2_s.wgrib2( ['gfs.grb', '-match', ':HGT:200 mb:',  '-append', '-grib' , 'out.grb' ] )
    - err = pywgrib2_s.close('gfs.grb')
    - err = pywgrib2_s.close('out.grb')
    -
    -This is not a recommended solution because opening and closing files is time consuming.
    -
    - - -

    -Besides "rewinding" input files by the -rewind_init option, you have to be aware -the output files are not completely written until the file is closed or the program ends. -The final writes to the output file may still be in a buffer until the file is flushed by -closing of the file. Th exception is the memory file. The write to a memory file -is not buffered, so the memory file is complete after the write. However, the -write to a memory file leaves the file pointer at the end of the file. To read -the memory file, you have to do a -rewind_init. - -

    - err = pywgrib2_s.wgrib2( ['gfs.grb', '-match', ':HGT:500 mb:',  '-grib' , 'out.grb' ] )
    - err = pywgrib2_s.close('out.grb) 
    - err = pywgrib2_s.wgrib2( ['out.grb', '-rpn', 'sto_1'] )
    -
    -line 1 write 500 mb HGT to 'out.grb'
    -line 2 closes 'out.grb' and finishes any pending writes
    -line 3 read 'out.grb' and stores the values in register 1
    -
    - err = pywgrib2_s.wgrib2( ['gfs.grb', '-match', ':HGT:500 mb:',  '-grib' , '@mem:0' ] )
    - err = pywgrib2_s.wgrib2( ['@mem:0', '-rewind_init', '@mem:0', '-rpn', 'sto_1'] )
    -
    -line 1 write 500 mb HGT to memory file 0, write is not buffered
    -line 2 reads from memory file 0, does a rewind prior to reading, stores values in register 1
    -
    -

    -See also: -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: July 10, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2_v3.0.0_changes.html b/web_docs/wgrib2_v3.0.0_changes.html deleted file mode 100644 index c944f4a..0000000 --- a/web_docs/wgrib2_v3.0.0_changes.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - Climate Prediction Center - wgrib2: Changes with v3.0.0 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 Changes with v3.0.0 -
     
    - -

    wgrib2: V3.0.0

    -
    - - -

    Changes from wgrib2 v2.0.8 to v3.0.0

    - -

    -Wgrib2 gets a new numbering convention (XX.YY.ZZ). - -

    -   new wgrib2 numbering convention XX.YY.ZZ
    -
    -   XX = incremented with major source code changes (infrequently)
    -   YY = incremented with software code changes (approximately yearly releases)
    -   ZZ = incremented with minor code releases
    -
    -

    -Normally wgrib2 gets updated annually. It ususally takes -that long to get enough updates to make it worthwhile for an upgrade. Of course, -some users may need that latest feature and need the latest ZZ release. The -schedule of the annual releases can vary widely. The expected Feb 2020 release -was delayed to September 2020 to incorporate a python interface. - -

    Hightlights for v3.0.0

    - -

    The upgrade from v2.0.8 was deemed a major release because -of the new IF-block structure and the shared library for python. -Scripts written with the new IF block structure are not downward -compatible, and I think that the python interface is a big deal. - -

      -
    • A real if/elseif/else/endif structure -
    • -import_grib_fs, import grib2 that matches a text string -
    • -new_grid location, interpolate to specified locations -
    • -new_grid_format: can write interpolated fields to grib, binary or ieee -
    • support of AOCC (AMD Optimizing C Compiler), based on clang/flang -
    • updated grib variable table -
    • fixed and increased functionality of -import_netcdf -
    • -ens_processing: do not use v2.0.8, major problem with some versions of gcc -
    • added spectral interpolation to -new_grid -
    • support making shared library (gnu compilers under linux and MacOS) -
    • support for python interface (linux, MacOS) -
    - - - -Wesley Ebisuzaki, 5/4/2020, revised 9/22/2020, 11/13/2020 - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page dates: May 4, 2020, modified 9/2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2_v3.0.2_changes.html b/web_docs/wgrib2_v3.0.2_changes.html deleted file mode 100644 index de22fd4..0000000 --- a/web_docs/wgrib2_v3.0.2_changes.html +++ /dev/null @@ -1,216 +0,0 @@ - - - - Climate Prediction Center - wgrib2: Changes with v3.0.2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 Changes with v3.0.2 -
     
    - -

    wgrib2: v3.0.2

    -
    - - -

    Changes from wgrib2 v3.0.0 to v3.0.2

    - -

    -Note that the file server (ftp.cpc.ncep.noaa.gov) had the wrong files for v3.0.1. The -source code was for a older beta version. So wgrib2 v3.0.1 has been erased -from history. Wgrib2 v3.0.2 is basically v3.0.1 plus with a minor upgrade to -"extended names". The extended names can now optionally include the level and -and forecast time information. This change allows -netcdf to produce unique -variable names for fields that previously would have had the same name. - -

    -Wgrib2 v3.0.2 is a minor upgrade to v3.0.0. Rather than accumulating -updates and new features for 12+ months, v3.0.1 is a relatively quick update -that is needed for gnu make v4.3, and for providing initial python support -on Windows (pywgrib2, cygwin). So that was the plan. - -

    I had deferred adding D Jovic's code for using the OpenJPEG -library for supporting jpeg2000 until the release of wgrib2 v3.0.0. It -is now a compile time option. - -

    M Schwarb sent me scripts that would read the ECMWF grib tables -from the web -and convert them to a format suitable for wgrib2. This lead to adding -the -names option and adding the DWD grib tables. Of course, -a wgrib2 update is not finished unless there several new options. - -

    G Trojan worked on the fatal error handler, and that -resulted in the removal of several routines, and cleaner code. - -

    Delayed fatal errors were added. This allows wgrib2 to flag an error, -and error out at the end of processing of the grib message. This -allows the user to "debug" the grib message which caused the fatal error. -In addition, delayed fatal errors can be converted to warnings. - -

    For python, wgrib2 has options to read and write grib sections. - -

    New compilers, means new warning and error messages. Fixed -an error that would be triggered if your keyboard generated characters -with the high bit (128) set and your compiler defines char as signed char. - -

    Added support for Nvidia compilers from the Nvidia HPC SDK for building -the wgrib2 executable and shared library. Previous -versions of the Nvidia compilers (old branding: Portland) had problems -compiling wgrib2. - -

    Added support for AOCC to compile a shared library for pywgrib2. - -

    Added support for cygwin (Windows) to compile a shared library for pywgrib2. -Unfortunately the shared library does not support jpeg2000 or png compression -because they use the zlib which refers to an undefined routine. - -

    Fixed -new_grid with interpolation ot user-specified locations. I -forgot to set the discpline of GEOLAT/GEOLON. - -

    An update to ncep grib tables. -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page dates: 2/17/2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2_v3.1.0_changes.html b/web_docs/wgrib2_v3.1.0_changes.html deleted file mode 100644 index 7990396..0000000 --- a/web_docs/wgrib2_v3.1.0_changes.html +++ /dev/null @@ -1,186 +0,0 @@ - - - - Climate Prediction Center - wgrib2: Changes with v3.0.3 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 FUTURE Changes with v3.0.3 -
     
    - -

    wgrib2: v3.1.0

    -
    - - -

    Future Changes from wgrib2 v3.0.2 to v3.1.0

    - -
      Big changes .. many inventory changes -
    1. wgrib2 upto v3.0.2 used NCEP web pages for table descriptions (scripts by M. Schwarb) -
    2. wgrib2 v3.1.0+ uses the WMO github for table descriptions (except field names) (scripts by M. Schwarb) -
    3. updated NCEP, ECMWF and DWD field names -
    4. old inv: :(chemical name): new inv: :chemical=(chemical name): -
    5. old inv: :process (number): new inv: :process=(number): -
    6. previous two changes are to make inventory consistent with -set_metadata -
    7. more compatibility for -set_metadata (wgrib2 file >inv; wgrib2 file -set_metadata inv) -
    - -
      Fix for PNG decoder -
    1. Can now handle PNG compressed grib files that use a bit depth of 1, 2 and 4 -
    2. previously library could only handle 8 and 16 bit depths -
    - -
      Other Changes -
    1. Public release source code, wgrib2.tgz, is now compatible with a BSD-varient tar -
    2. -reset_delayed_error: remove writes to stdout -
    3. -ndates: removed limit on size of output -
    4. nearest neighbor for global Gaussian grid is now a calculation rather than search -
    5. bug fix in -import_grib and -import_grib_fs when main input is an incorrectly encoded NCEP constant field,
      - the message read by -import_grib and -import_grib_fs will be incorrectly fixed. -
    -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page dates: 4/26/2021 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2_v3.1.1_changes.html b/web_docs/wgrib2_v3.1.1_changes.html deleted file mode 100644 index 2f58a24..0000000 --- a/web_docs/wgrib2_v3.1.1_changes.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - Climate Prediction Center - wgrib2: Changes with v3.0.3 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 FUTURE Changes with v3.0.3 -
     
    - -

    wgrib2: v3.1.1

    -
    - - -

    Changes from wgrib2 v3.1.0 to v3.1.1

    - -

    Wgrib2 v3.1.1 is a minor release that addresses problems with - -

      -
    1. check_pdt_size causes fatal error for some ECMWF and ICON files
      -work around for older versions: -check_pdt_size 0 -
    2. -unix_time fails with new glibc (random failures)
      -work around for older versions: $TZ should not be UTC, or a daylight saving time -
    - -
      Highlights -
    1. fixed check_pdt_size: added more PDTs, support for vertical coordinates -
    2. fixed and updated: -unix_time failed with new glibc -
        -
      • -unix_time: converted from posix to C89 code, and no longer optional -
      • -set_date: now understands unix time (seconds after start of Jan 1, 1970) -
      • -import_netcdf: display unix time codes in YYYYMMDDHH(mmss) format -
      • many minor changes -
      -
    3. ECMWF ensemble files: if code table 4.7 undefined, set to reasonable value -
    4. -set_pdt: major changes, handles more PDTs, much better -
    5. Early testing of Netcdf4 compiled with Ubuntu 20.04LTS is promising. -
    -

    Future Changes for wgrib2 v3.1.2

    -

    -Added better support for grids up to 2**32-1 (4,294,967,295) -grid points. This endeavor started in 2016. Progress -started slowly because of the lack of large-memory machines and urgency. -However, I received my first bug report about the 4G problem. -

    -Cmake is required for latest libaec. So the makefile is now -cmake aware. You can build wgrib2 without cmake but you will not be -able to install libaec or OpenJPEG. -

    -The parallelization of the uncompressing of complex-compressed files -was improved. Decoding of the GFS master file went from 14 seconds -to 9 seconds on a 6-core ryzen 5600g cpu using a nmve drive. Unfortunately -the speed was slow and unimproved on a Luster file system. -

    -Previous versions of wgrib2 handled non-spherical Lambert Azimuthal Equal Area Projection -using a spherical earth. Now this projection is handled by proj4 which means that -proj4 is now installed by default. -

    -The geolocation tag (-geolocation) is better defined (external added). Output is -changed from "XYZ" to "geolocation=XYZ". -

    -Alpha: USE_NETCDF4 redefined and USE_HDF5 added. The change -allows linking to precompiled NetCDF/HDF5 libraries. -

    -Alpha: compiling with Intel's oneAPP icx and ifx compilers. -Icx had a problem executing one OpenMP loop. Either -the loop is incorrect and several compilers have been -accidently generating "correct" code for years, or icx is -silently generating bad code. Anyways this is why wgrib2 -compiled by icx/ifx is considered alpha status. -

    -Update for local JMA product definition templates. - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page dates: 4/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2_v3.1.2_changes.html b/web_docs/wgrib2_v3.1.2_changes.html deleted file mode 100644 index 01efff9..0000000 --- a/web_docs/wgrib2_v3.1.2_changes.html +++ /dev/null @@ -1,262 +0,0 @@ - - - - Climate Prediction Center - wgrib2: Changes with v3.1.2 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 FUTURE Changes with v3.0.3 -
     
    - -

    wgrib2: v3.1.2

    -
    - - -

    Changes from wgrib2 v3.1.1 to v3.1.2

    -

    Wgrib2 v3.1.2 is a minor release.

    - -

    -Added better support for grids up to 2**32-1 (4,294,967,295) -grid points. This endeavor started in 2016. Progress -started slowly because of the lack of large-memory machines and urgency. However, I received my first bug report about the 4G problem. -

    -The makefile is now CMake aware. Without CMake, you will not -be able to install libaec or OpenJPEG. Previously CMake was -not necessary but libaec and OpenJPEG would only work on -intel/amd machines. -

    -The parallelization of the uncompressing of complex-compressed files -was improved. Decoding of the GFS master file went from 14 seconds -to 9 seconds on a 6-core ryzen 5600g cpu using a nmve drive. Unfortunately -the speed was slow and unimproved on a Luster file system. -

    -Previous versions of wgrib2 handled non-spherical Lambert Azimuthal Equal Area Projection -using a spherical earth. Now this projection is handled by proj4 which means that -proj4 is now installed by default. -

    -The geolocation tag (-geolocation) is better defined (external value was added). Output is -changed from "XYZ" to "geolocation=XYZ". -

    -Alpha: USE_NETCDF4 redefined and USE_HDF5 added. The change -allows linking to precompiled NetCDF/HDF5 libraries. -

    -Alpha: compiling with Intel's oneAPP icx and ifx compilers. -Icx had a problem executing one OpenMP loop. Either -the loop is incorrect and several compilers have been -accidently generating "correct" code for years, or icx is -silently generating bad code. Anyways this is why wgrib2 -compiled by icx/ifx is considered alpha status. -

    -Update for local JMA product definition templates. - -

    Fixes for v3.1.2 #1

    -

    -

    -USE_SHARED_LIB=1   fails, need to modify grib2/makefile
    -
    ------ old grib2/makefile
    -${zlib}:        ${zdir}
    -        # cd ${zdir} && export CFLAGS="${wCPPFLAGS}" && ./configure --prefix=${cwd} --static && ${MAKE} install
    -        cd ${zdir} && export CFLAGS="" && ./configure --prefix=${cwd} --static && ${MAKE} install
    ------ fixed grib2/makefile
    -${zlib}:        ${zdir}
    -        cd ${zdir} && export CFLAGS="${wCPPFLAGS}" && ./configure --prefix=${cwd} --static && ${MAKE} install
    -        # removed 3/2023 cd ${zdir} && export CFLAGS="" && ./configure --prefix=${cwd} --static && ${MAKE} install
    -------
    -
    -This is plain old fashioned bug that only affects wgrib2 v3.1.2. It is -a fix that didn't fix anything. - -

    Fixes for v3.1.2 #2

    -

    -

    -Proj fails to build using gcc on MacOS. Need to compile proj4 without -ffast-math
    -
    ------ old grib2/makefile
    -ifeq (${COMP_SYS},gnu_linux)
    -   wCPPFLAGS+=-Wall -Wmissing-prototypes -Wold-style-definition -Werror=format-security -ffast-math -O3
    ------ new grib2/makefile
    -ifeq (${COMP_SYS},gnu_linux)
    -   wCPPFLAGS+=-Wall -Wmissing-prototypes -Wold-style-definition -Werror=format-security -O3
    -------
    -
    -Usually fast-math only has minor impacts on the precision. However the differences -were enough to trigger the Proj validation routines. Wgrib2 v3.1.2 turn off fast-math. - -

    Fixes for v3.1.2 #3

    -

    -

    -OpenJPEG fails to build because of missing libraries.  You need to build
    -the third party libraries which are used the OpenJPEG auxilary programs but not 
    -used by the OpenJPEG library.  However, building the
    -third party software fails on my Ubuntu system.  So I will wait for the
    -OpenJPEG build to be fixed before making the third party software the 
    -default in the wgrib2 build. (Tested using OneAPI.)
    -
    ------ old grib2/makefile
    -        cd ${openjpegdir}/build && cmake .. -DZLIB_INCLUDE_DIR=${cwd}/include -DZLIB_LIBRARY=${zlib} -DPNG_LIBRARY=${pnglib} -DPNG_PNG_INCLUDE_DIR=${cwd}/include -DCMAKE_C_COMPILER=${CC} -DCMAKE_POSITION_INDEPENDENT_CODE:bool=ON && make
    ------ new grib2/makefile
    -        cd ${openjpegdir}/build && cmake .. -DZLIB_INCLUDE_DIR=${cwd}/include -DZLIB_LIBRARY=${zlib} -DPNG_LIBRARY=${pnglib} -DPNG_PNG_INCLUDE_DIR=${cwd}/include -DCMAKE_C_COMPILER=${CC} -DCMAKE_POSITION_INDEPENDENT_CODE:bool=ON -BUILD_THIRDPARTY:BOOL=ON && make
    -------
    -
    - -

    Future Changes for v3.1.3

    -
      -
    • Support for OpenMP 3.1, 4.0, 4.5, 5.0 (old: 3.1) -
    • testing SIMD using OpenMP 4.0 -
    • plan to test GPU using OpenMP 5.0 -
    • -ens_processing and -new_grid could use a GPU because parallelized over number of grid points -
    • other loops are parallized over smaller numbers, so GPU is not ideal -
    • so that is why OpenMP added the collapse clause -
    • fixes for makefile (backported to v3.1.2) -
    • installing the AEC library is now default, requiring a recent CMake to build -
    • Found bug in -set_bitmap 1 code. Will release wgrib2 v3.1.3 ASAP (ed. 10/23/2023). -
    - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page dates: 4/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2_v3.1.3_changes.html b/web_docs/wgrib2_v3.1.3_changes.html deleted file mode 100644 index c7dad9e..0000000 --- a/web_docs/wgrib2_v3.1.3_changes.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - Climate Prediction Center - wgrib2: Changes with v3.1.3 - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2 Changes with v3.1.3 -
     
    - -

    wgrib2: v3.1.3

    -
    - -

    Changes from wgrib2 v3.1.2 to v3.1.3

    - -

    Bug fix for -set_bitmap 1

    -

    -Complex-packed grib files have good compression with highly -parallelized decompression. Complex packing has two ways -of storing undefined values, either in bitmap or by encoding -a special value. A bitmap takes 1 bit per grid point, and -a high resolution gfs files typically uses 3-5 bits per -grid point. So storing undefined values typically takes -25% more space than using a special value. Using a bitmap -is inefficient; however, some codes cannot handle storing -undefined as a bitmap. So some operational files from NCEP -use complex packing with a bitmap. To generate such files -using wgrib2, the option "-set_bitmap 1" has to be used. - -

    -A bug was introduced to the wgrib2 where creating complex -files with a bitmap was flawed. The calculation of the range -of the field as flawed and field was truncated to a constant -field. The "optimization" was fixed removing this bug. This -bug only affected new versions of wgrib2 when using "-set_bitmap 1". - -

    ECMWF uses AEC compression

    -

    -ECMWF is producing grib files using AEC compression. By making AEC a default option, -wgrib2 needs to be built using a recent version of CMake. Once CMake becomes a -requirement for the default build, Jasper can be replaced by the long planned -OpenJPEG for jpeg2000 support. You can still build wgrib2 without CMake but you will -have to turn off AEC and replace OpenJPEG by Jasper in the makefile. The output -files created by Jasper and OpenJPEG are not bit identical but decode to -identical numbers in my testing. - -

    -Wgrib2 v3.1.3 is still including proj4 as one of its geolocation libraries. -Removing proj4 means that aspherical-earth equal area Lambert is unsupported. -Some compilers do not support proj4 which is an old version of the Proj library. -Moving to a new version of Proj is ideal but there were some API changes. - -

    Changes for v3.1.3

    -
      -
    • Support for OpenMP 3.1, 4.0, 4.5, 5.0 (prior: 3.1) -
    • added SIMD pragmas which are used if OpenMP support them -
    • testing AVX2 and AVX512 enabled -
    • support for proj4 on Mac -
    • makefile fixes to compiling shared lib, OpenJPEG -
    • NCEP grib tables updated 4/2022. -
    - -The trade offs between using SIMD vs threading is an interesting -subject. For short loops, SIMD has no overhead and will be -faster than threading. For long loops, memory bandwidth will -limit the speed. So threading could use more memory controllers -and have a faster speed. The ideal is for the threaded section -to have loops that can be speed up using SIMD. Unfortunately -that doesn't occur that frequently. - -

    Future Changes for v3.1.4

    -
      -
    • integrate development with NCEPlibs: github, cmake -
    • until the v3.1.4 is released, the github will be used to get convert to the new workflow -
    • updated grib tables -
    • added -lvl, -set_lvl1, -set_lvl2 (low level level options) -
    • added more levels -
    -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page dates: 4/2022 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2api.html b/web_docs/wgrib2api.html deleted file mode 100644 index 3369c47..0000000 --- a/web_docs/wgrib2api.html +++ /dev/null @@ -1,370 +0,0 @@ - - - - Climate Prediction Center - HOME: ftn_wgrib2api - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > ftn_wgrib2api -
     
    - -

    HOME: ftn_wgrib2api

    -

    The Easy Way of Reading and Writing Grib2 Using Fortran

    -
    - - -

    Introduction

    - -

    -Can a set of fortran routines make reading and writing grib2 easy? -Is it possible? -Can you read grib2 without referring to a the WMO grib standard? -Can you write grib2 without becoming an grib2 expert? Is reading and writing grib -now easier than other popular file formats? - - -

    -!       read 6 hour forecast from z500 field from file 'FILE.grb2'
    -
    -        use wgrib2api
    -	real, allocatable :: grid(:,:)
    -
    -	iret = grb2_mk_inv('FILE.grb2','FILE.inv')	              ! make index/inventory file, FILE.inv
    -	if (iret.ne.0) stop 1
    -
    -!       search index file for terms: ':HGT:500 mb:' and ':6 hour fcst:'
    -	iret = grb2_inq('FILE,grb2','FILE.inv',':HGT:500 mb:',':6 hour fcst:',data2=grid)
    -	if (iret.ne.1) stop 2                                         ! error if not 1 match
    -	write(*,*)'It was easy!  Z500 fhr=6 grid(10,12) =', grid(10,12)
    -
    -	stop
    -	end
    -
    - - -

    -Reading doesn't get much easier than that. You are allowed upto 20 search terms that are -based on the wgrib2 inventory. You don't have to even allocate the variable grid. -Now wgrib2api uses optional parameters to make the -grb2_inq(..) call both simple and powerful. -We can expand the above program to get much more information about the field that was read. -Do some testing, is it easier to read grib2, netcdf or hdf5? - - -

    -!       read 6 hour forecast from z500 field from file 'FILE.grb2'
    -!       showing the use of some optional parameters
    -
    -        use wgrib2api
    -	real, allocatable :: grid(:,:), lat(:,:), lon(:,:)
    -        character (len=300) :: metadata, grid_info
    -        integer :: nx, ny
    -
    -	iret = grb2_mk_inv('FILE.grb2','FILE.inv')	              ! make index/inventory file, FILE.inv
    -	if (iret.ne.0) stop 1
    -
    -!       search index file for terms: ':HGT:', ':500 mb:' and ':6 hour fcst:'
    -	iret = grb2_inq('FILE,grb2','FILE.inv',':HGT:',':500 mb:',':6 hour fcst:',data2=grid, &
    -          nx=nx, ny=ny, lat=lat, lon=lon, desc=metadata, grid_desc=grid_info)
    -        if (iret.ne.1) stop 2                                         ! error if not 1 match
    -
    -        write(*,*)'It was easy!  Z500 fhr=6 grid(10,12) =', grid(10,12)
    -        write(*,*) 'at latitude=',lat(10,12),' longitude=',lon(10,12)
    -        write(*,*) 'grid size=(',nx,',',ny,')'
    -        write(*,*) 'metadata: ',trim(metadata)
    -        write(*,*) 'grid: ', trim(grid_info)
    -
    -	stop
    -	end
    -
    - - -

    -Writing grib2 is also easy. First you need a template which is a sample grib2 file. The -template has the correct grid and unchanging metadata such as the center and grid definition. -The writing process consists of adding -the gridded data, the new variable name, level, reference date and forecast information -such as analysis, or 12 hour forecast and perhaps some ensemble information or some similar -changing metadata. - -

    Finding a template has gotten easier as grib2 has become more common. There are tools -to change the grid information (wgrib2) and change specific metadata information (wgrib2). -Suppose we already have a template. Writing a grib2 file is as easy as - - -

    -!       template.grb2: grib2 file, message/record 1 is template
    -!       fort.11: 10 mb TMP binary data WE:SN order
    -!       OUT.grb2:  output file, 10 mb TMP in grib2 format
    -
    -        use wgrib2api
    -        real, allocatable :: grid(:,:)
    -        integer, parameter :: nx=360, ny=181
    -
    -        allocate (grid(nx,ny))
    -        read(11) grid
    -        i = grb2_wrt('OUT.grb2','template.grb2',1,data2=grid,meta='d=2001020100:TMP:10 mb:anl:packing=j')
    -!       writes out 10 mb temperature, reference date = 00Z01Feb2001, analysis, jpeg2000 packing
    -        if (i.ne.0) stop 8
    -
    -        stop
    -        end
    -
    - - -

    -Reading and writing is based on text strings rather numbers in a table, so you don't have to -refer to the WMO documentation. All the text strings are based on the wgrib2 inventories, -so there should be no surprises as long as you are familiar with the wgrib2 inventories. - - -

    -Here is a practical example, you want to calculate the 1000-500 mb thickness. -We are assuming that the input file only contains one Z1000 and Z500 field. We -are also assuming the first record can be used as a template. - - -

    -!	sample program:
    -!       read z500, z1000
    -!       write 500-1000 mb  thickness  (z500-z1000)
    -!
    -	use wgrib2api
    -
    -	real, allocatable :: z500(:,:), z1000(:,:)
    -	character (len=200) :: file, inv, metadata
    -
    -	file = 'gep19.t00z.pgrb2af180'
    -	inv = 'gep19.t00z.pgrb2af180.inv'
    -
    -	iret = grb2_mk_inv(file, inv)		! make an inventory file
    -
    -!       read z500 and z1000
    -	iret = grb2_inq(file,inv,':HGT:1000 mb:', data2=z1000)
    -	if (iret.ne.1) stop 2
    -	iret = grb2_inq(file,inv,':HGT:500 mb:', data2=z500, desc=metadata)
    -	if (iret.ne.1) stop 3
    -
    -        z1000 = z500 - z1000
    -
    -!	the write needs metadata, going to use metadata from the z500 read
    -
    -!	new style write, var=.. and level=.. override the z500 metadata
    -        iret = grb2_wrt('thick.grb',FILE,1,data2=z1000,meta=metadata,var='THICK',level='500-1000 mb')
    -	if (iret.ne.0) stop 4
    -
    -!	old style write, convert z500 metadata -> thickness metadata
    -        write(*,*) 'metadata 0 ', trim(metadata)
    -        iret = grb2_set_substring(metadata,'THICK',2)
    -	if (iret.ne.0) stop 5
    -        iret = grb2_set_substring(metadata,'500-1000 mb',3)
    -	if (iret.ne.0) stop 6
    -        write(*,*) 'metadata 1 ', trim(metadata)
    -        iret = grb2_wrt('thick.grb',FILE,1,data2=z1000,meta=metadata)
    -	if (iret.ne.0) stop 7
    -
    -        stop
    -        end
    -
    - - -

    Tested Systems

    -

    -

  • RH6 gfortran -
  • RH6 ifort -
  • SUSE ifort -
  • Ubuntu 14.04 gfortran -
  • Cygwin64 (Windows) gfortran -
  • MacOS ifort (beta v2.0.7) - - - -

    Source Code

    -

    -The source code is included with wgrib2. Please use the -newest version of wgrib2 because wgrib2api is a new addition to wgrib2. You need -to compile wgrib2api using the same fortran compiler that you will be using to -compile your fortran programs. By default, wgrib2api/ftp_api is compiled with -OpenMP. So your fortran needs to be compiled with the same OpenMP setting. - -

    -compiling (making the ftn_api)
    -Sample Code - -

    The default wgrib2/wgrib2api build includes the ipolates and netcdf3 libraries. If your fortran -code uses a different ipolates or netcdf libraries, you will have to configure the wgrib2's makefile -and rebuild the wgrib2 library without the ipolates and netcdf options. Removing the two libraries -will not have an effect on the grb2_*(..) routines. However, if the missing libraries would adversely -affect calls to wgrib2a(..) and wgrib2c(..) that use the -new_grid or -netcdf options. - - -

    -

    Documentation

    -
      -
    1. Introduction pptx -
    2. Making an index file, in order to read grib: grb2_mk_inv(..) -
    3. Reading grib: grb2_inq(..) -
    4. Scanning grib: grb2_inq(..) with sequential reads -
    5. Writing grib: grb2_wrt(..) -
    6. Freeing files: grb2_free_file(..) does a flush -
    7. undefined grid points -
    8. HPC: introduction -
    9. HPC: reading/writing memory buffers/files -
    10. Sample fortran code: merge 2000 small grids -
    11. Example: calculating the average surface to 700 mb relative humidity. -
    - -

    Other Languages

    -
      -
    1. C_wgrib2api is in development and is based on ftn_wgrib2api -
    2. py_wgrib2api -
    - - -
  • - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: January 25, 2018, Aug 16, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2api_ave_rh.html b/web_docs/wgrib2api_ave_rh.html deleted file mode 100644 index aa372ac..0000000 --- a/web_docs/wgrib2api_ave_rh.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - Climate Prediction Center - wgrib2api - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api ave_rh.f90 -
     
    - -

    wgrib2api ave_rh.f90

    -

    Example: calculating average RH from surface to 700 mb

    -
    - - -

    Introduction

    - -

    -The wgrib2 utility can do calculations but some calculations are -more easily done in Fortran. This example came from a user question -on how to calculate the average RH from the surface to 700 mb. I -am using a sample file with the surface pressure, RH for the levels, -1000, 925, 850 and 700 mb. The proper tool for the job is wgrib2api. - - - -

    -     1	! 1/2018 Public Domain Wesley Ebisuzaki
    -     2	!
    -     3	!	Compute average rh from surface to 700 mb and write as grib file
    -     4	!
    -     5	!       input: grib file with RH on 1000, 925 850 and 700 mb
    -     6	!       output: grib file with pressure weighted average RH from
    -     7	!           surface to 700 mb
    -     8	!
    -     9	!       files:
    -    10	!           in = input grib2 file that has 1000, 825, 850 and 700 mb RH
    -    11	!                   (only one field at each level)
    -    12	!           inv = inventory file
    -    13	!           out = output grib2 with average RH
    -    14	!
    -    15	!       For RH below 1000 mb, use 1000 mb value
    -    16	!
    -    17	!       requires: wgrib2api built with wgrib2 v2.0.8 which supports
    -    18	!          'surface - 700 mb'
    -    19	!          grb_UNDEFINED
    -    20	!
    -    21	        use wgrib2api
    -    22	        character (len=100) :: in, out, inv
    -    23	        character (len=200) :: metadata
    -    24	        real, allocatable :: sfc_prs(:,:), tmp(:,:), rh(:,:,:), ave_rh(:,:)
    -    25	        integer, parameter :: nlevs = 4
    -    26		real, dimension (0:nlevs), parameter :: levels = (/ 2000.0, 1000.0, 925.0, 850.0, 700.0 /)
    -    27	        character (len=9), dimension(0:nlevs), parameter :: &
    -    28	            txt_levs = (/ ':2000 mb:', ':1000 mb:', ':925 mb: ', ':850 mb: ', ':700 mb: ' /)
    -    29	        character (len=30), parameter :: out_level = 'surface - 700 mb'
    -    30	
    -    31		integer :: lev, nx, ny, i, j
    -    32		real:: factor, ave_val, lower_val
    -    33	
    -    34		in='/export/cpc-lw-webisuzak/wd51we/grib2/examples/gep19.aec'
    -    35		inv='gep19.aec.inv'
    -    36		out='ave_rh.grb'
    -    37	
    -    38	!	make inventory
    -    39		i = grb2_mk_inv(in,inv)
    -    40		if (i /= 0) stop 1
    -    41	
    -    42	!	read surface pressure
    -    43		i = grb2_inq(in, inv, ':PRES:', ':surface:', data2=sfc_prs, nx=nx, ny=ny)
    -    44		if (i /= 1) stop 2
    -    45		sfc_prs = 0.01 * sfc_prs		! convert from Pa to mb
    -    46		write(*,*) 'read sfc pressure (mb) done'
    -    47	
    -    48	!	read rh 
    -    49		allocate(rh(nx,ny,0:nlevs))
    -    50		do lev = 1, nlevs
    -    51		   i = grb2_inq(in, inv, ':RH:', txt_levs(lev), data2=tmp, desc=metadata)
    -    52		   if (i /= 1) stop 3
    -    53		   rh(:,:,lev) = tmp
    -    54		enddo
    -    55		rh(:,:,0) = rh(:,:,1)			! rh(2000mb) = rh(1000mb)
    -    56		write(*,*) 'read rh finished'
    -    57	
    -    58	!	now find the ave RH, surface-700 mb, pressure weighted
    -    59		allocate(ave_rh(nx,ny))
    -    60		ave_rh = 0.0
    -    61		do j = 1, ny
    -    62		    do i = 1, nx
    -    63			if (sfc_prs(i,j).gt.2000) stop 4
    -    64			if (sfc_prs(i,j).lt.levels(nlevs)) then
    -    65	        	    ave_rh(i,j) = grb2_UNDEFINED
    -    66			    cycle
    -    67			endif
    -    68			do lev = 1, nlevs
    -    69			    if (sfc_prs(i,j) .gt. levels(lev-1)) then
    -    70	!			include whole layer
    -    71				ave_rh(i,j) = ave_rh(i,j) + (rh(i,j,lev-1)+rh(i,j,lev))*0.5*(levels(lev-1)-levels(lev))
    -    72			    else if (sfc_prs(i,j) .gt. levels(lev)) then
    -    73	!			include partial layer
    -    74				factor = (sfc_prs(i,j)-levels(lev)) / (levels(lev-1) - levels(lev))
    -    75				lower_val = factor*rh(i,j,lev-1) + (1.0-factor)*rh(i,j,lev)
    -    76			        ave_val = 0.5*(lower_val + rh(i,j,lev))
    -    77				ave_rh(i,j) = ave_rh(i,j) + ave_val * (sfc_prs(i,j) - levels(lev))
    -    78			    endif
    -    79			enddo
    -    80	!	        normalize ave_rh 
    -    81			ave_rh(i,j) = ave_rh(i,j) / (sfc_prs(i,j) - levels(nlevs))
    -    82		    enddo
    -    83		enddo
    -    84	
    -    85	!	write ave_rh
    -    86		i = grb2_wrt(out,in,1,data2=ave_rh,meta=metadata,level=out_level)
    -    87		if (i /= 0) stop 5
    -    88	
    -    89		stop
    -    90		end
    -
    - -
    -line 21:     needed use wgrib2api
    -lines 38-40: make inventory file
    -lines 42-46: read surface pressure, get nx, ny of the grid
    -lines 48-56: read RH for 1000, 925, 850 and 700 mb
    -             save in RH(:,:,level)
    -             for computations make RH for 2000 mb for the case
    -              where surface pressure is greater than 1000 mb.
    -lines 58-83: compute surface-700 mb average RH.
    -line 63:     if surface pressure is 2000 mb, something is really wrong
    -lines 64-67: if surface pressure is less than 700, ave RH is undefined
    -              note: grib2_UNDEFINED requires wgrib2api v2.0.7
    -lines 68-79: contribution of each layer to ave_rh
    -lines 85-87: write out ave_rh
    -              note: level_out requires wgrib2api v2.0.7
    -
    - -

    Comments

    - -

    -I needed to add couple of fixes to wgrib2 to make this example work. First -I added grb2_UNDEFINED and grb2_DEFINED_VAL(x) to wgrib2api. Next I had -to enhance wgrib2 so that -set_lev would handle "surface - 700 mb". - -

    -In the fortran code, reading and writing grib2 is done is a simple -manner. - -

    Code

    - -ave_rh.f90 - - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Jan 25, 2018 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2api_hpc.html b/web_docs/wgrib2api_hpc.html deleted file mode 100644 index 809bdb4..0000000 --- a/web_docs/wgrib2api_hpc.html +++ /dev/null @@ -1,216 +0,0 @@ - - - - Climate Prediction Center - wgrib2api hpc - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api hpc -
     
    - -

    HPC and wgrib2api

    -
    - - -

    Introduction

    - -

    -Wgrib2api was designed to work in High Performance Computing (HPC) applications. -The features useful for HPC are, - -

      -
    1. Applications can be written using the Intel fortran compiler, ifort. -
    2. Slow file reads and writes can be replaced by fast memory buffer reads and writes. -
    3. wgrib2api can be compiled without use of configure scripts which may cause problems - when cross compiling. However, you lose some functionality (handling jpeg2000 and png - encoded files). -
    4. wgrib2api can be compiled with/without OpenMP. -
    - -Some slowness can come from, - -
      -
    1. A high-level interface will always be slower than a low-level interface. However, -as grid size increases, the overhead will become a smaller fraction of workload. -
    2. wgrib2api is not reentrant. For large speedups, you have to run multiple copies of wgrib2api -by MPI. You are limited to one copy of wgrib2api per MPI processes and different copies better -not write to the same disk file. -
    - - -

    Reading

    - -

    Sure, HPC applications read. However, reading grib is a minor part of most -NWP-HPC jobs. Models and data assimilation systems tend to read much of their input -data files in non-grib formats. Most of the computation is in producing and -outputing the forecast or analyses. - -

    Writing

    -There has been much effort done in speeding up the writing of grib files. For example, the -GFS (Global Forecast System, NCEP) needs to writes grib files every 3 or 6 hours of -the forecasts. Each grib file has more than 700 fields. You can encode each field -independently but parallelization of the encoding of individual fields is limited. -The wgrib2api limits may be typical and they are - -
      -
    1. simple packing: highly parallized by OpenMP, poor compression -
    2. AEC packing: single thread, good compression -
    3. complex packing: some parallelization by OpenMP, good compression -
    4. jpeg2000: single thread using Jasper library, good compression -
    - -Simple packing could be parallelized using MPI but simple packing -is not competative because of its poor compression. So the best parallelization -will be from encoding individual fields using separate MPI processes. The output -file can either be created using a parallel filesystem or by copying the grib -messages to a I/O task to write them to the file system. Wgrib2api does not -support multiple programs writing to the same file, so the output can be -writen to a memory file and writen to a the larger disk file by another step. - -
    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Feb 21, 2017 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2m.html b/web_docs/wgrib2m.html deleted file mode 100644 index 4a7c2ef..0000000 --- a/web_docs/wgrib2m.html +++ /dev/null @@ -1,418 +0,0 @@ - - - - Climate Prediction Center - wgrib2mv/wgrib2ms (nee wgrib2m) - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2m -
     
    - -

    wgrib2ms - wgrib2 m(multiple streams) s(scalar data)

    -

    wgrib2mv - wgrib2 m(multiple streams) v(vector data)

    -
    - - -

    Introduction

    - -

    -Wgrib2 was designed to be parallelized by what-may-be-called dataflow programming. -Data flows into a black box and data flows out. One way to parallelize is to -divide the data flow into N streams, process each stream separately and then recombine -the streams at the end of the processing. For example, some wgrib2 operations -can be doubled in processing speed if you run two copies of wgrib2 and let -one copy process the even grib messages (records) and the other process the -odd messages. The grib output of the two copies need to be recombined by -a merging program. - -diagram of single and dual processing streams - -

    -Wgrib2ms is a shell script that allow you parallelize your wgrib2 commands -by running N copies of wgrib2 by dividing the file into N streams. One -common operation that needs parallelization is regridding using the --new_grid option. The --new_grid option has a unique requirement that -zonal wind must be followed by the corresponding meridional wind in order to accuractely -determine the winds near the pole. We can use this data-flow parallelation by -creating a file which contains both components of the wind in the same grib message -by using submessages (vector). Once the grib file has the vectors in the same grib message, -the shell script, wgrib2mv, can be used to parallelized the regridding by --new_grid. - - -

    wgrib2ms

    - - -

    Simple Usage

    -

    -

    -Each grib message has one field
    -run in 1 stream:                      wgrib2      FILE (options)
    -run in N streams:                     wgrib2ms  N FILE (options)           N > 1
    -generate script to run in N streams:  wgrib2ms -N FILE (options)           N > 1
    -
    - * restrictions on the options that work with wgrib2ms
    -
    - -Wgrib2ms runs wgrib2 in N streams and combines the grib output at the -end. For example, - -
    -wgrib2ms 4 IN.grb -set_grib_type c2 -ijsmall_grib 1:10 20:40 OUT.grb
    -
    -An easy-to-read version of the shell code that is generated by wgrib2ms,
    -
    - 1: mkfifo pipe1 pipe2 pipe3 pipe4
    - 2: wgrib2 -for_n 1::4 IN.grb -set_grib_type c2 -ijsmall_grib 1:10 20:40 pipe1 &
    - 3: wgrib2 -for_n 2::4 IN.grb -set_grib_type c2 -ijsmall_grib 1:10 20:40 pipe2 &
    - 4: wgrib2 -for_n 3::4 IN.grb -set_grib_type c2 -ijsmall_grib 1:10 20:40 pipe3 &
    - 5: wgrib2 -for_n 4::4 IN.grb -set_grib_type c2 -ijsmall_grib 1:10 20:40 pipe4 &
    - 6: gmerge OUT.grb pipe1 pipe2 pipe3 pipe4
    - 7: wait
    - 8: rm pipe1 pipe2 pipe3 pipe4
    -
    -line 1: make 4 pipes
    -lines 2-5: run 4 copies of wgrib2 in background, grib output to the pipes
    -    each copy of wgrib2 processes every 4th field
    -lines 6: gmerge reads grib messages from the 4 pipes in round-robin fashion and 
    -     writes it out to OUT.grb
    -
    -The advantage of this code is that there are no temporary disk files and the merging
    -of the results of the 4 streams is done at the same time as the wgrib2 processing.
    -
    - - -

    wgrib2mv

    -

    Regridding using -new_grid

    -
    - -

    Paralleling the regridding process is an almost trivial parallelization. -Regridding the Z500, Z1000 and T100 fields can be done independantly. The only -problem is in regridding vector quantities near the pole. For vector quantities, -one converts the vectors to a 3-d vector (x,y,z), interpolate the 3-d vectory and then project -it to the surface. So the two components of the vector need to be stored -in the same grib message, and the then the parallelization becomes easy. -Wgrib2mv is like wgrib2ms except it requires that the input grib file -have the scalars in their own grib message, and have the vectors -have the vector components saved as submessages in their own grib message. -The output of wgrib2mv, are in a like format. -

    - - -

    Wgrib2mv is for regridding using -new_grid. -This option requires the various vector fields (see vectors) -be processed together. To prevent the vector components from being processed by different copies -of wgrib2, the vector components are put in the same grib message. Using wgrib2 v3.0.0, making -the file is easy - -

    -$ wgrib2 IN.grb -new_grid_order OUT.grb ERROR.grb
    -
    -If there is an unmatched vector field (error), the field will be written to ERROR.grb.
    -So ERROR.grb should be an empty file.  Once the data are prepared, you can run wgrib2mv on it.
    -
    -
    -$ wgrib2mv 4 OUT.grb -new_grid_winds earth -new_grid ncep grid 3 grid3.grb
    -
    -This regrids the file using 4 threads.
    -
    - - -

    -Output options that can be used by wgrib2ms/wgrib2mv -

      -
    1. -grib -
    2. -grib_out -
    3. -ijsmall_grib -
    4. -new_grid (wgrib2mv, wgrib2ms if vectors are set to none) -
    5. -small_grib -
    6. all other output options should not be used -
    -

    -

    wgrib2m restrictions on the output options

    -

    -

      -
    1. Each output option must write to a different file -
    2. Each output option must write to the output file for every record processed. -
    3. You cannot use -if to select the record to be output (see restriction 2) -
    4. Output options can only write grib (ex. -netcdf, -cvs are not allowed) -
    -

    -

    wgrib2 reading options supported by wgrib2m

    -

    -

      -
    1. processing a regular grib file (not a pipe) -
    2. -i (reading inventory from stdin) added v1.1 -
    -

    -

    wgrib2 options that work differently in wgrib2m

    -

    -Some options still work but may behave differently in wgrib2m. -Since the processing is split in to N streams, each copy of -wgrib2 will not see all the records. For example, you -may want to calculate the 1000mb-500mb thickness. If one -copy of wgrib2 gets the 1000 mb Z and other one gets the 500 mb Z, -then you can't calculate the thinkness. This will affect - -

      -
    1. -rpn -
    2. -import (all types) -
    3. memory, and temporary files -
    - - -

    Usage

    -

    -

    -wgrib2ms N (wgrib2 subset options)
    -  for N > 1, execute wgrib2 (wgrib2 subset options) in N streams
    -  for N < -1, produces script running -N streams
    -wgrib2mv N (wgrib2 subset options)
    -  for N > 1, execute wgrib2 (wgrib2 subset options) in N streams
    -  for N < -1, produces script running -N streams
    -
    -v1.1+
    -  grep ":HGT:" nam.idx | wgrib2ms 3 -i nam.grb2 -set_grib_type c3 -grib_out HGT.c3
    -v1.2 wgrib2m was renamed wgrib2mv, added wgrib2ms
    -  can write to stdout by the "-" filename.  Note only one output option can write to stdout
    -
    - -

    Producing a Script

    -

    -Normally wgrib2ms is used to run wgrib2 in N streams. However, you might -use wgrib2ms to generate a script that runs wgrib2 in N streams. -You can then alter the script to run in your environment. For example, -NCEP operational scripts are not suppose to write files in /tmp. However, -that is the default location for pipes. NCEP operational scripts are -suppose to use $WGRIB2 instead of wgrib2. Again, another change that needs -to be done. - -

    Example:wgrib2mv

    -A major use of wgrib2mv is to regrid a file. Suppose we only want to do a vector -interpolation of (UGRD,VGRD) and (UGRD,VGRD) and only (UGRD,VGRD) are already -stored in the same grib message. In addition suppose we want to interpolate -to ncep grid 221. THen the 1 stream version is. -
    -    wgrib2 IN.grb -new_grid_winds grid -new_grid ncep grid 221 OUT221.grb
    -
    -    This will put UGRD and VGRD in their own grib messages. Suppose we want them in
    -    the same grib message, the you can do
    -
    -    wgrib2 IN.grb -inv /dev/null -new_grid_winds grid -new_grid ncep grid 221 - \
    -      wgrib2 - -ncep_uv OUT221.grb
    -
    -To parallelize (8 streams) the above you can do
    -
    -    wgrib2mv 8 IN.grb -inv /dev/null -new_grid_winds grid -new_grid ncep grid 221 OUT221.grb
    -
    -wgrib2mv run M(ultiple streams) using V(ector in own grib message).
    -
    -Now suppose we only want to treat (UGRD,VGRD) and (USTR,VSTM) as vectors.  In addition,
    -we want to bilinearly interpolate all the fields except to SOTYP and VGTYP which are
    -to be nearest neighbor values.  For one stream,
    -
    -   wgrib2 IN.grb -new_grid_winds earth -new_grid_interpolation bilinear \
    -      -new_grid_vectors "UGRD:VGRD:USTM:VSTM" \
    -      -if ":(VGTYP|SOTYP):" -new_grid_interpolation neighbor -fi \
    -      -new_grid ncep grid 221 - -inv /dev/null | wgrib2 - -ncep_uv OUT.grb
    -
    -The 4 stream version is
    -
    -   wgrib2 IN.grb -submsg_uv tmpfile
    -   wgrib2mv 4 tmpfile -new_grid_winds earth -new_grid_interpolation bilinear \
    -      -new_grid_vectors "UGRD:VGRD:USTM:VSTM" \
    -      -if ":(VGTYP|SOTYP):" -new_grid_interpolation neighbor -fi \
    -      -new_grid ncep grid 221 - -inv /dev/null | wgrib2 - -ncep_uv OUT.grb
    -
    - -

    Example 1: Jpeg2000 to complex packing

    - -Jpeg2000 packing is known for good compression at the expense of speed. -Suppose you have downloaded some jpeg2000 compressed files and want to -work with them. You speed up your processing by converting the files -from jpeg2000 to complex-3 in parallel. - -
    - $ wgrib2ms 8 jpeg2000.grb -set_grib_type c3 -grib_out fast.grb
    -
    - The above runs 8 copies of wgrib2 to speed up the processing.  On
    -an 8 core machine, the command will be quite quick.
    -
    - -

    Example 2: making a cookie-cutter subset grib file

    - -Making a cookie cutter subset of file can be done in parallel. - -
    - $ wgrib2ms 8 big_grid.grb -set_grib_type c3 -small_grib 10:40  20:60 small_grid.grb
    -
    - The above runs 8 copies of wgrib2 to speed up the processing.  On
    -an 8 core machine, the command will be quite quick.
    -
    -
    -

    Observations

    -

    -Using Centos 6.4 on a FX 8320 (8 core), there was little speed up with N > 4 when -using 1 MB grib messages. Using grib messages < 64KB (pipe buffer size), the -processing scaled better with the number of streams. Centos 6.4 has an old -kernel which limits the pipe size to 64KB. With a newer kernel, you -can increase the pipe size which will help speed up the wgrib2m. Some speedup -may be realized if gmerge were properly threaded. - -

    -Code location: https://www.ftp.cpc.ncep.noaa.gov/wd51we/wgrib2_aux_progs/ -

    -See also: --new_grid, --new_grid_order, --new_grid_winds, --wgrib2ms, - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: March 15, 2017, March 23, 2018, March 16, 2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wgrib2ms.html b/web_docs/wgrib2ms.html deleted file mode 100644 index 40c6d5b..0000000 --- a/web_docs/wgrib2ms.html +++ /dev/null @@ -1,254 +0,0 @@ - - - - Climate Prediction Center - wgrib2ms - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2ms -
     
    - -

    wgrib2ms

    -
    - - -

    Introduction

    - -

    -Wgrib2 was designed to be parallelized by what-may-be-called dataflow programming. -Data flows into a black box and data flows out. One way to parallelize is to -divide the data flow into N streams, process each stream separately and then recombine -the streams at the end of the processing. Wgrib2ms parallelizes wgrib2 this way. -The limitation of this parallelization is that it uses pipes and is -limited by pipe speed, disk speed, the number of CPUs on a node/cpu and the -overhead of setting up and running the parallel job. Pipe speed can be increased -by increasing the pipe buffer size (linux kernel 2.6.35+). - -

    -Wgrib2ms parallelizes a wgrib2 command by dividing the data flow into N -streams which are processed independently. Only a limited number of output -options are supported. Note that the inventory from wgrib2ms is in a different -order than the inventory from a wgrib2 command. Each grid (submessage) is processed -by send it to one of the N streams. Since -new_grid requires that vector -fields to be processed in order, this division of labor is incompatible with -new_grid. -Any wgrib2 option that requires an order of processing is incmopatible with wgrib2ms. - -

    wgrib2 output options supported by wgrib2m

    -

    -

      -
    1. -grib -
    2. -grib_out -
    3. -ijsmall_grib -
    4. -new_grid -
    5. all other output options should not be used -
    -

    -

    wgrib2ms restrictions on the output options

    -

    -

      -
    1. Each output option must write to a different file -
    2. Each output option must write to the output file for every record processed. -
    3. You can use the -match option because -match selects the record prior to processing -
    4. You cannot use -if to select the record to be output (see restriction 2) -
    5. Output options can only write grib (ex. -netcdf, -cvs are not allowed) -
    -

    -

    wgrib2 reading options supported by wgrib2ms

    -

    -

      -
    1. processing a regular grib file (not a pipe) -
    2. -i (reading inventory from stdin) added v1.1 -
    3. -import will cause problems -
    -

    -

    wgrib2 options that work differently in wgrib2ms

    -

    -Some options still work but may behave differently in wgrib2ms. -Since the processing is split in to N streams, each copy of -wgrib2 will not see all the records. For example, you -may want to calculate the 1000mb-500mb thickness. If one -copy of wgrib2 gets the 1000 mb Z and other one gets the 500 mb Z, -then you can't calculate the thinkness. This will affect - -

      -
    1. -rpn -
    2. -import -
    -

    - -

    Usage

    -

    -

    -wgrib2ms N (wgrib2 subset options)
    -  for N > 1, execute wgrib2 (wgrib2 subset options) in N streams
    -  for N < -1, produces script running -N streams
    -
    -v1.1+
    -  grep ":HGT:" nam.idx | wgrib2ms 3 -i nam.grb2 -set_grib_type c3 -grib_out HGT.c3
    -
    - -

    Example

    -wgrib2ms 4 IN.grb -set_grib_type c3 -new_grid_winds -new_grid ncep grid 221 out22.grb -new_grid ncep grep 3 out3.grb - - -

    Observations

    -

    -Using Centos 6.4 on a FX 8320 (8 core), there was little speed up with N > 4 when -using 1 MB grib messages. Using grib messages < 64KB (pipe buffer size), the -processing scaled better with the number of streams. The program, gmerge, -should be written to be multi-threading. - -

    -Code location: https://www.ftp.cpc.ncep.noaa.gov/wd51we/wgrib2_aux_progs/wgrib2m -

    -See also: -wgrib2m - - -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Aug, 2014 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wind_dir.html b/web_docs/wind_dir.html deleted file mode 100644 index a4540bd..0000000 --- a/web_docs/wind_dir.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -wind_dir - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-wind_dir -
     
    - -

    wgrib2: -wind_dir

    -
    - - -

    Introduction

    - -

    -The -wind_dir option takes the zonal and meridional winds, -computes the wind direction and writes it out in grib format. The results -is in degrees where 0 degrees is a wind from the north and 90 degrees is a wind from -the east. For this option to -work, (1) the zonal and meridional winds must be earth relative (not grid relative -winds) and (2) the meridional wind must follow the corresponding zonal wind for that -level, time and forecast hour. (Condition 2 is the same restriction as for the --wind_speed option. If the U and V in your grib file do not have -this order, the file must be sorted. However, many NCEP forecast files already -have this order. - -

    -The winds need to be earth relative. The -new_grid option -can convert between earth and grid relative winds. - -

    -You can save computer time by using the -match option -to restricting the decoding of records to U and V. - -

    The precision of the wind direction is set to the nearest degree (wgrib2 v3.0.0). -Earlier versions used the precision entering the routine. That would be precision -of the V field unless the precision was changed by a scaling option like -set_scaling. - -

    Calm Winds

    - -

    The calculation of the wind direction breaks down when the zonal and meridional -winds are zero. The wind direction for calm winds depends on the implementation. -(C's atan2 is well defined but some machines do not implement negative zero.) - - -

    Usage

    -

    - -

    --wind_dir output_grib_file
    -
    -   Comment: the -wind_speed option can write to the same file as -wind_dir
    -
    - -

    Example

    -

    - -

    -$ wgrib2 gep19.t00z.pgrb2af180 -wind_dir wind.grb -wind_speed wind.grb -match "(UGRD|VGRD)"
    -4.1:86046:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    -4.2:86046:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    -8.1:226831:d=2009060500:UGRD:250 mb:180 hour fcst:ENS=+19
    -8.2:226831:d=2009060500:VGRD:250 mb:180 hour fcst:ENS=+19
    -
    -$ wgrib2 wind.grb
    -1:0:d=2009060500:WDIR:200 mb:180 hour fcst:ENS=+19
    -2:97922:d=2009060500:WIND:200 mb:180 hour fcst:ENS=+19
    -3:179554:d=2009060500:WDIR:250 mb:180 hour fcst:ENS=+19
    -4:277476:d=2009060500:WIND:250 mb:180 hour fcst:ENS=+19
    -
    - -

    -See also: -match, - -wind_speed - -wind_uv -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Feb 4, 2013 , 1/8/2020. -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wind_speed.html b/web_docs/wind_speed.html deleted file mode 100644 index 75c3744..0000000 --- a/web_docs/wind_speed.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -wind_speed - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-wind_speed -
     
    - -

    wgrib2: -wind_speed

    -
    - - -

    Introduction

    - -

    -The -wind_speed option takes the zonal and meridional winds, -computes the wind speed and writes it out in grib format. For this option to -work, the meridional wind must follow the corresponding zonal wind for that -level, time and forecast hour. If the U and V in your grib file do not have -this order, the file must be sorted. However, many NCEP forecast files already -have this order. - -

    -You can save computer time by using the -match option -to restricting the decoding of records to U and V. - -

    Usage

    -

    - -

    --wind_speed output_grib_file
    -
    -   Comment: you can write the output of -wind_speed and -wind_dir to the same file
    -
    - -

    Example

    -

    - -

    -$ wgrib2 gep19.t00z.pgrb2af180 -wind_dir wind.grb -wind_speed wind.grb -match "(UGRD|VGRD)"
    -4.1:86046:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    -4.2:86046:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    -8.1:226831:d=2009060500:UGRD:250 mb:180 hour fcst:ENS=+19
    -8.2:226831:d=2009060500:VGRD:250 mb:180 hour fcst:ENS=+19
    -
    -$ wgrib2 wind.grb
    -1:0:d=2009060500:WDIR:200 mb:180 hour fcst:ENS=+19
    -2:97922:d=2009060500:WIND:200 mb:180 hour fcst:ENS=+19
    -3:179554:d=2009060500:WDIR:250 mb:180 hour fcst:ENS=+19
    -4:277476:d=2009060500:WIND:250 mb:180 hour fcst:ENS=+19
    -
    - -

    -See also: -match, - -wind_dir - -wind_uv -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page last modified: Feb 4, 2013 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/wind_uv.html b/web_docs/wind_uv.html deleted file mode 100644 index bc690b3..0000000 --- a/web_docs/wind_uv.html +++ /dev/null @@ -1,215 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -wind_uv - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-wind_uv -
     
    - -

    wgrib2: -wind_uv

    -
    - - -

    Introduction

    - -

    -The -wind_uv option takes the wind speed and wind -direction and computes the zonal (UGRD) and meridional (VGRD) wind -components. The wind components are then written out in grib format. -For this option to work, the corresponding wind direction and speed -must not be separated by a non-corresponding wind speed or direction. -If the speed and direction do no have this order, the file must be sorted. - -

    -If the wind direction is earth (grid) relative, the UGRD and VGRD -winds are earth (grid) relative. - -

    -You can save computer time by using the -match option -to restricting the decoding of records to wind speed (WIND) and -wind direction (WDIR). - -

    Usage

    -

    - -

    --wind_uv output_grib_file
    -
    - -

    Example

    -

    - -

    -$ wgrib2 gep19.t00z.pgrb2af180 -wind_dir wind.grb -wind_speed wind.grb -match "(UGRD|VGRD)"
    -4.1:86046:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    -4.2:86046:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
    -8.1:226831:d=2009060500:UGRD:250 mb:180 hour fcst:ENS=+19
    -8.2:226831:d=2009060500:VGRD:250 mb:180 hour fcst:ENS=+19
    -
    -$ wgrib2 wind.grb -wind_uv uv.grb
    -1:0:d=2009060500:WDIR:200 mb:180 hour fcst:ENS=+19
    -2:97922:d=2009060500:WIND:200 mb:180 hour fcst:ENS=+19
    -3:179554:d=2009060500:WDIR:250 mb:180 hour fcst:ENS=+19
    -4:277476:d=2009060500:WIND:250 mb:180 hour fcst:ENS=+19
    -
    -$ wgrib2 uv.grb
    -1:0:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    -2:89777:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
    -3:179554:d=2009060500:UGRD:250 mb:180 hour fcst:ENS=+19
    -4:269331:d=2009060500:UGRD:250 mb:180 hour fcst:ENS=+19
    -
    -
    - -

    -See also: -match, - -wind_speed - -wind_dir -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created: April 1, 2019 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - - diff --git a/web_docs/write_sec.html b/web_docs/write_sec.html deleted file mode 100644 index cbc8a91..0000000 --- a/web_docs/write_sec.html +++ /dev/null @@ -1,189 +0,0 @@ - - - - Climate Prediction Center - wgrib2: -write_sec - - - - - - - - - - -
    - Skip Navigation Links - www.nws.noaa.gov 
    - - - - - - - - - - -
    - NOAA logo - Click to go to the NOAA home pageNational Weather Service  - NWS logo - Click to go to the NWS home page
    Climate Prediction Center
    - - - - - - - - - - - -
    -
    -  
    - - - - - -  
    - - - - - -

    - - - - - - - - - -
    -
    - - - - - -   - -
    - About Us
    -    Our Mission
    -    Who We Are

    - Contact Us
    -    CPC Information
    -    CPC Web Team

    -
    -
    - - - - - - - - - - - - - - - - - - - -
     
    - HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-write_sec -
     
    - -

    wgrib2: -write_sec

    -
    - - -

    Introduction

    - -

    -The -write_sec option writes the current grib message section (0-8) -to file. The only options that applies to the file are the -header, --no_header, -append, and --no_append options. -The default -header option put a 4-byte unsigned integer header and trailer around the section data. -The header and trailer are the number of bytes of the section. - -

    -The -write_sec option is by codes that need low-level access to the grib data. - -

    Usage

    -
    --write_sec N file            N = 0..8
    -                             file = file to write
    -
    - -

    Example 1

    -
    -wgrib2 IN.grb -write_sec 0 sec0.dat -write_sec 1 sec1.dat -write_sec 2 sec2.dat -write_sec 3 sec3.dat \
    -  -write_sec 4 sec4.dat -write_sec 5 sec5.dat -write_sec 6 sec6.dat -write_sec 7 sec7.dat
    -
    - -

    -See also: --read_sec, -

    - - - - - - - - - -

    - NOAA/ - National Weather Service
    - National Centers for Environmental Prediction
    - Climate Prediction Center
    - 5830 University Research Court
    - College Park, Maryland 20740
    - Climate Prediction Center Web Team
    - Page created: 12/2020 -
    - Disclaimer - - Privacy Policy -
    -
    -
    - - -