ucar.unidata.data.grid
Class GeoGridDataSource

java.lang.Object
  extended by ucar.unidata.collab.SharableImpl
      extended by ucar.unidata.data.DataSourceImpl
          extended by ucar.unidata.data.FilesDataSource
              extended by ucar.unidata.data.grid.GridDataSource
                  extended by ucar.unidata.data.grid.GeoGridDataSource
All Implemented Interfaces:
Sharable, DataSource, DataSourceFactory, XmlPersistable
Direct Known Subclasses:
DodsGeoGridDataSource

public class GeoGridDataSource
extends GridDataSource

Handles gridded files

Version:
$Revision: 1.179 $
Author:
IDV Development Team

Field Summary
static String PREF_VERTICALCS
          Preference
static String PROP_GRIDSIZE
          grid size
static String PROP_TIMESIZE
          _more_
protected  Object readLock
          This is used to synchronize geogrid read access
static boolean testMode
          for test
 
Fields inherited from class ucar.unidata.data.grid.GridDataSource
ATTR_EAST, ATTR_NORTH, ATTR_SOUTH, ATTR_WEST, ATTR_X, ATTR_Y, ATTR_Z
 
Fields inherited from class ucar.unidata.data.FilesDataSource
adapters, oldSourceFromBundles, sources
 
Fields inherited from class ucar.unidata.data.DataSourceImpl
changeDataPathsCbx, dataCacheKey, dataChoices, geoSelectionPanel, haveBeenUnPersisted, okToContinue, PARAM_SHOW_HIDE, PARAM_SHOW_NO, PARAM_SHOW_YES
 
Fields inherited from interface ucar.unidata.data.DataSource
MOST_RECENT, ordinalNames, PROP_AUTOCREATEDISPLAY, PROP_BASEDIRECTORY, PROP_CACHEABLE, PROP_DATACHOICENAME, PROP_DISPLAYPROPERTIES, PROP_DOCUMENTLINKS, PROP_FILEPATTERN, PROP_GEOLOCATION, PROP_ICON, PROP_NAME, PROP_POLLINFO, PROP_RESOLVERURL, PROP_SERVICE_HTTP, PROP_SUBPROPERTIES, PROP_TIMELABELS, PROP_TITLE
 
Constructor Summary
GeoGridDataSource()
          Default constructor
GeoGridDataSource(DataSourceDescriptor descriptor, File file, Hashtable properties)
          Create a GeoGridDataSource from a File.
GeoGridDataSource(DataSourceDescriptor descriptor, List files, Hashtable properties)
          Create a GeoGridDataSource from the filename.
GeoGridDataSource(DataSourceDescriptor descriptor, String filename, Hashtable properties)
          Create a GeoGridDataSource from the filename.
 
Method Summary
 void addPropertiesTabs(JTabbedPane tabbedPane)
          Add any extra tabs into the properties tab
protected  void applyFieldMask(Element root)
          Load any subset info in field mask xml
 boolean canCacheDataToDisk()
          Can this data source cache its
protected  boolean canDoFieldMask()
          Can we mask the data?
 boolean canDoGeoSelection()
          We can do geo selection in the properties gui
 boolean canSaveDataToLocalDisk()
          Can this DataSource save data to local disk?
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.
protected  ucar.nc2.dt.grid.GridDataset doMakeDataSet()
          Create the dataset from the name of this DataSource.
protected  List doMakeDateTimes()
          Return the list of DateTime-s associated with this DataSource.
protected  JComponent doMakeGeoSubsetPropertiesComponent()
          Add in the spatial dimensions label
 void doRemove()
          Called when Datasource is removed.
 List getAllDateTimes(DataChoice dataChoice)
          Override the base class method to return the times for the data choice
 List getAllLevels(DataChoice dataChoice, DataSelection dataSelection)
          Get the list of all levels available from this DataSource
protected  Data getDataInner(DataChoice dataChoice, DataCategory category, DataSelection givenDataSelection, Hashtable requestProperties)
          Get the Data object specified by the particular selection criteria.
 List getDataPaths()
          What should be changed by the user when in data relative mode
 ucar.nc2.dt.grid.GridDataset getDataset()
          Return the GridDataset associated with this DataSource.
protected  JComponent getExtraGeoSelectionComponent()
          Get the extra label that is shown in the geo-subset panel
 String getFullDescription()
          Get the full description of the grid
protected  String getLocalDirectory(String label, String prefix)
          _more_
protected  ucar.unidata.geoloc.ProjectionImpl getSampleDataProjection()
          Return the sample projection
protected  String getSaveDataFileLabel()
          _more_
 void initAfterCreation()
          Initialize after we have been created.
 void initAfterUnpersistence()
          Initialize if being unpersisted.
protected  boolean isZAxisOk(ucar.nc2.dataset.CoordinateAxis1D zaxis)
          Utility to check if we should ignore the given z axis
static void main(String[] args)
          Test this class by running "java ucar.unidata.data.grid.GeoGridDataSource "
protected  void makeSaveLocalActions(List actions)
          _more_
 void reloadData()
          Clear out the data set
 void resetTmpState()
          This gets called after we have been saved in a zidv bundle to reset us back to any original state
protected  void resolvePath()
          Resolve the url if we have to
protected  List saveDataToLocalDisk(String prefix, Object loadId, boolean changeLinks)
          Save the data to local disk.
 void setFileNameOrUrl(String value)
          Set the FileNameOrUrl property.
 void setTmpPaths(List paths)
          Set what the user has changed
