All Docs
Main.DarOneTools.MITgcm_path
— ConstantMITgcm_path
Path to a MITgcm folder. MITgcm_path[1]
should generally be used. MITgcm_path[2]
is mostly meant to facilitate comparisons between e.g. MITgcm releases when needed.
Main.DarOneTools.base_configuration
— Constantbase_configuration
Name of the folder that lives in the /verificaion folder of the MITgcm. This holds the basic configuration for Dar_One, which is a homogenous 1m x 1m x 1m water parcel with air/sea exchange, no mixing, few nuturients, and no biological forcing.
Main.DarOneTools.filexe
— Constantfilexe
Path to the file that contains the built MITgcm, normally named "mitgcmuv". The executable should be compiled on whatever machine you're using to run the model, unless using the docker container [TODO: link]
Main.DarOneTools.MITgcm_config
— TypeMITgcm_config()
Concrete type of AbstractModelConfig
for MITgcm
(as part of the ClimateModels.jl
interface for MITgcm
) which contains
model :: String = "MITgcm"
configuration :: String = ""
options :: OrderedDict{Any,Any} = OrderedDict{Any,Any}()
inputs :: OrderedDict{Any,Any} = OrderedDict{Any,Any}()
outputs :: OrderedDict{Any,Any} = OrderedDict{Any,Any}()
status :: OrderedDict{Any,Any} = OrderedDict{Any,Any}()
channel :: Channel{Any} = Channel{Any}(10)
folder :: String = tempdir()
ID :: UUID = UUIDs.uuid4()
and can be constructed using keywords as follows
unknown_config=MITgcm_config(configuration="unknown")
Main.DarOneTools.MITgcm_namelist
— TypeMITgcm_namelist(groups,params)
Data structure representing a MITgcm namelist file, such as data.pkg
, which contains
groups :: Array{Symbol,1} = Array{Symbol,1}(undef, 0)
params :: Array{OrderedDict{Symbol,Any},1} = Array{OrderedDict{Symbol,Any},1}(undef, 0)
with model parameters (params
) being organized in groups
as done in the files.
using MITgcmTools
fil=joinpath(MITgcm_path[1],"verification","advect_xy","run","data")
nml=read_namelist(fil)
MITgcm_namelist(nml.groups,nml.params)
MITgcm_namelist(groups=nml.groups,params=nml.params)
MITgcm_namelist(groups=nml.groups)
Main.DarOneTools.SECONDS
— Typecommon time steps in seconds
ClimateModels.build
— Methodbuild(config::MITgcm_config,options::String)
Build the model using genmake2
, make depend
, and make
unless otherwise specified via options
. The genmake2
and make depend
commands link all code files, headers, etc in the build/
folder before make
compiles the model.
(part of the climate model interface as specialized for MITgcm
)
ClimateModels.build
— Methodbuild(config::MITgcm_config)
Build the model using genmake2
, make depend
, and make
. The first two link all code files, headers, etc in the build/
folder before compiling the model
(part of the climate model interface as specialized for MITgcm
)
ClimateModels.clean
— Methodclean(config::MITgcm_config)
Cancel any remaining task (config.channel) and clean up the run directory (via rm).
(part of the climate model interface as specialized for MITgcm
)
ClimateModels.compile
— Methodcompile(config::MITgcm_config)
Compile the model using make
in build/
that has already been setup.
(part of the climate model interface as specialized for MITgcm
)
ClimateModels.setup
— Methodsetup(config::MITgcm_config)
Create a run/
folder and link everything there as needed to be ready to run model as normally done for most-standard MITgcm configurations (incl. prepare_run
and mitgcmuv
). Call ClimateModels.git_log_init(config)
to setup git tracker and put!(config.channel,MITgcm_launch)
to be executed via launch(config)
later.
(part of the climate model interface as specialized for MITgcm
)
Main.DarOneTools.MITgcm_launch
— MethodMITgcm_launch(config::MITgcm_config)
Go to run/
folder and effectively call mitgcmuv > output.txt
(part of the climate model interface as specialized for MITgcm
)
Main.DarOneTools.create_MITgcm_config
— Methodcreate_MITgcm_config(config_id)
Arguments:
- configid: unique name for your darone run
Returns
- configobj::MITgcmconfig
- rundir::AbstractString - folder where output will be
Main.DarOneTools.ed_id_to_name
— Methoded_id_to_name(id)
Return the string "Ed"+id
Main.DarOneTools.es_id_to_name
— Methodes_id_to_name(id)
Return the string "Es"+id
Main.DarOneTools.hold_nutrients_constant
— Functionholdnutrientsconstant(param_list)
Takes a vector of length 19, for each of the non-plankton tracers, with values of either 0 or 1. This function modifies darwin_plankton.F, and mulitplies the computed tendencies of the nutrient tracers by the value passed in. 0 = hold constant 1 = allow change
The appropriate vector to pass in to hold all nutrients constant would be zeros(19)
. To allow all nutrients to vary, the parameter would be ones(19)
. The indices in the param_list correspond to the following nutrients, in order: [DIC, NO3, NO2, NH4, PO4, SiO2, FeT, DOC, DON, DOP, DOFe, PIC, POC, PON, PIP, PISi, POFe, ALK, O2]
Main.DarOneTools.init_radtrans_grid
— MethodTODO note: made specifically for selecting range of latitudes and times at fixed x and z
Main.DarOneTools.init_radtrans_grid_xy
— MethodTODO note: made specifically for selecting range of latitudes and longitudes at fixed t and z
Main.DarOneTools.init_temperature_grid
— Functioninit_temperature_grid(config_obj, tracer_name, init_list, dim, grid_size=(5,3))
Create a bin file of initial values for temperature. For a grid of size (X, Y), the initial conditions for each grid cell are set in a binary file with X*Y number of floats, in big-endian format, with no headers.
Arguments
- config_obj
- tracer_name: String
- init_list: list of values to initialize the temperature to
- dim: "x" or "y" - which dimension to set to the list; values won't change along the other axis
- grid_size: tuple ints, default 2x2
Returns
- the matrix of initial values
Main.DarOneTools.init_temperature_grid
— Methodinit_temperature_grid(config_obj, tracer_name, init_matrix)
Create a bin file of initial values for temperature. For a grid of size (X, Y), the initial conditions for each grid cell are set in a binary file with X*Y number of floats, in big-endian format, with no headers.
Arguments
- config_obj
- init_matrix: 2D list of values to write to the bin file
Returns
- the matrix of initial values
Main.DarOneTools.init_tracer_grid
— Functioninit_tracer_grid(config_obj, tracer_name, init_list, dim, grid_size=(5,3))
Create a bin file of initial values for a tracer. For a grid of size (X, Y), the initial conditions for each grid cell are set in a binary file with X*Y number of floats, in big-endian format, with no headers.
Arguments
- config_obj
- tracer_name: String
- init_list: list of values to initialize the tracer to
- dim: "x" or "y" - which dimension to set to the list; values won't change along the other axis
- grid_size: tuple ints, default 2x2
Returns
- the matrix of initial values
Main.DarOneTools.init_tracer_grid
— Methodinit_tracer_grid(config_obj, tracer_name, init_matrix)
Create a bin file of initial values for a tracer. For a grid of size (X, Y), the initial conditions for each grid cell are set in a binary file with X*Y number of floats, in big-endian format, with no headers.
Arguments
- config_obj
- tracer_name: String
- init_matrix: 2D list of values to write to the bin file
Returns
- the matrix of initial values
Main.DarOneTools.parse_param
— Methodparse_param(p1)
Parse namelist parameter and return in corresponding type
Main.DarOneTools.read_available_diagnostics
— Methodread_available_diagnostics(fldname::String; filename="available_diagnostics.log")
Get the information for a particular variable fldname
from the available_diagnostics.log
text file generated by MITgcm
.
Main.DarOneTools.read_flt
— Methodread_flt(dirIn::String,prec::DataType)
Read displacements from MITgcm/pkg/flt output file into a DataFrame.
Main.DarOneTools.read_mdsio
— Methodread_mdsio(pth::String,fil::String)
Read a set of MITgcm
MDSIO-type files (".data" binary + ".meta" text pair), combine, and return as an Array. Unlike read_mdsio(fil::String)
where fil
is one complete file name, this method will search within pth
for files that start with fil
.
p="./hs94.cs-32x32x5/run/"
x=read_mdsio(p,"surfDiag.0000000020")
y=read_mdsio(p,"pickup.ckptA")
z=read_mdsio(p,"T.0000000000")
Main.DarOneTools.read_mdsio
— Methodread_mdsio(fil::String)
Read a single MITgcm
MDSIO-type file (".data" binary + ".meta" text pair), and return as an Array
p="./hs94.cs-32x32x5/run/"
x=read_mdsio(p*"surfDiag.0000000020.002.001.data")
y=read_mdsio(p*"pickup.ckptA.002.001.data")
z=read_mdsio(p*"T.0000000000.002.001.data")
Main.DarOneTools.read_meta
— Methodread_meta(metafile)
Read a MITgcm
metadata file, parse it, and return as a NamedTuple
p="./hs94.cs-32x32x5/run/"
meta=read_meta(p*"surfDiag.0000000020.002.001.meta")
pairs(meta)
meta.dimList
Main.DarOneTools.read_meta
— Methodread_meta(pth::String,fil::String)
Read a MITgcm
metadata files, parse them, and return as an array of NamedTuple
p="./hs94.cs-32x32x5/run/"
meta=read_meta(p,"surfDiag.0000000020")
pairs(meta[end])
[meta[i].dimList for i in 1:length(meta)]
Main.DarOneTools.read_mnc
— Methodread_mnc(pth::String,fil::String,var::String)
Read variable var
from a set of MITgcm
MNC-type files (netcdf files), combine, and return as an Array. This method will search within pth
for files that start with fil
.
Main.DarOneTools.read_namelist
— Methodread_namelist(fil)
Read a MITgcm
namelist file, parse it, and return as a NamedTuple
- assumes a single variable definition per line
using MITgcmTools
testreport("advect_xy")
fil=joinpath(MITgcm_path[1],"verification","advect_xy","run","data")
namelist=read_namelist(fil)
Main.DarOneTools.scan_rundir
— Methodscan_rundir(pth::String)
Scan a MITgcm run directory and standard output text file ("output.txt" or "STDOUT.0000") and return a NamedTuple of collected information (various formats)
Initially, the output looked like (grid=gr,packages=pac,params_time=par1,params_grid=par2,completed=co)
Main.DarOneTools.scan_stdout
— Methodscan_stdout(filout::String)
Scan a MITgcm standard output text file ("output.txt" or "STDOUT.0000") and return a NamedTuple of collected information (various formats).
- packages : report of packages being compiled and used
- params_time : initial time, model duation, output frequency, etc
- params_grid : type of grid (Curvilinear, Cartesian, ...) and array sizes
- paramsfiles : type of output (usemdsio, use_mnc) and array size (ioSize)
- completed : true / false depending on the end of standard output file (filout)
Main.DarOneTools.testreport
— Functiontestreport(nam::String,ext="")
Run the testreport script for one model config nam
(or "all"), with additional options (optional) speficied in ext
using MITgcmTools
testreport(MITgcm_config(configuration="front_relax"),"-norun")
#testreport(MITgcm_config(configuration="all"),"-norun")
Main.DarOneTools.tracer_id_to_name
— Methodtracer_id_to_name(id)
Return the string "TRAC"+id
Main.DarOneTools.tracer_name_to_id
— Methodtracer_name_to_id(name)
Return the int in the tracer name. i.e. tracer_name_to_id("TRAC21")
will return 21
Main.DarOneTools.update_ALK
— Methodupdate_ALK(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of ALK for the model's initial condition (note: it will equalize through air-sea exchange)
Main.DarOneTools.update_CDOM
— Methodupdate_CDOM(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of CDOM for the model's initial condition
Main.DarOneTools.update_DOC
— Methodupdate_DOC(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of DOC for the model's initial condition
Main.DarOneTools.update_DOFe
— Methodupdate_DOFe(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of DOFe for the model's initial condition
Main.DarOneTools.update_DON
— Methodupdate_DON(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of DON for the model's initial condition
Main.DarOneTools.update_DOP
— Methodupdate_DOP(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of DOP for the model's initial condition
Main.DarOneTools.update_FeT
— Methodupdate_FeT(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of FeT for the model's initial condition
Main.DarOneTools.update_NH4
— Methodupdate_NH4(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of NH4 for the model's initial condition
Main.DarOneTools.update_NO2
— Methodupdate_NO2(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of NO2 for the model's initial condition
Main.DarOneTools.update_NO3
— Methodupdate_NO3(config_obj, new_val)
Arguments:
config_obj
`: the MITgcm_config you are working withnew_val
: amount of NO3 for the model's initial condition
Main.DarOneTools.update_O2
— Methodupdate_O2(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of O2 for the model's initial condition (note: it will equalize through air-sea exchange)
Main.DarOneTools.update_PIC
— Methodupdate_PIC(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of PIC for the model's initial condition
Main.DarOneTools.update_PO4
— Methodupdate_PO4(config_obj, new_val)
Arguments:
config_obj
`: the MITgcm_config you are working withnew_val
: amount of PO4 for the model's initial condition
Main.DarOneTools.update_POC
— Methodupdate_POC(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of POC for the model's initial condition
Main.DarOneTools.update_POFe
— Methodupdate_POFe(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of POFe for the model's initial condition
Main.DarOneTools.update_PON
— Methodupdate_PON(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of PON for the model's initial condition
Main.DarOneTools.update_POP
— Methodupdate_POP(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of POP for the model's initial condition
Main.DarOneTools.update_POSi
— Methodupdate_POSi(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of POSi for the model's initial condition
Main.DarOneTools.update_SiO2
— Methodupdate_SiO2(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of SiO2 for the model's initial condition
Main.DarOneTools.update_all_diagnostic_freqs
— Functionupdate_all_diagnostic_freqs(config_obj, frequency)
Speficy a frequency in seconds at which to write all diagnostic files
Arguments:
- configobj: the MITgcmconfig you are working with
- frequency: new frequency at which to write to the files, in seconds
Main.DarOneTools.update_delX_delY_for_grid
— MethodTODO
Main.DarOneTools.update_diagnostic_freq
— Methodupdate_diagnostic_freq(config_obj, diagnostic_num, frequency)
Speficy a frequency in seconds at which to write to a diagnostic file
Arguments:
- diagnostic_num: the integer identifier for the diagnostic file you want to modify
- frequency: new frequency at which to write to that file, in seconds
- configobj: the MITgcmconfig you are working with
TODO: create enums for diagnostic names (and name them better?)
TODO: what should the initial frequency be? - in file
Main.DarOneTools.update_end_time
— Methodupdate_end_time(end_time, config_obj)
Set how long the simulation will run, in iterations. Each iteration is 3 hours, or 10800 seconds. One year is 2880 iterations, which is the default.
Arguments:
- end_time: how many iterations to run the model for
- configobj: the MITgcmconfig you are working with
Main.DarOneTools.update_grid_size
— FunctionDefault grid size is 1 x 1.
Main.DarOneTools.update_param
— Methodupdate_param(config_obj, file_name, group_name, param_name, new_param_value)
Speficy a parameter to update
Arguments:
- TODO
Main.DarOneTools.update_params
— Methodupdate_params(config_obj, file_name, group_names, param_names, new_param_values)
Update multiple parameters in the same file.
Arguments:
- TODO
Main.DarOneTools.update_pro
— Methodupdate_pro(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of Prochlorococcus for the model's initial condition
Main.DarOneTools.update_ptracers_initialFile
— MethodTODO
Main.DarOneTools.update_radtrans
— Methodupdate_radtrans(config_obj, ds::NCDataset, x, y, z, t)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of Synechococcus for the model's initial condition
Main.DarOneTools.update_radtrans_initialFile
— MethodTODO
Main.DarOneTools.update_syn
— Methodupdate_syn(config_obj, new_val)
Arguments:
config_obj
: the MITgcm_config you are working withnew_val
: amount of Synechococcus for the model's initial condition
Main.DarOneTools.update_temperature
— Methodupdate_temperature(config_obj, new_temp)
Set the temperature (in celcius). This temperature will be constant throughout the run. TODO: how do you set a variable temperature? i.e. seasonal?
Arguments:
- new_temp: new temperature in celsius
- configobj: the MITgcmconfig you are working with
Main.DarOneTools.update_temperature_initialFile
— MethodTODO
Main.DarOneTools.update_tracer
— Methodupdate_tracer(config_obj, tracer_num::Int64, new_value::Float32)
Arguments
config_id
tracer_num
new_value
Main.DarOneTools.update_tracers
— Functionupdate_tracers(config_obj, tracer_ids, ds::NCDataset, x, y, z, t, multiplier=1)
Arguments
config_obj
tracer_ids
ds
- x
- y
- z
- t
- multiplier
Main.DarOneTools.update_tracers
— Methodtakes a list of tracers and list of values - todo
Main.DarOneTools.write_namelist
— Methodwrite_namelist(fil)
Save a MITgcm
namelist file. In the example below, one is read from file, modified, and then saved to a new file using write_namelist.
using MITgcmTools
fil=joinpath(MITgcm_path[1],"verification","advect_xy","run","data")
nml=read_namelist(fil)
write_namelist(fil*"_new",namelist)
or
nml=read(fil,MITgcm_namelist())
write(fil*"_new",nml)
Main.DarOneTools.write_palat_matrix
— MethodUpdate the palatability matrix for grazer preference where PALAT(X,Y) := rate at which predator Y eats prey X