Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
plot-precip-maps
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Andrew Buddenberg
plot-precip-maps
Commits
f4287641
Commit
f4287641
authored
Dec 04, 2012
by
abuddenberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some copypasta removed; config file refactored. I feel a rollback in my future
parent
30d07d40
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
25 additions
and
106 deletions
+25
-106
src/config.py
src/config.py
+5
-32
src/plot_global_annual_precip.py
src/plot_global_annual_precip.py
+0
-49
src/plot_global_categories.py
src/plot_global_categories.py
+3
-3
src/plot_global_precip.py
src/plot_global_precip.py
+2
-2
src/plot_hawaii_precip.py
src/plot_hawaii_precip.py
+5
-7
src/plot_north_american_annual.py
src/plot_north_american_annual.py
+4
-5
src/plot_north_american_categories.py
src/plot_north_american_categories.py
+4
-4
src/plot_north_american_precip.py
src/plot_north_american_precip.py
+2
-4
No files found.
src/config.py
View file @
f4287641
...
...
@@ -6,44 +6,17 @@ Created on Nov 20, 2012
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
.eps'
),
(
DATA_DIR
+
'pr_rcp26_2071-2099_percent_change.nc_hatched_north_america_ar5_white.nc'
,
'pr_rcp26_2071-2099_NA_
percent_change
.eps'
),
(
DATA_DIR
+
'pr_sresa2_2071-2099_percent_change.nc_hatched_north_america_ar5_white.nc'
,
'pr_sresa2_2071-2099_NA_
percent_change
.eps'
)
(
DATA_DIR
+
'pr_rcp85_2071-2099_percent_change.nc_hatched_north_america_ar5_white.nc'
,
'pr_rcp85_2071-2099_NA_
{}
.eps'
),
(
DATA_DIR
+
'pr_rcp26_2071-2099_percent_change.nc_hatched_north_america_ar5_white.nc'
,
'pr_rcp26_2071-2099_NA_
{}
.eps'
),
(
DATA_DIR
+
'pr_sresa2_2071-2099_percent_change.nc_hatched_north_america_ar5_white.nc'
,
'pr_sresa2_2071-2099_NA_
{}
.eps'
)
]
NA_ANNUAL_PRECIP_FILES
=
[
(
DATA_DIR
+
'pr_rcp26_2071-2099_percent_change-1.nc_hatched_global_ar5_white.nc'
,
'pr_rcp26_2071-2099_NA_annual_percent_change.eps'
),
(
DATA_DIR
+
'pr_rcp85_2071-2099_percent_change-1.nc_hatched_global_ar5_white.nc'
,
'pr_rcp85_2071-2099_NA_annual_percent_change.eps'
),
]
GLOBAL_ANNUAL_PRECIP_FILES
=
[
(
DATA_DIR
+
'pr_rcp26_2071-2099_percent_change-1.nc_hatched_global_ar5_white.nc'
,
'pr_rcp26_2071-2099_global_annual_percent_change.eps'
),
(
DATA_DIR
+
'pr_rcp85_2071-2099_percent_change-1.nc_hatched_global_ar5_white.nc'
,
'pr_rcp85_2071-2099_global_annual_percent_change.eps'
)
]
GLOBAL_CATEGORY_FILES
=
[
(
DATA_DIR
+
'pr_rcp26_2071-2099_percent_change-1.nc_hatched_global_ar5_white.nc'
,
'pr_rcp26_2071-2099_global_annual_categories.eps'
),
(
DATA_DIR
+
'pr_rcp85_2071-2099_percent_change-1.nc_hatched_global_ar5_white.nc'
,
'pr_rcp85_2071-2099_global_annual_categories.eps'
)
]
NA_CATEGORY_FILES
=
[
(
DATA_DIR
+
'pr_rcp85_2071-2099_percent_change.nc_hatched_north_america_ar5_white.nc'
,
'pr_rcp85_2071-2099_NA_percent_change_categories.eps'
),
(
DATA_DIR
+
'pr_rcp26_2071-2099_percent_change.nc_hatched_north_america_ar5_white.nc'
,
'pr_rcp26_2071-2099_NA_percent_change_categories.eps'
),
(
DATA_DIR
+
'pr_sresa2_2071-2099_percent_change.nc_hatched_north_america_ar5_white.nc'
,
'pr_sresa2_2071-2099_NA_percent_change_categories.eps'
)
]
GLOBAL_PRECIP_FILES
=
[
(
DATA_DIR
+
'pr_rcp26_2071-2099_percent_change-1.nc_hatched_global_ar5_white.nc'
,
'pr_rcp26_2071-2099_global_
percent_change_grads15
.eps'
),
(
DATA_DIR
+
'pr_rcp85_2071-2099_percent_change-1.nc_hatched_global_ar5_white.nc'
,
'pr_rcp85_2071-2099_global_
percent_change_grads15
.eps'
)
(
DATA_DIR
+
'pr_rcp26_2071-2099_percent_change-1.nc_hatched_global_ar5_white.nc'
,
'pr_rcp26_2071-2099_global_
{}
.eps'
),
(
DATA_DIR
+
'pr_rcp85_2071-2099_percent_change-1.nc_hatched_global_ar5_white.nc'
,
'pr_rcp85_2071-2099_global_
{}
.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
=
{
'Annual'
:
(
'annual_percent_change'
,
'annual_stipple'
),
...
...
src/plot_global_annual_precip.py
deleted
100644 → 0
View file @
30d07d40
'''
Created on Nov 30, 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_ANNUAL_PRECIP_FILES
,
SEASONS
for
infilename
,
outfilename
in
GLOBAL_ANNUAL_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
)
data
=
nc
.
variables
[
'annual_percent_change'
].
data
signif
=
nc
.
variables
[
'annual_stipple'
].
data
plt
.
title
(
'Annual'
)
m
=
Basemap
(
projection
=
'eck4'
,
lon_0
=
0
,
resolution
=
'l'
,
area_thresh
=
10000
)
m
.
drawcoastlines
()
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_10
,
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
src/plot_global_categories.py
View file @
f4287641
...
...
@@ -10,9 +10,9 @@ from numpy.ma import masked_equal
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
config
import
GLOBAL_
CATEGORY
_FILES
from
config
import
GLOBAL_
PRECIP
_FILES
for
infilename
,
outfilename
in
GLOBAL_
CATEGORY
_FILES
:
for
infilename
,
outfilename
in
GLOBAL_
PRECIP
_FILES
:
nc
=
netcdf_file
(
infilename
)
lat_data
=
nc
.
variables
[
'lat'
].
data
...
...
@@ -66,5 +66,5 @@ for infilename, outfilename in GLOBAL_CATEGORY_FILES:
# print np.any(np.logical_and(third_cat_mask, stipples_mask))
plt
.
savefig
(
'../dist/'
+
outfilename
,
format
=
'eps'
,
dpi
=
200
)
plt
.
savefig
(
'../dist/'
+
outfilename
.
format
(
'categories'
)
,
format
=
'eps'
,
dpi
=
200
)
# plt.show()
\ No newline at end of file
src/plot_global_precip.py
View file @
f4287641
...
...
@@ -55,5 +55,5 @@ for infilename, outfilename in GLOBAL_PRECIP_FILES:
# m.colorbar(hatching,location='right',pad="5%")
# plt.savefig('../dist/' + outfilename, format='eps', dpi=200)
plt
.
show
()
\ No newline at end of file
plt
.
savefig
(
'../dist/'
+
outfilename
.
format
(
'percent_change'
),
format
=
'eps'
,
dpi
=
200
)
# plt.show()
\ No newline at end of file
src/plot_hawaii_precip.py
View file @
f4287641
...
...
@@ -8,13 +8,13 @@ from mpl_toolkits.basemap import Basemap
from
numpy
import
meshgrid
import
matplotlib.pyplot
as
plt
from
config
import
HI
_PRECIP_FILES
,
SEASONS
from
config
import
NA
_PRECIP_FILES
,
SEASONS
for
infilename
,
outfilename
in
HI
_PRECIP_FILES
:
for
infilename
,
outfilename
in
NA
_PRECIP_FILES
:
nc
=
netcdf_file
(
infilename
)
lat_data
=
nc
.
variables
[
'lat'
].
data
lon_data
=
nc
.
variables
[
'lon'
].
data
-
360.
lon_data
=
nc
.
variables
[
'lon'
].
data
fig
=
plt
.
figure
(
figsize
=
(
25
,
16
),
dpi
=
100
,
tight_layout
=
True
)
...
...
@@ -47,16 +47,14 @@ for infilename, outfilename in HI_PRECIP_FILES:
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_1
5
,
extend
=
'both'
)
prcp
=
m
.
contourf
(
x
,
y
,
data
,
cmap
=
plt
.
get_cmap
(
'BrBG'
),
levels
=
levels_1
0
,
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
.
savefig
(
'../dist/'
+
outfilename
.
format
(
'HI_percent_change'
)
,
format
=
'eps'
,
dpi
=
200
)
# plt.show()
\ No newline at end of file
src/plot_north_american_annual.py
View file @
f4287641
...
...
@@ -8,13 +8,13 @@ from mpl_toolkits.basemap import Basemap
from
numpy
import
meshgrid
import
matplotlib.pyplot
as
plt
from
config
import
NA_ANNU
AL_PRECIP_FILES
,
SEASONS
from
config
import
GLOB
AL_PRECIP_FILES
,
SEASONS
for
infilename
,
outfilename
in
NA_ANNU
AL_PRECIP_FILES
:
for
infilename
,
outfilename
in
GLOB
AL_PRECIP_FILES
:
nc
=
netcdf_file
(
infilename
)
lat_data
=
nc
.
variables
[
'lat'
].
data
lon_data
=
nc
.
variables
[
'lon'
].
data
-
360.
lon_data
=
nc
.
variables
[
'lon'
].
data
fig
=
plt
.
figure
(
figsize
=
(
25
,
16
),
dpi
=
100
,
tight_layout
=
True
)
...
...
@@ -54,6 +54,5 @@ for infilename, outfilename in NA_ANNUAL_PRECIP_FILES:
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
.
savefig
(
'../dist/'
+
outfilename
.
format
(
'annual_percent_change'
),
format
=
'eps'
,
dpi
=
200
)
# plt.show()
\ No newline at end of file
src/plot_north_american_categories.py
View file @
f4287641
...
...
@@ -24,13 +24,13 @@ from numpy.ma import masked_equal
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
config
import
GLOBAL_
ANNUAL_
PRECIP_FILES
,
SEASONS
from
config
import
GLOBAL_PRECIP_FILES
,
SEASONS
for
infilename
,
outfilename
in
GLOBAL_
ANNUAL_
PRECIP_FILES
:
for
infilename
,
outfilename
in
GLOBAL_PRECIP_FILES
:
nc
=
netcdf_file
(
infilename
)
lat_data
=
nc
.
variables
[
'lat'
].
data
lon_data
=
nc
.
variables
[
'lon'
].
data
-
360.
lon_data
=
nc
.
variables
[
'lon'
].
data
fig
=
plt
.
figure
(
figsize
=
(
25
,
16
),
dpi
=
100
,
tight_layout
=
True
)
...
...
@@ -91,6 +91,6 @@ for infilename, outfilename in GLOBAL_ANNUAL_PRECIP_FILES:
# print np.any(np.logical_and(third_cat_mask, stipples_mask))
plt
.
savefig
(
'../dist/'
+
outfilename
+
'.test.eps'
,
format
=
'eps'
,
dpi
=
200
)
plt
.
savefig
(
'../dist/'
+
outfilename
.
format
(
'north_american_categories'
)
,
format
=
'eps'
,
dpi
=
200
)
# plt.show()
src/plot_north_american_precip.py
View file @
f4287641
...
...
@@ -21,7 +21,7 @@ for infilename, outfilename in NA_PRECIP_FILES:
nc
=
netcdf_file
(
infilename
)
lat_data
=
nc
.
variables
[
'lat'
].
data
lon_data
=
nc
.
variables
[
'lon'
].
data
-
360.
lon_data
=
nc
.
variables
[
'lon'
].
data
fig
=
plt
.
figure
(
figsize
=
(
25
,
16
),
dpi
=
100
,
tight_layout
=
True
)
...
...
@@ -54,8 +54,6 @@ for infilename, outfilename in NA_PRECIP_FILES:
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_10
,
extend
=
'both'
)
...
...
@@ -65,5 +63,5 @@ for infilename, outfilename in NA_PRECIP_FILES:
# m.colorbar(hatching,location='right',pad="5%")
plt
.
savefig
(
'../dist/'
+
outfilename
,
format
=
'eps'
,
dpi
=
200
)
plt
.
savefig
(
'../dist/'
+
outfilename
.
format
(
'percent_change'
)
,
format
=
'eps'
,
dpi
=
200
)
# plt.show()
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment