Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bin/MarsCalendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@
formatter_class=argparse.RawTextHelpFormatter
)

group = parser.add_argument_group("Required Arguments",
"\n{Yellow}MarsCalendar requires either -ls or -sol.{Nclr}\n")
group = parser.add_argument_group(
"Required Arguments:",
f"{Yellow}MarsCalendar requires either -ls or -sol.{Nclr}\n")
exclusive_group = parser.add_mutually_exclusive_group(required=True)

exclusive_group.add_argument('-sol', '--sol', nargs='+', type=float,
Expand Down
45 changes: 22 additions & 23 deletions bin/MarsFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,18 @@ def parse_args(self, *args, **kwargs):
f"> ls\n"
f"00334.atmos_average.nc 00668.atmos_average.nc\n"
f"> MarsFiles *.atmos_average.nc -c\n"
f"{Blue}Overwrites 00334.atmos_average.nc with concatenated "
f"files:\n"
f"> ls\n"
f" 00334.atmos_average.nc\n"
f"{Yellow}Overwrites 00334.atmos_average.nc with concatenated "
f"files. To override, use [-ext --extension]:{Green}\n"
f"{Blue}To preserve original files, use [-ext --extension]:"
f"{Green}\n"
f"> MarsFiles *.atmos_average.nc -c -ext _concatenated\n"
f"{Blue}Produces 00334.atmos_average_concatenated.nc and "
f"preserves all other files:{Green}\n"
f"> ls\n"
f" 00334.atmos_average.nc 00668.atmos_average.nc "
f"00334.atmos_average_concatenated.nc\n"
f"{Blue}(Produces 00334.atmos_average_concatenated.nc and "
f" preserves all other files)"
f"{Nclr}\n\n"
)
)
Expand Down Expand Up @@ -358,8 +360,8 @@ def parse_args(self, *args, **kwargs):
f"N = 1 diurnal tide, N = 2 semi-diurnal, etc.\n"
f"{Yellow}Generates a new file ending in ``_tide_decomp.nc``\n"
f"{Green}Example:\n"
f"> MarsFiles 01336.atmos_diurn.nc -tide 2 -incl ps temp "
f"{Blue}(extracts semi-diurnal tide component of ps and temp "
f"> MarsFiles 01336.atmos_diurn.nc -tide 2 -incl ps temp\n"
f"{Blue}(extracts semi-diurnal tide component of ps and\ntemp "
f"variables; 2 harmonics)"
f"{Nclr}\n\n"
)
Expand All @@ -376,10 +378,10 @@ def parse_args(self, *args, **kwargs):
f"to the same standard grid [zstd, zagl, pstd, etc.].\n"
f"{Yellow}Generates a new file ending in ``_regrid.nc``\n"
f"{Green}Example:\n"
f"> MarsInterp 01336.atmos_average_pstd.nc -regrid "
f"01336.atmos_average_pstd_c48.nc"
f"{Yellow}NOTE: name of regridded file does not matter."
f"{Green}> MarsInterp sim1/01336.atmos_average_pstd.nc -regrid "
f"> MarsFiles 01336.atmos_average_pstd.nc -regrid "
f"01336.atmos_average_pstd_c48.nc\n"
f"{Yellow}NOTE: regridded file name does not matter:\n"
f"{Green}> MarsFiles sim1/01336.atmos_average_pstd.nc -regrid "
f"sim2/01336.atmos_average_pstd.nc"
f"{Nclr}\n\n"
)
Expand Down Expand Up @@ -408,7 +410,7 @@ def parse_args(self, *args, **kwargs):
f"dimension on which to trim the file.\nAcceptable values are "
f"'areo', 'lev', 'lat', 'lon'. Default = 'areo'.\n"
f"{Green}Example:\n"
f"> MarsFiles 01336.atmos_average.nc --split 0 90 -dim areo"
f"> MarsFiles 01336.atmos_average.nc --split 0 90 -dim areo\n"
f"> MarsFiles 01336.atmos_average.nc --split -70 -dim lat"
f"{Nclr}\n\n"
)
Expand Down Expand Up @@ -482,8 +484,8 @@ def parse_args(self, *args, **kwargs):
f"CAP to create a new file with the extension name specified "
f"here.\n"
f"{Green}Example:\n"
f"> MarsFiles 00334.atmos_average.nc -c -ext _comb"
f" {Blue}(produces 00334.atmos_average_comb.nc and "
f"> MarsFiles 00334.atmos_average.nc -c -ext _comb\n"
f"{Blue}(Produces 00334.atmos_average_comb.nc and "
f"preserves all other files)"
f"{Nclr}\n\n"
)
Expand Down Expand Up @@ -710,7 +712,7 @@ def split_files(file_list, split_dim):
# size areo = (time, tod, scalar_axis)
reducing_dim = np.squeeze(fNcdf.variables['areo'][:, 0, :])
else:
reducing_dim = np.squeeze(fNcdf.variables[split_dim][:])
reducing_dim = np.squeeze(fNcdf.variables[split_dim][:, 0])
else:
if split_dim == 'areo':
# size areo = (time, scalar_axis)
Expand All @@ -719,22 +721,19 @@ def split_files(file_list, split_dim):
reducing_dim = np.squeeze(fNcdf.variables[split_dim][:])

