Code Monkey home page Code Monkey logo

apsimwheatphenology's People

Contributors

byzheng avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apsimwheatphenology's Issues

RAPSIM for manipulating APSIM simulation.How to do it ?

Hi! I've been studying APSIM model for one year! But i don't know how to establish the relationship between R language and APSIM model. librarying the Rapsim package with R which is enough.how to prepare those simFiles, simFolders, simSuffix and osbfile ? where are the tutorials? and the code as follow is for Comparing simulated and measured values? Please take time out of your busy schedule to answer my questions. Have a nice day !!!
install.packages("devtools")
devtools::install_github("byzheng/rapsim")
force = TRUE
library(rapsim)

RApsim <- function(
para = NULL,
obsFile = NULL,
simFiles = NULL,
simFolders = NULL,
simSuffix = "outputfile_daily",
xvar = "DaysAfterSowing", ... )
{
para <- setpara( p = para, ... )

Create a new folder if the para$outputPrefix is a folder name

if ( !is.null( para$outputPrefix ) && ( right( para$outputPrefix ) == "/" | right( para$outputPrefix ) == "\" ) )
{
dir.create( para$outputPrefix, showWarnings = FALSE )
}

Read data

sim <- readsim( simFiles, simFolders, simSuffix )
obs <- readobs( obsFile )

Combine Data

sim.obs <- combineObsSim( obs, sim,
para$variables,
para$identifiers,
para$isOutputObsData )

Plot the data

all.plots <- NULL
all.plots[[length( all.plots ) + 1]] <-
plotObsSimCompare( sim.obs, para$identifiers, para$variables )

com.plots <- NULL
if ( !is.null( sim.obs[[xvar]] ) & xvar %in% para$identifiers$sim )
{
xlab <- "Days After Sowing (d)"
com.plots <- plotGraphCombinations( sim.obs,
graph.combinations = para$graph.combinations,
identifiers = para$identifiers,
variables = para$variables,
xvar = xvar,
isOutputObsData = para$isOutputObsData )

plots.num <- length( all.plots )
for ( i in 1:length( com.plots ) )
{
  plots.num <- plots.num + 1
  all.plots[[plots.num]] <- com.plots[[i]]
}

}

filename <- NULL
if ( para$outputPrefix == "" )
{
filename <- paste( "graph.simul-observed", ".", para$outputFormat, sep = "" )
}
else
{
filename <- paste( para$outputPrefix, ".", "graph.simul-observed", ".", para$outputFormat, sep = "" )
}

if ( para$outputFormat == "pdf" )
{
pdf( filename, paper = "a4", width = 8, height = 11, onefile = TRUE )
for ( i in 1:length( all.plots ) )
{
print( all.plots[[i]] )
}
dev.off()
}

}

Error: 'wcal' is not an exported object from 'namespace:weaana'

library(APSIMWheatPhenology)
met <- system.file("extdata/weather.met", package = "APSIMWheatPhenology")
sim <- system.file("extdata/example.sim", package = "APSIMWheatPhenology")

Flowering time using parameter in the sim file

df <- wheatPhenology(sim, stages = 6, stageNames = 'flow', model = 'APSIM',
met = met, daily = FALSE)
#> Error: 'wcal' is not an exported object from 'namespace:weaana'
Created on 2022-02-20 by the reprex package (v2.0.1)

sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=Spanish_Latin America.1252
[2] LC_CTYPE=Spanish_Latin America.1252
[3] LC_MONETARY=Spanish_Latin America.1252
[4] LC_NUMERIC=C
[5] LC_TIME=Spanish_Latin America.1252

attached base packages:
[1] stats graphics grDevices utils datasets
[6] methods base

ApsimX parameter estimation example

Hi Teacher Zheng

When I ran the apsimx example , I encountered the following problem(About the path):

library(ApsimOnR)
library(CroptimizR)
library(dplyr)
library(nloptr)
library(DiceDesign)

TEST ON ONE MODEL and ONE VARIABLE

start_time <- Sys.time()

Select the model

simulation_name <- "GattonRowSpacingRowSpace25cm"

define the variables list

variable_names=c("Wheat.Leaf.LAI")

Getting apsimx file fro the package

apsimx_path="/usr/local/bin/Models" (In this here,I need to fill in the APSIM next generation installation path)
apsimx_path <- 'D:\Program Files\APSIMNG\Bin\Apsimx.exe' This is my Apsim NG installation path,but it's wrong
Error in system(cmd, wait = TRUE, intern = TRUE) : 'D:\Program' not found
Thank you in advance

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.