[Stacomir-commits] r181 - in pkg/stacomir: . R examples inst/config man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Aug 26 22:12:38 CEST 2016
Author: briand
Date: 2016-08-26 22:12:37 +0200 (Fri, 26 Aug 2016)
New Revision: 181
Added:
pkg/stacomir/examples/00_BilanMigration/
Modified:
pkg/stacomir/NAMESPACE
pkg/stacomir/R/BilanFonctionnementDF.r
pkg/stacomir/R/BilanMigration.r
pkg/stacomir/R/BilanMigrationMult.r
pkg/stacomir/R/BilanMigrationPar.r
pkg/stacomir/R/Bilan_carlot.r
pkg/stacomir/R/Bilan_poids_moyen.r
pkg/stacomir/R/Bilan_stades_pigm.r
pkg/stacomir/R/Bilan_taille.r
pkg/stacomir/R/fn_EcritBilanJournalier.r
pkg/stacomir/R/funSousListeBilanMigration.r
pkg/stacomir/R/funSousListeBilanMigrationPar.r
pkg/stacomir/R/setAs.r
pkg/stacomir/R/stacomi.r
pkg/stacomir/inst/config/generate_Roxygen2.R
pkg/stacomir/inst/config/generate_data.R
pkg/stacomir/man/BilanFonctionnementDC-class.Rd
pkg/stacomir/man/BilanMigration-class.Rd
pkg/stacomir/man/BilanMigrationMult-class.Rd
pkg/stacomir/man/BilanMigrationPar-class.Rd
pkg/stacomir/man/Bilan_stades_pigm-class.Rd
pkg/stacomir/man/calcule-Bilan_carlot-method.Rd
pkg/stacomir/man/charge-BilanFonctionnementDC-method.Rd
pkg/stacomir/man/charge-Bilan_carlot-method.Rd
pkg/stacomir/man/connect-BilanFonctionnementDC-method.Rd
pkg/stacomir/man/connect-Bilan_carlot-method.Rd
Log:
Development to version 0.5.0 for BilanMigration. WinProgressBar blocks Check even for Window ? Removed and replaced by Rgtk2
Modified: pkg/stacomir/NAMESPACE
===================================================================
--- pkg/stacomir/NAMESPACE 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/NAMESPACE 2016-08-26 20:12:37 UTC (rev 181)
@@ -4,16 +4,13 @@
export(fun_bilanMigrationMult)
export(fun_bilanMigrationMult_Overlaps)
export(fun_char_spe)
-export(funbarchartDC)
export(funbarchartDF)
-export(funboxDC)
export(funboxDF)
export(funboxplotBilan_carlot)
export(fundensityBilan_carlot)
export(funout)
export(funpointBilan_carlot)
export(funtableBilan_carlot)
-export(funtableDC)
export(funtableDF)
export(funtraitement_poids)
export(hBilanEspecescalc)
Modified: pkg/stacomir/R/BilanFonctionnementDF.r
===================================================================
--- pkg/stacomir/R/BilanFonctionnementDF.r 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/R/BilanFonctionnementDF.r 2016-08-26 20:12:37 UTC (rev 181)
@@ -126,18 +126,23 @@
seqmois=as.POSIXlt(round(seqmois,digits="months"))
#seqmois<-c(seqmois,seqmois[length(seqmois)]+months(1))
t_periodefonctdispositif_per_mois=t_periodefonctdispositif_per[1,]
- progres<-utils::winProgressBar(title =get("msg",envir=envir_stacomi)$BilanFonctionnementDF.4,
- label = get("msg",envir=envir_stacomi)$BilanFonctionnementDF.5,
- min = 0,
- max = 1,
- initial = 0,
- width = 400)
+ ############################
+ #progress bar
+ ###########################
+ progwin <- gtkWindow()
+ progwin$setTitle(get("msg",envir=envir_stacomi)$BilanFonctionnementDF.4)
+ progress_bar <- gtkProgressBar()
+ gtkWidgetSetSizeRequest(progress_bar,600,100)
+ progwin$add(progress_bar)
+ progress_bar$setText(get("msg",envir=envir_stacomi)$BilanFonctionnementDF.5)
+
+
+
z=0 # compteur tableau t_periodefonctdispositif_per_mois
for(j in 1:nrow(t_periodefonctdispositif_per)){
- #cat( j )
- utils::setWinProgressBar(progres,j/nrow(t_periodefonctdispositif_per),
- title=get("msg",envir=envir_stacomi)$BilanFonctionnementDF.4,
- label=sprintf("%d%% progression",round(100*j/nrow(t_periodefonctdispositif_per))))
+ #cat( j
+ progress_bar$setFraction(progres,j/nrow(t_periodefonctdispositif_per))
+ gtkMainIterationDo(FALSE)
if (j>1) t_periodefonctdispositif_per_mois=rbind(t_periodefonctdispositif_per_mois, t_periodefonctdispositif_per[j,])
lemoissuivant=seqmois[seqmois>tempsdebut[j]][1] # le premier mois superieur a tempsdebut
while (tempsfin[j]>lemoissuivant){ # on est a cheval sur deux periodes
@@ -155,8 +160,8 @@
t_periodefonctdispositif_per_mois$mois1= strftime(as.POSIXlt(t_periodefonctdispositif_per_mois$tempsdebut),"%b")
t_periodefonctdispositif_per_mois$mois=strftime(as.POSIXlt(t_periodefonctdispositif_per_mois$tempsdebut),"%m")
t_periodefonctdispositif_per_mois$annee=strftime(as.POSIXlt(t_periodefonctdispositif_per_mois$tempsdebut),"%Y")
+ progress_bar$setText("All done.")
- close(progres)
# graphique
t_periodefonctdispositif_per_mois<-stacomirtools::chnames(t_periodefonctdispositif_per_mois, old_variable_name=c("sumtime.sequence","per_tar_code","per_etat_fonctionnement"),
@@ -190,6 +195,7 @@
}
assign("periodeDF",t_periodefonctdispositif_per_mois,envir_stacomi)
funout(get("msg",envir=envir_stacomi)$BilanFonctionnementDF.8)
+ close(progress_bar)
}
#' FunboxDF draws rectangles to describe the DF work for BilanFonctionnementDF class
Modified: pkg/stacomir/R/BilanMigration.r
===================================================================
--- pkg/stacomir/R/BilanMigration.r 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/R/BilanMigration.r 2016-08-26 20:12:37 UTC (rev 181)
@@ -1,51 +1,26 @@
-# Nom fichier : BilanMigration (classe)
-# Projet : controle migrateur calmig/prog/classe
-# Date de creation : 31/03/2008 17:21:18
-
-#' Class "BilanMigration"
+#' Migration report for one DC, one species and one stage
#'
-#' Balance of fish migrations
-#'
#' @include RefTaxon.r
#' @include RefStades.r
#' @include PasDeTempsJournalier.r
-#' @section Objects from the Class: Objects can be created by calls of the form
-#' \code{new("BilanMigration",
-#' dc=new("RefDC"),taxons=("RefTaxon"),stades=("RefStades"),pasDeTemps=("PasDeTempsJournalier"),data=data.frame(),
-#' time.sequence=new(POSIXct) )}.
-#' \describe{
-#' \item{list("dc")}{Object of class
-#' \code{"RefDC"}: the control device }
-#' \item{:}{Object of class \code{"RefDC"}:
-#' the control device } \item{list("taxons")}{Object of class
-#' \code{"RefTaxon"}: the taxa of the fish}
-#' \item{:}{Object of class
-#' \code{"RefTaxon"}: the taxa of the fish}
-#' \item{list("stades")}{Object of
-#' class \code{"RefStades"} : the stage of the fish}\item{:}{Object of class
-#' \code{"RefStades"} : the stage of the fish}
-#' \item{list("pasDeTemps")}{Object
-#' of class \code{"PasDeTempsJournalier"} : the time step constrained to daily
-#' value and 365 days}
-#' \item{:}{Object of class \code{"PasDeTempsJournalier"} :
-#' the time step constrained to daily value and 365 days}
-#' \item{list("data")}{Object of class \code{"data.frame"} :
-#' data}
-#' \item{:}{Object of class \code{"data.frame"} : data}
-#' \item{list("time.sequence")}{Object of class \code{"POSIXct"} : duration of the
-#' analysis}
-#' \item{:}{Object of class \code{"POSIXct"} : duration of the
-#' analysis} }
+#' @slot dc Object of class \link{RefDC-class}: the control device
+#' @slot taxons Object of class \link{RefTaxon-class}: the species
+#' @slot stades Object of class \link{RefStades-class} : the stage of the fish
+#' @slot pasDeTemps Object of class \link{PasDeTempsJournalier-class} : the time step
+#' constrained to daily value and 365 days
+#' @slot data Object of class \code{data.frame}
+#' @slot time.sequence Object of class \code{POSIXct} : a time sequence of days generated by the calcule method
+#' @note TODO discuss the lenght of the bilan and how it is used to "write" in the database
#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
-#' @seealso Other Bilan Class \code{\linkS4class{Bilan_carlot}}
-#' \code{\linkS4class{Bilan_poids_moyen}}
-#' \code{\linkS4class{Bilan_stades_pigm}} \code{\linkS4class{Bilan_taille}}
-#' \code{\linkS4class{BilanConditionEnv}} \code{\linkS4class{BilanEspeces}}
-#' \code{\linkS4class{BilanFonctionnementDC}}
-#' \code{\linkS4class{BilanFonctionnementDF}}
-#' \code{\linkS4class{BilanMigration}}
-#' \code{\linkS4class{BilanMigrationConditionEnv}}
-#' \code{\linkS4class{BilanMigrationInterAnnuelle}}
+#' @seealso Other Bilan Class \code{\linkS4class{Bilan_carlot}},
+#' \code{\linkS4class{Bilan_poids_moyen}},
+#' \code{\linkS4class{Bilan_stades_pigm}}, \code{\linkS4class{Bilan_taille}},
+#' \code{\linkS4class{BilanConditionEnv}}, \code{\linkS4class{BilanEspeces}},
+#' \code{\linkS4class{BilanFonctionnementDC}},
+#' \code{\linkS4class{BilanFonctionnementDF}},
+#' \code{\linkS4class{BilanMigration}},
+#' \code{\linkS4class{BilanMigrationConditionEnv}},
+#' \code{\linkS4class{BilanMigrationInterAnnuelle}},
#' \code{\linkS4class{BilanMigrationPar}}
#' @concept Bilan Object
#' @export
@@ -85,6 +60,38 @@
calcule( h$action)
}
+#' command line interface for BilanMigration class
+#' @param object An object of class \link{BilanMigration-class}
+#' @param dc A numeric or integer, the code of the dc, coerced to integer,see \link{choice_c-RefDC-method}
+#' @param taxons Either a species name in latin or the SANDRE code for species (ie 2038=Anguilla anguilla),
+#' these should match the ref.tr_taxon_tax referential table in the stacomi database, see \link{choice_c-RefTaxon-method}
+#' @param stades A stage code matching the ref.tr_stadedeveloppement_std table in the stacomi database see \link{choice_c-RefStades-method}
+#' @param datedebut The starting date as a character, formats like \code{%Y-%m-%d} or \code{%d-%m-%Y} can be used as input
+#' @param datefin The finishing date of the Bilan, for this class this will be used to calculate the number of daily steps.
+#' The choice_c method fills in the data slot for RefDC, RefTaxon, RefStades, and RefPasDeTempsJournalier and then
+#' uses the choice_c methods of these object to "select" the data.
+#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
+#' @export
+setMethod("choice_c",signature=signature("BilanMigration"),definition=function(object,dc,taxons,stades,datedebut,datefin){
+ # code for debug using bM_Arzal example
+ #bilanMigration<-bM_Arzal;dc=5;taxons="Liza ramada";stades="IND";datedebut="2015-01-01";datefin="2015-12-31"
+ bilanMigration<-object
+ fonctionnementDC=new("BilanFonctionnementDC")
+ # appel ici pour pouvoir utiliser les fonctions graphiques associees sur fonctionnement du DC
+ assign("fonctionnementDC",fonctionnementDC,envir = envir_stacomi)
+ bilanMigration at dc=charge(bilanMigration at dc)
+ # loads and verifies the dc
+ # this will set dc_selectionne slot
+ bilanMigration at dc<-choice_c(object=bilanMigration at dc,dc)
+ # only taxa present in the bilanMigration are used
+ bilanMigration at taxons<-charge_avec_filtre(object=bilanMigration at taxons,bilanMigration at dc@dc_selectionne)
+ bilanMigration at taxons<-choice_c(bilanMigration at taxons,taxons)
+ bilanMigration at stades<-charge_avec_filtre(object=bilanMigration at stades,bilanMigration at dc@dc_selectionne,bilanMigration at taxons@data$tax_code)
+ bilanMigration at stades<-choice_c(bilanMigration at stades,stades)
+ bilanMigration at pasDeTemps<-choice_c(bilanMigration at pasDeTemps,datedebut,datefin)
+ assign("bilanMigration",bilanMigration,envir = envir_stacomi)
+ return(bilanMigration)
+ })
#' calcule method for BilanMigration
#' @param object An object of class \code{\link{BilanMigration-class}}
Modified: pkg/stacomir/R/BilanMigrationMult.r
===================================================================
--- pkg/stacomir/R/BilanMigrationMult.r 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/R/BilanMigrationMult.r 2016-08-26 20:12:37 UTC (rev 181)
@@ -1,10 +1,9 @@
-#' class BilanMigrationMult
+#' Migration reports for multiple DC / species / stages
#'
#' Migration counts for several Fish counting devices (DC), several taxa and several stages.
-#' This migration count can be built either by the graphical interface or in command line
-#' \code{new("BilanMigrationMult",
-#' dc=new("RefDC"),taxons=("RefTaxon"),stades=new("RefStades"),pasDeTemps=new("PasDeTempsJournalier"),data=data.frame(),calcdata=list(),
-#' coef_conversion=data.frame())}.
+#' This migration count can be built either by the graphical interface or from the command line
+#' (see examples).
+
#' @note A Migration Bilan comes from a migration monitoring : the fishes are monitored in a section of river, this section is
#' called a control station (station). Most often, there is a dam, one or several fishways (DF) which comprise one or several counting devices (DC).
#' On each counting device, the migration is recorded. It can be either an instant recording (video control) or the use of traps,
@@ -24,7 +23,7 @@
#' @slot calcdata A "list" of calculated daily data, one per dc, filled in by the calcule method
#' @slot coef_conversion A data.frame of daily weight to number conversion coefficients, filled in by the connect
#' method if any weight are found in the data slot.
-#' @slot time sequence A POSIXt time sequence
+#' @slot time.sequence A POSIXt time sequence
#' @export
#' @example examples/01_BilanMigrationMult/bilanMigrationMult_Arzal.R
#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
Modified: pkg/stacomir/R/BilanMigrationPar.r
===================================================================
--- pkg/stacomir/R/BilanMigrationPar.r 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/R/BilanMigrationPar.r 2016-08-26 20:12:37 UTC (rev 181)
@@ -1,7 +1,4 @@
-# Nom fichier : BilanMigrationCar (classe)
-# Date de creation : 31/03/2008 17:21:18
-
-#' Class BilanMigrationPar, Migration report along with quantitative and
+#' Migration report along with quantitative and
#' qualitative characteristics
#'
#' Migration along with qualitative or quantitative characteristics or both
@@ -14,7 +11,7 @@
#' @include Refparquan.r
#' @include Refparqual.r
#' @include RefChoix.r
-#' @note the program by default uses two parameter choice, checking box "aucun" will
+#' @note The program by default uses two parameter choice, checking box "aucun" will
#' allow the program to ignore the parameter
#' @section Objects from the Class: Objects can be created by calls of the form
#' \code{new("BilanMigrationPar", ...)}. they are loaded by the interface
@@ -27,22 +24,22 @@
#' @slot taxons An object of class \link{RefTaxon-class} inherited from \link{BilanMigration-class}
#' @slot stades An object of class \link{RefStades-class} inherited from \link{BilanMigration-class}
#' @slot pasDeTemps An object of class \link{PasDeTempsJournalier-class} inherited from \link{BilanMigration-class}
-#' @slot data A\code{data.frame} inherited from \link{BilanMigration-class}, stores the results
+#' @slot data A \code{data.frame} inherited from \link{BilanMigration-class}, stores the results
#' @slot time.sequence An object of class "POSIXct" inherited from \link{BilanMigration-class}
#' @note program : default two parameter choice, checking box "aucun" will allow the program to ignore the parameter
#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
#' @seealso Other Bilan Class
-#' \code{\linkS4class{Bilan_carlot}},
-#' \code{\linkS4class{Bilan_poids_moyen}},
-#' \code{\linkS4class{Bilan_stades_pigm}},
-#' \code{\linkS4class{Bilan_taille}},
+#' \code{\linkS4class{Bilan_carlot}},
+#' \code{\linkS4class{Bilan_poids_moyen}},
+#' \code{\linkS4class{Bilan_stades_pigm}},
+#' \code{\linkS4class{Bilan_taille}},
#' \code{\linkS4class{BilanConditionEnv}},
-#' \code{\linkS4class{BilanEspeces}},
-#' \code{\linkS4class{BilanFonctionnementDC}},
-#' \code{\linkS4class{BilanFonctionnementDF}},
-#' \code{\linkS4class{BilanMigration}},
-#' \code{\linkS4class{BilanMigrationConditionEnv}},
-#' \code{\linkS4class{BilanMigrationInterAnnuelle}},
+#' \code{\linkS4class{BilanEspeces}},
+#' \code{\linkS4class{BilanFonctionnementDC}},
+#' \code{\linkS4class{BilanFonctionnementDF}},
+#' \code{\linkS4class{BilanMigration}},
+#' \code{\linkS4class{BilanMigrationConditionEnv}},
+#' \code{\linkS4class{BilanMigrationInterAnnuelle}},
#' \code{\linkS4class{BilanMigrationPar}}
#' @concept Bilan Object
setClass(Class="BilanMigrationPar",
@@ -80,7 +77,7 @@
#' calcule methode
#'
#'
-#'@param object An object of class \code{\link{BilanMigrationPar}}
+#'@param object An object of class \code{\link{BilanMigrationPar-class}}
setMethod("calcule",signature=signature("BilanMigrationPar"),definition=function(object){
bilanMigrationPar<-object
if (exists("refDC",envir_stacomi)) {
Modified: pkg/stacomir/R/Bilan_carlot.r
===================================================================
--- pkg/stacomir/R/Bilan_carlot.r 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/R/Bilan_carlot.r 2016-08-26 20:12:37 UTC (rev 181)
@@ -123,7 +123,7 @@
#' Calcule method for Bilan_carlot
#'
-#' @param object An object of class \code{\link{Bilan_carlot}}
+#' @param object An object of class \code{\link{Bilan_carlot-class}}
#' @param h a handler
#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
setMethod("calcule",signature=signature("Bilan_carlot"),definition=function(object,h) {
Modified: pkg/stacomir/R/Bilan_poids_moyen.r
===================================================================
--- pkg/stacomir/R/Bilan_poids_moyen.r 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/R/Bilan_poids_moyen.r 2016-08-26 20:12:37 UTC (rev 181)
@@ -19,9 +19,9 @@
#' @slot anneedebut Object of class \code{\link{RefAnnee-class}}. refAnnee allows to choose year of beginning
#' @slot anneefin Object of class \code{\link{RefAnnee-class}}
#' refAnnee allows to choose last year of the Bilan
-#' @slot coe Object of class \code{\link{RefCoe}} class loading coefficient
+#' @slot coe Object of class \code{\link{RefCoe-class}} class loading coefficient
#' of conversion between quantity (weights or volumes of glass eel) and numbers
-#' @slot liste Object of class \code{\link{RefListe}} RefListe referential
+#' @slot liste Object of class \code{\link{RefListe-class}} RefListe referential
#' class choose within a list, here the choice is wether subsamples or not. Subsamples
#' in the stacomi database are samples with a non null value for parent sample. Migration
#' counts are never made on subsamples but those can be integrated to calculate mean weights.
Modified: pkg/stacomir/R/Bilan_stades_pigm.r
===================================================================
--- pkg/stacomir/R/Bilan_stades_pigm.r 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/R/Bilan_stades_pigm.r 2016-08-26 20:12:37 UTC (rev 181)
@@ -221,7 +221,7 @@
#'
#' method used by the graphical interface to build object from values
#' stored in envir_stacomi
-#' @param object An object of class \code{\link{Bilan_carlot}}
+#' @param object An object of class \code{\link{Bilan_stades_pigm-class}}
#' @param h A handler
#' @return Bilan_stades_pigm with slots filled with user choice
#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
Modified: pkg/stacomir/R/Bilan_taille.r
===================================================================
--- pkg/stacomir/R/Bilan_taille.r 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/R/Bilan_taille.r 2016-08-26 20:12:37 UTC (rev 181)
@@ -13,8 +13,8 @@
#' by a query to display on a single line two different characteristics size
#' and size group Once the data are loaded, the program checks if the size
#' class group is indicated at the sample or susample level
-
-#' @slot dc an object of class \link{RefDC-class}
+#' @slot data A data frame
+#' @slot dc An object of class \link{RefDC-class}
#' @slot taxons An object of class \link{RefTaxon-class}
#' @slot stades An object of class \link{RefStades-class} inherited from \link{BilanMigration-class}
#' @slot parquan An object of class \link{Refparquan-class}, quantitative parameter
@@ -26,15 +26,15 @@
#' @section Objects from the Class: Objects can be created by calls of the form
#' \code{new("Bilan_taille", ...)}
#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
-#' @seealso Other Bilan Classes \code{\linkS4class{Bilan_carlot}},
-#' \code{\linkS4class{Bilan_poids_moyen}},
-#' \code{\linkS4class{Bilan_stades_pigm}}, \code{\linkS4class{Bilan_taille}},
-#' \code{\linkS4class{BilanConditionEnv}}, \code{\linkS4class{BilanEspeces}},
-#' \code{\linkS4class{BilanFonctionnementDC}},
-#' \code{\linkS4class{BilanFonctionnementDF}},
-#' \code{\linkS4class{BilanMigration}},
-#' \code{\linkS4class{BilanMigrationConditionEnv}},
-#' \code{\linkS4class{BilanMigrationInterAnnuelle}},
+#' @seealso Other Bilan Classes \code{\linkS4class{Bilan_carlot}},
+#' \code{\linkS4class{Bilan_poids_moyen}},
+#' \code{\linkS4class{Bilan_stades_pigm}}, \code{\linkS4class{Bilan_taille}},
+#' \code{\linkS4class{BilanConditionEnv}}, \code{\linkS4class{BilanEspeces}},
+#' \code{\linkS4class{BilanFonctionnementDC}},
+#' \code{\linkS4class{BilanFonctionnementDF}},
+#' \code{\linkS4class{BilanMigration}},
+#' \code{\linkS4class{BilanMigrationConditionEnv}},
+#' \code{\linkS4class{BilanMigrationInterAnnuelle}},
#' \code{\linkS4class{BilanMigrationPar}}
#' @concept Bilan Object
#' @examples
@@ -62,7 +62,7 @@
requete=new("RequeteODBC")))
#' connect method for class Bilan_taille
-#' @param object An object of class \code{\link{Bilan_taille}}
+#' @param object An object of class \code{\link{Bilan_taille-class}}
#' @param ... Additional parameters
#' @return bilan_taille with requete field filled
#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
@@ -129,7 +129,7 @@
#object=new("Bilan_taille")
#' charge method for Bilan_taille
-#' @param object An object of class \code{\link{Bilan_taille}}
+#' @param object An object of class \code{\link{Bilan_taille-class}}
#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
setMethod("charge",signature=signature("Bilan_taille"),definition=function(object) {
if (exists("refDC",envir_stacomi)) {
@@ -182,7 +182,7 @@
calcule(h$action)
}
#' Calcule method for BilanTaille
-#' @param object An object of class \code{\link{Bilan_taille}}
+#' @param object An object of class \code{\link{Bilan_taille-class}}
#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
setMethod("calcule",signature=signature("Bilan_taille"),definition=function(object) {
bilan_taille<-object
Modified: pkg/stacomir/R/fn_EcritBilanJournalier.r
===================================================================
--- pkg/stacomir/R/fn_EcritBilanJournalier.r 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/R/fn_EcritBilanJournalier.r 2016-08-26 20:12:37 UTC (rev 181)
@@ -42,19 +42,29 @@
requete at baseODBC<-get("baseODBC",envir=envir_stacomi)
requete at silent=TRUE
requete at open=TRUE
- progres<-utils::winProgressBar(title = get("msg",envir=envir_stacomi)$fn_EcritBilanJournalier.3,
- label = get("msg",envir=envir_stacomi)$fn_EcritBilanJournalier.4,
- min = 0,
- max = 1,
- initial = 0,
- width = 400)
+ # progress bar
+# OLD CODE = problems to pass Rcheck
+# progres<-utils::winProgressBar(title = get("msg",envir=envir_stacomi)$fn_EcritBilanJournalier.3,
+# label = get("msg",envir=envir_stacomi)$fn_EcritBilanJournalier.4,
+# min = 0,
+# max = 1,
+# initial = 0,
+# width = 400)
+ progwin <- gtkWindow()
+ progwin$setTitle(get("msg",envir=envir_stacomi)$fn_EcritBilanJournalier.3)
+ progress_bar <- gtkProgressBar()
+ gtkWidgetSetSizeRequest(progress_bar,600,100)
+ progwin$add(progress_bar)
+ progress_bar$setText(get("msg",envir=envir_stacomi)$fn_EcritBilanJournalier.4)
for (i in 1:nrow(t_bilanmigrationjournalier_bjo)) {
- zz=i/nrow(t_bilanmigrationjournalier_bjo)
- utils::setWinProgressBar(progres,
- zz,
- title=get("msg",envir=envir_stacomi)$fn_EcritBilanJournalier.5,
- label=sprintf("%d%% progression",
- round(100*zz)))
+ zz=i/nrow(t_bilanmigrationjournalier_bjo)
+ progress_bar$setFraction(progres,zz)
+ gtkMainIterationDo(FALSE)
+# utils::setWinProgressBar(progres,
+# zz,
+# title=get("msg",envir=envir_stacomi)$fn_EcritBilanJournalier.5,
+# label=sprintf("%d%% progression",
+# round(100*zz)))
requete at sql=paste( "INSERT INTO ",get("sch",envir=envir_stacomi),"t_bilanmigrationjournalier_bjo (",
"bjo_dis_identifiant,bjo_tax_code,bjo_std_code,bjo_annee,bjo_jour,bjo_valeur,bjo_labelquantite,bjo_horodateexport,bjo_org_code)",
" VALUES " ,"('",paste(t_bilanmigrationjournalier_bjo[i,],collapse="','"),"');",sep="")
Modified: pkg/stacomir/R/funSousListeBilanMigration.r
===================================================================
--- pkg/stacomir/R/funSousListeBilanMigration.r 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/R/funSousListeBilanMigration.r 2016-08-26 20:12:37 UTC (rev 181)
@@ -35,14 +35,14 @@
req=new("RequeteODBC")
req at baseODBC<-get("baseODBC", envir=envir_stacomi)
req at open<-TRUE
- progres<-utils::winProgressBar(title = "calcul des effectifs par pas de temps",
- label = "progression %",
- min = 0,
- max = 1,
- initial = 0,
- width = 400)
+ progwin <- gtkWindow()
+ progwin$setTitle("Calcul des effectifs par pas de temps")
+ progress_bar <- gtkProgressBar()
+ gtkWidgetSetSizeRequest(progress_bar,600,100)
+ progwin$add(progress_bar)
+ progress_bar$setText(get("msg",envir=envir_stacomi)$BilanFonctionnementDF.5)
##############################
- on.exit(close(progres)) # fermeture de la barre de progres
+ on.exit(dispose(progress_bar)) # fermeture de la barre de progres
on.exit(if(!is.null(req at connection)) odbcClose(req at connection)) # ne pas lancer en debug
##############################"
##debug
@@ -53,7 +53,8 @@
dateFin=strftime(as.POSIXlt(DateFin(bilanMigration at pasDeTemps)),format="%Y-%m-%d %H:%M:%S")
while (getnoPasCourant(bilanMigration at pasDeTemps) != -1) {
zz=(getnoPasCourant(bilanMigration at pasDeTemps)+1)/bilanMigration at pasDeTemps@nbStep
- utils::setWinProgressBar(progres,zz,title="calcul des effectifs par pas de temps",label=sprintf("%d%% progression",round(100*zz)))
+ progress_bar$setFraction(progres,zz)
+ gtkMainIterationDo(FALSE)
debutPas = as.POSIXlt(currentDateDebut(bilanMigration at pasDeTemps))
finPas = as.POSIXlt(currentDateFin(bilanMigration at pasDeTemps))
if(finPas!=round(finPas,"day")) stop("problemes d'arrondi dans le calcul de la date, verifier la fonction funsouslistebilanmigration")
Modified: pkg/stacomir/R/funSousListeBilanMigrationPar.r
===================================================================
--- pkg/stacomir/R/funSousListeBilanMigrationPar.r 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/R/funSousListeBilanMigrationPar.r 2016-08-26 20:12:37 UTC (rev 181)
@@ -41,13 +41,19 @@
req=new("RequeteODBC")
req at open<-TRUE
req at baseODBC<-get("baseODBC", envir=envir_stacomi)
- assign("progres",utils::winProgressBar(title = "cumul val. quant. par pas de temps",
- label = "progression %",
- min = 0,
- max = 1,
- initial = 0,
- width = 400),
- envir = .GlobalEnv)
+# assign("progres",utils::winProgressBar(title = "cumul val. quant. par pas de temps",
+# label = "progression %",
+# min = 0,
+# max = 1,
+# initial = 0,
+# width = 400),
+# envir = .GlobalEnv)
+ progwin <- gtkWindow()
+ progwin$setTitle("cumul val. quant. par pas de temps")
+ progress_bar <- gtkProgressBar()
+ gtkWidgetSetSizeRequest(progress_bar,600,100)
+ progwin$add(progress_bar)
+ progress_bar$setText(get("msg",envir=envir_stacomi)$BilanFonctionnementDF.5)
##############################
on.exit(close(progres))
on.exit(if(!is.null(req at connection)) odbcClose(req at connection)) # ne pas lancer en debug
@@ -76,7 +82,10 @@
#bilanMigrationPar at pasDeTemps@noPasCourant=as.integer(-(difftime(as.POSIXlt(strptime("2006-01-01 00:00:00",format="%Y-%m-%d %H:%M:%S")),as.POSIXlt(strptime("2006-03-27 00:00:00",format="%Y-%m-%d %H:%M:%S")),unit="days")))
while (getnoPasCourant(bilanMigrationPar at pasDeTemps) != -1) {
zz=(getnoPasCourant(bilanMigrationPar at pasDeTemps)+1)/bilanMigrationPar at pasDeTemps@nbStep
- utils::setWinProgressBar(progres,zz,title="cumul val. quant. par pas de temps",label=sprintf("%d%% progression",round(100*zz)))
+
+ progress_bar$setFraction(progres,zz)
+ gtkMainIterationDo(FALSE)
+ #utils::setWinProgressBar(progres,zz,title="cumul val. quant. par pas de temps",label=sprintf("%d%% progression",round(100*zz)))
debutPas = as.POSIXlt(currentDateDebut(bilanMigrationPar at pasDeTemps))
finPas = as.POSIXlt(currentDateFin(bilanMigrationPar at pasDeTemps))
#finPas=as.POSIXlt(DateFin(bilanMigrationPar at pasDeTemps)) # pour debug avoir quelque chose dans le resultset
Modified: pkg/stacomir/R/setAs.r
===================================================================
--- pkg/stacomir/R/setAs.r 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/R/setAs.r 2016-08-26 20:12:37 UTC (rev 181)
@@ -1,23 +1,3 @@
-# Nom fichier : setAs.R
-# Projet : GEMAC/Prog global
-# Organisme : IAV/CEMAGREF
-# Auteur : Cedric Briand
-# Contact : cedric.briand"at"eptb-vilaine.fr
-# Date de creation : 02/12/2005 14:28:09
-# Description : Fonction de conversion entre classes
-# Data needed
-# Packages needed
-# remarques
-#
-#**********************************************************************
-#*
-#* Modifications :
-#* ---------------
-#* JJ-MM-AAAA #No Prenom NOM [INITIALES] :
-#* explication de la modification
-#*
-#**********************************************************************
-# from=new("BilanMigration")
setAs("BilanMigration","BilanMigrationInterAnnuelle",function(from,to){
anneeDebut=new("RefAnnee")
anneeFin=new("RefAnnee")
@@ -30,4 +10,17 @@
bilanMigrationInterAnnuelle at anneeDebut=anneeDebut
bilanMigrationInterAnnuelle at anneeFin=anneeFin
return(bilanMigrationInterAnnuelle)
-})
\ No newline at end of file
+})
+
+
+setAs("BilanMigration","BilanMigrationMult",function(from,to){
+ bMM=new("BilanMigrationMult")
+ bMM at dc=from at dc
+ bMM at taxons=from at taxons
+ bMM at stades=from at stades
+ bMM at datedebut=from at datedebut
+ bMM at anneeFin=from at datefin
+ bMM at anneeFin=from at datefin
+ bMM at data=from at data
+ return(bMM)
+ })
\ No newline at end of file
Modified: pkg/stacomir/R/stacomi.r
===================================================================
--- pkg/stacomir/R/stacomi.r 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/R/stacomi.r 2016-08-26 20:12:37 UTC (rev 181)
@@ -247,8 +247,6 @@
#' @importFrom grid pushViewport
#' @importFrom grid grid.newpage
#' @importFrom grid grid.layout
-#' @importFrom utils winProgressBar
-#' @importFrom utils setWinProgressBar
#' @importFrom utils read.csv
#' @importFrom utils stack
#' @importFrom utils globalVariables
Modified: pkg/stacomir/inst/config/generate_Roxygen2.R
===================================================================
--- pkg/stacomir/inst/config/generate_Roxygen2.R 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/inst/config/generate_Roxygen2.R 2016-08-26 20:12:37 UTC (rev 181)
@@ -30,6 +30,7 @@
#vignette("roxygen2")
setwd("F:/workspace/stacomir/pkg/stacomir")
data("bMM_Arzal")
+data("bM_Arzal")
data("msg")
envir_stacomi <- new.env(parent = emptyenv())
require(roxygen2)
Modified: pkg/stacomir/inst/config/generate_data.R
===================================================================
--- pkg/stacomir/inst/config/generate_data.R 2016-08-25 15:05:18 UTC (rev 180)
+++ pkg/stacomir/inst/config/generate_data.R 2016-08-26 20:12:37 UTC (rev 181)
@@ -17,18 +17,44 @@
##################################
require(stacomiR)
stacomi(FALSE,FALSE,FALSE)
-bMM_Arzal=new("BilanMigrationMult")
-bMM_Arzal=choice_c(bMM_Arzal,
+bM_Arzal=new("BilanMigrationMult")
+bM_Arzal=choice_c(bM_Arzal,
dc=c(5,6,12),
taxons=c("Anguilla anguilla"),
stades=c("AGG","AGJ","CIV"),datedebut="2011-01-01",datefin="2011-12-31")
-bMM_Arzal<-connect(bMM_Arzal)
+bM_Arzal<-connect(bM_Arzal)
# to avoid warnings at package checks
-bMM_Arzal at dc@data[,"dis_commentaires"]<-iconv(bMM_Arzal at dc@data[,"dis_commentaires"],from="latin1",to="UTF8")
-bMM_Arzal at dc@data[,"type_df"]<-iconv(bMM_Arzal at dc@data[,"type_df"],from="latin1",to="UTF8")
-bMM_Arzal at dc@data[,"type_dc"]<-iconv(bMM_Arzal at dc@data[,"type_dc"],from="latin1",to="UTF8")
-bMM_Arzal at dc@data[,"dif_localisation"]<-iconv(bMM_Arzal at dc@data[,"dif_localisation"],from="latin1",to="UTF8")
-bMM_Arzal at taxons@data[,"tax_nom_commun"]<-iconv(bMM_Arzal at taxons@data[,"tax_nom_commun"],from="latin1",to="UTF8")
-bMM_Arzal at stades@data[,"std_libelle"]<-iconv(bMM_Arzal at stades@data[,"std_libelle"],from="latin1",to="UTF8")
+bM_Arzal at dc@data[,"dis_commentaires"]<-iconv(bM_Arzal at dc@data[,"dis_commentaires"],from="latin1",to="UTF8")
+bM_Arzal at dc@data[,"type_df"]<-iconv(bM_Arzal at dc@data[,"type_df"],from="latin1",to="UTF8")
+bM_Arzal at dc@data[,"type_dc"]<-iconv(bM_Arzal at dc@data[,"type_dc"],from="latin1",to="UTF8")
+bM_Arzal at dc@data[,"dif_localisation"]<-iconv(bM_Arzal at dc@data[,"dif_localisation"],from="latin1",to="UTF8")
+bM_Arzal at taxons@data[,"tax_nom_commun"]<-iconv(bM_Arzal at taxons@data[,"tax_nom_commun"],from="latin1",to="UTF8")
+bM_Arzal at stades@data[,"std_libelle"]<-iconv(bM_Arzal at stades@data[,"std_libelle"],from="latin1",to="UTF8")
setwd("F:/workspace/stacomir/pkg/stacomir")
-devtools::use_data(bMM_Arzal,internal=FALSE,overwrite=TRUE)
\ No newline at end of file
+devtools::use_data(bM_Arzal,internal=FALSE,overwrite=TRUE)
+
+
+#################################
+# generates dataset for BilanMigrationMult
+# from the vertical slot fishway located at the estuary of the Vilaine (Brittany)
+# Taxa Liza Ramada (Thinlip grey mullet) in 2015
+##################################
+
+stacomi(gr_interface=FALSE,
+ login_window=FALSE,
+ pre_launch_test=FALSE)
+bM_Arzal=new("BilanMigration")
+bM_Arzal=choice_c(bM_Arzal,
+ dc=5,
+ taxons=c("Liza ramada"),
+ stades=c("IND"),
+ datedebut="2015-01-01",
+ datefin="2015-12-31")
+bM_Arzal at dc@data[,"dis_commentaires"]<-iconv(bM_Arzal at dc@data[,"dis_commentaires"],from="latin1",to="UTF8")
+bM_Arzal at dc@data[,"type_df"]<-iconv(bM_Arzal at dc@data[,"type_df"],from="latin1",to="UTF8")
+bM_Arzal at dc@data[,"type_dc"]<-iconv(bM_Arzal at dc@data[,"type_dc"],from="latin1",to="UTF8")
+bM_Arzal at dc@data[,"dif_localisation"]<-iconv(bM_Arzal at dc@data[,"dif_localisation"],from="latin1",to="UTF8")
+bM_Arzal at taxons@data[,"tax_nom_commun"]<-iconv(bM_Arzal at taxons@data[,"tax_nom_commun"],from="latin1",to="UTF8")
+bM_Arzal at stades@data[,"std_libelle"]<-iconv(bM_Arzal at stades@data[,"std_libelle"],from="latin1",to="UTF8")
+setwd("F:/workspace/stacomir/pkg/stacomir")
+devtools::use_data(bM_Arzal,internal=FALSE,overwrite=TRUE)
\ No newline at end of file
Modified: pkg/stacomir/man/BilanFonctionnementDC-class.Rd
===================================================================
--- pkg/stacomir/man/BilanFonctionnementDC-class.Rd 2016-08-25 15:05:18 UTC (rev 180)
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/stacomir -r 181
More information about the Stacomir-commits
mailing list