From 1c1865d6fc99966bdb495326188198974ab4c459 Mon Sep 17 00:00:00 2001 From: aho Date: Wed, 27 Nov 2019 11:15:29 +0100 Subject: [PATCH] Add how-to 6 --- inst/doc/faq.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/inst/doc/faq.md b/inst/doc/faq.md index 29dd391..3610bb2 100644 --- a/inst/doc/faq.md +++ b/inst/doc/faq.md @@ -9,6 +9,7 @@ This document intends to be the first reference for any doubts that you may have 3. [Use self-defined function in Compute()](#3-use-self-defined-function-in-compute) 4. [Use package function in Compute()](#4-use-package-function-in-compute) 5. [Do interpolation in Start() (using parameter 'transform')](#5-do-interpolation-in-start-using-parameter-transform) + 6. [Get data attributes without retrieving data to workstation](#6-get-data-attributes-without-retrieving-data-to-workstation) 2. **Something goes wrong...** @@ -261,6 +262,39 @@ You can find an example script here [ex1_1_tranform.R](/inst/doc/usecase/ex1_1_t You can see more information in s2dverification::CDORemap documentation [here](https://earth.bsc.es/gitlab/es/s2dverification/blob/master/man/CDORemap.Rd). +### 6. Get data attributes without retrieving data to workstation + +One of the most useful functionalities of Start() is the parameter `retrieve = FALSE`. It creates a pointer to data repository and tells you the data information without occupying your workstation memory. The better thing is, even the data is not actually retrieved, you can still use its attributes: +```r + header <- Start(dat = repos, + ..., + retrieve = FALSE) + class(header) +#[1] "startR_cube" + +# check attributes + str(attr(header, 'Variables')) +# Get longitude and latitude + lons <- attr(header, 'Variables')$common$lon + lats <- attr(header, 'Variables')$common$lat +# Get dimension + dim <- attr(header, 'Dimensions') + +``` + +And if you want to retrieve the data to the workstation afterward, you can use `eval()`: +```r + data <- eval(header) + + class(data) +#[1] "startR_array" + +# Get dimension + dim(data) +``` +Find examples at [usecase.md](/inst/doc/usecase.md), ex1_1 and ex1_3. + + ## Something goes wrong... ### 1. No space left on device -- GitLab