names(wsim_gldas_anoms)
[1] "deficit" "deficit_cause" "surplus" "surplus_cause"
[5] "both"
<- wsim_gldas_anoms['both'] wsim_gldas_anoms
<- wsim_gldas_anoms['deficit'] wsim_gldas_anoms
diff --git a/docs/wsim-gldas-acquisition.html b/docs/wsim-gldas-acquisition.html index 7cb732f..4eebd0a 100644 --- a/docs/wsim-gldas-acquisition.html +++ b/docs/wsim-gldas-acquisition.html @@ -2,7 +2,7 @@
- + @@ -23,7 +23,7 @@ } pre > code.sourceCode { white-space: pre; position: relative; } -pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } +pre > code.sourceCode > span { line-height: 1.25; } pre > code.sourceCode > span:empty { height: 1.2em; } .sourceCode { overflow: visible; } code.sourceCode > span { color: inherit; text-decoration: inherit; } @@ -145,6 +145,17 @@ } } + function dashboardOffset() { + const dashboardNavEl = window.document.getElementById( + "quarto-dashboard-header" + ); + if (dashboardNavEl !== null) { + return dashboardNavEl.clientHeight; + } else { + return 0; + } + } + function updateDocumentOffsetWithoutAnimation() { updateDocumentOffset(false); } @@ -152,7 +163,7 @@ function updateDocumentOffset(animated) { // set body offset const topOffset = headerOffset(); - const bodyOffset = topOffset + footerOffset(); + const bodyOffset = topOffset + footerOffset() + dashboardOffset(); const bodyEl = window.document.body; bodyEl.setAttribute("data-bs-offset", topOffset); bodyEl.style.paddingTop = topOffset + "px"; @@ -265,9 +276,9 @@ // Observe size changed for the header const headerEl = window.document.querySelector("header.fixed-top"); if (headerEl && window.ResizeObserver) { - const observer = new window.ResizeObserver( - updateDocumentOffsetWithoutAnimation - ); + const observer = new window.ResizeObserver(() => { + setTimeout(updateDocumentOffsetWithoutAnimation, 0); + }); observer.observe(headerEl, { attributes: true, childList: true, @@ -293,7 +304,7 @@ // Fixup any sharing links that require urls // Append url to any sharing urls const sharingLinks = window.document.querySelectorAll( - "a.sidebar-tools-main-item" + "a.sidebar-tools-main-item, a.quarto-navigation-tool, a.quarto-navbar-tools, a.quarto-navbar-tools-item" ); for (let i = 0; i < sharingLinks.length; i++) { const sharingLink = sharingLinks[i]; @@ -343,8 +354,8 @@ * Licensed MIT © Zeno Rocha */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return n={686:function(t,e,n){"use strict";n.d(e,{default:function(){return b}});var e=n(279),i=n.n(e),e=n(370),u=n.n(e),e=n(817),r=n.n(e);function c(t){try{return document.execCommand(t)}catch(t){return}}var a=function(t){t=r()(t);return c("cut"),t};function o(t,e){var n,o,t=(n=t,o="rtl"===document.documentElement.getAttribute("dir"),(t=document.createElement("textarea")).style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[o?"right":"left"]="-9999px",o=window.pageYOffset||document.documentElement.scrollTop,t.style.top="".concat(o,"px"),t.setAttribute("readonly",""),t.value=n,t);return e.container.appendChild(t),e=r()(t),c("copy"),t.remove(),e}var f=function(t){var e=1# proxy = TRUE will limit memory useage but does
# not always work with certain downstream processing functions
-<- stars::read_stars("composite_anom_1mo.nc", proxy = FALSE) wsim_gldas_anoms
deficit, deficit_cause, surplus, surplus_cause, both,
stars object with 3 dimensions and 5 attributes
attribute(s), summary of first 1e+05 cells:
- Min. 1st Qu. Median Mean 3rd Qu. Max.
-deficit -100 -1.8314584 -0.2373874 -1.26453645 -0.2373874 1.896493
-deficit_cause 1 129.0000000 129.0000000 112.90956000 129.0000000 129.000000
-surplus -100 -0.9671488 -0.7329655 -0.95631468 -0.6206152 2.384447
-surplus_cause 1 129.0000000 129.0000000 127.37130000 129.0000000 129.000000
-both 0 0.0000000 0.0000000 0.03784493 0.0000000 2.384447
- NA's
-deficit 87340
-deficit_cause 0
-surplus 98724
-surplus_cause 0
-both 98724
+ Min. 1st Qu. Median Mean 3rd Qu.
+deficit -100.000000 -2.366971 -1.9098018 -2.0387177 -1.171102
+deficit_cause 1.000000 129.000000 129.0000000 121.5036000 129.000000
+surplus -4.310967 -1.091849 -0.3321133 -0.3779968 0.224241
+surplus_cause 1.000000 129.000000 129.0000000 121.4569100 129.000000
+both 0.000000 0.000000 0.0000000 0.8073860 1.447755
+ Max. NA's
+deficit 1.977621 94083
+deficit_cause 129.000000 0
+surplus 3.547665 94088
+surplus_cause 129.000000 0
+both 100.000000 94088
dimension(s):
from to offset delta refsys values x/y
x 1 1440 -180 0.25 WGS 84 NULL [x]
y 1 600 90 -0.25 WGS 84 NULL [y]
-time 1 804 NA NA POSIXct 1948-01-01,...,2014-12-01
+time 1 793 NA NA POSIXct 1948-12-01,...,2014-12-01
The print command gives some basic information. The outputs tells us we have 5 attributes (deficit, deficit_cause, surplus, surplus_cause, both) and 3 dimensions. The first 2 dimensions are the spatial extents (x/y–longitude/latitude) and time is the 3rd dimension.
@@ -4588,24 +4768,24 @@We can start paring this down by subsetting for just the combined surplus/deficit anomaly (both).
+We can start paring this down by subsetting for just deficits (drought).
names(wsim_gldas_anoms)
[1] "deficit" "deficit_cause" "surplus" "surplus_cause"
[5] "both"
<- wsim_gldas_anoms['both'] wsim_gldas_anoms
<- wsim_gldas_anoms['deficit'] wsim_gldas_anoms
Specifying a temporal range of interest will free up more space. We’ll grab every month for 2000-2014. This can be accomplished by generating a sequence for every month between January 2000 and December 2014, and then passing that vector of dates to filter
.
Specifying a temporal range of interest will free up more space. We’ll grab every year for 2000-2014. This can be accomplished by generating a sequence for every year between December 2000 and December 2014, and then passing that vector of dates to filter
.
# generate a vector of dates for subsetting
-<-seq(lubridate::ymd("2000-01-01"),
+ keeps<-seq(lubridate::ymd("2000-12-01"),
keeps::ymd("2014-12-01"),
- lubridateby = "month")
+ by = "year")
# filter using that vector
<- dplyr::filter(wsim_gldas_anoms, time %in% keeps)
wsim_gldas_anoms
@@ -4613,25 +4793,29 @@ Time Selection
stars object with 3 dimensions and 1 attribute
attribute(s), summary of first 1e+05 cells:
- Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
-both 0 0 0 5.415477 1.631542 100 98724
+ Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
+deficit -3.140659 -1.491055 -1.092252 -1.037756 -0.5627083 0.8403344 94083
dimension(s):
from to offset delta refsys values x/y
x 1 1440 -180 0.25 WGS 84 NULL [x]
y 1 600 90 -0.25 WGS 84 NULL [y]
-time 1 180 NA NA POSIXct 2000-01-01,...,2014-12-01
+time 1 15 NA NA POSIXct 2000-12-01,...,2014-12-01
Now we’re down to a single attribute (“both”) with 180 time-steps. We can take a look at the first 6 months by passing the object through slice
and then into plot
.
Now we’re down to a single attribute (“both”) with 15 time-steps. We can take a look at the first 6 years by passing the object through slice
and then into plot
.
|>
wsim_gldas_anoms ::slice(index = 1:6, along = "time") |>
- dplyrplot(key.pos = 1)
downsample set to 1
Although we’ve pared it down to a single attribute with a restricted time period of interest, we can take it a step further and reduce the spatial extent to a country or state of interest.
@@ -4685,7 +4869,11 @@plot(sf::st_geometry(usa))
This looks good, but it includes all United States territories. For simplicity, we can get it down to only the contiguous United States.
@@ -4702,7 +4890,11 @@We can take this a step further and select a target state.
@@ -4711,7 +4903,11 @@From here we can crop the WSIM GLDAS raster stack by indexing it with the stored boundary of Texas
@@ -4722,11 +4918,11 @@For a final visual check we’ll take the last time-step in the WSIM-GLDAS dataset (180/December, 2014) and plot it with an overlay of the Texas boundary.
+For a final visual check we’ll take the last time-step in the WSIM-GLDAS dataset (15/December, 2014) and plot it with an overlay of the Texas boundary.
|>
- wsim_gldas_anoms_tex ::slice(index = 180, along = "time") |>
- dplyrplot(reset = FALSE)
+ ::slice(index = 15, along = "time") |>
+ dplyrplot(reset = FALSE, breaks = c(0,-1,-2,-3,-4,-5))
plot(sf::st_geometry(texas),
add = TRUE,
@@ -4734,7 +4930,11 @@ Spatial Selection
fill = NA,
border = 'purple')
The subsetted dataset may be written to disk, and saved for future modules.
@@ -4826,10 +5026,9 @@