Giter VIP home page Giter VIP logo

rsaga's Introduction

RSAGA

Travis build status Lifecycle: stable

Introduction

Latest RSAGA version with support for SAGA GIS 2.3 LTS - 8.4.1

Provides access to geocomputing and terrain analysis functions of the geographical information system (GIS) ‘SAGA’ (System for Automated Geoscientific Analyses) from within R by running the command line version of SAGA. This package furthermore provides several R functions for handling ASCII grids, including a flexible framework for applying local functions (including predict methods of fitted models) and focal functions to multiple grids. SAGA GIS is available under GPLv2 / LGPLv2 licence from http://sourceforge.net/projects/saga-gis/.

Installation

You can install RSAGA from CRAN with:

install.packages("RSAGA", dependencies = TRUE)

Or you can get the latest version from GitHub with:

devtools::install_github("r-spatial/RSAGA", dependencies = TRUE)

rsaga's People

Contributors

alexanderbrenning avatar be-marc avatar debangs avatar fapola avatar jannes-m avatar pat-s avatar rhurlin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rsaga's Issues

Hard to suppress cat() messages

R/RSAGA-core.R abounds with messages generated using the cat() function. I find these hard to suppress. Wouldn't it be reasonable to replace cat() with msg()?

Issue with geoprocessing tools

I've been using RSAGA to process covariates using almost the same line of code each time. I began a new project using the same code and have been unable run it, and it throws the following warning:

CODE:
rsaga.get.usage(lib = "ta_morphometry", module = "Slope, Aspect, Curvature", env = env)

rsaga.geoprocessor(lib = "ta_morphometry", module = "Slope, Aspect, Curvature", env = env, param = list(
ELEVATION = DEM_file,
ASPECT = paste0(wd,"asp"),
SLOPE = paste0(wd,"sl"),
C_GENE = paste0(wd,"gen_curve"),
C_PROF = paste0(wd,"prof_curve"),
C_PLAN = paste0(wd,"plan_curve"),
C_TANG = paste0(wd,"tang_curve"),
C_MINI = paste0(wd,"min_curve"),
C_MAXI = paste0(wd,"max_curve"),
C_TOTA = paste0(wd,"tot_curve")
))

WARNING:

Warning message: In system(command, intern = intern, show.output.on.console = show.output.on.console, : running command '"C:/Users/willi/Documents/saga-7.0.0_x64/saga-7.0.0_x64/saga_cmd.exe" -f=q ta_morphometry "Slope, Aspect, Curvature" -ELEVATION "D:/Digtal Soil Mapping Projects/Sabiston_Eagle_Hill_William/FilteredDEMS/EH3.tif" -ASPECT "D:/Digtal Soil Mapping Projects/Sabiston_Eagle_Hill-William/FilteredDEMS/3pix/asp" -SLOPE "D:/Digtal Soil Mapping Projects/Sabiston_Eagle_Hill-William/FilteredDEMS/3pix/sl" -C_GENE "D:/Digtal Soil Mapping Projects/Sabiston_Eagle_Hill-William/FilteredDEMS/3pix/gen_curve" -C_PROF "D:/Digtal Soil Mapping Projects/Sabiston_Eagle_Hill-William/FilteredDEMS/3pix/prof_curve" -C_PLAN "D:/Digtal Soil Mapping Projects/Sabiston_Eagle_Hill-William/FilteredDEMS/3pix/plan_curve" -C_TANG "D:/Digtal Soil Mapping Projects/Sabiston_Eagle_Hill-William/FilteredDEMS/3pix/tang_curve" -C_MINI "D:/Digtal Soil Mapping Projects/Sabiston_Eagle_Hill-William/FilteredDEMS/3pix/min_curve" -C_MAXI "D:/Digtal Soil Mapping Projects/Sabiston_Eagle_Hill-William/FilteredDEMS/3pix/max_curve" [... truncated]

 
I have ensured my inputs were valid and attempted to use my previous data inputs and gotten the same result. I am unsure what this warning means. This issue also persists over other functions in RSAGA that would create new rastors.
 

Thank you
 

Error in RSAGA::rsaga.env()

Using the following function call

RSAGA::rsaga.env(path = "/opt/.../saga-gis-6.4.0/bin",
              root = "/opt/.../saga-gis-6.4.0") # ... stands for the full directory

I got the following error:

Verify specified path to SAGA command line program...
Found SAGA command line program. Search for not specified SAGA modules path...
Error in list.files(path = root, pattern = "libio_gdal", recursive = TRUE, :
argument "root" is missing, with no default

By debugging, the error is thrown in line 42
modules = rsaga.get.modules.path(saga.path = path) - due to the missing root-argument. If I set the root-argument in this function during debugging mode, I got a correct path.

Unexpected Behavior in rsaga.pisr2 Function: Day Step Parameter Not Applied Correctly

Description

I am using the rsaga.pisr2 function from the RSAGA package (version 1.4.0) in R (version R-4.3.2) with RStudio (2023.12.0+369 "Ocean Storm") on a Windows system. When setting the day.step parameter to 7, the function appears to override this setting and defaults to a resolution of 5 days instead.

Steps to Reproduce

  1. Load the RSAGA package and set up the environment.

  2. Execute the rsaga.pisr2 function with the following parameters:

    rsaga.pisr2(in.dem = dtm,
                out.direct.grid = paste0(output.dir, layer.code, "_insolation.direct.tif"),
                out.diffuse.grid = paste0(output.dir, layer.code, "_insolation.diffuse.tif"),
                out.total.grid = paste0(output.dir, layer.code, "_insolation.total.tif"),
                out.duration = paste0(output.dir, layer.code, "_insolation.duration.tif"),
                start.date = list(day=21, month=7, year=2023),
                end.date = list(day=21, month=10, year=2023),
                time.step = 6,
                day.step = 7,
                env = env)
  3. Observe the parameters passed to the SAGA command, specifically see Resolution [d]: 5, but also note end.date.

Console Output

**Parameters**
Grid system: 0.100000; 1884x 2276y; 584947.870000x 6661632.24y
Elevation: e2_dtm
Sky View Factor: <not set>
Water Vapour Pressure [mbar]: <not set>
Default: 10.000000
Direct Insolation: 
Diffuse Insolation: 
Total Insolation: 
Direct to Diffuse Ratio: 
Compare to Flat Terrain: <not set>
Solar Constant [W / m�]: 1367.000000
Local Sky View Factor: true
Units: kWh / m�
Shadow: slim
Location: constant latitude
Latitude: +053�00'00''
Time Period: range of days
Day: 2023-06-21
Last Day: 2023-10-21
**Resolution [d]: 5**
Time Span [h]: 0.000000; 24.000000
Resolution [h]: 6.000000
Atmospheric Effects: Height of Atmosphere and Vapour Pressure
Height of Atmosphere [m]: 12000.000000

Expected Behavior

I understood from the description of the function () should apply the day.step parameter as specified (7 days in this case) and use it in the SAGA command.

Actual Behavior

The function seems to override the specified day.step parameter with a default of 5 days.

Additional Context

  • RSAGA Package Version: 1.4.0
  • R Version: R-4.3.2
  • RStudio Version: 2023.12.0+369 "Ocean Storm"
  • Operating System: Windows

I have attached the relevant output showing the parameters passed to the SAGA command. The key issue is with the Resolution [d]: 5, which does not correspond to the day.step = 7 that I set.

Possible Solution

I am not sure if this is a bug in the RSAGA package or a misconfiguration on my end. Any guidance on how to ensure the day.step parameter is correctly applied would be greatly appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.