#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Wed Jul 5 14:55:35 EDT 2023 if __name__ == '__main__': import sys,os from misc.timer import Timer tt = Timer(f'[{os.getcwd()}] start ' + ' '.join(sys.argv)) import sys, os.path, os, glob, datetime import xarray as xr, numpy as np, pandas as pd, matplotlib.pyplot as plt #more imports wython = '/tigress/wenchang/wython' if wython not in sys.path: sys.path.append(wython); print('added to python path:', wython) #from misc import get_kws_from_argv from fig_scatter_predict_vs_actual import wyplot # if __name__ == '__main__': tt.check('end import') # #start from here forcings = ['co2x2', 'co2x4', 'co2xp5', 'co2xp25', 'p2p0solar', 'p6p0solar', 'm2p0solar', 'm6p0solar']#[:4] labels = ['2xCO2', '4xCO2', '0.5xCO2', '0.25xCO2', '$+2$% solar', '$+6$% solar', '$-2$% solar', '$-6$% solar']#[:4] forcingScales = [1, 2, -1, -2, 1, 3, -1, -3]#[:4] if __name__ == '__main__': from wyconfig import * #my plot settings figsize = 11, 5 fig, axes = plt.subplots(2, 4, figsize=figsize) for forcing,label,scale,ax in zip(forcings,labels,forcingScales,axes.flat): wyplot(forcing, label, scale, ax) for ax in axes[0,:]: ax.set_xlabel('') for ax in axes[1,:]: ax.set_xlabel('Actual precip change [%]') for ax in axes.flat: ax.set_ylabel('') for ax in axes.flat[0::4]: ax.set_ylabel('Predicted precip change [%]') for ax,label in zip(axes.flat, list('abcdefgh')): ax.text(0, 1, f' ({label})', ha='left', va='top', transform=ax.transAxes, fontsize='large') #savefig if 'savefig' in sys.argv or 's' in sys.argv: figname = __file__.replace('.py', f'.png') if 'overwritefig' in sys.argv or 'o' in sys.argv: wysavefig(figname, overwritefig=True) else: wysavefig(figname) tt.check(f'**Done**') print() if 'notshowfig' in sys.argv or 'n' in sys.argv: pass else: if 'plt' in globals(): plt.show()