Base
get_file_suffix(dir, suffix)
Returns a list of all files in dir
which end in suffix
.
This is the same function that is in utils.load
but cannot do a relative import due to slurm job submission
stuff.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dir
|
str
|
Directory of interest. |
required |
suffix
|
str
|
Usually the file type of interest e.g. |
required |
Returns:
Type | Description |
---|---|
List[str]
|
List of all files with the correct |
Source code in isca_tools/run/base.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
get_unique_dir_name(base_dir)
Return a unique directory name by appending a number if needed. E.g., 'results', 'results_1', 'results_2', ...
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_dir
|
str
|
Path to directory |
required |
Returns:
Name | Type | Description |
---|---|---|
base_dir |
str
|
Unique directory name |
Source code in isca_tools/run/base.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
run_experiment(namelist_file, diag_table_file, slurm=False)
This splits the total simulation up into jobs based on info specified in namelist_file
and
then runs run_job
for each job. If slurm==True
, then each job will be submitted to a Slurm
queue through the run_slurm.sh
script.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
namelist_file
|
str
|
File path to namelist
|
required |
diag_table_file
|
str
|
File path to the diagnostic table file for the experiment. This specifies the outputs of the experiment. |
required |
slurm
|
bool
|
If |
False
|
Source code in isca_tools/run/base.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
run_job(namelist_file, diag_table_file, month_start, month_duration)
Runs simulation for month_duration
months starting with the month indicated by month_start
.
Will throw an error if no data found for months prior to month_start
.
Output will be saved in $GFDL_DATA/{exp_name}
with a different folder for each month.
Extended from original script.
Args:
namelist_file: File path to namelist nml
file for the experiment.
This specifies the physical parameters used for the simulation.
Also contains experiment_details
section which contains the following:
- `name`: *string*. Name of experiment e.g. data saved in folder `$GFDL_DATA/{name}`
- `input_dir`: *string*. Directory containing any input files e.g. `namelist.nml` or `co2.nc`.
- `n_months_total`: *int*. Total duration of simulation in months.
- `n_months_job`: *int*. Approximate duration of each job of the simulation in months.
E.g. if `n_months_total=12` and `n_months_job=6`, the experiment would be split up into 2 jobs each
of length 6 months.
- `n_nodes`: *int*. Number of nodes to run job on (*Slurm* info).
- `n_cores`: *int*. Number of cores for each node to run job on (*Slurm* info).
- `resolution`: *string*. Horizontal resolution of experiment (options are `T21`, `T42` or `T85`).
- `partition`: *string*. *Slurm* queue to submit job to.
- `overwrite_data`: *bool*. If this is `True` and data already exists in `$GFDL_DATA/{name}`,
then it will be overwritten. If it is `False` and the data exists, an error will occur.
- `compile`: *bool*. If `True`, it will recompile the codebase before running the experiment.
- `max_walltime`: *string*. Maximum time that job can run on *Slurm*. E.g. 1 hour would be '01:00:00'.
- `delete_restart_files`: *bool*. If `True`, only the restart file for the final month will be kept.
Otherwise, a restart file will be generated for every month.
diag_table_file: File path to the diagnostic table file for the experiment.
This specifies the outputs of the experiment.
month_start: Index of month at which this job starts the simulation (starting with 1).
month_duration: How many months to run simulation for in this job.
Source code in isca_tools/run/base.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
|