wrfrun 0.1.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wrfrun/__init__.py +3 -0
- wrfrun/core/__init__.py +5 -0
- wrfrun/core/base.py +680 -0
- wrfrun/core/config.py +717 -0
- wrfrun/core/error.py +80 -0
- wrfrun/core/replay.py +113 -0
- wrfrun/core/server.py +212 -0
- wrfrun/data.py +418 -0
- wrfrun/extension/__init__.py +1 -0
- wrfrun/extension/littler/__init__.py +1 -0
- wrfrun/extension/littler/utils.py +599 -0
- wrfrun/extension/utils.py +66 -0
- wrfrun/model/__init__.py +7 -0
- wrfrun/model/base.py +14 -0
- wrfrun/model/plot.py +54 -0
- wrfrun/model/utils.py +34 -0
- wrfrun/model/wrf/__init__.py +6 -0
- wrfrun/model/wrf/_metgrid.py +71 -0
- wrfrun/model/wrf/_ndown.py +39 -0
- wrfrun/model/wrf/core.py +805 -0
- wrfrun/model/wrf/exec_wrap.py +101 -0
- wrfrun/model/wrf/geodata.py +301 -0
- wrfrun/model/wrf/namelist.py +377 -0
- wrfrun/model/wrf/scheme.py +311 -0
- wrfrun/model/wrf/vtable.py +65 -0
- wrfrun/pbs.py +86 -0
- wrfrun/plot/__init__.py +1 -0
- wrfrun/plot/wps.py +188 -0
- wrfrun/res/__init__.py +22 -0
- wrfrun/res/config.toml.template +136 -0
- wrfrun/res/extension/plotgrids.ncl +216 -0
- wrfrun/res/job_scheduler/pbs.template +6 -0
- wrfrun/res/job_scheduler/slurm.template +6 -0
- wrfrun/res/namelist/namelist.input.da_wrfvar.template +261 -0
- wrfrun/res/namelist/namelist.input.dfi.template +260 -0
- wrfrun/res/namelist/namelist.input.real.template +256 -0
- wrfrun/res/namelist/namelist.input.wrf.template +256 -0
- wrfrun/res/namelist/namelist.wps.template +44 -0
- wrfrun/res/namelist/parame.in.template +11 -0
- wrfrun/res/run.sh.template +16 -0
- wrfrun/run.py +264 -0
- wrfrun/utils.py +257 -0
- wrfrun/workspace.py +88 -0
- wrfrun-0.1.7.dist-info/METADATA +67 -0
- wrfrun-0.1.7.dist-info/RECORD +46 -0
- wrfrun-0.1.7.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from wrfrun.core import WRFRUNConfig
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
VTABLE_URI = ":WRFRUN_VTABLE:"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class VtableFiles:
|
|
11
|
+
"""
|
|
12
|
+
Represent WPS Vtable files (v4.5).
|
|
13
|
+
With the ":/" we can tell from user custom Vtable files.
|
|
14
|
+
"""
|
|
15
|
+
AFWAICE = f"{VTABLE_URI}/Vtable.AFWAICE"
|
|
16
|
+
AGRMETSNOW = f"{VTABLE_URI}/Vtable.AGRMETSNOW"
|
|
17
|
+
AGRMETSOIL = f"{VTABLE_URI}/Vtable.AGRMETSOIL"
|
|
18
|
+
AGRMETSOIL2 = f"{VTABLE_URI}/Vtable.AGRMETSOIL2"
|
|
19
|
+
AGRWRF = f"{VTABLE_URI}/Vtable.AGRWRF"
|
|
20
|
+
ARW = f"{VTABLE_URI}/Vtable.ARW.UPP"
|
|
21
|
+
ARWP = f"{VTABLE_URI}/Vtable.ARWp.UPP"
|
|
22
|
+
AVN0P5WRF = f"{VTABLE_URI}/Vtable.AVN0P5WRF"
|
|
23
|
+
AWIP = f"{VTABLE_URI}/Vtable.AWIP"
|
|
24
|
+
CFSR = f"{VTABLE_URI}/Vtable.CFSR"
|
|
25
|
+
CFSR_MEAN = f"{VTABLE_URI}/Vtable.CFSR_mean"
|
|
26
|
+
ECMWF = f"{VTABLE_URI}/Vtable.ECMWF"
|
|
27
|
+
ECMWF_SIGMA = f"{VTABLE_URI}/Vtable.ECMWF_sigma"
|
|
28
|
+
ERA_ML = f"{VTABLE_URI}/Vtable.ERA-interim.ml"
|
|
29
|
+
ERA_PL = f"{VTABLE_URI}/Vtable.ERA-interim.pl"
|
|
30
|
+
GFDL = f"{VTABLE_URI}/Vtable.GFDL"
|
|
31
|
+
GFS = f"{VTABLE_URI}/Vtable.GFS"
|
|
32
|
+
GFS_OZONE = f"{VTABLE_URI}/Vtable.GFS_OZONE"
|
|
33
|
+
GFSENS = f"{VTABLE_URI}/Vtable.GFSENS"
|
|
34
|
+
GODAS = f"{VTABLE_URI}/Vtable.GODAS"
|
|
35
|
+
GSM = f"{VTABLE_URI}/Vtable.GSM"
|
|
36
|
+
ICONM = f"{VTABLE_URI}/Vtable.ICONm"
|
|
37
|
+
ICONP = f"{VTABLE_URI}/Vtable.ICONp"
|
|
38
|
+
JMAGSM = f"{VTABLE_URI}/Vtable.JMAGSM"
|
|
39
|
+
NAM = f"{VTABLE_URI}/Vtable.NAM"
|
|
40
|
+
NARR = f"{VTABLE_URI}/Vtable.NARR"
|
|
41
|
+
NAVY_SST = f"{VTABLE_URI}/Vtable.NavySST"
|
|
42
|
+
NCEP2 = f"{VTABLE_URI}/Vtable.NCEP2"
|
|
43
|
+
NNRP = f"{VTABLE_URI}/Vtable.NNRP"
|
|
44
|
+
NOGAPS = f"{VTABLE_URI}/Vtable.NOGAPS"
|
|
45
|
+
NOGAPS_GFS_SOIL = f"{VTABLE_URI}/Vtable.NOGAPS_needs_GFS_soil"
|
|
46
|
+
RAP_HYBRID_NCEP = f"{VTABLE_URI}/Vtable.RAP.hybrid.ncep"
|
|
47
|
+
RAP_PRESSURE_NCEP = f"{VTABLE_URI}/Vtable.RAP.pressure.ncep"
|
|
48
|
+
RAP_SIGMA_GSD = f"{VTABLE_URI}/Vtable.RAP.sigma.gsd"
|
|
49
|
+
RAPHRRR = f"{VTABLE_URI}/Vtable.raphrrr"
|
|
50
|
+
RUCB = f"{VTABLE_URI}/Vtable.RUCb"
|
|
51
|
+
RUCP = f"{VTABLE_URI}/Vtable.RUCp"
|
|
52
|
+
SREF = f"{VTABLE_URI}/Vtable.SREF"
|
|
53
|
+
SST = f"{VTABLE_URI}/Vtable.SST"
|
|
54
|
+
TCRP = f"{VTABLE_URI}/Vtable.TCRP"
|
|
55
|
+
UKMO_END_GAME = f"{VTABLE_URI}/Vtable.UKMO_ENDGame"
|
|
56
|
+
UKMO_LANDSEA = f"{VTABLE_URI}/Vtable.UKMO_LANDSEA"
|
|
57
|
+
UKMO_NO_HEIGHTS = f"{VTABLE_URI}/Vtable.UKMO_no_heights"
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# register uri
|
|
61
|
+
if not WRFRUNConfig.check_resource_uri(VTABLE_URI):
|
|
62
|
+
WRFRUNConfig.register_resource_uri(VTABLE_URI, f"{WRFRUNConfig.WPS_WORK_PATH}/ungrib/Variable_Tables")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
__all__ = ["VtableFiles"]
|
wrfrun/pbs.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
from os import environ
|
|
2
|
+
from os.path import exists, dirname, abspath
|
|
3
|
+
|
|
4
|
+
from .core import WRFRUNConfig
|
|
5
|
+
from .res import TASKSYS_PBS_TEMPLATE
|
|
6
|
+
from .utils import logger
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def prepare_pbs_script(main_file_path: str):
|
|
10
|
+
"""Prepare the bash script to be submitted to PBS work system.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
main_file_path (str): The path of main Python file.
|
|
14
|
+
"""
|
|
15
|
+
# check main file
|
|
16
|
+
if not exists(main_file_path):
|
|
17
|
+
logger.error(f"Wrong path of main Python file: {main_file_path}")
|
|
18
|
+
raise FileNotFoundError
|
|
19
|
+
|
|
20
|
+
# get absolute path of parent directory
|
|
21
|
+
dir_path = abspath(dirname(main_file_path))
|
|
22
|
+
|
|
23
|
+
# read log path and PBS setting from config
|
|
24
|
+
log_path = WRFRUNConfig.get_log_path()
|
|
25
|
+
PBS_setting = WRFRUNConfig.get_job_scheduler_config()
|
|
26
|
+
|
|
27
|
+
# set PBS log path
|
|
28
|
+
stdout_log_path = f"{log_path}/PBS.log"
|
|
29
|
+
stderr_log_path = f"{log_path}/PBS.log"
|
|
30
|
+
|
|
31
|
+
# set environment parameter
|
|
32
|
+
env_settings = ''
|
|
33
|
+
if len(PBS_setting["env_settings"]) != 0:
|
|
34
|
+
for key in PBS_setting["env_settings"]:
|
|
35
|
+
env_settings += f"{key}={PBS_setting['env_settings'][key]}\n"
|
|
36
|
+
|
|
37
|
+
# set command
|
|
38
|
+
exec_cmd = f"{PBS_setting['python_interpreter']} {main_file_path}"
|
|
39
|
+
|
|
40
|
+
# read template and write to file
|
|
41
|
+
pbs_template_path = WRFRUNConfig.parse_resource_uri(TASKSYS_PBS_TEMPLATE)
|
|
42
|
+
with open(f"{dir_path}/run.sh", "w") as f:
|
|
43
|
+
|
|
44
|
+
with open(pbs_template_path, "r") as f_template:
|
|
45
|
+
template = f_template.read()
|
|
46
|
+
|
|
47
|
+
template = template.format(
|
|
48
|
+
STDOUT_LOG_PATH=stdout_log_path,
|
|
49
|
+
STDERR_LOG_PATH=stderr_log_path,
|
|
50
|
+
NODE_NUM=PBS_setting["node_num"],
|
|
51
|
+
CORE_NUM=PBS_setting["core_num"],
|
|
52
|
+
ENV_SETTINGS=env_settings,
|
|
53
|
+
WORK_PATH=dir_path,
|
|
54
|
+
WORK_COMMAND=exec_cmd
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
f.write(template)
|
|
58
|
+
|
|
59
|
+
logger.info(
|
|
60
|
+
f"PBS script has been generated and write to file {dir_path}/run.sh. Check it and submit it to PBS system to run wrfrun.")
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def get_core_num() -> int:
|
|
64
|
+
"""Read core num from config.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
int: Core number.
|
|
68
|
+
"""
|
|
69
|
+
return WRFRUNConfig["core_num"]
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def in_pbs() -> bool:
|
|
73
|
+
"""Check if we're in a PBS work.
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
bool: True if we're in, False is we aren't.
|
|
77
|
+
"""
|
|
78
|
+
# check if we're a PBS task
|
|
79
|
+
if "PBS_ENVIRONMENT" in environ:
|
|
80
|
+
# we're in a PBS task
|
|
81
|
+
return True
|
|
82
|
+
else:
|
|
83
|
+
return False
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
__all__ = ["prepare_pbs_script", "get_core_num", "in_pbs"]
|
wrfrun/plot/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .wps import *
|
wrfrun/plot/wps.py
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
from typing import Tuple
|
|
2
|
+
|
|
3
|
+
from cartopy import crs
|
|
4
|
+
from cartopy.mpl.geoaxes import GeoAxes
|
|
5
|
+
from matplotlib.collections import QuadMesh
|
|
6
|
+
from matplotlib.colors import ListedColormap
|
|
7
|
+
from matplotlib.figure import Figure
|
|
8
|
+
from netCDF4 import Dataset # type: ignore
|
|
9
|
+
from wrf import getvar, latlon_coords, get_cartopy, to_np
|
|
10
|
+
from xarray import DataArray
|
|
11
|
+
|
|
12
|
+
from wrfrun.utils import logger
|
|
13
|
+
|
|
14
|
+
# Here defines the colormap for landuse and soiltype
|
|
15
|
+
LANDUSE_CMAP = ListedColormap([
|
|
16
|
+
[0, .4, 0], # 1 Evergreen Needleleaf Forest
|
|
17
|
+
[0, .4, .2], # 2 Evergreen Broadleaf Forest
|
|
18
|
+
[.2, .8, .2], # 3 Deciduous Needleleaf Forest
|
|
19
|
+
[.2, .8, .4], # 4 Deciduous Broadleaf Forest
|
|
20
|
+
[.2, .6, .2], # 5 Mixed Forests
|
|
21
|
+
[.3, .7, 0], # 6 Closed Shrublands
|
|
22
|
+
[.82, .41, .12], # 7 Open Shurblands
|
|
23
|
+
[.74, .71, .41], # 8 Woody Savannas
|
|
24
|
+
[1, .84, .0], # 9 Savannas
|
|
25
|
+
[0, 1, 0], # 10 Grasslands
|
|
26
|
+
[0, 1, 1], # 11 Permanant Wetlands
|
|
27
|
+
[1, 1, 0], # 12 Croplands
|
|
28
|
+
[1, 0, 0], # 13 Urban and Built-up
|
|
29
|
+
[.7, .9, .3], # 14 Cropland/Natual Vegation Mosaic
|
|
30
|
+
[1, 1, 1], # 15 Snow and Ice
|
|
31
|
+
[.914, .914, .7], # 16 Barren or Sparsely Vegetated
|
|
32
|
+
[.5, .7, 1], # 17 Water (like oceans)
|
|
33
|
+
[.86, .08, .23], # 18 Wooded Tundra
|
|
34
|
+
[.97, .5, .31], # 19 Mixed Tundra
|
|
35
|
+
[.91, .59, .48], # 20 Barren Tundra
|
|
36
|
+
[0, 0, .88], # 21 Lake
|
|
37
|
+
])
|
|
38
|
+
|
|
39
|
+
LANDUSE_LABELS = [
|
|
40
|
+
'Evergreen Needleleaf Forest',
|
|
41
|
+
'Evergreen Broadleaf Forest',
|
|
42
|
+
'Deciduous Needleleaf Forest',
|
|
43
|
+
'Deciduous Broadleaf Forest',
|
|
44
|
+
'Mixed Forests',
|
|
45
|
+
'Closed Shrublands',
|
|
46
|
+
'Open Shrublands',
|
|
47
|
+
'Woody Savannas',
|
|
48
|
+
'Savannas',
|
|
49
|
+
'Grasslands',
|
|
50
|
+
'Permanent Wetlands',
|
|
51
|
+
'Croplands',
|
|
52
|
+
'Urban and Built-Up',
|
|
53
|
+
'Cropland/Natural Vegetation Mosaic',
|
|
54
|
+
'Snow and Ice',
|
|
55
|
+
'Barren or Sparsely Vegetated',
|
|
56
|
+
'Water',
|
|
57
|
+
'Wooded Tundra',
|
|
58
|
+
'Mixed Tundra',
|
|
59
|
+
'Barren Tundra',
|
|
60
|
+
'Lake',
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# Here defines the colormap and labels for soil type
|
|
65
|
+
SOILTYPE_CMAP = ListedColormap([
|
|
66
|
+
[0, .4, 0], # 1 Sand
|
|
67
|
+
[0, .4, .2], # 2 Loamy Sand
|
|
68
|
+
[.2, .8, .2], # 3 Sandy Loam
|
|
69
|
+
[.2, .8, .4], # 4 Silt Loam
|
|
70
|
+
[.2, .6, .2], # 5 Silt
|
|
71
|
+
[.3, .7, 0], # 6 Loam
|
|
72
|
+
[.82, .41, .12], # 7 Sandy Clay Loam
|
|
73
|
+
[.74, .71, .41], # 8 Silty Clay Loam
|
|
74
|
+
[1, .84, .0], # 9 Clay Loam
|
|
75
|
+
[0, 1, 0], # 10 Sandy Clay
|
|
76
|
+
[0, 1, 1], # 11 Silty Clay
|
|
77
|
+
[1, 1, 0], # 12 Clay
|
|
78
|
+
[1, 0, 0], # 13 Organic Material
|
|
79
|
+
[.7, .9, .3], # 14 Water
|
|
80
|
+
[1, 1, 1], # 15 Bedrock
|
|
81
|
+
[.914, .914, .7] # 16 Other
|
|
82
|
+
])
|
|
83
|
+
|
|
84
|
+
SOILTYPE_LABELS = [
|
|
85
|
+
"Sand",
|
|
86
|
+
"Loamy Sand",
|
|
87
|
+
"Sandy Loam",
|
|
88
|
+
"Silt Loam",
|
|
89
|
+
"Silt",
|
|
90
|
+
"Loam",
|
|
91
|
+
"Sandy Clay Loam",
|
|
92
|
+
"Silty Clay Loam",
|
|
93
|
+
"Clay Loam",
|
|
94
|
+
"Sandy Clay",
|
|
95
|
+
"Silty Clay",
|
|
96
|
+
"Clay",
|
|
97
|
+
"Organic Material",
|
|
98
|
+
"Water",
|
|
99
|
+
"Bedrock",
|
|
100
|
+
"Other"
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def get_cmap_ticks(name: str) -> tuple:
|
|
105
|
+
"""Get corresponding colormap, labels and ticks.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
name (str): Field name.
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
tuple: (colormap, labels, ticks)
|
|
112
|
+
"""
|
|
113
|
+
# name map
|
|
114
|
+
cmap_ticks_map = {
|
|
115
|
+
"LU_INDEX": {
|
|
116
|
+
"cmap": LANDUSE_CMAP,
|
|
117
|
+
"labels": LANDUSE_LABELS,
|
|
118
|
+
},
|
|
119
|
+
"SOILCTOP": {
|
|
120
|
+
"cmap": SOILTYPE_CMAP,
|
|
121
|
+
"labels": SOILTYPE_LABELS,
|
|
122
|
+
},
|
|
123
|
+
"SOILCBOT": {
|
|
124
|
+
"cmap": SOILTYPE_CMAP,
|
|
125
|
+
"labels": SOILTYPE_LABELS,
|
|
126
|
+
},
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
# take out colormap and labels
|
|
130
|
+
if name not in cmap_ticks_map:
|
|
131
|
+
logger.error(f"Can't found colormap and labels for {name}")
|
|
132
|
+
raise ValueError
|
|
133
|
+
|
|
134
|
+
cmap = cmap_ticks_map[name]["cmap"]
|
|
135
|
+
labels = cmap_ticks_map[name]["labels"]
|
|
136
|
+
|
|
137
|
+
# generate ticks
|
|
138
|
+
ticks = [x + 1.5 for x in range(len(labels))]
|
|
139
|
+
|
|
140
|
+
return cmap, labels, ticks
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def draw_geogrid(data_path: str, field: str, fig: Figure, nrow: int, ncol: int, index: int) -> Tuple[GeoAxes, QuadMesh]:
|
|
144
|
+
"""Draw specific data in geo_em*
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
data_path (str): data path.
|
|
148
|
+
field (str): Which field you want to draw.
|
|
149
|
+
fig (Figure): Matplotlib figure object.
|
|
150
|
+
nrow (int): Row number of axes.
|
|
151
|
+
ncol (int): Column number of axes.
|
|
152
|
+
index (int): Index of axes.
|
|
153
|
+
"""
|
|
154
|
+
# take out data
|
|
155
|
+
data: DataArray = getvar(Dataset(data_path), field) # type: ignore
|
|
156
|
+
|
|
157
|
+
# soiltype data is different from landuse data
|
|
158
|
+
if field in ["SOILCTOP", "SOILCBOT"]:
|
|
159
|
+
data = data.argmax(dim="soil_cat", keep_attrs=True) # type: ignore
|
|
160
|
+
# get data attrs
|
|
161
|
+
data_attrs = data.attrs
|
|
162
|
+
data = data + 1
|
|
163
|
+
data.attrs = data_attrs
|
|
164
|
+
|
|
165
|
+
# get latitude and longitude
|
|
166
|
+
lats, lons = latlon_coords(data)
|
|
167
|
+
|
|
168
|
+
# get projection
|
|
169
|
+
proj = get_cartopy(data)
|
|
170
|
+
|
|
171
|
+
# add axes
|
|
172
|
+
ax = fig.add_subplot(nrow, ncol, index, projection=proj)
|
|
173
|
+
|
|
174
|
+
# get colormap, labels and ticks
|
|
175
|
+
cmap, labels, ticks = get_cmap_ticks(field)
|
|
176
|
+
|
|
177
|
+
# convert data to numpy
|
|
178
|
+
data, lats, lons = to_np(data), to_np(lats), to_np(lons) # type: ignore
|
|
179
|
+
|
|
180
|
+
# plot
|
|
181
|
+
im = ax.pcolormesh(
|
|
182
|
+
lons, lats, data, vmin=1, vmax=len(labels) + 1, cmap=cmap, transform=crs.PlateCarree()
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
return ax, im # type: ignore
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
__all__ = ["draw_geogrid", "get_cmap_ticks"]
|
wrfrun/res/__init__.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from os.path import abspath, dirname
|
|
2
|
+
|
|
3
|
+
from wrfrun.core import WRFRUNConfig
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
RES_PATH = abspath(dirname(__file__))
|
|
7
|
+
WRFRUNConfig.register_resource_uri(WRFRUNConfig.WRFRUN_RESOURCE_PATH, RES_PATH)
|
|
8
|
+
|
|
9
|
+
CONFIG_TOML_TEMPLATE = ":WRFRUN_RESOURCE_PATH:/config.toml.template"
|
|
10
|
+
EXT_NCL_PLOT_SCRIPT = ":WRFRUN_RESOURCE_PATH:/extension/plotgrids.ncl"
|
|
11
|
+
TASKSYS_PBS_TEMPLATE = ":WRFRUN_RESOURCE_PATH:/job_scheduler/pbs.template"
|
|
12
|
+
TASKSYS_SLURM_TEMPLATE = ":WRFRUN_RESOURCE_PATH:/job_scheduler/slurm.template"
|
|
13
|
+
NAMELIST_WRFDA = ":WRFRUN_RESOURCE_PATH:/namelist/namelist.input.da_wrfvar.template"
|
|
14
|
+
NAMELIST_DFI = ":WRFRUN_RESOURCE_PATH:/namelist/namelist.input.dfi.template"
|
|
15
|
+
NAMELIST_REAL = ":WRFRUN_RESOURCE_PATH:/namelist/namelist.input.real.template"
|
|
16
|
+
NAMELIST_WRF = ":WRFRUN_RESOURCE_PATH:/namelist/namelist.input.wrf.template"
|
|
17
|
+
NAMELIST_WPS = ":WRFRUN_RESOURCE_PATH:/namelist/namelist.wps.template"
|
|
18
|
+
|
|
19
|
+
WRFRUNConfig.set_config_template_path(CONFIG_TOML_TEMPLATE)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
__all__ = ["CONFIG_TOML_TEMPLATE", "EXT_NCL_PLOT_SCRIPT", "TASKSYS_PBS_TEMPLATE", "TASKSYS_SLURM_TEMPLATE", "NAMELIST_WRFDA", "NAMELIST_DFI", "NAMELIST_REAL", "NAMELIST_WRF", "NAMELIST_WPS"]
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Config template of wrfrun.
|
|
2
|
+
# Path of the directory which contains input data.
|
|
3
|
+
input_data_path = ""
|
|
4
|
+
|
|
5
|
+
# Path of the directory to store all outputs.
|
|
6
|
+
output_path = "./outputs"
|
|
7
|
+
log_path = "./logs"
|
|
8
|
+
|
|
9
|
+
# wrfrun can launch a socket server during NWP execution to report simulation progress.
|
|
10
|
+
# To enable the server, you need to configure the IP address and port on which it will listen to.
|
|
11
|
+
server_host = "localhost"
|
|
12
|
+
server_port = 54321
|
|
13
|
+
|
|
14
|
+
# How many cores you will use.
|
|
15
|
+
# Note that if you use a job scheduler (like PBS), this value means the number of cores each node you use.
|
|
16
|
+
core_num = 36
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
[job_scheduler]
|
|
20
|
+
# Job scheduler settings.
|
|
21
|
+
# How many nodes you will use.
|
|
22
|
+
node_num = 1
|
|
23
|
+
|
|
24
|
+
# Custom environment settings
|
|
25
|
+
env_settings = {}
|
|
26
|
+
|
|
27
|
+
# Path of the python interpreter that will be used to run wrfrun.
|
|
28
|
+
# You can also give its name only.
|
|
29
|
+
python_interpreter = "/usr/bin/python3" # or just "python3"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
[model]
|
|
33
|
+
# Model debug level
|
|
34
|
+
debug_level = 100
|
|
35
|
+
|
|
36
|
+
# ################################################### Only settings above is necessary ###########################################
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# ####################################### You can give more settings about the NWP you will use ##################################
|
|
40
|
+
|
|
41
|
+
[model.wrf]
|
|
42
|
+
# Config for WRF
|
|
43
|
+
# WRF model path
|
|
44
|
+
wps_path = '/path/to/your/WPS/folder'
|
|
45
|
+
wrf_path = '/path/to/your/WRF/folder'
|
|
46
|
+
# WRFDA is optional.
|
|
47
|
+
wrfda_path = ''
|
|
48
|
+
|
|
49
|
+
# static geographic data path
|
|
50
|
+
geog_data_path = '/path/to/your/geog/data'
|
|
51
|
+
|
|
52
|
+
# Your can give your custom namelist files here.
|
|
53
|
+
# The value in it will overwrite the default value in the namelist template file.
|
|
54
|
+
user_wps_namelist = ''
|
|
55
|
+
user_real_namelist = ''
|
|
56
|
+
user_wrf_namelist = ''
|
|
57
|
+
user_wrfda_namelist = ''
|
|
58
|
+
|
|
59
|
+
# If you make a restart run?
|
|
60
|
+
restart_mode = false
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
[model.wrf.time]
|
|
64
|
+
# Advance time config for WRF
|
|
65
|
+
# Set the start and end date. It will be used for all domains.
|
|
66
|
+
# You can also provide all the dates as a list, with each date for the corresponding domain.
|
|
67
|
+
start_date = 2021-03-24T12:00:00Z # or [2021-03-24T12:00:00Z, 2021-03-24T12:00:00Z]
|
|
68
|
+
end_date = 2021-03-26T00:00:00Z # or [2021-03-26T00:00:00Z, 2021-03-24T12:00:00Z]
|
|
69
|
+
|
|
70
|
+
# Set input data time interval. Unit: seconds
|
|
71
|
+
input_data_interval = 10800
|
|
72
|
+
|
|
73
|
+
# Set output data time interval. Unit: minutes
|
|
74
|
+
output_data_interval = 180
|
|
75
|
+
|
|
76
|
+
# Note that there are various reasons which could crash wrf,
|
|
77
|
+
# and in most cases you can deal with them by decrease time step.
|
|
78
|
+
# Unit: seconds
|
|
79
|
+
time_step = 120
|
|
80
|
+
|
|
81
|
+
# Time ratio to the first domain for each domain
|
|
82
|
+
parent_time_step_ratio = [1, 3, 4]
|
|
83
|
+
|
|
84
|
+
# Time interval to write restart files.
|
|
85
|
+
# This help you can restart WRF after it stops.
|
|
86
|
+
# By default, it equals to output_data_interval. Unit: minutes.
|
|
87
|
+
restart_interval = -1
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
[model.wrf.domain]
|
|
91
|
+
# Advance domain config for WRF.
|
|
92
|
+
# Set domain number.
|
|
93
|
+
domain_num = 3
|
|
94
|
+
|
|
95
|
+
# It's very hard to process wrf domain settings because it's related to various settings, so I keep it.
|
|
96
|
+
# The resolution ratio to the first domain.
|
|
97
|
+
parent_grid_ratio = [1, 3, 9]
|
|
98
|
+
|
|
99
|
+
# Index of the start point.
|
|
100
|
+
i_parent_start = [1, 17, 72]
|
|
101
|
+
j_parent_start = [1, 17, 36]
|
|
102
|
+
|
|
103
|
+
# Number of points.
|
|
104
|
+
e_we = [120, 250, 1198]
|
|
105
|
+
e_sn = [120, 220, 1297]
|
|
106
|
+
|
|
107
|
+
# Resolution of the first domain.
|
|
108
|
+
dx = 9000
|
|
109
|
+
dy = 9000
|
|
110
|
+
|
|
111
|
+
# Projection.
|
|
112
|
+
map_proj = { name = 'lambert', truelat1 = 34.0, truelat2 = 40.0}
|
|
113
|
+
|
|
114
|
+
# Central point of the first area.
|
|
115
|
+
ref_lat = 37.0
|
|
116
|
+
ref_lon = 120.5
|
|
117
|
+
stand_lon = 120.5
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
[model.wrf.scheme]
|
|
121
|
+
# Advance physics scheme config for WRF.
|
|
122
|
+
# To loop up the nickname for all physics schemes, please see: https://wrfrun.syize.cn.
|
|
123
|
+
# Option contains many other settings related to the scheme.
|
|
124
|
+
# Sometimes some option can only be used for a specific scheme.
|
|
125
|
+
# You can check it in online namelist variables: https://www2.mmm.ucar.edu/wrf/users/wrf_users_guide/build/html/namelist_variables.html
|
|
126
|
+
# You can set option with its `wrf name` and its `wrf value`.
|
|
127
|
+
# For example, `ghg_input=1` works with rrtm scheme. If you want to set `ghg_input=1` when using rrtm, set option: {"ghg_input": 1}
|
|
128
|
+
# However, sometimes some options work with various schemes, and some options themselves are schem.
|
|
129
|
+
# Use this carefully.
|
|
130
|
+
# You can set multiple keys in option.
|
|
131
|
+
long_wave_scheme = { name = "rrtm", option = {} }
|
|
132
|
+
short_wave_scheme = { name = "rrtmg", option = {} }
|
|
133
|
+
cumulus_scheme = { name = "kf", option = {} }
|
|
134
|
+
pbl_scheme = { name = "ysu", option = { ysu_topdown_pblmix = 1} }
|
|
135
|
+
land_surface_scheme = { name = "noah", option = {} }
|
|
136
|
+
surface_layer_scheme = { name = "mm5", option = {} }
|