Atlantis-Ecosystem-Model/cdfdistiller
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
README
This program has been designed to create a new Atlantis input file based on an Atlantis output file.
The most recent documentation will be found on the Atlantis wiki uder the Atlantis Users ->Tool section.
Building:
Windows.
Have visual studio 2003 installed.
Double click on the file cdfDistiller.sln to open the cdfDistiller solution in Visual Studio.
This code references some libraries in the atlantis code base. So it must know where these files are.
The expected file structure is:
CodeFolderName
->Atlantis
->sjwlib
->netcdf
->cdfDistiller
If for some reason you have a different folder structure to this you will have to change the settings in the cdfDistiller project to tell it where to find the
sjwlib and netcdf headers and .lib files.
These are set by right clicking on the project (not solution) name and selecting properties.
Setting the locations of the netcdf and sjwlib headers:
Expand the 'Configuration Properties' -> C/C++ ->General option.
The Additional Include Directories field will by default contain teh following:
"$(SolutionDir)..\atlantis\sjwlib\include";"$(SolutionDir)..\atlantis\netcdf\include"
Where $(SolutionDir) will be the location you have placed the cdfDistiller code.
You will need to change the relative reference to where your atlantis code is.
Changing the location of the sjwlib.lib and netcdfs.lib files:
These are also set in the Configuration Properties panel under the 'Linker->general' option.
The Additional Dependancies field will contain the following default value:
$(SolutionDir)..\atlantis\sjwlib\Debug\sjwlib.lib $(SolutionDir)..\atlantis\netcdf\lib\netcdfs.lib
So you will also need to change the relative location to the atlantis directory.
If you can't get this working contact Bec or move you cdfDistiller code to the default location as
indicated above.
Linux:
./configure
make
sudo make install
Program Usage:
cdfDistiller is a command line program that should be run via a command prompt or a terminal.
cdfDistiller.exe -i existingOutput.nc -o newInput.nc -r run.prm
Where
cdfDistiller.exe is the name of the program
existingOutput.nc is the name of an existing Atlantis output netcdf file.
newInput.nc is the name of the output file that cdfDistiller will create. This can then be used as input to a new Atlantis run.
run.prm is a prm text file that contains information about how you want your new file to be created. See below for more information.
run.prm input file:
verbose 0 # Detailed logged output
title Final fishing starting 1968
flagdump 0 # flag indicating whether use max dump in file (0) or user specified dump (1). If set to 0 the max timestep in the input file will be used.
#
start_dump 10 # dump to use of flagdump = 1. Note - this is not days its steps in time.
dt 12 hour # 12 hour time step - the timestep of the output and input files. They must be the same.
flagtimereset 1 # flag indicating whether to use t from original file (0) or set to value in tstop (1)
tstop 0 hour # timestamp to put on input.cdf dump
flagflipdz 1 # flag to flip dz if necessary (0 of old output.nc file, 1 for newer output.nc files)
# Should really always be 1.
wc_dz_tol 0.20 # Tolerance for water column dz values. The model only allows this much fractional
# change before dz is reset to nominal value.
# Best to leave as it.
Example run files:
There are some example files in the cdfDistiller Example folder. Open the 'rundistiller.bat' file using textpad or similar to view.
Checking your output:
1. Either use Dive or Olive to view the files.
2. Use ncdump to dump the generated netcdf file to cdf format so it can be viewed with a text editor.
3. Use ncks (a very usful netcdf tool).
Basic Program outline.
- Create a new empty netcdf file based on the structure in the template.nc file. The dimensions will be read in from the provided output Atlantis file.
- Read in the data at the specified timestamp and then store these in the newly generated netcdf file.
- The order of the dz values will be 'slid' so that they match the correct order of the Atlantis input files.
- Atlantis expects to read in information about each box from the sediment up through the water column with any non-existant before the sediment values.
- for example
950 350 100 50 0 0 SED0 SED1
where SED0 is the first sediment layer, SED1 is the second sediment layer.
- But its very confusing for people to view this in Dive to have the zero values at the end between the water column layers and the sediment layers.
So the atlantis output file would look lihe the following:
0 0 950 350 100 50 SED0 SED1
- You don't need to know about this to use the cdfDistiller but its a useful thing to note.