Class GeoGridDataSource

All Implemented Interfaces:
Sharable, DataSource, DataSourceFactory, XmlPersistable
Direct Known Subclasses:
DodsGeoGridDataSource, ImageGridDataSource

public class GeoGridDataSource extends GridDataSource
Handles gridded files
Author:
IDV Development Team
  • Field Details

    • DOMAIN_SET_MUTEX

      protected final Object DOMAIN_SET_MUTEX
      Used to synchronize the geogridadapter
    • PREF_VERTICALCS

      public static final String PREF_VERTICALCS
      Preference
      See Also:
    • PREF_LARGE_REMOTE_DATA_WARN

      public static final String PREF_LARGE_REMOTE_DATA_WARN
      Preference - warn users for large remote data requests
      See Also:
    • PROP_GRIDSIZE

      public static final String PROP_GRIDSIZE
      grid size
      See Also:
    • PROP_TIMESIZE

      public static final String PROP_TIMESIZE
      property timesize
      See Also:
    • PROP_TIMEVAR

      public static final String PROP_TIMEVAR
      property time variable
      See Also:
    • readLock

      protected final Object readLock
      This is used to synchronize geogrid read access
    • testMode

      public static boolean testMode
      for test
  • Constructor Details

    • GeoGridDataSource

      public GeoGridDataSource()
      Default constructor
    • GeoGridDataSource

      public GeoGridDataSource(DataSourceDescriptor descriptor, ucar.nc2.dt.grid.GridDataset gds, String name, String filename)
      Construct a GeoGridDataSource
      Parameters:
      descriptor - the data source descriptor
      gds - The GridDataset
      name - A name
      filename - the filename
    • GeoGridDataSource

      public GeoGridDataSource(ucar.nc2.dt.grid.GridDataset gds)
      Create a GeoGridDataSource from the GridDataset
      Parameters:
      gds - the GridDataset
    • GeoGridDataSource

      public GeoGridDataSource(DataSourceDescriptor descriptor, File file, Hashtable properties) throws IOException
      Create a GeoGridDataSource from a File.
      Parameters:
      descriptor - Describes this data source, has a label etc.
      file - This is the file that points to the actual data source.
      properties - General properties used in the base class
      Throws:
      IOException - problem opening file
    • GeoGridDataSource

      public GeoGridDataSource(DataSourceDescriptor descriptor, String filename, Hashtable properties) throws IOException
      Create a GeoGridDataSource from the filename.
      Parameters:
      descriptor - Describes this data source, has a label etc.
      filename - This is the filename (or url) that points to the actual data source.
      properties - General properties used in the base class
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • GeoGridDataSource

      public GeoGridDataSource(DataSourceDescriptor descriptor, List files, Hashtable properties) throws IOException
      Create a GeoGridDataSource from the filename.
      Parameters:
      descriptor - Describes this data source, has a label etc.
      files - List of files or urls
      properties - General properties used in the base class
      Throws:
      IOException - Signals that an I/O exception has occurred.
  • Method Details

    • setDefaultSelectionBounds

      public void setDefaultSelectionBounds(Rectangle2D.Float rect)
      Set the default selection bounds
      Parameters:
      rect - rectangle
    • applyFieldMask

      protected void applyFieldMask(Element root)
      Load any subset info in field mask xml
      Overrides:
      applyFieldMask in class DataSourceImpl
      Parameters:
      root - xml root
    • canDoFieldMask

      protected boolean canDoFieldMask()
      Can we mask the data?
      Overrides:
      canDoFieldMask in class DataSourceImpl
      Returns:
      true if we can
    • writeFieldMaskFile

      protected void writeFieldMaskFile(Document doc, Element root)
      Write out the field mask file
      Overrides:
      writeFieldMaskFile in class DataSourceImpl
      Parameters:
      doc - doc to write to
      root - root node
    • initAfterUnpersistence

      public void initAfterUnpersistence()
      Initialize if being unpersisted.
      Specified by:
      initAfterUnpersistence in interface DataSource
      Overrides:
      initAfterUnpersistence in class FilesDataSource
    • doMakeGeoSubsetPropertiesComponent

      protected JComponent doMakeGeoSubsetPropertiesComponent()
      Add in the spatial dimensions label
      Overrides:
      doMakeGeoSubsetPropertiesComponent in class DataSourceImpl
      Returns:
      The subset properties component
    • getExtraGeoSelectionComponent

      protected JComponent getExtraGeoSelectionComponent()
      Get the extra label that is shown in the geo-subset panel
      Overrides:
      getExtraGeoSelectionComponent in class DataSourceImpl
      Returns:
      Extra label for geosubset panel
    • addPropertiesTabs

      public void addPropertiesTabs(JTabbedPane tabbedPane)
      Add any extra tabs into the properties tab
      Overrides:
      addPropertiesTabs in class DataSourceImpl
      Parameters:
      tabbedPane - The properties tab
    • initAfterCreation

      public void initAfterCreation()
      Initialize after we have been created.
      Specified by:
      initAfterCreation in interface DataSource
      Overrides:
      initAfterCreation in class FilesDataSource
    • getDataPaths

      public List getDataPaths()
      What should be changed by the user when in data relative mode
      Specified by:
      getDataPaths in interface DataSource
      Overrides:
      getDataPaths in class FilesDataSource
      Returns:
      paths to changed
    • updateState

      public void updateState(Object newObject, Hashtable newProperties)
      Update the state
      Specified by:
      updateState in interface DataSource
      Overrides:
      updateState in class FilesDataSource
      Parameters:
      newObject - new object
      newProperties - properties
    • setTmpPaths

      public void setTmpPaths(List paths)
      Set what the user has changed
      Specified by:
      setTmpPaths in interface DataSource
      Overrides:
      setTmpPaths in class DataSourceImpl
      Parameters:
      paths - new paths
    • resolvePath

      protected void resolvePath()
      Resolve the url if we have to
    • sourcesChanged

      protected void sourcesChanged()
      The source has changed
      Overrides:
      sourcesChanged in class FilesDataSource
    • reloadData

      public void reloadData()
      Clear out the data set
      Specified by:
      reloadData in interface DataSource
      Overrides:
      reloadData in class FilesDataSource
    • doRemove

      public void doRemove()
      Called when Datasource is removed.
      Specified by:
      doRemove in interface DataSource
      Overrides:
      doRemove in class FilesDataSource
    • canSaveDataToLocalDisk

      public boolean canSaveDataToLocalDisk()
      Can this DataSource save data to local disk?
      Specified by:
      canSaveDataToLocalDisk in interface DataSource
      Overrides:
      canSaveDataToLocalDisk in class DataSourceImpl
      Returns:
      true if this DataSource can save data to local disk?
    • getSaveDataFileLabel

      protected String getSaveDataFileLabel()
      Get the label for the save data file option
      Overrides:
      getSaveDataFileLabel in class DataSourceImpl
      Returns:
      label
    • makeSaveLocalActions

      protected void makeSaveLocalActions(List actions)
      Make savel local actions
      Overrides:
      makeSaveLocalActions in class DataSourceImpl
      Parameters:
      actions - list of actions
    • beginWritingDataToLocalDisk

      protected Object beginWritingDataToLocalDisk(String msg)
      Overwrite this method so we don't show the loading dialog
      Overrides:
      beginWritingDataToLocalDisk in class DataSourceImpl
      Parameters:
      msg - The msg to show in the dialog
      Returns:
      The jobmanager loadid
    • saveDataToLocalDisk

      protected List saveDataToLocalDisk(String prefix, Object loadId, boolean changeLinks) throws Exception
      Save the data to local disk.
      Overrides:
      saveDataToLocalDisk in class FilesDataSource
      Parameters:
      prefix - the prefix for the local file name
      loadId - the load id (for cancelling)
      changeLinks - true to change the links
      Returns:
      The list of files
      Throws:
      Exception - problem saving data.
    • isLocalFile

      public boolean isLocalFile()
      Are we a local file
      Returns:
      is a local file
    • setNewFiles

      public void setNewFiles(List files)
      Overwrite setNewFiles so we clear out the resolverurl
      Specified by:
      setNewFiles in interface DataSource
      Overrides:
      setNewFiles in class FilesDataSource
      Parameters:
      files - The list of new files to use
    • getLocalDirectory

      protected String getLocalDirectory(String label, String prefix)
      Get the local directory
      Overrides:
      getLocalDirectory in class DataSourceImpl
      Parameters:
      label - a label
      prefix - the prefix
      Returns:
      the path
    • getFullDescription

      public String getFullDescription()
      Get the full description of the grid
      Specified by:
      getFullDescription in interface DataSource
      Overrides:
      getFullDescription in class FilesDataSource
      Returns:
      the description
    • resetTmpState

      public void resetTmpState()
      Reset the tmp state
      Specified by:
      resetTmpState in interface DataSource
      Overrides:
      resetTmpState in class DataSourceImpl
    • doMakeDataSet

      protected ucar.nc2.dt.grid.GridDataset doMakeDataSet()
      Create the dataset from the name of this DataSource.
      Returns:
      new GridDataset
    • getDataset

      public ucar.nc2.dt.grid.GridDataset getDataset()
      Return the GridDataset associated with this DataSource.
      Returns:
      dataset
    • getSampleDataProjection

      protected ucar.unidata.geoloc.ProjectionImpl getSampleDataProjection()
      Return the sample projection
      Overrides:
      getSampleDataProjection in class DataSourceImpl
      Returns:
      the sample projection
    • doMakeDataChoices

      protected void doMakeDataChoices()
      This method is called at initialization time and creates a set of DirectDataChoice-s and adds them into the base class managed list of DataChoice-s with the method addDataChoice.
      Overrides:
      doMakeDataChoices in class DataSourceImpl
    • getDataInner

      protected Data getDataInner(DataChoice dataChoice, DataCategory category, DataSelection givenDataSelection, Hashtable requestProperties) throws VisADException, RemoteException
      Get the Data object specified by the particular selection criteria.
      Overrides:
      getDataInner in class DataSourceImpl
      Parameters:
      dataChoice - DataChoice to select.
      category - DataCategory (unused at present)
      givenDataSelection - DataSelection criteria for this request.
      requestProperties - extra request selection properties (not used in this class)
      Returns:
      Data object corresponding to the data choice
      Throws:
      VisADException - couldn't create Data object
      RemoteException - couldn't create remote Data object
    • listParameters

      public List<String> listParameters()
      Get the list of parameters
      Returns:
      the list
    • getData

      public Data getData(String parameter) throws VisADException, RemoteException
      Get the data for a particular parameter
      Parameters:
      parameter - the parameter name
      Returns:
      the Data or null
      Throws:
      RemoteException - Java RMI Error
      VisADException - VisAD Error
    • doMakeDateTimes

      protected List doMakeDateTimes()
      Return the list of DateTime-s associated with this DataSource.
      Overrides:
      doMakeDateTimes in class DataSourceImpl
      Returns:
      List of DateTime-s.
    • getAllLevels

      public List getAllLevels(DataChoice dataChoice, DataSelection dataSelection)
      Get the list of all levels available from this DataSource
      Specified by:
      getAllLevels in interface DataSource
      Overrides:
      getAllLevels in class DataSourceImpl
      Parameters:
      dataChoice - The data choice we are getting levels for
      dataSelection - the data selection
      Returns:
      List of all available levels
    • canDoGeoSelection

      public boolean canDoGeoSelection()
      We can do geo selection in the properties gui
      Specified by:
      canDoGeoSelection in interface DataSource
      Overrides:
      canDoGeoSelection in class DataSourceImpl
      Returns:
      can do geo selection
    • canCacheDataToDisk

      public boolean canCacheDataToDisk()
      Can this data source cache its
      Overrides:
      canCacheDataToDisk in class DataSourceImpl
      Returns:
      can cache data to disk
    • calculateStrideFactor

      public int calculateStrideFactor(int dataPoints, int displayPoints)
      _more_
      Parameters:
      dataPoints - _more_
      displayPoints - _more_
      Returns:
      _more_
    • getTimeIndexWithBounds

      public int getTimeIndexWithBounds(DateTime dateTime, List<DateTime> allTimes, ucar.nc2.dataset.CoordinateAxis1DTime cca)
      Find the time index in the dataset with smallest bound values
      Parameters:
      dateTime - the time
      allTimes - the DateTime list
      cca - the data CoordinateAxis1DTime
      Returns:
      the GeoGrid or null dataset doesn't exist or if variable not found
    • findGridForDataChoice

      public ucar.nc2.dt.grid.GeoGrid findGridForDataChoice(ucar.nc2.dt.grid.GridDataset ds, DataChoice dc)
      Find the grid in the dataset from the DataChoice
      Parameters:
      ds - the grid dataset
      dc - the data choice
      Returns:
      the GeoGrid or null dataset doesn't exist or if variable not found
    • isZAxisOk

      protected boolean isZAxisOk(ucar.nc2.dataset.CoordinateAxis1D zaxis)
      Utility to check if we should ignore the given z axis
      Parameters:
      zaxis - given z axis
      Returns:
      Is ok
    • getAllDateTimes

      public List getAllDateTimes(DataChoice dataChoice)
      Override the base class method to return the times for the data choice
      Specified by:
      getAllDateTimes in interface DataSource
      Overrides:
      getAllDateTimes in class DataSourceImpl
      Parameters:
      dataChoice - DataChoice in question
      Returns:
      List of all times for that choice
    • isNumeric

      public static boolean isNumeric(String str)
      check if a input is only numeric number
      Parameters:
      str - is this numeric
      Returns:
      true if numeric
    • main

      public static void main(String[] args) throws Exception
      Test this class by running "java ucar.unidata.data.grid.GeoGridDataSource "
      Parameters:
      args - filename
      Throws:
      Exception - some error occurred
    • setFileNameOrUrl

      public void setFileNameOrUrl(String value)
      Set the FileNameOrUrl property.
      Parameters:
      value - The new value for FileNameOrUrl
    • applyProperties

      public boolean applyProperties()
      Apply the properties
      Overrides:
      applyProperties in class DataSourceImpl
      Returns:
      everything ok
    • getExtraTimesComponent

      protected JComponent getExtraTimesComponent()
      Add the reverse times checkbox
      Overrides:
      getExtraTimesComponent in class DataSourceImpl
      Returns:
      extra comp
    • setReverseTimes

      public void setReverseTimes(boolean value)
      Set the ReverseTimes property.
      Parameters:
      value - The new value for ReverseTimes
    • getReverseTimes

      public boolean getReverseTimes()
      Get the ReverseTimes property.
      Returns:
      The ReverseTimes