Package ucar.unidata.data.grid
Class GridCoverageDataSource
java.lang.Object
ucar.unidata.collab.SharableImpl
ucar.unidata.data.DataSourceImpl
ucar.unidata.data.FilesDataSource
ucar.unidata.data.grid.GridDataSource
ucar.unidata.data.grid.GridCoverageDataSource
- All Implemented Interfaces:
Sharable,DataSource,DataSourceFactory,XmlPersistable
Handles gridded files
- Author:
- IDV Development Team
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classClass description -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ObjectUsed to synchronize the geogridadapterstatic final StringPreference - warn users for large remote data requestsstatic final StringPreferencestatic final Stringgrid sizestatic final Stringproperty timesizestatic final Stringproperty time variableprotected final ObjectThis is used to synchronize geogrid read accessstatic booleanfor testFields inherited from class ucar.unidata.data.grid.GridDataSource
ATTR_EAST, ATTR_NORTH, ATTR_SOUTH, ATTR_WEST, ATTR_X, ATTR_Y, ATTR_Z, PROP_ENSEMBLEMEMBERSFields inherited from class ucar.unidata.data.FilesDataSource
adapters, oldSourceFromBundles, sourcesFields inherited from class ucar.unidata.data.DataSourceImpl
changeDataPathsCbx, dataCacheKey, dataChoices, geoSelectionPanel, haveBeenUnPersisted, okToContinue, PARAM_SHOW_HIDE, PARAM_SHOW_NO, PARAM_SHOW_YESFields inherited from interface ucar.unidata.data.DataSource
DATAPATH_DATE_FORMAT, DATAPATH_DATE_PATTERN, 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_TIMESTRIDE, PROP_TITLE -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorGridCoverageDataSource(ucar.nc2.ft2.coverage.adapter.DtCoverageDataset gds) Create a GeoGridDataSource from the GridDatasetGridCoverageDataSource(DataSourceDescriptor descriptor, File file, Hashtable properties) Create a GridCoverageDataSource from a File.GridCoverageDataSource(DataSourceDescriptor descriptor, String filename, Hashtable properties) Create a GeoGridDataSource from the filename.GridCoverageDataSource(DataSourceDescriptor descriptor, List files, Hashtable properties) Create a GeoGridDataSource from the filename.GridCoverageDataSource(DataSourceDescriptor descriptor, ucar.nc2.ft2.coverage.adapter.DtCoverageDataset gds, String name, String filename) Construct a GeoGridDataSource -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertiesTabs(JTabbedPane tabbedPane) Add any extra tabs into the properties tabprotected voidapplyFieldMask(Element root) Load any subset info in field mask xmlbooleanApply the propertiesprotected ObjectOverwrite this method so we don't show the loading dialogintcalculateStrideFactor(int dataPoints, int displayPoints) _more_booleanCan this data source cache itsprotected booleanCan we mask the data?booleanWe can do geo selection in the properties guibooleanCan this DataSource save data to local disk?protected voidThis method is called at initialization time and creates a set ofDirectDataChoice-s and adds them into the base class managed list of DataChoice-s with the method addDataChoice.protected ucar.nc2.ft2.coverage.adapter.DtCoverageDatasetCreate the dataset from the name of this DataSource.protected ListReturn the list of DateTime-s associated with this DataSource.protected JComponentAdd in the spatial dimensions labelvoiddoRemove()Called when Datasource is removed.ucar.nc2.ft2.coverage.adapter.DtCoveragefindGridForDataChoice(ucar.nc2.ft2.coverage.adapter.DtCoverageDataset ds, DataChoice dc) Find the grid in the dataset from the DataChoicegetAllDateTimes(DataChoice dataChoice) Override the base class method to return the times for the data choicegetAllLevels(DataChoice dataChoice, DataSelection dataSelection) Get the list of all levels available from this DataSourceGet the data for a particular parameterprotected DatagetDataInner(DataChoice dataChoice, DataCategory category, DataSelection givenDataSelection, Hashtable requestProperties) Get the Data object specified by the particular selection criteria.What should be changed by the user when in data relative modeucar.nc2.ft2.coverage.adapter.DtCoverageDatasetReturn the GridDataset associated with this DataSource.protected JComponentGet the extra label that is shown in the geo-subset panelprotected JComponentAdd the reverse times checkboxGet the full description of the gridprotected StringgetLocalDirectory(String label, String prefix) Get the local directoryList<ucar.ma2.Range> getRangesFromLatLonRect(ucar.nc2.ft2.coverage.adapter.DtCoverageCS dtCoverageCS, ucar.unidata.geoloc.LatLonRect rect) List<ucar.ma2.Range> getRangesFromLonRange(ucar.nc2.ft2.coverage.adapter.DtCoverageCS dtCoverageCS, double lonMin, double lonMax) booleanGet the ReverseTimes property.protected ucar.unidata.geoloc.ProjectionImplReturn the sample projectionprotected StringGet the label for the save data file optionintgetTimeIndexWithBounds(DateTime dateTime, List<DateTime> allTimes, ucar.nc2.ft2.coverage.CoverageCoordAxis1D cca) Find the time index in the dataset with smallest bound valuesList<ucar.nc2.util.NamedObject> intFind the index of the given object in the list of levels.voidInitialize after we have been created.voidInitialize if being unpersisted.booleanAre we a local filestatic booleancheck if a input is only numeric numberprotected booleanisZAxisOk(ucar.nc2.dataset.CoordinateAxis1D zaxis) Utility to check if we should ignore the given z axisGet the list of parametersstatic voidTest this class by running "java ucar.unidata.data.grid.GeoGridDataSource" ucar.nc2.util.Optional<ucar.ma2.RangeIterator> makeRange(ucar.nc2.ft2.coverage.adapter.DtCoverageCS dtCoverageCS, double minValue, double maxValue) protected voidmakeSaveLocalActions(List actions) Make savel local actionsvoidClear out the data setvoidReset the tmp stateprotected voidResolve the url if we have toprotected ListsaveDataToLocalDisk(String prefix, Object loadId, boolean changeLinks) Save the data to local disk.voidSet the default selection boundsvoidsetFileNameOrUrl(String value) Set the FileNameOrUrl property.voidsetNewFiles(List files) Overwrite setNewFiles so we clear out the resolverurlvoidsetReverseTimes(boolean value) Set the ReverseTimes property.voidsetTmpPaths(List paths) Set what the user has changedprotected voidThe source has changedvoidupdateState(Object newObject, Hashtable newProperties) Update the stateprotected voidwriteFieldMaskFile(Document doc, Element root) Write out the field mask fileMethods inherited from class ucar.unidata.data.grid.GridDataSource
getEnsDCategory, getEnsembleSelection, getThreeDCategories, getThreeDEnsTimeSeriesCategories, getThreeDTimeSeriesCategories, getTwoDCategories, getTwoDEnsTimeSeriesCategories, getTwoDTimeSeriesCategories, initCategories, setEnsembleSelectionMethods inherited from class ucar.unidata.data.FilesDataSource
equals, getDataFileExtension, getFilePath, getInputStreams, getLocationsForPolling, getPartialDescription, getSource, getSources, haveSources, initWithPollingInfo, isFileBased, newFilesFromPolling, processDataFilename, propertiesChanged, reloadData, setSource, setSourcesMethods inherited from class ucar.unidata.data.DataSourceImpl
addActions, addDataChangeListener, addDataChoice, addReloadTab, canAddCurrentName, canChangeData, canDoAllLevels, canDoGeoSelectionMap, canDoGeoSelectionStride, canPoll, canShowParameter, checkForInitAfterUnPersistence, clearCachedData, clearFileCache, clearTimes, convertSourceFile, convertToFilesIfDirectory, createAutoDisplay, createCacheKey, createElement, decrOutstandingGetDataCalls, doDirectory, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, endWritingDataToLocalDisk, expandIfNeeded, findDataChoice, findDataChoices, flushCache, getAbsoluteDateTimes, getActions, getAlias, getAllDateTimes, getAllLevels, getAllTimesForTimeDriver, getCache, getCache, getCacheClearDelay, getCacheDataToDisk, getCompositeDataChoices, getData, getData, getDataCachePath, getDataChangeListeners, getDataChoices, getDataContext, getDataInner, getDataIsEditable, getDataPrefix, getDataSelection, getDataSelectionComponents, getDataSource, getDateTimes, getDateTimeSelection, getDefaultSave, getDescription, getDescriptor, getErrorMessage, getEverChangedName, getFileFilterForPolling, getid, getIdv, 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, putCache, reloadProperties, removeCache, removeDataChangeListener, removeDataChoice, removeProperty, replaceDataChoice, saveDataToLocalDisk, saveDataToLocalDisk, selectTimesFromList, setAlias, setAskToUpdate, setCacheClearDelay, setCacheDataToDisk, setDataEditableStrings, setDataIsEditable, setDataIsRelative, setDataRelativeStrings, setDataSelection, setDateTimeSelection, setDefaultSave, setDescription, setDescriptor, setDirectory, setEverChangedName, setInError, setInError, setInError, setName, setObjectProperties, setObjectProperty, setPassword, setPollingInfo, setPollLocation, setProperties, setProperty, setProperty, setRelativePaths, setTemplateName, setUserName, shouldCache, shouldCache, showPasswordDialog, showPropertiesDialog, showPropertiesDialog, showPropertiesDialog, showWaitDialog, tick, toString, toStringTruncated, updateDetailsText, writeFieldMaskFileMethods inherited from class ucar.unidata.collab.SharableImpl
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getReceiveShareTime, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setReceiveShareTime, setShareGroup, setSharing, setUniqueId, showSharableDialogMethods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ucar.unidata.data.DataSource
getUniqueId
-
Field Details
-
PREF_VERTICALCS
Preference- See Also:
-
PREF_LARGE_REMOTE_DATA_WARN
Preference - warn users for large remote data requests- See Also:
-
PROP_GRIDSIZE
grid size- See Also:
-
PROP_TIMESIZE
property timesize- See Also:
-
PROP_TIMEVAR
property time variable- See Also:
-
testMode
public static boolean testModefor test -
DOMAIN_SET_MUTEX
Used to synchronize the geogridadapter -
readLock
This is used to synchronize geogrid read access
-
-
Constructor Details
-
GridCoverageDataSource
public GridCoverageDataSource()Default constructor -
GridCoverageDataSource
public GridCoverageDataSource(DataSourceDescriptor descriptor, ucar.nc2.ft2.coverage.adapter.DtCoverageDataset gds, String name, String filename) Construct a GeoGridDataSource- Parameters:
descriptor- the data source descriptorgds- The GridDatasetname- A namefilename- the filename
-
GridCoverageDataSource
public GridCoverageDataSource(ucar.nc2.ft2.coverage.adapter.DtCoverageDataset gds) Create a GeoGridDataSource from the GridDataset- Parameters:
gds- the GridDataset
-
GridCoverageDataSource
public GridCoverageDataSource(DataSourceDescriptor descriptor, File file, Hashtable properties) throws IOException Create a GridCoverageDataSource 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
-
GridCoverageDataSource
public GridCoverageDataSource(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.
-
GridCoverageDataSource
public GridCoverageDataSource(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 urlsproperties- General properties used in the base class- Throws:
IOException- Signals that an I/O exception has occurred.
-
-
Method Details
-
isNumeric
check if a input is only numeric number- Parameters:
str- is this numeric- Returns:
- true if numeric
-
main
Test this class by running "java ucar.unidata.data.grid.GeoGridDataSource" - Parameters:
args- filename- Throws:
Exception- some error occurred
-
setDefaultSelectionBounds
Set the default selection bounds- Parameters:
rect- rectangle
-
applyFieldMask
Load any subset info in field mask xml- Overrides:
applyFieldMaskin classDataSourceImpl- Parameters:
root- xml root
-
canDoFieldMask
protected boolean canDoFieldMask()Can we mask the data?- Overrides:
canDoFieldMaskin classDataSourceImpl- Returns:
- true if we can
-
writeFieldMaskFile
Write out the field mask file- Overrides:
writeFieldMaskFilein classDataSourceImpl- Parameters:
doc- doc to write toroot- root node
-
initAfterUnpersistence
public void initAfterUnpersistence()Initialize if being unpersisted.- Specified by:
initAfterUnpersistencein interfaceDataSource- Overrides:
initAfterUnpersistencein classFilesDataSource
-
doMakeGeoSubsetPropertiesComponent
Add in the spatial dimensions label- Overrides:
doMakeGeoSubsetPropertiesComponentin classDataSourceImpl- Returns:
- The subset properties component
-
getExtraGeoSelectionComponent
Get the extra label that is shown in the geo-subset panel- Overrides:
getExtraGeoSelectionComponentin classDataSourceImpl- Returns:
- Extra label for geosubset panel
-
addPropertiesTabs
Add any extra tabs into the properties tab- Overrides:
addPropertiesTabsin classDataSourceImpl- Parameters:
tabbedPane- The properties tab
-
initAfterCreation
public void initAfterCreation()Initialize after we have been created.- Specified by:
initAfterCreationin interfaceDataSource- Overrides:
initAfterCreationin classFilesDataSource
-
getDataPaths
What should be changed by the user when in data relative mode- Specified by:
getDataPathsin interfaceDataSource- Overrides:
getDataPathsin classFilesDataSource- Returns:
- paths to changed
-
updateState
Update the state- Specified by:
updateStatein interfaceDataSource- Overrides:
updateStatein classFilesDataSource- Parameters:
newObject- new objectnewProperties- properties
-
setTmpPaths
Set what the user has changed- Specified by:
setTmpPathsin interfaceDataSource- Overrides:
setTmpPathsin classDataSourceImpl- Parameters:
paths- new paths
-
resolvePath
protected void resolvePath()Resolve the url if we have to -
sourcesChanged
protected void sourcesChanged()The source has changed- Overrides:
sourcesChangedin classFilesDataSource
-
reloadData
public void reloadData()Clear out the data set- Specified by:
reloadDatain interfaceDataSource- Overrides:
reloadDatain classFilesDataSource
-
doRemove
public void doRemove()Called when Datasource is removed.- Specified by:
doRemovein interfaceDataSource- Overrides:
doRemovein classFilesDataSource
-
canSaveDataToLocalDisk
public boolean canSaveDataToLocalDisk()Can this DataSource save data to local disk?- Specified by:
canSaveDataToLocalDiskin interfaceDataSource- Overrides:
canSaveDataToLocalDiskin classDataSourceImpl- Returns:
- true if this DataSource can save data to local disk?
-
getSaveDataFileLabel
Get the label for the save data file option- Overrides:
getSaveDataFileLabelin classDataSourceImpl- Returns:
- label
-
makeSaveLocalActions
Make savel local actions- Overrides:
makeSaveLocalActionsin classDataSourceImpl- Parameters:
actions- list of actions
-
beginWritingDataToLocalDisk
Overwrite this method so we don't show the loading dialog- Overrides:
beginWritingDataToLocalDiskin classDataSourceImpl- 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:
saveDataToLocalDiskin classFilesDataSource- Parameters:
prefix- the prefix for the local file nameloadId- 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
Overwrite setNewFiles so we clear out the resolverurl- Specified by:
setNewFilesin interfaceDataSource- Overrides:
setNewFilesin classFilesDataSource- Parameters:
files- The list of new files to use
-
getLocalDirectory
Get the local directory- Overrides:
getLocalDirectoryin classDataSourceImpl- Parameters:
label- a labelprefix- the prefix- Returns:
- the path
-
getFullDescription
Get the full description of the grid- Specified by:
getFullDescriptionin interfaceDataSource- Overrides:
getFullDescriptionin classFilesDataSource- Returns:
- the description
-
resetTmpState
public void resetTmpState()Reset the tmp state- Specified by:
resetTmpStatein interfaceDataSource- Overrides:
resetTmpStatein classDataSourceImpl
-
doMakeDataSet
protected ucar.nc2.ft2.coverage.adapter.DtCoverageDataset doMakeDataSet()Create the dataset from the name of this DataSource.- Returns:
- new GridDataset
-
getDataset
public ucar.nc2.ft2.coverage.adapter.DtCoverageDataset getDataset()Return the GridDataset associated with this DataSource.- Returns:
- dataset
-
getSampleDataProjection
protected ucar.unidata.geoloc.ProjectionImpl getSampleDataProjection()Return the sample projection- Overrides:
getSampleDataProjectionin classDataSourceImpl- Returns:
- the sample projection
-
doMakeDataChoices
protected void doMakeDataChoices()This method is called at initialization time and creates a set ofDirectDataChoice-s and adds them into the base class managed list of DataChoice-s with the method addDataChoice.- Overrides:
doMakeDataChoicesin classDataSourceImpl
-
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:
getDataInnerin classDataSourceImpl- 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 objectRemoteException- couldn't create remote Data object
-
listParameters
Get the list of parameters- Returns:
- the list
-
getData
Get the data for a particular parameter- Parameters:
parameter- the parameter name- Returns:
- the Data or null
- Throws:
RemoteException- Java RMI ErrorVisADException- VisAD Error
-
doMakeDateTimes
Return the list of DateTime-s associated with this DataSource.- Overrides:
doMakeDateTimesin classDataSourceImpl- Returns:
- List of DateTime-s.
-
getAllLevels
Get the list of all levels available from this DataSource- Specified by:
getAllLevelsin interfaceDataSource- Overrides:
getAllLevelsin classDataSourceImpl- Parameters:
dataChoice- The data choice we are getting levels fordataSelection- the data selection- Returns:
- List of all available levels
-
canDoGeoSelection
public boolean canDoGeoSelection()We can do geo selection in the properties gui- Specified by:
canDoGeoSelectionin interfaceDataSource- Overrides:
canDoGeoSelectionin classDataSourceImpl- Returns:
- can do geo selection
-
canCacheDataToDisk
public boolean canCacheDataToDisk()Can this data source cache its- Overrides:
canCacheDataToDiskin classDataSourceImpl- Returns:
- can cache data to disk
-
makeRange
public ucar.nc2.util.Optional<ucar.ma2.RangeIterator> makeRange(ucar.nc2.ft2.coverage.adapter.DtCoverageCS dtCoverageCS, double minValue, double maxValue) -
calculateStrideFactor
public int calculateStrideFactor(int dataPoints, int displayPoints) _more_- Parameters:
dataPoints- _more_displayPoints- _more_- Returns:
- _more_
-
indexOf
Find the index of the given object in the list of levels. If its a Real then check values- Parameters:
o- Objectlevels- levels- Returns:
- index
- Throws:
VisADException- On badness
-
getTimeIndexWithBounds
public int getTimeIndexWithBounds(DateTime dateTime, List<DateTime> allTimes, ucar.nc2.ft2.coverage.CoverageCoordAxis1D cca) Find the time index in the dataset with smallest bound values- Parameters:
dateTime- the timeallTimes- the DateTime listcca- the data CoordinateAxis1DTime- Returns:
- the GeoGrid or null dataset doesn't exist or if variable not found
-
findGridForDataChoice
public ucar.nc2.ft2.coverage.adapter.DtCoverage findGridForDataChoice(ucar.nc2.ft2.coverage.adapter.DtCoverageDataset ds, DataChoice dc) Find the grid in the dataset from the DataChoice- Parameters:
ds- the grid datasetdc- 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
Override the base class method to return the times for the data choice- Specified by:
getAllDateTimesin interfaceDataSource- Overrides:
getAllDateTimesin classDataSourceImpl- Parameters:
dataChoice- DataChoice in question- Returns:
- List of all times for that choice
-
setFileNameOrUrl
Set the FileNameOrUrl property.- Parameters:
value- The new value for FileNameOrUrl
-
applyProperties
public boolean applyProperties()Apply the properties- Overrides:
applyPropertiesin classDataSourceImpl- Returns:
- everything ok
-
getExtraTimesComponent
Add the reverse times checkbox- Overrides:
getExtraTimesComponentin classDataSourceImpl- Returns:
- extra comp
-
getReverseTimes
public boolean getReverseTimes()Get the ReverseTimes property.- Returns:
- The ReverseTimes
-
setReverseTimes
public void setReverseTimes(boolean value) Set the ReverseTimes property.- Parameters:
value- The new value for ReverseTimes
-
getRangesFromLatLonRect
public List<ucar.ma2.Range> getRangesFromLatLonRect(ucar.nc2.ft2.coverage.adapter.DtCoverageCS dtCoverageCS, ucar.unidata.geoloc.LatLonRect rect) throws ucar.ma2.InvalidRangeException - Throws:
ucar.ma2.InvalidRangeException
-
getRangesFromLonRange
public List<ucar.ma2.Range> getRangesFromLonRange(ucar.nc2.ft2.coverage.adapter.DtCoverageCS dtCoverageCS, double lonMin, double lonMax) throws ucar.ma2.InvalidRangeException - Throws:
ucar.ma2.InvalidRangeException
-
getTimes
- Returns:
- nameObject list
-