Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Model pre-adapter for running SWAN (Simulating WAves Nearshore) model from Delft-FEWS.
For information about the SWAN model see http://www.swan.tudelft.nl/Image Removed

Usage: SwanPreAdapter <netcdf run file pathname relative to current working directory>

...

  • For all files that are written by this adapter, if the file to be written already exists, then it will be overwritten.
  • This program assumes that the model always runs in time zone GMT.
  • This program writes log messages to a log file called swan_pre_adapter_log.txt in the workDir specified in the netcdf run file.
  • This program uses the information in the specified netcdf run file as input and uses this information to do the following actions:
    1. Convert input spectra time series (optional):
      The netcdf file specified in the property "input_spectra_file_to_convert" will be converted to a file in SWAN ascii format with the same path and name but different extension (.BND). For example the original file input/spectra.nc is converted to input/spectra.BND. If the property "input_spectra_file_to_convert" is not specified, then this step does nothing.
    2. Create swan input file:
      The template SWAN input file specified in the property "template_swan_input_file" will be copied to the file specified in the property "swan_input_file". In the copy the following tags will be replaced with the corresponding values:

      $TSTART$

      Start time of the model run.

      $TSTOP$

      End time of the model run.

      $HOTSTART$

      Either "INITIAL HOTSTART 'pathname of input state file' NETCDF" if the input state file is not empty (warm state start) or empty string if the input state file is an empty dummy file of 0 bytes length (cold state start) or empty string if there is no input state file at all (cold state start).

      $STATIONARY_TIMES$

      Multiple lines with time stamps for a stationary model run:
      COMPUTE STATIONARY <first time stamp for stationary model run>
      COMPUTE STATIONARY <second time stamp for stationary model run>
      ...
      COMPUTE STATIONARY <last time stamp for stationary model run>

...

Model post-adapter for running SWAN (Simulating WAves Nearshore) model from Delft-FEWS.
For information about the SWAN model see http://www.swan.tudelft.nl/Image Removed

Usage: SwanPostAdapter <netcdf run file pathname relative to current working directory>

...

  • This program needs Java version 1.7 or higher.
  • This program needs the following Java libraries:
    • commons-httpclient-3.0.1.jar
    • Delft_FEWS.jar
    • Delft_Util.jar
    • log4j-1.2.14.jar
    • netcdf-4.2.jar
    • slf4j-api-1.5.6.jar
    • slf4j-log4j12-1.5.6.jar
    • TimeSeriesImport.jar

GeneralAdapterRun Example Configuration

The following gives an example of how to set up the GeneralAdapterRun file for SWAN in FEWS using the SWAN model pre and post-adapters.  The GeneralAdapterRun file follows the general structure as described here.

General

In this section general information regarding the module such as version number, file directories, missing values, and time zone information can be specified.

Code Block
xml
xml
titlegeneral

<general>
	<description>SWAN model run</description>
	<piVersion>1.8</piVersion>
	<rootDir>%REGION_HOME%/Modules/Swan/$MODEL$</rootDir>
	<workDir>%ROOT_DIR%/workDir</workDir>
	<exportDir>%ROOT_DIR%/input</exportDir>
	<exportDataSetDir>%ROOT_DIR%/</exportDataSetDir>
	<exportIdMap>IdExport_$MODEL$</exportIdMap>
	<importDir>%ROOT_DIR%/workDir</importDir>
	<importIdMap>IdImport_$MODEL$</importIdMap>
	<importUnitConversionsId>ImportUnitConversions</importUnitConversionsId>
	<dumpFileDir>$GA_DUMPFILEDIR$</dumpFileDir>
	<dumpDir>%ROOT_DIR%/diagnostics/</dumpDir>
	<diagnosticFile>%ROOT_DIR%/diagnostics/diagnostics.xml</diagnosticFile>
	<missVal>-999</missVal>
	<timeZone>
		<timeZoneName>GMT+0:00</timeZoneName>
	</timeZone>
</general>
Start-up activities

It may be useful to clear the model working directory of any previous runs before starting a new run.

