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.
Files changed (46) hide show
  1. wrfrun/__init__.py +3 -0
  2. wrfrun/core/__init__.py +5 -0
  3. wrfrun/core/base.py +680 -0
  4. wrfrun/core/config.py +717 -0
  5. wrfrun/core/error.py +80 -0
  6. wrfrun/core/replay.py +113 -0
  7. wrfrun/core/server.py +212 -0
  8. wrfrun/data.py +418 -0
  9. wrfrun/extension/__init__.py +1 -0
  10. wrfrun/extension/littler/__init__.py +1 -0
  11. wrfrun/extension/littler/utils.py +599 -0
  12. wrfrun/extension/utils.py +66 -0
  13. wrfrun/model/__init__.py +7 -0
  14. wrfrun/model/base.py +14 -0
  15. wrfrun/model/plot.py +54 -0
  16. wrfrun/model/utils.py +34 -0
  17. wrfrun/model/wrf/__init__.py +6 -0
  18. wrfrun/model/wrf/_metgrid.py +71 -0
  19. wrfrun/model/wrf/_ndown.py +39 -0
  20. wrfrun/model/wrf/core.py +805 -0
  21. wrfrun/model/wrf/exec_wrap.py +101 -0
  22. wrfrun/model/wrf/geodata.py +301 -0
  23. wrfrun/model/wrf/namelist.py +377 -0
  24. wrfrun/model/wrf/scheme.py +311 -0
  25. wrfrun/model/wrf/vtable.py +65 -0
  26. wrfrun/pbs.py +86 -0
  27. wrfrun/plot/__init__.py +1 -0
  28. wrfrun/plot/wps.py +188 -0
  29. wrfrun/res/__init__.py +22 -0
  30. wrfrun/res/config.toml.template +136 -0
  31. wrfrun/res/extension/plotgrids.ncl +216 -0
  32. wrfrun/res/job_scheduler/pbs.template +6 -0
  33. wrfrun/res/job_scheduler/slurm.template +6 -0
  34. wrfrun/res/namelist/namelist.input.da_wrfvar.template +261 -0
  35. wrfrun/res/namelist/namelist.input.dfi.template +260 -0
  36. wrfrun/res/namelist/namelist.input.real.template +256 -0
  37. wrfrun/res/namelist/namelist.input.wrf.template +256 -0
  38. wrfrun/res/namelist/namelist.wps.template +44 -0
  39. wrfrun/res/namelist/parame.in.template +11 -0
  40. wrfrun/res/run.sh.template +16 -0
  41. wrfrun/run.py +264 -0
  42. wrfrun/utils.py +257 -0
  43. wrfrun/workspace.py +88 -0
  44. wrfrun-0.1.7.dist-info/METADATA +67 -0
  45. wrfrun-0.1.7.dist-info/RECORD +46 -0
  46. wrfrun-0.1.7.dist-info/WHEEL +4 -0
@@ -0,0 +1,216 @@
1
+
2
+ ; Script display location of model domains
3
+ ; Only works for ARW domains
4
+ ; Only works for NCL versions 6.2 or later
5
+ ; Reads namelist file directly
6
+
7
+ load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
8
+ load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
9
+
10
+ begin
11
+ ;
12
+
13
+ ; Check the version of NCL
14
+ version = systemfunc("ncl -V")
15
+ if(version.lt.6.2) then
16
+ print("You need NCL V6.2 or later to run this script. Try running plotgrids.ncl. Stopping now...")
17
+ return
18
+ end if
19
+
20
+ ; We generate plots, but what kind do we prefer?
21
+ ; type = "x11"
22
+ ; type = "pdf"
23
+ ; type = "ps"
24
+ ; type = "ncgm"
25
+ type = "png"
26
+ wks = gsn_open_wks(type,"wps_show_dom")
27
+
28
+ ; read the following namelist file
29
+ filename = "namelist.wps"
30
+
31
+ ; Set the colors to be used
32
+ colors = (/"white","black","White","ForestGreen","DeepSkyBlue","Red","Blue"/)
33
+ gsn_define_colormap(wks, colors)
34
+
35
+
36
+ ; Set some map information ; line and text information
37
+ mpres = True
38
+ mpres@mpFillOn = True
39
+ mpres@mpFillColors = (/"background","DeepSkyBlue","ForestGreen","DeepSkyBlue", "transparent"/)
40
+ mpres@mpDataBaseVersion = "Ncarg4_1"
41
+ mpres@mpGeophysicalLineColor = "Black"
42
+ mpres@mpGridLineColor = "Black"
43
+ mpres@mpLimbLineColor = "Black"
44
+ mpres@mpNationalLineColor = "Black"
45
+ mpres@mpPerimLineColor = "Black"
46
+ mpres@mpUSStateLineColor = "Black"
47
+ ; mpres@mpOutlineBoundarySets = "AllBoundaries"
48
+ ;mpres@mpGridSpacingF = 45
49
+ mpres@tiMainString = " WPS Domain Configuration "
50
+
51
+ lnres = True
52
+ lnres@gsLineThicknessF = 2.5
53
+ lnres@domLineColors = (/ "white", "Red" , "Red" , "Blue" /)
54
+
55
+ txres = True
56
+ txres@txFont = "helvetica-bold"
57
+ ;txres@txJust = "BottomLeft"
58
+ txres@txJust = "TopLeft"
59
+ txres@txPerimOn = False
60
+ txres@txFontHeightF = 0.015
61
+
62
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
63
+ ; Do not change anything between the ";;;;;" lines
64
+
65
+ maxdom = 21
66
+ nvar = 19
67
+ parent_idn = new (maxdom,integer)
68
+ parent_grid_ration = new (maxdom,integer)
69
+ i_parent_startn = new (maxdom,integer)
70
+ j_parent_startn = new (maxdom,integer)
71
+ e_wen = new (maxdom,integer)
72
+ e_snn = new (maxdom,integer)
73
+ plotvar = new((/maxdom,nvar/),float)
74
+ plotvar@_FillValue = -999.0
75
+
76
+ plotvar = wrf_wps_read_nml(filename)
77
+
78
+ mpres@max_dom = floattointeger(plotvar(0,0))
79
+ mpres@dx = plotvar(0,1)
80
+ mpres@dy = plotvar(0,2)
81
+ if (.not.ismissing(plotvar(0,3))) then
82
+ mpres@ref_lat = plotvar(0,3)
83
+ else
84
+ mpres@ref_lat = 0.0
85
+ end if
86
+ if (.not.ismissing(plotvar(0,4))) then
87
+ mpres@ref_lon = plotvar(0,4)
88
+ else
89
+ mpres@ref_lon = 0.0
90
+ end if
91
+ if (.not.ismissing(plotvar(0,5))) then
92
+ mpres@ref_x = plotvar(0,5)
93
+ end if
94
+ if (.not.ismissing(plotvar(0,6))) then
95
+ mpres@ref_y = plotvar(0,6)
96
+ end if
97
+ mpres@truelat1 = plotvar(0,7)
98
+ mpres@truelat2 = plotvar(0,8)
99
+ mpres@stand_lon = plotvar(0,9)
100
+ mproj_int = plotvar(0,10)
101
+ mpres@pole_lat = plotvar(0,11)
102
+ mpres@pole_lon = plotvar(0,12)
103
+
104
+ do i = 0,maxdom-1
105
+ parent_idn(i) = floattointeger(plotvar(i,13))
106
+ parent_grid_ration(i) = floattointeger(plotvar(i,14))
107
+ i_parent_startn(i) = floattointeger(plotvar(i,15))
108
+ j_parent_startn(i) = floattointeger(plotvar(i,16))
109
+ e_wen(i) = floattointeger(plotvar(i,17))
110
+ e_snn(i) = floattointeger(plotvar(i,18))
111
+ end do
112
+
113
+
114
+ if(mpres@max_dom .gt. 1) then
115
+ do i = 1,mpres@max_dom-1
116
+
117
+ ;Making sure edge is nested grid is at least 5 grid points from mother domain.
118
+ if(i_parent_startn(i) .lt. 5) then
119
+ print("Warning: Western edge of grid must be at least 5 grid points from mother domain!")
120
+ end if
121
+ if(j_parent_startn(i) .lt. 5) then
122
+ print("Warning: Southern edge of grid must be at least 5 grid points from mother domain!")
123
+ end if
124
+ pointwe = (e_wen(i)-1.)/parent_grid_ration(i)
125
+ pointsn = (e_snn(i)-1.)/parent_grid_ration(i)
126
+ gridwe = e_wen(parent_idn(i)-1)-(pointwe+i_parent_startn(i))
127
+ gridsn = e_snn(parent_idn(i)-1)-(pointsn+j_parent_startn(i))
128
+ if(gridwe .lt. 5) then
129
+ print("Warning: Eastern edge of grid must be at least 5 grid points from mother domain!")
130
+ end if
131
+ if(gridsn .lt. 5) then
132
+ print("Warning: Northern edge of grid must be at least 5 grid points from mother domain!")
133
+ end if
134
+
135
+ ;Making sure nested grid is fully contained in mother domain.
136
+ gridsizewe = (((e_wen(parent_idn(i)-1)-4)-i_parent_startn(i))*parent_grid_ration(i))-(parent_grid_ration(i)-1)
137
+ gridsizesn = (((e_snn(parent_idn(i)-1)-4)-j_parent_startn(i))*parent_grid_ration(i))-(parent_grid_ration(i)-1)
138
+ if(gridwe .lt. 5) then
139
+ print("Warning: Inner nest (domain = " + (i+1) + ") is not fully contained in mother nest (domain = " + parent_idn(i) + ")!")
140
+ print("For the current setup of mother domain = " + parent_idn(i) + ", you can only have a nest of size " + gridsizewe + "X" + gridsizesn + ". Stopping Program!")
141
+ exit
142
+ end if
143
+ if(gridsn .lt. 5) then
144
+ print("Warning: Inner nest (domain = " + (i+1) + ") is not fully contained in mother nest (domain = " + parent_idn(i) + ")!")
145
+ print("For the current setup of mother domain = " + parent_idn(i) + ", you can only have a nest of size " + gridsizewe + "X" + gridsizesn + ". Stopping Program!")
146
+ exit
147
+ end if
148
+
149
+ ;Making sure the nest ends at a mother grid domain point.
150
+ pointwetrunc = decimalPlaces(pointwe,0,False)
151
+ pointsntrunc = decimalPlaces(pointsn,0,False)
152
+ if((pointwe-pointwetrunc) .ne. 0.) then
153
+ nest_we_up = (ceil(pointwe)*parent_grid_ration(i))+1
154
+ nest_we_dn = (floor(pointwe)*parent_grid_ration(i))+1
155
+ print("Nest does not end on mother grid domain point. Try " + nest_we_dn + " or " + nest_we_up + ".")
156
+ end if
157
+ if((pointsn-pointsntrunc) .ne. 0.) then
158
+ nest_sn_up = (ceil(pointsn)*parent_grid_ration(i))+1
159
+ nest_sn_dn = (floor(pointsn)*parent_grid_ration(i))+1
160
+ print("Nest does not end on mother grid domain point. Try " + nest_sn_dn + " or " + nest_sn_up + ".")
161
+ end if
162
+
163
+ end do
164
+ end if
165
+
166
+ mpres@parent_id = parent_idn(0:mpres@max_dom-1)
167
+ mpres@parent_grid_ratio = parent_grid_ration(0:mpres@max_dom-1)
168
+ mpres@i_parent_start = i_parent_startn(0:mpres@max_dom-1)
169
+ mpres@j_parent_start = j_parent_startn(0:mpres@max_dom-1)
170
+ mpres@e_we = e_wen(0:mpres@max_dom-1)
171
+ mpres@e_sn = e_snn(0:mpres@max_dom-1)
172
+
173
+ if(mproj_int .eq. 1) then
174
+ mpres@map_proj = "lambert"
175
+ mpres@pole_lat = 0.0
176
+ mpres@pole_lon = 0.0
177
+ else if(mproj_int .eq. 2) then
178
+ mpres@map_proj = "mercator"
179
+ mpres@pole_lat = 0.0
180
+ mpres@pole_lon = 0.0
181
+ else if(mproj_int .eq. 3) then
182
+ mpres@map_proj = "polar"
183
+ mpres@pole_lat = 0.0
184
+ mpres@pole_lon = 0.0
185
+ else if(mproj_int .eq. 4) then
186
+ mpres@map_proj = "lat-lon"
187
+ end if
188
+ end if
189
+ end if
190
+ end if
191
+
192
+ ; Deal with global wrf domains that don't have dx or dy
193
+
194
+ if (mpres@dx.lt.1e-10 .and. mpres@dx.lt.1e-10) then
195
+ mpres@dx = 360./(mpres@e_we(0) - 1)
196
+ mpres@dy = 180./(mpres@e_sn(0) - 1)
197
+ mpres@ref_lat = 0.0
198
+ mpres@ref_lon = 180.0
199
+ end if
200
+
201
+ mp = wrf_wps_dom (wks,mpres,lnres,txres)
202
+
203
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
204
+
205
+ ; Now you can add some information to the plot.
206
+ ; Below is an example of adding a white dot over the DC location.
207
+ ;pmres = True
208
+ ;pmres@gsMarkerColor = "White"
209
+ ;pmres@gsMarkerIndex = 16
210
+ ;pmres@gsMarkerSizeF = 0.01
211
+ ;gsn_polymarker(wks,mp,-77.26,38.56,pmres)
212
+
213
+
214
+ frame(wks) ; lets frame the plot - do not delete
215
+
216
+ end
@@ -0,0 +1,6 @@
1
+ #PBS -q batch
2
+ #PBS -N wrfrun
3
+ #PBS -o {STDOUT_LOG_PATH}
4
+ #PBS -e {STDERR_LOG_PATH}
5
+ #PBS -l nodes={NODE_NUM}:ppn={CORE_NUM}
6
+ #PBS -l walltime=9999:00:00
@@ -0,0 +1,6 @@
1
+ #SBATCH -J wrfrun %Job's name
2
+ #SBATCH -N{NODE_NUM} %node num
3
+ #SBATCH -n{CORE_NUM} %core num
4
+ #SBATCH --time=9999:00:00 %maximum run time
5
+ #SBATCH --output={STDOUT_LOG_PATH} %stdout output log path
6
+ #SBATCH --error={STDERR_LOG_PATH} %error output log path
@@ -0,0 +1,261 @@
1
+ &wrfvar1
2
+ print_detail_grad = .false.
3
+ /
4
+
5
+ &wrfvar2
6
+ calc_w_increment = .false.
7
+ dt_cloud_model = .false.
8
+ write_mod_filtered_obs = .false.
9
+ wind_sd = .true.
10
+ wind_sd_buoy = .true.
11
+ wind_sd_synop = .true.
12
+ wind_sd_ships = .true.
13
+ wind_sd_metar = .true.
14
+ wind_sd_sound = .true.
15
+ wind_sd_pilot = .true.
16
+ wind_sd_airep = .true.
17
+ wind_sd_qscat = .true.
18
+ wind_sd_tamdar = .true.
19
+ wind_sd_geoamv = .true.
20
+ wind_sd_mtgirs = .true.
21
+ wind_sd_polaramv = .true.
22
+ wind_sd_profiler = .true.
23
+ wind_stats_sd = .false.
24
+ qc_rej_both = .false.
25
+ /
26
+
27
+ &wrfvar3
28
+ ob_format = 2
29
+ ob_format_gpsro = 1
30
+ /
31
+
32
+ &wrfvar4
33
+ use_synopobs = .true.
34
+ use_shipsobs = .true.
35
+ use_soundobs = .true.
36
+ use_qscatobs = .true.
37
+ use_metarobs = .true.
38
+ use_pilotobs = .true.
39
+ use_airepobs = .true.
40
+ use_tamdarobs = .true.
41
+ use_geoamvobs = .true.
42
+ use_polaramvobs = .true.
43
+ use_bogusobs = .true.
44
+ use_buoyobs = .true.
45
+ use_profilerobs = .true.
46
+ use_satemobs = .true.
47
+ use_gpspwobs = .true.
48
+ use_gpsrefobs = .true.
49
+ use_ssmiretrievalobs = .false.
50
+ use_airsretobs = .true.
51
+ use_radarobs = .false.
52
+ use_radar_rv = .false.
53
+ use_radar_rf = .false.
54
+ use_amsuaobs = .false.
55
+ use_amsubobs = .false.
56
+ use_eos_amsuaobs = .false.
57
+ use_iasiobs = .false.
58
+ use_mhsobs = .false.
59
+ use_seviriobs = .false.
60
+ use_airsobs = .false.
61
+ use_atmsobs = .false.
62
+ use_ssmisobs = .false.
63
+ use_hirs3obs = .false.
64
+ use_hirs4obs = .false.
65
+ use_msuobs = .false.
66
+ use_mwtsobs = .false.
67
+ use_mwhsobs = .false.
68
+ use_amsr2obs = .false.
69
+ use_obs_errfac = .false.
70
+ /
71
+
72
+ &wrfvar5
73
+ check_max_iv = .true.
74
+ max_error_t = 5.0
75
+ max_error_uv = 5.0
76
+ max_error_pw = 5.0
77
+ max_error_ref = 5.0
78
+ max_error_rh = 5.0
79
+ max_error_q = 5.0
80
+ max_error_p = 5.0
81
+ max_error_tb = 5.0
82
+ max_error_thickness = 5.0
83
+ max_error_rv = 5.0
84
+ max_error_rf = 5.0
85
+ /
86
+
87
+ &wrfvar6
88
+ max_ext_its = 1
89
+ ntmax = 150
90
+ eps = 0.0001, 0.0001, 0.0001, 0.0001, 0.0001
91
+ orthonorm_gradient = .true.
92
+ /
93
+
94
+ &wrfvar7
95
+ cv_options = 3
96
+ len_scaling1 = 1.0
97
+ len_scaling2 = 1.0
98
+ len_scaling3 = 1.0
99
+ len_scaling4 = 1.0
100
+ len_scaling5 = 1.0
101
+ var_scaling1 = 1.0
102
+ var_scaling2 = 1.0
103
+ var_scaling3 = 1.0
104
+ var_scaling4 = 1.0
105
+ var_scaling5 = 1.0
106
+ /
107
+
108
+ &wrfvar8
109
+ /
110
+
111
+ &wrfvar9
112
+ trace_use = .false.
113
+ /
114
+
115
+ &wrfvar10
116
+ /
117
+
118
+ &wrfvar11
119
+ check_rh = 0
120
+ sfc_assi_options = 1
121
+ calculate_cg_cost_fn = .true.
122
+ /
123
+
124
+ &wrfvar12
125
+ /
126
+
127
+ &wrfvar13
128
+ /
129
+
130
+ &wrfvar14
131
+ rtminit_nsensor = 22
132
+ rtminit_platform = 1, 1, 1, 1, 9, 10, 1, 1, 1, 10, 1, 1, 10, 12, 12,
133
+ 9, 17, 2, 1, 1, 1, 1
134
+ rtminit_satid = 15, 16, 18, 19, 2, 2, 15, 16, 17, 2, 18, 19, 2, 2, 3,
135
+ 2, 0, 16, 15, 16, 17, 18
136
+ rtminit_sensor = 3, 3, 3, 3, 3, 3, 4, 4, 4, 16, 15, 15, 15, 21, 21,
137
+ 11, 19, 10, 0, 0, 0, 0
138
+ thinning = .true.
139
+ thinning_mesh = 45.0, 45.0, 45.0, 45.0, 45.0, 45.0, 45.0, 45.0, 45.0,
140
+ 45.0, 45.0, 45.0, 45.0, 45.0, 45.0, 45.0, 45.0, 45.0
141
+ qc_rad = .true.
142
+ write_iv_rad_ascii = .false.
143
+ write_oa_rad_ascii = .true.
144
+ use_antcorr = .true., .true., .true., .true., .true., .true., .true.,
145
+ .true., .true., .true., .true., .true., .true., .true.,
146
+ .true., .true., .true., .true.
147
+ rtm_option = 1
148
+ only_sea_rad = .true.
149
+ use_varbc = .true.
150
+ varbc_factor = 1.0
151
+ freeze_varbc = .true.
152
+ varbc_nobsmin = 10
153
+ use_crtm_kmatrix = .true.
154
+ use_rttov_kmatrix = .true.
155
+ rttov_emis_atlas_ir = 1
156
+ rttov_emis_atlas_mw = 1
157
+ /
158
+
159
+ &wrfvar15
160
+ num_pseudo = 0
161
+ pseudo_x = 129.0
162
+ pseudo_y = 26.0
163
+ pseudo_z = 1.0
164
+ pseudo_val = -500.0
165
+ pseudo_err = 1.0
166
+ /
167
+
168
+ &wrfvar16
169
+ /
170
+
171
+ &wrfvar17
172
+ /
173
+
174
+ &wrfvar18
175
+ analysis_date = '2022-05-19_18:00:00.0000'
176
+ /
177
+
178
+ &wrfvar19
179
+ pseudo_var = 'p'
180
+ /
181
+
182
+ &wrfvar20
183
+ /
184
+
185
+ &wrfvar21
186
+ time_window_min = '2022-05-19_17:00:00.0000'
187
+ /
188
+
189
+ &wrfvar22
190
+ time_window_max = '2022-05-19_19:00:00.0000'
191
+ /
192
+
193
+ &wrfvar23
194
+ /
195
+
196
+ &time_control
197
+ start_year = 2022
198
+ start_month = 5
199
+ start_day = 19
200
+ start_hour = 18
201
+ start_minute = 0
202
+ end_year = 2022
203
+ end_month = 5
204
+ end_day = 19
205
+ end_hour = 18
206
+ end_minute = 0
207
+ /
208
+
209
+ &dfi_control
210
+ /
211
+
212
+ &domains
213
+ e_we = 110
214
+ e_sn = 120
215
+ e_vert = 44
216
+ dx = 30000
217
+ dy = 30000
218
+ nproc_x = -1
219
+ nproc_y = -1
220
+ numtiles = 6
221
+ interp_theta = .true.
222
+ hypsometric_opt = 2
223
+ /
224
+
225
+ &physics
226
+ mp_physics = 2
227
+ progn = 0
228
+ no_mp_heating = 0
229
+ ra_lw_physics = 4
230
+ ra_sw_physics = 4
231
+ radt = 15
232
+ sf_sfclay_physics = 1
233
+ sf_surface_physics = 2
234
+ bl_pbl_physics = 1
235
+ num_land_cat = 21
236
+ num_soil_layers = 4
237
+ cu_physics = 1
238
+ cudt = 0
239
+ isfflx = 1
240
+ mp_zero_out = 2
241
+ /
242
+
243
+ &fdda
244
+ /
245
+
246
+ &dynamics
247
+ km_opt = 4
248
+ damp_opt = 3
249
+ dampcoef = 0.2
250
+ /
251
+
252
+ &bdy_control
253
+ /
254
+
255
+ &grib2
256
+ /
257
+
258
+ &namelist_quilt
259
+ nio_tasks_per_group = 0
260
+ nio_groups = 1
261
+ /