diff --git a/example-library/helloworld-spatial-syncrosim3.ssim b/example-library/helloworld-spatial-syncrosim3.ssim deleted file mode 100644 index 0d2c21c..0000000 Binary files a/example-library/helloworld-spatial-syncrosim3.ssim and /dev/null differ diff --git a/helloworldSpatial1/model.R b/helloworldSpatial1/model.R deleted file mode 100644 index 76977b6..0000000 --- a/helloworldSpatial1/model.R +++ /dev/null @@ -1,76 +0,0 @@ -library(rsyncrosim) # Load SyncroSim R package -library(terra) # Load terra package -myScenario <- scenario() # Get the SyncroSim scenario that is currently running - -# Retrieve the transfer directory for storing output rasters -e <- ssimEnvironment() -transferDir <- e$TransferDirectory - -# Load RunControl datasheet to be able to set timesteps -runSettings <- datasheet(myScenario, name = "helloworldSpatial1_RunControl") - -# Set timesteps - can set to different frequencies if desired -timesteps <- seq(runSettings$MinimumTimestep, runSettings$MaximumTimestep) - -# Load scenario's input datasheet from SyncroSim library into R dataframe -myInputDataframe <- datasheet(myScenario, - name = "helloworldSpatial1_InputDatasheet") - -# Extract model inputs from complete input dataframe -mMean <- myInputDataframe$mMean -mSD <- myInputDataframe$mSD - -# Load raster input -rasterMap <- datasheetSpatRaster(myScenario, - datasheet = "helloworldSpatial1_InputDatasheet", - column = "InterceptRasterFile") - -# Setup empty R dataframe ready to accept output in SyncroSim datasheet format -myOutputDataframe <- datasheet( - myScenario, - name = "helloworldSpatial1_IntermediateDatasheet" -) - -# Setup empty R dataframe ready to accept output in SyncroSim datasheet format -myOutputDataframe <- data.frame(Iteration = numeric(0), - Timestep = numeric(0), - y = numeric(0), - OutputRasterFile = character(0)) - -# For loop through iterations -for (iter in runSettings$MinimumIteration:runSettings$MaximumIteration) { - - # Extract a slope value from normal distribution - m <- rnorm(n = 1, mean = mMean, sd = mSD) - - # Use each cell in the raster as the intercept in linear equation - rastList <- c() - for (t in timesteps){ - tempRasterMap <- app(rasterMap, function(b) m * t + b) - rastList <- c(rastList, tempRasterMap) - } - newRasterMaps <- terra::rast(rastList) - - # The y value will be the sum of all the cells in each raster - y <- global(newRasterMaps, "sum")$sum - - # Add the new raster for this timestep/iteration to the output - newRasterNames <- file.path(paste0(transferDir, - "/hw.it", iter, ".ts", - timesteps, ".tif")) - writeRaster(newRasterMaps, filename = newRasterNames, overwrite = TRUE) - - # Store the relevant outputs in a temporary dataframe - tempDataframe <- data.frame(Iteration = iter, - Timestep = timesteps, - y = y, - OutputRasterFile = newRasterNames) - - # Copy output into this R dataframe - myOutputDataframe <- addRow(myOutputDataframe, tempDataframe) -} - -# Save this R dataframe back to the SyncroSim library's output datasheet -saveDatasheet(myScenario, - data = myOutputDataframe, - name = "helloworldSpatial1_IntermediateDatasheet") diff --git a/helloworldSpatial1/package.xml b/helloworldSpatial1/package.xml deleted file mode 100644 index a215014..0000000 --- a/helloworldSpatial1/package.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/helloworldSpatial2/model2.R b/helloworldSpatial2/model2.R deleted file mode 100644 index a4129aa..0000000 --- a/helloworldSpatial2/model2.R +++ /dev/null @@ -1,40 +0,0 @@ -library(rsyncrosim) # Load SyncroSim R package -myScenario <- scenario() # Get the SyncroSim scenario that is currently running - -# Load RunControl datasheet to be able to set timesteps -runSettings <- datasheet(myScenario, name = "helloworldSpatial1_RunControl") - -# Set timesteps - can set to different frequencies if desired -timesteps <- seq(runSettings$MinimumTimestep, runSettings$MaximumTimestep) - -# Load scenario's input datasheet from SyncroSim library into R dataframe -myInputDataframe <- datasheet(myScenario, - name = "helloworldSpatial1_IntermediateDatasheet") - -# Setup empty R dataframe ready to accept output in SyncroSim datasheet format -myOutputDataframe <- data.frame(Iteration = numeric(0), - Timestep = numeric(0), - yCum = numeric(0)) - -# For loop through iterations -for (iter in runSettings$MinimumIteration:runSettings$MaximumIteration) { - - # Only load y for this iteration - y <- myInputDataframe$y[myInputDataframe$Iteration == iter] - - # Do calculations - yCum <- cumsum(y) - - # Store the relevant outputs in a temporary dataframe - tempDataframe <- data.frame(Iteration = iter, - Timestep = timesteps, - yCum = yCum) - - # Copy output into this R dataframe - myOutputDataframe <- addRow(myOutputDataframe, tempDataframe) -} - -# Save this R dataframe back to the SyncroSim library's output datasheet -saveDatasheet(myScenario, - data = myOutputDataframe, - name = "helloworldSpatial2_OutputDatasheet") diff --git a/helloworldSpatial2/package.xml b/helloworldSpatial2/package.xml deleted file mode 100644 index 33f1b15..0000000 --- a/helloworldSpatial2/package.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/helloworldSpatial2/templates/example-library.png b/helloworldSpatial2/templates/example-library.png deleted file mode 100644 index 0e8e824..0000000 Binary files a/helloworldSpatial2/templates/example-library.png and /dev/null differ diff --git a/helloworldSpatial2/templates/example-library.ssim b/helloworldSpatial2/templates/example-library.ssim deleted file mode 100644 index ba0b482..0000000 Binary files a/helloworldSpatial2/templates/example-library.ssim and /dev/null differ diff --git a/helloworldSpatial2/templates/example-library.ssim.backup/example-library.ssim.backup.2023-01-24-at-12-59-44-PRE-LIBRARY-UPDATE.ssimbak b/helloworldSpatial2/templates/example-library.ssim.backup/example-library.ssim.backup.2023-01-24-at-12-59-44-PRE-LIBRARY-UPDATE.ssimbak deleted file mode 100644 index 1a439fe..0000000 Binary files a/helloworldSpatial2/templates/example-library.ssim.backup/example-library.ssim.backup.2023-01-24-at-12-59-44-PRE-LIBRARY-UPDATE.ssimbak and /dev/null differ diff --git a/helloworldSpatial2/templates/example-library.ssim.input/Scenario-1/helloworldSpatial_InputDatasheet/input-raster.tif b/helloworldSpatial2/templates/example-library.ssim.input/Scenario-1/helloworldSpatial_InputDatasheet/input-raster.tif deleted file mode 100644 index 0708f6b..0000000 Binary files a/helloworldSpatial2/templates/example-library.ssim.input/Scenario-1/helloworldSpatial_InputDatasheet/input-raster.tif and /dev/null differ diff --git a/images/input-raster.tif b/images/input-raster.tif deleted file mode 100644 index b873c71..0000000 Binary files a/images/input-raster.tif and /dev/null differ diff --git a/src/helloworldR.yml b/src/helloworldR.yml index 07ff0a6..6b9d82d 100644 --- a/src/helloworldR.yml +++ b/src/helloworldR.yml @@ -1,197 +1,8 @@ name: helloworldR channels: - conda-forge + - defaults dependencies: - - _r-mutex=1.0.1=anacondar_1 - - bzip2=1.0.8=h2466b09_7 - - ca-certificates=2025.4.26=h4c7d964_0 - - cairo=1.18.0=h91e5215_2 - - font-ttf-dejavu-sans-mono=2.37=hab24e00_0 - - font-ttf-inconsolata=3.000=h77eed37_0 - - font-ttf-source-code-pro=2.038=h77eed37_0 - - font-ttf-ubuntu=0.83=h77eed37_3 - - fontconfig=2.15.0=h765892d_1 - - fonts-conda-ecosystem=1=0 - - fonts-conda-forge=1=0 - - freetype=2.12.1=hdaf720e_2 - - fribidi=1.0.10=h8d14728_0 - - graphite2=1.3.13=h63175ca_1003 - - harfbuzz=8.5.0=h81778c3_0 - - icu=73.2=h63175ca_0 - - intel-openmp=2024.2.1=h57928b3_1083 - - lerc=4.0.0=h63175ca_0 - - libblas=3.9.0=26_win64_mkl - - libdeflate=1.23=h9062f6e_0 - - libexpat=2.6.4=he0c23c2_0 - - libffi=3.4.2=h8ffe710_5 - - libglib=2.82.2=h7025463_0 - - libhwloc=2.11.2=default_hc8275d1_1000 - - libiconv=1.17=hcfcfb64_2 - - libintl=0.22.5=h5728263_3 - - libjpeg-turbo=3.0.0=hcfcfb64_1 - - liblapack=3.9.0=26_win64_mkl - - liblzma=5.6.3=h2466b09_1 - - libpng=1.6.44=h3ca93ac_0 - - libtiff=4.7.0=h797046b_3 - - libxml2=2.13.5=he286e8c_1 - - libzlib=1.3.1=h2466b09_2 - - m2w64-bwidget=1.9.10=2 - - m2w64-bzip2=1.0.6=6 - - m2w64-expat=2.1.1=2 - - m2w64-fftw=3.3.4=6 - - m2w64-flac=1.3.1=3 - - m2w64-gcc-libgfortran=5.3.0=6 - - m2w64-gcc-libs=5.3.0=7 - - m2w64-gcc-libs-core=5.3.0=7 - - m2w64-gettext=0.19.7=2 - - m2w64-gmp=6.1.0=2 - - m2w64-gsl=2.1=2 - - m2w64-icu=58.2=2 - - m2w64-libiconv=1.14=6 - - m2w64-libjpeg-turbo=1.4.2=3 - - m2w64-libogg=1.3.2=3 - - m2w64-libpng=1.6.21=2 - - m2w64-libsndfile=1.0.26=2 - - m2w64-libtiff=4.0.6=2 - - m2w64-libvorbis=1.3.5=2 - - m2w64-libwinpthread-git=5.0.0.4634.697f757=2 - - m2w64-libxml2=2.9.3=3 - - m2w64-mpfr=3.1.4=4 - - m2w64-pcre2=10.34=0 - - m2w64-speex=1.2rc2=3 - - m2w64-speexdsp=1.2rc3=3 - - m2w64-tcl=8.6.5=3 - - m2w64-tk=8.6.5=3 - - m2w64-tktable=2.10=5 - - m2w64-wineditline=2.101=5 - - m2w64-xz=5.2.2=2 - - m2w64-zlib=1.2.8=10 - - mkl=2024.2.2=h66d3029_15 - - msys2-conda-epoch=20160418=1 - - openssl=3.5.0=ha4e3fda_0 - - pandoc=2.19.2=h57928b3_2 - - pcre2=10.44=h3d7b363_2 - - pixman=0.44.2=had0cd8c_0 - - pthreads-win32=2.9.1=h2466b09_4 - - r-askpass=1.2.0=r41h6d2157b_0 - - r-assertthat=0.2.1=r41hc72bb7e_3 - - r-backports=1.5.0=r41h6c66454_0 - - r-base=4.1.3=h22dd5fe_17 - - r-base64enc=0.1_3=r41h6d2157b_1006 - - r-bit=4.0.5=r41h6d2157b_1 - - r-bit64=4.0.5=r41h6d2157b_2 - - r-blob=1.2.4=r41hc72bb7e_0 - - r-broom=1.0.5=r41hc72bb7e_0 - - r-bslib=0.5.0=r41hc72bb7e_0 - - r-cachem=1.1.0=r41h6c66454_0 - - r-callr=3.7.3=r41hc72bb7e_0 - - r-cellranger=1.1.0=r41hc72bb7e_1005 - - r-cli=3.6.3=r41he75b88d_0 - - r-clipr=0.8.0=r41hc72bb7e_1 - - r-colorspace=2.1_0=r41h6d2157b_1 - - r-conflicted=1.2.0=r41h785f33e_0 - - r-cpp11=0.4.7=r41hc72bb7e_0 - - r-crayon=1.5.2=r41hc72bb7e_1 - - r-curl=4.3.3=r41h6d2157b_2 - - r-data.table=1.15.4=r41h6d2157b_0 - - r-dbi=1.1.3=r41hc72bb7e_1 - - r-dbplyr=2.3.2=r41hc72bb7e_0 - - r-digest=0.6.36=r41he75b88d_0 - - r-dplyr=1.1.4=r41ha856d6a_0 - - r-dtplyr=1.3.1=r41hc72bb7e_0 - - r-ellipsis=0.3.2=r41h6d2157b_2 - - r-evaluate=0.21=r41hc72bb7e_0 - - r-fansi=1.0.6=r41h6d2157b_0 - - r-farver=2.1.2=r41he75b88d_0 - - r-fastmap=1.2.0=r41he75b88d_0 - - r-fontawesome=0.5.1=r41hc72bb7e_0 - - r-forcats=1.0.0=r41hc72bb7e_0 - - r-fs=1.6.4=r41h3f0a074_0 - - r-gargle=1.4.0=r41h785f33e_0 - - r-generics=0.1.3=r41hc72bb7e_1 - - r-ggplot2=3.4.2=r41hc72bb7e_0 - - r-glue=1.7.0=r41h6d2157b_0 - - r-googledrive=2.1.0=r41hc72bb7e_0 - - r-googlesheets4=1.1.0=r41h785f33e_0 - - r-gtable=0.3.3=r41hc72bb7e_0 - - r-gtools=3.9.5=r41h6d2157b_0 - - r-haven=2.5.4=r41ha856d6a_0 - - r-highr=0.10=r41hc72bb7e_0 - - r-hms=1.1.3=r41hc72bb7e_0 - - r-htmltools=0.5.8.1=r41ha856d6a_0 - - r-httr=1.4.6=r41hc72bb7e_0 - - r-ids=1.0.1=r41hc72bb7e_2 - - r-isoband=0.2.7=r41ha856d6a_2 - - r-jquerylib=0.1.4=r41hc72bb7e_1 - - r-jsonlite=1.8.8=r41h6d2157b_0 - - r-knitr=1.43=r41hc72bb7e_0 - - r-labeling=0.4.2=r41hc72bb7e_2 - - r-lattice=0.22_6=r41h6d2157b_0 - - r-lifecycle=1.0.3=r41hc72bb7e_1 - - r-lubridate=1.9.3=r41h6d2157b_0 - - r-magrittr=2.0.3=r41h6d2157b_2 - - r-mass=7.3_58.3=r41h6d2157b_0 - - r-matrix=1.6_5=r41hb9981e2_0 - - r-memoise=2.0.1=r41hc72bb7e_1 - - r-mgcv=1.9_1=r41hb9981e2_0 - - r-mime=0.12=r41h6d2157b_2 - - r-modelr=0.1.11=r41hc72bb7e_0 - - r-munsell=0.5.0=r41hc72bb7e_1005 - - r-nlme=3.1_165=r41hd63c432_0 - - r-openssl=2.0.6=r41h81a3cea_1 - - r-pillar=1.9.0=r41hc72bb7e_0 - - r-pkgconfig=2.0.3=r41hc72bb7e_2 - - r-plogr=0.2.0=r41hc72bb7e_1004 - - r-prettyunits=1.1.1=r41hc72bb7e_2 - - r-processx=3.8.4=r41h6d2157b_0 - - r-progress=1.2.2=r41hc72bb7e_3 - - r-ps=1.7.6=r41h6d2157b_0 - - r-purrr=1.0.2=r41h6d2157b_0 - - r-r6=2.5.1=r41hc72bb7e_1 - - r-ragg=1.3.2=r41he767bbc_0 - - r-rappdirs=0.3.3=r41h6d2157b_2 - - r-rcolorbrewer=1.1_3=r41h785f33e_1 - - r-rcpp=1.0.12=r41ha856d6a_0 - - r-readr=2.1.5=r41ha856d6a_0 - - r-readxl=1.4.3=r41h1c2d66b_0 - - r-rematch=1.0.1=r41hc72bb7e_1005 - - r-rematch2=2.1.2=r41hc72bb7e_2 - - r-reprex=2.0.2=r41hc72bb7e_1 - - r-rlang=1.1.4=r41he75b88d_0 - - r-rmarkdown=2.22=r41hc72bb7e_0 - - r-rsqlite=2.3.4=r41ha856d6a_0 - - r-rstudioapi=0.14=r41hc72bb7e_1 - - r-rsyncrosim=2.1.1=r41hd8ed1ab_0 - - r-rvest=1.0.3=r41hc72bb7e_1 - - r-sass=0.4.9=r41ha856d6a_0 - - r-scales=1.2.1=r41hc72bb7e_1 - - r-selectr=0.4_2=r41hc72bb7e_2 - - r-stringi=1.8.4=r41h3f0a074_0 - - r-stringr=1.5.0=r41h785f33e_0 - - r-sys=3.4.2=r41h6d2157b_1 - - r-systemfonts=1.1.0=r41h754b566_0 - - r-terra=1.5_21=r41ha856d6a_8 - - r-textshaping=0.4.0=r41hdd868d5_0 - - r-tibble=3.2.1=r41h6d2157b_2 - - r-tidyr=1.3.1=r41ha856d6a_0 - - r-tidyselect=1.2.0=r41h6addd8b_1 - - r-tidyverse=2.0.0=r41h785f33e_0 - - r-timechange=0.3.0=r41ha856d6a_0 - - r-tinytex=0.45=r41hc72bb7e_0 - - r-tzdb=0.4.0=r41ha856d6a_1 - - r-utf8=1.2.4=r41h6d2157b_0 - - r-uuid=1.2_0=r41h6d2157b_0 - - r-vctrs=0.6.5=r41ha856d6a_0 - - r-viridislite=0.4.1=r41hc72bb7e_1 - - r-vroom=1.6.5=r41ha856d6a_0 - - r-withr=2.5.0=r41hc72bb7e_1 - - r-xfun=0.45=r41he75b88d_0 - - r-xml2=1.3.3=r41ha856d6a_2 - - r-yaml=2.3.8=r41h6d2157b_0 - - tbb=2021.13.0=h62715c5_1 - - ucrt=10.0.22621.0=h57928b3_1 - - vc=14.3=ha32ba9b_23 - - vc14_runtime=14.42.34433=he29a5d6_23 - - vs2015_runtime=14.42.34433=hdffcdeb_23 - - zlib=1.3.1=h2466b09_2 - - zstd=1.5.6=h0ea2cb4_0 \ No newline at end of file + - r-base=4.1.3 + - r-rsyncrosim=2.1.7 + - r-terra=1.5_21 \ No newline at end of file diff --git a/src/package.xml b/src/package.xml index c0a0902..a7ca3dc 100644 --- a/src/package.xml +++ b/src/package.xml @@ -1,5 +1,5 @@  - + @@ -26,7 +26,7 @@ - +