This is a preliminary visualization of the SHARP setup for PNW.

MetSim -> SUMMA -> MizuRoute

Temporal plots

library(rgdal)
library(ggplot2)
library(dplyr)
library(ncdf4)
library(RColorBrewer)
library(data.table)
pnw <-readOGR(dsn ="/glade/p/work/manab/SHARP/shapefiles/naokifiles/", layer = 'Region_17_merged_hru')

Inputs

ncdat <- nc_open('/glade/p/work/manab/SHARP/PNW_3L/output/20100601_20161231_fulldomain_NOV6_concat/ncfinal.nc')
timeStep <- 365*8
pptrate <- ncdf4::ncvar_get(ncdat, 'pptrate')[,timeStep]*3600 #For one time step and all HRUs. mm/hr
airtemp <- ncdf4::ncvar_get(ncdat, 'airtemp')[,timeStep] #Kelvin
scalarSWE <- ncdf4::ncvar_get(ncdat, 'scalarSWE')[,timeStep] #kg m-2
scalarSoilDrainage <- ncdf4::ncvar_get(ncdat, 'scalarSoilDrainage')[,timeStep] #m s-1
hru_id2 <- ncdf4::ncvar_get(ncdat, 'hruId') #For one time step and all HRUs

ncdf <- data.frame(hru_id2, pptrate, airtemp, scalarSWE, scalarSoilDrainage)

pnwmer <- merge(pnw, ncdf, by='hru_id2') #Merging into shapefile
my.palette <- brewer.pal(n = 11, name = "Spectral")

pnwmer1 = subset(pnwmer, pptrate != 9999) # remove the basins with no PPT values
pnwmer2 = subset(pnwmer, scalarSoilDrainage != -9999) # remove the basins with no SoilDrainage values
pnwmer3 = subset(pnwmer, airtemp != -9999)
png("pptrate.png")
spplot(pnwmer1, col.regions = my.palette, "pptrate", cuts = 10, main = "pptrate")
dev.off()


msaharia/rsumma documentation built on May 17, 2019, 12:14 p.m.