Changes between Initial Version and Version 1 of Documentation/UserGuide/HistoryOperators


Ignore:
Timestamp:
2012-09-12T10:23:28+02:00 (12 years ago)
Author:
dsolyga
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/UserGuide/HistoryOperators

    v1 v1  
     1= How to understand the operations performed on the variables when written in the history files = 
     2 '''1. IOIPSL/src/histcom.f90'''[[BR]] 
     3 
     4First read more about the IOIPSL module that manages the history files here: 
     5http://www.ipsl.jussieu.fr/~ioipsl/WWW2/index.html 
     6 
     7The main information __useful for ORCHIDEE__ is reproduced below:[[BR]] 
     8 
     9''histdef'': The variables which will be written are declared and the following information is passed: 
     10 * name of variable 
     11 * title  
     12 * units  
     13 * size of the variable  
     14 * '''operation to be carried out on the variable before writing it''' 
     15 * frequency at which the operations need to be done (positive values are in units of seconds and negative values are in units of month)  
     16 * frequency at which the resulting data need to be written into the file(positive values are in units of seconds and negative values are in units of month)  
     17 
     18'''Allowed operations'''[[BR]] 
     19 
     20In ''histdef'' the user may specify for each field that is going to be archived a number of operations. 3 types may be distinguished: Vector operations, vector-scalar operations and index operations on the vector. In the description of the operations to be carried out the vector will be represented by x. For instance a gather operation will be written "gather(x)". It must be noted that the indexing operations will use as index vector the one passed to histwrite. On top of this a time operation has to be chosen. There only one is allowed and it should be outer most operator. For instance the time averaging of the gather operation will be written as "ave(gather(x))". 
     21 
     22 * Allowed time operations: 
     23||ave||time average of the field|| 
     24||inst||instantaneous values of the field is going to be written|| 
     25||t_min||the minimum value over the time period is going to be archived|| 
     26||t_max||the maximum value over the time period is going to be archived|| 
     27||t_sum||sums the variable over time|| 
     28||once||the field is written once on the file without any time axis|| 
     29||never||the field is never written|| 
     30 
     31 * Allowed vector operations:[[BR]] 
     32Usage: cels(x) 
     33||cels||transforms the field into degrees Celsius|| 
     34 
     35 * Allowed vector-scalar operations:[[BR]] 
     36Usage: scal*x 
     37||*||multiplication|| 
     38 
     39 * Allowed indexing operations:[[BR]] 
     40Usage: gather(x) 
     41||gather||Gathers from the input data all the points listed in index and puts them onto the file. Other points in the resulting array are going to labeled as missing. This operation could be used to reduce the resolution of  the history file.|| 
     42||scatter||Scatters from the input data onto the points which are listed in the index. Other points are going to be labeled as missing. This is used for instance to put a variable only available over oceans onto a global grid.|| 
     43 
     44Examples:[[BR]] 
     45 * ave(scatter(cels(X)): Will average the variables (temperature for instance) in celsius and scatter it onto the grid. This could be used in an ocean model where all grid points are in a vector and cover only ocean points. Thus in the history file you will have the field placed correctly on the map. 
     46 * ave(max(cels(x),0.)): Average over time only the temperature (if that is the variable in Kelvin) which are above 0. 
     47 * t_max(X): Computes the maximum over the time between two writes of the variable. 
     48 
     49 
     50 '''2. src_sechiba/intersurf.f90'''[[BR]] 
     51 
     52The ''histdef'' calls are made in the ''intsurf_history'' subroutine for the sechiba history file and similarly in the ''stom_define_history'' subroutine for the stomate history file. 
     53 
     54Characters strings are first declared to perform units conversion for fluxes: 
     55 
     56{{{ 
     57!! Operations to be performed on fluxes 
     58CHARACTER(LEN=30)   :: flux_op      
     59!! Operations which do not include a scatter                
     60CHARACTER(LEN=30)   :: flux_sc     
     61!! Operation in seconds                 
     62CHARACTER(LEN=30)   :: flux_insec, flux_scinsec  
     63}}} 
     64   
     65 
     66The history level will determine the number of output variables: 
     67 
     68{{{ 
     69!! history output level (default is 10 => maximum output) 
     70INTEGER(i_std)     :: hist_level  
     71}}} 
     72 
     73The following strings arrays will contain the operation to perform from 1 to hist_level and contain ‘never’ from hist_level to 10, meaning there is nothing to do (the variable is not written in the history file). 
     74 
     75{{{ 
     76!! The various operations to be performed 
     77CHARACTER(LEN=40),DIMENSION(max_hist_level) :: & 
     78         & ave, avecels, avescatter, fluxop, & 
     79         & fluxop_scinsec, tmincels, tmaxcels, once, sumscatter   
     80}}} 
     81 
     82For fluxes, the operation is written as a string with IOIPSL operators including a multiplication by the number required to obtain the desired output unit: 
     83 
     84{{{ 
     85WRITE(flux_op,'("ave(scatter(X*",F8.1,"))")') one_day/dt 
     86WRITE(flux_sc,'("ave(X*",F8.1,")")') one_day/dt 
     87WRITE(flux_insec,'("ave(X*",F8.6,")")') un/dt 
     88WRITE(flux_scinsec,'("ave(scatter(X*",F8.6,"))")') un/dt 
     89}}} 
     90 
     91Reading of the chosen history level from the run.def file: 
     92 
     93{{{ 
     94!Config  Key  = SECHIBA_HISTLEVEL 
     95!Config  Desc = SECHIBA history output level (0..10) 
     96!Config  Def  = 5 
     97!Config  Help = Chooses the list of variables in the history file.  
     98!Config         Values between 0: nothing is written; 10: everything is  
     99!Config         written are available More details can be found on the web under documentation. 
     100!Config         web under documentation. 
     101hist_level = 5 
     102CALL getin_p('SECHIBA_HISTLEVEL', hist_level) 
     103}}} 
     104 
     105 
     106 
     107{{{ 
     108!- define operations as a function of history level. 
     109!- Above hist_level, operation='never' 
     110ave(1:max_hist_level) = 'ave(X)' 
     111IF (hist_level < max_hist_level) THEN 
     112       ave(hist_level+1:max_hist_level) = 'never' 
     113ENDIF 
     114sumscatter(1:max_hist_level) = 't_sum(scatter(X))' 
     115IF (hist_level < max_hist_level) THEN 
     116       sumscatter(hist_level+1:max_hist_level) = 'never' 
     117ENDIF 
     118avecels(1:max_hist_level) = 'ave(cels(X))' 
     119IF (hist_level < max_hist_level) THEN 
     120       avecels(hist_level+1:max_hist_level) = 'never' 
     121ENDIF 
     122avescatter(1:max_hist_level) = 'ave(scatter(X))' 
     123IF (hist_level < max_hist_level) THEN 
     124       avescatter(hist_level+1:max_hist_level) = 'never' 
     125ENDIF 
     126tmincels(1:max_hist_level) = 't_min(cels(X))' 
     127IF (hist_level < max_hist_level) THEN 
     128       tmincels(hist_level+1:max_hist_level) = 'never' 
     129ENDIF 
     130tmaxcels(1:max_hist_level) = 't_max(cels(X))' 
     131IF (hist_level < max_hist_level) THEN 
     132       tmaxcels(hist_level+1:max_hist_level) = 'never' 
     133ENDIF 
     134fluxop(1:max_hist_level) = flux_op 
     135IF (hist_level < max_hist_level) THEN 
     136       fluxop(hist_level+1:max_hist_level) = 'never' 
     137ENDIF 
     138fluxop_scinsec(1:max_hist_level) = flux_scinsec 
     139IF (hist_level < max_hist_level) THEN 
     140       fluxop_scinsec(hist_level+1:max_hist_level) = 'never' 
     141ENDIF 
     142once(1:max_hist_level) = 'once(scatter(X))' 
     143IF (hist_level < max_hist_level) THEN 
     144       once(hist_level+1:max_hist_level) = 'never' 
     145ENDIF 
     146}}} 
     147 
     148 
     149If for example ''hist_lev''=5, for a variable with a corresponding ''histdef'' call containing ''operator''(6), ''operator''(6) is ‘never’ and the variable won’t appear in the history file. For another variable with a corresponding ''histdef'' call containing ''operator''(4), the variable will be processing according to the ''operator'' definition and written in the history file.[[BR]] 
     150 
     151 
     152 
     153Example:[[BR]] 
     154 
     155ALMA convention [[BR]] 
     156 
     157Here we divide per dt to get per seconds: 
     158 
     159 
     160{{{ 
     161CALL histdef(hist_id, 'Evap', 'Total Evapotranspiration', 'kg/m2/s', &  
     162           & iim,jjm, hori_id, 1,1,1, -99, 32, fluxop_scinsec(1), dt, dw)  
     163}}} 
     164 
     165NOT ALMA [[BR]] 
     166 
     167Here we multiply per one_day/dt to get per days:  
     168 
     169{{{ 
     170CALL histdef(hist_id, 'evap', 'Evaporation', 'mm/d', &  
     171           & iim,jjm, hori_id, 1,1,1, -99, 32, fluxop(1), dt, dw)  
     172}}} 
     173