Skip to content

Instantly share code, notes, and snippets.

@TakashiUNUMA
Created July 22, 2017 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TakashiUNUMA/c21abcd9ffb875ca0fd6d265696737e6 to your computer and use it in GitHub Desktop.
Save TakashiUNUMA/c21abcd9ffb875ca0fd6d265696737e6 to your computer and use it in GitHub Desktop.
A sample handling script in order to extract point data from a grib2 format data.
#!/bin/bash
#
# extract_grib2_pointdata.sh
#
# original script was coded by Takashi Unuma, Tsu local meteorological office, Japan Meteorological Agency
# last modified: 22nd July 2017
#
# requirements:
# wgrib2, sed, awk (gawk is also available)
#
# specify grid point (x,y) of input file, which is able to obtain by typing as follows;
# $ wgrib2 -llij [longitude] [latitude] grib2file
longrid=583
latgrid=561
# specify input grib2 file (for example, radar echo top data of JMA-RADAR)
infile=Z__C_RJTD_20140813150000_RDR_JMAGPV_Gll2p5km_Phhlv_ANAL_grib2.bin
# execute
# output data will be displayed in your terminal with the format of "YYYYMMDDHH (UTC) Echo top data [km]".
wgrib2 -ij ${longrid} ${latgrid} -s ${infile} 2> /dev/null | sed -e "s/\=/ /g" -e "s/:/ /g" | awk '{print $6,$4}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment