Skip to content

Commit d42b597

Browse files
Merge pull request #79 from falconstryker/devel
Update help for testing round 2
2 parents f1c4b25 + de2d74a commit d42b597

File tree

7 files changed

+83
-78
lines changed

7 files changed

+83
-78
lines changed

bin/MarsFiles.py

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ def parse_args(self, *args, **kwargs):
152152
f" - ``diurn`` : 5-sol averages binned by time of day\n"
153153
f" - ``average``: 5-sol averages\n"
154154
f"{Green}Example:\n"
155-
f"> MarsFiles filename.nc -bin fixed\n"
156-
f"> MarsFiles filename.nc -bin fixed diurn"
155+
f"> MarsFiles fort.11_* -bin fixed daily diurn average\n"
156+
f"> MarsFiles fort.11_* -bin fixed diurn"
157157
f"{Nclr}\n\n"
158158
)
159159
)
@@ -187,10 +187,10 @@ def parse_args(self, *args, **kwargs):
187187
f"-dim.\nIf a file contains multiple Mars Years of data, the "
188188
f"function splits the file in the first Mars Year.\n"
189189
f"{Green}Example:\n"
190-
f"> MarsFiles 00668.atmos_average.nc --split 0 90"
191-
f"> MarsFiles 00668.atmos_average.nc --split 270\n"
190+
f"> MarsFiles 01336.atmos_average.nc --split 0 90"
191+
f"> MarsFiles 01336.atmos_average.nc --split 270\n"
192192
f"{Yellow}Use -dim to specify the dimension:{Green}\n"
193-
f"> MarsFiles 00668.atmos_average.nc --split 0 90 -dim lat"
193+
f"> MarsFiles 01336.atmos_average.nc --split 0 90 -dim lat"
194194
f"{Nclr}\n\n"
195195
)
196196
)
@@ -206,9 +206,9 @@ def parse_args(self, *args, **kwargs):
206206
f"files.\n"
207207
f"{Yellow}Generates a new file ending in ``_T.nc``{Nclr}\n"
208208
f"{Green}Example:\n"
209-
f"> MarsFiles 00668.atmos_diurn.nc -t"
209+
f"> MarsFiles 01336.atmos_diurn.nc -t"
210210
f" {Blue}(outputs data for all 24 local times){Green}\n"
211-
f"> MarsFiles 00668.atmos_diurn.nc -t '3 15'"
211+
f"> MarsFiles 01336.atmos_diurn.nc -t '3 15'"
212212
f" {Blue}(outputs data for target local times only)"
213213
f"{Nclr}\n\n"
214214
)
@@ -224,8 +224,8 @@ def parse_args(self, *args, **kwargs):
224224
f"Requires input file to be in MGCM 'daily' format.\n"
225225
f"{Yellow}Generates a new file ending in ``_to_average.nc``\n"
226226
f"{Green}Example:\n"
227-
f"> MarsFiles 00668.atmos_daily.nc -ba {Blue}(5-sol bin){Green}\n"
228-
f"> MarsFiles 00668.atmos_daily_pstd.nc -ba 10 {Blue}(10-sol bin)"
227+
f"> MarsFiles 01336.atmos_daily.nc -ba {Blue}(5-sol bin){Green}\n"
228+
f"> MarsFiles 01336.atmos_daily_pstd.nc -ba 10 {Blue}(10-sol bin)"
229229
f"{Nclr}\n\n"
230230
)
231231
)
@@ -241,10 +241,10 @@ def parse_args(self, *args, **kwargs):
241241
f"Requires input file to be in MGCM 'daily' format.\n"
242242
f"{Yellow}Generates a new file ending in ``_to_diurn.nc``\n"
243243
f"{Green}Example:\n"
244-
f"> MarsFiles 00668.atmos_daily.nc -bd {Blue}(5-sol bin){Green}\n"
245-
f"> MarsFiles 00668.atmos_daily_pstd.nc -bd -ba 10 "
244+
f"> MarsFiles 01336.atmos_daily.nc -bd {Blue}(5-sol bin){Green}\n"
245+
f"> MarsFiles 01336.atmos_daily_pstd.nc -bd -ba 10 "
246246
f"{Blue}(10-sol bin){Green}\n"
247-
f"> MarsFiles 00668.atmos_daily_pstd.nc -bd -ba 1 "
247+
f"> MarsFiles 01336.atmos_daily_pstd.nc -bd -ba 1 "
248248
f"{Blue}(no binning, mimics raw Legacy output)"
249249
f"{Nclr}\n\n"
250250
)
@@ -262,7 +262,7 @@ def parse_args(self, *args, **kwargs):
262262
f"to add the original linear trend to the amplitudes \n"
263263
f"\n{Yellow}Generates a new file ending in ``_hpt.nc``\n"
264264
f"{Green}Example:\n"
265-
f"> MarsFiles 00668.atmos_daily.nc -hpt 10.\n"
265+
f"> MarsFiles 01336.atmos_daily.nc -hpt 10.\n"
266266
f"{Nclr}\n\n"
267267
)
268268
)
@@ -279,7 +279,7 @@ def parse_args(self, *args, **kwargs):
279279
f"to add the original linear trend to the amplitudes \n"
280280
f"\n{Yellow}Generates a new file ending in ``_lpt.nc``\n"
281281
f"{Green}Example:\n"
282-
f"> MarsFiles 00668.atmos_daily.nc -lpt 0.5\n"
282+
f"> MarsFiles 01336.atmos_daily.nc -lpt 0.5\n"
283283
f"{Nclr}\n\n"
284284
)
285285
)
@@ -296,7 +296,7 @@ def parse_args(self, *args, **kwargs):
296296
f"to add the original linear trend to the amplitudes \n"
297297
f"\n{Yellow}Generates a new file ending in ``bpt.nc``\n"
298298
f"{Green}Example:\n"
299-
f"> MarsFiles 00668.atmos_daily.nc -hpt 0.5 10.\n"
299+
f"> MarsFiles 01336.atmos_daily.nc -hpt 0.5 10.\n"
300300
f"{Nclr}\n\n"
301301
)
302302
)
@@ -312,7 +312,7 @@ def parse_args(self, *args, **kwargs):
312312
f"in Sols.\n"
313313
f"{Yellow}Generates a new file ending in ``_hps.nc``\n"
314314
f"{Green}Example:\n"
315-
f"> MarsFiles 00668.atmos_daily.nc -hps 10 --add_trend\n"
315+
f"> MarsFiles 01336.atmos_daily.nc -hps 10 --add_trend\n"
316316
f"{Nclr}\n\n"
317317
)
318318
)
@@ -327,7 +327,7 @@ def parse_args(self, *args, **kwargs):
327327
f"cutoff frequency in Sols.\n"
328328
f"{Yellow}Generates a new file ending in ``_lps.nc``\n"
329329
f"{Green}Example:\n"
330-
f"> MarsFiles 00668.atmos_daily.nc -lps 20 --add_trend\n"
330+
f"> MarsFiles 01336.atmos_daily.nc -lps 20 --add_trend\n"
331331
f"{Nclr}\n\n"
332332
)
333333
)
@@ -342,7 +342,7 @@ def parse_args(self, *args, **kwargs):
342342
f"cutoff frequency in Sols.\nData detrended before filtering.\n"
343343
f"{Yellow}Generates a new file ending in ``_bps.nc``\n"
344344
f"{Green}Example:\n"
345-
f"> MarsFiles 00668.atmos_daily.nc -bps 10 20 --add_trend\n"
345+
f"> MarsFiles 01336.atmos_daily.nc -bps 10 20 --add_trend\n"
346346
f"{Nclr}\n\n"
347347
)
348348
)
@@ -358,7 +358,7 @@ def parse_args(self, *args, **kwargs):
358358
f"N = 1 diurnal tide, N = 2 semi-diurnal, etc.\n"
359359
f"{Yellow}Generates a new file ending in ``_tide_decomp.nc``\n"
360360
f"{Green}Example:\n"
361-
f"> MarsFiles 00668.atmos_diurn.nc -tide 2 -incl ps temp "
361+
f"> MarsFiles 01336.atmos_diurn.nc -tide 2 -incl ps temp "
362362
f"{Blue}(extracts semi-diurnal tide component of ps and temp "
363363
f"variables; 2 harmonics)"
364364
f"{Nclr}\n\n"
@@ -376,8 +376,11 @@ def parse_args(self, *args, **kwargs):
376376
f"to the same standard grid [zstd, zagl, pstd, etc.].\n"
377377
f"{Yellow}Generates a new file ending in ``_regrid.nc``\n"
378378
f"{Green}Example:\n"
379-
f"> MarsInterp sim1/00668.atmos_average_pstd.nc -regrid "
380-
f"sim2/00668.atmos_average_pstd.nc"
379+
f"> MarsInterp 01336.atmos_average_pstd.nc -regrid "
380+
f"01336.atmos_average_pstd_c48.nc"
381+
f"{Yellow}NOTE: name of regridded file does not matter."
382+
f"{Green}> MarsInterp sim1/01336.atmos_average_pstd.nc -regrid "
383+
f"sim2/01336.atmos_average_pstd.nc"
381384
f"{Nclr}\n\n"
382385
)
383386
)
@@ -392,7 +395,7 @@ def parse_args(self, *args, **kwargs):
392395
f"length <= 1.\n"
393396
f"{Yellow}Generates a new file ending in ``_zavg.nc``\n"
394397
f"{Green}Example:\n"
395-
"> MarsFiles 00668.atmos_diurn.nc -zavg"
398+
"> MarsFiles 01336.atmos_diurn.nc -zavg"
396399
f"{Nclr}\n\n"
397400
)
398401
)
@@ -405,8 +408,8 @@ def parse_args(self, *args, **kwargs):
405408
f"dimension on which to trim the file.\nAcceptable values are "
406409
f"'areo', 'lev', 'lat', 'lon'. Default = 'areo'.\n"
407410
f"{Green}Example:\n"
408-
f"> MarsFiles 00668.atmos_average.nc --split 0 90 -dim areo"
409-
f"> MarsFiles 00668.atmos_average.nc --split -70 -dim lat"
411+
f"> MarsFiles 01336.atmos_average.nc --split 0 90 -dim areo"
412+
f"> MarsFiles 01336.atmos_average.nc --split -70 -dim lat"
410413
f"{Nclr}\n\n"
411414
)
412415
)
@@ -421,7 +424,7 @@ def parse_args(self, *args, **kwargs):
421424
f"N = 1 diurnal tide, N = 2 semi-diurnal, etc.\n"
422425
f"{Yellow}Generates a new file ending in ``_norm.nc``\n"
423426
f"{Green}Example:\n"
424-
f"> MarsFiles 00668.atmos_diurn.nc -tide 6 -incl ps "
427+
f"> MarsFiles 01336.atmos_diurn.nc -tide 6 -incl ps "
425428
f"-norm"
426429
f"{Nclr}\n\n"
427430
)
@@ -438,9 +441,9 @@ def parse_args(self, *args, **kwargs):
438441
f"``-hpt``, ``-bpt``).\n"
439442
f"{Yellow}Generates a new file ending in ``_trended.nc``\n"
440443
f"{Green}Example:\n"
441-
f"> MarsFiles 00668.atmos_daily.nc -hpt 10. -add_trend\n"
442-
f"> MarsFiles 00668.atmos_daily.nc -lpt 0.5 -add_trend\n"
443-
f"> MarsFiles 00668.atmos_daily.nc -hpt 0.5 10. -add_trend"
444+
f"> MarsFiles 01336.atmos_daily.nc -hpt 10. -add_trend\n"
445+
f"> MarsFiles 01336.atmos_daily.nc -lpt 0.5 -add_trend\n"
446+
f"> MarsFiles 01336.atmos_daily.nc -hpt 0.5 10. -add_trend"
444447
f"{Nclr}\n\n"
445448
)
446449
)
@@ -453,7 +456,7 @@ def parse_args(self, *args, **kwargs):
453456
f"Reconstructs the first N harmonics.\n"
454457
f"{Yellow}Generates a new file ending in ``_reconstruct.nc``\n"
455458
f"{Green}Example:\n"
456-
f"> MarsFiles 00668.atmos_diurn.nc -tide 6 -incl ps temp "
459+
f"> MarsFiles 01336.atmos_diurn.nc -tide 6 -incl ps temp "
457460
f"-recon"
458461
f"{Nclr}\n\n"
459462
)
@@ -467,7 +470,7 @@ def parse_args(self, *args, **kwargs):
467470
f"{Yellow}Overwrites existing target file. To override, use "
468471
f"-ext.{Nclr}\n"
469472
f"{Green}Example:\n"
470-
f"> MarsFiles 00668.atmos_daily.nc -ba -incl ps temp ts"
473+
f"> MarsFiles 01336.atmos_daily.nc -ba -incl ps temp ts"
471474
f"{Nclr}\n\n"
472475
)
473476
)
@@ -491,7 +494,7 @@ def parse_args(self, *args, **kwargs):
491494
f"Use with any other argument to pass all Python errors and\n"
492495
f"status messages to the screen when running CAP.\n"
493496
f"{Green}Example:\n"
494-
f"> MarsFiles 00668.atmos_average.nc -t '3 15' --debug"
497+
f"> MarsFiles 01336.atmos_average.nc -t '3 15' --debug"
495498
f"{Nclr}\n\n"
496499
)
497500
)

bin/MarsFormat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ def main():
181181
#=================================================================
182182
if model_type == 'marswrf':
183183
# First save all variable descriptions in attrs longname
184+
print(f"{Cyan}Current variables at top of marswrf processing:\n{list(DS.variables)}{Nclr}\n")
184185
for var_name in DS.data_vars:
185186
var = DS[var_name]
186187
if 'description' in var.attrs:
@@ -409,6 +410,7 @@ def main():
409410
# ==============================================================
410411
# check that vertical grid starts at toa with highest level at surface
411412
if DS[model.dim_pfull][0] != DS[model.dim_pfull].min(): # if toa, lev = 0 is surface then flip
413+
print(f"{Cyan}Current variables at start of processing for all models:\n{list(DS.variables)}{Nclr}\n")
412414
DS = DS.isel(**{model.dim_pfull: slice(None, None, -1)})
413415
DS=DS.isel(**{model.dim_phalf: slice(None, None, -1)}) #Also flip phalf,ak, bk
414416
print(f"{Red}NOTE: all variables flipped along vertical dimension, so that the top of the atmosphere is now index 0")

bin/MarsInterp.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@
7878
help=(
7979
f"Interpolation interp_: ``pstd``, ``zstd``, or ``zagl``.\n"
8080
f"{Green}Example:\n"
81-
f"> MarsInterp 00668.atmos_average.nc\n"
82-
f"> MarsInterp 00668.atmos_average.nc -t pstd"
81+
f"> MarsInterp 01336.atmos_average.nc\n"
82+
f"> MarsInterp 01336.atmos_average.nc -t pstd"
8383
f"{Nclr}\n\n"
8484
)
8585
)
@@ -93,7 +93,7 @@
9393
f"{Cyan}cp path/to/amesCAP/mars_templates/amescap_profile "
9494
f"~/.amescap_profile\n"
9595
f"{Green}Example:\n"
96-
f"> MarsInterp 00668.atmos_average.nc -t zstd -v phalf_mb"
96+
f"> MarsInterp 01336.atmos_average.nc -t zstd -v phalf_mb"
9797
f"{Nclr}\n\n"
9898
)
9999
)
@@ -103,7 +103,7 @@
103103
f"Only include the listed variables. Dimensions and 1D "
104104
f"variables are always included.\n"
105105
f"{Green}Example:\n"
106-
f"> MarsInterp 00668.atmos_daily.nc -incl temp ps ts"
106+
f"> MarsInterp 01336.atmos_daily.nc -incl temp ps ts"
107107
f"{Nclr}\n\n"
108108
)
109109
)
@@ -113,7 +113,7 @@
113113
f"Print the vertical grid to the screen. {Yellow}This does not "
114114
f"run the interpolation, it only prints grid information.\n"
115115
f"{Green}Example:\n"
116-
f"> MarsInterp 00668.atmos_average.nc -t pstd -v p44 -print"
116+
f"> MarsInterp 01336.atmos_average.nc -t pstd -v p44 -print"
117117
f"{Nclr}\n\n"
118118
)
119119
)
@@ -139,7 +139,7 @@
139139
f"Use with any other argument to pass all Python errors and\n"
140140
f"status messages to the screen when running CAP.\n"
141141
f"{Green}Example:\n"
142-
f"> MarsInterp 00668.atmos_average.nc -t pstd --debug"
142+
f"> MarsInterp 01336.atmos_average.nc -t pstd --debug"
143143
f"{Nclr}\n\n"
144144
)
145145
)

bin/MarsPlot.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
f"Print the content of a netCDF file to the screen. This is a "
111111
f"ncdump-like feature. Variables are sorted by dimension.\n"
112112
f"{Green}Example:\n"
113-
f"> MarsPlot -i 00668.atmos_daily.nc"
113+
f"> MarsPlot -i 01336.atmos_daily.nc"
114114
f"{Nclr}\n\n"
115115
)
116116
)
@@ -130,7 +130,7 @@
130130
help=(
131131
f"Specify the file to use. Default is the last file created.\n"
132132
f"{Green}Example:\n"
133-
f"> MarsPlot Custom.in -d 00668"
133+
f"> MarsPlot Custom.in -d 01336"
134134
f"{Nclr}\n\n"
135135
)
136136
)
@@ -211,9 +211,9 @@
211211
f"For use with ``-i --inspect``: print the values of the "
212212
f"specified variable to the screen.\n"
213213
f"{Green}Example:\n"
214-
f"> MarsPlot -i 00668.atmos_daily.nc -values temp\n"
214+
f"> MarsPlot -i 01336.atmos_daily.nc -values temp\n"
215215
f"{Blue}(quotes '' req. for browsing dimensions){Green}\n"
216-
f"> MarsPlot -i 00668.atmos_daily.nc -values 'temp[6,:,30,10]'"
216+
f"> MarsPlot -i 01336.atmos_daily.nc -values 'temp[6,:,30,10]'"
217217
f"{Nclr}\n\n"
218218
)
219219
)
@@ -224,9 +224,9 @@
224224
f"For use with ``-i --inspect``: print the min, mean, and max "
225225
f"values of the specified variable to the screen.\n"
226226
f"{Green}Example:\n"
227-
f"> MarsPlot -i 00668.atmos_daily.nc -stats temp\n"
227+
f"> MarsPlot -i 01336.atmos_daily.nc -stats temp\n"
228228
f"{Blue}(quotes '' req. for browsing dimensions){Green}\n"
229-
f"> MarsPlot -i 00668.atmos_daily.nc -stats 'temp[6,:,30,10]'"
229+
f"> MarsPlot -i 01336.atmos_daily.nc -stats 'temp[6,:,30,10]'"
230230
f"{Nclr}\n\n"
231231
)
232232
)
@@ -259,7 +259,7 @@
259259
args.generate_template is False and
260260
args.inspect_file is None):
261261
parser.error(f"{Red}The -d argument requires a template file "
262-
f"like Custom.in (e.g., MarsPlot Custom.in -d 00668)"
262+
f"like Custom.in (e.g., MarsPlot Custom.in -d 01336)"
263263
f"{Nclr}")
264264
exit()
265265