print(f"\n{Yellow}All values in dimension:\n{reducing_dim}\n")

bounds_in=bounds.copy()
if split_dim == 'areo':
while (bounds[0] < reducing_dim[0]):
bounds += 360.
if len(np.atleast_1d(bounds)) == 2:
while (bounds[1] < bounds[0]):
bounds[1] += 360.

if len(np.atleast_1d(bounds)) < 2:
a=check_bounds(bounds[0],reducing_dim[0],reducing_dim[-1])
indices = [(np.abs(reducing_dim - bounds[0])).argmin()]
dim_out = reducing_dim[indices]
print(f"Requested value = {bounds[0]}\n"
f"Nearest value = {dim_out[0]}\n")
else:
bounds_in=bounds.copy()
if split_dim == 'areo':
while (bounds[0] < reducing_dim[0]):
bounds += 360.
while (bounds[1] < bounds[0]):
bounds[1] += 360.
a=check_bounds(bounds,reducing_dim[0],reducing_dim[-1])
if ((split_dim == 'lon') & (bounds[1] < bounds[0])):
indices = np.where((reducing_dim <= bounds[1]) | (reducing_dim >= bounds[0]))[0]
Expand Down
26 changes: 12 additions & 14 deletions bin/MarsFormat.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
f"Acceptable types include 'openmars', 'marswrf', 'emars', "
f"and 'pcm' \n"
f"{Green}Example:\n"
f"> MarsFormat openmars_file.nc -gcm openmars"
f"{Blue}Creates openmars_file_daily.nc"
f"> MarsFormat openmars_file.nc -gcm openmars\n"
f"{Blue}(Creates openmars_file_daily.nc)"
f"{Nclr}\n\n"
)
)
Expand All @@ -86,11 +86,10 @@
f"Calculate 5-day averages from instantaneous data. Generates "
f"MGCM-like 'average' files.\n"
f"{Green}Example:\n"
f"> MarsFormat openmars_file.nc -gcm openmars -ba "
f"{Blue}Creates openmars_file_average.nc"
f"{Blue}5-sol bin{Green}\n"
f"> MarsFormat openmars_file.nc -gcm openmars -ba 10 "
f"{Blue}10-sol bin"
f"> MarsFormat openmars_file.nc -gcm openmars -ba\n"
f"{Blue}(Creates openmars_file_average.nc; 5-sol bin){Green}\n"
f"> MarsFormat openmars_file.nc -gcm openmars -ba 10\n"
f"{Blue}(10-sol bin)"
f"{Nclr}\n\n"
)
)
Expand All @@ -101,11 +100,10 @@
f"Calculate 5-day averages binned by hour from instantaneous "
f"data. Generates MGCM-like 'diurn' files.\n"
f"{Green}Example:\n"
f"> MarsFormat openmars_file.nc -gcm openmars -bd "
f"{Blue}Creates openmars_file_daily.nc"
f"{Blue}uses a 5-sol bin{Green}\n"
f"> MarsFormat openmars_file.nc -gcm openmars -bd -ba 10 "
f"{Blue}uses a 10-sol bin"
f"> MarsFormat openmars_file.nc -gcm openmars -bd\n"
f"{Blue}(Creates openmars_file_daily.nc; 5-sol bin){Green}\n"
f"> MarsFormat openmars_file.nc -gcm openmars -bd -ba 10\n"
f"{Blue}(10-sol bin)"
f"{Nclr}\n\n"
)
)
Expand All @@ -118,8 +116,8 @@
f"Preserves the names of the variables and dimensions in the"
f"original file.\n"
f"{Green}Example:\n"
f"> MarsFormat openmars_file.nc -gcm openmars -rn"
f"{Blue}Creates openmars_file_daily.nc"
f"> MarsFormat openmars_file.nc -gcm openmars -rn\n"
f"{Blue}(Creates openmars_file_daily.nc)"
f"{Nclr}\n\n"
)
)
Expand Down
8 changes: 4 additions & 4 deletions bin/MarsInterp.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

