Changeset 8579 for branches/ORCHIDEE_2_2


Ignore:
Timestamp:
2024-06-13T16:33:33+02:00 (5 months ago)
Author:
antoine.bierjon
Message:

Adapted read and interpolation of irrigation input files with XIOS_interpolation.
Added a default value for AEI_SW interpolation (in case of missing value, with and without XIOS), which is chosen to be the average of the GMIA5 dataset from FAO.
Related to ticket #857

Location:
branches/ORCHIDEE_2_2/ORCHIDEE
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/ORCHIDEE_2_2/ORCHIDEE/src_sechiba/slowproc.f90

    r8462 r8579  
    6464  REAL(r_std), SAVE                                  :: slope_default = 0.1 
    6565!$OMP THREADPRIVATE(slope_default) 
     66  REAL(r_std), PARAMETER                             :: aei_sw_default = 62.2 !! Default percentage for Area Equipped for Irrigation with Surface Water (unitless). Value of 62.2% is the mean of the GMIA v5 dataset of the FAO AQUASTAT (Siebert et al., 2010) used for the construction of the AEI_SW_pct.nc 
    6667  INTEGER, SAVE                                      :: printlev_loc        !! Local printlev in slowproc module 
    6768!$OMP THREADPRIVATE(printlev_loc) 
     
    271272       CALL xios_orchidee_set_field_attr("woodharvest_interp",enabled=.FALSE.) 
    272273    ENDIF 
     274     
     275    !! 6. Prepare for reading of irrigmap file 
     276    filename = 'IRRIGmap.nc' 
     277    CALL getin_p('IRRIGmap_FILE',filename) 
     278    name = filename(1:LEN_TRIM(FILENAME)-3) 
     279    CALL xios_orchidee_set_file_attr("irrigmap_file",name=name) 
     280     
     281    IF (xios_interpolation .AND. do_irrigation .AND. & 
     282        irrig_map_dynamic_flag) THEN 
     283       ! IRRIGmap file will be read each year 
     284 
     285       ! Reading will be done 
     286       IF (printlev>=2) WRITE(numout,*) 'Reading of irrigmap file will be done later using XIOS. The filename is ', filename 
     287    ELSEIF (xios_interpolation .AND. do_irrigation .AND. & 
     288            restname_in=='NONE') THEN 
     289       ! IRRIGmap file will be read only once if no restart file exists 
     290 
     291       ! Reading will be done 
     292       IF (printlev>=2) WRITE(numout,*) 'Reading of irrigmap file will be done later using XIOS. The filename is ', filename 
     293    ELSE 
     294       ! No reading, deactivate irrigmap file 
     295       IF (printlev>=2) WRITE(numout,*) 'Reading of irrigmap file will not be done with XIOS.' 
     296       CALL xios_orchidee_set_file_attr("irrigmap_file",enabled=.FALSE.) 
     297       CALL xios_orchidee_set_field_attr("irrigmap_interp",enabled=.FALSE.) 
     298    ENDIF 
     299     
     300    !! 7. Prepare for reading of aei_sw file 
     301    filename = 'AEI_SW_pct.nc' 
     302    CALL getin_p('AEI_SW_FILE',filename) 
     303    name = filename(1:LEN_TRIM(FILENAME)-3) 
     304    CALL xios_orchidee_set_file_attr("aei_sw_file",name=name) 
     305     
     306    ! Set default values used by XIOS for the interpolation 
     307    lerr=xios_orchidee_setvar('aei_sw_default',aei_sw_default) 
     308     
     309    IF (xios_interpolation .AND. do_irrigation .AND. & 
     310        select_source_irrig .AND. restname_in=='NONE') THEN 
     311       ! AEI_SW file will be read if no restart file exists 
     312 
     313       ! Reading will be done 
     314       IF (printlev>=2) WRITE(numout,*) 'Reading of aei_sw file will be done later using XIOS. The filename is ', filename 
     315    ELSE 
     316       ! No reading, deactivate aei_sw file 
     317       IF (printlev>=2) WRITE(numout,*) 'Reading of aei_sw file will not be done with XIOS.' 
     318       CALL xios_orchidee_set_file_attr("aei_sw_file",enabled=.FALSE.) 
     319       CALL xios_orchidee_set_field_attr("aei_sw_interp",enabled=.FALSE.) 
     320    ENDIF 
    273321 
    274322    !! This part was introduced to prepare the reading of params_sp_mip.nc if spmipexp='maps' 
     
    278326    !! The corresponding part in context_input_orchidee.xml is also commented 
    279327     
    280 !!$    !! 6. Prepare for reading of soil parameter files 
     328!!$    !! 8. Prepare for reading of soil parameter files 
    281329!!$ 
    282330!!$    ! Get the file name from run.def file and set file attributes accordingly 
     
    47274775    ! for irrigated_new case : 
    47284776 
    4729     REAL(r_std), DIMENSION(nbpt)                     :: irrigref_frac    !! irrigation fractions re-dimensioned 
     4777    REAL(r_std), DIMENSION(nbpt)                         :: irrigref_frac    !! irrigation fractions re-dimensioned 
    47304778    REAL(r_std), DIMENSION(nbpt)                         :: airrig           !! Availability of the soilcol interpolation 
    47314779    REAL(r_std)                          :: vmin, vmax       !! min/max values to use for the renormalization 
     
    47564804  !_ ================================================================================================================================ 
    47574805 
    4758     IF (printlev_loc >= 5) PRINT *,'  In slowproc_read irrigmap_new' 
     4806    IF (printlev_loc >= 5) PRINT *,'  In slowproc_readirrigmap_dyn' 
    47594807 
    47604808    ! 
     
    47714819    variablename = 'irrig' 
    47724820 
    4773     IF (printlev_loc >= 1) WRITE(numout,*) "slowproc_read irrigmap_new: Read and interpolate " & 
    4774          // TRIM(filename) // " for variable " // TRIM(variablename) 
    4775  
    4776     ! Assigning values to vmin, vmax 
    4777     vmin = 1. 
    4778     vmax = 1. 
    4779  
    4780     variabletypevals = -un 
    4781  
    4782     !! Variables for interpweight 
    4783     ! Type of calculation of cell fractions 
    4784     fractype = 'default' 
    4785     ! Name of the longitude and latitude in the input file 
    4786     lonname = 'lon' 
    4787     latname = 'lat' 
    4788     ! Should negative values be set to zero from input file? 
    4789     nonegative = .TRUE. 
    4790     ! Type of mask to apply to the input data (see header for more details) 
    4791     maskingtype = 'nomask' 
    4792     ! Values to use for the masking 
    4793     maskvals = (/ 0.05, 0.05 , un /) 
    4794     ! Name of the variable with the values for the mask in the input file (only if maskkingtype='var') (here not used) 
    4795     namemaskvar = '' 
    4796  
    4797     CALL interpweight_2Dcont(nbpt, 0, 0, lalo, resolution, neighbours,        & 
    4798       contfrac, filename, variablename, lonname, latname, vmin, vmax, nonegative, maskingtype,        & 
    4799       maskvals, namemaskvar, -1, fractype, 0., 0.,                                 & 
    4800       irrigref_frac, airrig) 
    4801  
    4802     IF (printlev_loc >= 5) WRITE(numout,*)'  slowproc_read after interpweight_2Dcont' 
     4821    IF (xios_interpolation) THEN 
     4822       IF (printlev_loc >= 1) WRITE(numout,*) "slowproc_readirrigmap_dyn: Use XIOS to read and interpolate " & 
     4823            // TRIM(filename) // " for variable " // TRIM(variablename) 
     4824 
     4825       CALL xios_orchidee_recv_field('irrigmap_interp',irrigref_frac) 
     4826 
     4827       airrig = 1.0 
     4828    ELSE 
     4829 
     4830       IF (printlev_loc >= 1) WRITE(numout,*) "slowproc_readirrigmap_dyn: Read and interpolate " & 
     4831            // TRIM(filename) // " for variable " // TRIM(variablename) 
     4832 
     4833       ! Assigning values to vmin, vmax 
     4834       vmin = 1. 
     4835       vmax = 1. 
     4836 
     4837       variabletypevals = -un 
     4838 
     4839       !! Variables for interpweight 
     4840       ! Type of calculation of cell fractions 
     4841       fractype = 'default' 
     4842       ! Name of the longitude and latitude in the input file 
     4843       lonname = 'lon' 
     4844       latname = 'lat' 
     4845       ! Should negative values be set to zero from input file? 
     4846       nonegative = .TRUE. 
     4847       ! Type of mask to apply to the input data (see header for more details) 
     4848       maskingtype = 'nomask' 
     4849       ! Values to use for the masking 
     4850       maskvals = (/ 0.05, 0.05 , un /) 
     4851       ! Name of the variable with the values for the mask in the input file (only if maskkingtype='var') (here not used) 
     4852       namemaskvar = '' 
     4853 
     4854       CALL interpweight_2Dcont(nbpt, 0, 0, lalo, resolution, neighbours,        & 
     4855         contfrac, filename, variablename, lonname, latname, vmin, vmax, nonegative, maskingtype,        & 
     4856         maskvals, namemaskvar, -1, fractype, 0., 0.,                                 & 
     4857         irrigref_frac, airrig) 
     4858 
     4859       IF (printlev_loc >= 5) WRITE(numout,*)'  slowproc_readirrigmap_dyn after interpweight_2Dcont' 
     4860 
     4861    ENDIF 
     4862     
     4863    ! Write diagnostics 
     4864    CALL xios_orchidee_send_field("interp_diag_irrigmap_frac",irrigref_frac) 
    48034865 
    48044866    IF (printlev_loc >= 5) THEN 
    4805       WRITE(numout,*)'  slowproc_read irrigmap_new before updating loop nbpt:', nbpt 
     4867      WRITE(numout,*)'  slowproc_readirrigmap_dyn before updating loop nbpt:', nbpt 
    48064868    END IF 
     4869     
     4870    ! Transform form percentage (irrigref_frac) to area (irrigmap_new) 
    48074871    irrigmap_new(:) = zero 
    48084872    irrigref_frac(:) = irrigref_frac(:)/100. 
     
    48104874    DO ib=1,nbpt 
    48114875      IF (irrigref_frac(ib) < 1. .AND. irrigref_frac(ib) > 0.005 ) THEN 
    4812         irrigmap_new(ib) = irrigref_frac(ib) * resolution(ib,1)*resolution(ib,2)*contfrac(ib) 
     4876        irrigmap_new(ib) = irrigref_frac(ib) * area(ib) * contfrac(ib) 
    48134877      ELSEIF (irrigref_frac(ib) > 1.) THEN 
    4814         irrigmap_new(ib) = resolution(ib,1)*resolution(ib,2)*contfrac(ib) 
    4815       !ELSE  THEN irrigated_new= zero. ALready set, put to lisibility 
     4878        irrigmap_new(ib) = area(ib)*contfrac(ib) 
     4879      !ELSE  THEN irrigated_new= zero. Already set, put to lisibility 
    48164880      ENDIF 
    48174881    ENDDO 
     
    48204884    !CALL xios_orchidee_send_field("airrig",airrig) 
    48214885 
    4822     IF (printlev_loc >= 3) WRITE(numout,*) '  slowproc_read irrigmap_new ended' 
     4886    IF (printlev_loc >= 3) WRITE(numout,*) '  slowproc_readirrigmap_dyn ended' 
    48234887 
    48244888  END SUBROUTINE slowproc_readirrigmap_dyn 
     
    48724936    ! for irrigated_new case : 
    48734937 
    4874     REAL(r_std), DIMENSION(nbpt)                     :: irrigref_frac    !! irrigation fractions re-dimensioned 
     4938    REAL(r_std), DIMENSION(nbpt)                         :: irrigref_frac    !! irrigation fractions re-dimensioned (0-100, percentage) 
    48754939    REAL(r_std), DIMENSION(nbpt)                         :: airrig           !! Availability of the soilcol interpolation 
    48764940    REAL(r_std)                          :: vmin, vmax       !! min/max values to use for the renormalization 
     
    49014965  !_ ================================================================================================================================ 
    49024966 
    4903     IF (printlev_loc >= 5) PRINT *,'  In slowproc_read irrigmap_new' 
     4967    IF (printlev_loc >= 5) PRINT *,'  In slowproc_read_aeisw_map' 
    49044968 
    49054969    ! 
     
    49164980    variablename = 'aeisw_pct' 
    49174981 
    4918     IF (printlev_loc >= 1) WRITE(numout,*) "slowproc_read_aeisw_map: Read and interpolate " & 
    4919          // TRIM(filename) // " for variable " // TRIM(variablename) 
    4920  
    4921     ! Assigning values to vmin, vmax 
    4922     vmin = 1. 
    4923     vmax = 1. 
    4924  
    4925     variabletypevals = -un 
    4926  
    4927     !! Variables for interpweight 
    4928     ! Type of calculation of cell fractions 
    4929     fractype = 'default' 
    4930     ! Name of the longitude and latitude in the input file 
    4931     lonname = 'lon' 
    4932     latname = 'lat' 
    4933     ! Should negative values be set to zero from input file? 
    4934     nonegative = .TRUE. 
    4935     ! Type of mask to apply to the input data (see header for more details) 
    4936     maskingtype = 'mabove' 
    4937     ! Values to use for the masking 
    4938     maskvals = (/ 0.05, 0.05 , un /) 
    4939     ! Name of the variable with the values for the mask in the input file (only if maskkingtype='var') (here not used) 
    4940     namemaskvar = '' 
    4941  
    4942     CALL interpweight_2Dcont(nbpt, 0, 0, lalo, resolution, neighbours,        & 
    4943       contfrac, filename, variablename, lonname, latname, vmin, vmax, nonegative, maskingtype,        & 
    4944       maskvals, namemaskvar, -1, fractype, 0., 0.,                                 & 
    4945       irrigref_frac, airrig) 
    4946  
    4947     IF (printlev_loc >= 5) WRITE(numout,*)'  slowproc_read after interpweight_2Dcont' 
     4982    IF (xios_interpolation) THEN 
     4983       IF (printlev_loc >= 1) WRITE(numout,*) "slowproc_read_aeisw_map: Use XIOS to read and interpolate " & 
     4984            // TRIM(filename) // " for variable " // TRIM(variablename) 
     4985 
     4986       CALL xios_orchidee_recv_field('aei_sw_interp',irrigref_frac) 
     4987 
     4988       airrig = 1.0 
     4989    ELSE 
     4990 
     4991       IF (printlev_loc >= 1) WRITE(numout,*) "slowproc_read_aeisw_map: Read and interpolate " & 
     4992            // TRIM(filename) // " for variable " // TRIM(variablename) 
     4993 
     4994       ! Assigning values to vmin, vmax 
     4995       vmin = 1. 
     4996       vmax = 1. 
     4997 
     4998       variabletypevals = -un 
     4999 
     5000       !! Variables for interpweight 
     5001       ! Type of calculation of cell fractions 
     5002       fractype = 'default' 
     5003       ! Name of the longitude and latitude in the input file 
     5004       lonname = 'lon' 
     5005       latname = 'lat' 
     5006       ! Should negative values be set to zero from input file? 
     5007       nonegative = .TRUE. 
     5008       ! Type of mask to apply to the input data (see header for more details) 
     5009       maskingtype = 'mabove' 
     5010       ! Values to use for the masking 
     5011       maskvals = (/ 0.05, 0.05 , un /) 
     5012       ! Name of the variable with the values for the mask in the input file (only if maskkingtype='var') (here not used) 
     5013       namemaskvar = '' 
     5014 
     5015       CALL interpweight_2Dcont(nbpt, 0, 0, lalo, resolution, neighbours,        & 
     5016         contfrac, filename, variablename, lonname, latname, vmin, vmax, nonegative, maskingtype,        & 
     5017         maskvals, namemaskvar, -1, fractype, aei_sw_default, aei_sw_default,                                 & 
     5018         irrigref_frac, airrig) 
     5019 
     5020       IF (printlev_loc >= 5) WRITE(numout,*)'  slowproc_read_aeisw_map after interpweight_2Dcont' 
     5021        
     5022    END IF 
     5023     
     5024    ! Write diagnostics 
     5025    CALL xios_orchidee_send_field("interp_diag_aeiswmap_frac",irrigref_frac) ! irrigref_frac here has a different meaning than in subroutine slowproc_readirrigmap_dyn 
    49485026 
    49495027    IF (printlev_loc >= 5) THEN 
  • branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/context_input_orchidee.xml

    r8468 r8579  
    8989    <file id="woodharvest_file" mode="read" output_freq="1y" cyclic="true"> 
    9090      <field id="woodharvest_read"  name="woodharvest" domain_ref="dom_file_woodharvest" operation="instant"  freq_offset="1ts"/> 
     91    </file> 
     92     
     93    <file id="irrigmap_file" mode="read" output_freq="1y" cyclic="true"> 
     94      <field id="irrigmap_read"  name="irrig" domain_ref="dom_file_irrigmap" operation="instant"  freq_offset="1ts" > (this &gt; 101) ? $missing_value : this </field> 
     95    </file> 
     96     
     97    <file id="aei_sw_file" mode="read" output_freq="1y" cyclic="true"> 
     98      <field id="aei_sw_read"  name="aeisw_pct" domain_ref="dom_file_aei_sw" operation="instant"  freq_offset="1ts" > (this &gt; 101) ? $missing_value : this </field> 
    9199    </file> 
    92100     
     
    176184 
    177185      <field id="woodharvest_interp"  field_ref="woodharvest_read"  domain_ref="dom_from_woodharvest" read_access="true" enabled="true" /> 
     186 
     187      <field id="irrigmap_tmp"   field_ref="irrigmap_read"  domain_ref="dom_from_irrigmap"  /> 
     188      <field id="irrigmap_interp"  field_ref="irrigmap_tmp" read_access="true" enabled="true" > this == $missing_value ? 0 : this </field> 
     189 
     190      <field id="aei_sw_tmp"   field_ref="aei_sw_read"  domain_ref="dom_from_aei_sw"  /> 
     191      <field id="aei_sw_interp"  field_ref="aei_sw_tmp" read_access="true" enabled="true" > this == $missing_value ? $aei_sw_default : this </field> 
    178192       
    179193    </field_group> 
     
    275289    </domain> 
    276290     
     291    <domain id="dom_from_irrigmap" domain_ref="domain_landpoints"> 
     292      <interpolate_domain order="1" renormalize="true" detect_missing_value="true" /> 
     293    </domain> 
     294     
     295    <domain id="dom_from_aei_sw" domain_ref="domain_landpoints"> 
     296      <interpolate_domain order="1" renormalize="true" detect_missing_value="true" /> 
     297    </domain> 
     298     
    277299    <domain id="dom_file_soil" type="rectilinear"> 
    278300      <!-- generate_rectilinear_domain bounds_lon_start="-180" bounds_lon_end="180" bounds_lat_start="-90" bounds_lat_end="90"/--> 
     
    313335 
    314336    <domain id="dom_file_woodharvest" type="rectilinear"> 
     337      <generate_rectilinear_domain/> 
     338    </domain> 
     339 
     340    <domain id="dom_file_irrigmap" type="rectilinear"> 
     341      <generate_rectilinear_domain/> 
     342    </domain> 
     343 
     344    <domain id="dom_file_aei_sw" type="rectilinear"> 
    315345      <generate_rectilinear_domain/> 
    316346    </domain> 
     
    371401    <variable id="albbg_nir_default" type="double">xxx</variable> 
    372402    <variable id="bulk_default" type="double">xxx</variable> 
     403    <variable id="aei_sw_default" type="double">xxx</variable> 
    373404     
    374405  </variable_definition> 
  • branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/field_def_orchidee.xml

    r8566 r8579  
    391391    <field id="interp_avail_areftemp" name="interp_avail_areftemp" long_name="Availability of data for the reftemp interpolation (negative values if no data found)" unit="1" operation="once" freq_offset="0ts"/> 
    392392    <field id="interp_diag_woodharvest" name="interp_diag_woodharvest" long_name="woodharvest read from file" operation="once" freq_offset="0ts"/> 
     393    <field id="interp_diag_irrigmap_frac" name="interp_diag_irrigmap_frac" long_name="irrigmap_frac read from file" unit="%" operation="once" freq_offset="0ts"/> 
     394    <field id="interp_diag_aeiswmap_frac" name="interp_diag_aeiswmap_frac" long_name="aeiswmap_frac read from file" unit="%" operation="once" freq_offset="0ts"/> 
    393395 
    394396 
  • branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/file_def_orchidee.xml

    r8572 r8579  
    755755      <field field_ref="interp_diag_reftemp" level="1"/> 
    756756      <field field_ref="interp_diag_woodharvest" level="1"/> 
     757      <field field_ref="interp_diag_irrigmap_frac" level="1"/> 
     758      <field field_ref="interp_diag_aeiswmap_frac" level="1"/> 
    757759      <!--      <field field_ref="interp_diag_lai" grid_ref="grid_from_lai" level="1"/> --> 
    758760       
Note: See TracChangeset for help on using the changeset viewer.