dycdtools

source codes for dycdTools package

https://github.com/songyanyu/dycdtools

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
    3 of 3 committers (100.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.1%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

source codes for dycdTools package

Basic Info
  • Host: GitHub
  • Owner: SongyanYu
  • License: other
  • Language: R
  • Default Branch: master
  • Size: 752 KB
Statistics
  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 6 years ago · Last pushed almost 2 years ago
Metadata Files
Readme Changelog License

README.md

dycdtools

CRAN status

Overview

An R package for assisting calibration and visualising outputs of DYRESM-CAEDYM.

In the dycdtools package, there are two main function categories: calibration assistant and post-processing.

  • The calibration assistant function (calib_assist) carries out simulations with a large number of possible combinations of parameter values that users regard as potentially suitable for their model calibration, and calculates the values of nominated objective functions (i.e., statistical measures of goodness of fit) for each combination. Based on the calculated objective function values, users can determine the optimal set(s) of parameter values or narrow the ranges of possible parameter values. NOTE: the calib_assist function can only be run on Windows as it needs to call 'shell' to run DYRESM-CARDYM software executables.

  • Four post-processing functions provide multiple ways to visualise DYRESM-CAEDYM outputs as follows:

    • Function plot_cont displays a heat map of variable values with depth within the water column and over time. This visualisation is particularly suitable for displaying temporal and depth dynamics of a variable at one lake site.
    • Function plot_prof shows vertical profiles of the simulation and corresponding observations, for all dates where observations are available.
    • Function plot_ts plots simulated values and observations for a specified variable and depth over time. It can be used to compare temporal changes of a variable for simulations and observations at specific depths.
    • Function plot_scatter shows observations against simulated values for corresponding time and depth, with a colour scale representing measured depths. It can be used to demonstrate visually the goodness of fit for a variable across the water column.

For a detailed tutorial of how to use these functions, readers are referred to a peer-reviewed paper by the developers.

IMPORTANT: It is highly recommended that first-time users of the package first run the package functions (particularly'calib_assist') on the provided example data (see below the Application Section) to familiarise themselves.

Installation

To install the latest development version run the following code: ```{r}

install devtools

install.packages("devtools")

install dycdTools package

devtools::install_github("SongyanYu/dycdtools")

Remove the package zip after installation

unlink("dycdtools.zip") ```

Application

Below is a minimal case study example. The example data supporting the case study can be accessed via: https://doi.org/10.5281/zenodo.7431128

The calibration assistant function - calib_assist

Assume that you want to calibrate three model parameters: wind stirring efficiency, vertical mixing coefficient, and light extinction coefficient and each parameter have 4 possible values. The calib_assis function can be used to call DYRESM-CAEDYM to run for all possible combinations (n = 64) of the three parameters' values. For each model run, the objective function Nash-Sutcliffe Efficiency (NSE) coefficient is calculated for temperature simulations.

{r} library(dycdtools) calib_assist(cal.para = "calibration_data/Calibration_parameters.csv", combination = "all", model.var = c("TEMP"), obs.data = "calibration_data/Obs_data_template.csv", objective.function = c("NSE"), start.date = "2002-01-23", end.date = "2016-12-31", dycd.wd = "calibration_data/DYRESM_CAEDYM_Lake-Okareka/", dycd.output = "calibration_data/DYRESM_CAEDYM_Lake-Okareka/DYsim.nc", file.name = "calibration_data/Calibration_outputs.csv", write.out = TRUE, parallel = TRUE, verbose = TRUE)

Visualise calibration results

Use a heatmap to visualise the calculated NSE values for all 64 model runs. ```{r}

Read in model calibration results

calibration <- read.csv("calibrationdata/Calibrationoutputs.csv")

Heat map

library(ggplot2) ggplot(calibration, aes(x = wse,y = vmc,fill = NSE.TEMP)) + geomtile() + scalefilldistiller(palette = "PuBu", direction = 1) + facetwrap(~lec, scales = "free") + xlab("Wind stirring efficiency") + ylab("Vertical mixing coefficient") + labs(title = "Light extinction coefficient", fill = "NSE") + themebw() + theme(plot.title = elementtext(size = 11, hjust = 0.5)) ```

Post-processing functions

Based on the 64 model runs, you can select a particular parameter value combination that generate the best performance (measured by NSE) and rerun DYRESM-CAEDYM for that particular parameter values. After that, you can use the post-processing functions in the dycdtools package to visualise the outputs of the calibrated model.

```{r}

Extract temperature simulations

var.values <- extoutput(dycd.output = "DYCDOkareka/DYsim.nc", var.extract = c("TEMP"))

Interpolation of temperature across water column at an interval of 0.5 m

temp.interpolated < -interpol(layerHeights = var.values$dyresmLAYERHTSVar, var = var.values$dyresmTEMPTURE_Var, min.dept = 0, max.dept = 33, by.value = 0.5)

Read in observed water quality data

library(lubridate) obs.okareka <- read.csv("plottingdata/Obsdata_template.csv") obs.okareka$Date <- as.Date(obs.okareka$Date,format="%d/%m/%Y")

subset observed data to remain temperature observations

obs.temp <- obs.okareka[, c('Date','Depth','TEMP')]

Contour plot

plotcontcom(sim = temp.interpolated, obs = obs.temp, plot.start = "2002-01-23", plot.end = "2006-12-31", sim.start = "2002-01-23", sim.end = "2016-12-31" legend.title = "T\n(\u00B0C)", min.depth = 0, max.depth = 33, by.value = 0.5, nlevels = 20)

Profile plot

plot_prof(sim = temp.interpolated, obs = obs.temp, sim.start = "2002-01-23", sim.end = "2016-12-31", plot.start = "2002-01-23", plot.end = "2002-12-31", min.depth = 0, max.depth = 33, by.value = 0.5, xlabel = "Temperature \u00B0C")

Time series plot

plot_ts(sim = temp.interpolated, obs = obs.temp, target.depth = c(1, 14, 30), sim.start = "2002-01-23", sim.end = "2016-12-31", plot.start = "2002-01-23", plot.end = "2012-12-31", min.depth = 0, max.depth = 33, by.value = 0.5, ylabel = "Temperature \u00B0C")

Scatter plot

plot_scatter(sim=temp.interpolated, obs=obs.temp, sim.start="2002-01-23", sim.end="2016-12-31", plot.start = "2002-01-23", plot.end="2012-12-31", min.depth = 0, max.depth = 33, by.value = 0.5) ```

Developer contact

Songyan (Sunny) Yu: yusongyan1989@gmail.com

Owner

  • Name: Songyan (Sunny) Yu
  • Login: SongyanYu
  • Kind: user
  • Location: Brisbane
  • Company: Griffith University

PhD | Hydro-ecologist with particular interests in intermittent streams

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 188
  • Total Committers: 3
  • Avg Commits per committer: 62.667
  • Development Distribution Score (DDS): 0.58
Past Year
  • Commits: 28
  • Committers: 2
  • Avg Commits per committer: 14.0
  • Development Distribution Score (DDS): 0.107
Top Committers
Name Email Commits
Sunny Yu s****5@s****u 79
SongyanYu s****u@g****u 73
Songyan (Sunny) Yu s****u@g****u 36
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 249 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 8
  • Total maintainers: 1
cran.r-project.org: dycdtools

Calibration Assistant and Post-Processing Tool for Aquatic Ecosystem Model DYRESM-CAEDYM

  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 249 Last month
Rankings
Forks count: 28.8%
Dependent packages count: 29.8%
Average: 33.9%
Stargazers count: 35.2%
Dependent repos count: 35.5%
Downloads: 40.2%
Maintainers (1)
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • R >= 2.10 depends
  • R.utils * imports
  • RColorBrewer * imports
  • dplyr * imports
  • ggplot2 * imports
  • hydroGOF * imports
  • lubridate * imports
  • ncdf4 * imports
  • parallel * imports
  • tidyr * imports
  • testthat >= 3.0.0 suggests