#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Thu Aug 20 17:12:52 EDT 2020 if __name__ == '__main__': from misc.timer import Timer tt = Timer(f'start {__file__}') import sys, os.path, os, glob import xarray as xr, numpy as np, pandas as pd #import matplotlib.pyplot as plt #more imports # if __name__ == '__main__': tt.check('end import') # #start from here ifile = 'q2m.validate.2019.nc' vmax = 4e-3 levels = 21 cmap = 'BrBG' extend = 'both'#'neither' if __name__ == '__main__': from wyconfig import * #my plot settings from geoplots import mapplot with xr.open_dataset(ifile) as ds: for month in range(1, 13): plt.figure() ds.anom_true.isel(time=month-1).plot(vmax=vmax, levels=levels, cmap=cmap, extend=extend) mapplot() figname = __file__.replace('.py', f'_mon{month:02d}_anomTrue_{tt.today()}.png') plt.savefig(figname) print('[saved]:', figname) plt.figure() ds.anom.isel(time=month-1).plot(vmax=vmax, levels=levels, cmap=cmap, extend=extend) mapplot() figname = __file__.replace('.py', f'_mon{month:02d}_anom_{tt.today()}.png') plt.savefig(figname) print('[saved]:', figname) tt.check(f'**Done**') #plt.show()