From faab5cb3627732a360ed5061dacba73b975fd6a0 Mon Sep 17 00:00:00 2001 From: Kasra Farmer Date: Tue, 15 Nov 2022 18:14:04 -0600 Subject: [PATCH] Iss12 (#13) * updating exactextractr dependency version as well as updating Graham's local cache files * correcting subsetting address file for the output tif * correcting variables in GSDE's example --- assets/renv.lock | 8 ++++---- example/gsde.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ landsat/landsat.sh | 2 +- 3 files changed, 49 insertions(+), 5 deletions(-) create mode 100755 example/gsde.sh diff --git a/assets/renv.lock b/assets/renv.lock index 31b071c..b68df67 100644 --- a/assets/renv.lock +++ b/assets/renv.lock @@ -110,15 +110,15 @@ }, "exactextractr": { "Package": "exactextractr", - "Version": "0.9.0", + "Version": "0.9.1", "Source": "GitHub", "RemoteType": "github", "RemoteHost": "api.github.com", "RemoteUsername": "isciences", "RemoteRepo": "exactextractr", - "RemoteRef": "6d02446438991c3d6a8017474200aaf23fc7a695", - "RemoteSha": "6d02446438991c3d6a8017474200aaf23fc7a695", - "Hash": "c22e1f368bc1d3083f3ad82ee8134344", + "RemoteRef": "f875cea876f0f9746f741e5559fce0e044fae8b8", + "RemoteSha": "f875cea876f0f9746f741e5559fce0e044fae8b8", + "Hash": "dc114ab271000cfc3e72331d5212f2c2", "Requirements": [ "Rcpp", "raster", diff --git a/example/gsde.sh b/example/gsde.sh new file mode 100755 index 0000000..e92cfb5 --- /dev/null +++ b/example/gsde.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Geospatial Dataset Processing Workflow +# Copyright (C) 2022, University of Saskatchewan +# +# This file is part of the Geospatial Dataset Processing Workflow +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# This is a simple example to extract common statistics for the +# pfaf 71 - Saskatchewan-Nelson System Shapefiles of MERIT-Basins - +# from the GSDE rasters. + +# Always call the script in the root directory of this repository +cd .. +echo "The current directory is: $(pwd)" + +# first download a sample shapefile - could be any shapefile +wget -m -nd -nv -q -A "cat_pfaf_71_MERIT_Hydro_v07_Basins_v01_bugfix1.*" \ + "http://hydrology.princeton.edu/data/mpan/MERIT_Basins/MERIT_Hydro_v07_Basins_v01_bugfix1/pfaf_level_02/"; + +# implement subsetting and zonal statistics +./extract-gis.sh --dataset="GSDE" \ + --dataset-dir="/project/rpp-kshook/Model_Output/GSDE/download/gsde-30sec/" \ + --variable="BD" \ + --shape-file="$(pwd)/cat_pfaf_71_MERIT_Hydro_v07_Basins_v01_bugfix1.shp" \ + --print-geotiff=true \ + --output-dir="$HOME/scratch/depth-to-bedrock-test/" \ + --prefix="dtb_" \ + --stat="mean,min,max" \ + --email="you@company.ca" \ + -j; + diff --git a/landsat/landsat.sh b/landsat/landsat.sh index 8856608..82beb9e 100755 --- a/landsat/landsat.sh +++ b/landsat/landsat.sh @@ -243,7 +243,7 @@ if [[ "$printGeotiff" == "true" ]]; then echo "$(logDate)$(basename $0): subsetting GeoTIFFs under $outputDir" for var in "${variables[@]}"; do # subset based on lat and lon values - subset_geotiff "${geotiffDir}/${var}.tif" "${outputDir}/${prefix}${var}.tif" + subset_geotiff "${cache}/${var}/${var}.tif" "${outputDir}/${prefix}${var}.tif" done fi