forked from bkravitz/feedback_suite
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
executable file
·94 lines (87 loc) · 4.05 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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
#! /usr/bin/env python
# Explicit feedback for climate modeling
# Copyright (C) 2020 Ben Kravitz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Main setup script
#
# Written by Ben Kravitz ([email protected] or [email protected])
# Last updated 11 July 2019
#
# This script provides the main information about the run. Note that everything
# here is specific to an individual run. Each run should have its own copy
# of the feedback suite.
#
# This script is written in native python format. Be careful with brackets [],
# white space, and making sure everything that needs to be a string is actually
# a string by putting it in quotes ''. All lines beginning with # are comments.
#
# Things you need to specify:
#
################## GLOBAL SETUP PARAMETERS ##################
#
# casepath = The path where this specific case is built and run.
#
# maindir = The path where the control suite sits.
#
# scratchdir = The script will need to extract and process some of the model
# output. This is the path where it will do that. The scratchdir
# will be removed after the script is done processing everything,
# so make sure this does not point to a directory that you care about.
#
# runname = The name of the case you're running.
#
# frequency = How often you want the controller to operate. This
# includes two pieces of information: a number and a letter.
# The letters can be d (days), w (weeks), m (months),
# or y (years). For example, if you want the controller to run
# every 23 days, you would put '23d' (the quotes are important
# because this is a string). You're probably going to mostly use
# '1m' or '1y'. There is currently no capability of having sub-daily
# frequency. If the frequency of the model output is not concordant
# with what you select here (e.g., you only output monthly, but you
# select frequency='2w'), you will get unpredictable behavior.
#
# maxrest = The number of times you want the controller to restart.
# For example, if you want a 50 year simulation, and if
# frequency='1y', then maxrest=49.
#
# pathtocontrol = The absolute path of the feedback algorithm.
#
################## VARIABLE-SPECIFIC SETUP PARAMETERS ##################
# These are lists that are specific to each variable.
#
# variables = The variables that the feedback algorithm needs. Note that
# for now, all variables must be 2-D fields (i.e., no vertical component).
#
# archivepaths = The paths where all of your archived output is stored, one
# for each variable. This is split apart in case you want to call for inputs
# from two different model components (e.g., atmosphere and ocean).
#
# varlocs = The locations of the variables to be extracted. Examples include
# 'cam.h0', 'cam.h2', or 'pop.h.nday1'.
runname='b.e21.BW.f09_g17.SSP245-TSMLT-GAUSS-DEFAULT.001'
casepath='/glade/work/geostrat/cases/'+runname
maindir=casepath+'/controller'
scratchdir='/glade/scratch/geostrat/'+runname+'/allthetemporarystuff/'
frequency='1y'
maxrest=1000
pathtocontrol=maindir+'/PIcontrol.py'
variables=['TREFHT']
archivepaths=len(variables)*['/glade/scratch/geostrat/archive/'+runname+'/atm/hist'] # do NOT include a '/' at the end of each path
varlocs=len(variables)*['cam.h0']
###########################
### CALLING MAIN SCRIPT ###
###########################
execfile(maindir+"/driver.py")