Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jared Rennie
cpo_drought
Commits
d11bd0fd
Commit
d11bd0fd
authored
Jul 23, 2021
by
Jared Rennie
Browse files
fixed joined to match FIPS codes from UNMC team
parent
f12ac32c
Changes
2
Show whitespace changes
Inline
Side-by-side
plot_spei.py
View file @
d11bd0fd
...
@@ -93,6 +93,12 @@ result=gpd.sjoin(geo_shapefile,geo_grid,how="inner", op="intersects")
...
@@ -93,6 +93,12 @@ result=gpd.sjoin(geo_shapefile,geo_grid,how="inner", op="intersects")
# Take the Aggregate Mean By County
# Take the Aggregate Mean By County
result_mean
=
result
.
groupby
([
'GEOID'
],
as_index
=
False
).
mean
()[[
'GEOID'
,
inCode0
]]
result_mean
=
result
.
groupby
([
'GEOID'
],
as_index
=
False
).
mean
()[[
'GEOID'
,
inCode0
]]
# Join Results with CONUS Counties, to reconcile missing counties during Spatial Join
conus_counties
=
pd
.
read_csv
(
main_directory
+
'/counties.csv'
)
conus_counties
[
'GEOID'
]
=
conus_counties
[
'GEOID'
].
astype
(
str
).
apply
(
lambda
x
:
x
.
zfill
(
5
))
merge_conus
=
conus_counties
.
merge
(
result_mean
,
on
=
'GEOID'
,
how
=
'left'
)
result_mean
=
merge_conus
# Insert and Reformat Columns
# Insert and Reformat Columns
result_mean
=
result_mean
.
rename
(
columns
=
{
inCode0
:
inCode1
})
result_mean
=
result_mean
.
rename
(
columns
=
{
inCode0
:
inCode1
})
result_mean
[
inCode1
]
=
result_mean
[
inCode1
].
round
(
decimals
=
1
)
result_mean
[
inCode1
]
=
result_mean
[
inCode1
].
round
(
decimals
=
1
)
...
...
plot_spi.py
View file @
d11bd0fd
...
@@ -93,6 +93,12 @@ result=gpd.sjoin(geo_shapefile,geo_grid,how="inner", op="intersects")
...
@@ -93,6 +93,12 @@ result=gpd.sjoin(geo_shapefile,geo_grid,how="inner", op="intersects")
# Take the Aggregate Mean By County
# Take the Aggregate Mean By County
result_mean
=
result
.
groupby
([
'GEOID'
],
as_index
=
False
).
mean
()[[
'GEOID'
,
inCode0
]]
result_mean
=
result
.
groupby
([
'GEOID'
],
as_index
=
False
).
mean
()[[
'GEOID'
,
inCode0
]]
# Join Results with CONUS Counties, to reconcile missing counties during Spatial Join
conus_counties
=
pd
.
read_csv
(
main_directory
+
'/counties.csv'
)
conus_counties
[
'GEOID'
]
=
conus_counties
[
'GEOID'
].
astype
(
str
).
apply
(
lambda
x
:
x
.
zfill
(
5
))
merge_conus
=
conus_counties
.
merge
(
result_mean
,
on
=
'GEOID'
,
how
=
'left'
)
result_mean
=
merge_conus
# Insert and Reformat Columns
# Insert and Reformat Columns
result_mean
=
result_mean
.
rename
(
columns
=
{
inCode0
:
inCode1
})
result_mean
=
result_mean
.
rename
(
columns
=
{
inCode0
:
inCode1
})
result_mean
[
inCode1
]
=
result_mean
[
inCode1
].
round
(
decimals
=
1
)
result_mean
[
inCode1
]
=
result_mean
[
inCode1
].
round
(
decimals
=
1
)
...
...
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