Re: [visad] Convert Netcdf content to visad object in order generate contours coordinates

  • To: Jose Carro <joandca@xxxxxxxxx>
  • Subject: Re: [visad] Convert Netcdf content to visad object in order generate contours coordinates
  • From: Tom Whittaker <whittaker@xxxxxxxx>
  • Date: Mon, 15 Jul 2013 10:27:17 -0500
Hi Jose...

The "GridDataset" you refer to is actually the domain sampling set --
usually a "visad.Gridded2DSet".  Use the JPythonMethods method
"getDomainSet()" to get the Set for the FieldImpl.

Be a little careful about the structure of your "temperatures" object
-- if the first dimension is for "time", then you will need to
reference this as "temperature[0]" for the methods to work correctly.
(I usually just do a "print len(temperature)" and if the value is 1,
then I know I must use "temperature[0]" to reference the FlatField.)

tom

On Thu, Jul 11, 2013 at 5:17 PM, Jose Carro <joandca@xxxxxxxxx> wrote:
> Thanks Tom
> I am able to get the array of points.
> I see that function "getLatLons() requires a GridDataset.
> Based on the simple code below I have a FieldImpl object.
> How can I get a gridset in order to send as parameter to getLanLons
> function?
>
> import visad.python.JPythonMethods as JPythonMethods
>
> filename = 'd:/mymodel.nc'
> file_opener = 'file.grid'
> variable = 'sst'
> ds = makeDataSource(filename, file_opener)
> temperatures = getData(ds.getName(), variable)
>
> #Obtain points for the required temperature range 0' - 2.99 Celsius
> list=findWithinRange(temperatures,0,2.99)
>
> latlonlist=getLatLons(Gridset?,list)
>
> ........more code .....
>
> Regards
> Jose
>

--
Tom Whittaker
University of Wisconsin-Madison
Space Science & Engineering Center (SSEC)
Cooperative Institute for Meteorological Satellite Studies (CIMSS)
1225 W. Dayton Street
Madison, WI  53706  USA
ph: +1 608 262 2759