Skip to content

Commit

Permalink
Extraction scripts for Xue and Zhang datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
acrunyon committed Feb 23, 2023
1 parent 64da9b9 commit 3dbb3e3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ vignettes/*.pdf
.Renviron

*.Rproj
data/
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ Climate data were provided by Dr. Abby Frazier in 2022. Descriptions of the data
* Only 1 Cf
* Rain and T2

- Right now Xue doesn't add anything from Zhang. Try getting daily files from NCAR

14 changes: 14 additions & 0 deletions Xue_extraction.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
library(tidyr)
library(dplyr)
library(ncdf4)
library(stars)
library(raster)
library(here)

DataDir <- "D:/HI_Data/Xue/"

Xue <- read_ncdf(paste0(DataDir,"hist_mean_rain.nc"))

nc<-nc_open(paste0(DataDir,"hist_mean_rain.nc"))
nc$dim

25 changes: 25 additions & 0 deletions Zhang_extraction.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
library(tidyr)
library(dplyr)
library(ncdf4)
library(stars)
library(raster)
library(here)

DataDir <- "D:/HI_Data/Zhang/"

test.tif <- raster("D:/HI_Data/Zhang/Processed/HI_Downscaling_Share/DynDS_RainfallTIF_AllFolders/DynDS_7MonthlyTIF_byIsland_250m/Maui/present/ma_rf_pres_1990_01_250m.tif")
plot(test.tif)
crs(test.tif)

boundary <- st_read('./data/HALE/HALE_boundary.shp')
boundary <- st_transform(boundary, st_crs(test.tif))

plot(test.tif)
plot(boundary[1])

t<-mask(test.tif,boundary)
plot(t)

Zhang <- read_stars("D:/HI_Data/Zhang/Processed/HI_Downscaling_Share/DynDS_RainfallTIF_AllFolders/DynDS_7MonthlyTIF_byIsland_250m/Maui/present/ma_rf_pres_1990_01_250m.tif")
Zhang
plot(Zhang)

0 comments on commit 3dbb3e3

Please sign in to comment.