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
13 changes: 12 additions & 1 deletion amescap/FV3_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,13 @@ def mass_stream(v_avg, lat, level, type="pstd", psfc=700, H=8000.,
.g. ⌡ f(z)dz = (Zn-Zn-1){f(Zn) + f(Zn-1)}/2
n-1
"""

reverting = False
if level[0] < level[-1]:
reverting = True
print("Reversing pstd array for mass stream function calculation...")
level = level[::-1]
v_avg = v_avg[::-1, ...]

g = 3.72 # m/s2
a = 3400*1000 # m
nlev = len(level)
Expand Down Expand Up @@ -1335,6 +1341,11 @@ def mass_stream(v_avg, lat, level, type="pstd", psfc=700, H=8000.,
MSF[mask] = np.nan
if isMasked:
MSF = np.ma.array(MSF, mask = mask)

if reverting:
print("Reversing pstd dimension of MSF array for compatibility...")
MSF = MSF[::-1, ...]

return MSF.reshape(shape_out)


Expand Down
1 change: 0 additions & 1 deletion amescap/Script_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,6 @@ def filter_vars(fNcdf, include_list=None, giveExclude=False):
else:
print(f"{Yellow}***Warning*** from filter_vars(): "
f"{ivar} not found in file.\n")
exit()

baseline_var = []
for ivar in var_list:
Expand Down
13 changes: 8 additions & 5 deletions bin/MarsInterp.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,6 @@ def main():

long_name_txt = getattr(fNcdf.variables[ivar], "long_name", "")
units_txt = getattr(fNcdf.variables[ivar], "units", "")
# long_name_txt=fNcdf.variables[ivar].long_name
# units_txt=fNcdf.variables[ivar].units)

if not do_diurn:
if "tile" in ifile:
Expand Down Expand Up @@ -538,13 +536,18 @@ def main():
fnew.copy_Ncaxis_with_content(fNcdf.variables[ivar])
else:
fnew.copy_Ncvar(fNcdf.variables[ivar])


with Dataset(newname, 'r') as nc_file:
# Print the global attributes of the NetCDF file
print(f"\nGlobal File Attributes for {newname}:")
for attr_name in nc_file.ncattrs():
print(f" {attr_name}: {getattr(nc_file, attr_name)}")

print("\r ", end="")
fNcdf.close()
fnew.close()
print(f"Completed in {(time.time() - start_time):3f} sec")



# ======================================================================
# END OF PROGRAM
# ======================================================================
Expand Down
2 changes: 1 addition & 1 deletion bin/MarsVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def wrapper(*args, **kwargs):
'msf': [
"Mass stream function",
'1.e8 kg/s',
['vcomp'],
['vcomp', 'temp'],
['pstd', 'zstd', 'zagl']
],
'mx': [
Expand Down
Loading