Class NetCDFResourceAdapter
java.lang.Object
net.simplace.sim.io.FWSimIOAdapter
net.simplace.sim.io.resources.FWSimInputAdapter
net.simplace.sim.io.resources.FWSimResourceAdapter<List<String>>
net.simplace.sim.io.resources.adapter.NetCDFResourceAdapter
- All Implemented Interfaces:
FWSimFieldContainer
Resource adapter for NetCDF files (
NetCDFInterface). For each header variable the NetCDF variable of the
same name is read, restricted by the section specification of the interface (tokens ${...} are
replaced). The key variables span the dimensions: every combination of key values becomes one data line of the
cache, lines without any valid value (missing value -999 or NaN) are skipped. Dates are stored as days since
the epoch. The cache is never stored in the database.- Author:
- Andreas Enders
-
Nested Class Summary
Nested classes/interfaces inherited from class FWSimIOAdapter
FWSimIOAdapter.FREQUENCE -
Field Summary
Fields inherited from class FWSimResourceAdapter
iLinesToReadFields inherited from class FWSimInputAdapter
iJexlScript, iShouldCacheToDBFields inherited from class FWSimIOAdapter
iArrayMode, iFieldcount, iFrequence, iHeaderVariables, iInterface, iJexlRule, iKeyMap, iName, iOrderNumber, iProcessTime, iResourceElement, iSession, iSourceKey -
Constructor Summary
ConstructorsConstructorDescriptionNetCDFResourceAdapter(FWSimResourceAdapter<?> aAdapter, NetCDFInterface aInterface) Copy constructor used when the interface is replaced; the key variables are taken over.NetCDFResourceAdapter(org.jdom2.Element aResourceElement, FWSimSession aSession, int aOrderNumber) Creates the adapter from aresourceelement of the solution.NetCDFResourceAdapter(org.jdom2.Element aHeaderElement, NetCDFInterface aInterface, int aOrderNumber) Creates an adapter for a NetCDF interface with frequency ONCE and without session. -
Method Summary
Modifier and TypeMethodDescriptiongetData(FWSimVarMap aVarMap) Registers the file of the current simulation in the file pool and reads it, if it was updated.getData(FWSimVarMap aVarMap, FileData aFileData) Reads a NetCDF file into a new cache, unless it is the same file (path) as last time.Methods inherited from class FWSimResourceAdapter
createAdapterFromObservable, createResourceAdapter, getLinesToRead, setLinesToRead, toXML, updateAdapterMethods inherited from class FWSimInputAdapter
getContentType, getInputVariables, getJexlScript, getOutputVariables, getVarMap, isTransformer, setFrequenceAndRule, shouldCacheToDB, toHTMLTablestringMethods inherited from class FWSimIOAdapter
addProcessTime, addVariable, checkCondition, createFormFields, createVariables, finalize, getCreateFormXML, getEditFormXML, getFieldMap, getFrequence, getHeaderVariables, getHeaderXML, getInterface, getJexlRule, getKeyMap, getName, getOrderNumber, getVariable, isArrayMode, isConditionCheck, removeVariable, setInterface, setOrderNumber, toString, writeHeaderList
-
Constructor Details
-
NetCDFResourceAdapter
public NetCDFResourceAdapter(org.jdom2.Element aResourceElement, FWSimSession aSession, int aOrderNumber) Creates the adapter from aresourceelement of the solution.- Parameters:
aResourceElement- theresourceelementaSession- the sessionaOrderNumber- order number of the adapter
-
NetCDFResourceAdapter
Copy constructor used when the interface is replaced; the key variables are taken over.- Parameters:
aAdapter- the adapter to copyaInterface- the new interface
-
NetCDFResourceAdapter
public NetCDFResourceAdapter(org.jdom2.Element aHeaderElement, NetCDFInterface aInterface, int aOrderNumber) Creates an adapter for a NetCDF interface with frequency ONCE and without session.- Parameters:
aHeaderElement- element with the attributeid(name of the adapter) and the headeraInterface- the NetCDF interfaceaOrderNumber- order number of the adapter
-
-
Method Details
-
getData
Registers the file of the current simulation in the file pool and reads it, if it was updated.- Specified by:
getDatain classFWSimInputAdapter- Parameters:
aVarMap- variable map of the simulation (e.g. for the key values of the rule)- Returns:
- the new cache, or
nullif the file is unchanged (the previous cache stays valid) - Throws:
MissingSimResourceException- if the data cannot be read- See Also:
-
getData
public FWSimResourceCache getData(FWSimVarMap aVarMap, FileData aFileData) throws MissingSimResourceException Reads a NetCDF file into a new cache, unless it is the same file (path) as last time.- Parameters:
aVarMap- variable map of the simulationaFileData- the file- Returns:
- the new cache, or
nullif the file was already read - Throws:
MissingSimResourceException- if the file cannot be read, contains no valid values or the resource has fewer than two header variables
-