protected  void sourcesChanged()
          The source has changed
 void updateState(Object newObject, Hashtable newProperties)
          This gets called when the user interactively does a Change data
protected  void writeFieldMaskFile(Document doc, Element root)
          Write out the field mask file
 
Methods inherited from class ucar.unidata.data.grid.GridDataSource
getThreeDCategories, getThreeDTimeSeriesCategories, getTwoDCategories, getTwoDTimeSeriesCategories, initCategories
 
Methods inherited from class ucar.unidata.data.FilesDataSource
equals, getDataFileExtension, getFilePath, getInputStreams, getLocationsForPolling, getPartialDescription, getSource, getSources, haveSources, initWithPollingInfo, isFileBased, newFilesFromPolling, processDataFilename, propertiesChanged, setNewFiles, setSource, setSources
 
Methods inherited from class ucar.unidata.data.DataSourceImpl
addActions, addDataChangeListener, addDataChoice, applyProperties, beginWritingDataToLocalDisk, canChangeData, canDoGeoSelectionMap, canDoGeoSelectionStride, canPoll, canShowParameter, checkForInitAfterUnPersistence, clearCachedData, clearFileCache, clearTimes, convertToFilesIfDirectory, createAutoDisplay, createCacheKey, createElement, decrOutstandingGetDataCalls, doDirectory, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, endWritingDataToLocalDisk, expandIfNeeded, findDataChoice, findDataChoices, flushCache, getAbsoluteDateTimes, getActions, getAlias, getAllDateTimes, getAllLevels, getCache, getCacheClearDelay, getCacheDataToDisk, getCompositeDataChoices, getData, getData, getDataCachePath, getDataChangeListeners, getDataChoices, getDataContext, getDataInner, getDataIsEditable, getDataPrefix, getDataSelection, getDataSelectionComponents, getDataSource, getDateTimes, getDateTimeSelection, getDescription, getDescriptor, getErrorMessage, getFileFilterForPolling, getid, getInError, getLocationForPolling, getMostRecentFiles, getName, getNameForDataSource, getNeedToShowErrorToUser, getNextId, getOutstandingGetDataCalls, getPassword, getPathsThatCanBeRelative, getPollingInfo, getProperties, getPropertiesComponents, getPropertiesHeader, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getRelativePaths, getSelectedDateTimes, getSelectedDateTimes, getTimesFromDataSelection, getTmpPaths, getTypeName, getUserName, handlePropertiesAction, hasPollingInfo, holdsDateTimes, holdsIndices, identifiedBy, identifiedByName, incrOutstandingGetDataCalls, initAfter, initDataChoice, initDataSelectionComponents, initFromXml, isPolling, loadFieldMask, loadFieldMask, loadLatestFile, logException, logException, makeDerivedDataChoices, newFileFromPolling, notifyDataChange, putCache, removeCache, removeDataChangeListener, removeDataChoice, removeProperty, replaceDataChoice, saveDataToLocalDisk, saveDataToLocalDisk, setAlias, setAskToUpdate, setCacheClearDelay, setCacheDataToDisk, setDataEditableStrings, setDataIsEditable, setDataIsRelative, setDataRelativeStrings, setDataSelection, setDateTimeSelection, setDescription, setDescriptor, setDirectory, setInError, setInError, setInError, setName, setObjectProperties, setObjectProperty, setPassword, setPollingInfo, setPollLocation, setProperties, setProperty, setProperty, setRelativePaths, setTemplateName, setUserName, shouldCache, showPasswordDialog, showPropertiesDialog, showPropertiesDialog, showPropertiesDialog, showWaitDialog, tick, toString, toStringTruncated, updateDetailsText, writeFieldMaskFile
 
Methods inherited from class ucar.unidata.collab.SharableImpl
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setShareGroup, setSharing, setUniqueId, showSharableDialog
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ucar.unidata.data.DataSource
getUniqueId
 

Field Detail

PREF_VERTICALCS

public static final String PREF_VERTICALCS
Preference

See Also:
Constant Field Values

PROP_GRIDSIZE

public static final String PROP_GRIDSIZE
grid size

See Also:
Constant Field Values

PROP_TIMESIZE

public static final String PROP_TIMESIZE
_more_

See Also:
Constant Field Values

readLock

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


testMode

public static boolean testMode
for test

Constructor Detail

GeoGridDataSource

public GeoGridDataSource()
Default constructor


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

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
Method Detail

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)
Description copied from class: FilesDataSource
This gets called when the user interactively does a Change data

Specified by:
updateState in interface DataSource
Overrides:
updateState in class FilesDataSource
Parameters:
newObject - The new data object. May be a string or a list
newProperties - new 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()
_more_

Overrides:
getSaveDataFileLabel in class DataSourceImpl
Returns:
_more_

makeSaveLocalActions

protected void makeSaveLocalActions(List actions)
_more_

Overrides:
makeSaveLocalActions in class DataSourceImpl
Parameters:
actions - _more_

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.

getLocalDirectory

protected String getLocalDirectory(String label,
                                   String prefix)
_more_

Overrides:
getLocalDirectory in class DataSourceImpl
Parameters:
label - _more_
prefix - _more_
Returns:
_more_

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()
Description copied from class: DataSourceImpl
This gets called after we have been saved in a zidv bundle to reset us back to any original 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

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 - _more_
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

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

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