Giter Site home page Giter Site logo

Comments (7)

spidru avatar spidru commented on June 18, 2024

Hi @binu8051,

I'm not sure what you mean by "0.5.0 have to jar files", can you please clarify?

Also, can you share the relevant part of your code where you are trying to use JGribX? It would also be helpful to share the error log.

from jgribx.

binu8051 avatar binu8051 commented on June 18, 2024

I'm not sure what you mean by "0.5.0 have to jar files", can you please clarify?

Its typing error, 0.5.0 have two jar files (jgribx-jdk8.jar, jgribx-jdk9.jar).
which i need to use?
i tried placing the jar in the Libs folder, but android studio cant recognize the
GribFile gribFile = new GribFile("src/test/resources/" + gribFilename);

from jgribx.

binu8051 avatar binu8051 commented on June 18, 2024

Hi added the complete project and now its work.

Need a help, i want to read the wind speed and direction from a grib file
this the output which i used with the Example code

I/System.out: ---------------------------------------
I/System.out: Reading file:
I/System.out: GRIB Edition: 1
I/System.out: Records successfully read: 174 of 174
I/System.out: ---------------------------------------
I/System.out: Weather Centre(s): 7 [US National Weather Service, National Centers for Environmental Prediction (NCEP)]
I/System.out: Generating Process(es): 96 [Global Forecast System Model]
I/System.out: Forecast Time(s):
I/System.out: 11-03-2022 15:00:00 IST
I/System.out: 11-03-2022 18:00:00 IST
I/System.out: 11-03-2022 21:00:00 IST
I/System.out: 12-03-2022 00:00:00 IST
I/System.out: 12-03-2022 03:00:00 IST
I/System.out: 12-03-2022 06:00:00 IST
I/System.out: 12-03-2022 09:00:00 IST
I/System.out: 12-03-2022 12:00:00 IST
I/System.out: 12-03-2022 15:00:00 IST
I/System.out: 12-03-2022 18:00:00 IST
I/System.out: 12-03-2022 21:00:00 IST
I/System.out: 13-03-2022 00:00:00 IST
I/System.out: 13-03-2022 03:00:00 IST
I/System.out: 13-03-2022 06:00:00 IST
I/System.out: 13-03-2022 09:00:00 IST
I/System.out: 13-03-2022 12:00:00 IST
I/System.out: 13-03-2022 15:00:00 IST
I/System.out: 13-03-2022 18:00:00 IST
I/System.out: 13-03-2022 21:00:00 IST
I/System.out: 14-03-2022 00:00:00 IST
I/System.out: 14-03-2022 03:00:00 IST
I/System.out: 14-03-2022 06:00:00 IST
I/System.out: 14-03-2022 09:00:00 IST
I/System.out: 14-03-2022 12:00:00 IST
I/System.out: 14-03-2022 15:00:00 IST
I/System.out: 14-03-2022 18:00:00 IST
I/System.out: 14-03-2022 21:00:00 IST
I/System.out: 15-03-2022 00:00:00 IST
I/System.out: 15-03-2022 03:00:00 IST
I/System.out: 15-03-2022 06:00:00 IST
I/System.out: 15-03-2022 09:00:00 IST
I/System.out: 15-03-2022 12:00:00 IST
I/System.out: 15-03-2022 15:00:00 IST
I/System.out: 15-03-2022 18:00:00 IST
I/System.out: 15-03-2022 21:00:00 IST
I/System.out: 16-03-2022 00:00:00 IST
I/System.out: 16-03-2022 03:00:00 IST
I/System.out: 16-03-2022 06:00:00 IST
I/System.out: 16-03-2022 09:00:00 IST
I/System.out: 16-03-2022 12:00:00 IST
I/System.out: 16-03-2022 15:00:00 IST
I/System.out: 16-03-2022 18:00:00 IST
I/System.out: 16-03-2022 21:00:00 IST
I/System.out: 17-03-2022 00:00:00 IST
I/System.out: 17-03-2022 03:00:00 IST
I/System.out: 17-03-2022 06:00:00 IST
I/System.out: 17-03-2022 09:00:00 IST
I/System.out: 17-03-2022 12:00:00 IST
I/System.out: 17-03-2022 15:00:00 IST
I/System.out: 17-03-2022 18:00:00 IST
I/System.out: 17-03-2022 21:00:00 IST
I/System.out: 18-03-2022 00:00:00 IST
I/System.out: 18-03-2022 03:00:00 IST
I/System.out: 18-03-2022 06:00:00 IST
I/System.out: 18-03-2022 09:00:00 IST
I/System.out: 18-03-2022 12:00:00 IST
I/System.out: 18-03-2022 15:00:00 IST
I/System.out: 18-03-2022 18:00:00 IST
I/System.out: 18-03-2022 21:00:00 IST
I/System.out: 19-03-2022 00:00:00 IST
I/System.out: 19-03-2022 03:00:00 IST
I/System.out: 19-03-2022 06:00:00 IST
I/System.out: 19-03-2022 09:00:00 IST
I/System.out: 19-03-2022 12:00:00 IST
I/System.out: 19-03-2022 15:00:00 IST
I/System.out: 19-03-2022 18:00:00 IST
I/System.out: 19-03-2022 21:00:00 IST
I/System.out: 20-03-2022 00:00:00 IST
I/System.out: 20-03-2022 03:00:00 IST
I/System.out: 20-03-2022 06:00:00 IST
I/System.out: 20-03-2022 09:00:00 IST
I/System.out: 20-03-2022 12:00:00 IST
I/System.out: 20-03-2022 15:00:00 IST
I/System.out: 20-03-2022 18:00:00 IST
I/System.out: 20-03-2022 21:00:00 IST
I/System.out: 21-03-2022 00:00:00 IST
I/System.out: 21-03-2022 03:00:00 IST
I/System.out: 21-03-2022 06:00:00 IST
I/System.out: 21-03-2022 09:00:00 IST
I/System.out: 21-03-2022 12:00:00 IST
I/System.out: 22-03-2022 00:00:00 IST
I/System.out: 22-03-2022 12:00:00 IST
I/System.out: 23-03-2022 00:00:00 IST
I/System.out: 23-03-2022 12:00:00 IST
I/System.out: 24-03-2022 00:00:00 IST
I/System.out: 24-03-2022 12:00:00 IST
I/System.out: 25-03-2022 00:00:00 IST
I/System.out: Reference Time:
I/System.out: 11-03-2022 12:00:00 IST
I/System.out: Data:
I/System.out: UGRD: TGL:10
I/System.out: VGRD: TGL:10

