Giter Site home page Giter Site logo

jgribx's People

Contributors

kubovy avatar reymalahay avatar spidru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jgribx's Issues

How to use this library in my Android App

Hi
I tried to add this library in my android app to read the Grib file.
0.5.0 have to jar files so i download the 0.4 version jar file and add it to my libs folder.
GribFile gribFile = new GribFile("filename.grb"); // typically .grb or .grb2 extension
gives error and there is nothing to import.

How to use this library on my app, Thanks
Binu

Support other data representation templates

Currently this library supports only "Grid Point Data - Complex Packing and Spatial Differencing". It would be useful to support more than this one to enable reading GRIB2 files from e.g. NOMAD which use "Grid Point Data - Simple Packing".

Documentation can be found: https://www.yumpu.com/en/document/view/11723135/guide-to-wmo-table-driven-code-forms

The "Grid Point Data - Simple Packing" is rather simple. "Grid Point Data - Complex Packing" is more complex but as it is a base for the already implemented "Grid Point Data - Complex Packing and Spatial Differencing" this should also be feasable.

NoValidGribException: No valid GRIB records found.

Hello.
I currently pull my grib2 data from https://tgftp.nws.noaa.gov/SL.us008001/ST.opnl/MT.gfs_CY.00/RD.20220705/PT.grid_DF.gr2/. When I put this data into a GribFile, I get the NoValidGribException. I am using the current version of the JGribX.jar. After downloading one of these records from this url, I also checked using java -jar JGribX.jar -i grib2.grb and I get the same NoValidGribException. Can you please tell me what is wrong with this data?

Thank you.

NPE on getValue when record is constant

Exception in thread "main" java.lang.NullPointerException
at mt.edu.um.cf2.jgribx.grib1.Grib1RecordBDS.getValue(Grib1RecordBDS.java:276)
at mt.edu.um.cf2.jgribx.grib1.Grib1Record.getValue(Grib1Record.java:296)

Build's tests failed and code does not work, both due to NoValidGribException on valid GRIB2 files

Hi.

I downloaded the actual source code (commit 0e5b8c3 and try to build it with gradle on Intellij. When doing it, all two thirdof the tests failed due to NoValidGribException. Here is the compilation output on Intellij console :

15:52:50: Executing task 'build'...

:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar UP-TO-DATE
:assemble UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test

mt.edu.um.cf2.jgribx.GribTest > testVersion STARTED

mt.edu.um.cf2.jgribx.GribTest > testVersion PASSED

mt.edu.um.cf2.jgribx.GribTest > testGrib1Gfs3 STARTED

mt.edu.um.cf2.jgribx.GribTest > testGrib1Gfs3 FAILED
    mt.edu.um.cf2.jgribx.NoValidGribException at GribTest.java:58

mt.edu.um.cf2.jgribx.GribTest > testGrib2Gfs3 STARTED

mt.edu.um.cf2.jgribx.GribTest > testGrib2Gfs3 FAILED
    mt.edu.um.cf2.jgribx.NoValidGribException at GribTest.java:163

3 tests completed, 2 failed
:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///C:/Users/amerat/Downloads/JGribX-master/JGribX-master/build/reports/tests/test/index.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
6 actionable tasks: 1 executed, 5 up-to-date
15:52:54: Task execution finished 'build'.

I thought it was due to corrupted GRIB files in your repository, but when I try with my own and with the JAR I built from the actual code (not your release), it fails too giving me this error :

mt.edu.um.cf2.jgribx.NoValidGribException: No valid GRIB records found.
	at mt.edu.um.cf2.jgribx.GribFile.<init>(GribFile.java:138)
	at mt.edu.um.cf2.jgribx.GribFile.<init>(GribFile.java:80)
	at mt.edu.um.cf2.jgribx.GribFile.<init>(GribFile.java:63)

The GRIB2 file I use is not corrupted, I can open it in Nasa's Panoply GUI Software without any error. Reading your GribFile.java:138, it looks like the code is seeing an empty record whereas it is not.

In my GRIB2 file, there's only one data Temperature_height_above_ground at only one timestamp 2021-10-12 14:00+0000 and height 2.00000 m, thus I wrote the code below.

Please note that the GRIB2 data is first acquired by a client API so that's why it's first held by a variable bytes which type is Array[Byte]. Before using your library I write the GRIB2 data to a file and then pass it's path to the GribFile constructor. This part of the code works fine, I can open the created file in Nasa's Panoply.

      import mt.edu.um.cf2.jgribx._
      import java.util.Calendar
      import java.util.GregorianCalendar
      
      val path: String = "mf-data.grb2"
      val file: File = new File(path)
      FileUtils.writeByteArrayToFile(file, bytes)
      
      val gribFile: GribFile = new GribFile(path)
      
      val date: Calendar = new GregorianCalendar(2021, Calendar.OCTOBER, 12, 14, 0, 0)
      val parameter: String = "TMP"
      val ltvid: String = "TGL:2"     // TGL = "specified height level above ground" & 2 = 2 meters
      val lat: Double = 50.7
      val lon: Double = 362.29
      
      val record: GribRecord = gribFile.getRecord(date, parameter, ltvid)
      val value: Double = record.getValue(lat, lon)
      println("Value at (" + lat + ", " + lon + ") : " + value + "\n")

Thanks.

Does not read all records

When I try to read a grab file, I get "Records successfully read: 1 of 195". What does "RecordsSkipped" mean?

getRecord does not work with level without level value

I have GRB1 file with SFC level, but without level value.

  • If I search for records with "SFC", it does not find any record, because
    src/main/mt/edu/um/cf2/jgribx/GribFile.java:359 if (matcher.find()) is false
  • if I put "SFC:0" it does not find any record because record.getLevelValues()[0] is NaN
  • if I put "SFC:", it fails with
    Exception in thread "main" java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Integer.java:542) at java.lang.Integer.parseInt(Integer.java:615) at mt.edu.um.cf2.jgribx.GribFile.getRecord(GribFile.java:364)