Code Block
xml
xml
titlestartUpActivities

		<startUpActivities>
			<purgeActivity>
				<filter>%ROOT_DIR%/workDir/*</filter>
			</purgeActivity>
		</startUpActivities>
Export activities

In this section the data to be exported from FEWS as input to the module is specified. Data to export to SWAN generally includes:

  • Model state
  • Model data set
  • Input data (i.e. wind, water levels, wave spectra)
  • Run file

The run file contains information regarding the input file names, start and stop times, and time step. Additional properties can be passed using the run file as listed above under Properties.

Code Block
xml
xml
titleexportActivities

<exportActivities>
			<exportStateActivity>
				<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
				<stateExportDir>%ROOT_DIR%/stateInput</stateExportDir>
				<stateSelection>
					<warmState>
						<stateSearchPeriod unit="hour" start="-1" end="0"/>
					</warmState>
				</stateSelection>
			</exportStateActivity>
			<exportDataSetActivity>
				<moduleInstanceId>Swan_$MODEL$_$METEO$</moduleInstanceId>
			</exportDataSetActivity>
			<exportNetcdfActivity>
				<exportFile>waterlevel.nc</exportFile>
				<timeSeriesSets>
					<timeSeriesSet>
						<moduleInstanceId>D3D_flow_dcsm5_hirlam72_hc</moduleInstanceId>
						<valueType>grid</valueType>
						<parameterId>H.simulated</parameterId>
						<locationId>dcsm5</locationId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="hour"/>
						<relativeViewPeriod unit="hour" start="-1" startOverrulable="true" end="0"/>
						<readWriteMode>read only</readWriteMode>
						<synchLevel>2</synchLevel>
					</timeSeriesSet>
				</timeSeriesSets>
			</exportNetcdfActivity>
			<exportNetcdfActivity>
				<exportFile>$METEO$.nc</exportFile>
				<timeSeriesSets>
					<timeSeriesSet>
						<moduleInstanceId>Import_$METEO$</moduleInstanceId>
						<valueType>grid</valueType>
						<parameterId>Wind.u.simulated</parameterId>
						<locationId>$METEO$_regular</locationId>
						<timeSeriesType>external historical</timeSeriesType>
						<timeStep unit="hour" multiplier="1"/>
						<relativeViewPeriod unit="hour" start="-1" startOverrulable="true" end="0"/>
						<readWriteMode>read only</readWriteMode>
					</timeSeriesSet>
					<timeSeriesSet>
						<moduleInstanceId>Import_$METEO$</moduleInstanceId>
						<valueType>grid</valueType>
						<parameterId>Wind.v.simulated</parameterId>
						<locationId>$METEO$_regular</locationId>
						<timeSeriesType>external historical</timeSeriesType>
						<timeStep unit="hour" multiplier="1"/>
						<relativeViewPeriod unit="hour" start="-1" startOverrulable="true" end="0"/>
						<readWriteMode>read only</readWriteMode>
					</timeSeriesSet>
				</timeSeriesSets>
			</exportNetcdfActivity>
			<exportNetcdfActivity>
				<exportFile>ecmwf_spectra.nc</exportFile>
				<timeSeriesSets>
					<timeSeriesSet>
						<moduleInstanceId>Import_ecmwf_spectra</moduleInstanceId>
						<valueType>scalar</valueType>
						<parameterId>Wave.variancedensity2D.simulated</parameterId>
						<domainParameterId>f</domainParameterId>
						<domainParameterId>dir</domainParameterId>
						<locationSetId>ecmwf_spectra.locations</locationSetId>
						<timeSeriesType>external historical</timeSeriesType>
						<timeStep unit="hour" multiplier="6"/>
						<relativeViewPeriod unit="hour" end="0"/>
						<readWriteMode>read only</readWriteMode>
					</timeSeriesSet>
				</timeSeriesSets>
			</exportNetcdfActivity>
			<exportNetcdfRunFileActivity>
				<description>This run file is passed as argument to SwanPreAdapter</description>
				<exportFile>%WORK_DIR%\run_info.nc</exportFile>
				<properties>
					<string key="input_spectra_file_to_convert" value="..\input\ecmwf_spectra.nc"/>
					<string key="template_swan_input_file" value="..\template\template.swn"/>
					<string key="swan_input_file" value="INPUT"/>
				</properties>
			</exportNetcdfRunFileActivity>
		</exportActivities>
Execute activities

This section calls the SWAN pre and post-adapters as well as the SWAN executable. Note: the run file must be passed as an argument to the SWAN pre and post-adapters.

Code Block
xml
xml
titleexecuteActivities

<executeActivities>
			<executeActivity>
				<command>
					<className>nl.deltares.swan.SwanPreAdapter</className>
					<binDir>..\..\..\bin\Swan_adapter\bin</binDir>
				</command>
				<arguments>
					<argument>%WORK_DIR%\run_info.nc</argument>
				</arguments>
				<timeOut>99999999</timeOut>
				<ignoreDiagnostics>true</ignoreDiagnostics>
			</executeActivity>
			<executeActivity>
				<command>
					<executable>..\..\..\bin\Swan\swan_4091AB_3_del_win_vs2010.exe</executable>
				</command>
				<arguments>
					<argument>%WORK_DIR%\INPUT</argument>
				</arguments>
				<timeOut>99999999</timeOut>
				<ignoreDiagnostics>true</ignoreDiagnostics>
			</executeActivity>
			<executeActivity>
				<command>
					<className>nl.deltares.swan.SwanPostAdapter</className>
					<binDir>..\..\..\bin\Swan_adapter\bin</binDir>
				</command>
				<arguments>
					<argument>%WORK_DIR%\run_info.nc</argument>
				</arguments>
				<timeOut>99999999</timeOut>
				<ignoreDiagnostics>true</ignoreDiagnostics>
			</executeActivity>
		</executeActivities>
Import activities

In this section the data to be imported into FEWS as output from the module is specified. Data to import from SWAN generally includes:

  • Model state
  • Output data (i.e. wind, water levels, wave spectra)
Code Block
xml
xml
titleimportActivities

<importActivities>
			<importStateActivity>
				<stateFile>
					<importFile>%ROOT_DIR%/workDir/swan-state.nc</importFile>
					<relativeExportFile>swan-restart.nc</relativeExportFile>
				</stateFile>
				<expiryTime unit="day" multiplier="3"/>
			</importStateActivity>
			<importPiNetcdfActivity>
				<importFile>..\output\SPEC2D_P1.nc</importFile>
				<timeSeriesSets>
					<timeSeriesSet>
						<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
						<valueType>spectrum</valueType>
						<parameterId>Wave.variancedensity2D.simulated</parameterId>
						<domainParameterId>f</domainParameterId>
						<domainParameterId>dir</domainParameterId>
						<locationSetId>$MODEL$.locations</locationSetId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="hour"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>2</synchLevel>
						<expiryTime unit="week" multiplier="1"/>
					</timeSeriesSet>
				</timeSeriesSets>
			</importPiNetcdfActivity>
			<importPiNetcdfActivity>
				<importFile>POINTS.nc</importFile>
				<timeSeriesSets>
					<timeSeriesSet>
						<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
						<valueType>scalar</valueType>
						<parameterId>Wave.hm0.simulated</parameterId>
						<locationSetId>$MODEL$.locations</locationSetId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="minute" multiplier="60"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>0</synchLevel>
						<expiryTime unit="week" multiplier="1"/>
					</timeSeriesSet>
					<timeSeriesSet>
						<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
						<valueType>scalar</valueType>
						<parameterId>Wave.he10.simulated</parameterId>
						<locationSetId>$MODEL$.locations</locationSetId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="minute" multiplier="60"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>0</synchLevel>
						<expiryTime unit="week" multiplier="1"/>
					</timeSeriesSet>
					<timeSeriesSet>
						<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
						<valueType>scalar</valueType>
						<parameterId>Wave.period.Tm-1.0.simulated</parameterId>
						<locationSetId>$MODEL$.locations</locationSetId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="minute" multiplier="60"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>0</synchLevel>
						<expiryTime unit="week" multiplier="1"/>
					</timeSeriesSet>
					<timeSeriesSet>
						<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
						<valueType>scalar</valueType>
						<parameterId>Wave.dir.E10.simulated</parameterId>
						<locationSetId>$MODEL$.locations</locationSetId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="minute" multiplier="60"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>0</synchLevel>
						<expiryTime unit="week" multiplier="1"/>
					</timeSeriesSet>
					<timeSeriesSet>
						<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
						<valueType>scalar</valueType>
						<parameterId>Wave.s0bh.simulated</parameterId>
						<locationSetId>$MODEL$.locations</locationSetId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="minute" multiplier="60"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>0</synchLevel>
						<expiryTime unit="week" multiplier="1"/>
					</timeSeriesSet>
					<timeSeriesSet>
						<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
						<valueType>scalar</valueType>
						<parameterId>Wave.period.Tps.simulated</parameterId>
						<locationSetId>$MODEL$.locations</locationSetId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="minute" multiplier="60"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>0</synchLevel>
						<expiryTime unit="week" multiplier="1"/>
					</timeSeriesSet>
					<timeSeriesSet>
						<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
						<valueType>scalar</valueType>
						<parameterId>H.simulated</parameterId>
						<locationSetId>$MODEL$.locations</locationSetId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="minute" multiplier="60"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>0</synchLevel>
						<expiryTime unit="week" multiplier="1"/>
					</timeSeriesSet>
				</timeSeriesSets>
			</importPiNetcdfActivity>
			<importPiNetcdfActivity>
				<importFile>..\output\swan2D.nc</importFile>
				<timeSeriesSets>
					<timeSeriesSet>
						<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
						<valueType>grid</valueType>
						<parameterId>Wave.hm0.simulated</parameterId>
						<locationId>$MODEL$</locationId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="minute" multiplier="60"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>2</synchLevel>
						<expiryTime unit="hour" multiplier="24"/>
					</timeSeriesSet>
					<timeSeriesSet>
						<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
						<valueType>grid</valueType>
						<parameterId>Wave.he10.simulated</parameterId>
						<locationId>$MODEL$</locationId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="minute" multiplier="60"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>2</synchLevel>
						<expiryTime unit="hour" multiplier="24"/>
					</timeSeriesSet>
					<timeSeriesSet>
						<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
						<valueType>grid</valueType>
						<parameterId>Wave.period.Tm-1.0.simulated</parameterId>
						<locationId>$MODEL$</locationId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="minute" multiplier="60"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>2</synchLevel>
						<expiryTime unit="hour" multiplier="24"/>
					</timeSeriesSet>
					<timeSeriesSet>
						<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
						<valueType>grid</valueType>
						<parameterId>Wave.period.Tps.simulated</parameterId>
						<locationId>$MODEL$</locationId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="minute" multiplier="60"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>2</synchLevel>
						<expiryTime unit="hour" multiplier="24"/>
					</timeSeriesSet>
					<timeSeriesSet>
						<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
						<valueType>grid</valueType>
						<parameterId>Wave.th0.simulated</parameterId>
						<locationId>$MODEL$</locationId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="minute" multiplier="60"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>2</synchLevel>
						<expiryTime unit="hour" multiplier="24"/>
					</timeSeriesSet>
					<timeSeriesSet>
						<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
						<valueType>grid</valueType>
						<parameterId>Wave.s0bh.simulated</parameterId>
						<locationId>$MODEL$</locationId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="minute" multiplier="60"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>2</synchLevel>
						<expiryTime unit="hour" multiplier="24"/>
					</timeSeriesSet>
					<timeSeriesSet>
						<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
						<valueType>grid</valueType>
						<parameterId>H.simulated</parameterId>
						<locationId>$MODEL$</locationId>
						<timeSeriesType>simulated historical</timeSeriesType>
						<timeStep unit="minute" multiplier="60"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>2</synchLevel>
						<expiryTime unit="hour" multiplier="24"/>
					</timeSeriesSet>
				</timeSeriesSets>
			</importPiNetcdfActivity>
		</importActivities>