-
Notifications
You must be signed in to change notification settings - Fork 3
/
zips_tmean.R
32 lines (24 loc) · 868 Bytes
/
zips_tmean.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# This script will:
# load raster file for particular year
# load shapefile
# isolate each ZIP Code's data in raster via shapefile and then find area-weighted mean
# output result
# Robbie M Parks 2022
rm(list=ls())
# declare root directory, folder locations and load essential stuff
project.folder = paste0(print(here::here()),'/')
# arguments from Rscript
args = commandArgs(trailingOnly=TRUE)
seed.arg = as.numeric(args[1])
# create grid of years an countries
source(paste0(project.folder,'data/objects/objects.R'))
seed.grid = expand.grid(state=states, year=years_total_tmean)
chosen.row = seed.grid[seed.arg,]
# year of interest
year = as.numeric(chosen.row[1,2])
dname = 'tmean'
time.res = 'daily'
space.res = 'zip'
state = as.character(chosen.row[1,1])
# process from grids into shapefiles
source('prog/02_grid_county_intersection/processing_code.R')