Package ucar.unidata.data.point
Class TextPointDataSource
java.lang.Object
ucar.unidata.collab.SharableImpl
ucar.unidata.data.DataSourceImpl
ucar.unidata.data.FilesDataSource
ucar.unidata.data.point.PointDataSource
ucar.unidata.data.point.TextPointDataSource
- All Implemented Interfaces:
Sharable,DataSource,DataSourceFactory,XmlPersistable
- Direct Known Subclasses:
AMRCTextPointDataSource,CDOGTextPointDataSource,DiamondPointDataSource,GNOMETextPointDataSource
A data source for point data from a Text file
- Author:
- IDV Development Team
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classClass Metadata holds the skipRows and the list of metadata itemsNested classes/interfaces inherited from class ucar.unidata.data.point.PointDataSource
PointDataSource.PlotModelSelectionComponent -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringBlank delimiterstatic final StringComma delimiterboolean_more_static final StringWhere to write out the saved meta data listingstatic final StringProperty identifier for the hashtable of propertiesstatic final Stringproperty id for the whole header blob, map and paramsstatic final StringProperty identifier for thestatic final Stringproperty id for the header mapstatic final Stringproperty id for the header paramsstatic final Stringproperty id for how many rows to skipstatic final Stringproperty id for how many rows to skipstatic final StringSemicolon delimiterstatic final StringTab delimiterboolean_more_Fields inherited from class ucar.unidata.data.point.PointDataSource
fieldsDescription, POINT_DATA, PROP_FIRSTGUESS, PROP_GRID_GAIN, PROP_GRID_NUMPASSES, PROP_GRID_PARAM, PROP_GRID_SEARCH_RADIUS, PROP_GRID_UNIT, PROP_GRID_X, PROP_GRID_Y, PROP_STATIONMODELNAME, PROP_STATIONMODELSCALE, STATION_DATA, STATION_PLOTFields 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 constructorTextPointDataSource(String source) Create a TextPointDataSource from the path nameTextPointDataSource(DataSourceDescriptor descriptor, String source, String name, Hashtable properties) Create a new TextPointDataSourceTextPointDataSource(DataSourceDescriptor descriptor, String source, Hashtable properties) Create a new TextPointDataSourceTextPointDataSource(DataSourceDescriptor descriptor, List sources, Hashtable properties) Create a new PointDataSource -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertiesTabs(JTabbedPane tabbedPane) add to properties tabvoidapplyNames(String line) update the guibooleanapply propertiesvoidInit the widgetsvoidTHis gets called from the Preferences menu and sets the metadata and also updates the skipRowsvoidThis gets called in a thread from the applySavedMetaDataFromUI methodbooleanCan this datasource do the geoselection subsetting and decimationprotected booleanUsed for the geo subsetting property gui as to whether to show the stride or notbooleanCan we save locallyvoidShow the metadata guivoiddeleteMetaData(String key) Remove the given key from the saved mapping.voidMake the data choicesbooleanCheck to see if this TextPointDataSource is equal to the object in question.static int[]Find the lat/lon/alt indicidesprotected final StringgetContents(String sourceFile) Get the contents of the file as a stringprotected StringgetContents(String sourceFile, boolean sampleIt) Read the given source file and return the text contents of it.protected DatagetDataInner(DataChoice dataChoice, DataCategory category, DataSelection dataSelection, Hashtable requestProperties) Get the data represented by this class.Get the delimiter used in the text fileprotected StringgetDelimiter(String source) Get the delimiter to use for the given file.Get the GroupVarName property.getMap()Get the Map property.Get the MetaDataFields property.Get the Params property.protected ListGet the default categories for data from PointDataSource-svoidgetPropertiesComponents(List comps) Add to properties guiprotected FieldImplgetSample(DataChoice dataChoice) Read a sample of the data.intGet the SkipRows property.protected StringgetSource(DataChoice dataChoice) the data choiceinthashCode()Get the hashcode for this objectstatic voidmainstatic voidtestmakeObs(String contents, String delimiter, DataSelection subset, ucar.unidata.geoloc.LatLonRect bbox, String trackParam, boolean sampleIt, boolean showAttributeGuiIfNeeded) make the observations from the given datachoicemakeObs(DataChoice dataChoice, DataSelection subset, ucar.unidata.geoloc.LatLonRect bbox) Make PointObs from the raw VisAD datamakeObs(DataChoice dataChoice, DataSelection subset, ucar.unidata.geoloc.LatLonRect bbox, String trackParam, boolean sampleIt, boolean showAttributeGuiIfNeeded) make the observations from the given datachoicevoidpopupMetaDataMenu(JComponent near) Show the metadata preference menuvoidSave the meta datavoidsetDelimiter(String delim) Get the delimiter used in the text filevoidsetGroupVarName(String value) Set the GroupVarName property.voidSet the Map property.voidsetMetaDataFields(List value) Set the MetaDataFields property.voidSet the Params property.voidsetSkipRows(int value) Set the SkipRows property.voidsetStreamProcessor(TextAdapter.StreamProcessor streamProcessor) Set the stream processor to usevoidwrite the header text to a filevoidwrite the pluginMethods inherited from class ucar.unidata.data.point.PointDataSource
canAddCurrentName, canCreateGrid, canDoAllLevels, doRemove, getBinRoundTo, getBinWidth, getDataName, getDefaultLevels, getDescriptionDataChoice, getFullDescription, getGridGain, getGridSearchRadius, getGridUnit, getGridX, getGridY, getMakeGridFields, getNumGridPasses, init, initDataSelectionComponents, initGridParameters, makeDerivedDataChoices, makeFieldDescription, reloadData, setBinRoundTo, setBinWidth, setGridGain, setGridSearchRadius, setGridUnit, setGridX, setGridY, setMakeGridFields, setNumGridPasses, setRoundToFromComboBox, setSource, setWidthFromComboBox, shouldCacheMethods inherited from class ucar.unidata.data.FilesDataSource
getDataFileExtension, getDataPaths, getFilePath, getInputStreams, getLocationsForPolling, getPartialDescription, getSource, getSources, haveSources, initAfterCreation, initAfterUnpersistence, initWithPollingInfo, isFileBased, newFilesFromPolling, processDataFilename, propertiesChanged, reloadData, saveDataToLocalDisk, setNewFiles, setSources, sourcesChanged, updateStateMethods inherited from class ucar.unidata.data.DataSourceImpl
addActions, addDataChangeListener, addDataChoice, addReloadTab, applyFieldMask, beginWritingDataToLocalDisk, canCacheDataToDisk, canChangeData, canDoFieldMask, canDoGeoSelectionMap, canPoll, canShowParameter, checkForInitAfterUnPersistence, clearCachedData, clearFileCache, clearTimes, convertSourceFile, convertToFilesIfDirectory, createAutoDisplay, createCacheKey, createElement, decrOutstandingGetDataCalls, doDirectory, doMakeDateTimes, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSubsetPropertiesComponent, endWritingDataToLocalDisk, expandIfNeeded, findDataChoice, findDataChoices, flushCache, getAbsoluteDateTimes, getActions, getAlias, getAllDateTimes, getAllDateTimes, getAllLevels, 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, getExtraGeoSelectionComponent, getExtraTimesComponent, getFileFilterForPolling, getid, getIdv, getInError, getLocalDirectory, getLocationForPolling, getMostRecentFiles, getName, getNameForDataSource, getNeedToShowErrorToUser, getNextId, getOutstandingGetDataCalls, getPassword, getPathsThatCanBeRelative, getPollingInfo, getProperties, getPropertiesHeader, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getRelativePaths, getSampleDataProjection, getSaveDataFileLabel, getSelectedDateTimes, getSelectedDateTimes, getTimesFromDataSelection, getTmpPaths, getTypeName, getUserName, handlePropertiesAction, hasPollingInfo, holdsDateTimes, holdsIndices, identifiedBy, identifiedByName, incrOutstandingGetDataCalls, initAfter, initDataChoice, initFromXml, isPolling, loadFieldMask, loadFieldMask, loadLatestFile, logException, logException, makeSaveLocalActions, newFileFromPolling, notifyDataChange, putCache, putCache, reloadProperties, removeCache, removeDataChangeListener, removeDataChoice, removeProperty, replaceDataChoice, resetTmpState, 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, setTmpPaths, setUserName, shouldCache, showPasswordDialog, showPropertiesDialog, showPropertiesDialog, showPropertiesDialog, showWaitDialog, tick, toString, toStringTruncated, updateDetailsText, writeFieldMaskFile, 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, notify, notifyAll, wait, wait, waitMethods inherited from interface ucar.unidata.data.DataSource
getUniqueId
-
Field Details
-
PROP_HEADER_MAP
property id for the header map- See Also:
-
PROP_DATAPROPERTIES
Property identifier for the hashtable of properties- See Also:
-
PROP_HEADER_EXTRA
Property identifier for the- See Also:
-
PROP_HEADER_PARAMS
property id for the header params- See Also:
-
PROP_HEADER_SKIP
property id for how many rows to skip- See Also:
-
PROP_HEADER_SKIPPATTERN
property id for how many rows to skip- See Also:
-
PROP_HEADER_BLOB
property id for the whole header blob, map and params- See Also:
-
PREF_METADATAMAP
Where to write out the saved meta data listing- See Also:
-
COMMA_DELIM
Comma delimiter- See Also:
-
SEMICOLON_DELIM
Semicolon delimiter- See Also:
-
TAB_DELIM
Tab delimiter- See Also:
-
BLANK_DELIM
Blank delimiter- See Also:
-
useDriverTime
public boolean useDriverTime_more_ -
hasLatLon
public boolean hasLatLon_more_
-
-
Constructor Details
-
TextPointDataSource
Default constructor- Throws:
VisADException- problem creating the object
-
TextPointDataSource
Create a TextPointDataSource from the path name- Parameters:
source- path to source data- Throws:
VisADException- problem creating the file
-
TextPointDataSource
public TextPointDataSource(DataSourceDescriptor descriptor, List sources, Hashtable properties) throws VisADException Create a new PointDataSource- Parameters:
descriptor- data source descriptorsources- List of sources of data (filename/URL)properties- extra properties for initialization- Throws:
VisADException- problem creating the data
-
TextPointDataSource
public TextPointDataSource(DataSourceDescriptor descriptor, String source, Hashtable properties) throws VisADException Create a new TextPointDataSource- Parameters:
descriptor- data source descriptorsource- source of data (filename/URL)properties- extra properties for initialization- Throws:
VisADException- problem creating the data
-
TextPointDataSource
public TextPointDataSource(DataSourceDescriptor descriptor, String source, String name, Hashtable properties) throws VisADException Create a new TextPointDataSource- Parameters:
descriptor- data source descriptorsource- source of data (filename/URL)name- the name of the datasetproperties- extra properties for initialization- Throws:
VisADException- problem creating the data
-
-
Method Details
-
canSaveDataToLocalDisk
public boolean canSaveDataToLocalDisk()Can we save locally- Specified by:
canSaveDataToLocalDiskin interfaceDataSource- Overrides:
canSaveDataToLocalDiskin classDataSourceImpl- Returns:
- true if we can
-
setStreamProcessor
Set the stream processor to use- Parameters:
streamProcessor- the StreamProcessor
-
canDoGeoSelection
public boolean canDoGeoSelection()Can this datasource do the geoselection subsetting and decimation- Specified by:
canDoGeoSelectionin interfaceDataSource- Overrides:
canDoGeoSelectionin classDataSourceImpl- Returns:
- treu if can do geo subsetting
-
canDoGeoSelectionStride
protected boolean canDoGeoSelectionStride()Used for the geo subsetting property gui as to whether to show the stride or not- Overrides:
canDoGeoSelectionStridein classDataSourceImpl- Returns:
- default is true
-
makeObs
public FieldImpl makeObs(DataChoice dataChoice, DataSelection subset, ucar.unidata.geoloc.LatLonRect bbox) throws Exception Make PointObs from the raw VisAD data- Specified by:
makeObsin classPointDataSource- Parameters:
dataChoice- choice for data (source of data)subset- subsetting parametersbbox- The area subset. May be null.- Returns:
- data of the form index -> (EarthLocation, Time, value_tuple)
- Throws:
Exception- problem creating data
-
getSource
the data choice- Overrides:
getSourcein classPointDataSource- Parameters:
dataChoice- the data choice- Returns:
- the file or url this data choice refers to
-
makeObs
public FieldImpl makeObs(DataChoice dataChoice, DataSelection subset, ucar.unidata.geoloc.LatLonRect bbox, String trackParam, boolean sampleIt, boolean showAttributeGuiIfNeeded) throws Exception make the observations from the given datachoice- Parameters:
dataChoice- the data choicesubset- data selection to subset withbbox- bounding box to subsettrackParam- the parameter to use for thetracksampleIt- do we just sample or do we read the full set of obsshowAttributeGuiIfNeeded- popup the gui if we have a problem- Returns:
- the field
- Throws:
Exception- On badness
-
getDelimiter
Get the delimiter to use for the given file. If its xls then use ','- Parameters:
source- source file- Returns:
- delimiter to use
-
getContents
Get the contents of the file as a string- Parameters:
sourceFile- the contents- Returns:
- the contents as a string
- Throws:
Exception- probably an IOException
-
getContents
Read the given source file and return the text contents of it. If the source file is a xls file then convert to csv text- Parameters:
sourceFile- The source file (or url)sampleIt- if true, then just read on ob- Returns:
- The contents
- Throws:
Exception- On badness
-
makeObs
public FieldImpl makeObs(String contents, String delimiter, DataSelection subset, ucar.unidata.geoloc.LatLonRect bbox, String trackParam, boolean sampleIt, boolean showAttributeGuiIfNeeded) throws Exception make the observations from the given datachoice- Parameters:
contents- The text contentsdelimiter- The delimitersubset- data selection to subset withbbox- bounding box to subsettrackParam- the parameter to use for thetracksampleIt- do we just sample or do we read the full set of obsshowAttributeGuiIfNeeded- popup the gui if we have a problem- Returns:
- the field
- Throws:
Exception- On badness
-
changeMetadata
Show the metadata gui- Throws:
IOException- On badness
-
getDelimiter
Get the delimiter used in the text file- Returns:
- delimiter
-
setDelimiter
Get the delimiter used in the text file- Parameters:
delim- delimiter
-
applyNames
update the gui- Parameters:
line- the sampled text line
-
deleteMetaData
Remove the given key from the saved mapping. Write out the file- Parameters:
key- key
-
writePlugin
public void writePlugin()write the plugin -
writeHeader
public void writeHeader()write the header text to a file -
popupMetaDataMenu
Show the metadata preference menu- Parameters:
near- The component to show the menu near
-
saveMetaDataMap
public void saveMetaDataMap()Save the meta data -
applyProperties
public boolean applyProperties()apply properties- Overrides:
applyPropertiesin classPointDataSource- Returns:
- ok
-
addPropertiesTabs
add to properties tab- Overrides:
addPropertiesTabsin classPointDataSource- Parameters:
tabbedPane- tab
-
applySavedMetaDataFromUI
THis gets called from the Preferences menu and sets the metadata and also updates the skipRows- Parameters:
metadata- The metadata
-
applySavedMetaDataFromUIInner
This gets called in a thread from the applySavedMetaDataFromUI method- Parameters:
metadata- The metadata
-
applySavedMetaData
Init the widgets- Parameters:
metadata- The metadata
-
equals
Check to see if this TextPointDataSource is equal to the object in question.- Overrides:
equalsin classFilesDataSource- Parameters:
o- object in question- Returns:
- true if they are the same or equivalent objects
-
hashCode
public int hashCode()Get the hashcode for this object -
getPointCategories
Get the default categories for data from PointDataSource-s- Overrides:
getPointCategoriesin classPointDataSource- Returns:
- list of categories
-
findLatLonAltIndices
Find the lat/lon/alt indicides- Parameters:
type- the type to search- Returns:
- the indicies in the tuple
-
getSample
Read a sample of the data. e.g., just the first ob- Overrides:
getSamplein classPointDataSource- Parameters:
dataChoice- The data choice- Returns:
- The first ob
- Throws:
Exception- On badness
-
doMakeDataChoices
public void doMakeDataChoices()Make the data choices- Overrides:
doMakeDataChoicesin classPointDataSource
-
getPropertiesComponents
Add to properties gui- Overrides:
getPropertiesComponentsin classPointDataSource- Parameters:
comps- properties comps
-
getDataInner
protected Data getDataInner(DataChoice dataChoice, DataCategory category, DataSelection dataSelection, Hashtable requestProperties) throws VisADException, RemoteException Get the data represented by this class. Calls makeObs, real work needs to be implemented there.- Overrides:
getDataInnerin classPointDataSource- Parameters:
dataChoice- choice for datacategory- category of datadataSelection- subselection propertiesrequestProperties- additional selection properties (not used here)- Returns:
- Data object representative of the choice
- Throws:
RemoteException- Java RMI errorVisADException- VisAD Error
-
main2
test- Parameters:
args- args- Throws:
Exception- On badness
-
main
main- Parameters:
args- args- Throws:
Exception- on badness
-
setMap
Set the Map property.- Parameters:
value- The new value for Map
-
getMap
Get the Map property.- Returns:
- The Map
-
setParams
Set the Params property.- Parameters:
value- The new value for Params
-
getParams
Get the Params property.- Returns:
- The Params
-
setMetaDataFields
Set the MetaDataFields property.- Parameters:
value- The new value for MetaDataFields
-
getMetaDataFields
Get the MetaDataFields property.- Returns:
- The MetaDataFields
-
setGroupVarName
Set the GroupVarName property.- Parameters:
value- The new value for GroupVarName
-
getGroupVarName
Get the GroupVarName property.- Returns:
- The GroupVarName
-
setSkipRows
public void setSkipRows(int value) Set the SkipRows property.- Parameters:
value- The new value for SkipRows
-
getSkipRows
public int getSkipRows()Get the SkipRows property.- Returns:
- The SkipRows
-