i use this code to get the record

Calendar forecastDate = new GregorianCalendar(2023, Calendar.MARCH, 15, 9, 0, 0);
String parameterCode = "UGRD";    // parameter code for temperature
String ltvid = "TGL:10";       // LTVID (level type-value ID)
GribRecord gribRecord=gribFile.getRecord(forecastDate, parameterCode, ltvid);

the gribRecord from the above code is given below.

GRIB record:
IS section:
Grib Edition 1
length: 5422 bytes
PDS header:
center: 7
subcenter: 0
table: 2
grid_id: 255
time: 27.3.2022 0:0 (dd.mm.yyyy hh:mm)
Type: UGRD
Description: u-component of wind
Unit: m/s
table version: 2
Level description:
parameter id: 105
name: specified height level above ground
description: 10.0 m above ground
units: m
short descr: TGL
increasing up?: true
single layer?: false
value1: 10.0
value2: NaN
dec.scale: 0
GDS exists
GDS section:
LatLon Grid (73x65)
lon: 59.0 to 95.0 (dx 0.5)
lat: 23.0 to -9.0 (dy -0.5)
BDS section:
min/max value: -5.7507935 8.499207
ref. value: -5.7507935
is a constant: false
bin. scale: -5
num bits: 9

how to get the wind speed and direction, please help.
Thanks.

from jgribx.

spidru avatar spidru commented on June 18, 2024

Hi @binu8051,

To get the wind speed and direction, you will need to obtain the u- and v-components of the wind vector.

Calendar forecastDate = new GregorianCalendar(2023, Calendar.MARCH, 15, 9, 0, 0);

// UGRD
String parameterCode = "UGRD";    // parameter code for temperature
String ltvid = "TGL:10";       // LTVID (level type-value ID)
GribRecord gribRecord = gribFile.getRecord(forecastDate, parameterCode, ltvid);
double ugrd = gribRecord.getValue(latitude, longitude); // you need to pass the coordinates of interest here

// VGRD
// TODO Similar to above

// Scalar speed
double speed = Math.sqrt(Math.pow(ugrd, 2) + Math.pow(vgrd, 2));

// Direction
// TODO

Hope this helps.

from jgribx.

binu8051 avatar binu8051 commented on June 18, 2024

Thanks i got it, one more help how to get the minimum and maximum lat/lng from the below GDS section

GDS section:
LatLon Grid (73x65)
lon: 59.0 to 95.0 (dx 0.5)
lat: 23.0 to -9.0 (dy -0.5)

from jgribx.

binu8051 avatar binu8051 commented on June 18, 2024

global-wind-wave.zip
Hi i cant read this file and here is the GRIB record.

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

Can you please check it, but the same file can be opened in xygrib viewer software.

from jgribx.

spidru avatar spidru commented on June 18, 2024

Hi @binu8051,

Could you please submit a separate issue for your last comment? I would like to close this issue since the original question was resolved. Thanks.

from jgribx.

Related Issues (15)

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.