[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDFJava #KSI-756893]: read data from grib2 according to latitude and longitude range



Greetings Veir,

You want to open the file as you are doing now:

ucar.nc2.dt.grid.GridDataset.open(location);

Then, rather than using findGridDatatype, use the findGridByName method on the 
GridDataset:

https://www.unidata.ucar.edu/software/thredds/current/netcdf-java/javadoc/ucar/nc2/dt/grid/GridDataset.html#findGridByName-java.lang.String-

This will give you a GeoGrid object. There is a method on GeoGrid called 
makeSubet 
that will allow you to create a logical subset of the grid:

https://www.unidata.ucar.edu/software/thredds/current/netcdf-java/javadoc/ucar/nc2/dt/grid/GeoGrid.html#makeSubset-ucar.ma2.Range-ucar.ma2.Range-ucar.unidata.geoloc.LatLonRect-int-int-int-

Once you have your logical subset, you can then use the methods in GridDatatype 
to
read the values as constrained by the subset.

https://www.unidata.ucar.edu/software/thredds/current/netcdf-java/javadoc/ucar/nc2/dt/GridDatatype.html

Cheers,

Sean


> I would like to know that how to read the values of a Variable according to 
> latitude and longitude range(eg:lat:90.02~95.56, lon:0.02~4.12). Is there any 
> example?
> 
> 
> 
> 
> ------------------ ??? ------------------
> : "support-netcdf-java"<address@hidden>;
> ?: 20171220() 11:58
> ?: "Veir"<address@hidden>;
> : [netCDFJava #KSI-756893]: read data from grib2 according to latitude and 
> longitude range
> 
> 
> 
> 
> Veir,
> 
> Your Ticket has been received, and a Unidata staff member will review it and 
> reply accordingly. Listed below are details of this new Ticket. Please make 
> sure the Ticket ID remains in the Subject: line on all correspondence related 
> to this Ticket.
> 
> NOTE: All email exchanges with Unidata User Support are recorded in the 
> Unidata inquiry tracking system and then made publicly available through the 
> web.  If you do not want to have your interactions made available in this 
> way, you must let us know in each email you send to us.
> 
> Ticket ID: KSI-756893
> Subject: read data from grib2 according to latitude and longitude range
> Department: Support netCDF Java
> Priority: Normal
> Status: Open
> 
> 
> 
> NOTE: All email exchanges with Unidata User Support are recorded in the 
> Unidata inquiry tracking system and then made publicly available through the 
> web.  If you do not want to have your interactions made available in this 
> way, you must let us know in each email you send to us.
> 
> Please let us know how we can assist you further.
> 
> Unidata User Support

Ticket Details
===================
Ticket ID: KSI-756893
Department: Support netCDF Java
Priority: Normal
Status: Open
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.