#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Thu Oct 3 11:13:36 EDT 2019 from datetime import datetime import os.path, sys, os import xarray as xr, numpy as np, pandas as pd import matplotlib.pyplot as plt from misc.cim import cim plt.close() basin = 'NA'#'global'# 'NA' figname = f'fig.tcCounts.volcBG.{basin}.png' figsize = (8, 4)#None fig = plt.figure(figsize=figsize) years = range(1,6) xticks = None#years ylabel = f'# of {basin} TCs' xlabel = 'year' alpha = 0.3 capsize = 5 fmt = 'o' volc = 'CTL' color = 'k' ifile = '/tigress/wenchang/analysis/TC/CTL1860_v201904_tigercpu_intelmpi_18_576PE/netcdf/tc_counts.0801-0850.yearly.nc' da = xr.open_dataset(ifile)[basin] da.plot(color=color, label=volc) volc = 'volcBG' color = 'C0' ifile = '/tigress/wenchang/analysis/TC/CTL1860_volcBG_tigercpu_intelmpi_18_576PE/netcdf/tc_counts.0801-0850.yearly.nc' da = xr.open_dataset(ifile)[basin] da.plot(color=color, label=volc) if xticks is not None: plt.xticks(xticks) if ylabel is not None: plt.ylabel(ylabel) if xlabel is not None: plt.xlabel(xlabel) #plt.legend(ncol=4, bbox_to_anchor=(0, 1), loc='lower left') plt.legend(ncol=4, loc='best') if figname is not None: plt.tight_layout() plt.savefig(figname) plt.show()