#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Tue May 16 14:19:24 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 # if __name__ == '__main__': tt.check('end import') # #start from here ifile = 'zsurf_AM2.5C360_amipHadISSTrcp45_tigercpu_intelmpi_18_1080PE_ens16_1871-1871_AfricanCities.nc' da = xr.open_dataarray(ifile) if __name__ == '__main__': from wyconfig import * #my plot settings from geoplots import mapplot plt.scatter(da.lon.where(da.lon<180, other=da.lon-360), da.lat, c=da, cmap='turbo') mapplot() plt.colorbar(label='elevation [m]') #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()