NoValidGribException: No valid GRIB records found for RAP and NAM wind data

Hello.
You have recently updated the jgribx.jar to handle the following data: https://tgftp.nws.noaa.gov/SL.us008001/ST.opnl/MT.gfs_CY.00/RD.20220705/PT.grid_DF.gr2/.
Now I am having issues with NAM and RAP data:

https://tgftp.nws.noaa.gov/SL.us008001/ST.opnl/MT.rap_CY.06/RD.20220725/PT.grid_DF.gr2/ - for RAP and https://tgftp.nws.noaa.gov/SL.us008001/ST.opnl/MT.nam_AR.ak_CY.06/RD.20220725/PT.grid_DF.gr2/ for NAM

For the RD.20220725 above- please update to the current date to see data for that day.

When I put this data into a GribFile, I get the NoValidGribException. I am using the current version of the JGribX.jar. After downloading one of these records from this url, I also checked using java -jar JGribX.jar -i grib2.grb and I get the same NoValidGribException. Can you please tell me what is wrong with this data?

Thank you so much for helping with decoding GFS - hopefully it will not be a big issue for RAP and NAM.
Christine

Getting NullPointer while loading GFS grib2 file

I am trying to load an GFS grib2 file with this library. Unfortunately I get a NullPointerException while calling

GribFile gribFile = new GribFile(gribPath);

as following:

java.lang.NullPointerException at mt.edu.um.cf2.jgribx.grib2.Grib2RecordPDS.getLevelCode(Grib2RecordPDS.java:313) at mt.edu.um.cf2.jgribx.grib2.Grib2Record.getLevelCode(Grib2Record.java:121) at mt.edu.um.cf2.jgribx.GribFile.<init>(GribFile.java:127) at mt.edu.um.cf2.jgribx.GribFile.<init>(GribFile.java:80) at mt.edu.um.cf2.jgribx.GribFile.<init>(GribFile.java:63)

I've downloaded various files from NOAA GFS to test the import, but still the same exception.

I would appreciate any help, thanks in advance.

Cant Read this type grib1 files

Hi i cant read this grib file. Can you please check it
https://github.com/spidru/JGribX/files/8329778/global-wind-wave.zip

Here is the grib record output.

GRIB record:
    IS section:
        Grib Edition 1
        length: 209505 bytes
    PDS header:
        center: 0
        subcenter: 0
        table: 255
        grid_id: 255
        time: 22.3.2022  0:0 (dd.mm.yyyy hh:mm) 
        Type: missing
        Description: missing parameter
        Unit: 
        table version: 255
        Level description:
        	parameter id: 1
        	name: ground or water surface
        	description: ground or water surface
        	units: 
        	short descr: SFC
        	increasing up?: true
        	single layer?: true
        	value1: NaN
        	value2: NaN
        dec.scale: 0
        GDS exists
        BMS exists
    GDS section:
        LatLon Grid  (366x367)
        lon: 61.2 to 97.7  (dx 0.1)
        lat: -7.7 to 28.9  (dy 0.1)
    BMS section:
        bitmap length: 134322
    BDS section:
        min/max value: -1.6407833 1.4991093
        ref. value: -1.6407833
        is a constant: false
        bin. scale: -14
        num bits: 16

Update the JAR

Can you please make a new release JAR with new commits since 2019. I need the new improvements made since then.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.