#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Sat Feb 13 13:34:41 EST 2021 if __name__ == '__main__': from misc.timer import Timer tt = Timer(f'start {__file__}') import sys, os.path, os, glob, datetime import xarray as xr, numpy as np, pandas as pd import matplotlib.pyplot as plt #more imports import salem # if __name__ == '__main__': tt.check('end import') # #start from here dfsh= salem.read_shapefile('chn_admbnda_adm1_ocha/chn_admbnda_adm1_ocha.shp') ofile = __file__.replace('.py', '.csv') if os.path.exists(ofile): print('[exists]:', ofile) sys.exit() cols = list(dfsh.columns) cols.remove('geometry') dfsh[cols].to_csv(ofile) print('[saved]:', ofile) if __name__ == '__main__': #from wyconfig import * #my plot settings figname = __file__.replace('.py', f'_{tt.today()}.png') if len(sys.argv) > 1 and sys.argv[1] == 'savefig': plt.savefig(figname) print('[saved]:', figname) tt.check(f'**Done**') #plt.show()