@@ -292,13 +292,13 @@
292292
if args.statistics is not None and args.inspect_file is None:
293293
parser.error(f"{Red}The -stat argument requires a template "
294294
f"file like Custom.in (e.g., MarsPlot -i "
295-
f"00668.atmos_daily.nc -stats temp{Nclr}")
295+
f"01336.atmos_daily.nc -stats temp{Nclr}")
296296
exit()
297297

298298
if args.print_values is not None and args.inspect_file is None:
299299
parser.error(f"{Red}The -values argument requires a template "
300300
f"file like Custom.in (e.g., MarsPlot -i "
301-
f"00668.atmos_daily.nc -values temp{Nclr}")
301+
f"01336.atmos_daily.nc -values temp{Nclr}")
302302
exit()
303303

304304
if args.trim_text and (args.generate_template is False):
@@ -2073,7 +2073,7 @@ def prep_file(var_name, file_type, simuID, sol_array):
20732073
file_has_sol_number = True
20742074
if sol_array != [None]:
20752075
# File number explicitly provided in varfull
2076-
# (e.g., 00668.atmos_average.nc)
2076+
# (e.g., 01336.atmos_average.nc)
20772077
Sol_num_current = sol_array
20782078
elif Ncdf_num is not None:
20792079
# File number NOT provided in varfull
@@ -2701,8 +2701,8 @@ def get_topo_2D(self, varfull, plot_type):
27012701
This function returns the longitude, latitude, and topography
27022702
to overlay as contours in a ``2D_lon_lat`` plot. Because the
27032703
main variable requested may be complex
2704-
(e.g., ``[00668.atmos_average_psdt2.temp]/1000.``), we will
2705-
ensure to load the matching topography (here ``00668.fixed.nc``
2704+
(e.g., ``[01336.atmos_average_psdt2.temp]/1000.``), we will
2705+
ensure to load the matching topography (here ``01336.fixed.nc``
27062706
from the 2nd simulation). This function essentially does a
27072707
simple task in a complicated way. Note that a great deal of
27082708
the code is borrowed from the ``data_loader_2D()`` function.
@@ -2734,8 +2734,8 @@ def get_topo_2D(self, varfull, plot_type):
27342734
f = get_list_varfull(varfull)
27352735
sol_array, filetype, var, simuID = split_varfull(varfull_list[0])
27362736

2737-
# If requesting a lat-lon plot for 00668.atmos_average.nc,
2738-
# try to find matching 00668.fixed.nc
2737+
# If requesting a lat-lon plot for 01336.atmos_average.nc,
2738+
# try to find matching 01336.fixed.nc
27392739
try:
27402740
f, var_info, dim_info, dims = prep_file(
27412741
"zsurf", "fixed", simuID, sol_array)

0 commit comments

Comments
 (0)