Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct installation of grib2json library #19

Open
Edison91 opened this issue Aug 2, 2016 · 4 comments
Open

Correct installation of grib2json library #19

Edison91 opened this issue Aug 2, 2016 · 4 comments

Comments

@Edison91
Copy link

Edison91 commented Aug 2, 2016

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
Copy link

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
Copy link

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
Copy link

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
Copy link

Do we have to install java8?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants