Changeset 529 for XIOS/branchs


Ignore:
Timestamp:
12/04/14 15:36:07 (9 years ago)
Author:
aclsce
Message:
  • Added xios_variable as public type (in order to be used by the xios client)
  • Added example of getting/setting variable as global/local attribute of field/file in test_complete.
  • Some cleaning in test_complete program and xml files.
Location:
XIOS/branchs/xios-1.0
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • XIOS/branchs/xios-1.0/inputs/COMPLETE/context_atmosphere.xml

    r486 r529  
    11<!-- Context atm --> 
    22   
    3 <context id="atmopshere" calendar_type="Gregorian" start_date="2012-03-01 15:00:00" time_origin="2012-02-29 15:00:00"> 
     3<context id="atmosphere" calendar_type="Gregorian" start_date="2012-03-01 15:00:00" time_origin="2012-02-29 15:00:00"> 
    44 
    55  <field_definition level="1" enabled=".FALSE." default_value="9.96921e+36"> 
     
    2626   </domain_definition>     
    2727   
    28    <grid_definition />     
    29    
    3028</context> 
  • XIOS/branchs/xios-1.0/inputs/COMPLETE/context_surface.xml

    r513 r529  
    2424      <field field_ref="field_A_srf" name="field_A_srf_prec4" prec="8"/> 
    2525      <field field_ref="field_A_srf_max" name="field_A_srf_mean_max" long_name="Average of hourly maximum over 6h" operation="average" freq_op="1h" > @field_A_srf_max </field> 
    26       <variable id="my_global_attribute" type="string" >file_6h</variable> 
     26      <variable id="my_global_attribute_xml" type="string" >file_6h</variable> 
    2727    </file> 
    2828 
     
    3939      <field field_ref="field_A_srf" name="field_A_srf_prec4" prec="8"/> 
    4040      <field field_ref="field_A_srf_max" name="field_A_srf_mean_max" long_name="Average of hourly maximum over 1d" operation="average" freq_op="1h" > @field_A_srf_max </field> 
    41       <variable id="my_global_attribute" type="string" >file_1d</variable> 
    4241    </file> 
    4342  </file_definition> 
     
    5150   </domain_definition>     
    5251   
    53    <grid_definition />     
    54    
    5552</context> 
  • XIOS/branchs/xios-1.0/src/interface/fortran/ixios.F90

    r519 r529  
    157157 
    158158 PUBLIC :: txios(domain), txios(domaingroup),txios(field), txios(fieldgroup),txios(file), txios(filegroup), & 
    159           txios(grid), txios(gridgroup), txios(axis), txios(axisgroup),txios(context), txios(date),txios(time) 
     159          txios(grid), txios(gridgroup), txios(axis), txios(axisgroup),txios(context), txios(date),         & 
     160          txios(time), txios(variable) 
    160161 
    161162 PUBLIC :: xios(set_attr), xios(set_domain_attr), xios(set_domaingroup_attr), xios(set_fieldgroup_attr), & 
  • XIOS/branchs/xios-1.0/src/test/test_complete.f90

    r501 r529  
    2020  TYPE(xios_fieldgroup) :: fieldgroup_hdl 
    2121  TYPE(xios_file) :: file_hdl 
     22  TYPE(xios_variable) :: var_hdl 
    2223  LOGICAL :: ok 
    23   CHARACTER(len=256) :: crname 
    24  
     24  CHARACTER(len=256) :: crname, str_temp 
    2525  DOUBLE PRECISION,DIMENSION(ni_glo,nj_glo) :: lon_glo,lat_glo 
    2626  DOUBLE PRECISION :: field_A_glo(ni_glo,nj_glo,llm) 
     
    2929  INTEGER :: ni,ibegin,iend,nj,jbegin,jend 
    3030  INTEGER :: i,j,l,ts,n, nb_pt 
     31  INTEGER :: iret 
    3132 
    3233!!! MPI Initialization 
     
    4546 
    4647!########################################################################### 
    47 ! Contexte ATM 
    48 !########################################################################### 
    49  
    50 !!! Initialisation des coordonnées globales et locales pour la grille réguliÚre 
     48! ATM Context 
     49!########################################################################### 
     50 
     51!!! Initialization of global and local coordinates for regular grid 
    5152 
    5253  DO j=1,nj_glo 
     
    7778  
    7879 
    79 !!! Context ATMOSPHERE 
     80!!! ATMOSPHERE context 
    8081 
    8182  CALL xios_context_initialize("atmosphere",comm) 
     
    9798  CALL xios_set_domain_attr("domain_atm_zoom",lonvalue=RESHAPE(lon,(/ni*nj/)),latvalue=RESHAPE(lat,(/ni*nj/))) 
    9899 
    99 !!! Activation du groupe field_definition 
     100!!! field_definition group activation 
    100101 
    101102  CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.) 
    102103 
    103 !!! Création d un nouveau champ  
     104!!! Creation of new field 
    104105 
    105106  CALL xios_get_handle("field_definition",fieldgroup_hdl) 
    106107  CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B_atm") 
    107108 
    108 !!! Heritage des attributs d un autre champ 
     109!!! Attribute inheritance from another field  
    109110 
    110111  CALL xios_set_attr(field_hdl,field_ref="field_A_atm",name="field_B_atm") 
    111112   
    112 !!! Affectation de ce nouveau champ au fichier avec un nouveau nom 
     113!!! Assign new field into a file (with a new name) 
    113114 
    114115  CALL xios_get_handle("output_atmosphere",file_hdl) 
     
    116117  CALL xios_set_attr(field_hdl,field_ref="field_B_atm",name="field_C_atm") 
    117118     
    118 !!! Definition du timestep 
     119!!! Timestep definition  
    119120 
    120121  dtime%second=3600 
    121122  CALL xios_set_timestep(dtime)  
    122123     
    123 !!! Recupration des valeurs des longitudes et de taille des domaines locaux (pour test de fonctionnalité) 
     124!!! Get longitude values and local domain sizes (to check functionality) 
    124125 
    125126  ni=0 ; lonvalue(:)=0 
     
    129130  PRINT *,"lonvalue",lonvalue ; 
    130131 
    131 !!! Fin de la definition du contexte 
     132!!! End of context definition 
    132133 
    133134  CALL xios_close_context_definition() 
    134135 
    135 !!! Test des valeurs des champs/fichiers 
    136    
    137   !!! Attribut defini ?  
     136!!! Test on fields/files values 
     137   
     138  !!! Is an attribute defined ? 
    138139 
    139140  CALL xios_is_defined_field_attr("field_A_atm",enabled=ok) 
    140141  PRINT *,"field_A_atm : attribute enabled is defined ? ",ok 
    141142 
    142   !!! Recuperer la valeur d un attribut 
     143  !!! Get an attibute value 
    143144   
    144145  CALL xios_get_field_attr("field_A_atm",name=crname) 
    145146  PRINT *,"field_A_atm : attribute name is : ",TRIM(crname) 
    146147 
    147   !!! Champ actif (besoin de fournir la valeur) ?  
     148  !!! Is a field active (i.e need to give the value ) ? 
    148149 
    149150    PRINT*,"field field_A_atm is active ? ",xios_field_is_active("field_A_atm") 
    150151 
    151   !!! Champ defini ? 
     152  !!! Is a field defined ? 
    152153 
    153154    PRINT*,"field field_A_atm is valid ?",xios_is_valid_field("field_A_atm") 
     
    155156 
    156157!########################################################################### 
    157 ! Contexte SRF 
    158 !########################################################################### 
    159  
    160 !!! Initialisation des coordonnées globales et locales pour la grille indexee (1 point sur 2) 
     158! SRF Context 
     159!########################################################################### 
     160 
     161!!! Initialization of global and local coordinates for indexed grid (1 point every 2 points) 
    161162 
    162163    nb_pt=ni*nj/2 
     
    181182  CALL xios_set_domain_attr("domain_srf",lonvalue=RESHAPE(lon,(/ni*nj/)),latvalue=RESHAPE(lat,(/ni*nj/))) 
    182183 
    183 !!! Création d un nouveau champ  
     184!!! Creation of new field  
    184185 
    185186  CALL xios_get_handle("field_definition",fieldgroup_hdl) 
    186187  CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B_srf") 
    187188 
    188 !!! Heritage des attributs d un autre champ 
     189!!! Attribute inheritance from another field  
    189190 
    190191  CALL xios_set_attr(field_hdl,field_ref="field_A_srf",name="field_B_srf") 
    191    
    192 !!! Affectation de ce nouveau champ au fichier avec un nouveau nom 
     192 
     193!!! Assign new field into a file (with a new name) 
    193194 
    194195  CALL xios_get_handle("output_surface",file_hdl) 
    195196  CALL xios_add_child(file_hdl,field_hdl) 
    196197  CALL xios_set_attr(field_hdl,field_ref="field_B_srf",name="field_C_srf") 
    197      
    198 !!! Definition du timestep 
     198 
     199!!! Add a variable as field local attribute 
     200 
     201  CALL xios_add_child(field_hdl,var_hdl,"my_local_attribute") 
     202  CALL xios_set_attr(var_hdl,type="string") 
     203  iret=xios_setVar("my_local_attribute","attribute_local") 
     204 
     205!!! Add a variable as file global attribute 
     206 
     207  CALL xios_add_child(file_hdl,var_hdl,"my_global_attribute") 
     208  CALL xios_set_attr(var_hdl,type="string") 
     209  iret=xios_setVar("my_global_attribute","attribute_global") 
     210 
     211!!! Modify a variable used as attribute (defined in xml file) 
     212 
     213  iret=xios_setVar("my_global_attribute_xml","6h_file") 
     214 
     215!!! Get the value of a variable (defined in xml file) 
     216   
     217  iret=xios_getVar("my_attribute1",str_temp) 
     218  PRINT *, "my_attribute1 is :",TRIM(str_temp) 
     219       
     220!!! Timestep definition 
    199221 
    200222  dtime%second=1800 
    201223  CALL xios_set_timestep(dtime)  
    202224     
    203 !!! Recupration des valeurs des longitudes et de taille des domaines locaux (pour test de fonctionnalité) 
     225!!! Get longitude values and local domain sizes (to check functionality) 
    204226 
    205227  ni=0 ; lonvalue(:)=0 
     
    209231  PRINT *,"lonvalue",lonvalue ; 
    210232 
    211 !!! Fin de la definition du contexte SRF 
     233!!! End of SRF context definition 
    212234 
    213235  CALL xios_close_context_definition() 
    214236 
    215  
    216 !#################################################################################### 
    217 !!! Boucle temporelle 
     237!#################################################################################### 
     238!!! Loop on timesteps 
    218239!#################################################################################### 
    219240 
     
    223244      CALL xios_set_current_context(ctx_hdl)     
    224245 
    225 !!! Mise a jour du pas de temps 
     246!!! Update of calendar  
    226247 
    227248      CALL xios_update_calendar(ts) 
    228249 
    229 !!! On donne la valeur du champ atm 
     250!!! Put the value of atm field 
    230251 
    231252      CALL xios_send_field("field_A_atm",field_A_atm) 
    232253 
    233 !!! On change de contexte 
     254!!! Change of context  
    234255 
    235256      CALL xios_get_handle("surface",ctx_hdl) 
    236257      CALL xios_set_current_context(ctx_hdl)     
    237258 
    238 !!! Mise a jour du pas de temps 
     259!!! Update of calendar  
    239260 
    240261      CALL xios_update_calendar(ts) 
    241262 
    242 !!! On donne la valeur du champ srf 
     263!!! Put the value of srf field 
    243264 
    244265      CALL xios_send_field("field_A_srf",field_A_srf) 
     
    248269 
    249270!#################################################################################### 
    250 !!! Finalisation 
    251 !#################################################################################### 
    252  
    253 !!! Fin des contextes 
    254      
     271!!! Finalization 
     272!#################################################################################### 
     273 
     274!!! End of contextes 
     275 
    255276    CALL xios_context_finalize() 
    256277    CALL xios_get_handle("atmosphere",ctx_hdl) 
     
    258279    CALL xios_context_finalize() 
    259280     
    260 !!! Fin de XIOS 
     281!!! End of XIOS 
    261282 
    262283    CALL xios_finalize() 
Note: See TracChangeset for help on using the changeset viewer.