Commit 226b3046 authored by abuddenberg's avatar abuddenberg

Initial commit

parents
.DS_Store
.project
.pydevproject
src/Blah.py
src/Blah.pyc
dist/*/*.sum
dist/*/*.csv
data/*/*.nc
'''
Created on Nov 20, 2012
@author: abuddenberg
'''
DATA_DIR = '/Users/abuddenberg/workspace/plot_precip_maps/data/'
NA_PRECIP_FILES = [
(DATA_DIR + 'pr_rcp85_2071-2099_percent_change.nc_hatched_north_america_ar5_white.nc', 'pr_rcp85_2071-2099_NA_percent_change_grads15.eps'),
(DATA_DIR + 'pr_rcp26_2071-2099_percent_change.nc_hatched_north_america_ar5_white.nc', 'pr_rcp26_2071-2099_NA_percent_change_grads15.eps'),
(DATA_DIR + 'pr_sresa2_2071-2099_percent_change.nc_hatched_north_america_ar5_white.nc', 'pr_sresa2_2071-2099_NA_percent_change_grads15.eps')
]
GLOBAL_PRECIP_FILES = [
(DATA_DIR + 'pr_rcp26_2071-2099_percent_change.nc_hatched_global_ar5_white.nc', 'pr_rcp26_2071-2099_global_percent_change_grads15.eps'),
(DATA_DIR + 'pr_rcp85_2071-2099_percent_change.nc_hatched_global_ar5_white.nc', 'pr_rcp85_2071-2099_global_percent_change_grads15.eps')
]
HI_PRECIP_FILES = [
(DATA_DIR + 'pr_rcp85_2071-2099_percent_change.nc_hatched_north_america_ar5_white.nc', 'pr_rcp85_2071-2099_HI_percent_change_grads15.eps'),
(DATA_DIR + 'pr_rcp26_2071-2099_percent_change.nc_hatched_north_america_ar5_white.nc', 'pr_rcp26_2071-2099_HI_percent_change_grads15.eps'),
(DATA_DIR + 'pr_sresa2_2071-2099_percent_change.nc_hatched_north_america_ar5_white.nc', 'pr_sresa2_2071-2099_HI_percent_change_grads15.eps')
]
SEASONS = {
'Winter': ('DJF_percent_change', 'DJF_stipple'),
'Spring': ('MAM_percent_change', 'MAM_stipple'),
'Summer': ('JJA_percent_change', 'JJA_stipple'),
'Fall': ('SON_percent_change', 'SON_stipple')
}
\ No newline at end of file
File added
'''
Created on Nov 21, 2012
@author: abuddenberg
'''
from scipy.io.netcdf import netcdf_file
from mpl_toolkits.basemap import Basemap
from numpy import meshgrid
import matplotlib.pyplot as plt
from config import GLOBAL_PRECIP_FILES, SEASONS
for infilename, outfilename in GLOBAL_PRECIP_FILES:
nc = netcdf_file(infilename)
lat_data = nc.variables['lat'].data
lon_data = nc.variables['lon'].data
fig = plt.figure(figsize=(25,16), dpi=100, tight_layout=True)
for i, season in enumerate(['Winter', 'Spring', 'Summer', 'Fall']):
data_var, signif_var = SEASONS[season]
data = nc.variables[data_var].data
signif = nc.variables[signif_var].data
ax = fig.add_subplot(221 + i)
plt.title(season)
m = Basemap(
projection='eck4',
lon_0=0,
resolution='l',area_thresh=10000
)
m.drawcoastlines()
# m.drawstates()
m.drawcountries()
lons, lats = meshgrid(lon_data, lat_data)
x,y = m(lons, lats)
levels_15 = [-45, -30, -15, 0, 15, 30, 45]
levels_10 = [-30, -20, -10, 0, 10, 20, 30]
prcp = m.contourf(x, y, data, cmap=plt.get_cmap('BrBG'), levels=levels_15, extend='both')
m.colorbar(prcp, location='bottom',pad="5%")
hatching = m.contourf(x,y, signif, 1, colors='none',hatches=[None, '//'])
# m.colorbar(hatching,location='right',pad="5%")
plt.savefig('../dist/' + outfilename, format='eps', dpi=200)
# plt.show()
\ No newline at end of file
'''
Created on Nov 27, 2012
@author: abuddenberg
'''
from scipy.io.netcdf import netcdf_file
from mpl_toolkits.basemap import Basemap
from numpy import meshgrid
import matplotlib.pyplot as plt
from config import HI_PRECIP_FILES, SEASONS
for infilename, outfilename in HI_PRECIP_FILES:
nc = netcdf_file(infilename)
lat_data = nc.variables['lat'].data
lon_data = nc.variables['lon'].data - 360.
fig = plt.figure(figsize=(25,16), dpi=100, tight_layout=True)
for i, season in enumerate(['Winter', 'Spring', 'Summer', 'Fall']):
data_var, signif_var = SEASONS[season]
data = nc.variables[data_var].data
signif = nc.variables[signif_var].data
ax = fig.add_subplot(221 + i)
plt.title(season)
m = Basemap(
projection='aea',
lon_0=-96,
lat_0=37.5,
lat_1=29.5,
lat_2=45.5,
# lat_ts=median(lats),
llcrnrlat=10,
urcrnrlat=40,
llcrnrlon=-160,
urcrnrlon=-158,
resolution='l',area_thresh=1
)
m.drawcoastlines()
m.drawstates()
m.drawcountries()
lons, lats = meshgrid(lon_data, lat_data)
x,y = m(lons, lats)
levels_15 = [-45, -30, -15, 0, 15, 30, 45]
levels_10 = [-30, -20, -10, 0, 10, 20, 30]
prcp = m.contourf(x, y, data, cmap=plt.get_cmap('BrBG'), levels=levels_15, extend='both')
m.colorbar(prcp, location='bottom',pad="5%")
hatching = m.contourf(x,y, signif, 1, colors='none',hatches=[None, '//'])
# m.colorbar(hatching,location='right',pad="5%")
plt.savefig('../dist/' + outfilename, format='eps', dpi=200)
# plt.show()
\ No newline at end of file
'''
Created on Nov 16, 2012
@author: abuddenberg
'''
from scipy.io.netcdf import netcdf_file
from mpl_toolkits.basemap import Basemap
from numpy import meshgrid
import matplotlib.pyplot as plt
from config import NA_PRECIP_FILES, SEASONS
for infilename, outfilename in NA_PRECIP_FILES:
nc = netcdf_file(infilename)
lat_data = nc.variables['lat'].data
lon_data = nc.variables['lon'].data - 360.
fig = plt.figure(figsize=(25,16), dpi=100, tight_layout=True)
for i, season in enumerate(['Winter', 'Spring', 'Summer', 'Fall']):
data_var, signif_var = SEASONS[season]
data = nc.variables[data_var].data
signif = nc.variables[signif_var].data
ax = fig.add_subplot(221 + i)
plt.title(season)
m = Basemap(
projection='aea',
lon_0=-96,
lat_0=37.5,
lat_1=29.5,
lat_2=45.5,
# lat_ts=median(lats),
llcrnrlat=12,
urcrnrlat=80,
llcrnrlon=-135,
urcrnrlon=-25,
resolution='l',area_thresh=10000
)
m.drawcoastlines()
m.drawstates()
m.drawcountries()
lons, lats = meshgrid(lon_data, lat_data)
x,y = m(lons, lats)
levels_15 = [-45, -30, -15, 0, 15, 30, 45]
levels_10 = [-30, -20, -10, 0, 10, 20, 30]
prcp = m.contourf(x, y, data, cmap=plt.get_cmap('BrBG'), levels=levels_15, extend='both')
m.colorbar(prcp, location='bottom',pad="5%")
hatching = m.contourf(x,y, signif, 1, colors='none',hatches=[None, '//'])
# m.colorbar(hatching,location='right',pad="5%")
plt.savefig('../dist/' + outfilename, format='eps', dpi=200)
# plt.show()
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment