ETHZ_Logo RAMSES_Logo_Right   RAMSES   RAMSES_Logo_Left Systems Ecology  
Start    search button      Modules:   A-Z   Function   Layer        QuickRefs:   DM   AuxLib   AuxLibE   SciLib   EasyMW   MW   ISIS   RMSLib

DEFINITION MODULE MWGFitParams;

  (*******************************************************************

    Module  MWGFitParams     (Version 1.0)

      Copyright (c) 1996-2006 by Dimitrios Gyalistras and ETH Zurich.

    Purpose   Fit parameters needed for stochastic
              simulation of monthly weather variables.

    Remarks   Missing data are recognized and returned as
              DMConversions.UndefREAL() or UndefLONGREAL().

              This module is part of the package MonWeathGen.


    Programming

      o Design
        Dimitrios Gyalistras      09/12/1996

      o Implementation
        Dimitrios Gyalistras      09/12/1996


    ETH Zurich
    Systems Ecology
    CHN E 35.1
    Universitaetstrasse 16
    8092 Zurich
    SWITZERLAND

    URLs:
        <mailto:RAMSES@env.ethz.ch>
        <http://www.sysecol.ethz.ch>
        <http://www.sysecol.ethz.ch/SimSoftware/RAMSES>


    Last revision of definition:  24/05/2002  AF

  *******************************************************************)


  IMPORT Errors;

  FROM LgMatrices IMPORT
    LMatrix;

  FROM MonWeathGen IMPORT
    MWGLRealVec, MWGIntVec, MWGLRealVecArr, MWGLnTrfTVecArr, MWGLMatrixArr;


  CONST  (* result codes returned *)
    allOk   = Errors.allOk;
    notDone = Errors.onlyAnInsert;

  TYPE
    MWGModelType = ( simple,
                     crossCorr,
                     fixedPhaseCyclostat,
                     phaseAveragedCyclostat );


  PROCEDURE FitMWGParams(

      (*  1. input data  *)
      nVariables          : INTEGER;         (* number of variables/time series *)
      nTimePoints         : INTEGER;         (* number of time points *)
      timeSeries          : LMatrix;         (* input time series at a monthly time step:
                                                rows = variables, columns = timepoints;
                                                first month = Jan *)
      (*  2. model specification  *)
      mwgModelType        : MWGModelType;    (* type of model *)
      chi2SgnfLevForLnTrf : MWGLRealVec;     (* a Log-Normal transformation for skewness reduction
                                                is applied if the hypothesis that the variable
                                                is not normally distributed is accepted with a
                                                probability > sgnfLev (given in %); you may choose
                                                sgnfLev=0.0 to always force, and sgnfLev=100.0
                                                to always avoid a LogN-transformation *)
      nHarmonicsMuSig     : MWGIntVec;       (* number of harmonics for mu and stdev *)
      nHarmonicsCycSt     : INTEGER;         (* number of harmonics for determination of matrices
                                                A and B if mwgModelType = phaseAveragedCyclostat *)
      (*  3. fitted parameters  *)
      VAR mu              : MWGLRealVecArr;  (* long-term means *)
      VAR sig             : MWGLRealVecArr;  (* long-term standard deviations *)
      VAR lnTrfType       : MWGLnTrfTVecArr; (* type of Log-Normal transf. applied (if any )  *)
      VAR lnTrfMu         : MWGLRealVecArr;  (* mu of transformed variables *)
      VAR lnTrfSig        : MWGLRealVecArr;  (* sig of transformed variables *)
      VAR lnTrfTheta      : MWGLRealVecArr;  (* theta (offset)-parameter of transformed variables *)
      VAR A, B            : MWGLMatrixArr;   (* matrices of stochastic process *)
      VAR nParsFitted     : INTEGER;         (* effective number of parameters fitted *)

      VAR resCode         : INTEGER;
      VAR errTxt          : ARRAY OF CHAR );

  (* NOTE: all LMatrix objects in A and B are first de-allocated and then
  re-allocated.  Usage of MonWeathGen.ResetMWGLMatrixArr prior to calling
  this procedure for the first time is recommended. *)

END MWGFitParams.

  Contact RAMSES@env.ethz.ch Last updated: 25-Jul-2011 [Top of page]