parser.add_argument('-v', '--vertical_grid', type=str, default=None,
help=(
f"Layer IDs as defined in ``amescap_profile``. For first "
f"Layer IDs as defined in ``amescap_profile``.\nFor first "
f"time use, copy ``amescap_profile`` to your home directory:\n"
f"{Cyan}cp path/to/amesCAP/mars_templates/amescap_profile "
f"~/.amescap_profile\n"
Expand All @@ -110,7 +110,7 @@

parser.add_argument('-print', '--print_grid', action='store_true',
help=(
f"Print the vertical grid to the screen. {Yellow}This does not "
f"Print the vertical grid to the screen.\n{Yellow}This does not "
f"run the interpolation, it only prints grid information.\n"
f"{Green}Example:\n"
f"> MarsInterp 01336.atmos_average.nc -t pstd -v p44 -print"
Expand All @@ -128,8 +128,8 @@
f"here.\n"
f"{Green}Example:\n"
f"> MarsInterp 00334.atmos_average.nc -t pstd -ext _dflt_levs\n"
f" {Blue} produces 00334.atmos_average_dflt_levs.nc and "
f"preserves all other files."
f"{Blue}(Produces 00334.atmos_average_dflt_levs.nc and "
f"preserves all other files)"
f"{Nclr}\n\n"
)
)
Expand Down
22 changes: 11 additions & 11 deletions bin/MarsPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
parser.add_argument('-i', '--inspect_file', nargs='?',
type=argparse.FileType('rb'),
help=(
f"Print the content of a netCDF file to the screen. This is a "
f"ncdump-like feature. Variables are sorted by dimension.\n"
f"Print the content of a netCDF file to the screen.\nVariables "
f"are sorted by dimension.\n"
f"{Green}Example:\n"
f"> MarsPlot -i 01336.atmos_daily.nc"
f"{Nclr}\n\n"
Expand Down Expand Up @@ -138,10 +138,10 @@
parser.add_argument('-sy', '--stack_years', action='store_true',
default=False,
help=(
f"Stack consecutive years of data on the same axes (e.g., Ls ="
f"0-360) in 1D time series plots.\nThis only works if ADD LINE "
f"is used in the Custom.in template to overplot multiple years "
f"of data.\nDefault is to plot in monotonically increasing "
f"Plot consecutive years of data over the same axes range (e.g."
f"Ls=0–360). For 1D time series plots.\nRequires ADD LINE "
f"in the Custom.in template (see template for instructions)."
f"\nDefault is to plot in monotonically increasing "
f"format.\n"
f"{Green}Example:\n"
f"> MarsPlot Custom.in -sy"
Expand Down Expand Up @@ -196,7 +196,7 @@
default=False,
help=(
f"Generate a file called Custom.in that provides templates "
f"for making plots with CAP without the commented instructions "
f"for making plots\nwith CAP without the instructions "
f"at top of the file.\n"
f"{Green}Example:\n"
f"> MarsPlot -template -trim\n"
Expand All @@ -208,7 +208,7 @@
parser.add_argument('-values', '--print_values', nargs='+',
default=None,
help=(
f"For use with ``-i --inspect``: print the values of the "
f"For use with ``-i --inspect``:\nPrint the values of the "
f"specified variable to the screen.\n"
f"{Green}Example:\n"
f"> MarsPlot -i 01336.atmos_daily.nc -values temp\n"
Expand All @@ -221,7 +221,7 @@
# to be used jointly with --inspect
parser.add_argument('-stats', '--statistics', nargs='+', default=None,
help=(
f"For use with ``-i --inspect``: print the min, mean, and max "
f"For use with ``-i --inspect``:\nPrint the min, mean, and max "
f"values of the specified variable to the screen.\n"
f"{Green}Example:\n"
f"> MarsPlot -i 01336.atmos_daily.nc -stats temp\n"
Expand All @@ -233,8 +233,8 @@

parser.add_argument('--debug', action='store_true',
help=(
f"Use with any other argument to pass all Python errors and\n"
f"status messages to the screen when running CAP.\n"
f"Use with any other argument to print all Python errors and "
f"status messages to the screen\n"
f"{Green}Example:\n"
f"> MarsPlot Custom.in --debug"
f"{Nclr}\n\n"
Expand Down
36 changes: 18 additions & 18 deletions bin/MarsPull.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,25 @@
prog=('MarsPull'),
description=(
f"{Yellow}Uility for downloading NASA Ames Mars Global Climate "
f"Model output files from the NAS Data Portal at:"
f"{Cyan}https://data.nas.nasa.gov/mcmcref/\n{Nclr}\n"
f"Requires the ``-id`` argument AND EITHER ``-f`` or ``-ls``."
f"Model output files from the NAS Data Portal at:\n"
f"{Cyan}https://data.nas.nasa.gov/mcmcref/\n{Nclr}"
f"Requires ``-f`` or ``-ls``."
f"{Nclr}\n\n"
),
formatter_class=argparse.RawTextHelpFormatter
)

parser.add_argument('-list', '--list_files', action='store_true',
help=(
f"Return a list of all the files available for download from:\n"
f"{Cyan}https://data.nas.nasa.gov/mcmcref/\n{Nclr}\n"
f"{Green}Example:\n"
f"> MarsPull -list"
f"{Nclr}\n\n"
)
)

parser.add_argument('directory_name', type=str, nargs='?',
choices=[
'FV3BETAOUT1', 'ACTIVECLDS', 'INERTCLDS', 'NEWBASE_ACTIVECLDS',
'ACTIVECLDS_NCDF'],
help=(
f"Selects the simulation directory from the "
f"NAS data portal:\n"
f"{Cyan}https://data.nas.nasa.gov/mcmcref/\n{Nclr}\n"
f"Current options are:\n{Yellow}FV3BETAOUT1\nACTIVECLDS\n"
f"INERTCLDS\nNEWBASE_ACTIVECLDS\nACTIVECLDS_NCDF\n"
f"{Red}MUST be used with either ``-f`` or ``-ls``.\n"
f"NAS data portal ("
f"{Cyan}https://data.nas.nasa.gov/mcmcref/){Nclr}\n"
f"Current directory options are:\n{Yellow}FV3BETAOUT1, ACTIVECLDS, "
f"ACTIVECLDS, INERTCLDS, NEWBASE_ACTIVECLDS, ACTIVECLDS_NCDF\n"
f"{Red}MUST be used with either ``-f`` or ``-ls``\n"
f"{Green}Example:\n"
f"> MarsPull INERTCLDS -f fort.11_0690\n"
f"{Blue}OR{Green}\n"
Expand All @@ -80,6 +70,16 @@
)
)

parser.add_argument('-list', '--list_files', action='store_true',
help=(
f"Return a list of all the files available for download from "
f"{Cyan}https://data.nas.nasa.gov/mcmcref/{Nclr}\n"
f"{Green}Example:\n"
f"> MarsPull -list"
f"{Nclr}\n\n"
)
)

parser.add_argument('-f', '--filename', nargs='+', type=str,
help=(
f"The name(s) of the file(s) to download.\n"
Expand Down
20 changes: 10 additions & 10 deletions bin/MarsVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ def add_help(var_list):
f"A new variable (``var_col``) in [kg/m2] will be added to the "
f"file.\n"
f"{Green}Example:\n"
f"> MarsVars 01336.atmos_average.nc -col dst_mass_mom"
f" {Blue}dst_mass_mom_col is derived and added to the file"
f"> MarsVars 01336.atmos_average.nc -col dst_mass_mom\n"
f"{Blue}(derive and add dst_mass_mom_col to the file)"
f"{Nclr}\n\n"
)
)
Expand All @@ -333,8 +333,8 @@ def add_help(var_list):
f"A new a variable (``var_p``) (for prime) will be added to the"
f" file.\n"
f"{Green}Example:\n"
f"> MarsVars 01336.atmos_average.nc -zd temp"
f" {Blue}temp_p is derived and added to the file"
f"> MarsVars 01336.atmos_average.nc -zd temp\n"
f"{Blue}(temp_p is added to the file)"
f"{Nclr}\n\n"
)
)
Expand All @@ -347,7 +347,7 @@ def add_help(var_list):
f"file.\n"
f"{Green}Example:\n"
f"> MarsVars 01336.atmos_average.nc -to_dz temp\n"
f" {Blue}temp_dp_to_dz is derived and added to the file"
f"{Blue}(temp_dp_to_dz is added to the file)"
f"{Nclr}\n\n"
)
)
Expand All @@ -360,7 +360,7 @@ def add_help(var_list):
f"file.\n"
f"{Green}Example:\n"
f"> MarsVars 01336.atmos_average.nc -to_dp temp\n"
f" {Blue}temp_dz_to_dp is derived and added to the file"
f"{Blue}(temp_dz_to_dp is added to the file)"
f"{Nclr}\n\n"
)
)
Expand All @@ -379,10 +379,10 @@ def add_help(var_list):
f"Copy one or more variables from a file into a new file of "
f"the same name with the appended extension: '_extract'.\n"
f"{Green}Example:\n"
f"> MarsVars 01336.atmos_average.nc -extract ps temp"
f" {Blue}Creates 01336.atmos_average_extract.nc containing ps "
f"and temp as well as their dimensional variables (e.g., lat, "
f"lon, lev, etc.)"
f"> MarsVars 01336.atmos_average.nc -extract ps temp\n"
f"{Blue}(Creates 01336.atmos_average_extract.nc containing ps "
f"and temp\nplus their dimensional variables [lat, "
f"lon, lev, etc.])"
f"{Nclr}\n\n"
)
)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Install CAP from the `NASA Planetary Science GitHub <https://github.com/NASA-Pla

cp amescap/mars_templates/amescap_profile ~/.amescap_profile # For pip
# OR
cp opt/anaconda3/envs/amescap/mars_templates/amescap-profile ~/.amescap-profile # For conda
cp /opt/anaconda3/envs/amescap/mars_templates/amescap-profile ~/.amescap-profile # For conda

5. Test your installation
~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down