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

[IDV #SYK-697558]: IDV - issue loading OPenDAP url -> 2Dset



Hi-

> Institution: ITC
> Package Version: 2.1b1
> Operating System: os.name:Windows XP; os.arch:x86; os.version:5.1;
> Hardware Information: java.vendor:Sun Microsystems Inc.; 
> java.version:1.5.0_06; java.home:C:\\Program Files\\Java\\jre1.5.0_06; 
> j3d.version:1.3.2 fcs (build12); j3d.vendor:Sun Microsystems, Inc.; 
> j3d.renderer:OpenGL;
> Inquiry: Dear IDV-support,
> 
> we're just trying to load in  an OpenDAP datasource, but cannot display it 
> other than through a omnicontrol
> 
> Data url: 
> http://ferret.pmel.noaa.gov/NVODS-FDS/LAS/NOAA-CIRES-CDC-CDC_Derived_NCEP_Reanalysis_Products_Surface_Flux/CDC_DS40-soilw12356.dods
> The attached jython procedure (designed for MODIS) gives the follwoing error 
> messsage:
> 
> An error has occurred:
> ControlDescriptor.Creating display
> org.python.core.PyException

The problem is that the form of the data for this image is different than
that for the MODIS data.  In this case you have a time dimension, not
just the spatial dimension, so your field looks like (one of the subchoices):

(TIME -> ((LON, LAT) -> SOILW))

Here is a jython procedure which will take the time image and 
create something that can be displayed as a color shaded plan view
in the IDV's main window:

def makeUrlToTime2DSet(a):
  from visad import *
  from visad import RealType
  from visad import RealTupleType
  from visad import Gridded1DDoubleSet
  from visad import Gridded2DSet
  from ucar.unidata.data.grid import GridUtil

  timedom = a.getDomainSet()
  numTimes = timedom.getLength()
  dom1 = GridUtil.getSpatialDomain(a)
  samples = dom1.getSamples(0)
  sets = dom1.getSets()
  
  sdomain = Gridded2DSet(RealTupleType.SpatialEarth2DTuple, samples, 
                        sets[0].getLength(), sets[1].getLength(),
                        dom1.getCoordinateSystem(),
                        dom1.getSetUnits(),
                        dom1.getSetErrors(), 0, 0)

  image = GridUtil.setSpatialDomain(a,sdomain)
  newTime = Gridded1DDoubleSet(RealType.Time, timedom.getSamples(0),
                               numTimes, 
                               timedom.getCoordinateSystem(),
                               timedom.getSetUnits(),
                               timedom.getSetErrors(), 0)
  newType = FunctionType(RealTupleType.Time1DTuple, image[0].getType())
  timeImage = FieldImpl(newType, newTime)
  for i in range(numTimes):
    timeImage.setSample(i, image[i],0)
  return timeImage


Don Murray

> def makeUrlTo2DSet(a):
> from visad import *
> from visad import RealTupleType
> from visad import FunctionType
> from visad import Gridded2DSet
> from visad import FlatField
> 
> lat = a[0][0]
> lon = a[0][1]
> xyLen = lat.getDomainSet().getLengths()
> values = a[1]
> latVals = lat.getFloats(0)[0]
> lonVals = lon.getFloats(0)[0]
> domain = Gridded2DSet(RealTupleType.SpatialEarth2DTuple,
> (lonVals, latVals), xyLen[0], xyLen[1],
> None, None, None, 0, 0 )
> image = 
> FlatField(FunctionType(domain.getType().getDomain(),makeRealType("values")), 
> domain)
> image.setSamples(values.getFloats(0),0)
> return image
> 
> 
> ******************
> Stack trace:
> Traceback (innermost last):
> File "<string>", line 1, in ?
> File "<string>", line 14, in makeNCEFGridTo2DSet
> AttributeError: getDomainSet
> 
> 
> 


Ticket Details
===================
Ticket ID: SYK-697558
Department: Support IDV
Priority: Normal
Status: Open