cambecc / grib2json

converts GRIB2 files to JSON
MIT License
356 stars 154 forks source link

Correct installation of grib2json library #19

Open Edison91 opened 8 years ago

Edison91 commented 8 years ago

The following steps were run successfully through Ubuntu 14.04 for installing grib2json library.

Step 1: git clone https://github.com/cambecc/grib2json.git

Step 2: cd grib2json/src/bin/

Step 3: change the java path if necessary, that is, if your system java path is different from the one in grib2json file. Provide the correct path in "grib2json" file, save and close the file.

Ste4: Change to grib2json directory by typing "cd grib2json" on terminal.

Step 5: Build by typing "mvn package" on terminal. In order to run this command you need maven installed. I installed it using: sudo apt-get install maven2

Step 6: After building with mvn package, you need to unzip and untar target\grib2json-0.8.0-SNAPSHOT.tar.gz. When you do this, it will create a bin subdirectory, which will contain grib2json and grib2json.cmd.

The following command convert "gfs_4_20160717_0000_000.grb2" to "gfs_4_20160717_0000_000.json": sh grib2json --names --data --fp 2 --fs 103 --fv 10.0 --output gfs_4_20160717_0000_000.json ~/Downloads/gfs_4_20160717_0000_000.grb2. This command must be executed from where "grib2json" is located.

Hope this saved your precious time.

WernerRaath commented 8 years ago

I've been struggling the whole day to get this working... Keep on getting the following error: Exception in thread "main" java.lang.NoClassDefFoundError: com/lexicalscope/jewel/JewelRuntimeException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2625) at java.lang.Class.getMethod0(Class.java:2866) at java.lang.Class.getMethod(Class.java:1676) at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486) Caused by: java.lang.ClassNotFoundException: com.lexicalscope.jewel.JewelRuntimeException at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 6 more

gustavost26 commented 5 years ago

I downloaded the following gfs.t00z.pgrb2.1p00.f000 config file shown in github.

But when executing the following command: sh grib2json -d -n -o current-wind-surface-level-gfs-1.0.json gfs.t00z.pgrb2.1p00.f000

And presenting the following error:

java.io.IOException: java.io.IOException: Cant read gfs.t00z.pgrb2.1p00.f000: not a valid CDM file. at ucar.nc2.NetcdfFile.open(NetcdfFile.java:425) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:392) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:379) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:367) at net.nullschool.grib2json.Grib2Json.write(Grib2Json.java:114) at net.nullschool.grib2json.Launcher.main(Launcher.java:75) Caused by: java.io.IOException: Cant read gfs.t00z.pgrb2.1p00.f000: not a valid CDM file. at ucar.nc2.NetcdfFile.open(NetcdfFile.java:803) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:422) ... 5 more

I noticed that the file I downloaded according to the github tutorial does not have the extension .grb2

How do I download a file with this extension for possible conversion to json?

Sources: https://github.com/cambecc/earth https://github.com/cambecc/grib2json

gustavost26 commented 5 years ago

I downloaded the following gfs.t00z.pgrb2.1p00.f000 config file shown in github.

But when executing the following command: sh grib2json -d -n -o current-wind-surface-level-gfs-1.0.json gfs.t00z.pgrb2.1p00.f000

And presenting the following error:

java.io.IOException: java.io.IOException: Cant read gfs.t00z.pgrb2.1p00.f000: not a valid CDM file. at ucar.nc2.NetcdfFile.open(NetcdfFile.java:425) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:392) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:379) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:367) at net.nullschool.grib2json.Grib2Json.write(Grib2Json.java:114) at net.nullschool.grib2json.Launcher.main(Launcher.java:75) Caused by: java.io.IOException: Cant read gfs.t00z.pgrb2.1p00.f000: not a valid CDM file. at ucar.nc2.NetcdfFile.open(NetcdfFile.java:803) at ucar.nc2.NetcdfFile.open(NetcdfFile.java:422) ... 5 more

I noticed that the file I downloaded according to the github tutorial does not have the extension .grb2

How do I download a file with this extension for possible conversion to json?

Sources: https://github.com/cambecc/earth https://github.com/cambecc/grib2json

I downloaded the correct file to convert to json through this page: https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_1p00.pl http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_1p00.pl?dir=%2Fgfs.2018122700

gaowqspace commented 4 months ago

Do we have to install java8?