Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lee1043 committed May 1, 2024
1 parent 680dd7c commit 8236449
Show file tree
Hide file tree
Showing 5 changed files with 315 additions and 119 deletions.
20 changes: 13 additions & 7 deletions pcmdi_metrics/mjo/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,26 @@
from .dict_merge import dict_merge # noqa
from .lib_mjo import ( # noqa
Remove_dailySeasonalCycle,
calculate_ewr,
# calculate_ewr,
calculate_ewr_xcdat,
decorate_2d_array_axes,
generate_axes_and_decorate,
get_daily_ano_segment,
#interp2commonGrid,
# generate_axes_and_decorate,
generate_axes_and_decorate_xcdat,
# get_daily_ano_segment,
get_daily_ano_segment_xcdat,
# interp2commonGrid,
interp2commonGrid_xcdat,
mjo_metrics_to_json,
output_power_spectra,
space_time_spectrum,
# output_power_spectra,
output_power_spectra_xcdat,
# space_time_spectrum,
space_time_spectrum_xcdat,
# subSliceSegment,
subSliceSegment_xcdat,
taper,
unit_conversion,
write_netcdf_output,
# write_netcdf_output,
write_netcdf_output_xcdat,
)
from .mjo_metric_calc import mjo_metric_ewr_calculation # noqa
from .plot_wavenumber_frequency_power import plot_power # noqa
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 8236449

Please sign in to comment.