Skip to content

Commit

Permalink
Merge pull request #1091 from PCMDI/feature/1084_lee1043_MJO-xcdat
Browse files Browse the repository at this point in the history
MJO xcdat conversion
  • Loading branch information
lee1043 committed Jun 6, 2024
2 parents d2d7f4e + e9e3be0 commit b354fbe
Show file tree
Hide file tree
Showing 10 changed files with 328 additions and 262 deletions.
3 changes: 0 additions & 3 deletions pcmdi_metrics/mjo/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
from .debug_chk_plot import debug_chk_plot # noqa
from .dict_merge import dict_merge # noqa
from .lib_mjo import ( # noqa
Remove_dailySeasonalCycle,
calculate_ewr,
decorate_2d_array_axes,
generate_axes_and_decorate,
get_daily_ano_segment,
interp2commonGrid,
Expand All @@ -13,7 +11,6 @@
space_time_spectrum,
subSliceSegment,
taper,
unit_conversion,
write_netcdf_output,
)
from .mjo_metric_calc import mjo_metric_ewr_calculation # noqa
Expand Down
28 changes: 6 additions & 22 deletions pcmdi_metrics/mjo/lib/debug_chk_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,15 @@
import matplotlib.pyplot as plt
from cartopy.mpl.ticker import LatitudeFormatter, LongitudeFormatter

from pcmdi_metrics.io import get_latitude, get_longitude


def debug_chk_plot(d_seg_x_ano, Power, OEE, segment_year, daSeaCyc, segment_ano_year):
os.makedirs("debug", exist_ok=True)

""" FIX ME ---
x = vcs.init()
x.plot(d_seg_x_ano)
x.png('debug/d_seg_x_ano.png')
x.clear()
x.plot(Power)
x.png('debug/power.png')
x.clear()
x.plot(OEE)
x.png('debug/OEE.png')
"""

print("type(segment_year)", type(segment_year))
print("segment_year.shape:", segment_year.shape)
print(segment_year.getAxis(0))
print(segment_year.getAxis(1))
print(segment_year.getAxis(2))

plot_map(segment_year[0], "debug/segment.png")

print("type(daSeaCyc)", type(daSeaCyc))
Expand All @@ -35,16 +21,14 @@ def debug_chk_plot(d_seg_x_ano, Power, OEE, segment_year, daSeaCyc, segment_ano_

print("type(segment_ano_year)", type(segment_ano_year))
print("segment_ano_year.shape:", segment_ano_year.shape)
print(segment_ano_year.getAxis(0))
print(segment_ano_year.getAxis(1))
print(segment_ano_year.getAxis(2))

plot_map(segment_ano_year[0], "debug/segment_ano.png")


def plot_map(data, filename):
fig = plt.figure(figsize=(10, 6))
lons = data.getLongitude()
lats = data.getLatitude()
lons = get_longitude(data)
lats = get_latitude(data)
ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=180))
im = ax.contourf(lons, lats, data, transform=ccrs.PlateCarree(), cmap="viridis")
ax.coastlines()
Expand Down
Loading

0 comments on commit b354fbe

Please sign in to comment.