From 31efe677b40fe491c988d50f96b59b1b7e2d46f7 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 11 Dec 2019 20:44:21 +0100 Subject: Initial commit --- LICENSE.md | 21 ++++++++++++ README.md | 72 +++++++++++++++++++++++++++++++++++++++ bin/grib2json | 5 +++ bin/grib2json.cmd | 4 +++ lib/c3p0-0.9.1.1.jar | Bin 0 -> 608376 bytes lib/commons-codec-1.2.jar | Bin 0 -> 30085 bytes lib/commons-httpclient-3.1.jar | Bin 0 -> 305001 bytes lib/ehcache-core-2.6.2.jar | Bin 0 -> 1338129 bytes lib/grib-4.3.19.jar | Bin 0 -> 2259157 bytes lib/grib2json-0.8.0-SNAPSHOT.jar | Bin 0 -> 20246 bytes lib/javax.json-1.0.3.jar | Bin 0 -> 80416 bytes lib/jcip-annotations-1.0.jar | Bin 0 -> 2254 bytes lib/jcl-over-slf4j-1.7.5.jar | Bin 0 -> 16517 bytes lib/jdom2-2.0.4.jar | Bin 0 -> 298360 bytes lib/je-4.0.92.jar | Bin 0 -> 2132019 bytes lib/jewelcli-0.8.8.jar | Bin 0 -> 554401 bytes lib/jna-3.0.9.jar | Bin 0 -> 795871 bytes lib/joda-time-2.3.jar | Bin 0 -> 581571 bytes lib/jsoup-1.7.2.jar | Bin 0 -> 293671 bytes lib/logback-classic-1.0.9.jar | Bin 0 -> 252684 bytes lib/logback-core-1.0.9.jar | Bin 0 -> 366462 bytes lib/netcdf-4.3.19.jar | Bin 0 -> 4590073 bytes lib/protobuf-java-2.5.0.jar | Bin 0 -> 533455 bytes lib/quartz-2.1.1.jar | Bin 0 -> 554349 bytes lib/slf4j-api-1.7.5.jar | Bin 0 -> 26084 bytes lib/udunits-4.3.19.jar | Bin 0 -> 126895 bytes 26 files changed, 102 insertions(+) create mode 100644 LICENSE.md create mode 100644 README.md create mode 100755 bin/grib2json create mode 100755 bin/grib2json.cmd create mode 100644 lib/c3p0-0.9.1.1.jar create mode 100644 lib/commons-codec-1.2.jar create mode 100644 lib/commons-httpclient-3.1.jar create mode 100644 lib/ehcache-core-2.6.2.jar create mode 100644 lib/grib-4.3.19.jar create mode 100644 lib/grib2json-0.8.0-SNAPSHOT.jar create mode 100644 lib/javax.json-1.0.3.jar create mode 100644 lib/jcip-annotations-1.0.jar create mode 100644 lib/jcl-over-slf4j-1.7.5.jar create mode 100644 lib/jdom2-2.0.4.jar create mode 100644 lib/je-4.0.92.jar create mode 100644 lib/jewelcli-0.8.8.jar create mode 100644 lib/jna-3.0.9.jar create mode 100644 lib/joda-time-2.3.jar create mode 100644 lib/jsoup-1.7.2.jar create mode 100644 lib/logback-classic-1.0.9.jar create mode 100644 lib/logback-core-1.0.9.jar create mode 100644 lib/netcdf-4.3.19.jar create mode 100644 lib/protobuf-java-2.5.0.jar create mode 100644 lib/quartz-2.1.1.jar create mode 100644 lib/slf4j-api-1.7.5.jar create mode 100644 lib/udunits-4.3.19.jar diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..52f404e --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013 Cameron Beccario + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..afed7db --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ +grib2json +========= + +A command line utility that decodes [GRIB2](http://en.wikipedia.org/wiki/GRIB) files as JSON. + +This utility uses the netCDF-Java GRIB decoder, part of the [THREDDS](https://github.com/Unidata/thredds) project +by University Corporation for Atmospheric Research/Unidata. + +Installation +------------ + +``` +git clone +mvn package +``` + +This creates a .tar.gz in the target directory. Unzip and untar the package in a location of choice. + +Usage +----- + +The `grib2json` launch script is located in the `bin` directory and requires the `JAVA_HOME` environment +variable to be defined. + +``` +> grib2json --help +Usage: grib2json [options] FILE + [--compact -c] : enable compact Json formatting + [--data -d] : print GRIB record data + [--filter.category --fc value] : select records with this numeric category + [--filter.parameter --fp value] : select records with this numeric parameter + [--filter.surface --fs value] : select records with this numeric surface type + [--filter.value --fv value] : select records with this numeric surface value + [--help -h] : display this help + [--names -n] : print names of numeric codes + [--output -o value] : write output to the specified file (default is stdout) + [--verbose -v] : enable logging to stdout +``` + +For example, the following command outputs to stdout the records for parameter 2 (U-component_of_wind), with +surface type 103 (Specified height level above ground), and surface value 10.0 meters from the GRIB2 file +_gfs.t18z.pgrbf00.2p5deg.grib2_. Notice the optional inclusion of human-readable _xyzName_ keys and the data array: + +``` +> grib2json --names --data --fp 2 --fs 103 --fv 10.0 gfs.t18z.pgrbf00.2p5deg.grib2 + +[ + { + "header":{ + "discipline":0, + "disciplineName":"Meteorological products", + "gribEdition":2, + "gribLength":27759, + "center":7, + "centerName":"US National Weather Service - NCEP(WMC)", + "parameterNumber":2, + "parameterNumberName":"U-component_of_wind", + "parameterUnit":"m.s-1", + "surface1Type":103, + "surface1TypeName":"Specified height level above ground", + "surface1Value":10.0, + ... + }, + "data":[ + -2.12, + -2.27, + -2.41, + ... + ] + } +] +``` diff --git a/bin/grib2json b/bin/grib2json new file mode 100755 index 0000000..c458057 --- /dev/null +++ b/bin/grib2json @@ -0,0 +1,5 @@ +#!/bin/sh +#set -x +LIB_DIR=$(dirname "$0")/../lib +LAUNCH_JAR=$LIB_DIR/grib2json-*.jar +$JAVA_HOME/bin/java -Xmx512M -jar $LAUNCH_JAR $@ diff --git a/bin/grib2json.cmd b/bin/grib2json.cmd new file mode 100755 index 0000000..788abb5 --- /dev/null +++ b/bin/grib2json.cmd @@ -0,0 +1,4 @@ +@echo off +set LIB_DIR="%~dp0..\lib" +for /f "delims=X" %%i in ('dir /b %LIB_DIR%\grib2json-*.jar') do set LAUNCH_JAR=%LIB_DIR%\%%i +"%JAVA_HOME%\bin\java.exe" -Xmx512M -jar %LAUNCH_JAR% %* diff --git a/lib/c3p0-0.9.1.1.jar b/lib/c3p0-0.9.1.1.jar new file mode 100644 index 0000000..8d283e4 Binary files /dev/null and b/lib/c3p0-0.9.1.1.jar differ diff --git a/lib/commons-codec-1.2.jar b/lib/commons-codec-1.2.jar new file mode 100644 index 0000000..67cb720 Binary files /dev/null and b/lib/commons-codec-1.2.jar differ diff --git a/lib/commons-httpclient-3.1.jar b/lib/commons-httpclient-3.1.jar new file mode 100644 index 0000000..7c59774 Binary files /dev/null and b/lib/commons-httpclient-3.1.jar differ diff --git a/lib/ehcache-core-2.6.2.jar b/lib/ehcache-core-2.6.2.jar new file mode 100644 index 0000000..9801aa7 Binary files /dev/null and b/lib/ehcache-core-2.6.2.jar differ diff --git a/lib/grib-4.3.19.jar b/lib/grib-4.3.19.jar new file mode 100644 index 0000000..6197b12 Binary files /dev/null and b/lib/grib-4.3.19.jar differ diff --git a/lib/grib2json-0.8.0-SNAPSHOT.jar b/lib/grib2json-0.8.0-SNAPSHOT.jar new file mode 100644 index 0000000..af34dd8 Binary files /dev/null and b/lib/grib2json-0.8.0-SNAPSHOT.jar differ diff --git a/lib/javax.json-1.0.3.jar b/lib/javax.json-1.0.3.jar new file mode 100644 index 0000000..0894587 Binary files /dev/null and b/lib/javax.json-1.0.3.jar differ diff --git a/lib/jcip-annotations-1.0.jar b/lib/jcip-annotations-1.0.jar new file mode 100644 index 0000000..06e9066 Binary files /dev/null and b/lib/jcip-annotations-1.0.jar differ diff --git a/lib/jcl-over-slf4j-1.7.5.jar b/lib/jcl-over-slf4j-1.7.5.jar new file mode 100644 index 0000000..90153b0 Binary files /dev/null and b/lib/jcl-over-slf4j-1.7.5.jar differ diff --git a/lib/jdom2-2.0.4.jar b/lib/jdom2-2.0.4.jar new file mode 100644 index 0000000..19cafb8 Binary files /dev/null and b/lib/jdom2-2.0.4.jar differ diff --git a/lib/je-4.0.92.jar b/lib/je-4.0.92.jar new file mode 100644 index 0000000..fa9225d Binary files /dev/null and b/lib/je-4.0.92.jar differ diff --git a/lib/jewelcli-0.8.8.jar b/lib/jewelcli-0.8.8.jar new file mode 100644 index 0000000..2c70e6c Binary files /dev/null and b/lib/jewelcli-0.8.8.jar differ diff --git a/lib/jna-3.0.9.jar b/lib/jna-3.0.9.jar new file mode 100644 index 0000000..33461ec Binary files /dev/null and b/lib/jna-3.0.9.jar differ diff --git a/lib/joda-time-2.3.jar b/lib/joda-time-2.3.jar new file mode 100644 index 0000000..9dce4f9 Binary files /dev/null and b/lib/joda-time-2.3.jar differ diff --git a/lib/jsoup-1.7.2.jar b/lib/jsoup-1.7.2.jar new file mode 100644 index 0000000..1d9879f Binary files /dev/null and b/lib/jsoup-1.7.2.jar differ diff --git a/lib/logback-classic-1.0.9.jar b/lib/logback-classic-1.0.9.jar new file mode 100644 index 0000000..cebd1a3 Binary files /dev/null and b/lib/logback-classic-1.0.9.jar differ diff --git a/lib/logback-core-1.0.9.jar b/lib/logback-core-1.0.9.jar new file mode 100644 index 0000000..f526524 Binary files /dev/null and b/lib/logback-core-1.0.9.jar differ diff --git a/lib/netcdf-4.3.19.jar b/lib/netcdf-4.3.19.jar new file mode 100644 index 0000000..b4c5ec5 Binary files /dev/null and b/lib/netcdf-4.3.19.jar differ diff --git a/lib/protobuf-java-2.5.0.jar b/lib/protobuf-java-2.5.0.jar new file mode 100644 index 0000000..4c4e686 Binary files /dev/null and b/lib/protobuf-java-2.5.0.jar differ diff --git a/lib/quartz-2.1.1.jar b/lib/quartz-2.1.1.jar new file mode 100644 index 0000000..27a45f6 Binary files /dev/null and b/lib/quartz-2.1.1.jar differ diff --git a/lib/slf4j-api-1.7.5.jar b/lib/slf4j-api-1.7.5.jar new file mode 100644 index 0000000..8f004d3 Binary files /dev/null and b/lib/slf4j-api-1.7.5.jar differ diff --git a/lib/udunits-4.3.19.jar b/lib/udunits-4.3.19.jar new file mode 100644 index 0000000..5ca6289 Binary files /dev/null and b/lib/udunits-4.3.19.jar differ -- cgit v1.2.3