Class NetCDFInterface
java.lang.Object
net.simplace.sim.io.interfaces.FWSimInterface<FilePool>
net.simplace.sim.io.interfaces.FILEInterface
net.simplace.sim.io.interfaces.NetCDFInterface
Interface for NetCDF files, used for resources and outputs. Settings:
filename,
simulationcount (size of the simulation dimension of output files) and section (section
specification for reading, e.g. 0:364,${index}; tokens are replaced by the resource adapter).- Author:
- Andreas Enders
-
Nested Class Summary
Nested classes/interfaces inherited from class FWSimInterface
FWSimInterface.INTERFACE_TYPE -
Field Summary
Fields inherited from class FILEInterface
iContent, iFileinfo, iFilenameFields inherited from class FWSimInterface
iColumnMap, iColumnNamesInt, iIntColumnNames -
Constructor Summary
ConstructorsModifierConstructorDescriptionNetCDFInterface(String aName, int aPoolSize, String aFileName, Integer aSimulationCount) Creates the interface without element.protectedNetCDFInterface(String aName, org.jdom2.Element aInterfaceElement) Creates the interface from its element. -
Method Summary
Modifier and TypeMethodDescriptiongetInterface(FWSimVarMap aVarMap, FWSimVariable.CONTENT_TYPE aContentType) Returns the file pool; it is created on the first call.intread(FWSimSession aFwSimSession, String aProjectID, Object aCache, LinkedHashMap<String, String> aKeyMap, FWSimInputAdapter aResourceAdapter, String aUniqueID, FWSimInterface.INTERFACE_TYPE aInterfaceType) Converts the data lines read by the NetCDF resource adapter (Object[][], key columns first) into a resource cache; empty lines are skipped.org.jdom2.ElementtoXML()Adds simulation count and section (if set) to the element of the base class.Methods inherited from class FILEInterface
finalize, getFilename, getRegisteredOutputFiles, resetFilePool, setFilenameMethods inherited from class FWSimInterface
checkHeaderForColMode, createInterface, createInterface, createStatisticInterface, getInterfaceElement, getInterfaceType, getName, getPoolSize, readColArray, readColArray, toString, transformArrays, writeToDatabase
-
Constructor Details
-
NetCDFInterface
Creates the interface from its element.- Parameters:
aName- name of the interfaceaInterfaceElement- theinterfaceelement
-
NetCDFInterface
Creates the interface without element.- Parameters:
aName- name of the interfaceaPoolSize- number of pooled filesaFileName- the file name, may contain tokensaSimulationCount- number of simulations;nulllike a missingsimulationcountelement (0)
-
-
Method Details
-
toXML
public org.jdom2.Element toXML()Adds simulation count and section (if set) to the element of the base class.- Overrides:
toXMLin classFILEInterface- Returns:
- the
interfaceelement
-
getInterface
Returns the file pool; it is created on the first call.- Overrides:
getInterfacein classFILEInterface- Parameters:
aVarMap- variable map used for replacing tokens (e.g. in file names), may benullaContentType-resfor reading,outfor writing- Returns:
- the file pool, or
nullwithout file name and content - See Also:
-
read
public FWSimResourceCache read(FWSimSession aFwSimSession, String aProjectID, Object aCache, LinkedHashMap<String, String> aKeyMap, FWSimInputAdapter aResourceAdapter, String aUniqueID, FWSimInterface.INTERFACE_TYPE aInterfaceType) throws MissingSimResourceExceptionConverts the data lines read by the NetCDF resource adapter (Object[][], key columns first) into a resource cache; empty lines are skipped. If the adapter caches to the database, or for the project data, the lines are also written to a table.- Specified by:
readin classFWSimInterface<FilePool>- Parameters:
aFwSimSession- the sessionaProjectID- id of the current projectaCache- the data read, in the format of the interface (e.g.String[][], result set, XML element)aKeyMap- key variables of the resourceaResourceAdapter- the adapter the cache belongs toaUniqueID- unique id of the source dataaInterfaceType- type of the source interface- Returns:
- the new resource cache
- Throws:
MissingSimResourceException- if the data cannot be converted- See Also:
-
getSimulationCount
public int getSimulationCount()- Returns:
- the number of simulations (size of the simulation dimension of output files)
-
getSectionSpec
- Returns:
- the section specification for reading (with tokens), or
null
-