- Timestamp:
- 2018-10-29T15:20:26+01:00 (6 years ago)
- Location:
- branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN
- Files:
-
- 2 deleted
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/cfg/variable.cfg
r10248 r10251 1 # name | units | axis | pt| interpolation | long name | standard name 2 X | 1 | X | | | | projection_x_coordinate 3 Y | 1 | Y | | | | projection_y_coordinate 4 Z | 1 | Z | | | | projection_z_coordinate 5 T | 1 | T | | | | projection_t_coordinate 6 nav_lon | degrees_east | XY | T | cubic | Longitude | longitude 7 nav_lat | degrees_north | XY | T | cubic | Latitude | latitude 8 nav_lev | model_levels | Z | T | cubic | Model levels | 9 deptht | m | Z | T | | Vertical T levels | depth 10 time_counter | | T | | | Time axis | time 11 Bathymetry | m | XY | T | cubic | Bathymetry | bathymetry 12 votemper | degree_Celsius | XYZT | T | cubic | Temperature | sea_water_potential_temperature 13 vozocrtx | m s-1 | XYZT | U | cubic | Zonal velocity | 14 vomecrty | m s-1 | XYZT | V | cubic | Meridional velocity | 15 vosaline | PSU | XYZT | T | cubic | Salinity | sea_water_salinity 16 sossheig | m | XYT | T | cubic | Sea Surface Height | sea_surface_height 17 sotemper | m | XYT | T | cubic | | 18 sossheig | m | XYT | T | cubic | | 19 glamt | degrees_east | XY | T | cubic | Longitude_T | 20 glamu | degrees_east | XY | U | cubic | Longitude_U | 21 glamv | degrees_east | XY | V | cubic | Longitude_V | 22 glamf | degrees_east | XY | F | cubic | Longitude_F | 23 gphit | degrees_north | XY | T | cubic | Latitude_T | 24 gphiu | degrees_north | XY | U | cubic | Latitude_U | 25 gphiv | degrees_north | XY | V | cubic | Latitude_V | 26 gphif | degrees_north | XY | F | cubic | Latitude_F | 27 e1t | m | XY | T | cubic/rhoi | | 28 e1u | m | XY | U | cubic/rhoi | | 29 e1v | m | XY | V | cubic/rhoi | | 30 e1f | m | XY | F | cubic/rhoi | | 31 e2t | m | XY | T | cubic/rhoj | | 32 e2u | m | XY | U | cubic/rhoj | | 33 e2v | m | XY | V | cubic/rhoj | | 34 e2f | m | XY | F | cubic/rhoj | | 35 tmask | | XYZ | T | nearest | | 36 umask | | XYZ | U | nearest | | 37 vmask | | XYZ | V | nearest | | 38 fmask | | XYZ | F | nearest | | 39 weight | | XY | T | | | 40 kt | | | | | | 41 ndastp | | | | | | 42 adatrj | | | | | | 43 kt | | | | | | 44 rdt | | | | | | 45 rdttra1 | | | | | | 46 utau_b | | XY | U | | |surface_downward_eastward_stress 47 vtau_b | | XY | V | | |surface_downward_northward_stress 48 qns_b | | XY | T | | | 49 emp_b | | XY | T | | | 50 sfx_b | | XY | T | | | 51 en | | XYZ | T | | | 52 avt | | XYZ | T | | vertical eddy diffusivity | 53 avm | | XYZ | T | | vertical eddy viscosity | 54 avmu | | XYZ | T | | | 55 avmv | | XYZ | T | | | 56 dissl | | XYZ | T | | | 57 sbc_hc_b | | XY | T | | | 58 sbc_sc_b | | XY | T | | | 59 gcx | | XY | T | | | 60 gcxb | | XY | T | | | 61 ub | | XYZ | U | | | 62 vb | | XYZ | V | | | 63 tb | | XYZ | T | | | 64 sb | | XYZ | T | | | 65 rotb | | XYZ | T | | | 66 hdivb | | XYZ | T | | | 67 sshb | | XY | T | | | 68 un | | XYZ | U | | | 69 vn | | XYZ | V | | | 70 tn | | XYZ | T | | | 71 sn | | XYZ | T | | | 72 rotn | | XYZ | T | | | 73 hdivn | | XYZ | T | | | 74 sshn | | XYT | T | | | 75 rhop | | XYZ | T | | | 76 dic | | XYZT | T | | Dissolved Inorganic Carbon | mole_concentration_of_dissolved_inorganic_caron_in_sea_water 77 alkalini | | XYZT | T | | Total Alkalinity | sea_water_alkalinity_expressed_as_mole_equivalent 78 o2 | | XYZT | T | | Dissolved Oxygen | mole_concentration_of_dissolved_molecular_oxygen_in_sea_water 79 caco3 | | XYZT | T | | Calcite | 80 po4 | | XYZT | T | | Phosphate | mole_concentration_of_phosphate_in_sea_water 81 poc | | XYZT | T | | Small Particulate Organic Carbon | 82 si | | XYZT | T | | Dissolved Silicate | mole_concentration_of_silicate_in_sea_water 83 phy | | XYZT | T | | Nanophytoplankton | 84 zoo | | XYZT | T | | Microzooplankton | mole_concentration_of_microzooplankton_expressed_as_carbon_in_sea_water 85 doc | | XYZT | T | | Dissolved Organic Carbon | 86 phy2 | | XYZT | T | | Diatoms | 87 zoo2 | | XYZT | T | | Mesozooplankton | mole_concentration_of_mesozooplankton_expressed_as_carbon_in_sea_water 88 gsi | | XYZT | T | | Sinking biogenic Silica | 89 fer | | XYZT | T | | Dissolved Iron | mole_concentration_of_dissolved_iron_in_sea_water 90 bfe | | XYZT | T | | Iron in the big particles | 91 goc | | XYZT | T | | Big Particulate Organic Carbon | 92 sfe | | XYZT | T | | Iron in the small particles | 93 dfe | | XYZT | T | | Iron content of the Diatoms | 94 dsi | | XYZT | T | | Silicon content of the Diatoms | 95 nfe | | XYZT | T | | Iron content of the Nanophytoplankton | 96 nchl | | XYZT | T | | Chlorophyll of the Nanophytoplankton | 97 dchl | | XYZT | T | | Chlorophyll of the Diatoms | 98 no3 | | XYZT | T | | Nitrate | mole_concentration_of_nitrate_in_sea_water 99 nh4 | | XYZT | T | | Ammonium | mole_concentration_of_ammonium_in_sea_water 100 ppd | | XYZT | T | | | 101 ppn | | XYZT | T | | | 102 ph | | XYZT | T | | | 103 cflx | | XYZT | T | | | 104 oflx | | XYZT | T | | | 105 kg | | XYZT | T | | | 106 dpco2 | | XYZT | T | | | 107 heup | | XYZT | T | | | 108 kz | | XYZT | T | | | 109 irondep | | XYZT | T | | | 110 kt_ice | | | | | | 111 hicif | | | | | | 112 hsnif | | | | | | 113 frld | | | | | | 114 sist | | | | | | 115 tbif1 | | | | | | 116 tbif2 | | | | | | 117 tbif3 | | | | | | 118 ui_ice | | | | | | 119 vi_ice | | | | | | 120 qstoif | | | | | | 121 fsbbq | | | | | | 122 stress1_i | | | | | | 123 stress2_i | | | | | | 124 stress12_i | | | | | | 125 sxice | | | | | | 126 syice | | | | | | 127 sxxice | | | | | | 128 syyice | | | | | | 129 sxyice | | | | | | 130 sxsn | | | | | | 131 sysn | | | | | | 132 sxxsn | | | | | | 133 syysn | | | | | | 134 sxysn | | | | | | 135 sxa | | | | | | 136 sya | | | | | | 137 sxxa | | | | | | 138 syya | | | | | | 139 sxya | | | | | | 140 sxc0 | | | | | | 141 syc0 | | | | | | 142 sxxc0 | | | | | | 143 syyc0 | | | | | | 144 sxyc0 | | | | | | 145 sxc1 | | | | | | 146 syc1 | | | | | | 147 sxxc1 | | | | | | 148 syyc1 | | | | | | 149 sxyc1 | | | | | | 150 sxc2 | | | | | | 151 syc2 | | | | | | 152 sxxc2 | | | | | | 153 syyc2 | | | | | | 154 sxyc2 | | | | | | 155 sxst | | | | | | 156 syst | | | | | | 157 sxxst | | | | | | 158 syyst | | | | | | 159 sxyst | | | | | | 1 # name | units | axis | point | standard name | long name | interpolation 2 X | 1 | X | | projection_x_coordinate | | 3 Y | 1 | Y | | projection_y_coordinate | | 4 Z | 1 | Z | | projection_z_coordinate | | 5 T | 1 | T | | projection_t_coordinate | | 6 nav_lon | degrees_east | XY | T | longitude | Longitude | cubic 7 nav_lat | degrees_north | XY | T | latitude | Latitude | cubic 8 nav_lev | model_levels | Z | T | | Model levels | cubic 9 deptht | m | Z | T | depth | Vertical T levels | 10 time_counter | | T | | time | Time axis | 11 Bathymetry | m | XY | T | bathymetry | Bathymetry | cubic 12 votemper | degree_Celsius | XYZT | T | sea_water_potential_temperature | Temperature | cubic 13 vozocrtx | m s-1 | XYZT | U | | Zonal velocity | cubic 14 vomecrty | m s-1 | XYZT | V | | Meridional velocity| cubic 15 vosaline | PSU | XYZT | T | sea_water_salinity | Salinity | cubic 16 sossheig | m | XYT | T | sea_surface_height | Sea Surface Height | cubic 17 glamt | degrees_east | XY | T | | Longitude_T | cubic 18 glamu | degrees_east | XY | U | | Longitude_U | cubic 19 glamv | degrees_east | XY | V | | Longitude_V | cubic 20 glamf | degrees_east | XY | F | | Longitude_F | cubic 21 gphit | degrees_north | XY | T | | Latitude_T | cubic 22 gphiu | degrees_north | XY | U | | Latitude_U | cubic 23 gphiv | degrees_north | XY | V | | Latitude_V | cubic 24 gphif | degrees_north | XY | F | | Latitude_F | cubic 25 e1t | m | XY | T | | | cubic/rhoi 26 e1u | m | XY | U | | | cubic/rhoi 27 e1v | m | XY | V | | | cubic/rhoi 28 e1f | m | XY | F | | | cubic/rhoi 29 e2t | m | XY | T | | | cubic/rhoj 30 e2u | m | XY | U | | | cubic/rhoj 31 e2v | m | XY | V | | | cubic/rhoj 32 e2f | m | XY | F | | | cubic/rhoj 33 tmask | | XYZ | T | | | nearest 34 umask | | XYZ | U | | | nearest 35 vmask | | XYZ | V | | | nearest 36 fmask | | XYZ | F | | | nearest 37 weight | | XY | T | | | 38 kt | | | | | | 39 ndastp | | | | | | 40 adatrj | | | | | | 41 kt | | | | | | 42 rdt | | | | | | 43 rdttra1 | | | | | | 44 utau_b | | XYT | U |surface_downward_eastward_stress | | 45 vtau_b | | XYT | V |surface_downward_northward_stress | | 46 qns_b | | XYT | T | | | 47 emp_b | | XYT | T | | | 48 sfx_b | | XYT | T | | | 49 en | | XYZT | T | | | 50 avt | | XYZT | T | | | 51 avm | | XYZT | T | | | 52 avmu | | XYZT | T | | | 53 avmv | | XYZT | T | | | 54 dissl | | XYZT | T | | | 55 sbc_hc_b | | XYT | T | | | 56 sbc_sc_b | | XYT | T | | | 57 gcx | | XYT | T | | | 58 gcxb | | XYT | T | | | 59 ub | | XYZT | U | | | 60 vb | | XYZT | V | | | 61 tb | | XYZT | T | | | 62 sb | | XYZT | T | | | 63 rotb | | XYZT | T | | | 64 hdivb | | XYZT | T | | | 65 sshb | | XYT | T | | | 66 un | | XYZT | U | | | 67 vn | | XYZT | V | | | 68 tn | | XYZT | T | | | 69 sn | | XYZT | T | | | 70 rotn | | XYZT | T | | | 71 hdivn | | XYZT | T | | | 72 sshn | | XYT | T | | | 73 rhop | | XYZT | T | | | -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/attribute.f90
r10248 r10251 81 81 ! REVISION HISTORY: 82 82 !> @date November, 2013 - Initial Version 83 !> @date November, 2014 84 !> - Fix memory leaks bug 83 !> @date November, 2014 - Fix memory leaks bug 85 84 ! 86 85 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 131 130 INTEGER(i4) :: i_type = 0 !< attribute type 132 131 INTEGER(i4) :: i_len = 0 !< number of value store in attribute 133 CHARACTER(LEN=lc) :: c_value = 'none'!< attribute value if type CHAR132 CHARACTER(LEN=lc) :: c_value = "none" !< attribute value if type CHAR 134 133 REAL(dp), DIMENSION(:), POINTER :: d_value => NULL() !< attribute value if type SHORT,INT,FLOAT or DOUBLE 135 134 END TYPE TATT 136 135 137 136 INTERFACE att_init 138 MODULE PROCEDURE att__init_c 137 MODULE PROCEDURE att__init_c 139 138 MODULE PROCEDURE att__init_dp 140 139 MODULE PROCEDURE att__init_dp_0d … … 182 181 !> @date November, 2013 - Initial Version 183 182 !> @date November, 2014 184 !> - use function instead of overload assignment operator183 !> - use function instead of overload assignment operator 185 184 !> (to avoid memory leak) 186 185 ! … … 235 234 236 235 ! local variable 237 REAL(dp) 236 REAL(dp), DIMENSION(:), ALLOCATABLE :: dl_value 238 237 !---------------------------------------------------------------- 239 238 … … 301 300 !> @author J.Paul 302 301 !> @date November, 2013 - Initial Version 303 !> @date September, 2014 304 !> - bug fix with use of id read from attribute structure 305 !> 302 !> @date September, 2014 - bug fix with use of id read from attribute structure 303 ! 306 304 !> @param[in] td_att array of attribute structure 307 305 !> @param[in] cd_name attribute name … … 357 355 358 356 att__init_c%c_name=TRIM(ADJUSTL(cd_name)) 357 359 358 att__init_c%i_type=NF90_CHAR 360 361 359 att__init_c%c_value=TRIM(ADJUSTL(cd_value)) 362 360 att__init_c%i_len=LEN( TRIM(ADJUSTL(cd_value)) ) … … 370 368 !> 371 369 !> @author J.Paul 372 !> @d ate November, 2013 - Initial Version370 !> @dtae November, 2013 - Initial Version 373 371 ! 374 372 !> @param[in] cd_name attribute name … … 1070 1068 !> @author J.Paul 1071 1069 !> @date November, 2013 - Initial Version 1072 !> @date September, 2014 1073 !> - take into account type of attribute. 1070 !> @date September, 2014 - take into account type of attribute. 1074 1071 ! 1075 1072 !> @param[in] td_att attribute structure … … 1117 1114 1118 1115 CASE(NF90_CHAR) 1119 1120 1116 cl_value=td_att%c_value 1121 1117 -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/boundary.f90
r10248 r10251 26 26 !> - ld_west is logical to force used of north boundary [optional] 27 27 !> - cd_north is string character description of north boundary [optional] 28 !> - cd_south is string character description of south boundary [optional]29 !> - cd_east is string character description of eastboundary [optional]30 !> - cd_west is string character description of westboundary [optional]28 !> - cd_south is string character description of north boundary [optional] 29 !> - cd_east is string character description of north boundary [optional] 30 !> - cd_west is string character description of north boundary [optional] 31 31 !> - ld_oneseg is logical to force to use only one segment for each boundary [optional] 32 32 !> … … 36 36 !> to know if boundary is use:<br/> 37 37 !> - tl_bdy\%l_use 38 !>39 !> to know if boundary come from namelist (cn_north,..):<br/>40 !> - tl_bdy\%l_nam41 38 !> 42 39 !> to get the number of segment in boundary:<br/> … … 108 105 ! REVISION HISTORY: 109 106 !> @date November, 2013 - Initial Version 110 !> @date September, 2014 111 !> - add boundary description 112 !> @date November, 2014 113 !> - Fix memory leaks bug 114 !> @date February, 2015 115 !> - Do not change indices read from namelist 116 !> - Change string character format of boundary read from namelist, 117 !> see boundary__get_info 107 !> @date September, 2014 - add boundary description 108 !> @date November, 2014 - Fix memory leaks bug 118 109 !> 119 110 !> @todo add schematic to boundary structure description … … 166 157 PRIVATE :: seg__init ! initialise segment structure 167 158 PRIVATE :: seg__clean ! clean segment structure 168 PRIVATE :: seg__clean_unit ! clean onesegment structure159 PRIVATE :: seg__clean_unit ! clean segment structure 169 160 PRIVATE :: seg__clean_arr ! clean array of segment structure 170 161 PRIVATE :: seg__copy ! copy segment structure in another … … 182 173 CHARACTER(LEN=lc) :: c_card = '' !< boundary cardinal 183 174 LOGICAL :: l_use = .FALSE. !< boundary use or not 184 LOGICAL :: l_nam = .FALSE. !< boundary get from namelist185 175 INTEGER(i4) :: i_nseg = 0 !< number of segment in boundary 186 176 TYPE(TSEG), DIMENSION(:), POINTER :: t_seg => NULL() !< array of segment structure 187 177 END TYPE TBDY 188 178 189 ! module variable190 179 INTEGER(i4), PARAMETER :: im_width=10 191 180 … … 234 223 !> @date November, 2013 - Initial Version 235 224 !> @date November, 2014 236 !> - use function instead of overload assignment operator225 !> - use function instead of overload assignment operator 237 226 !> (to avoid memory leak) 238 227 ! … … 271 260 !> @date November, 2013 - Initial Version 272 261 !> @date November, 2014 273 !> - use function instead of overload assignment operator262 !> - use function instead of overload assignment operator 274 263 !> (to avoid memory leak) 275 264 ! … … 364 353 END SUBROUTINE boundary__clean_arr 365 354 !------------------------------------------------------------------- 366 !> @brief This function put cardinal name and dateinside file name.355 !> @brief This function put cardinal name inside file name. 367 356 ! 368 357 !> @details 369 !> Examples : 370 !> cd_file="boundary.nc" 371 !> cd_card="west" 372 !> id_seg =2 373 !> cd_date=y2015m07d16 374 !> 375 !> function return "boundary_west_2_y2015m07d16.nc" 376 !> 377 !> cd_file="boundary.nc" 378 !> cd_card="west" 379 !> 380 !> function return "boundary_west.nc" 381 !> 358 ! 382 359 !> @author J.Paul 383 360 !> @date November, 2013 - Initial Version … … 408 385 CHARACTER(LEN=lc) :: cl_date 409 386 CHARACTER(LEN=lc) :: cl_name 410 411 INTEGER(i4) :: il_ind412 INTEGER(i4) :: il_indend413 414 387 ! loop indices 415 388 !---------------------------------------------------------------- … … 427 400 cl_suffix=fct_split(TRIM(cl_basename),2,'.') 428 401 429 ! add segment number430 402 IF( PRESENT(id_seg) )THEN 431 cl_segnum="_"//TRIM(fct_str(id_seg)) 403 cl_segnum="_"//TRIM(fct_str(id_seg))//"_" 432 404 ELSE 433 405 cl_segnum="" 434 406 ENDIF 435 407 436 ! add date437 408 IF( PRESENT(cd_date) )THEN 438 cl_date= "_"//TRIM(ADJUSTL(cd_date))409 cl_date=TRIM(ADJUSTL(cd_date)) 439 410 ELSE 440 411 cl_date="" 441 412 ENDIF 442 413 443 ! special case for obcdta 444 il_ind=INDEX(cl_base,'_obcdta_') 445 IF( il_ind/=0 )THEN 446 il_ind=il_ind-1+8 447 il_indend=LEN_TRIM(cl_base) 448 449 cl_name=TRIM(cl_base(1:il_ind))//TRIM(cd_card)//& 450 & TRIM(cl_segnum)//"_"//TRIM(cl_base(il_ind+1:il_indend))//& 451 & TRIM(cl_date)//"."//TRIM(cl_suffix) 452 ELSE 453 cl_name=TRIM(cl_base)//"_"//TRIM(cd_card)//TRIM(cl_segnum)//& 454 & TRIM(cl_date)//"."//TRIM(cl_suffix) 455 ENDIF 414 cl_name=TRIM(cl_base)//"_"//TRIM(cd_card)//TRIM(cl_segnum)//& 415 & TRIM(cl_date)//"."//TRIM(cl_suffix) 456 416 457 417 boundary_set_filename=TRIM(cl_dirname)//"/"//TRIM(cl_name) … … 482 442 !> ex : cn_north='index1,first1,last1(width)|index2,first2,last2' 483 443 !> 484 !> @note Boundaries are compute on T point, but expressed on U,V point.485 !> change will be done to get dataon other point when need be.444 !> @note boundaries are compute on T point. change will be done to get data 445 !> on other point when need be. 486 446 !> 487 447 !> @author J.Paul … … 621 581 622 582 ! get namelist information 623 tl_tmp=boundary__get_info(cl_card(jk),jk) 624 625 ! get segments indices 583 tl_tmp=boundary__get_info(cl_card(jk)) 626 584 DO ji=1,tl_tmp%i_nseg 627 585 CALL boundary__add_seg(tl_bdy(jk),tl_tmp%t_seg(ji)) 628 586 ENDDO 629 ! indices from namelist or not630 tl_bdy(jk)%l_nam=tl_tmp%l_nam631 632 587 CALL boundary_clean(tl_tmp) 633 588 … … 687 642 !> @return boundary structure 688 643 !------------------------------------------------------------------- 689 FUNCTION boundary__init( cd_card, ld_use, ld_nam,td_seg )644 FUNCTION boundary__init( cd_card, ld_use, td_seg ) 690 645 IMPLICIT NONE 691 646 ! Argument 692 647 CHARACTER(LEN=*), INTENT(IN) :: cd_card 693 648 LOGICAL , INTENT(IN), OPTIONAL :: ld_use 694 LOGICAL , INTENT(IN), OPTIONAL :: ld_nam695 649 TYPE(TSEG) , INTENT(IN), OPTIONAL :: td_seg 696 650 … … 710 664 boundary__init%l_use=.TRUE. 711 665 IF( PRESENT(ld_use) ) boundary__init%l_use=ld_use 712 713 boundary__init%l_nam=.FALSE.714 IF( PRESENT(ld_nam) ) boundary__init%l_nam=ld_nam715 666 716 667 IF( PRESENT(td_seg) )THEN … … 827 778 !> orthogonal index, first and last indices, of each segment. 828 779 !> And also the width of all segments of this boundary. 829 !> cn_north='index1,first1 :last1(width)|index2,first2:last2'780 !> cn_north='index1,first1,last1(width)|index2,first2,last2' 830 781 !> 831 782 !> @author J.Paul 832 783 !> @date November, 2013 - Initial Version 833 !> @date february, 2015834 !> - do not change indices read from namelist835 !> - change format cn_north836 784 ! 837 785 !> @param[in] cd_card boundary description 838 !> @param[in] id_jcard boundary index839 786 !> @return boundary structure 840 787 !------------------------------------------------------------------- 841 FUNCTION boundary__get_info(cd_card , id_jcard)788 FUNCTION boundary__get_info(cd_card) 842 789 IMPLICIT NONE 843 790 ! Argument 844 791 CHARACTER(LEN=lc), INTENT(IN) :: cd_card 845 INTEGER(i4) , INTENT(IN) :: id_jcard846 792 847 793 ! function … … 856 802 CHARACTER(LEN=lc) :: cl_index 857 803 CHARACTER(LEN=lc) :: cl_width 858 CHARACTER(LEN=lc) :: cl_tmp859 804 CHARACTER(LEN=lc) :: cl_first 860 805 CHARACTER(LEN=lc) :: cl_last … … 873 818 ! width should be the same for all segment of one boundary 874 819 IF( TRIM(cl_seg) /= '' )THEN 875 876 ! initialise boundary877 ! temporaty boundary, so it doesn't matter which caridnal is used878 boundary__get_info=boundary__init('north',ld_nam=.TRUE.)879 880 820 il_ind1=SCAN(fct_lower(cl_seg),'(') 881 821 IF( il_ind1 /=0 )THEN … … 891 831 ENDIF 892 832 ENDIF 893 894 833 ENDIF 895 834 … … 900 839 il_ind1=SCAN(fct_lower(cl_index),'(') 901 840 IF( il_ind1 /=0 )THEN 902 il_ind2=SCAN(fct_lower(cl_index),' )')841 il_ind2=SCAN(fct_lower(cl_index),'(') 903 842 IF( il_ind2 /=0 )THEN 904 843 cl_index=TRIM(cl_index(:il_ind1-1))//TRIM(cl_index(il_ind2+1:)) … … 909 848 ENDIF 910 849 911 912 cl_tmp=fct_split(cl_seg,2,',') 913 914 915 cl_first=fct_split(cl_tmp,1,':') 850 cl_first=fct_split(cl_seg,2,',') 916 851 ! remove potential width information 917 852 il_ind1=SCAN(fct_lower(cl_first),'(') 918 853 IF( il_ind1 /=0 )THEN 919 il_ind2=SCAN(fct_lower(cl_first),' )')854 il_ind2=SCAN(fct_lower(cl_first),'(') 920 855 IF( il_ind2 /=0 )THEN 921 856 cl_first=TRIM(cl_first(:il_ind1-1))//TRIM(cl_first(il_ind2+1:)) … … 926 861 ENDIF 927 862 928 cl_last =fct_split(cl_ tmp,2,':')863 cl_last =fct_split(cl_seg,3,',') 929 864 ! remove potential width information 930 865 il_ind1=SCAN(fct_lower(cl_last),'(') 931 866 IF( il_ind1 /=0 )THEN 932 il_ind2=SCAN(fct_lower(cl_last),' )')867 il_ind2=SCAN(fct_lower(cl_last),'(') 933 868 IF( il_ind2 /=0 )THEN 934 869 cl_last=TRIM(cl_last(:il_ind1-1))//TRIM(cl_last(il_ind2+1:)) … … 944 879 IF( TRIM(cl_first) /= '' ) READ(cl_first,*) tl_seg%i_first 945 880 IF( TRIM(cl_last) /= '' ) READ(cl_last ,*) tl_seg%i_last 946 947 ! index expressed on U,V point, move on T point.948 SELECT CASE(id_jcard)949 CASE(jp_north, jp_east)950 tl_seg%i_index=tl_seg%i_index+1951 END SELECT952 881 953 882 IF( (tl_seg%i_first == 0 .AND. tl_seg%i_last == 0) .OR. & … … 1014 943 1015 944 DO jk=1,ip_ncard 1016 IF( .NOT. td_bdy(jk)%l_use .OR. td_bdy(jk)% l_nam)THEN945 IF( .NOT. td_bdy(jk)%l_use .OR. td_bdy(jk)%i_nseg > 1 )THEN 1017 946 ! nothing to be done 1018 947 ELSE … … 1551 1480 il_max(jp_east )=td_var%t_dim(2)%i_len 1552 1481 il_max(jp_west )=td_var%t_dim(2)%i_len 1553 1482 1554 1483 il_maxindex(jp_north)=td_var%t_dim(2)%i_len-ip_ghost 1555 1484 il_maxindex(jp_south)=td_var%t_dim(2)%i_len-ip_ghost … … 1586 1515 ENDIF 1587 1516 ENDDO 1588 1517 1589 1518 CALL boundary_check_corner(td_bdy, td_var) 1590 1519 … … 1721 1650 !> @date November, 2013 - Initial Version 1722 1651 !> @date November, 2014 1723 !> - use function instead of overload assignment operator1652 !> - use function instead of overload assignment operator 1724 1653 !> (to avoid memory leak) 1725 1654 ! … … 1758 1687 !> @date November, 2013 - Initial Version 1759 1688 !> @date November, 2014 1760 !> - use function instead of overload assignment operator1689 !> - use function instead of overload assignment operator 1761 1690 !> (to avoid memory leak) 1762 1691 ! -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/create_bathy.f90
r10248 r10251 20 20 !> ./SIREN/bin/create_bathy create_bathy.nam 21 21 !> @endcode 22 !> <br/> 23 !> \image html bathy_40.png 24 !> \image latex bathy_30.png 25 !> 26 !> @note 27 !> you could find a template of the namelist in templates directory. 28 !> 22 !> 29 23 !> create_bathy.nam comprise 7 namelists:<br/> 30 24 !> - logger namelist (namlog) … … 43 37 !> - cn_logfile : log filename 44 38 !> - cn_verbosity : verbosity ('trace','debug','info', 45 !> 'warning','error','fatal' ,'none')39 !> 'warning','error','fatal') 46 40 !> - in_maxerror : maximum number of error allowed 47 41 !> … … 58 52 !> - cn_coord1 : coordinate file 59 53 !> - in_perio1 : periodicity index 60 !> - ln_fillclosed : fill closed sea or not (default is .TRUE.)54 !> - ln_fillclosed : fill closed sea or not 61 55 !> 62 56 !> * _variable namelist (namvar)_:<br/> 63 57 !> - cn_varinfo : list of variable and extra information about request(s) 64 58 !> to be used.<br/> 65 !> each elements of *cn_varinfo* is a string character 66 !> (separated by ',').<br/> 59 !> each elements of *cn_varinfo* is a string character.<br/> 67 60 !> it is composed of the variable name follow by ':', 68 61 !> then request(s) to be used on this variable.<br/> 69 62 !> request could be: 70 !> - int = interpolation method 71 !> - ext = extrapolation method 72 !> - flt = filter method 73 !> - min = minimum value 74 !> - max = maximum value 75 !> - unt = new units 76 !> - unf = unit scale factor (linked to new units) 63 !> - interpolation method 64 !> - extrapolation method 65 !> - filter method 66 !> - > minimum value 67 !> - < maximum value 77 68 !> 78 69 !> requests must be separated by ';'.<br/> … … 81 72 !> informations about available method could be find in @ref interp, 82 73 !> @ref extrap and @ref filter modules.<br/> 83 !> Example: 'Bathymetry: flt=2*hamming(2,3); min=0'74 !> Example: 'Bathymetry: 2*hamming(2,3); > 0' 84 75 !> @note 85 76 !> If you do not specify a method which is required, … … 99 90 !> - ',' for line 100 91 !> - '/' for row 92 !> - '\' for level<br/> 101 93 !> Example:<br/> 102 94 !> 3,2,3/1,4,5 => @f$ \left( \begin{array}{ccc} … … 107 99 !> - 'Bathymetry:gridT.nc' 108 100 !> - 'Bathymetry:5000,5000,5000/5000,3000,5000/5000,5000,5000' 101 !> 102 !> \image html bathy_40.png 103 !> \image latex bathy_30.png 109 104 !> 110 105 !> * _nesting namelist (namnst)_:<br/> … … 124 119 !> - add header for user 125 120 !> - Bug fix, compute offset depending of grid point 126 !> @date June, 2015127 !> - extrapolate all land points.128 !> - allow to change unit.129 121 ! 130 !> @todo131 !> - use create_bathy_check_depth as in create_boundary132 !> - use create_bathy_check_time as in create_boundary133 !> - check tl_multi is not empty134 !>135 122 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 136 123 !---------------------------------------------------------------------- … … 495 482 ENDIF 496 483 497 ! use additional request498 484 DO jk=1,tl_multi%i_nvar 499 500 ! change unit and apply factor501 CALL var_chg_unit(tl_var(jk))502 503 485 ! forced min and max value 504 486 CALL var_limit_value(tl_var(jk)) … … 575 557 576 558 ! add other variables 577 DO jk= tl_multi%i_nvar,1,-1559 DO jk=1,tl_multi%i_nvar 578 560 CALL file_add_var(tl_fileout, tl_var(jk)) 579 561 CALL var_clean(tl_var(jk)) … … 641 623 !> 642 624 !> @author J.Paul 643 !> @date November, 2013- Initial Version625 !> - November, 2013- Initial Version 644 626 !> 645 627 !> @param[in] td_var variable structure … … 777 759 !> 778 760 !> @author J.Paul 779 !> @date November, 2013- Initial Version761 !> - November, 2013- Initial Version 780 762 !> 781 763 !> @param[in] td_var variable structure … … 896 878 !> 897 879 !> @author J.Paul 898 !> @date November, 2013- Initial Version880 !> - November, 2013- Initial Version 899 881 !> 900 882 !> @param[in] td_var variable structure … … 915 897 IMPLICIT NONE 916 898 ! Argument 917 TYPE(TVAR) 918 TYPE(TMPP) 919 INTEGER(i4) 920 INTEGER(i4) 921 INTEGER(i4) 922 INTEGER(i4) 899 TYPE(TVAR) , INTENT(IN) :: td_var 900 TYPE(TMPP) , INTENT(IN) :: td_mpp 901 INTEGER(i4), INTENT(IN) :: id_imin 902 INTEGER(i4), INTENT(IN) :: id_imax 903 INTEGER(i4), INTENT(IN) :: id_jmin 904 INTEGER(i4), INTENT(IN) :: id_jmax 923 905 INTEGER(i4), DIMENSION(:,:), INTENT(IN) :: id_offset 924 906 INTEGER(i4), DIMENSION(:) , INTENT(IN) :: id_rho … … 1007 989 !> 1008 990 !> @author J.Paul 1009 !> @date November, 2013- Initial Version991 !> - November, 2013- Initial Version 1010 992 !> 1011 993 !> @param[inout] td_var variable structure … … 1091 1073 1092 1074 ! extrapolate variable 1093 CALL extrap_fill_value( td_var ) 1075 CALL extrap_fill_value( td_var, id_offset=id_offset(:,:), & 1076 & id_rho=id_rho(:), & 1077 & id_iext=il_iext, id_jext=il_jext ) 1094 1078 1095 1079 ! interpolate Bathymetry -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/create_boundary.f90
r10248 r10251 23 23 !> ./SIREN/bin/create_boundary create_boundary.nam 24 24 !> @endcode 25 !> <br/> 26 !> \image html boundary_NEATL36_70.png 27 !> \image latex boundary_NEATL36_70.png 28 !> 29 !> @note 30 !> you could find a template of the namelist in templates directory. 31 !> 25 !> 32 26 !> create_boundary.nam comprise 9 namelists:<br/> 33 27 !> - logger namelist (namlog) … … 48 42 !> - cn_logfile : log filename 49 43 !> - cn_verbosity : verbosity ('trace','debug','info', 50 !> 'warning','error','fatal' ,'none')44 !> 'warning','error','fatal') 51 45 !> - in_maxerror : maximum number of error allowed 52 46 !> … … 85 79 !> * _variable namelist (namvar)_:<br/> 86 80 !> - cn_varinfo : list of variable and extra information about request(s) 87 !> to be used (separated by ',').<br/>81 !> to be used.<br/> 88 82 !> each elements of *cn_varinfo* is a string character.<br/> 89 83 !> it is composed of the variable name follow by ':', 90 84 !> then request(s) to be used on this variable.<br/> 91 85 !> request could be: 92 !> - int = interpolation method 93 !> - ext = extrapolation method 94 !> - flt = filter method 95 !> - unt = new units 96 !> - unf = unit scale factor (linked to new units) 86 !> - interpolation method 87 !> - extrapolation method 88 !> - filter method 97 89 !> 98 90 !> requests must be separated by ';'.<br/> … … 102 94 !> @ref extrap and @ref filter.<br/> 103 95 !> 104 !> Example: 'votemper: int=linear;flt=hann;ext=dist_weight', 'vosaline:int=cubic'96 !> Example: 'votemper:linear;hann;dist_weight', 'vosaline:cubic' 105 97 !> @note 106 98 !> If you do not specify a method which is required, … … 144 136 !> segments are separated by '|'.<br/> 145 137 !> each segments of the boundary is composed of: 146 !> - indice of velocity (orthogonal to boundary .ie.147 !> for north boundary, J-indice).148 !> - indice of segemnt start(I-indice for north boundary)149 !> - indice of segment end(I-indice for north boundary)<br/>150 !> indices must be separated by ' :' .<br/>138 !> - orthogonal indice (.ie. for north boundary, 139 !> J-indice where boundary are). 140 !> - first indice of boundary (I-indice for north boundary) 141 !> - last indice of boundary (I-indice for north boundary)<br/> 142 !> indices must be separated by ',' .<br/> 151 143 !> - optionally, boundary size could be added between '(' and ')' 152 144 !> in the first segment defined. … … 155 147 !> 156 148 !> Examples: 157 !> - cn_north='index1,first1:last1(width)' 158 !> - cn_north='index1(width),first1:last1|index2,first2:last2' 159 !> \image html boundary_50.png 160 !> \image latex boundary_50.png 149 !> - cn_north='index1,first1,last1(width)' 150 !> - cn_north='index1(width),first1,last1|index2,first2,last2' 151 !> 152 !> \image html boundary_50.png 153 !> \image latex boundary_50.png 154 !> 161 155 !> - cn_south : south boundary indices on fine grid 162 156 !> - cn_east : east boundary indices on fine grid 163 157 !> - cn_west : west boundary indices on fine grid 164 158 !> - ln_oneseg : use only one segment for each boundary or not 165 !> 166 !> * _output namelist (namout)_:<br/> 159 !> - in_extrap : number of mask point to be extrapolated 160 !> 161 !> * _output namelist (namout)_:<br/> 167 162 !> - cn_fileout : fine grid boundary basename 168 163 !> (cardinal and segment number will be automatically added) 169 !> - dn_dayofs : date offset in day (change only ouput file name)170 !> - ln_extrap : extrapolate land point or not171 !>172 !> Examples:173 !> - cn_fileout=boundary.nc<br/>174 !> if time_counter (16/07/2015 00h) is read on input file (see varfile),175 !> west boundary will be named boundary_west_y2015m07d16176 !> - dn_dayofs=-2.<br/>177 !> if you use day offset you get boundary_west_y2015m07d14178 !>179 164 !> 180 165 !> @author J.Paul … … 184 169 !> - add header for user 185 170 !> - take into account grid point to compue boundaries 186 !> - reorder output dimension for north and south boundaries 187 !> @date June, 2015 188 !> - extrapolate all land points, and add ln_extrap in namelist. 189 !> - allow to change unit. 190 !> @date July, 2015 191 !> - add namelist parameter to shift date of output file name. 171 !> - reorder output dimension for north and south boundaries 192 172 !> 193 173 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 211 191 USE dom ! domain manager 212 192 USE grid ! grid manager 213 USE vgrid ! v ertical grid manager193 USE vgrid ! vartical grid manager 214 194 USE extrap ! extrapolation manager 215 195 USE interp ! interpolation manager … … 233 213 INTEGER(i4) :: il_status 234 214 INTEGER(i4) :: il_fileid 215 INTEGER(i4) :: il_dim 235 216 INTEGER(i4) :: il_imin0 236 217 INTEGER(i4) :: il_imax0 … … 258 239 259 240 TYPE(TDIM) , DIMENSION(ip_maxdim) :: tl_dim 260 261 TYPE(TDATE) :: tl_date262 241 263 242 TYPE(TBDY) , DIMENSION(ip_ncard) :: tl_bdy … … 286 265 ! namelist variable 287 266 ! namlog 288 CHARACTER(LEN=lc) :: cn_logfile = 'create_boundary.log'289 CHARACTER(LEN=lc) :: cn_verbosity = 'warning'290 INTEGER(i4) :: in_maxerror = 5267 CHARACTER(LEN=lc) :: cn_logfile = 'create_boundary.log' 268 CHARACTER(LEN=lc) :: cn_verbosity = 'warning' 269 INTEGER(i4) :: in_maxerror = 5 291 270 292 271 ! namcfg 293 CHARACTER(LEN=lc) :: cn_varcfg = 'variable.cfg'272 CHARACTER(LEN=lc) :: cn_varcfg = 'variable.cfg' 294 273 295 274 ! namcrs 296 CHARACTER(LEN=lc) :: cn_coord0 = ''297 INTEGER(i4) :: in_perio0 = -1275 CHARACTER(LEN=lc) :: cn_coord0 = '' 276 INTEGER(i4) :: in_perio0 = -1 298 277 299 278 ! namfin 300 CHARACTER(LEN=lc) :: cn_coord1 = ''301 CHARACTER(LEN=lc) :: cn_bathy1 = ''302 INTEGER(i4) :: in_perio1 = -1279 CHARACTER(LEN=lc) :: cn_coord1 = '' 280 CHARACTER(LEN=lc) :: cn_bathy1 = '' 281 INTEGER(i4) :: in_perio1 = -1 303 282 304 283 !namzgr 305 REAL(dp) :: dn_pp_to_be_computed = 0._dp 306 REAL(dp) :: dn_ppsur = -3958.951371276829_dp 307 REAL(dp) :: dn_ppa0 = 103.9530096000000_dp 308 REAL(dp) :: dn_ppa1 = 2.4159512690000_dp 309 REAL(dp) :: dn_ppa2 = 100.7609285000000_dp 310 REAL(dp) :: dn_ppkth = 15.3510137000000_dp 311 REAL(dp) :: dn_ppkth2 = 48.0298937200000_dp 312 REAL(dp) :: dn_ppacr = 7.0000000000000_dp 313 REAL(dp) :: dn_ppacr2 = 13.000000000000_dp 314 REAL(dp) :: dn_ppdzmin = 6._dp 315 REAL(dp) :: dn_pphmax = 5750._dp 316 INTEGER(i4) :: in_nlevel = 75 317 318 !namzps 319 REAL(dp) :: dn_e3zps_min = 25._dp 320 REAL(dp) :: dn_e3zps_rat = 0.2_dp 284 INTEGER(i4) :: in_nlevel = 75 321 285 322 286 ! namvar … … 325 289 326 290 ! namnst 327 INTEGER(i4) :: in_rhoi = 0328 INTEGER(i4) :: in_rhoj = 0291 INTEGER(i4) :: in_rhoi = 0 292 INTEGER(i4) :: in_rhoj = 0 329 293 330 294 ! nambdy 331 LOGICAL :: ln_north = .TRUE. 332 LOGICAL :: ln_south = .TRUE. 333 LOGICAL :: ln_east = .TRUE. 334 LOGICAL :: ln_west = .TRUE. 335 CHARACTER(LEN=lc) :: cn_north = '' 336 CHARACTER(LEN=lc) :: cn_south = '' 337 CHARACTER(LEN=lc) :: cn_east = '' 338 CHARACTER(LEN=lc) :: cn_west = '' 339 LOGICAL :: ln_oneseg = .TRUE. 295 LOGICAL :: ln_north = .TRUE. 296 LOGICAL :: ln_south = .TRUE. 297 LOGICAL :: ln_east = .TRUE. 298 LOGICAL :: ln_west = .TRUE. 299 CHARACTER(LEN=lc) :: cn_north = '' 300 CHARACTER(LEN=lc) :: cn_south = '' 301 CHARACTER(LEN=lc) :: cn_east = '' 302 CHARACTER(LEN=lc) :: cn_west = '' 303 LOGICAL :: ln_oneseg = .TRUE. 304 INTEGER(i4) :: in_extrap = 0 340 305 341 306 ! namout 342 CHARACTER(LEN=lc) :: cn_fileout = 'boundary.nc' 343 REAL(dp) :: dn_dayofs = 0._dp 344 LOGICAL :: ln_extrap = .FALSE. 307 CHARACTER(LEN=lc) :: cn_fileout = 'boundary.nc' 345 308 !------------------------------------------------------------------- 346 309 … … 356 319 & cn_coord0, & !< coordinate file 357 320 & in_perio0 !< periodicity index 358 321 359 322 NAMELIST /namfin/ & !< fine grid namelist 360 323 & cn_coord1, & !< coordinate file … … 363 326 364 327 NAMELIST /namzgr/ & 365 & dn_pp_to_be_computed, & 366 & dn_ppsur, & 367 & dn_ppa0, & 368 & dn_ppa1, & 369 & dn_ppa2, & 370 & dn_ppkth, & 371 & dn_ppkth2, & 372 & dn_ppacr, & 373 & dn_ppacr2, & 374 & dn_ppdzmin, & 375 & dn_pphmax, & 376 & in_nlevel !< number of vertical level 377 378 NAMELIST /namzps/ & 379 & dn_e3zps_min, & 380 & dn_e3zps_rat 328 & in_nlevel 381 329 382 330 NAMELIST /namvar/ & !< variable namelist 383 331 & cn_varinfo, & !< list of variable and method to apply on. (ex: 'votemper:linear','vosaline:cubic' ) 384 332 & cn_varfile !< list of variable and file where find it. (ex: 'votemper:GLORYS_gridT.nc' ) 385 333 386 334 NAMELIST /namnst/ & !< nesting namelist 387 335 & in_rhoi, & !< refinement factor in i-direction … … 397 345 & cn_east , & !< east boundary indices on fine grid 398 346 & cn_west , & !< west boundary indices on fine grid 399 & ln_oneseg !< use only one segment for each boundary or not 347 & ln_oneseg, & !< use only one segment for each boundary or not 348 & in_extrap !< number of mask point to be extrapolated 400 349 401 350 NAMELIST /namout/ & !< output namelist 402 & cn_fileout, & !< fine grid boundary file basename 403 & dn_dayofs, & !< date offset in day (change only ouput file name) 404 & ln_extrap !< extrapolate or not 351 & cn_fileout !< fine grid boundary file basename 405 352 !------------------------------------------------------------------- 406 353 … … 501 448 ! check 502 449 ! check output file do not already exist 503 ! WARNING: do not work when use time to create output file name504 450 DO jk=1,ip_ncard 505 451 cl_bdyout=boundary_set_filename( TRIM(cn_fileout), & 506 452 & TRIM(cp_card(jk)), 1 ) 507 INQUIRE(FILE=TRIM(cl_bdyout), EXIST=ll_exist)508 IF( ll_exist )THEN509 CALL logger_fatal("CREATE BOUNDARY: output file "//TRIM(cl_bdyout)//&510 & " already exist.")511 ENDIF512 513 cl_bdyout=boundary_set_filename( TRIM(cn_fileout), &514 & TRIM(cp_card(jk)) )515 453 INQUIRE(FILE=TRIM(cl_bdyout), EXIST=ll_exist) 516 454 IF( ll_exist )THEN … … 552 490 553 491 CALL iom_mpp_open(tl_bathy1) 554 492 555 493 tl_var1=iom_mpp_read_var(tl_bathy1,'Bathymetry') 556 494 557 495 CALL iom_mpp_close(tl_bathy1) 558 496 559 ! get boundaries indices560 497 tl_bdy(:)=boundary_init(tl_var1, ln_north, ln_south, ln_east, ln_west, & 561 498 & cn_north, cn_south, cn_east, cn_west, & … … 568 505 tl_level(:)=vgrid_get_level(tl_bathy1, cl_namelist ) 569 506 570 ! get coordinate foreach segment of each boundary507 ! get coordinate on each segment of each boundary 571 508 ALLOCATE( tl_segdom1(ip_npoint,ip_maxseg,ip_ncard) ) 572 509 ALLOCATE( tl_seglvl1(ip_npoint,ip_maxseg,ip_ncard) ) 573 510 574 511 DO jl=1,ip_ncard 575 512 IF( tl_bdy(jl)%l_use )THEN … … 579 516 tl_segdom1(:,jk,jl)=create_boundary_get_dom( tl_bathy1, & 580 517 & tl_bdy(jl), jk ) 581 582 IF( .NOT. ln_extrap )THEN583 ! get fine grid level584 tl_seglvl1(:,jk,jl)= &585 & create_boundary_get_level( tl_level(:), &586 & tl_segdom1(:,jk,jl))587 ENDIF588 518 589 519 ! add extra band to fine grid domain (if possible) … … 593 523 & il_rho(jp_I), il_rho(jp_J)) 594 524 ENDDO 525 526 ! get fine grid level 527 tl_seglvl1(:,jk,jl)=create_boundary_get_level( tl_level(:), & 528 tl_segdom1(:,jk,jl)) 595 529 596 530 ENDDO … … 660 594 & in_nlevel ) 661 595 596 ! use mask 597 CALL create_boundary_use_mask( tl_segvar1(jvar,jk,jl), & 598 & tl_seglvl1(jpoint,jk,jl)) 599 662 600 !del extra 663 601 CALL dom_del_extra( tl_segvar1(jvar,jk,jl), & … … 716 654 IF( tl_bdy(jl)%l_use )THEN 717 655 718 WRITE(*,'(2x,a,a)') 'work on '//TRIM(tl_bdy(jl)%c_card)//& 719 & ' boundary' 656 WRITE(*,'(2x,a,a)') 'work on '//TRIM(tl_bdy(jl)%c_card)//' boundary' 720 657 DO jk=1,tl_bdy(jl)%i_nseg 721 658 ! compute domain on fine grid … … 725 662 726 663 cl_name=tl_multi%t_mpp(ji)%t_proc(1)%t_var(jj)%c_name 727 WRITE(*,'(4x,a,a)') "work on (extract) variable "//& 728 & TRIM(cl_name) 664 WRITE(*,'(4x,a,a)') "work on variable "//TRIM(cl_name) 729 665 730 666 cl_point=tl_multi%t_mpp(ji)%t_proc(1)%t_var(jj)%c_point … … 742 678 743 679 tl_dom1=dom_copy(tl_segdom1(jpoint,jk,jl)) 680 tl_lvl1=var_copy(tl_seglvl1(jpoint,jk,jl)) 744 681 745 682 ! open mpp files … … 750 687 & tl_mpp, TRIM(cl_name), tl_dom1) 751 688 689 ! use mask 690 CALL create_boundary_use_mask( & 691 & tl_segvar1(jvar+jj,jk,jl), tl_lvl1) 692 752 693 ! del extra point 753 694 CALL dom_del_extra( tl_segvar1(jvar+jj,jk,jl), & … … 758 699 759 700 ! add attribute to variable 760 tl_att=att_init('src_file', & 761 & TRIM(fct_basename(tl_mpp%c_name))) 701 tl_att=att_init('src_file',TRIM(fct_basename(tl_mpp%c_name))) 762 702 CALL var_move_att(tl_segvar1(jvar+jj,jk,jl), tl_att) 763 703 764 tl_att=att_init('src_i_indices', & 765 & (/tl_dom1%i_imin, tl_dom1%i_imax/)) 704 tl_att=att_init('src_i_indices',(/tl_dom1%i_imin, tl_dom1%i_imax/)) 766 705 CALL var_move_att(tl_segvar1(jvar+jj,jk,jl), tl_att) 767 706 768 tl_att=att_init('src_j_indices', & 769 & (/tl_dom1%i_jmin, tl_dom1%i_jmax/)) 707 tl_att=att_init('src_j_indices',(/tl_dom1%i_jmin, tl_dom1%i_jmax/)) 770 708 CALL var_move_att(tl_segvar1(jvar+jj,jk,jl), tl_att) 771 709 … … 798 736 IF( tl_bdy(jl)%l_use )THEN 799 737 800 WRITE(*,'(2x,a,a)') 'work on '//TRIM(tl_bdy(jl)%c_card)//& 801 & ' boundary' 738 WRITE(*,'(2x,a,a)') 'work on '//TRIM(tl_bdy(jl)%c_card)//' boundary' 802 739 DO jk=1,tl_bdy(jl)%i_nseg 803 740 804 741 ! for each variable of this file 805 742 DO jj=1,tl_multi%t_mpp(ji)%t_proc(1)%i_nvar 806 807 WRITE(*,'(4x,a,a)') "work on (interp)variable "//&743 744 WRITE(*,'(4x,a,a)') "work on variable "//& 808 745 & TRIM(tl_multi%t_mpp(ji)%t_proc(1)%t_var(jj)%c_name) 809 746 … … 822 759 823 760 tl_dom1=dom_copy(tl_segdom1(jpoint,jk,jl)) 761 tl_lvl1=var_copy(tl_seglvl1(jpoint,jk,jl)) 824 762 825 763 CALL create_boundary_get_coord( tl_coord1, tl_dom1, & … … 857 795 & il_jmin0, il_jmax0 ) 858 796 859 ! add extra band (if possible) to compute 860 ! interpolation 797 ! add extra band (if possible) to compute interpolation 861 798 CALL dom_add_extra(tl_dom0) 862 799 … … 878 815 CALL dom_del_extra( tl_segvar1(jvar+jj,jk,jl), & 879 816 & tl_dom0, il_rho(:) ) 817 818 ! use mask 819 CALL create_boundary_use_mask( & 820 & tl_segvar1(jvar+jj,jk,jl), tl_lvl1) 880 821 881 822 ! del extra point on fine grid … … 948 889 949 890 IF( jvar /= tl_multi%i_nvar )THEN 950 CALL logger_error("CREATE BOUNDARY: it seems some variable "//& 951 & "can not be read") 891 CALL logger_error("CREATE BOUNDARY: it seems some variable can not be read") 952 892 ENDIF 893 894 CALL var_clean(tl_seglvl1(:,:,:)) 895 DEALLOCATE( tl_seglvl1 ) 953 896 954 897 ! write file for each segment of each boundary 955 898 DO jl=1,ip_ncard 956 899 IF( tl_bdy(jl)%l_use )THEN 900 901 SELECT CASE(TRIM(tl_bdy(jk)%c_card)) 902 CASE('north','south') 903 il_dim=1 904 CASE('east','west') 905 il_dim=2 906 END SELECT 957 907 958 908 DO jk=1,tl_bdy(jl)%i_nseg … … 961 911 & 'T', tl_lon1, tl_lat1 ) 962 912 963 ! force to use nav_lon, nav_lat as variable name964 tl_lon1%c_name='nav_lon'965 tl_lat1%c_name='nav_lat'966 967 913 ! del extra point on fine grid 968 914 CALL dom_del_extra( tl_lon1, tl_segdom1(jp_T,jk,jl) ) … … 978 924 CALL boundary_swap(tl_lat1, tl_bdy(jl)) 979 925 DO jvar=1,tl_multi%i_nvar 926 CALL boundary_swap(tl_segvar1(jvar,jk,jl), tl_bdy(jl)) 980 927 981 928 ! use additional request 982 ! change unit and apply factor983 CALL var_chg_unit(tl_segvar1(jvar,jk,jl))984 985 929 ! forced min and max value 986 930 CALL var_limit_value(tl_segvar1(jvar,jk,jl)) … … 989 933 CALL filter_fill_value(tl_segvar1(jvar,jk,jl)) 990 934 991 IF( .NOT. ln_extrap )THEN 992 ! use mask 993 SELECT CASE(TRIM(tl_segvar1(jvar,jk,jl)%c_point)) 994 CASE DEFAULT !'T' 995 jpoint=jp_T 996 CASE('U') 997 jpoint=jp_U 998 CASE('V') 999 jpoint=jp_V 1000 CASE('F') 1001 jpoint=jp_F 1002 END SELECT 1003 1004 CALL create_boundary_use_mask(tl_segvar1(jvar,jk,jl), & 1005 & tl_seglvl1(jpoint,jk,jl)) 1006 ENDIF 1007 1008 ! swap dimension order 1009 CALL boundary_swap(tl_segvar1(jvar,jk,jl), tl_bdy(jl)) 935 ! extrapolate 936 CALL extrap_fill_value( tl_segvar1(jvar,jk,jl), & 937 & id_iext=in_extrap, & 938 & id_jext=in_extrap, & 939 & id_kext=in_extrap ) 1010 940 1011 941 ENDDO … … 1014 944 ! create file structure 1015 945 ! set file namearray of level variable structure 1016 IF( tl_bdy(jl)%i_nseg > 1 )THEN 1017 IF( ASSOCIATED(tl_time%d_value) )THEN 1018 cl_fmt="('y',i0.4,'m',i0.2,'d',i0.2)" 1019 tl_date=var_to_date(tl_time) 1020 tl_date=tl_date+dn_dayofs 1021 cl_date=date_print( tl_date, cl_fmt ) 1022 1023 cl_bdyout=boundary_set_filename( TRIM(cn_fileout), & 1024 & TRIM(tl_bdy(jl)%c_card), jk,& 1025 & cd_date=TRIM(cl_date) ) 1026 ELSE 1027 cl_bdyout=boundary_set_filename( TRIM(cn_fileout), & 1028 & TRIM(tl_bdy(jl)%c_card), jk ) 1029 ENDIF 946 IF( ASSOCIATED(tl_time%d_value) )THEN 947 cl_fmt="('y',i0.4,'m',i0.2,'d',i0.2)" 948 cl_date=date_print( var_to_date(tl_time), cl_fmt ) 949 950 cl_bdyout=boundary_set_filename( TRIM(cn_fileout), & 951 & TRIM(tl_bdy(jl)%c_card), jk, TRIM(cl_date) ) 1030 952 ELSE 1031 IF( ASSOCIATED(tl_time%d_value) )THEN 1032 cl_fmt="('y',i0.4,'m',i0.2,'d',i0.2)" 1033 tl_date=var_to_date(tl_time) 1034 tl_date=tl_date+dn_dayofs 1035 cl_date=date_print( tl_date, cl_fmt ) 1036 1037 cl_bdyout=boundary_set_filename( TRIM(cn_fileout), & 1038 & TRIM(tl_bdy(jl)%c_card), & 1039 & cd_date=TRIM(cl_date) ) 1040 ELSE 1041 cl_bdyout=boundary_set_filename( TRIM(cn_fileout), & 1042 & TRIM(tl_bdy(jl)%c_card) ) 1043 ENDIF 953 cl_bdyout=boundary_set_filename( TRIM(cn_fileout), & 954 & TRIM(tl_bdy(jl)%c_card), jk ) 1044 955 ENDIF 1045 956 ! … … 1049 960 tl_dim(:)=var_max_dim(tl_segvar1(:,jk,jl)) 1050 961 962 CALL dim_unorder(tl_dim(:)) 1051 963 SELECT CASE(TRIM(tl_bdy(jl)%c_card)) 1052 964 CASE DEFAULT ! 'north','south' 1053 965 cl_dimorder='xyzt' 966 CALL dim_reorder(tl_dim(:),TRIM(cl_dimorder)) 1054 967 CASE('east','west') 1055 968 cl_dimorder='yxzt' 969 CALL dim_reorder(tl_dim(:),TRIM(cl_dimorder)) 970 ! reorder coordinates dimension 971 CALL var_reorder(tl_lon1,TRIM(cl_dimorder)) 972 CALL var_reorder(tl_lat1,TRIM(cl_dimorder)) 973 ! reorder other variable dimension 974 DO jvar=1,tl_multi%i_nvar 975 CALL var_reorder(tl_segvar1(jvar,jk,jl),TRIM(cl_dimorder)) 976 ENDDO 1056 977 END SELECT 1057 978 … … 1071 992 ENDIF 1072 993 1073 1074 1075 994 IF( tl_dim(3)%l_use )THEN 1076 IF( ASSOCIATED(tl_depth%d_value) )THEN 1077 ! add depth 1078 CALL file_add_var(tl_fileout, tl_depth) 1079 ENDIF 995 ! add depth 996 CALL file_add_var(tl_fileout, tl_depth) 1080 997 ENDIF 1081 998 1082 999 IF( tl_dim(4)%l_use )THEN 1083 IF( ASSOCIATED(tl_time%d_value) )THEN 1084 ! add time 1085 CALL file_add_var(tl_fileout, tl_time) 1086 ENDIF 1000 ! add time 1001 CALL file_add_var(tl_fileout, tl_time) 1087 1002 ENDIF 1088 1003 1089 1004 ! add other variable 1090 DO jvar= tl_multi%i_nvar,1,-11005 DO jvar=1,tl_multi%i_nvar 1091 1006 CALL file_add_var(tl_fileout, tl_segvar1(jvar,jk,jl)) 1092 1007 CALL var_clean(tl_segvar1(jvar,jk,jl)) … … 1133 1048 1134 1049 ! write file 1135 CALL iom_write_file(tl_fileout , cl_dimorder)1050 CALL iom_write_file(tl_fileout) 1136 1051 1137 1052 ! close file … … 1151 1066 DEALLOCATE( tl_segdom1 ) 1152 1067 DEALLOCATE( tl_segvar1 ) 1153 CALL var_clean(tl_seglvl1(:,:,:))1154 DEALLOCATE( tl_seglvl1 )1155 1156 1068 1157 1069 CALL mpp_clean(tl_coord1) … … 1170 1082 !> 1171 1083 !> @author J.Paul 1172 !> @date November, 2013- Initial Version1084 !> - November, 2013- Initial Version 1173 1085 !> @date September, 2014 1174 1086 !> - take into account grid point to compute boundary indices … … 1274 1186 !------------------------------------------------------------------- 1275 1187 !> @brief 1276 !> This subroutine get coordinates over bou ndary domain1188 !> This subroutine get coordinates over boudnary domain 1277 1189 !> 1278 1190 !> @author J.Paul 1279 !> @date November, 2013 - Initial Version 1280 !> @date September, 2014 1281 !> - take into account grid point 1191 !> - November, 2013- Initial Version 1192 !> @date September, 2014 - take into account grid point 1282 1193 !> 1283 1194 !> @param[in] td_coord1 coordinates file structure … … 1326 1237 !------------------------------------------------------------------- 1327 1238 !> @brief 1328 !> This subroutine interpolate variable o nboundary1239 !> This subroutine interpolate variable over boundary 1329 1240 !> 1330 1241 !> @details 1331 1242 !> 1332 1243 !> @author J.Paul 1333 !> @date November, 2013- Initial Version1244 !> - Nov, 2013- Initial Version 1334 1245 !> 1335 1246 !> @param[inout] td_var variable structure … … 1385 1296 1386 1297 ! extrapolate variable 1387 CALL extrap_fill_value( td_var )1298 CALL extrap_fill_value( td_var, id_iext=il_iext, id_jext=il_jext ) 1388 1299 1389 1300 ! interpolate Bathymetry … … 1392 1303 1393 1304 ! remove extraband 1394 CALL extrap_del_extrabands(td_var, il_iext*id_rho(jp_I), & 1395 & il_jext*id_rho(jp_J)) 1305 CALL extrap_del_extrabands(td_var, il_iext*id_rho(jp_I), il_jext*id_rho(jp_J)) 1396 1306 1397 1307 END SUBROUTINE create_boundary_interp … … 1407 1317 !> 1408 1318 !> @author J.Paul 1409 !> @date November, 2013- Initial Version1319 !> - November, 2013- Initial Version 1410 1320 !> 1411 1321 !> @param[in] td_var variable structure … … 1512 1422 !> 1513 1423 !> @author J.Paul 1514 !> @date November, 2013- Initial Version1424 !> - November, 2013- Initial Version 1515 1425 !> 1516 1426 !> @param[inout] td_var variable structure … … 1565 1475 !> 1566 1476 !> @author J.Paul 1567 !> @date November, 2013- Initial Version1477 !> - November, 2013- Initial Version 1568 1478 !> 1569 1479 !> @param[in] td_level array of level variable structure … … 1627 1537 !> 1628 1538 !> @author J.Paul 1629 !> @date November, 2014- Initial Version1539 !> - November, 2014- Initial Version 1630 1540 !> 1631 1541 !> @param[in] td_mpp mpp structure … … 1678 1588 !> 1679 1589 !> @author J.Paul 1680 !> @date November, 2014- Initial Version1590 !> - November, 2014- Initial Version 1681 1591 !> 1682 1592 !> @param[in] td_mpp mpp structure -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/create_coord.f90
r10248 r10251 24 24 !> @endcode 25 25 !> 26 !> @note27 !> you could find a template of the namelist in templates directory.28 !>29 26 !> create_coord.nam comprise 6 namelists:<br/> 30 27 !> - logger namelist (namlog) … … 42 39 !> - cn_logfile : log filename 43 40 !> - cn_verbosity : verbosity ('trace','debug','info', 44 !> 'warning','error','fatal' ,'none')41 !> 'warning','error','fatal') 45 42 !> - in_maxerror : maximum number of error allowed 46 43 !> … … 57 54 !> - cn_varinfo : list of variable and extra information about request(s) 58 55 !> to be used.<br/> 59 !> each elements of *cn_varinfo* is a string character 60 !> (separated by ',').<br/> 56 !> each elements of *cn_varinfo* is a string character.<br/> 61 57 !> it is composed of the variable name follow by ':', 62 58 !> then request(s) to be used on this variable.<br/> 63 59 !> request could be: 64 !> - int = interpolation method65 !> - ext = extrapolation method66 !> - f lt = filter method60 !> - interpolation method 61 !> - extrapolation method 62 !> - filter method 67 63 !> 68 64 !> requests must be separated by ';' .<br/> … … 72 68 !> @ref extrap and @ref filter modules.<br/> 73 69 !> 74 !> Example: 'votemper: int=linear; flt=hann(2,3); ext=dist_weight',75 !> 'vosaline: int=cubic'<br/>70 !> Example: 'votemper: linear; hann(2,3); dist_weight', 71 !> 'vosaline: cubic'<br/> 76 72 !> @note 77 73 !> If you do not specify a method which is required, … … 94 90 !> 95 91 !> * _output namelist (namout)_: 96 !> - cn_fileout : output coordinate file name92 !> - cn_fileout : output coordinate file 97 93 !> 98 94 !> @author J.Paul … … 156 152 TYPE(TFILE) :: tl_fileout 157 153 154 ! check 155 ! INTEGER(i4) :: il_imin0 156 ! INTEGER(i4) :: il_imax0 157 ! INTEGER(i4) :: il_jmin0 158 ! INTEGER(i4) :: il_jmax0 159 ! INTEGER(i4) , DIMENSION(2,2) :: il_ind2 160 ! TYPE(TMPP) :: tl_mppout 161 158 162 ! loop indices 159 163 INTEGER(i4) :: ji … … 161 165 162 166 ! namelist variable 163 ! namlog164 167 CHARACTER(LEN=lc) :: cn_logfile = 'create_coord.log' 165 168 CHARACTER(LEN=lc) :: cn_verbosity = 'warning' 166 169 INTEGER(i4) :: in_maxerror = 5 167 170 168 ! namcfg169 CHARACTER(LEN=lc) :: cn_varcfg = '../cfg/variable.cfg'170 171 ! namcrs172 171 CHARACTER(LEN=lc) :: cn_coord0 = '' 173 172 INTEGER(i4) :: in_perio0 = -1 174 173 175 ! namvar 174 CHARACTER(LEN=lc) :: cn_varcfg = '../cfg/variable.cfg' 175 176 176 CHARACTER(LEN=lc), DIMENSION(ip_maxvar) :: cn_varinfo = '' 177 177 178 !namnst179 178 INTEGER(i4) :: in_imin0 = 0 180 179 INTEGER(i4) :: in_imax0 = 0 … … 184 183 INTEGER(i4) :: in_rhoj = 1 185 184 186 !namout187 185 CHARACTER(LEN=lc) :: cn_fileout= 'coord_fine.nc' 188 186 !------------------------------------------------------------------- … … 307 305 308 306 il_offset(:,:,:)=create_coord_get_offset(il_rho(:)) 307 309 308 ENDIF 310 309 … … 349 348 CALL dom_del_extra( tl_var(ji), tl_dom, il_rho(:), .true. ) 350 349 350 ! do not add ghost cell. 351 ! ghost cell already replace by value for coordinates 352 ! CALL grid_add_ghost(tl_var(ji),tl_dom%i_ghost(:,:)) 353 351 354 ! filter 352 355 CALL filter_fill_value(tl_var(ji)) … … 372 375 373 376 ! add variables 374 DO ji= il_nvar,1,-1377 DO ji=1,il_nvar 375 378 CALL file_add_var(tl_fileout, tl_var(ji)) 376 CALL var_clean(tl_var(ji))377 379 ENDDO 380 381 ! recompute some attribute 378 382 379 383 ! add some attribute … … 436 440 437 441 CALL file_clean(tl_fileout) 442 443 ! ! check domain 444 ! tl_coord0=mpp_init( file_init(TRIM(cn_coord0)), id_perio=in_perio0) 445 ! tl_mppout=mpp_init( file_init(TRIM(cn_fileout)) ) 446 ! CALL grid_get_info(tl_coord0) 447 ! CALL iom_mpp_open(tl_mppout) 448 ! 449 ! il_ind2(:,:)=grid_get_coarse_index( tl_coord0, tl_mppout, & 450 ! & id_rho=il_rho(:) ) 451 ! 452 ! il_imin0=il_ind2(1,1) ; il_imax0=il_ind2(1,2) 453 ! il_jmin0=il_ind2(2,1) ; il_jmax0=il_ind2(2,2) 454 ! 455 ! IF( il_imin0 /= in_imin0 .OR. & 456 ! & il_imax0 /= in_imax0 .OR. & 457 ! & il_jmin0 /= in_jmin0 .OR. & 458 ! & il_jmax0 /= in_jmax0 )THEN 459 ! CALL logger_debug("CREATE COORD: output indices ("//& 460 ! & TRIM(fct_str(il_imin0))//","//& 461 ! & TRIM(fct_str(il_imax0))//") ("//& 462 ! & TRIM(fct_str(il_jmin0))//","//& 463 ! & TRIM(fct_str(il_jmax0))//")" ) 464 ! CALL logger_debug("CREATE COORD: input indices ("//& 465 ! & TRIM(fct_str(in_imin0))//","//& 466 ! & TRIM(fct_str(in_imax0))//") ("//& 467 ! & TRIM(fct_str(in_jmin0))//","//& 468 ! & TRIM(fct_str(in_jmax0))//")" ) 469 ! CALL logger_fatal("CREATE COORD: output domain not confrom "//& 470 ! & "with input indices") 471 ! ENDIF 472 ! 473 ! CALL iom_mpp_close(tl_coord0) 474 ! CALL iom_mpp_close(tl_mppout) 438 475 439 476 ! close log file … … 502 539 !> @param[in] id_iext number of points to be extrapolated in i-direction 503 540 !> @param[in] id_jext number of points to be extrapolated in j-direction 504 !>505 !> @todo check if mask is really needed506 541 !------------------------------------------------------------------- 507 542 SUBROUTINE create_coord_interp( td_var, & … … 591 626 592 627 ! extrapolate variable 593 CALL extrap_fill_value( td_var )628 CALL extrap_fill_value( td_var, id_iext=il_iext, id_jext=il_jext ) 594 629 595 630 ! interpolate variable -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/create_restart.f90
r10248 r10251 25 25 !> @endcode 26 26 !> 27 !> @note28 !> you could find a template of the namelist in templates directory.29 !>30 27 !> create_restart.nam comprise 9 namelists:<br/> 31 28 !> - logger namelist (namlog) … … 46 43 !> - cn_logfile : log filename 47 44 !> - cn_verbosity : verbosity ('trace','debug','info', 48 !> 'warning','error','fatal' ,'none')45 !> 'warning','error','fatal') 49 46 !> - in_maxerror : maximum number of error allowed 50 47 !> … … 62 59 !> - cn_bathy1 : bathymetry file 63 60 !> - in_perio1 : NEMO periodicity index 61 !> - in_extrap : number of land point to be extrapolated 62 !> before writing file 64 63 !> 65 64 !> * _vertical grid namelist (namzgr)_:<br/> … … 84 83 !> - cn_varinfo : list of variable and extra information about request(s) 85 84 !> to be used.<br/> 86 !> each elements of *cn_varinfo* is a string character 87 !> (separated by ',').<br/> 85 !> each elements of *cn_varinfo* is a string character.<br/> 88 86 !> it is composed of the variable name follow by ':', 89 87 !> then request(s) to be used on this variable.<br/> 90 88 !> request could be: 91 !> - int = interpolation method 92 !> - ext = extrapolation method 93 !> - flt = filter method 94 !> - min = minimum value 95 !> - max = maximum value 96 !> - unt = new units 97 !> - unf = unit scale factor (linked to new units) 89 !> - interpolation method 90 !> - extrapolation method 91 !> - filter method 92 !> - > minimum value 93 !> - < maximum value 98 94 !> 99 95 !> requests must be separated by ';'.<br/> … … 102 98 !> informations about available method could be find in @ref interp, 103 99 !> @ref extrap and @ref filter.<br/> 104 !> Example: 'votemper: int=linear; flt=hann; ext=dist_weight','vosaline: int=cubic'100 !> Example: 'votemper: linear; hann; dist_weight','vosaline: cubic' 105 101 !> @note 106 102 !> If you do not specify a method which is required, … … 140 136 !> * _output namelist (namout)_:<br/> 141 137 !> - cn_fileout : output file 142 !> - ln_extrap : extrapolate land point or not138 !> - in_nproc : total number of processor to be used 143 139 !> - in_niproc : i-direction number of processor 144 140 !> - in_njproc : j-direction numebr of processor 145 !> - in_nproc : total number of processor to be used146 141 !> - cn_type : output format ('dimg', 'cdf') 147 142 !> … … 153 148 !> - offset computed considering grid point 154 149 !> - add attributes in output variable 155 !> @date June, 2015156 !> - extrapolate all land points, and add ln_extrap in namelist.157 !> - allow to change unit.158 150 !> 159 151 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 173 165 USE iom ! I/O manager 174 166 USE grid ! grid manager 175 USE vgrid 167 USE vgrid ! vertical grid manager 176 168 USE extrap ! extrapolation manager 177 169 USE interp ! interpolation manager … … 257 249 CHARACTER(LEN=lc) :: cn_bathy1 = '' 258 250 INTEGER(i4) :: in_perio1 = -1 251 INTEGER(i4) :: in_extrap = 0 259 252 260 253 !namzgr … … 286 279 ! namout 287 280 CHARACTER(LEN=lc) :: cn_fileout = 'restart.nc' 288 LOGICAL :: ln_extrap = .FALSE.289 281 INTEGER(i4) :: in_nproc = 0 290 282 INTEGER(i4) :: in_niproc = 0 … … 309 301 & cn_coord1, & !< coordinate file 310 302 & cn_bathy1, & !< bathymetry file 311 & in_perio1 !< periodicity index 303 & in_perio1, & !< periodicity index 304 & in_extrap 312 305 313 306 NAMELIST /namzgr/ & … … 339 332 NAMELIST /namout/ & !< output namlist 340 333 & cn_fileout, & !< fine grid bathymetry file 341 & ln_extrap, & !< extrapolate or not334 & in_nproc, & !< number of processor to be used 342 335 & in_niproc, & !< i-direction number of processor 343 336 & in_njproc, & !< j-direction numebr of processor 344 & in_nproc, & !< number of processor to be used345 337 & cn_type !< output type format (dimg, cdf) 346 338 !------------------------------------------------------------------- … … 355 347 CALL GET_COMMAND_ARGUMENT(1,cl_namelist) !f03 intrinsec 356 348 ENDIF 357 349 358 350 ! read namelist 359 351 INQUIRE(FILE=TRIM(cl_namelist), EXIST=ll_exist) … … 442 434 ! check 443 435 ! check output file do not already exist 444 IF( in_nproc > 0 )THEN 445 cl_fileout=file_rename(cn_fileout,1) 446 ELSE 447 cl_fileout=file_rename(cn_fileout) 448 ENDIF 436 cl_fileout=file_rename(cn_fileout,1) 449 437 INQUIRE(FILE=TRIM(cl_fileout), EXIST=ll_exist) 450 438 IF( ll_exist )THEN … … 480 468 & il_rho(:) ) 481 469 482 ! fine grid ghost cell 470 ! compute level 471 ALLOCATE(tl_level(ip_npoint)) 472 tl_level(:)=vgrid_get_level(tl_bathy1, cl_namelist ) 473 474 ! remove ghost cell 483 475 il_xghost(:,:)=grid_get_ghost(tl_bathy1) 476 DO ji=1,ip_npoint 477 CALL grid_del_ghost(tl_level(ji), il_xghost(:,:)) 478 ENDDO 479 480 ! clean 481 CALL mpp_clean(tl_bathy1) 484 482 485 483 ! work on variables … … 516 514 tl_var(jvar) = create_restart_matrix( & 517 515 & tl_multi%t_mpp(ji)%t_proc(1)%t_var(jj), tl_coord1, & 518 & in_nlevel, il_xghost(:,:) ) 519 520 ! add ghost cell 521 CALL grid_add_ghost(tl_var(jvar), il_xghost(:,:)) 516 & in_nlevel, tl_level(:) ) 522 517 523 518 ENDDO … … 540 535 ! open mpp file 541 536 CALL iom_mpp_open(tl_mpp) 542 543 537 544 538 ! get or check depth value … … 585 579 DO jj=1,tl_multi%t_mpp(ji)%t_proc(1)%i_nvar 586 580 587 WRITE(*,'(2x,a,a)') "work on (extract)variable "//&581 WRITE(*,'(2x,a,a)') "work on variable "//& 588 582 & TRIM(tl_multi%t_mpp(ji)%t_proc(1)%t_var(jj)%c_name) 589 583 … … 606 600 CALL att_clean(tl_att) 607 601 602 ! use mask 603 CALL create_restart_mask(tl_var(jvar), tl_level(:)) 604 608 605 ! add ghost cell 609 CALL grid_add_ghost( tl_var(jvar), tl_dom1%i_ghost(:,:))606 CALL grid_add_ghost( tl_var(jvar), tl_dom1%i_ghost(:,:) ) 610 607 611 608 ENDDO … … 634 631 DO jj=1,tl_multi%t_mpp(ji)%t_proc(1)%i_nvar 635 632 636 WRITE(*,'(2x,a,a)') "work on (interp)variable "//&633 WRITE(*,'(2x,a,a)') "work on variable "//& 637 634 & TRIM(tl_multi%t_mpp(ji)%t_proc(1)%t_var(jj)%c_name) 638 635 … … 649 646 & id_rho=il_rho(:), & 650 647 & cd_point=TRIM(tl_var(jvar)%c_point)) 648 651 649 652 650 ! interpolate variable 653 CALL create_restart_interp(tl_var(jvar), &651 CALL create_restart_interp(tl_var(jvar), tl_level(:), & 654 652 & il_rho(:), & 655 653 & id_offset=il_offset(:,:)) … … 677 675 CALL att_clean(tl_att) 678 676 677 ! use mask 678 CALL create_restart_mask(tl_var(jvar), tl_level(:)) 679 679 680 ! add ghost cell 680 CALL grid_add_ghost(tl_var(jvar), il_xghost(:,:)) 681 CALL grid_add_ghost( tl_var(jvar), il_xghost(:,:) ) 682 683 681 684 ENDDO 682 685 … … 702 705 CALL mpp_clean(tl_coord0) 703 706 704 IF( .NOT. ln_extrap )THEN705 ! compute level706 ALLOCATE(tl_level(ip_npoint))707 tl_level(:)=vgrid_get_level(tl_bathy1, cl_namelist )708 ENDIF709 710 ! clean711 CALL mpp_clean(tl_bathy1)712 713 707 ! use additional request 714 708 DO jvar=1,il_nvar 715 709 716 ! change unit and apply factor717 CALL var_chg_unit(tl_var(jvar))718 719 710 ! forced min and max value 720 711 CALL var_limit_value(tl_var(jvar)) … … 723 714 CALL filter_fill_value(tl_var(jvar)) 724 715 725 IF( .NOT. ln_extrap )THEN726 ! use mask727 CALL create_restart_mask(tl_var(jvar), tl_level(:))728 ENDIF716 ! extrapolate 717 CALL extrap_fill_value(tl_var(jvar), id_iext=in_extrap, & 718 & id_jext=in_extrap, & 719 & id_kext=in_extrap) 729 720 730 721 ENDDO … … 733 724 IF( in_niproc == 0 .AND. & 734 725 & in_njproc == 0 .AND. & 735 & in_nproc == 0 )THEN726 & in_nproc == 0 )THEN 736 727 in_niproc = 1 737 728 in_njproc = 1 … … 791 782 CALL mpp_add_var(tl_mppout, tl_depth) 792 783 ELSE 793 CALL logger_ warn("CREATE RESTART: no value for depth variable.")784 CALL logger_error("CREATE RESTART: no value for depth variable.") 794 785 ENDIF 795 786 ENDIF … … 801 792 CALL mpp_add_var(tl_mppout, tl_time) 802 793 ELSE 803 CALL logger_ warn("CREATE RESTART: no value for time variable.")794 CALL logger_error("CREATE RESTART: no value for time variable.") 804 795 ENDIF 805 796 ENDIF … … 807 798 808 799 ! add other variable 809 DO jvar= il_nvar,1,-1800 DO jvar=1,il_nvar 810 801 ! check if variable already add 811 802 il_index=var_get_index(tl_mppout%t_proc(1)%t_var(:), tl_var(jvar)%c_name) … … 816 807 ENDDO 817 808 809 ! DO ji=1,4 810 ! CALL grid_add_ghost( tl_level(ji), il_xghost(:,:) ) 811 ! CALL var_clean(tl_level(ji)) 812 ! ENDDO 813 818 814 ! add some attribute 819 815 tl_att=att_init("Created_by","SIREN create_restart") … … 843 839 ENDIF 844 840 845 ! print846 CALL mpp_print(tl_mppout)847 848 841 ! create file 849 842 CALL iom_mpp_create(tl_mppout) … … 854 847 CALL iom_mpp_close(tl_mppout) 855 848 849 ! print 850 CALL mpp_print(tl_mppout) 851 856 852 ! clean 857 853 CALL att_clean(tl_att) 858 854 CALL var_clean(tl_var(:)) 859 855 DEALLOCATE(tl_var) 860 IF( .NOT. ln_extrap )THEN 861 CALL var_clean(tl_level(:)) 862 DEALLOCATE(tl_level) 863 ENDIF 856 CALL var_clean(tl_level(:)) 857 DEALLOCATE(tl_level) 864 858 865 859 CALL mpp_clean(tl_mppout) … … 882 876 !> 883 877 !> @author J.Paul 884 !> @date November, 2013 - Initial Version 885 !> @date June, 2015 886 !> - do not use level anymore 878 !> - November, 2013- Initial Version 887 879 !> 888 880 !> @param[in] td_var variable structure 889 881 !> @param[in] td_coord coordinate file structure 890 882 !> @param[in] id_nlevel number of vertical level 891 !> @param[in] id_xghost ghost cell array883 !> @param[in] td_level array of level on T,U,V,F point (variable structure) 892 884 !> @return variable structure 893 885 !------------------------------------------------------------------- 894 FUNCTION create_restart_matrix(td_var, td_coord, id_nlevel, id_xghost)886 FUNCTION create_restart_matrix(td_var, td_coord, id_nlevel, td_level) 895 887 IMPLICIT NONE 896 888 ! Argument 897 TYPE(TVAR) 898 TYPE(TMPP) 899 INTEGER(i4) 900 INTEGER(i4), DIMENSION(:,:), INTENT(IN) :: id_xghost889 TYPE(TVAR) , INTENT(IN) :: td_var 890 TYPE(TMPP) , INTENT(IN) :: td_coord 891 INTEGER(i4) , INTENT(IN) :: id_nlevel 892 TYPE(TVAR), DIMENSION(:), INTENT(IN) :: td_level 901 893 902 894 ! function … … 907 899 INTEGER(i4) , DIMENSION(3) :: il_size 908 900 INTEGER(i4) , DIMENSION(3) :: il_rest 901 INTEGER(i4) , DIMENSION(2,2) :: il_xghost 909 902 910 903 INTEGER(i4) , DIMENSION(:) , ALLOCATABLE :: il_ishape … … 922 915 !---------------------------------------------------------------- 923 916 917 ! look for ghost cell 918 il_xghost(:,:)=grid_get_ghost( td_coord ) 919 924 920 ! write value on grid 925 921 ! get matrix dimension … … 933 929 934 930 ! remove ghost cell 935 tl_dim(jp_I)%i_len=tl_dim(jp_I)%i_len - SUM(i d_xghost(jp_I,:))*ip_ghost936 tl_dim(jp_J)%i_len=tl_dim(jp_J)%i_len - SUM(i d_xghost(jp_J,:))*ip_ghost931 tl_dim(jp_I)%i_len=tl_dim(jp_I)%i_len - SUM(il_xghost(jp_I,:))*ip_ghost 932 tl_dim(jp_J)%i_len=tl_dim(jp_J)%i_len - SUM(il_xghost(jp_J,:))*ip_ghost 937 933 938 934 ! split output domain in N subdomain depending of matrix dimension … … 996 992 DEALLOCATE(dl_value) 997 993 994 ! use mask 995 CALL create_restart_mask(create_restart_matrix, td_level(:)) 996 997 ! add ghost cell 998 CALL grid_add_ghost( create_restart_matrix, il_xghost(:,:) ) 999 998 1000 ! clean 999 1001 DEALLOCATE(il_ishape) … … 1007 1009 !> 1008 1010 !> @author J.Paul 1009 !> @date November, 2013- Initial Version1011 !> - November, 2013- Initial Version 1010 1012 !> 1011 1013 !> @param[inout] td_var variable structure … … 1069 1071 !> 1070 1072 !> @author J.Paul 1071 !> @date November, 2013 - Initial Version 1072 !> @date June, 2015 1073 !> - do not use level anymore (for extrapolation) 1073 !> - Nov, 2013- Initial Version 1074 1074 !> 1075 1075 !> @param[inout] td_var variable structure 1076 !> @param[inout] td_level fine grid level, array of variable structure 1076 1077 !> @param[in] id_rho array of refinment factor 1077 1078 !> @param[in] id_offset array of offset between fine and coarse grid … … 1079 1080 !> @param[in] id_jext j-direction size of extra bands (default=im_minext) 1080 1081 !------------------------------------------------------------------- 1081 SUBROUTINE create_restart_interp( td_var, &1082 SUBROUTINE create_restart_interp( td_var, td_level,& 1082 1083 & id_rho, & 1083 1084 & id_offset, & … … 1088 1089 ! Argument 1089 1090 TYPE(TVAR) , INTENT(INOUT) :: td_var 1091 TYPE(TVAR) , DIMENSION(:) , INTENT(INOUT) :: td_level 1090 1092 INTEGER(i4), DIMENSION(:) , INTENT(IN ) :: id_rho 1091 1093 INTEGER(i4), DIMENSION(:,:), INTENT(IN ) :: id_offset … … 1117 1119 il_jext=2 1118 1120 ENDIF 1121 1119 1122 ! work on variable 1120 1123 ! add extraband … … 1122 1125 1123 1126 ! extrapolate variable 1124 CALL extrap_fill_value( td_var ) 1127 CALL extrap_fill_value( td_var, td_level(:), & 1128 & id_offset(:,:), & 1129 & id_rho(:), & 1130 & id_iext=il_iext, id_jext=il_jext ) 1125 1131 1126 1132 ! interpolate variable … … 1140 1146 !> 1141 1147 !> @author J.Paul 1142 !> @date November, 2014- Initial Version1148 !> - November, 2014- Initial Version 1143 1149 !> 1144 1150 !> @param[in] td_mpp mpp structure … … 1191 1197 !> 1192 1198 !> @author J.Paul 1193 !> @date November, 2014- Initial Version1199 !> - November, 2014- Initial Version 1194 1200 !> 1195 1201 !> @param[in] td_mpp mpp structure … … 1214 1220 1215 1221 ! get or check depth value 1216 1217 1222 IF( td_mpp%t_proc(1)%i_timeid /= 0 )THEN 1218 1223 -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/dimension.f90
r10248 r10251 78 78 !> 79 79 !> This subroutine filled dimension structure with unused dimension, 80 !> then switch from " disordered" dimension to "ordered" dimension.<br/>80 !> then switch from "unordered" dimension to "ordered" dimension.<br/> 81 81 !> The dimension structure return will be:<br/> 82 82 !> tl_dim(1) => 'X', i_len=10, l_use=T, l_uld=F<br/> … … 94 94 !> - cl_neworder : character(len=4) (example: 'yxzt') 95 95 !> 96 !> to switch dimension array from ordered dimension to disordered96 !> to switch dimension array from ordered dimension to unordered 97 97 !> dimension:<br/> 98 98 !> @code 99 !> CALL dim_ disorder(tl_dim(:))99 !> CALL dim_unorder(tl_dim(:)) 100 100 !> @endcode 101 101 !> … … 111 111 !> CALL dim_reshape_2xyzt(tl_dim(:), value(:,:,:,:)) 112 112 !> @endcode 113 !> - value must be a 4D array of real(8) value " disordered"114 !> 115 !> to reshape array of value in " disordered" dimension:<br/>113 !> - value must be a 4D array of real(8) value "unordered" 114 !> 115 !> to reshape array of value in "unordered" dimension:<br/> 116 116 !> @code 117 117 !> CALL dim_reshape_xyzt2(tl_dim(:), value(:,:,:,:)) … … 123 123 !> CALL dim_reorder_2xyzt(tl_dim(:), tab(:)) 124 124 !> @endcode 125 !> - tab must be a 1D array with 4 elements " disordered".125 !> - tab must be a 1D array with 4 elements "unordered". 126 126 !> It could be composed of character, integer(4), or logical 127 127 !> 128 !> to reorder a 1D array of 4 elements in " disordered" dimension:<br/>129 !> @code 130 !> CALL dim_reorder_ xyzt2(tl_dim(:), tab(:))128 !> to reorder a 1D array of 4 elements in "unordered" dimension:<br/> 129 !> @code 130 !> CALL dim_reorder_2xyzt(tl_dim(:), tab(:)) 131 131 !> @endcode 132 132 !> - tab must be a 1D array with 4 elements "ordered". … … 173 173 PUBLIC :: dim_print !< print dimension information 174 174 PUBLIC :: dim_copy !< copy dimension structure 175 PUBLIC :: dim_reorder !< filled dimension structure to switch from disordered to ordered dimension176 PUBLIC :: dim_ disorder !< switch dimension array from ordered to disordered dimension175 PUBLIC :: dim_reorder !< filled dimension structure to switch from unordered to ordered dimension 176 PUBLIC :: dim_unorder !< switch dimension array from ordered to unordered dimension 177 177 PUBLIC :: dim_fill_unused !< filled dimension structure with unused dimension 178 178 PUBLIC :: dim_reshape_2xyzt !< reshape array dimension to ('x','y','z','t') … … 321 321 !> @author J.Paul 322 322 !> @date November, 2013 - Initial Version 323 !> @date September, 2014 324 !> - do not check if dimension used 323 !> @date September, 2014 - do not check if dimension used 325 324 !> 326 325 !> @param[in] td_dim array of dimension structure … … 503 502 !> Optionally length could be inform, as well as short name and if dimension 504 503 !> is unlimited or not.<br/> 505 !> By default, define dimension is supposed to be used. 506 !> Optionally you could force a defined dimension to be unused. 507 !> 508 !> @author J.Paul 509 !> @date November, 2013 - Initial Version 510 !> @date February, 2015 511 !> - add optional argument to define dimension unused 512 !> @date July, 2015 513 !> - Bug fix: inform order to disorder table instead of disorder to order 514 !> table 504 !> define dimension is supposed to be used. 505 !> 506 !> @author J.Paul 507 !> @date November, 2013 - Initial Version 515 508 ! 516 509 !> @param[in] cd_name dimension name … … 518 511 !> @param[in] ld_uld dimension unlimited 519 512 !> @param[in] cd_sname dimension short name 520 !> @param[in] ld_uld dimension use or not521 513 !> @return dimension structure 522 514 !------------------------------------------------------------------- 523 TYPE(TDIM) FUNCTION dim_init( cd_name, id_len, ld_uld, cd_sname , ld_use)515 TYPE(TDIM) FUNCTION dim_init( cd_name, id_len, ld_uld, cd_sname) 524 516 IMPLICIT NONE 525 517 … … 529 521 LOGICAL, INTENT(IN), OPTIONAL :: ld_uld 530 522 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_sname 531 LOGICAL, INTENT(IN), OPTIONAL :: ld_use532 523 533 524 ! local variable … … 552 543 553 544 ! define dimension is supposed to be used 554 IF( PRESENT(ld_use) )THEN 555 dim_init%l_use=ld_use 556 ELSE 557 dim_init%l_use=.TRUE. 558 ENDIF 545 dim_init%l_use=.TRUE. 559 546 560 547 IF( PRESENT(cd_sname) )THEN … … 603 590 ENDIF 604 591 605 ! get dimension order indices606 dim_init%i_ xyzt2=SCAN(TRIM(cp_dimorder),TRIM(dim_init%c_sname))592 ! get dimension orderer index 593 dim_init%i_2xyzt=SCAN(TRIM(cp_dimorder),TRIM(dim_init%c_sname)) 607 594 608 595 END FUNCTION dim_init … … 668 655 !> @author J.Paul 669 656 !> @date November, 2013 - Initial Version 670 !> @date July, 2015671 !> - Bug fix: use order to disorder table (see dim_init)672 657 !> 673 658 !> @param[in] td_dim array of dimension structure … … 701 686 ! search missing dimension 702 687 IF( INDEX(cl_dimin,TRIM(fct_lower(cp_dimorder(ji:ji)))) == 0 )THEN 703 ! search first empty dimension (see dim_init)704 il_ind(:)=MINLOC( tl_dim(:)%i_ xyzt2, tl_dim(:)%i_xyzt2== 0 )688 ! search first empty dimension 689 il_ind(:)=MINLOC( tl_dim(:)%i_2xyzt, tl_dim(:)%i_2xyzt == 0 ) 705 690 706 691 ! put missing dimension instead of empty one … … 708 693 ! update output structure 709 694 tl_dim(il_ind(1))%c_name=fct_lower(cp_dimorder(ji:ji)) 710 tl_dim(il_ind(1))%i_ xyzt2=ji695 tl_dim(il_ind(1))%i_2xyzt=ji 711 696 tl_dim(il_ind(1))%i_len=1 712 697 tl_dim(il_ind(1))%l_use=.FALSE. … … 726 711 !> This subroutine switch element of an array (4 elts) of dimension 727 712 !> structure 728 !> from disordered dimension to ordered dimension <br/>713 !> from unordered dimension to ordered dimension <br/> 729 714 !> 730 715 !> @details … … 737 722 !> @author J.Paul 738 723 !> @date November, 2013 - Initial Version 739 !> @date September, 2014 740 !> - allow to choose ordered dimension to be output 724 !> @date September, 2014 - allow to choose ordered dimension to be output 741 725 !> 742 726 !> @param[inout] td_dim array of dimension structure … … 827 811 !------------------------------------------------------------------- 828 812 !> @brief This subroutine switch dimension array from ordered dimension ('x','y','z','t') 829 !> to disordered dimension. <br/>813 !> to unordered dimension. <br/> 830 814 !> @details 831 815 !> Example: (/'x','y','z','t'/) => (/'z','x','t','y'/)<br/> … … 838 822 !> @param[inout] td_dim array of dimension structure 839 823 !------------------------------------------------------------------- 840 SUBROUTINE dim_ disorder(td_dim)824 SUBROUTINE dim_unorder(td_dim) 841 825 IMPLICIT NONE 842 826 ! Argument … … 851 835 852 836 IF( SIZE(td_dim(:)) /= ip_maxdim )THEN 853 CALL logger_error("DIM DISORDER: invalid dimension of array dimension.")837 CALL logger_error("DIM UNORDER: invalid dimension of array dimension.") 854 838 ELSE 855 839 ! add dummy xyzt2 id to unused dimension … … 884 868 ENDIF 885 869 886 END SUBROUTINE dim_ disorder870 END SUBROUTINE dim_unorder 887 871 !------------------------------------------------------------------- 888 872 !> @brief This function reshape real(8) 4D array … … 924 908 925 909 IF( SIZE(td_dim(:)) /= ip_maxdim )THEN 926 CALL logger_error("DIM RESHAPE 2 XYZT: invalid dimension of "//& 927 & "array dimension.") 910 CALL logger_error("DIM RESHAPE 2 XYZT: invalid dimension of array dimension.") 928 911 ELSE 929 912 … … 931 914 932 915 CALL logger_fatal( & 933 & " DIM RESHAPE 2 XYZT: you should have run dim_reorder "//&934 & "before running RESHAPE" )916 & " DIM RESHAPE 2 XYZT: you should have run dim_reorder & 917 & before running RESHAPE" ) 935 918 936 919 ENDIF … … 989 972 !------------------------------------------------------------------- 990 973 !> @brief This function reshape ordered real(8) 4D array with dimension 991 !> (/'x','y','z','t'/) to an " disordered" array.<br/>974 !> (/'x','y','z','t'/) to an "unordered" array.<br/> 992 975 !> @details 993 976 !> Example: (/'x','y','z','t'/) => (/'z','x','t','y'/) … … 1026 1009 1027 1010 IF( SIZE(td_dim(:)) /= ip_maxdim )THEN 1028 CALL logger_error("DIM RESHAPE XYZT 2: invalid dimension of "//& 1029 & "array dimension.") 1011 CALL logger_error("DIM RESHAPE XYZT 2: invalid dimension of array dimension.") 1030 1012 ELSE 1031 1013 … … 1033 1015 1034 1016 CALL logger_fatal( & 1035 & " DIM RESHAPE XYZT 2: you should have run dim_reorder "//&1036 & "before running RESHAPE" )1017 & " DIM RESHAPE XYZT 2: you should have run dim_reorder & 1018 & before running RESHAPE" ) 1037 1019 1038 1020 ENDIF … … 1122 1104 1123 1105 CALL logger_error( & 1124 & " DIM REORDER 2 XYZT: you should have run dim_reorder "//&1125 & "before running REORDER" )1106 & " DIM REORDER 2 XYZT: you should have run dim_reorder & 1107 & before running REORDER" ) 1126 1108 1127 1109 ENDIF … … 1134 1116 END FUNCTION dim__reorder_2xyzt_i4 1135 1117 !------------------------------------------------------------------- 1136 !> @brief This function disordered integer(4) 1D array to be suitable with1118 !> @brief This function unordered integer(4) 1D array to be suitable with 1137 1119 !> initial dimension order (ex: dimension read in file). 1138 1120 !> @note you must have run dim_reorder before use this subroutine … … 1161 1143 IF( SIZE(td_dim(:)) /= ip_maxdim .OR. & 1162 1144 & SIZE(id_arr(:)) /= ip_maxdim )THEN 1163 CALL logger_error("DIM REORDER XYZT 2: invalid dimension of "//&1164 & "array dimensionor of array of value.")1145 CALL logger_error("DIM REORDER XYZT 2: invalid dimension of array dimension"//& 1146 & " or of array of value.") 1165 1147 ELSE 1166 1148 IF( ANY(td_dim(:)%i_xyzt2==0) )THEN 1167 1149 1168 1150 CALL logger_error( & 1169 & " DIM REORDER XYZT 2: you should have run dim_reorder "//&1170 & "before running REORDER" )1151 & " DIM REORDER XYZT 2: you should have run dim_reorder & 1152 & before running REORDER" ) 1171 1153 1172 1154 ENDIF … … 1184 1166 ! 1185 1167 !> @author J.Paul 1186 !> @date Nov ember, 2013 - Initial Version1168 !> @date Nov, 2013 - Initial Version 1187 1169 ! 1188 1170 !> @param[in] td_dim array of dimension structure … … 1211 1193 1212 1194 CALL logger_error( & 1213 & " DIM REORDER 2 XYZT: you should have run dim_reorder "//&1214 & "before running REORDER" )1195 & " DIM REORDER 2 XYZT: you should have run dim_reorder & 1196 & before running REORDER" ) 1215 1197 1216 1198 ENDIF … … 1223 1205 END FUNCTION dim__reorder_2xyzt_l 1224 1206 !------------------------------------------------------------------- 1225 !> @brief This function disordered logical 1D array to be suitable with1207 !> @brief This function unordered logical 1D array to be suitable with 1226 1208 !> initial dimension order (ex: dimension read in file). 1227 1209 !> @note you must have run dim_reorder before use this subroutine … … 1256 1238 1257 1239 CALL logger_error( & 1258 & " DIM REORDER XYZT 2: you should have run dim_reorder "//&1259 & "before running REORDER" )1240 & " DIM REORDER XYZT 2: you should have run dim_reorder & 1241 & before running REORDER" ) 1260 1242 1261 1243 ENDIF … … 1312 1294 END FUNCTION dim__reorder_2xyzt_c 1313 1295 !------------------------------------------------------------------- 1314 !> @brief This function disordered string 1D array to be suitable with1296 !> @brief This function unordered string 1D array to be suitable with 1315 1297 !> initial dimension order (ex: dimension read in file). 1316 1298 !> @note you must have run dim_reorder before use this subroutine 1317 1299 ! 1318 1300 !> @author J.Paul 1319 !> @date Nov ember, 2013 - Initial Version1301 !> @date Nov, 2013 - Initial Version 1320 1302 ! 1321 1303 !> @param[in] td_dim array of dimension structure … … 1344 1326 IF( ANY(td_dim(:)%i_xyzt2==0) )THEN 1345 1327 CALL logger_error( & 1346 & " DIM REORDER XYZT 2: you should have run dim_reorder "//&1347 & "before running REORDER" )1328 & " DIM REORDER XYZT 2: you should have run dim_reorder & 1329 & before running REORDER" ) 1348 1330 1349 1331 ENDIF -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/docsrc/1_install.md
r10248 r10251 13 13 # Fortran Compiler 14 14 SIREN codes were succesfully tested with : 15 - ifort (version 1 5.0.1)16 - gfortran (version 4. 8.2 20140120)15 - ifort (version 12.0.4) 16 - gfortran (version 4.7.2 20121109) 17 17 <!-- - pgf95 (version 13.9-0) --> 18 18 -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/docsrc/3_codingRules.md
r10248 r10251 80 80 81 81 # Implicit none {#implicit} 82 All subroutines and functions will include an IMPLIC ITNONE statement.82 All subroutines and functions will include an IMPLICTI NONE statement. 83 83 84 84 # Header {#header} -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/domain.f90
r10248 r10251 246 246 ! 247 247 !> @author J.Paul 248 !> @date November, 2013- Initial Version248 !> - Nov, 2013- Initial Version 249 249 ! 250 250 !> @param[inout] td_dom dom structure … … 294 294 ! 295 295 !> @author J.Paul 296 !> @date June, 2013- Initial Version296 !> - June, 2013- Initial Version 297 297 !> @date September, 2014 298 298 !> - add boundary index … … 362 362 363 363 IF( td_mpp%i_perio < 0 .OR. td_mpp%i_perio > 6 )THEN 364 CALL logger_error("DOM INIT: invalid grid periodicity ("//& 365 & TRIM(fct_str(td_mpp%i_perio))//& 366 & ") you should use grid_get_perio to compute it") 364 CALL logger_error("DOM INIT: invalid grid periodicity. "//& 365 & "you should use grid_get_perio to compute it") 367 366 ELSE 368 367 dom__init_mpp%i_perio0=td_mpp%i_perio … … 425 424 ! 426 425 !> @author J.Paul 427 !> @date June, 2013- Initial Version426 !> - June, 2013- Initial Version 428 427 !> @date September, 2014 429 428 !> - add boundary index … … 490 489 491 490 IF( td_file%i_perio < 0 .OR. td_file%i_perio > 6 )THEN 492 CALL logger_error("DOM INIT: invalid grid periodicity ("//& 493 & TRIM(fct_str(td_file%i_perio))//& 494 & ") you should use grid_get_perio to compute it") 491 CALL logger_error("DOM INIT: invalid grid periodicity. "//& 492 & "you should use grid_get_perio to compute it") 495 493 ELSE 496 494 dom__init_file%i_perio0=td_file%i_perio … … 550 548 !> 551 549 !> @author J.Paul 552 !> @date November, 2013 - Initial version550 !> - November, 2013- Subroutine written 553 551 ! 554 552 !> @param[inout] td_dom domain structure … … 655 653 !> 656 654 !> @author J.Paul 657 !> @date November, 2013 - Initial version655 !> - November, 2013- Subroutine written 658 656 !> @date September, 2014 659 657 !> - use zero indice to defined cyclic or global domain … … 723 721 !> 724 722 !> @author J.Paul 725 !> @date November, 2013 - Initial verison723 !> - November, 2013- Subroutine written 726 724 ! 727 725 !> @param[inout] td_dom domain strcuture … … 757 755 !> 758 756 !> @author J.Paul 759 !> @date November, 2013 - Initial version757 !> - November, 2013- Subroutine written 760 758 ! 761 759 !> @param[inout] td_dom domain strcuture … … 776 774 !> 777 775 !> @author J.Paul 778 !> @date November, 2013 - Initial version776 !> - November, 2013- Subroutine written 779 777 ! 780 778 !> @param[inout] td_dom domain strcuture … … 808 806 !> 809 807 !> @author J.Paul 810 !> @date November, 2013 - Initial version808 !> - November, 2013- Subroutine written 811 809 ! 812 810 !> @param[inout] td_dom domain strcuture … … 826 824 !> 827 825 !> @author J.Paul 828 !> @date November, 2013 - Initial version826 !> - November, 2013- Subroutine written 829 827 ! 830 828 !> @param[inout] td_dom domain strcuture … … 864 862 !> 865 863 !> @author J.Paul 866 !> @date November, 2013 - Initial version864 !> - November, 2013- Subroutine written 867 865 ! 868 866 !> @param[inout] td_dom domain strcuture … … 914 912 !> 915 913 !> @author J.Paul 916 !> @date November, 2013 - Initial version914 !> - November, 2013- Subroutine written 917 915 ! 918 916 !> @param[inout] td_dom domain strcuture … … 953 951 !> 954 952 !> @author J.Paul 955 !> @date April, 2013 - Initial version953 !> - April, 2013- Subroutine written 956 954 ! 957 955 !> @param[inout] td_dom domain strcuture … … 981 979 !> 982 980 !> @author J.Paul 983 !> @date November, 2013 - Initial version981 !> - November, 2013- Subroutine written 984 982 ! 985 983 !> @param[inout] td_dom domain strcuture … … 1043 1041 !> 1044 1042 !> @author J.Paul 1045 !> @date November, 2013 - Initial version1043 !> - November, 2013- Subroutine written 1046 1044 ! 1047 1045 !> @param[inout] td_dom domain strcuture … … 1084 1082 !> 1085 1083 !> @author J.Paul 1086 !> @date November, 2013 - Initial version1084 !> - November, 2013- Subroutine written 1087 1085 ! 1088 1086 !> @param[inout] td_dom domain strcuture … … 1182 1180 !> 1183 1181 !> @author J.Paul 1184 !> @date November, 2013 - Initial version1182 !> - November, 2013- Subroutine written 1185 1183 ! 1186 1184 !> @param[inout] td_dom domain strcuture … … 1294 1292 !> 1295 1293 !> @author J.Paul 1296 !> @date November, 2013 - Initial version1294 !> @date November, 2013 1297 1295 !> @date September, 2014 1298 1296 !> - take into account number of ghost cell … … 1435 1433 ! 1436 1434 !> @author J.Paul 1437 !> @date November, 2013 - Initial version1435 !> @date November, 2013 1438 1436 ! 1439 1437 !> @param[inout] td_dom domain strcuture … … 1478 1476 !> 1479 1477 !> @author J.Paul 1480 !> @date November, 2013 - Initial version1478 !> @date November, 2013 1481 1479 !> @date September, 2014 1482 1480 !> - take into account boundary for one point size domain … … 1717 1715 ! 1718 1716 !> @author J.Paul 1719 !> @date November, 2013 - Initial version1717 !> @date November, 2013 1720 1718 ! 1721 1719 !> @param[inout] td_dom domain strcuture -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/extrap.f90
r10248 r10251 19 19 !> defining string character _cn\_varinfo_. By default _dist_weight_.<br/> 20 20 !> Example: 21 !> - cn_varinfo='varname1: ext=dist_weight', 'varname2:ext=min_error'21 !> - cn_varinfo='varname1:dist_weight', 'varname2:min_error' 22 22 !> 23 23 !> to detect point to be extrapolated:<br/> 24 24 !> @code 25 !> il_detect(:,:,:)=extrap_detect(td_var )25 !> il_detect(:,:,:)=extrap_detect(td_var, [td_level], [id_offset,] [id_rho,] [id_ext]) 26 26 !> @endcode 27 27 !> - il_detect(:,:,:) is 3D array of point to be extrapolated 28 28 !> - td_var is coarse grid variable to be extrapolated 29 !> - td_level is fine grid array of level (see vgrid_get_level) [optional] 30 !> - id_offset is array of offset between fine and coarse grid [optional] 31 !> - id_rho is array of refinment factor [optional] 32 !> - id_ext is array of number of points to be extrapolated [optional] 29 33 !> 30 34 !> to extrapolate variable:<br/> 31 35 !> @code 32 !> CALL extrap_fill_value( td_var, [ id_radius])36 !> CALL extrap_fill_value( td_var, [td_level], [id_offset], [id_rho], [id_iext], [id_jext], [id_kext], [id_radius], [id_maxiter]) 33 37 !> @endcode 34 38 !> - td_var is coarse grid variable to be extrapolated 39 !> - td_level is fine grid array of level (see vgrid_get_level) [optional] 40 !> - id_offset is array of offset between fine and coarse grid [optional] 41 !> - id_rho is array of refinment factor [optional] 42 !> - id_iext is number of points to be extrapolated in i-direction [optional] 43 !> - id_jext is number of points to be extrapolated in j-direction [optional] 44 !> - id_kext is number of points to be extrapolated in k-direction [optional] 35 45 !> - id_radius is radius of the halo used to compute extrapolation [optional] 46 !> - id_maxiter is maximum number of iteration [optional] 36 47 !> 37 48 !> to add extraband to the variable (to be extrapolated):<br/> … … 51 62 !> - id_jsize : j-direction size of extra bands [optional] 52 63 !> 64 !> to compute first derivative of 1D array:<br/> 65 !> @code 66 !> dl_value(:)=extrap_deriv_1D( dd_value(:), dd_fill, [ld_discont] ) 67 !> @endcode 68 !> - dd_value is 1D array of variable 69 !> - dd_fill is FillValue of variable 70 !> - ld_discont is logical to take into account longitudinal East-West discontinuity [optional] 71 !> 72 !> to compute first derivative of 2D array:<br/> 73 !> @code 74 !> dl_value(:,:)=extrap_deriv_2D( dd_value(:,:), dd_fill, cd_dim, [ld_discont] ) 75 !> @endcode 76 !> - dd_value is 2D array of variable 77 !> - dd_fill is FillValue of variable 78 !> - cd_dim is character to compute derivative on first (I) or second (J) dimension 79 !> - ld_discont is logical to take into account longitudinal East-West discontinuity [optional] 80 !> 81 !> to compute first derivative of 3D array:<br/> 82 !> @code 83 !> dl_value(:,:,:)=extrap_deriv_3D( dd_value(:,:,:), dd_fill, cd_dim, [ld_discont] ) 84 !> @endcode 85 !> - dd_value is 3D array of variable 86 !> - dd_fill is FillValue of variable 87 !> - cd_dim is character to compute derivative on first (I), second (J), or third (K) dimension 88 !> - ld_discont is logical to take into account longitudinal East-West discontinuity [optional] 89 !> 53 90 !> @warning _FillValue must not be zero (use var_chg_FillValue()) 54 91 !> … … 56 93 !> J.Paul 57 94 ! REVISION HISTORY: 58 !> @date Nov ember, 2013 - Initial Version95 !> @date Nov, 2013 - Initial Version 59 96 !> @date September, 2014 60 97 !> - add header 61 !> @date June, 201562 !> - extrapolate all land points (_FillValue)63 !> - move deriv function to math module64 !> @date July, 201565 !> - compute extrapolation from north west to south east,66 !> and from south east to north west67 98 !> 68 99 !> @todo 69 100 !> - create module for each extrapolation method 70 !> - smooth extrapolated points71 101 !> 72 102 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 80 110 USE date ! date manager 81 111 USE logger ! log file manager 82 USE math ! mathematical function83 112 USE att ! attribute manager 84 113 USE dim ! dimension manager … … 89 118 90 119 ! type and variable 120 PRIVATE :: im_maxiter !< default maximum number of iteration 91 121 PRIVATE :: im_minext !< default minumum number of point to extrapolate 92 122 PRIVATE :: im_mincubic !< default minumum number of point to extrapolate for cubic interpolation … … 97 127 PUBLIC :: extrap_add_extrabands !< add extraband to the variable (to be extrapolated) 98 128 PUBLIC :: extrap_del_extrabands !< delete extraband of the variable 129 PUBLIC :: extrap_deriv_1D !< compute first derivative of 1D array 130 PUBLIC :: extrap_deriv_2D !< compute first derivative of 2D array 131 PUBLIC :: extrap_deriv_3D !< compute first derivative of 3D array 99 132 100 133 PRIVATE :: extrap__detect_wrapper ! detected point to be extrapolated wrapper … … 108 141 PRIVATE :: extrap__3D_dist_weight_fill ! 109 142 143 INTEGER(i4), PARAMETER :: im_maxiter = 10 !< default maximum number of iteration 110 144 INTEGER(i4), PARAMETER :: im_minext = 2 !< default minumum number of point to extrapolate 111 145 INTEGER(i4), PARAMETER :: im_mincubic= 4 !< default minumum number of point to extrapolate for cubic interpolation … … 137 171 !> 138 172 !> @author J.Paul 139 !> @date November, 2013 - Initial Version 140 !> @date June, 2015 141 !> - do not use level to select points to be extrapolated 173 !> - November, 2013- Initial Version 142 174 ! 143 175 !> @param[in] td_var0 coarse grid variable to extrapolate 176 !> @param[in] td_level1 fine grid array of level 177 !> @param[in] id_offset array of offset between fine and coarse grid 178 !> @param[in] id_rho array of refinment factor 179 !> @param[in] id_ext array of number of points to be extrapolated 144 180 !> @return array of point to be extrapolated 145 181 !------------------------------------------------------------------- 146 FUNCTION extrap__detect( td_var0 ) 182 FUNCTION extrap__detect( td_var0, td_level1, & 183 & id_offset, id_rho, id_ext ) 147 184 IMPLICIT NONE 148 185 ! Argument 149 186 TYPE(TVAR) , INTENT(IN ) :: td_var0 187 TYPE(TVAR) , DIMENSION(:) , INTENT(IN ), OPTIONAL :: td_level1 188 INTEGER(i4), DIMENSION(:,:), INTENT(IN ), OPTIONAL :: id_offset 189 INTEGER(i4), DIMENSION(:) , INTENT(IN ), OPTIONAL :: id_rho 190 INTEGER(i4), DIMENSION(:) , INTENT(IN ), OPTIONAL :: id_ext 150 191 151 192 ! function … … 155 196 156 197 ! local variable 198 CHARACTER(LEN=lc) :: cl_level 199 200 INTEGER(i4) :: il_ind 201 INTEGER(i4) , DIMENSION(:,:,:), ALLOCATABLE :: il_detect 202 INTEGER(i4) , DIMENSION(:,:,:), ALLOCATABLE :: il_tmp 203 INTEGER(i4) , DIMENSION(:,:) , ALLOCATABLE :: il_offset 204 INTEGER(i4) , DIMENSION(:,:) , ALLOCATABLE :: il_level1 205 INTEGER(i4) , DIMENSION(:,:) , ALLOCATABLE :: il_level1_G0 206 INTEGER(i4) , DIMENSION(:,:) , ALLOCATABLE :: il_extra 207 INTEGER(i4) , DIMENSION(:) , ALLOCATABLE :: il_ext 208 INTEGER(i4) , DIMENSION(:) , ALLOCATABLE :: il_rho 209 INTEGER(i4) , DIMENSION(:) , ALLOCATABLE :: il_dim0 210 211 TYPE(TVAR) :: tl_var1 212 157 213 ! loop indices 158 214 INTEGER(i4) :: ji0 159 215 INTEGER(i4) :: jj0 160 216 INTEGER(i4) :: jk0 217 INTEGER(i4) :: ji1 218 INTEGER(i4) :: jj1 219 INTEGER(i4) :: ji1m 220 INTEGER(i4) :: jj1m 221 INTEGER(i4) :: ji1p 222 INTEGER(i4) :: jj1p 161 223 !---------------------------------------------------------------- 162 224 163 ! force to extrapolated all points 164 extrap__detect(:,:,:)=1 225 ! init 226 extrap__detect(:,:,:)=0 227 228 ALLOCATE( il_dim0(3) ) 229 il_dim0(:)=td_var0%t_dim(1:3)%i_len 230 231 ! optional argument 232 ALLOCATE( il_rho(ip_maxdim) ) 233 il_rho(:)=1 234 IF( PRESENT(id_rho) ) il_rho(1:SIZE(id_rho(:)))=id_rho(:) 235 236 ALLOCATE( il_offset(ip_maxdim,2) ) 237 il_offset(:,:)=0 238 IF( PRESENT(id_offset) )THEN 239 il_offset(1:SIZE(id_offset(:,:),DIM=1),& 240 & 1:SIZE(id_offset(:,:),DIM=2) )= id_offset(:,:) 241 ELSE 242 il_offset(jp_I,:)=FLOOR(REAL(il_rho(jp_I)-1,dp)*0.5) 243 il_offset(jp_J,:)=FLOOR(REAL(il_rho(jp_J)-1,dp)*0.5) 244 ENDIF 245 246 ALLOCATE( il_ext(ip_maxdim) ) 247 il_ext(:)=im_minext 248 IF( PRESENT(id_ext) ) il_ext(1:SIZE(id_ext(:)))=id_ext(:) 249 250 ALLOCATE( il_detect(il_dim0(1),& 251 & il_dim0(2),& 252 & il_dim0(3)) ) 253 il_detect(:,:,:)=0 254 255 ! select point already inform 256 DO jk0=1,td_var0%t_dim(3)%i_len 257 DO jj0=1,td_var0%t_dim(2)%i_len 258 DO ji0=1,td_var0%t_dim(1)%i_len 259 IF( td_var0%d_value(ji0,jj0,jk0,1) /= td_var0%d_fill ) il_detect(ji0,jj0,jk0)=1 260 ENDDO 261 ENDDO 262 ENDDO 263 264 IF( PRESENT(td_level1) )THEN 265 SELECT CASE(TRIM(td_var0%c_point)) 266 CASE DEFAULT !'T' 267 cl_level='tlevel' 268 CASE('U') 269 cl_level='ulevel' 270 CASE('V') 271 cl_level='vlevel' 272 CASE('F') 273 cl_level='flevel' 274 END SELECT 275 276 il_ind=var_get_index(td_level1(:),TRIM(cl_level)) 277 IF( il_ind == 0 )THEN 278 CALL logger_error("EXTRAP DETECT: can not compute point to be "//& 279 & "extrapolated for variable "//TRIM(td_var0%c_name)//& 280 & ". can not find "//& 281 & "level for variable point "//TRIM(TRIM(td_var0%c_point))) 282 ELSE 283 tl_var1=var_copy(td_level1(il_ind)) 284 285 ALLOCATE( il_level1_G0( il_dim0(1), il_dim0(2)) ) 286 IF( ALL(tl_var1%t_dim(1:2)%i_len == il_dim0(1:2)) )THEN 287 288 ! variable to be extrapolated use same resolution than level 289 il_level1_G0(:,:)=INT(tl_var1%d_value(:,:,1,1),i4) 290 291 ELSE 292 ! variable to be extrapolated do not use same resolution than level 293 ALLOCATE( il_level1(tl_var1%t_dim(1)%i_len, & 294 & tl_var1%t_dim(2)%i_len) ) 295 ! match fine grid vertical level with coarse grid 296 il_level1(:,:)=INT(tl_var1%d_value(:,:,1,1),i4)/il_rho(jp_K) 297 298 ALLOCATE( il_extra(ip_maxdim,2) ) 299 ! coarsening fine grid level 300 il_extra(jp_I,1)=CEILING(REAL(il_rho(jp_I)-1,dp)*0.5_dp) 301 il_extra(jp_I,2)=FLOOR(REAL(il_rho(jp_I)-1,dp)*0.5_dp) 302 303 il_extra(jp_J,1)=CEILING(REAL(il_rho(jp_J)-1,dp)*0.5_dp) 304 il_extra(jp_J,2)=FLOOR(REAL(il_rho(jp_J)-1,dp)*0.5_dp) 305 306 DO jj0=1,td_var0%t_dim(2)%i_len 307 308 jj1=(jj0-1)*il_rho(jp_J)+1-il_offset(jp_J,1) 309 310 jj1m=MAX( jj1-il_extra(jp_J,1), 1 ) 311 jj1p=MIN( jj1+il_extra(jp_J,2), & 312 & tl_var1%t_dim(2)%i_len-il_offset(jp_J,2) ) 313 314 DO ji0=1,td_var0%t_dim(1)%i_len 315 316 ji1=(ji0-1)*il_rho(jp_I)+1-id_offset(jp_I,1) 317 318 ji1m=MAX( ji1-il_extra(jp_I,1), 1 ) 319 ji1p=MIN( ji1+il_extra(jp_I,2), & 320 & tl_var1%t_dim(1)%i_len-id_offset(jp_I,2) ) 321 322 il_level1_G0(ji0,jj0)=MAXVAL(il_level1(ji1m:ji1p,jj1m:jj1p)) 323 324 ENDDO 325 ENDDO 326 327 ! clean 328 DEALLOCATE( il_extra ) 329 DEALLOCATE( il_level1 ) 330 331 ENDIF 332 333 ! look for sea point 334 DO jk0=1,td_var0%t_dim(3)%i_len 335 WHERE( il_level1_G0(:,:) >= jk0) 336 il_detect(:,:,jk0)=1 337 END WHERE 338 ENDDO 339 340 ! clean 341 DEALLOCATE( il_level1_G0 ) 342 CALL var_clean(tl_var1) 343 344 ENDIF 345 ENDIF 346 347 ! clean 348 DEALLOCATE( il_offset ) 349 350 ALLOCATE( il_tmp(il_dim0(1),& 351 & il_dim0(2),& 352 & il_dim0(3)) ) 353 il_tmp(:,:,:)=il_detect(:,:,:) 354 ! select extra point depending on interpolation method 355 ! compute point near grid point already inform 356 DO jk0=1,il_dim0(3) 357 DO jj0=1,il_dim0(2) 358 DO ji0=1,il_dim0(1) 359 360 IF( il_tmp(ji0,jj0,jk0) == 1 )THEN 361 il_detect( & 362 & MAX(1,ji0-il_ext(jp_I)):MIN(ji0+il_ext(jp_I),il_dim0(1)),& 363 & MAX(1,jj0-il_ext(jp_J)):MIN(jj0+il_ext(jp_J),il_dim0(2)),& 364 & MAX(1,jk0-il_ext(jp_K)):MIN(jk0+il_ext(jp_K),il_dim0(3)) & 365 & ) = 1 366 ENDIF 367 368 ENDDO 369 ENDDO 370 ENDDO 371 372 ! clean 373 DEALLOCATE( il_tmp ) 165 374 166 375 ! do not compute grid point already inform … … 168 377 DO jj0=1,td_var0%t_dim(2)%i_len 169 378 DO ji0=1,td_var0%t_dim(1)%i_len 170 IF( td_var0%d_value(ji0,jj0,jk0,1) /= td_var0%d_fill )THEN 171 extrap__detect(ji0,jj0,jk0)=0 172 ENDIF 379 IF( td_var0%d_value(ji0,jj0,jk0,1) /= td_var0%d_fill ) il_detect(ji0,jj0,jk0)=0 173 380 ENDDO 174 381 ENDDO 175 382 ENDDO 383 384 ! save result 385 extrap__detect(:,:,:)=il_detect(:,:,:) 386 387 ! clean 388 DEALLOCATE( il_dim0 ) 389 DEALLOCATE( il_ext ) 390 DEALLOCATE( il_detect ) 391 DEALLOCATE( il_rho ) 176 392 177 393 END FUNCTION extrap__detect … … 182 398 !> 183 399 !> @author J.Paul 184 !> @date November, 2013 - Initial Version 185 !> @date June, 2015 186 !> - select all land points for extrapolation 400 !> - November, 2013- Initial Version 187 401 !> 188 402 !> @param[in] td_var coarse grid variable to extrapolate 403 !> @param[in] td_level fine grid array of level 404 !> @param[in] id_offset array of offset between fine and coarse grid 405 !> @param[in] id_rho array of refinment factor 406 !> @param[in] id_ext array of number of points to be extrapolated 189 407 !> @return 3D array of point to be extrapolated 190 408 !------------------------------------------------------------------- 191 FUNCTION extrap__detect_wrapper( td_var ) 409 FUNCTION extrap__detect_wrapper( td_var, td_level, & 410 & id_offset, id_rho, id_ext ) 192 411 193 412 IMPLICIT NONE 194 413 ! Argument 195 414 TYPE(TVAR) , INTENT(IN ) :: td_var 415 TYPE(TVAR) , DIMENSION(:) , INTENT(IN ), OPTIONAL :: td_level 416 INTEGER(i4), DIMENSION(:,:), INTENT(IN ), OPTIONAL :: id_offset 417 INTEGER(i4), DIMENSION(:) , INTENT(IN ), OPTIONAL :: id_rho 418 INTEGER(i4), DIMENSION(:) , INTENT(IN ), OPTIONAL :: id_ext 196 419 197 420 ! function … … 216 439 & " for variable "//TRIM(td_var%c_name) ) 217 440 218 extrap__detect_wrapper(:,:,:)=extrap__detect( td_var ) 441 extrap__detect_wrapper(:,:,:)=extrap__detect( td_var, td_level, & 442 & id_offset, & 443 & id_rho, & 444 & id_ext ) 219 445 220 446 ELSE IF( ALL(td_var%t_dim(1:2)%l_use) )THEN … … 224 450 & " for variable "//TRIM(td_var%c_name) ) 225 451 226 extrap__detect_wrapper(:,:,1:1)=extrap__detect( td_var ) 452 extrap__detect_wrapper(:,:,1:1)=extrap__detect( td_var , td_level,& 453 & id_offset, & 454 & id_rho, & 455 & id_ext ) 227 456 228 457 ELSE IF( td_var%t_dim(3)%l_use )THEN … … 232 461 & " for variable "//TRIM(td_var%c_name) ) 233 462 234 extrap__detect_wrapper(1:1,1:1,:)=extrap__detect( td_var ) 463 extrap__detect_wrapper(1:1,1:1,:)=extrap__detect( td_var , td_level, & 464 & id_offset, & 465 & id_rho, & 466 & id_ext ) 235 467 236 468 ENDIF … … 257 489 !> 258 490 !> @author J.Paul 259 !> @date November, 2013 - Initial Version 260 !> @date June, 2015 261 !> - select all land points for extrapolation 491 !> - Nov, 2013- Initial Version 262 492 ! 263 493 !> @param[inout] td_var variable structure 494 !> @param[in] td_level fine grid array of level 495 !> @param[in] id_offset array of offset between fine and coarse grid 496 !> @param[in] id_rho array of refinment factor 497 !> @param[in] id_iext number of points to be extrapolated in i-direction 498 !> @param[in] id_jext number of points to be extrapolated in j-direction 499 !> @param[in] id_kext number of points to be extrapolated in k-direction 264 500 !> @param[in] id_radius radius of the halo used to compute extrapolation 265 !------------------------------------------------------------------- 266 SUBROUTINE extrap__fill_value_wrapper( td_var, & 267 & id_radius ) 501 !> @param[in] id_maxiter maximum number of iteration 502 !------------------------------------------------------------------- 503 SUBROUTINE extrap__fill_value_wrapper( td_var, td_level, & 504 & id_offset, & 505 & id_rho, & 506 & id_iext, id_jext, id_kext, & 507 & id_radius, id_maxiter ) 268 508 IMPLICIT NONE 269 509 ! Argument 270 510 TYPE(TVAR) , INTENT(INOUT) :: td_var 511 TYPE(TVAR) , DIMENSION(:) , INTENT(IN ), OPTIONAL :: td_level 512 INTEGER(i4), DIMENSION(:,:), INTENT(IN ), OPTIONAL :: id_offset 513 INTEGER(i4), DIMENSION(:) , INTENT(IN ), OPTIONAL :: id_rho 514 INTEGER(i4), INTENT(IN ), OPTIONAL :: id_iext 515 INTEGER(i4), INTENT(IN ), OPTIONAL :: id_jext 516 INTEGER(i4), INTENT(IN ), OPTIONAL :: id_kext 271 517 INTEGER(i4), INTENT(IN ), OPTIONAL :: id_radius 518 INTEGER(i4), INTENT(IN ), OPTIONAL :: id_maxiter 272 519 273 520 ! local variable 521 INTEGER(i4) :: il_iext 522 INTEGER(i4) :: il_jext 523 INTEGER(i4) :: il_kext 274 524 INTEGER(i4) :: il_radius 525 INTEGER(i4) :: il_maxiter 275 526 276 527 CHARACTER(LEN=lc) :: cl_method … … 293 544 END SELECT 294 545 295 ! number of point use to compute box 296 il_radius=1 297 IF( PRESENT(id_radius) ) il_radius=id_radius 298 IF( il_radius < 0 )THEN 546 il_iext=im_minext 547 IF( PRESENT(id_iext) ) il_iext=id_iext 548 il_jext=im_minext 549 IF( PRESENT(id_jext) ) il_jext=id_jext 550 il_kext=0 551 IF( PRESENT(id_kext) ) il_kext=id_kext 552 553 IF( TRIM(td_var%c_interp(1)) == 'cubic')THEN 554 IF( il_iext > 0 .AND. il_iext < im_mincubic ) il_iext=im_mincubic 555 IF( il_jext > 0 .AND. il_jext < im_mincubic ) il_jext=im_mincubic 556 ENDIF 557 558 IF( il_iext < 0 )THEN 299 559 CALL logger_error("EXTRAP FILL VALUE: invalid "//& 300 & " radius of the box used to compute extrapolation "//&301 & "("//TRIM(fct_str(il_ radius))//")")560 & " number of points to be extrapolated in i-direction "//& 561 & "("//TRIM(fct_str(il_iext))//")") 302 562 ENDIF 303 563 304 CALL logger_info("EXTRAP FILL: extrapolate "//TRIM(td_var%c_name)//& 305 & " using "//TRIM(cl_method)//" method." ) 306 307 CALL extrap__fill_value( td_var, cl_method, & 308 & il_radius ) 564 IF( il_jext < 0 )THEN 565 CALL logger_error("EXTRAP FILL VALUE: invalid "//& 566 & " number of points to be extrapolated in j-direction "//& 567 & "("//TRIM(fct_str(il_jext))//")") 568 ENDIF 569 570 IF( il_kext < 0 )THEN 571 CALL logger_error("EXTRAP FILL VALUE: invalid "//& 572 & " number of points to be extrapolated in k-direction "//& 573 & "("//TRIM(fct_str(il_kext))//")") 574 ENDIF 575 576 IF( (il_iext /= 0 .AND. td_var%t_dim(1)%l_use) .OR. & 577 & (il_jext /= 0 .AND. td_var%t_dim(2)%l_use) .OR. & 578 & (il_kext /= 0 .AND. td_var%t_dim(3)%l_use) )THEN 579 580 ! number of point use to compute box 581 il_radius=1 582 IF( PRESENT(id_radius) ) il_radius=id_radius 583 IF( il_radius < 0 )THEN 584 CALL logger_error("EXTRAP FILL VALUE: invalid "//& 585 & " radius of the box used to compute extrapolation "//& 586 & "("//TRIM(fct_str(il_radius))//")") 587 ENDIF 588 589 ! maximum number of iteration 590 il_maxiter=im_maxiter 591 IF( PRESENT(id_maxiter) ) il_maxiter=id_maxiter 592 IF( il_maxiter < 0 )THEN 593 CALL logger_error("EXTRAP FILL VALUE: invalid "//& 594 & " maximum nuber of iteration "//& 595 & "("//TRIM(fct_str(il_maxiter))//")") 596 ENDIF 597 598 CALL logger_info("EXTRAP FILL: extrapolate "//TRIM(td_var%c_name)//& 599 & " using "//TRIM(cl_method)//" method." ) 600 601 CALL extrap__fill_value( td_var, cl_method, & 602 & il_iext, il_jext, il_kext, & 603 & il_radius, il_maxiter, & 604 & td_level, & 605 & id_offset, id_rho ) 606 607 ENDIF 309 608 310 609 ENDIF … … 322 621 !> 323 622 !> @author J.Paul 324 !> @date November, 2013 - Initial Version 325 !> @date June, 2015 326 !> - select all land points for extrapolation 623 !> - November, 2013- Initial Version 327 624 ! 328 625 !> @param[inout] td_var variable structure 329 626 !> @param[in] cd_method extrapolation method 627 !> @param[in] id_iext number of points to be extrapolated in i-direction 628 !> @param[in] id_jext number of points to be extrapolated in j-direction 629 !> @param[in] id_kext number of points to be extrapolated in k-direction 330 630 !> @param[in] id_radius radius of the halo used to compute extrapolation 631 !> @param[in] id_maxiter maximum number of iteration 632 !> @param[in] td_level fine grid array of level 633 !> @param[in] id_offset array of offset between fine and coarse grid 634 !> @param[in] id_rho array of refinment factor 331 635 !------------------------------------------------------------------- 332 636 SUBROUTINE extrap__fill_value( td_var, cd_method, & 333 & id_radius ) 637 & id_iext, id_jext, id_kext, & 638 & id_radius, id_maxiter, & 639 & td_level, & 640 & id_offset, & 641 & id_rho ) 334 642 IMPLICIT NONE 335 643 ! Argument 336 644 TYPE(TVAR) , INTENT(INOUT) :: td_var 337 645 CHARACTER(LEN=*), INTENT(IN ) :: cd_method 646 INTEGER(i4) , INTENT(IN ) :: id_iext 647 INTEGER(i4) , INTENT(IN ) :: id_jext 648 INTEGER(i4) , INTENT(IN ) :: id_kext 338 649 INTEGER(i4) , INTENT(IN ) :: id_radius 650 INTEGER(i4) , INTENT(IN ) :: id_maxiter 651 TYPE(TVAR) , DIMENSION(:) , INTENT(IN ), OPTIONAL :: td_level 652 INTEGER(i4) , DIMENSION(:,:), INTENT(IN ), OPTIONAL :: id_offset 653 INTEGER(i4) , DIMENSION(:) , INTENT(IN ), OPTIONAL :: id_rho 339 654 340 655 ! local variable … … 353 668 & td_var%t_dim(3)%i_len) ) 354 669 355 il_detect(:,:,:) = extrap_detect( td_var ) 356 670 il_detect(:,:,:) = extrap_detect( td_var, td_level, & 671 & id_offset, & 672 & id_rho, & 673 & id_ext=(/id_iext, id_jext, id_kext/) ) 357 674 !2- add attribute to variable 358 675 cl_extrap=fct_concat(td_var%c_extrap(:)) … … 362 679 CALL att_clean(tl_att) 363 680 364 IF( ALL(il_detect(:,:,:)==1) )THEN 365 CALL logger_warn(" EXTRAP FILL: "//& 366 & " can not extrapolate "//TRIM(td_var%c_name)//& 367 & ". no value inform." ) 368 ELSE 369 CALL logger_info(" EXTRAP FILL: "//& 370 & TRIM(fct_str(SUM(il_detect(:,:,:))))//& 371 & " point(s) to extrapolate " ) 372 373 CALL logger_info(" EXTRAP FILL: method "//& 374 & TRIM(cd_method) ) 375 376 !3- extrapolate 377 CALL extrap__3D(td_var%d_value(:,:,:,:), td_var%d_fill, & 378 & il_detect(:,:,:), & 379 & cd_method, id_radius ) 380 ENDIF 681 CALL logger_info(" EXTRAP FILL: "//& 682 & TRIM(fct_str(SUM(il_detect(:,:,:))))//& 683 & " point(s) to extrapolate " ) 684 685 !3- extrapolate 686 CALL extrap__3D(td_var%d_value(:,:,:,:), td_var%d_fill, & 687 & il_detect(:,:,:), & 688 & cd_method, id_radius, id_maxiter ) 381 689 382 690 DEALLOCATE(il_detect) … … 397 705 !> 398 706 !> @author J.Paul 399 !> @date November, 2013 - Initial Version 400 !> @date July, 2015 401 !> - compute coef indices to be used 402 !> - bug fix: force coef indice to 1, for dimension lenth equal to 1 707 !> - Nov, 2013- Initial Version 403 708 ! 404 709 !> @param[inout] dd_value 3D array of variable to be extrapolated … … 409 714 !------------------------------------------------------------------- 410 715 SUBROUTINE extrap__3D( dd_value, dd_fill, id_detect,& 411 & cd_method, id_radius )716 & cd_method, id_radius, id_maxiter ) 412 717 IMPLICIT NONE 413 718 ! Argument 414 719 REAL(dp) , DIMENSION(:,:,:,:), INTENT(INOUT) :: dd_value 415 REAL(dp) , INTENT(IN ) :: dd_fill 416 INTEGER(i4), DIMENSION(:,:,:) , INTENT(INOUT) :: id_detect 417 CHARACTER(LEN=*), INTENT(IN ) :: cd_method 418 INTEGER(i4), INTENT(IN ) :: id_radius 720 REAL(dp) , INTENT(IN ) :: dd_fill 721 INTEGER(i4), DIMENSION(:,:,:), INTENT(INOUT) :: id_detect 722 CHARACTER(LEN=*), INTENT(IN ) :: cd_method 723 INTEGER(i4), INTENT(IN ) :: id_radius 724 INTEGER(i4), INTENT(IN ) :: id_maxiter 419 725 420 726 ! local variable 421 INTEGER(i4) :: il_imin 422 INTEGER(i4) :: il_imax 423 INTEGER(i4) :: il_jmin 424 INTEGER(i4) :: il_jmax 425 INTEGER(i4) :: il_kmin 426 INTEGER(i4) :: il_kmax 427 INTEGER(i4) :: il_iter 428 INTEGER(i4) :: il_radius 429 INTEGER(i4) :: il_i1 430 INTEGER(i4) :: il_i2 431 INTEGER(i4) :: il_j1 432 INTEGER(i4) :: il_j2 433 INTEGER(i4) :: il_k1 434 INTEGER(i4) :: il_k2 435 436 INTEGER(i4), DIMENSION(4) :: il_shape 437 INTEGER(i4), DIMENSION(3) :: il_dim 727 INTEGER(i4) :: il_imin 728 INTEGER(i4) :: il_imax 729 INTEGER(i4) :: il_jmin 730 INTEGER(i4) :: il_jmax 731 INTEGER(i4) :: il_kmin 732 INTEGER(i4) :: il_kmax 733 INTEGER(i4) :: il_iter 734 INTEGER(i4) :: il_radius 735 736 INTEGER(i4), DIMENSION(4) :: il_shape 737 INTEGER(i4), DIMENSION(3) :: il_dim 438 738 439 739 INTEGER(i4), DIMENSION(:,:,:), ALLOCATABLE :: il_detect … … 443 743 REAL(dp) , DIMENSION(:,:,:), ALLOCATABLE :: dl_dfdz 444 744 REAL(dp) , DIMENSION(:,:,:), ALLOCATABLE :: dl_coef 445 446 LOGICAL :: ll_iter447 745 448 746 ! loop indices … … 467 765 DO WHILE( ANY(il_detect(:,:,:)==1) ) 468 766 ! change extend value to minimize number of iteration 469 il_radius=id_radius+(il_iter-1) 470 ll_iter=.TRUE. 767 il_radius=id_radius+(il_iter/id_maxiter) 471 768 472 769 ALLOCATE( dl_dfdx(il_shape(1), il_shape(2), il_shape(3)) ) … … 477 774 dl_dfdx(:,:,:)=dd_fill 478 775 IF( il_shape(1) > 1 )THEN 479 dl_dfdx(:,:,:)=math_deriv_3D( dd_value(:,:,:,jl), & 480 & dd_fill, 'I' ) 776 dl_dfdx(:,:,:)=extrap_deriv_3D( dd_value(:,:,:,jl), dd_fill, 'I' ) 481 777 ENDIF 482 778 … … 484 780 dl_dfdy(:,:,:)=dd_fill 485 781 IF( il_shape(2) > 1 )THEN 486 dl_dfdy(:,:,:)=math_deriv_3D( dd_value(:,:,:,jl), & 487 & dd_fill, 'J' ) 782 dl_dfdy(:,:,:)=extrap_deriv_3D( dd_value(:,:,:,jl), dd_fill, 'J' ) 488 783 ENDIF 489 784 … … 491 786 dl_dfdz(:,:,:)=dd_fill 492 787 IF( il_shape(3) > 1 )THEN 493 dl_dfdz(:,:,:)=math_deriv_3D( dd_value(:,:,:,jl), & 494 & dd_fill, 'K' ) 788 dl_dfdz(:,:,:)=extrap_deriv_3D( dd_value(:,:,:,jl), dd_fill, 'K' ) 495 789 ENDIF 496 790 … … 510 804 511 805 DO jk=1,il_shape(3) 512 ! from North West(1,1) to South East(il_shape(1),il_shape(2))513 806 IF( ALL(il_detect(:,:,jk) == 0) ) CYCLE 514 807 DO jj=1,il_shape(2) … … 520 813 il_imin=MAX(ji-il_radius,1) 521 814 il_imax=MIN(ji+il_radius,il_shape(1)) 522 ! coef indices to be used523 il_i1 = il_radius-(ji-il_imin)+1524 il_i2 = il_radius+(il_imax-ji)+1525 815 IF( il_dim(1) == 1 )THEN 526 816 il_imin=ji 527 817 il_imax=ji 528 ! coef indices to be used529 il_i1 = 1530 il_i2 = 1531 818 ENDIF 532 533 819 534 820 il_jmin=MAX(jj-il_radius,1) 535 821 il_jmax=MIN(jj+il_radius,il_shape(2)) 536 ! coef indices to be used537 il_j1 = il_radius-(jj-il_jmin)+1538 il_j2 = il_radius+(il_jmax-jj)+1539 822 IF( il_dim(2) == 1 )THEN 540 823 il_jmin=jj 541 824 il_jmax=jj 542 ! coef indices to be used543 il_j1 = 1544 il_j2 = 1545 825 ENDIF 546 826 547 827 il_kmin=MAX(jk-il_radius,1) 548 828 il_kmax=MIN(jk+il_radius,il_shape(3)) 549 ! coef indices to be used550 il_k1 = il_radius-(jk-il_kmin)+1551 il_k2 = il_radius+(il_kmax-jk)+1552 829 IF( il_dim(3) == 1 )THEN 553 830 il_kmin=jk 554 831 il_kmax=jk 555 ! coef indices to be used556 il_k1 = 1557 il_k2 = 1558 832 ENDIF 559 833 … … 571 845 & il_jmin:il_jmax, & 572 846 & il_kmin:il_kmax ), & 573 & dl_coef(il_i1:il_i2, & 574 & il_j1:il_j2, & 575 & il_k1:il_k2) ) 847 & dl_coef(:,:,:) ) 576 848 577 849 IF( dd_value(ji,jj,jk,jl) /= dd_fill )THEN 578 850 il_detect(ji,jj,jk)= 0 579 ll_iter=.FALSE.580 ENDIF581 582 ENDIF583 584 ENDDO585 ENDDO586 ! from South East(il_shape(1),il_shape(2)) to North West(1,1)587 IF( ALL(il_detect(:,:,jk) == 0) ) CYCLE588 DO jj=il_shape(2),1,-1589 IF( ALL(il_detect(:,jj,jk) == 0) ) CYCLE590 DO ji=il_shape(1),1,-1591 592 IF( il_detect(ji,jj,jk) == 1 )THEN593 594 il_imin=MAX(ji-il_radius,1)595 il_imax=MIN(ji+il_radius,il_shape(1))596 ! coef indices to be used597 il_i1 = il_radius-(ji-il_imin)+1598 il_i2 = il_radius+(il_imax-ji)+1599 IF( il_dim(1) == 1 )THEN600 il_imin=ji601 il_imax=ji602 ! coef indices to be used603 il_i1 = 1604 il_i2 = 1605 ENDIF606 607 608 il_jmin=MAX(jj-il_radius,1)609 il_jmax=MIN(jj+il_radius,il_shape(2))610 ! coef indices to be used611 il_j1 = il_radius-(jj-il_jmin)+1612 il_j2 = il_radius+(il_jmax-jj)+1613 IF( il_dim(2) == 1 )THEN614 il_jmin=jj615 il_jmax=jj616 ! coef indices to be used617 il_j1 = 1618 il_j2 = 1619 ENDIF620 621 il_kmin=MAX(jk-il_radius,1)622 il_kmax=MIN(jk+il_radius,il_shape(3))623 ! coef indices to be used624 il_k1 = il_radius-(jk-il_kmin)+1625 il_k2 = il_radius+(il_kmax-jk)+1626 IF( il_dim(3) == 1 )THEN627 il_kmin=jk628 il_kmax=jk629 ! coef indices to be used630 il_k1 = 1631 il_k2 = 1632 ENDIF633 634 dd_value(ji,jj,jk,jl)=extrap__3D_min_error_fill( &635 & dd_value( il_imin:il_imax, &636 & il_jmin:il_jmax, &637 & il_kmin:il_kmax,jl ), dd_fill, il_radius, &638 & dl_dfdx( il_imin:il_imax, &639 & il_jmin:il_jmax, &640 & il_kmin:il_kmax ), &641 & dl_dfdy( il_imin:il_imax, &642 & il_jmin:il_jmax, &643 & il_kmin:il_kmax ), &644 & dl_dfdz( il_imin:il_imax, &645 & il_jmin:il_jmax, &646 & il_kmin:il_kmax ), &647 & dl_coef(il_i1:il_i2, &648 & il_j1:il_j2, &649 & il_k1:il_k2) )650 651 IF( dd_value(ji,jj,jk,jl) /= dd_fill )THEN652 il_detect(ji,jj,jk)= 0653 ll_iter=.FALSE.654 851 ENDIF 655 852 … … 665 862 DEALLOCATE( dl_coef ) 666 863 667 IF( ll_iter )il_iter=il_iter+1864 il_iter=il_iter+1 668 865 ENDDO 669 866 ENDDO … … 678 875 DO WHILE( ANY(il_detect(:,:,:)==1) ) 679 876 ! change extend value to minimize number of iteration 680 il_radius=id_radius+(il_iter-1) 681 ll_iter=.TRUE. 877 il_radius=id_radius+(il_iter/id_maxiter) 682 878 683 879 il_dim(1)=2*il_radius+1 … … 690 886 ALLOCATE( dl_coef(il_dim(1), il_dim(2), il_dim(3)) ) 691 887 692 dl_coef(:,:,:)=extrap__3D_dist_weight_coef(dd_value(1:il_dim(1), &693 & 1:il_dim(2), &694 & 1:il_dim(3), &888 dl_coef(:,:,:)=extrap__3D_dist_weight_coef(dd_value(1:il_dim(1), & 889 & 1:il_dim(2), & 890 & 1:il_dim(3), & 695 891 & jl ) ) 696 892 697 893 DO jk=1,il_shape(3) 698 ! from North West(1,1) to South East(il_shape(1),il_shape(2))699 894 IF( ALL(il_detect(:,:,jk) == 0) ) CYCLE 700 895 DO jj=1,il_shape(2) … … 706 901 il_imin=MAX(ji-il_radius,1) 707 902 il_imax=MIN(ji+il_radius,il_shape(1)) 708 ! coef indices to be used709 il_i1 = il_radius-(ji-il_imin)+1710 il_i2 = il_radius+(il_imax-ji)+1711 903 IF( il_dim(1) == 1 )THEN 712 904 il_imin=ji 713 905 il_imax=ji 714 ! coef indices to be used715 il_i1 = 1716 il_i2 = 1717 906 ENDIF 718 907 719 908 il_jmin=MAX(jj-il_radius,1) 720 909 il_jmax=MIN(jj+il_radius,il_shape(2)) 721 ! coef indices to be used722 il_j1 = il_radius-(jj-il_jmin)+1723 il_j2 = il_radius+(il_jmax-jj)+1724 910 IF( il_dim(2) == 1 )THEN 725 911 il_jmin=jj 726 912 il_jmax=jj 727 ! coef indices to be used728 il_j1 = 1729 il_j2 = 1730 913 ENDIF 731 914 732 915 il_kmin=MAX(jk-il_radius,1) 733 916 il_kmax=MIN(jk+il_radius,il_shape(3)) 734 ! coef indices to be used735 il_k1 = il_radius-(jk-il_kmin)+1736 il_k2 = il_radius+(il_kmax-jk)+1737 917 IF( il_dim(3) == 1 )THEN 738 918 il_kmin=jk 739 919 il_kmax=jk 740 ! coef indices to be used741 il_k1 = 1742 il_k2 = 1743 920 ENDIF 744 921 … … 748 925 & il_kmin:il_kmax, & 749 926 & jl), dd_fill, il_radius, & 750 & dl_coef(il_i1:il_i2, & 751 & il_j1:il_j2, & 752 & il_k1:il_k2) ) 927 & dl_coef(:,:,:) ) 753 928 754 929 IF( dd_value(ji,jj,jk,jl) /= dd_fill )THEN 755 930 il_detect(ji,jj,jk)= 0 756 ll_iter=.FALSE.757 ENDIF758 759 ENDIF760 761 ENDDO762 ENDDO763 ! from South East(il_shape(1),il_shape(2)) to North West(1,1)764 IF( ALL(il_detect(:,:,jk) == 0) ) CYCLE765 DO jj=il_shape(2),1,-1766 IF( ALL(il_detect(:,jj,jk) == 0) ) CYCLE767 DO ji=il_shape(1),1,-1768 769 IF( il_detect(ji,jj,jk) == 1 )THEN770 771 il_imin=MAX(ji-il_radius,1)772 il_imax=MIN(ji+il_radius,il_shape(1))773 ! coef indices to be used774 il_i1 = il_radius-(ji-il_imin)+1775 il_i2 = il_radius+(il_imax-ji)+1776 IF( il_dim(1) == 1 )THEN777 il_imin=ji778 il_imax=ji779 ! coef indices to be used780 il_i1 = 1781 il_i2 = 1782 ENDIF783 784 il_jmin=MAX(jj-il_radius,1)785 il_jmax=MIN(jj+il_radius,il_shape(2))786 ! coef indices to be used787 il_j1 = il_radius-(jj-il_jmin)+1788 il_j2 = il_radius+(il_jmax-jj)+1789 IF( il_dim(2) == 1 )THEN790 il_jmin=jj791 il_jmax=jj792 ! coef indices to be used793 il_j1 = 1794 il_j2 = 1795 ENDIF796 797 il_kmin=MAX(jk-il_radius,1)798 il_kmax=MIN(jk+il_radius,il_shape(3))799 ! coef indices to be used800 il_k1 = il_radius-(jk-il_kmin)+1801 il_k2 = il_radius+(il_kmax-jk)+1802 IF( il_dim(3) == 1 )THEN803 il_kmin=jk804 il_kmax=jk805 ! coef indices to be used806 il_k1 = 1807 il_k2 = 1808 ENDIF809 810 dd_value(ji,jj,jk,jl)=extrap__3D_dist_weight_fill( &811 & dd_value( il_imin:il_imax, &812 & il_jmin:il_jmax, &813 & il_kmin:il_kmax, &814 & jl), dd_fill, il_radius, &815 & dl_coef(il_i1:il_i2, &816 & il_j1:il_j2, &817 & il_k1:il_k2) )818 819 IF( dd_value(ji,jj,jk,jl) /= dd_fill )THEN820 il_detect(ji,jj,jk)= 0821 ll_iter=.FALSE.822 931 ENDIF 823 932 … … 827 936 ENDDO 828 937 ENDDO 829 CALL logger_info(" EXTRAP 3D: "//& 830 & TRIM(fct_str(SUM(il_detect(:,:,:))))//& 831 & " point(s) to extrapolate " ) 832 938 833 939 DEALLOCATE( dl_coef ) 834 IF( ll_iter )il_iter=il_iter+1940 il_iter=il_iter+1 835 941 ENDDO 836 942 ENDDO … … 840 946 841 947 END SUBROUTINE extrap__3D 948 !------------------------------------------------------------------- 949 !> @brief 950 !> This function compute derivative of 1D array. 951 !> 952 !> @details 953 !> optionaly you could specify to take into account east west discontinuity 954 !> (-180° 180° or 0° 360° for longitude variable) 955 !> 956 !> @author J.Paul 957 !> - November, 2013- Initial Version 958 ! 959 !> @param[in] dd_value 1D array of variable to be extrapolated 960 !> @param[in] dd_fill FillValue of variable 961 !> @param[in] ld_discont logical to take into account east west discontinuity 962 !------------------------------------------------------------------- 963 PURE FUNCTION extrap_deriv_1D( dd_value, dd_fill, ld_discont ) 964 965 IMPLICIT NONE 966 ! Argument 967 REAL(dp) , DIMENSION(:), INTENT(IN) :: dd_value 968 REAL(dp) , INTENT(IN) :: dd_fill 969 LOGICAL , INTENT(IN), OPTIONAL :: ld_discont 970 971 ! function 972 REAL(dp), DIMENSION(SIZE(dd_value,DIM=1) ) :: extrap_deriv_1D 973 974 ! local variable 975 INTEGER(i4) :: il_imin 976 INTEGER(i4) :: il_imax 977 INTEGER(i4), DIMENSION(1) :: il_shape 978 979 REAL(dp) :: dl_min 980 REAL(dp) :: dl_max 981 REAL(dp) , DIMENSION(:), ALLOCATABLE :: dl_value 982 983 LOGICAL :: ll_discont 984 985 ! loop indices 986 INTEGER(i4) :: ji 987 988 INTEGER(i4) :: i1 989 INTEGER(i4) :: i2 990 !---------------------------------------------------------------- 991 ! init 992 extrap_deriv_1D(:)=dd_fill 993 994 ll_discont=.FALSE. 995 IF( PRESENT(ld_discont) ) ll_discont=ld_discont 996 997 il_shape(:)=SHAPE(dd_value(:)) 998 999 ALLOCATE( dl_value(3)) 1000 1001 ! compute derivative in i-direction 1002 DO ji=1,il_shape(1) 1003 1004 il_imin=MAX(ji-1,1) 1005 il_imax=MIN(ji+1,il_shape(1)) 1006 1007 IF( il_imin==ji-1 .AND. il_imax==ji+1 )THEN 1008 i1=1 ; i2=3 1009 ELSEIF( il_imin==ji .AND. il_imax==ji+1 )THEN 1010 i1=1 ; i2=2 1011 ELSEIF( il_imin==ji-1 .AND. il_imax==ji )THEN 1012 i1=2 ; i2=3 1013 ENDIF 1014 1015 dl_value(i1:i2)=dd_value(il_imin:il_imax) 1016 IF( il_imin == 1 )THEN 1017 dl_value(:)=EOSHIFT( dl_value(:), & 1018 & DIM=1, & 1019 & SHIFT=-1, & 1020 & BOUNDARY=dl_value(1) ) 1021 ENDIF 1022 IF( il_imax == il_shape(1) )THEN 1023 dl_value(:)=EOSHIFT( dl_value(:), & 1024 & DIM=1, & 1025 & SHIFT=1, & 1026 & BOUNDARY=dl_value(3)) 1027 ENDIF 1028 1029 IF( ll_discont )THEN 1030 dl_min=MINVAL( dl_value(:), dl_value(:)/=dd_fill ) 1031 dl_max=MAXVAL( dl_value(:), dl_value(:)/=dd_fill ) 1032 IF( dl_min < -170_dp .AND. dl_max > 170_dp )THEN 1033 WHERE( dl_value(:) < 0._dp ) 1034 dl_value(:) = dl_value(:)+360._dp 1035 END WHERE 1036 ELSEIF( dl_min < 10_dp .AND. dl_max > 350_dp )THEN 1037 WHERE( dl_value(:) > 180._dp ) 1038 dl_value(:) = dl_value(:)-180._dp 1039 END WHERE 1040 ENDIF 1041 ENDIF 1042 1043 IF( dl_value( 2) /= dd_fill .AND. & ! ji 1044 & dl_value( 3) /= dd_fill .AND. & ! ji+1 1045 & dl_value( 1) /= dd_fill )THEN ! ji-1 1046 1047 extrap_deriv_1D(ji)=& 1048 & ( dl_value(3) - dl_value(1) ) / & 1049 & REAL( il_imax-il_imin ,dp) 1050 1051 ENDIF 1052 1053 ENDDO 1054 1055 DEALLOCATE( dl_value ) 1056 1057 END FUNCTION extrap_deriv_1D 1058 !------------------------------------------------------------------- 1059 !> @brief 1060 !> This function compute derivative of 2D array. 1061 !> you have to specify in which direction derivative have to be computed: 1062 !> first (I) or second (J) dimension. 1063 !> 1064 !> @details 1065 !> optionaly you could specify to take into account east west discontinuity 1066 !> (-180° 180° or 0° 360° for longitude variable) 1067 !> 1068 !> @author J.Paul 1069 !> - November, 2013- Initial Version 1070 ! 1071 !> @param[in] dd_value 2D array of variable to be extrapolated 1072 !> @param[in] dd_fill FillValue of variable 1073 !> @param[in] cd_dim compute derivative on first (I) or second (J) dimension 1074 !> @param[in] ld_discont logical to take into account east west discontinuity 1075 !------------------------------------------------------------------- 1076 FUNCTION extrap_deriv_2D( dd_value, dd_fill, cd_dim, ld_discont ) 1077 1078 IMPLICIT NONE 1079 ! Argument 1080 REAL(dp) , DIMENSION(:,:), INTENT(IN) :: dd_value 1081 REAL(dp) , INTENT(IN) :: dd_fill 1082 CHARACTER(LEN=*) , INTENT(IN) :: cd_dim 1083 LOGICAL , INTENT(IN), OPTIONAL :: ld_discont 1084 1085 ! function 1086 REAL(dp), DIMENSION(SIZE(dd_value,DIM=1), & 1087 & SIZE(dd_value,DIM=2) ) :: extrap_deriv_2D 1088 1089 ! local variable 1090 INTEGER(i4) :: il_imin 1091 INTEGER(i4) :: il_imax 1092 INTEGER(i4) :: il_jmin 1093 INTEGER(i4) :: il_jmax 1094 INTEGER(i4), DIMENSION(2) :: il_shape 1095 1096 REAL(dp) :: dl_min 1097 REAL(dp) :: dl_max 1098 REAL(dp) , DIMENSION(:,:), ALLOCATABLE :: dl_value 1099 1100 LOGICAL :: ll_discont 1101 1102 ! loop indices 1103 INTEGER(i4) :: ji 1104 INTEGER(i4) :: jj 1105 1106 INTEGER(i4) :: i1 1107 INTEGER(i4) :: i2 1108 1109 INTEGER(i4) :: j1 1110 INTEGER(i4) :: j2 1111 !---------------------------------------------------------------- 1112 ! init 1113 extrap_deriv_2D(:,:)=dd_fill 1114 1115 ll_discont=.FALSE. 1116 IF( PRESENT(ld_discont) ) ll_discont=ld_discont 1117 1118 il_shape(:)=SHAPE(dd_value(:,:)) 1119 1120 SELECT CASE(TRIM(fct_upper(cd_dim))) 1121 1122 CASE('I') 1123 1124 ALLOCATE( dl_value(3,il_shape(2)) ) 1125 ! compute derivative in i-direction 1126 DO ji=1,il_shape(1) 1127 1128 ! init 1129 dl_value(:,:)=dd_fill 1130 1131 il_imin=MAX(ji-1,1) 1132 il_imax=MIN(ji+1,il_shape(1)) 1133 1134 IF( il_imin==ji-1 .AND. il_imax==ji+1 )THEN 1135 i1=1 ; i2=3 1136 ELSEIF( il_imin==ji .AND. il_imax==ji+1 )THEN 1137 i1=1 ; i2=2 1138 ELSEIF( il_imin==ji-1 .AND. il_imax==ji )THEN 1139 i1=2 ; i2=3 1140 ENDIF 1141 1142 dl_value(i1:i2,:)=dd_value(il_imin:il_imax,:) 1143 IF( il_imin == 1 )THEN 1144 dl_value(:,:)=EOSHIFT( dl_value(:,:), & 1145 & DIM=1, & 1146 & SHIFT=-1, & 1147 & BOUNDARY=dl_value(1,:) ) 1148 ENDIF 1149 IF( il_imax == il_shape(1) )THEN 1150 dl_value(:,:)=EOSHIFT( dl_value(:,:), & 1151 & DIM=1, & 1152 & SHIFT=1, & 1153 & BOUNDARY=dl_value(3,:)) 1154 ENDIF 1155 1156 IF( ll_discont )THEN 1157 dl_min=MINVAL( dl_value(:,:), dl_value(:,:)/=dd_fill ) 1158 dl_max=MAXVAL( dl_value(:,:), dl_value(:,:)/=dd_fill ) 1159 IF( dl_min < -170_dp .AND. dl_max > 170_dp )THEN 1160 WHERE( dl_value(:,:) < 0_dp ) 1161 dl_value(:,:) = dl_value(:,:)+360._dp 1162 END WHERE 1163 ELSEIF( dl_min < 10_dp .AND. dl_max > 350_dp )THEN 1164 WHERE( dl_value(:,:) > 180 ) 1165 dl_value(:,:) = dl_value(:,:)-180._dp 1166 END WHERE 1167 ENDIF 1168 ENDIF 1169 1170 WHERE( dl_value(2,:) /= dd_fill .AND. & ! ji 1171 & dl_value(3,:) /= dd_fill .AND. & ! ji+1 1172 & dl_value(1,:) /= dd_fill ) ! ji-1 1173 1174 extrap_deriv_2D(ji,:)=& 1175 & ( dl_value(3,:) - dl_value(1,:) ) / & 1176 & REAL( il_imax-il_imin,dp) 1177 1178 END WHERE 1179 1180 ENDDO 1181 1182 CASE('J') 1183 1184 ALLOCATE( dl_value(il_shape(1),3) ) 1185 ! compute derivative in j-direction 1186 DO jj=1,il_shape(2) 1187 1188 il_jmin=MAX(jj-1,1) 1189 il_jmax=MIN(jj+1,il_shape(2)) 1190 1191 IF( il_jmin==jj-1 .AND. il_jmax==jj+1 )THEN 1192 j1=1 ; j2=3 1193 ELSEIF( il_jmin==jj .AND. il_jmax==jj+1 )THEN 1194 j1=1 ; j2=2 1195 ELSEIF( il_jmin==jj-1 .AND. il_jmax==jj )THEN 1196 j1=2 ; j2=3 1197 ENDIF 1198 1199 dl_value(:,j1:j2)=dd_value(:,il_jmin:il_jmax) 1200 IF( il_jmin == 1 )THEN 1201 dl_value(:,:)=EOSHIFT( dl_value(:,:), & 1202 & DIM=2, & 1203 & SHIFT=-1, & 1204 & BOUNDARY=dl_value(:,1)) 1205 ENDIF 1206 IF( il_jmax == il_shape(2) )THEN 1207 dl_value(:,:)=EOSHIFT( dl_value(:,:), & 1208 & DIM=2, & 1209 & SHIFT=1, & 1210 & BOUNDARY=dl_value(:,3)) 1211 ENDIF 1212 1213 IF( ll_discont )THEN 1214 dl_min=MINVAL( dl_value(:,:), dl_value(:,:)/=dd_fill ) 1215 dl_max=MAXVAL( dl_value(:,:), dl_value(:,:)/=dd_fill ) 1216 IF( dl_min < -170_dp .AND. dl_max > 170_dp )THEN 1217 WHERE( dl_value(:,:) < 0_dp ) 1218 dl_value(:,:) = dl_value(:,:)+360._dp 1219 END WHERE 1220 ELSEIF( dl_min < 10_dp .AND. dl_max > 350_dp )THEN 1221 WHERE( dl_value(:,:) > 180 ) 1222 dl_value(:,:) = dl_value(:,:)-180._dp 1223 END WHERE 1224 ENDIF 1225 ENDIF 1226 1227 WHERE( dl_value(:, 2) /= dd_fill .AND. & ! jj 1228 & dl_value(:, 3) /= dd_fill .AND. & ! jj+1 1229 & dl_value(:, 1) /= dd_fill ) ! jj-1 1230 1231 extrap_deriv_2D(:,jj)=& 1232 & ( dl_value(:,3) - dl_value(:,1) ) / & 1233 & REAL(il_jmax-il_jmin,dp) 1234 1235 END WHERE 1236 1237 ENDDO 1238 1239 END SELECT 1240 1241 DEALLOCATE( dl_value ) 1242 1243 END FUNCTION extrap_deriv_2D 1244 !------------------------------------------------------------------- 1245 !> @brief 1246 !> This function compute derivative of 3D array. 1247 !> you have to specify in which direction derivative have to be computed: 1248 !> first (I), second (J) or third (K) dimension. 1249 !> 1250 !> @details 1251 !> optionaly you could specify to take into account east west discontinuity 1252 !> (-180° 180° or 0° 360° for longitude variable) 1253 !> 1254 !> @author J.Paul 1255 !> - November, 2013- Initial Version 1256 ! 1257 !> @param[inout] dd_value 3D array of variable to be extrapolated 1258 !> @param[in] dd_fill FillValue of variable 1259 !> @param[in] cd_dim compute derivative on first (I) second (J) or third (K) dimension 1260 !> @param[in] ld_discont logical to take into account east west discontinuity 1261 !------------------------------------------------------------------- 1262 PURE FUNCTION extrap_deriv_3D( dd_value, dd_fill, cd_dim, ld_discont ) 1263 1264 IMPLICIT NONE 1265 ! Argument 1266 REAL(dp) , DIMENSION(:,:,:), INTENT(IN) :: dd_value 1267 REAL(dp) , INTENT(IN) :: dd_fill 1268 CHARACTER(LEN=*) , INTENT(IN) :: cd_dim 1269 LOGICAL , INTENT(IN), OPTIONAL :: ld_discont 1270 1271 ! function 1272 REAL(dp), DIMENSION(SIZE(dd_value,DIM=1), & 1273 & SIZE(dd_value,DIM=2), & 1274 & SIZE(dd_value,DIM=3)) :: extrap_deriv_3D 1275 1276 ! local variable 1277 INTEGER(i4) :: il_imin 1278 INTEGER(i4) :: il_imax 1279 INTEGER(i4) :: il_jmin 1280 INTEGER(i4) :: il_jmax 1281 INTEGER(i4) :: il_kmin 1282 INTEGER(i4) :: il_kmax 1283 INTEGER(i4), DIMENSION(3) :: il_shape 1284 1285 REAL(dp) :: dl_min 1286 REAL(dp) :: dl_max 1287 REAL(dp) , DIMENSION(:,:,:), ALLOCATABLE :: dl_value 1288 1289 LOGICAL :: ll_discont 1290 1291 ! loop indices 1292 INTEGER(i4) :: ji 1293 INTEGER(i4) :: jj 1294 INTEGER(i4) :: jk 1295 1296 INTEGER(i4) :: i1 1297 INTEGER(i4) :: i2 1298 1299 INTEGER(i4) :: j1 1300 INTEGER(i4) :: j2 1301 1302 INTEGER(i4) :: k1 1303 INTEGER(i4) :: k2 1304 !---------------------------------------------------------------- 1305 ! init 1306 extrap_deriv_3D(:,:,:)=dd_fill 1307 1308 ll_discont=.FALSE. 1309 IF( PRESENT(ld_discont) ) ll_discont=ld_discont 1310 1311 il_shape(:)=SHAPE(dd_value(:,:,:)) 1312 1313 1314 SELECT CASE(TRIM(fct_upper(cd_dim))) 1315 1316 CASE('I') 1317 1318 ALLOCATE( dl_value(3,il_shape(2),il_shape(3)) ) 1319 ! compute derivative in i-direction 1320 DO ji=1,il_shape(1) 1321 1322 il_imin=MAX(ji-1,1) 1323 il_imax=MIN(ji+1,il_shape(1)) 1324 1325 IF( il_imin==ji-1 .AND. il_imax==ji+1 )THEN 1326 i1=1 ; i2=3 1327 ELSEIF( il_imin==ji .AND. il_imax==ji+1 )THEN 1328 i1=1 ; i2=2 1329 ELSEIF( il_imin==ji-1 .AND. il_imax==ji )THEN 1330 i1=2 ; i2=3 1331 ENDIF 1332 1333 dl_value(i1:i2,:,:)=dd_value(il_imin:il_imax,:,:) 1334 IF( il_imin == 1 )THEN 1335 dl_value(:,:,:)=EOSHIFT( dl_value(:,:,:), & 1336 & DIM=1, & 1337 & SHIFT=-1, & 1338 & BOUNDARY=dl_value(1,:,:) ) 1339 ENDIF 1340 IF( il_imax == il_shape(1) )THEN 1341 dl_value(:,:,:)=EOSHIFT( dl_value(:,:,:), & 1342 & DIM=1, & 1343 & SHIFT=1, & 1344 & BOUNDARY=dl_value(3,:,:)) 1345 ENDIF 1346 1347 IF( ll_discont )THEN 1348 dl_min=MINVAL( dl_value(:,:,:), dl_value(:,:,:)/=dd_fill ) 1349 dl_max=MAXVAL( dl_value(:,:,:), dl_value(:,:,:)/=dd_fill ) 1350 IF( dl_min < -170_dp .AND. dl_max > 170_dp )THEN 1351 WHERE( dl_value(:,:,:) < 0_dp ) 1352 dl_value(:,:,:) = dl_value(:,:,:)+360._dp 1353 END WHERE 1354 ELSEIF( dl_min < 10_dp .AND. dl_max > 350_dp )THEN 1355 WHERE( dl_value(:,:,:) > 180 ) 1356 dl_value(:,:,:) = dl_value(:,:,:)-180._dp 1357 END WHERE 1358 ENDIF 1359 ENDIF 1360 1361 WHERE( dl_value(2,:,:) /= dd_fill .AND. & ! ji 1362 & dl_value(3,:,:) /= dd_fill .AND. & !ji+1 1363 & dl_value(1,:,:) /= dd_fill ) !ji-1 1364 1365 extrap_deriv_3D(ji,:,:)= & 1366 & ( dl_value(3,:,:) - dl_value(1,:,:) ) / & 1367 & REAL( il_imax-il_imin ,dp) 1368 1369 END WHERE 1370 1371 ENDDO 1372 1373 CASE('J') 1374 1375 ALLOCATE( dl_value(il_shape(1),3,il_shape(3)) ) 1376 ! compute derivative in j-direction 1377 DO jj=1,il_shape(2) 1378 1379 il_jmin=MAX(jj-1,1) 1380 il_jmax=MIN(jj+1,il_shape(2)) 1381 1382 IF( il_jmin==jj-1 .AND. il_jmax==jj+1 )THEN 1383 j1=1 ; j2=3 1384 ELSEIF( il_jmin==jj .AND. il_jmax==jj+1 )THEN 1385 j1=1 ; j2=2 1386 ELSEIF( il_jmin==jj-1 .AND. il_jmax==jj )THEN 1387 j1=2 ; j2=3 1388 ENDIF 1389 1390 dl_value(:,j1:j2,:)=dd_value(:,il_jmin:il_jmax,:) 1391 IF( il_jmin == 1 )THEN 1392 dl_value(:,:,:)=EOSHIFT( dl_value(:,:,:), & 1393 & DIM=2, & 1394 & SHIFT=-1, & 1395 & BOUNDARY=dl_value(:,1,:) ) 1396 ENDIF 1397 IF( il_jmax == il_shape(2) )THEN 1398 dl_value(:,:,:)=EOSHIFT( dl_value(:,:,:), & 1399 & DIM=2, & 1400 & SHIFT=1, & 1401 & BOUNDARY=dl_value(:,3,:)) 1402 ENDIF 1403 1404 IF( ll_discont )THEN 1405 dl_min=MINVAL( dl_value(:,:,:), dl_value(:,:,:)/=dd_fill ) 1406 dl_max=MAXVAL( dl_value(:,:,:), dl_value(:,:,:)/=dd_fill ) 1407 IF( dl_min < -170_dp .AND. dl_max > 170_dp )THEN 1408 WHERE( dl_value(:,:,:) < 0_dp ) 1409 dl_value(:,:,:) = dl_value(:,:,:)+360._dp 1410 END WHERE 1411 ELSEIF( dl_min < 10_dp .AND. dl_max > 350_dp )THEN 1412 WHERE( dl_value(:,:,:) > 180 ) 1413 dl_value(:,:,:) = dl_value(:,:,:)-180._dp 1414 END WHERE 1415 ENDIF 1416 ENDIF 1417 1418 WHERE( dl_value(:, 2,:) /= dd_fill .AND. & ! jj 1419 & dl_value(:, 3,:) /= dd_fill .AND. & ! jj+1 1420 & dl_value(:, 1,:) /= dd_fill ) ! jj-1 1421 1422 extrap_deriv_3D(:,jj,:)=& 1423 & ( dl_value(:,3,:) - dl_value(:,1,:) ) / & 1424 & REAL( il_jmax - il_jmin ,dp) 1425 1426 END WHERE 1427 1428 ENDDO 1429 1430 CASE('K') 1431 ! compute derivative in k-direction 1432 DO jk=1,il_shape(3) 1433 1434 il_kmin=MAX(jk-1,1) 1435 il_kmax=MIN(jk+1,il_shape(3)) 1436 1437 IF( il_kmin==jk-1 .AND. il_kmax==jk+1 )THEN 1438 k1=1 ; k2=3 1439 ELSEIF( il_kmin==jk .AND. il_kmax==jk+1 )THEN 1440 k1=1 ; k2=2 1441 ELSEIF( il_kmin==jk-1 .AND. il_kmax==jk )THEN 1442 k1=2 ; k2=3 1443 ENDIF 1444 1445 dl_value(:,:,k1:k2)=dd_value(:,:,il_kmin:il_kmax) 1446 IF( il_kmin == 1 )THEN 1447 dl_value(:,:,:)=EOSHIFT( dl_value(:,:,:), & 1448 & DIM=3, & 1449 & SHIFT=-1, & 1450 & BOUNDARY=dl_value(:,:,1) ) 1451 ENDIF 1452 IF( il_kmax == il_shape(3) )THEN 1453 dl_value(:,:,:)=EOSHIFT( dl_value(:,:,:), & 1454 & DIM=3, & 1455 & SHIFT=1, & 1456 & BOUNDARY=dl_value(:,:,3)) 1457 ENDIF 1458 1459 IF( ll_discont )THEN 1460 dl_min=MINVAL( dl_value(:,:,:), dl_value(:,:,:)/=dd_fill ) 1461 dl_max=MAXVAL( dl_value(:,:,:), dl_value(:,:,:)/=dd_fill ) 1462 IF( dl_min < -170_dp .AND. dl_max > 170_dp )THEN 1463 WHERE( dl_value(:,:,:) < 0_dp ) 1464 dl_value(:,:,:) = dl_value(:,:,:)+360._dp 1465 END WHERE 1466 ELSEIF( dl_min < 10_dp .AND. dl_max > 350_dp )THEN 1467 WHERE( dl_value(:,:,:) > 180 ) 1468 dl_value(:,:,:) = dl_value(:,:,:)-180._dp 1469 END WHERE 1470 ENDIF 1471 ENDIF 1472 1473 WHERE( dl_value(:,:, 2) /= dd_fill .AND. & ! jk 1474 & dl_value(:,:, 3) /= dd_fill .AND. & ! jk+1 1475 & dl_value(:,:, 1) /= dd_fill ) ! jk-1 1476 1477 extrap_deriv_3D(:,:,jk)=& 1478 & ( dl_value(:,:,3) - dl_value(:,:,1) ) / & 1479 & REAL( il_kmax-il_kmin,dp) 1480 1481 END WHERE 1482 1483 ENDDO 1484 1485 END SELECT 1486 1487 DEALLOCATE( dl_value ) 1488 1489 END FUNCTION extrap_deriv_3D 842 1490 !------------------------------------------------------------------- 843 1491 !> @brief … … 845 1493 !> 846 1494 !> @details 847 !> coefficients are "grid distance" to the center of the box 848 !> choosed to computeextrapolation.1495 !> coefficients are "grid distance" to the center of the box choosed to compute 1496 !> extrapolation. 849 1497 !> 850 1498 !> @author J.Paul 851 !> @date November, 2013 - Initial Version 852 !> @date July, 2015 853 !> - decrease weight of third dimension 1499 !> - November, 2013- Initial Version 854 1500 ! 855 1501 !> @param[in] dd_value 3D array of variable to be extrapolated … … 898 1544 899 1545 ! compute distance 900 ! "vertical weight" is lower than horizontal901 1546 dl_dist(ji,jj,jk) = (ji-il_imid)**2 + & 902 1547 & (jj-il_jmid)**2 + & 903 & 3*(jk-il_kmid)**21548 & (jk-il_kmid)**2 904 1549 905 1550 IF( dl_dist(ji,jj,jk) /= 0 )THEN … … 924 1569 !> 925 1570 !> @author J.Paul 926 !> @date November, 2013- Initial Version1571 !> - November, 2013- Initial Version 927 1572 !> 928 1573 !> @param[in] dd_value 3D array of variable to be extrapolated … … 1013 1658 !> 1014 1659 !> @author J.Paul 1015 !> @date November, 2013 - Initial Version 1016 !> @date July, 2015 1017 !> - decrease weight of third dimension 1660 !> - November, 2013- Initial Version 1018 1661 ! 1019 1662 !> @param[in] dd_value 3D array of variable to be extrapolated … … 1062 1705 1063 1706 ! compute distance 1064 ! "vertical weight" is lower than horizontal1065 1707 dl_dist(ji,jj,jk) = (ji-il_imid)**2 + & 1066 1708 & (jj-il_jmid)**2 + & 1067 & 3*(jk-il_kmid)**21709 & (jk-il_kmid)**2 1068 1710 1069 1711 IF( dl_dist(ji,jj,jk) /= 0 )THEN … … 1090 1732 !> 1091 1733 !> @author J.Paul 1092 !> @date November, 2013- Initial Version1734 !> - November, 2013- Initial Version 1093 1735 ! 1094 1736 !> @param[in] dd_value 3D array of variable to be extrapolated … … 1121 1763 INTEGER(i4) :: jj 1122 1764 INTEGER(i4) :: jk 1765 1123 1766 !---------------------------------------------------------------- 1124 1767 … … 1150 1793 ENDDO 1151 1794 ENDDO 1152 1153 1795 1154 1796 ! return value … … 1173 1815 !> 1174 1816 !> @author J.Paul 1175 !> @date November, 2013 -Initial version1817 !> - November, 2013-Initial version 1176 1818 ! 1177 1819 !> @param[inout] td_var variable … … 1275 1917 !> 1276 1918 !> @author J.Paul 1277 !> @date November, 2013 -Initial version1919 !> - November, 2013-Initial version 1278 1920 !> 1279 1921 !> @param[inout] td_var variable -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/file.f90
r10248 r10251 137 137 !> J.Paul 138 138 ! REVISION HISTORY: 139 !> @date November, 2013 - Initial Version 140 !> @date November, 2014 141 !> - Fix memory leaks bug 139 !> @date November, 2013- Initial Version 140 !> @date November, 2014 - Fix memory leaks bug 142 141 !> 143 142 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 289 288 !> 290 289 !> @author J.Paul 291 !> @date November, 2013- Initial Version290 !> - November, 2013- Initial Version 292 291 !> @date November, 2014 293 !> - use function instead of overload assignment operator292 !> - use function instead of overload assignment operator 294 293 !> (to avoid memory leak) 295 294 ! … … 410 409 !> 411 410 !> @author J.Paul 412 !> @date November, 2013- Initial Version411 !> - November, 2013- Initial Version 413 412 !> @date November, 2014 414 !> - use function instead of overload assignment operator413 !> - use function instead of overload assignment operator 415 414 !> (to avoid memory leak) 416 415 ! … … 449 448 ! 450 449 !> @author J.Paul 451 !> @date November, 2013- Initial Version450 !> - November, 2013- Initial Version 452 451 ! 453 452 !> @param[in] cd_file file name … … 554 553 ! 555 554 !> @author J.Paul 556 !> @date November, 2013- Initial Version555 !> - November, 2013- Initial Version 557 556 ! 558 557 !> @param[in] cd_file file name … … 590 589 ! 591 590 !> @author J.Paul 592 !> @date November, 2013- Initial Version591 !> - November, 2013- Initial Version 593 592 ! 594 593 !> @param[in] td_file file structure … … 605 604 CHARACTER(LEN=lc) :: cl_dim 606 605 LOGICAL :: ll_error 607 LOGICAL :: ll_warn 608 609 INTEGER(i4) :: il_ind 606 607 INTEGER(i4) :: il_ind 610 608 611 609 ! loop indices … … 616 614 ! check used dimension 617 615 ll_error=.FALSE. 618 ll_warn=.FALSE.619 616 DO ji=1,ip_maxdim 620 617 il_ind=dim_get_index( td_file%t_dim(:), & … … 622 619 & TRIM(td_var%t_dim(ji)%c_sname)) 623 620 IF( il_ind /= 0 )THEN 624 IF( td_var%t_dim(ji)%l_use .AND. & 625 & td_file%t_dim(il_ind)%l_use .AND. & 626 & td_var%t_dim(ji)%i_len /= td_file%t_dim(il_ind)%i_len )THEN 627 IF( INDEX( TRIM(td_var%c_axis), & 628 & TRIM(fct_upper(td_var%t_dim(ji)%c_name))) == 0 )THEN 629 ll_warn=.TRUE. 630 ELSE 631 ll_error=.TRUE. 632 ENDIF 633 ENDIF 621 IF( td_var%t_dim(ji)%l_use .AND. & 622 & td_file%t_dim(il_ind)%l_use .AND. & 623 & td_var%t_dim(ji)%i_len /= td_file%t_dim(il_ind)%i_len )THEN 624 ll_error=.TRUE. 625 ENDIF 634 626 ENDIF 635 627 ENDDO 636 628 637 629 IF( ll_error )THEN 630 631 file_check_var_dim=.FALSE. 632 633 CALL logger_error( & 634 & " FILE CHECK VAR DIM: variable and file dimension differ"//& 635 & " for variable "//TRIM(td_var%c_name)//& 636 & " and file "//TRIM(td_file%c_name)) 637 638 638 639 639 cl_dim='(/' … … 659 659 CALL logger_debug( " variable dimension: "//TRIM(cl_dim) ) 660 660 661 file_check_var_dim=.FALSE.662 663 CALL logger_error( &664 & " FILE CHECK VAR DIM: variable and file dimension differ"//&665 & " for variable "//TRIM(td_var%c_name)//&666 & " and file "//TRIM(td_file%c_name))667 668 ELSEIF( ll_warn )THEN669 CALL logger_warn( &670 & " FILE CHECK VAR DIM: variable and file dimension differ"//&671 & " for variable "//TRIM(td_var%c_name)//&672 & " and file "//TRIM(td_file%c_name)//". you should use"//&673 & " var_check_dim to remove useless dimension.")674 661 ELSE 675 662 … … 692 679 ! 693 680 !> @author J.Paul 694 !> @date November, 2013- Initial Version681 !> - November, 2013- Initial Version 695 682 !> @date September, 2014 696 683 !> - add dimension to file if need be … … 720 707 IF( TRIM(td_file%c_name) == '' )THEN 721 708 709 CALL logger_error( " FILE ADD VAR: structure file unknown" ) 722 710 CALL logger_debug( " FILE ADD VAR: you should have used file_init before "//& 723 711 & "running file_add_var" ) 724 CALL logger_error( " FILE ADD VAR: structure file unknown" )725 712 726 713 ELSE … … 736 723 & td_var%c_stdname ) 737 724 ENDIF 738 CALL logger_debug( & 739 & " FILE ADD VAR: ind "//TRIM(fct_str(il_ind)) ) 725 740 726 IF( il_ind /= 0 )THEN 741 727 … … 753 739 ELSE 754 740 755 CALL logger_ debug( &741 CALL logger_trace( & 756 742 & " FILE ADD VAR: add variable "//TRIM(td_var%c_name)//& 757 743 & ", standard name "//TRIM(td_var%c_stdname)//& … … 784 770 !il_rec=td_file%t_dim(3)%i_len 785 771 END SELECT 772 CALL logger_info( & 773 & " FILE ADD VAR: variable index "//TRIM(fct_str(il_ind))) 786 774 787 775 IF( td_file%i_nvar > 0 )THEN … … 818 806 ENDIF 819 807 820 IF( il_ind < td_file%i_nvar +1)THEN808 IF( il_ind < td_file%i_nvar )THEN 821 809 ! variable with more dimension than new variable 822 810 td_file%t_var( il_ind+1 : td_file%i_nvar+1 ) = & … … 905 893 ! 906 894 !> @author J.Paul 907 !> @date November, 2013 - Initial Version 908 !> @date February, 2015 909 !> - define local variable structure to avoid mistake with pointer 895 !> - November, 2013- Initial Version 910 896 ! 911 897 !> @param[inout] td_file file structure … … 921 907 ! local variable 922 908 INTEGER(i4) :: il_ind 923 TYPE(TVAR) :: tl_var924 909 !---------------------------------------------------------------- 925 910 … … 943 928 IF( il_ind /= 0 )THEN 944 929 945 tl_var=var_copy(td_file%t_var(il_ind)) 946 CALL file_del_var(td_file, tl_var) 930 CALL file_del_var(td_file, td_file%t_var(il_ind)) 947 931 948 932 ELSE 949 933 950 CALL logger_ debug( &934 CALL logger_warn( & 951 935 & " FILE DEL VAR NAME: there is no variable with name or "//& 952 936 & "standard name "//TRIM(cd_name)//" in file "//& … … 969 953 !> 970 954 !> @author J.Paul 971 !> @date November, 2013- Initial Version955 !> - November, 2013- Initial Version 972 956 !> 973 957 !> @param[inout] td_file file structure … … 1112 1096 ! 1113 1097 !> @author J.Paul 1114 !> @date November, 2013- Initial Version1098 !> - November, 2013- Initial Version 1115 1099 ! 1116 1100 !> @param[inout] td_file file structure … … 1147 1131 ! 1148 1132 !> @author J.Paul 1149 !> @date November, 2013- Initial Version1133 !> - November, 2013- Initial Version 1150 1134 ! 1151 1135 !> @param[inout] td_file file structure … … 1263 1247 ! 1264 1248 !> @author J.Paul 1265 !> @date November, 2013 - Initial Version 1266 !> @date February, 2015 1267 !> - define local attribute structure to avoid mistake 1268 !> with pointer 1249 !> - November, 2013- Initial Version 1269 1250 ! 1270 1251 !> @param[inout] td_file file structure … … 1280 1261 ! local variable 1281 1262 INTEGER(i4) :: il_ind 1282 TYPE(TATT) :: tl_att1283 1263 !---------------------------------------------------------------- 1284 1264 … … 1302 1282 IF( il_ind /= 0 )THEN 1303 1283 1304 tl_att=att_copy(td_file%t_att(il_ind)) 1305 CALL file_del_att(td_file, tl_att) 1284 CALL file_del_att(td_file, td_file%t_att(il_ind)) 1306 1285 1307 1286 ELSE 1308 1287 1309 CALL logger_ debug( &1288 CALL logger_warn( & 1310 1289 & " FILE DEL ATT NAME: there is no attribute with name "//& 1311 1290 & TRIM(cd_name)//" in file "//TRIM(td_file%c_name)) … … 1326 1305 ! 1327 1306 !> @author J.Paul 1328 !> @date November, 2013- Initial Version1307 !> - November, 2013- Initial Version 1329 1308 ! 1330 1309 !> @param[inout] td_file file structure … … 1424 1403 ! 1425 1404 !> @author J.Paul 1426 !> @date November, 2013- Initial Version1405 !> - November, 2013- Initial Version 1427 1406 ! 1428 1407 !> @param[inout] td_file file structure … … 1465 1444 ! 1466 1445 !> @author J.Paul 1467 !> @date November, 2013- Initial Version1446 !> - November, 2013- Initial Version 1468 1447 !> @date September, 2014 1469 1448 !> - do not reorder dimension, before put in file … … 1550 1529 !> 1551 1530 !> @author J.Paul 1552 !> @date November, 2013- Initial Version1531 !> - November, 2013- Initial Version 1553 1532 ! 1554 1533 !> @param[inout] td_file file structure … … 1630 1609 ! 1631 1610 !> @author J.Paul 1632 !> @date November, 2013- Initial Version1611 !> - November, 2013- Initial Version 1633 1612 ! 1634 1613 !> @param[inout] td_file file structure … … 1673 1652 ! 1674 1653 !> @author J.Paul 1675 !> @date November, 2013- Initial Version1654 !> - November, 2013- Initial Version 1676 1655 ! 1677 1656 !> @param[in] td_file file structure … … 1738 1717 WRITE(*,'(/a)') " File variable" 1739 1718 DO ji=1,td_file%i_nvar 1740 CALL var_print(td_file%t_var(ji) ,.FALSE.)1719 CALL var_print(td_file%t_var(ji))!,.FALSE.) 1741 1720 ENDDO 1742 1721 ENDIF … … 1751 1730 ! 1752 1731 !> @author J.Paul 1753 !> @date November, 2013- Initial Version1732 !> - November, 2013- Initial Version 1754 1733 ! 1755 1734 !> @param[in] cd_file file structure … … 1790 1769 ! 1791 1770 !> @author J.Paul 1792 !> @date November, 2013 - Initial Version 1793 !> @date February, 2015 1794 !> - add case to not return date (yyyymmdd) at the end of filename 1795 !> @date February, 2015 1796 !> - add case to not return release number 1797 !> we assume release number only on one digit (ex : file_v3.5.nc) 1771 !> - November, 2013- Initial Version 1798 1772 ! 1799 1773 !> @param[in] cd_file file name (without suffix) … … 1829 1803 IF( .NOT. fct_is_num(file__get_number(2:)) )THEN 1830 1804 file__get_number='' 1831 ELSEIF( LEN(TRIM(file__get_number))-1 == 8 )THEN1832 ! date case yyyymmdd1833 file__get_number=''1834 ELSEIF( LEN(TRIM(file__get_number))-1 == 1 )THEN1835 ! release number case1836 file__get_number=''1837 1805 ENDIF 1838 1806 ELSE … … 1848 1816 ! 1849 1817 !> @author J.Paul 1850 !> @date November, 2013- Initial Version1818 !> - November, 2013- Initial Version 1851 1819 ! 1852 1820 !> @param[in] td_file file structure … … 1911 1879 ! 1912 1880 !> @author J.Paul 1913 !> @date November, 2013- Initial Version1881 !> - November, 2013- Initial Version 1914 1882 ! 1915 1883 !> @param[in] td_file file structure … … 1938 1906 ! 1939 1907 !> @author J.Paul 1940 !> @date November, 2013- Initial Version1908 !> - November, 2013- Initial Version 1941 1909 ! 1942 1910 !> @param[in] td_file file structure … … 2051 2019 ! 2052 2020 !> @author J.Paul 2053 !> @date November, 2013- Initial Version2021 !> - November, 2013- Initial Version 2054 2022 ! 2055 2023 !> @param[in] td_file array of file structure … … 2089 2057 !> 2090 2058 !> @author J.Paul 2091 !> @date September, 2014- Initial Version2059 !> - September, 2014- Initial Version 2092 2060 ! 2093 2061 !> @param[in] td_file array of file -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/filter.f90
r10248 r10251 18 18 !> - rad > cutoff : @f$ filter=0 @f$ 19 19 !> - 'blackman' 20 !> - rad < cutoff : @f$ filter=0.42 + 0.5*COS(\pi*\frac{rad}{cutoff}) + 21 !> 0.08*COS(2\pi*\frac{rad}{cutoff}) @f$ 20 !> - rad < cutoff : @f$ filter=0.42 + 0.5*COS(\pi*\frac{rad}{cutoff}) + 0.08*COS(2\pi*\frac{rad}{cutoff}) @f$ 22 21 !> - rad > cutoff : @f$ filter=0 @f$ 23 22 !> - 'gauss' … … 30 29 !> 31 30 !> td_var\%c_filter(2) string character is the number of turn to be done<br/> 32 !> td_var\%c_filter(3) string character is the cut-off frequency 33 ! > (count in number of mesh grid)<br/> 34 !> td_var\%c_filter(4) string character is the halo radius 35 !> (count in number of mesh grid)<br/> 36 !> td_var\%c_filter(5) string character is the alpha parameter 37 !> (for gauss and butterworth method)<br/> 31 !> td_var\%c_filter(3) string character is the cut-off frequency (count in number of mesh grid)<br/> 32 !> td_var\%c_filter(4) string character is the halo radius (count in number of mesh grid)<br/> 33 !> td_var\%c_filter(5) string character is the alpha parameter (for gauss and butterworth method)<br/> 38 34 !> 39 35 !> @note Filter method could be specify for each variable in namelist _namvar_, … … 44 40 !> The number of turn is specify using '*' separator.<br/> 45 41 !> Example: 46 !> - cn_varinfo='varname1:flt=2*hamming(@f$cutoff@f$,@f$radius@f$)', 47 !> 'varname2:flt=gauss(@f$cutoff@f$,@f$radius@f$,@f$\alpha@f$)' 42 !> - cn_varinfo='varname1:2*hamming(@f$cutoff@f$,@f$radius@f$)', 'varname2:gauss(@f$cutoff@f$,@f$radius@f$,@f$\alpha@f$)' 48 43 !> 49 44 !> to filter variable value:<br/> … … 111 106 !> 112 107 !> @author J.Paul 113 !> @date November, 2013- Initial Version108 !> - November, 2013- Initial Version 114 109 ! 115 110 !> @param[inout] td_var variable structure … … 255 250 !> 256 251 !> @author J.Paul 257 !> @date November, 2013- Initial Version252 !> - November, 2013- Initial Version 258 253 ! 259 254 !> @param[inout] td_var variable … … 301 296 302 297 !3-extrapolate 303 CALL extrap_fill_value( td_var ) !, id_iext=id_radius, id_jext=id_radius )298 CALL extrap_fill_value( td_var, id_iext=id_radius, id_jext=id_radius ) 304 299 305 300 !4-filtering … … 346 341 ! 347 342 !> @author J.Paul 348 !> @date November, 2013- Initial Version343 !> - November, 2013- Initial Version 349 344 ! 350 345 !> @param[inout] dd_value array of value to be filtered … … 398 393 !> 399 394 !> @author J.Paul 400 !> @date November, 2013- Initial Version395 !> - November, 2013- Initial Version 401 396 ! 402 397 !> @param[inout] dd_value array of value to be filtered … … 444 439 !> 445 440 !> @author J.Paul 446 !> @date November, 2013- Initial Version441 !> - November, 2013- Initial Version 447 442 ! 448 443 !> @param[inout] dd_value array of value to be filtered … … 487 482 !> 488 483 !> @author J.Paul 489 !> @date November, 2013- Initial Version484 !> - November, 2013- Initial Version 490 485 ! 491 486 !> @param[inout] dd_value array of value to be filtered … … 542 537 !> 543 538 !> @author J.Paul 544 !> @date November, 2013- Initial Version539 !> - Nov, 2013- Initial Version 545 540 ! 546 541 !> @param[inout] dd_value array of value to be filtered … … 595 590 ! 596 591 !> @author J.Paul 597 !> @date November, 2013- Initial Version592 !> - November, 2013- Initial Version 598 593 ! 599 594 !> @param[in] cd_name filter name … … 654 649 ! 655 650 !> @author J.Paul 656 !> @date November, 2013- Initial Version651 !> - November, 2013- Initial Version 657 652 ! 658 653 !> @param[in] cd_name filter name … … 700 695 ! 701 696 !> @author J.Paul 702 !> @date November, 2013- Initial Version697 !> - November, 2013- Initial Version 703 698 ! 704 699 !> @param[in] dd_cutoff cut-off frequency … … 754 749 ! 755 750 !> @author J.Paul 756 !> @date November, 2013- Initial Version751 !> - November, 2013- Initial Version 757 752 ! 758 753 !> @param[in] dd_cutoff cut-off frequency … … 813 808 ! 814 809 !> @author J.Paul 815 !> @date November, 2013- Initial Version810 !> - November, 2013- Initial Version 816 811 ! 817 812 !> @param[in] dd_cutoff cut-off frequency … … 868 863 ! 869 864 !> @author J.Paul 870 !> @date November, 2013- Initial Version865 !> - November, 2013- Initial Version 871 866 ! 872 867 !> @param[in] dd_cutoff cut-off frequency … … 927 922 ! 928 923 !> @author J.Paul 929 !> @date November, 2013- Initial Version924 !> - November, 2013- Initial Version 930 925 ! 931 926 !> @param[in] dd_cutoff cut-off frequency … … 983 978 !> 984 979 !> @author J.Paul 985 !> @date November, 2013- Initial Version980 !> - November, 2013- Initial Version 986 981 !> 987 982 !> @param[in] dd_cutoff cut-off frequency … … 1043 1038 !> 1044 1039 !> @author J.Paul 1045 !> @date November, 2013- Initial Version1040 !> - November, 2013- Initial Version 1046 1041 !> 1047 1042 !> @param[in] dd_cutoff cut-off frequency … … 1095 1090 !> 1096 1091 !> @author J.Paul 1097 !> @date November, 2013- Initial Version1092 !> - November, 2013- Initial Version 1098 1093 !> 1099 1094 !> @param[in] dd_cutoff cut-off frequency … … 1151 1146 !> 1152 1147 !> @author J.Paul 1153 !> @date November, 2013- Initial Version1148 !> - November, 2013- Initial Version 1154 1149 !> 1155 1150 !> @param[in] dd_cutoff cut-off frequency … … 1203 1198 !> 1204 1199 !> @author J.Paul 1205 !> @date November, 2013- Initial Version1200 !> - November, 2013- Initial Version 1206 1201 !> 1207 1202 !> @param[in] dd_cutoff cut-off frequency -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/function.f90
r10248 r10251 51 51 !> @endcode 52 52 !> 53 !> to check if character is real54 !> @code55 !> ll_is_real=fct_is_real(cd_var)56 !> @endcode57 !>58 53 !> to split string into substring and return one of the element:<br/> 59 54 !> @code … … 94 89 ! REVISION HISTORY: 95 90 !> @date November, 2013 - Initial Version 96 !> @date September, 2014 97 !> - add header 91 !> @date September, 2014 - add header 98 92 ! 99 93 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 112 106 PUBLIC :: fct_lower !< convert character from upper to lower case 113 107 PUBLIC :: fct_is_num !< check if character is numeric 114 PUBLIC :: fct_is_real !< check if character is real115 108 PUBLIC :: fct_split !< split string into substring 116 109 PUBLIC :: fct_basename !< return basename (name without path) … … 160 153 ! 161 154 !> @author J.Paul 162 !> @date September, 2014- Initial Version155 !> - September, 2014- Initial Version 163 156 ! 164 157 !> @param[in] cd_char string character … … 184 177 ! 185 178 !> @author J.Paul 186 !> @date September, 2014- Initial Version179 !> - September, 2014- Initial Version 187 180 ! 188 181 !> @param[in] cd_char string character … … 208 201 ! 209 202 !> @author J.Paul 210 !> @date November, 2013- Initial Version203 !> - Nov, 2013- Initial Version 211 204 ! 212 205 !> @param[in] cd_char string character … … 232 225 ! 233 226 !> @author J.Paul 234 !> @date November, 2013- Initial Version227 !> - November, 2013- Initial Version 235 228 ! 236 229 !> @param[in] cd_char string character … … 256 249 ! 257 250 !> @author J.Paul 258 !> @date November, 2013- Initial Version251 !> - November, 2013- Initial Version 259 252 ! 260 253 !> @param[in] cd_char string character … … 280 273 !> 281 274 !> @author J.Paul 282 !> @date November, 2013- Initial Version275 !> - November, 2013- Initial Version 283 276 !> 284 277 !> @param[in] cd_char string character … … 304 297 !> 305 298 !> @author J.Paul 306 !> @date November, 2013- Initial Version299 !> - November, 2013- Initial Version 307 300 !> 308 301 !> @param[in] cd_char string character … … 328 321 !> 329 322 !> @author J.Paul 330 !> @date November, 2013- Initial Version323 !> - November, 2013- Initial Version 331 324 !> 332 325 !> @return file id … … 351 344 ! 352 345 !> @author J.Paul 353 !> @date November, 2013- Initial Version346 !> - November, 2013- Initial Version 354 347 !> 355 348 !> @param[in] id_status … … 372 365 ! 373 366 !> @author J.Paul 374 !> @date November, 2014- Initial Version367 !> - November, 2014- Initial Version 375 368 !> 376 369 !> @param[in] cd_msg optional message to be added … … 394 387 !> 395 388 !> @author J.Paul 396 !> @date November, 2013- Initial Version389 !> - November, 2013- Initial Version 397 390 ! 398 391 !> @param[in] ld_var logical variable … … 416 409 !> 417 410 !> @author J.Paul 418 !> @date November, 2013- Initial Version411 !> - November, 2013- Initial Version 419 412 ! 420 413 !> @param[in] bd_var integer(1) variable … … 438 431 !> 439 432 !> @author J.Paul 440 !> @date November, 2013- Initial Version433 !> - November, 2013- Initial Version 441 434 ! 442 435 !> @param[in] sd_var integer(2) variable … … 460 453 !> 461 454 !> @author J.Paul 462 !> @date November, 2013- Initial Version455 !> - November, 2013- Initial Version 463 456 ! 464 457 !> @param[in] id_var integer(4) variable … … 482 475 !> 483 476 !> @author J.Paul 484 !> @date November, 2013- Initial Version477 !> - November, 2013- Initial Version 485 478 ! 486 479 !> @param[in] kd_var integer(8) variable … … 504 497 !> 505 498 !> @author J.Paul 506 !> @date November, 2013- Initial Version499 !> - November, 2013- Initial Version 507 500 ! 508 501 !> @param[in] rd_var real(4) variable … … 526 519 !> 527 520 !> @author J.Paul 528 !> @date November, 2013- Initial Version521 !> - November, 2013- Initial Version 529 522 ! 530 523 !> @param[in] dd_var real(8) variable … … 551 544 !> 552 545 !> @author J.Paul 553 !> @date November, 2013- Initial Version546 !> - November, 2013- Initial Version 554 547 ! 555 548 !> @param[in] cd_arr array of character … … 597 590 ! 598 591 !> @author J.Paul 599 !> @date November, 2013- Initial Version592 !> - November, 2013- Initial Version 600 593 ! 601 594 !> @param[in] cd_var character … … 654 647 ! 655 648 !> @author J.Paul 656 !> @date November, 2013- Initial Version649 !> - November, 2013- Initial Version 657 650 ! 658 651 !> @param[in] cd_var character … … 704 697 ! 705 698 !> @author J.Paul 706 !> @date November, 2013- Initial Version699 !> - November, 2013- Initial Version 707 700 ! 708 701 !> @param[in] cd_var character … … 730 723 END FUNCTION fct_is_num 731 724 !------------------------------------------------------------------- 732 !> @brief This function check if character is real number.733 !734 !> @details735 !> it allows exponantial and decimal number736 !> exemple : 1e6, 2.3737 !>738 !> @author J.Paul739 !> @date June, 2015 - Initial Version740 !741 !> @param[in] cd_var character742 !> @return character is numeric743 !-------------------------------------------------------------------744 PURE LOGICAL FUNCTION fct_is_real(cd_var)745 IMPLICIT NONE746 ! Argument747 CHARACTER(LEN=*), INTENT(IN) :: cd_var748 749 ! local variables750 LOGICAL :: ll_exp751 LOGICAL :: ll_dec752 753 ! loop indices754 INTEGER :: ji755 !----------------------------------------------------------------756 757 ll_exp=.TRUE.758 ll_dec=.FALSE.759 DO ji=1,LEN(TRIM(cd_var))760 IF( IACHAR(cd_var(ji:ji)) >= IACHAR('0') .AND. &761 & IACHAR(cd_var(ji:ji)) <= IACHAR('9') )THEN762 763 fct_is_real=.TRUE.764 ll_exp=.FALSE.765 766 ELSEIF( TRIM(cd_var(ji:ji))=='e' )THEN767 768 IF( ll_exp .OR. ji== LEN(TRIM(cd_var)) )THEN769 fct_is_real=.FALSE.770 EXIT771 ELSE772 ll_exp=.TRUE.773 ENDIF774 775 ELSEIF( TRIM(cd_var(ji:ji))=='.' )THEN776 777 IF( ll_dec )THEN778 fct_is_real=.FALSE.779 EXIT780 ELSE781 fct_is_real=.TRUE.782 ll_dec=.TRUE.783 ENDIF784 785 ELSE786 787 fct_is_real=.FALSE.788 EXIT789 790 ENDIF791 ENDDO792 793 END FUNCTION fct_is_real794 !-------------------------------------------------------------------795 725 !> @brief This function split string of character 796 726 !> using separator character, by default '|', … … 798 728 ! 799 729 !> @author J.Paul 800 !> @date November, 2013- Initial Version730 !> - November, 2013- Initial Version 801 731 ! 802 732 !> @param[in] cd_string string of character … … 878 808 ! 879 809 !> @author J.Paul 880 !> @date November, 2013- Initial Version810 !> - November, 2013- Initial Version 881 811 ! 882 812 !> @param[in] cd_string string of character … … 943 873 !> Optionally you could specify another separator. 944 874 !> @author J.Paul 945 !> @date November, 2013- Initial Version875 !> - November, 2013- Initial Version 946 876 ! 947 877 !> @param[in] cd_string filename … … 984 914 !> Optionally you could specify another separator. 985 915 !> @author J.Paul 986 !> @date November, 2013- Initial Version916 !> - November, 2013- Initial Version 987 917 ! 988 918 !> @param[in] cd_string filename -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/grid.f90
r10248 r10251 149 149 !> CALL grid_check_coincidence(td_coord0, td_coord1, 150 150 !> id_imin0, id_imax0, id_jmin0, id_jmax0 151 !> ,id_rho)151 !> [,id_rho]) 152 152 !> @endcode 153 153 !> - td_coord0 is coarse grid coordinate mpp structure … … 161 161 !> - id_jmax0 is coarse grid upper right corner j-indice of fine grid 162 162 !> domain 163 !> - id_rho is array of refinement factor 163 !> - id_rho is array of refinement factor (default 1) 164 164 !> 165 165 !> to add ghost cell at boundaries:<br/> … … 213 213 !> @date October, 2014 214 214 !> - use mpp file structure instead of file 215 !> @date February, 2015216 !> - add function grid_fill_small_msk to fill small domain inside bigger one217 215 ! 218 216 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 257 255 PUBLIC :: grid_split_domain !< compute closed sea domain 258 256 PUBLIC :: grid_fill_small_dom !< fill small closed sea with fill value 259 PUBLIC :: grid_fill_small_msk !< fill small domain inside bigger one260 257 261 258 ! get closest coarse grid indices of fine grid domain … … 355 352 !> @note need all processor files to be there 356 353 !> @author J.Paul 357 !> @date October, 2014- Initial Version354 !> - October, 2014- Initial Version 358 355 !> 359 356 !> @param[inout] td_file file structure … … 469 466 !> - compute East West overlap 470 467 !> 471 !> @note need all processor files 468 !> @note need all processor files to be there 472 469 !> @author J.Paul 473 !> @date October, 2014- Initial Version470 !> - October, 2014- Initial Version 474 471 !> 475 472 !> @param[in] td_mpp mpp structure … … 499 496 il_ew =-1 500 497 501 CALL logger_info("GRID GET INFO: look for "//TRIM(td_mpp%c_name))502 498 ! copy structure 503 499 tl_mpp=mpp_copy(td_mpp) … … 527 523 ENDIF 528 524 529 CALL logger_info("GRID GET INFO: perio "//TRIM(fct_str(il_perio)))530 531 525 SELECT CASE(il_perio) 532 526 CASE(3,4) 527 il_pivot=0 528 CASE(5,6) 533 529 il_pivot=1 534 CASE(5,6)535 il_pivot=0536 530 CASE(0,1,2) 537 531 il_pivot=1 … … 540 534 IF( il_pivot < 0 .OR. il_pivot > 1 )THEN 541 535 ! get pivot 542 CALL logger_info("GRID GET INFO: look for pivot ")543 536 il_pivot=grid_get_pivot(tl_mpp) 544 537 ENDIF … … 546 539 IF( il_perio < 0 .OR. il_perio > 6 )THEN 547 540 ! get periodicity 548 CALL logger_info("GRID GET INFO: look for perio ")549 541 il_perio=grid_get_perio(tl_mpp, il_pivot) 550 542 ENDIF … … 552 544 IF( il_ew < 0 )THEN 553 545 ! get periodicity 554 CALL logger_info("GRID GET INFO: look for overlap ")555 546 il_ew=grid_get_ew_overlap(tl_mpp) 556 547 ENDIF … … 604 595 !> 605 596 !> @author J.Paul 606 !> @date November, 2013 - Initial version597 !> - November, 2013- Subroutine written 607 598 !> @date September, 2014 608 599 !> - add dummy loop in case variable not over right point. … … 717 708 !> 718 709 !> @author J.Paul 719 !> @dateOctober, 2014 - Initial version710 !> - October, 2014 - Initial version 720 711 ! 721 712 !> @param[in] dd_value array of value … … 792 783 793 784 IF( ll_check )THEN 794 CALL logger_info("GRID GET PIVOT: F-pivot")785 CALL logger_info("GRID GET PIVOT: T-pivot") 795 786 grid__get_pivot_varT=0 796 787 ENDIF … … 810 801 !> 811 802 !> @author J.Paul 812 !> @dateOctober, 2014 - Initial version803 !> - October, 2014 - Initial version 813 804 ! 814 805 !> @param[in] dd_value array of value … … 885 876 886 877 IF( ll_check )THEN 887 CALL logger_info("GRID GET PIVOT: F-pivot")878 CALL logger_info("GRID GET PIVOT: T-pivot") 888 879 grid__get_pivot_varU=0 889 880 ENDIF … … 903 894 !> 904 895 !> @author J.Paul 905 !> @dateOctober, 2014 - Initial version896 !> - October, 2014 - Initial version 906 897 ! 907 898 !> @param[in] dd_value array of value … … 978 969 979 970 IF( ll_check )THEN 980 CALL logger_info("GRID GET PIVOT: F-pivot")971 CALL logger_info("GRID GET PIVOT: T-pivot") 981 972 grid__get_pivot_varV=0 982 973 ENDIF … … 996 987 !> 997 988 !> @author J.Paul 998 !> @dateOctober, 2014 - Initial version989 !> - October, 2014 - Initial version 999 990 ! 1000 991 !> @param[in] dd_value array of value … … 1071 1062 1072 1063 IF( ll_check )THEN 1073 CALL logger_info("GRID GET PIVOT: F-pivot")1064 CALL logger_info("GRID GET PIVOT: T-pivot") 1074 1065 grid__get_pivot_varF=0 1075 1066 ENDIF … … 1092 1083 !> 1093 1084 !> @author J.Paul 1094 !> @date Ocotber, 2014- Initial version1085 !> - Ocotber, 2014- Initial version 1095 1086 ! 1096 1087 !> @param[in] td_file file structure … … 1181 1172 !> 1182 1173 !> @author J.Paul 1183 !> @dateOctober, 2014 - Initial version1174 !> - October, 2014 - Initial version 1184 1175 ! 1185 1176 !> @param[in] td_mpp mpp file structure … … 1286 1277 !> 1: cyclic east-west boundary 1287 1278 !> 2: symmetric boundary condition across the equator 1288 !> 3: North fold boundary (with a T-point pivot)1289 !> 4: North fold boundary (with a T-point pivot) and cyclic east-west boundary1290 !> 5: North fold boundary (with a F-point pivot)1291 !> 6: North fold boundary (with a F-point pivot) and cyclic east-west boundary1279 !> 3: North fold boundary (with a F-point pivot) 1280 !> 4: North fold boundary (with a F-point pivot) and cyclic east-west boundary 1281 !> 5: North fold boundary (with a T-point pivot) 1282 !> 6: North fold boundary (with a T-point pivot) and cyclic east-west boundary 1292 1283 !> 1293 1284 !> @warning pivot point should have been computed before run this script. see grid_get_pivot. 1294 1285 !> 1295 1286 !> @author J.Paul 1296 !> @date November, 2013 - Initial version1287 !> - November, 2013- Subroutine written 1297 1288 !> @date October, 2014 1298 1289 !> - work on variable structure instead of file structure … … 1461 1452 !> 1462 1453 !> @author J.Paul 1463 !> @dateOctober, 2014 - Initial version1454 !> - October, 2014 - Initial version 1464 1455 !> 1465 1456 !> @param[in] td_file file structure … … 1546 1537 !> 1: cyclic east-west boundary 1547 1538 !> 2: symmetric boundary condition across the equator 1548 !> 3: North fold boundary (with a T-point pivot)1549 !> 4: North fold boundary (with a T-point pivot) and cyclic east-west boundary1550 !> 5: North fold boundary (with a F-point pivot)1551 !> 6: North fold boundary (with a F-point pivot) and cyclic east-west boundary1539 !> 3: North fold boundary (with a F-point pivot) 1540 !> 4: North fold boundary (with a F-point pivot) and cyclic east-west boundary 1541 !> 5: North fold boundary (with a T-point pivot) 1542 !> 6: North fold boundary (with a T-point pivot) and cyclic east-west boundary 1552 1543 !> 1553 1544 !> @warning pivot point should have been computed before run this script. see grid_get_pivot. 1554 1545 !> 1555 1546 !> @author J.Paul 1556 !> @dateOctober, 2014 - Initial version1547 !> - October, 2014 - Initial version 1557 1548 ! 1558 1549 !> @param[in] td_mpp mpp file structure … … 1643 1634 ! 1644 1635 !> @author J.Paul 1645 !> @date November, 2013- Initial Version1636 !> - November, 2013- Initial Version 1646 1637 !> @date October, 2014 1647 1638 !> - work on mpp file structure instead of file structure … … 1755 1746 !> 1756 1747 !> @author J.Paul 1757 !> @date October, 2014- Initial Version1748 !> - October, 2014- Initial Version 1758 1749 !> 1759 1750 !> @param[in] td_file file structure … … 1806 1797 ! 1807 1798 !> @author J.Paul 1808 !> @date November, 2013- Initial Version1799 !> - November, 2013- Initial Version 1809 1800 !> @date October, 2014 1810 1801 !> - work on mpp file structure instead of file structure … … 1862 1853 !> 1863 1854 !> @author J.Paul 1864 !> @date November, 2013- Initial Version1855 !> - November, 2013- Initial Version 1865 1856 !> 1866 1857 !> @param[in] td_lat latitude variable structure … … 1899 1890 ! 1900 1891 !> @author J.Paul 1901 !> @date November, 2013- Initial Version1892 !> - November, 2013- Initial Version 1902 1893 !> @date October, 2014 1903 1894 !> - work on mpp file structure instead of file structure … … 1987 1978 !> 1988 1979 !> @author J.Paul 1989 !> @date November, 2013- Initial Version1980 !> - November, 2013- Initial Version 1990 1981 !> @date September, 2014 1991 1982 !> - use grid point to read coordinates variable. 1992 1983 !> @date October, 2014 1993 1984 !> - work on mpp file structure instead of file structure 1994 !> @date February, 20151995 !> - use longitude or latitude as standard name, if can not find1996 !> longitude_T, latitude_T...1997 1985 !> 1998 1986 !> @param[in] td_coord0 coarse grid coordinate mpp structure … … 2016 2004 2017 2005 ! local variable 2018 CHARACTER(LEN= 1) :: cl_point 2019 CHARACTER(LEN=lc) :: cl_name 2020 2021 INTEGER(i4) :: il_imin0 2022 INTEGER(i4) :: il_imax0 2023 INTEGER(i4) :: il_jmin0 2024 INTEGER(i4) :: il_jmax0 2025 INTEGER(i4) :: il_ind 2026 2027 INTEGER(i4), DIMENSION(2,2) :: il_xghost0 2028 INTEGER(i4), DIMENSION(2,2) :: il_xghost1 2029 2030 INTEGER(i4), DIMENSION(:) , ALLOCATABLE :: il_rho 2031 2032 TYPE(TVAR) :: tl_lon0 2033 TYPE(TVAR) :: tl_lat0 2034 TYPE(TVAR) :: tl_lon1 2035 TYPE(TVAR) :: tl_lat1 2036 2037 TYPE(TMPP) :: tl_coord0 2038 TYPE(TMPP) :: tl_coord1 2006 TYPE(TMPP) :: tl_coord0 2007 TYPE(TMPP) :: tl_coord1 2008 2009 TYPE(TVAR) :: tl_lon0 2010 TYPE(TVAR) :: tl_lat0 2011 TYPE(TVAR) :: tl_lon1 2012 TYPE(TVAR) :: tl_lat1 2013 2014 INTEGER(i4), DIMENSION(:), ALLOCATABLE :: il_rho 2015 2016 INTEGER(i4), DIMENSION(2,2) :: il_xghost0 2017 INTEGER(i4), DIMENSION(2,2) :: il_xghost1 2018 2019 INTEGER(i4) :: il_imin0 2020 INTEGER(i4) :: il_imax0 2021 INTEGER(i4) :: il_jmin0 2022 INTEGER(i4) :: il_jmax0 2023 2024 CHARACTER(LEN= 1) :: cl_point 2025 CHARACTER(LEN=lc) :: cl_name 2039 2026 2040 2027 ! loop indices … … 2070 2057 ! read coarse longitue and latitude 2071 2058 WRITE(cl_name,*) 'longitude_'//TRIM(cl_point) 2072 il_ind=var_get_id(tl_coord0%t_proc(1)%t_var(:), cl_name)2073 IF( il_ind == 0 )THEN2074 CALL logger_warn("GRID GET COARSE INDEX: no variable "//&2075 & TRIM(cl_name)//" in file "//TRIM(tl_coord0%c_name)//". &2076 & try to use longitude.")2077 WRITE(cl_name,*) 'longitude'2078 ENDIF2079 2059 tl_lon0=iom_mpp_read_var(tl_coord0, TRIM(cl_name)) 2080 2081 2060 WRITE(cl_name,*) 'latitude_'//TRIM(cl_point) 2082 il_ind=var_get_id(tl_coord0%t_proc(1)%t_var(:), cl_name)2083 IF( il_ind == 0 )THEN2084 CALL logger_warn("GRID GET COARSE INDEX: no variable "//&2085 & TRIM(cl_name)//" in file "//TRIM(tl_coord0%c_name)//". &2086 & try to use latitude.")2087 WRITE(cl_name,*) 'latitude'2088 ENDIF2089 2061 tl_lat0=iom_mpp_read_var(tl_coord0, TRIM(cl_name)) 2090 2062 … … 2105 2077 ! read fine longitue and latitude 2106 2078 WRITE(cl_name,*) 'longitude_'//TRIM(cl_point) 2107 il_ind=var_get_id(tl_coord1%t_proc(1)%t_var(:), cl_name)2108 IF( il_ind == 0 )THEN2109 CALL logger_warn("GRID GET COARSE INDEX: no variable "//&2110 & TRIM(cl_name)//" in file "//TRIM(tl_coord1%c_name)//". &2111 & try to use longitude.")2112 WRITE(cl_name,*) 'longitude'2113 ENDIF2114 2079 tl_lon1=iom_mpp_read_var(tl_coord1, TRIM(cl_name)) 2115 2116 2080 WRITE(cl_name,*) 'latitude_'//TRIM(cl_point) 2117 il_ind=var_get_id(tl_coord1%t_proc(1)%t_var(:), cl_name)2118 IF( il_ind == 0 )THEN2119 CALL logger_warn("GRID GET COARSE INDEX: no variable "//&2120 & TRIM(cl_name)//" in file "//TRIM(tl_coord1%c_name)//". &2121 & try to use latitude.")2122 WRITE(cl_name,*) 'latitude'2123 ENDIF2124 2081 tl_lat1=iom_mpp_read_var(tl_coord1, TRIM(cl_name)) 2125 2082 … … 2170 2127 !> 2171 2128 !> @author J.Paul 2172 !> @date November, 2013- Initial Version2129 !> - November, 2013- Initial Version 2173 2130 !> @date September, 2014 2174 2131 !> - use grid point to read coordinates variable. 2175 2132 !> @date October, 2014 2176 2133 !> - work on mpp file structure instead of file structure 2177 !> @date February, 20152178 !> - use longitude or latitude as standard name, if can not find2179 !> longitude_T, latitude_T...2180 2134 !> 2181 2135 !> @param[in] td_longitude0 coarse grid longitude … … 2200 2154 2201 2155 ! local variable 2202 CHARACTER(LEN= 1) :: cl_point 2203 CHARACTER(LEN=lc) :: cl_name 2204 2205 INTEGER(i4) :: il_ind 2206 2207 INTEGER(i4), DIMENSION(:) , ALLOCATABLE :: il_rho 2208 2209 INTEGER(i4), DIMENSION(2,2) :: il_xghost 2210 2211 TYPE(TVAR) :: tl_lon1 2212 TYPE(TVAR) :: tl_lat1 2213 2214 TYPE(TMPP) :: tl_coord1 2156 TYPE(TMPP) :: tl_coord1 2157 2158 TYPE(TVAR) :: tl_lon1 2159 TYPE(TVAR) :: tl_lat1 2160 2161 INTEGER(i4), DIMENSION(:), ALLOCATABLE :: il_rho 2162 2163 INTEGER(i4), DIMENSION(2,2) :: il_xghost 2164 2165 CHARACTER(LEN= 1) :: cl_point 2166 CHARACTER(LEN=lc) :: cl_name 2215 2167 2216 2168 ! loop indices … … 2257 2209 ! read fine longitue and latitude 2258 2210 WRITE(cl_name,*) 'longitude_'//TRIM(cl_point) 2259 il_ind=var_get_id(tl_coord1%t_proc(1)%t_var(:), cl_name)2260 IF( il_ind == 0 )THEN2261 CALL logger_warn("GRID GET COARSE INDEX: no variable "//&2262 & TRIM(cl_name)//"in file "//TRIM(tl_coord1%c_name)//". &2263 & try to use longitude.")2264 WRITE(cl_name,*) 'longitude'2265 ENDIF2266 2211 tl_lon1=iom_mpp_read_var(tl_coord1, TRIM(cl_name)) 2267 2268 2212 WRITE(cl_name,*) 'latitude_'//TRIM(cl_point) 2269 il_ind=var_get_id(tl_coord1%t_proc(1)%t_var(:), cl_name)2270 IF( il_ind == 0 )THEN2271 CALL logger_warn("GRID GET COARSE INDEX: no variable "//&2272 & TRIM(cl_name)//"in file "//TRIM(tl_coord1%c_name)//". &2273 & try to use longitude.")2274 WRITE(cl_name,*) 'latitude'2275 ENDIF2276 2213 tl_lat1=iom_mpp_read_var(tl_coord1, TRIM(cl_name)) 2277 2214 … … 2307 2244 !> 2308 2245 !> @author J.Paul 2309 !> @date November, 2013- Initial Version2246 !> - November, 2013- Initial Version 2310 2247 !> @date September, 2014 2311 2248 !> - use grid point to read coordinates variable. 2312 2249 !> @date October, 2014 2313 2250 !> - work on mpp file structure instead of file structure 2314 !> @date February, 20152315 !> - use longitude or latitude as standard name, if can not find2316 !> longitude_T, latitude_T...2317 2251 !> 2318 2252 !> @param[in] td_coord0 coarse grid coordinate mpp structure … … 2337 2271 2338 2272 ! local variable 2339 CHARACTER(LEN= 1) :: cl_point 2340 CHARACTER(LEN=lc) :: cl_name 2341 2342 INTEGER(i4) :: il_imin0 2343 INTEGER(i4) :: il_imax0 2344 INTEGER(i4) :: il_jmin0 2345 INTEGER(i4) :: il_jmax0 2346 INTEGER(i4) :: il_ind 2347 2348 INTEGER(i4), DIMENSION(:), ALLOCATABLE :: il_rho 2349 2350 INTEGER(i4), DIMENSION(2,2) :: il_xghost 2351 2352 TYPE(TVAR) :: tl_lon0 2353 TYPE(TVAR) :: tl_lat0 2354 2355 TYPE(TMPP) :: tl_coord0 2273 TYPE(TMPP) :: tl_coord0 2274 2275 TYPE(TVAR) :: tl_lon0 2276 TYPE(TVAR) :: tl_lat0 2277 2278 INTEGER(i4), DIMENSION(:), ALLOCATABLE :: il_rho 2279 2280 INTEGER(i4), DIMENSION(2,2) :: il_xghost 2281 2282 INTEGER(i4) :: il_imin0 2283 INTEGER(i4) :: il_imax0 2284 INTEGER(i4) :: il_jmin0 2285 INTEGER(i4) :: il_jmax0 2286 2287 CHARACTER(LEN= 1) :: cl_point 2288 CHARACTER(LEN=lc) :: cl_name 2356 2289 2357 2290 ! loop indices … … 2397 2330 ! read coarse longitue and latitude 2398 2331 WRITE(cl_name,*) 'longitude_'//TRIM(cl_point) 2399 il_ind=var_get_id(tl_coord0%t_proc(1)%t_var(:), cl_name)2400 IF( il_ind == 0 )THEN2401 CALL logger_warn("GRID GET COARSE INDEX: no variable "//&2402 & TRIM(cl_name)//"in file "//TRIM(tl_coord0%c_name)//". &2403 & try to use longitude.")2404 WRITE(cl_name,*) 'longitude'2405 ENDIF2406 2332 tl_lon0=iom_mpp_read_var(tl_coord0, TRIM(cl_name)) 2407 2408 2333 WRITE(cl_name,*) 'latitude_'//TRIM(cl_point) 2409 il_ind=var_get_id(tl_coord0%t_proc(1)%t_var(:), cl_name)2410 IF( il_ind == 0 )THEN2411 CALL logger_warn("GRID GET COARSE INDEX: no variable "//&2412 & TRIM(cl_name)//"in file "//TRIM(tl_coord0%c_name)//". &2413 & try to use latitude.")2414 WRITE(cl_name,*) 'latitude'2415 ENDIF2416 2334 tl_lat0=iom_mpp_read_var(tl_coord0, TRIM(cl_name)) 2417 2335 … … 2459 2377 !> 2460 2378 !> @author J.Paul 2461 !> @date November, 2013- Initial Version2379 !> - November, 2013- Initial Version 2462 2380 !> @date September, 2014 2463 2381 !> - check grid point … … 2602 2520 CALL grid_del_ghost(tl_lon0, il_xghost0(:,:)) 2603 2521 CALL grid_del_ghost(tl_lat0, il_xghost0(:,:)) 2604 2522 2605 2523 ! "global" coarse grid indice 2606 2524 il_imin0=1 … … 2650 2568 IF( dl_lon1_ll == tl_lon1%d_fill .OR. & 2651 2569 & dl_lat1_ll == tl_lat1%d_fill )THEN 2652 CALL logger_debug("GRID GET COARSE INDEX: lon "//&2653 & TRIM(fct_str(dl_lon1_ll))//" "//&2654 & TRIM(fct_str(tl_lon1%d_fill)) )2655 CALL logger_debug("GRID GET COARSE INDEX: lat "//&2656 & TRIM(fct_str(dl_lat1_ll))//" "//&2657 & TRIM(fct_str(tl_lat1%d_fill)) )2658 2570 CALL logger_error("GRID GET COARSE INDEX: lower left corner "//& 2659 2571 & "point is FillValue. remove ghost cell "//& … … 2720 2632 ji = il_iul(1) 2721 2633 jj = il_iul(2) 2634 2722 2635 IF( ABS(tl_lon0%d_value(ji,jj,1,1)-dl_lon1_ul) > dp_delta )THEN 2723 2636 IF(tl_lon0%d_value(ji,jj,1,1) > dl_lon1_ul )THEN … … 2734 2647 ENDIF 2735 2648 ENDIF 2649 2736 2650 IF( ABS(tl_lat0%d_value(ji,jj,1,1)-dl_lat1_ul) > dp_delta )THEN 2737 2651 IF(tl_lat0%d_value(ji,jj,1,1) < dl_lat1_ul )THEN … … 2884 2798 ! 2885 2799 !> @author J.Paul 2886 !> @date November, 2013- Initial Version2800 !> - November, 2013- Initial Version 2887 2801 ! 2888 2802 !> @param[in] td_lon longitude structure … … 2952 2866 !> 2953 2867 !> @author J.Paul 2954 !> @date November, 2013 - Initial Version 2955 !> @date February, 2015 - change dichotomy method to manage ORCA grid 2868 !> - November, 2013- Initial Version 2956 2869 ! 2957 2870 !> @param[in] dd_lon0 coarse grid array of longitude … … 2959 2872 !> @param[in] dd_lon1 fine grid longitude 2960 2873 !> @param[in] dd_lat1 fine grid latitude 2961 !> @param[in] dd_fill fill value2962 2874 !> @return coarse grid indices of closest point of fine grid point 2963 !------------------------------------------------------------------- 2964 FUNCTION grid_get_closest( dd_lon0, dd_lat0, dd_lon1, dd_lat1, dd_fill ) 2875 !> 2876 !------------------------------------------------------------------- 2877 FUNCTION grid_get_closest( dd_lon0, dd_lat0, dd_lon1, dd_lat1 ) 2965 2878 IMPLICIT NONE 2966 2879 ! Argument … … 2969 2882 REAL(dp), INTENT(IN) :: dd_lon1 2970 2883 REAL(dp), INTENT(IN) :: dd_lat1 2971 REAL(dp), INTENT(IN), OPTIONAL :: dd_fill2972 2884 2973 2885 ! function … … 3017 2929 3018 2930 ll_north=.FALSE. 3019 ll_continue=.FALSE. 3020 3021 ! avoid to use fillvalue for reduce domain on first time 3022 IF( PRESENT(dd_fill) )THEN 3023 DO WHILE( ALL(dl_lon0(il_isup,:) == dd_fill) ) 3024 il_isup=il_isup-1 3025 ENDDO 3026 DO WHILE( ALL(dl_lon0(il_iinf,:) == dd_fill) ) 3027 il_iinf=il_iinf+1 3028 ENDDO 3029 DO WHILE( ALL(dd_lat0(:,il_jsup) == dd_fill) ) 3030 il_jsup=il_jsup-1 3031 ENDDO 3032 DO WHILE( ALL(dd_lat0(:,il_jinf) == dd_fill) ) 3033 il_jinf=il_jinf+1 3034 ENDDO 2931 ll_continue=.TRUE. 2932 2933 ! look for meridian 0°/360° 2934 il_jmid = il_jinf + INT(il_shape(2)/2) 2935 il_ind(:) = MAXLOC( dl_lon0(:,il_jmid), dl_lon0(:,il_jmid) <= 360._dp ) 2936 2937 il_imid=il_ind(1) 2938 2939 IF( dl_lon1 == dl_lon0(il_imid,il_jmid) .AND. & 2940 & dd_lat1 == dd_lat0(il_imid,il_jmid) )THEN 2941 2942 il_iinf = il_imid ; il_isup = il_imid 2943 il_jinf = il_jmid ; il_jsup = il_jmid 2944 2945 ll_continue=.FALSE. 2946 2947 ELSE 2948 IF( dl_lon1 < dl_lon0(il_isup,il_jmid) .AND. & 2949 & il_imid /= il_isup )THEN 2950 2951 ! point east 2952 il_iinf = il_imid 2953 2954 ELSE IF( dl_lon1 > dl_lon0(il_iinf,il_jmid) .AND. & 2955 & il_imid /= il_iinf )THEN 2956 2957 ! point west 2958 il_isup = il_imid 2959 2960 ENDIF 3035 2961 3036 2962 il_shape(1)= il_isup - il_iinf + 1 3037 2963 il_shape(2)= il_jsup - il_jinf + 1 3038 2964 3039 ENDIF 3040 3041 ! special case for north ORCA grid 3042 IF( dd_lat1 > 19. .AND. dl_lon1 < 74. )THEN 3043 ll_north=.TRUE. 3044 ENDIF 3045 3046 IF( .NOT. ll_north )THEN 3047 ! look for meridian 0°/360° 2965 il_imid = il_iinf + INT(il_shape(1)/2) 3048 2966 il_jmid = il_jinf + INT(il_shape(2)/2) 3049 il_ind(:) = MAXLOC( dl_lon0(il_iinf:il_isup,il_jmid), & 3050 & dl_lon0(il_iinf:il_isup,il_jmid) <= 360._dp ) 3051 3052 il_imid=il_ind(1) 2967 2968 ! exit if too close from north fold (safer) 2969 IF( dd_lat0(il_imid,il_jmid) > 50.0 ) ll_north=.TRUE. 2970 2971 ! exit when close enough of point 2972 IF( ANY(il_shape(:) < 10 ) ) ll_continue=.FALSE. 2973 ENDIF 2974 2975 ! 2976 DO WHILE( ll_continue .AND. .NOT. ll_north ) 3053 2977 3054 2978 IF( dl_lon1 == dl_lon0(il_imid,il_jmid) .AND. & … … 3058 2982 il_jinf = il_jmid ; il_jsup = il_jmid 3059 2983 2984 ll_continue=.FALSE. 2985 3060 2986 ELSE 3061 IF( ALL(dl_lon0(il_isup,il_jinf:il_jsup) > dl_lon1 ) .AND. & 3062 & il_imid /= il_isup )THEN 3063 ! 0 < lon1 < lon0(isup) 2987 IF( dl_lon1 > dl_lon0(il_imid,il_jmid) )THEN 2988 3064 2989 ! point east 3065 il_iinf = il_imid+1 3066 ll_continue=.TRUE. 3067 3068 ELSE IF( ALL(dl_lon0(il_iinf,il_jinf:il_jsup) < dl_lon1 ) .AND. & 3069 & il_imid /= il_iinf )THEN 3070 ! lon0(iinf) < lon1 < 360 2990 il_iinf = il_imid 2991 2992 ELSE IF(dl_lon1 < dl_lon0(il_imid,il_jmid) )THEN 2993 3071 2994 ! point west 3072 2995 il_isup = il_imid 3073 ll_continue=.TRUE.3074 2996 3075 2997 ENDIF 3076 2998 3077 il_shape(1)= il_isup - il_iinf + 1 3078 il_shape(2)= il_jsup - il_jinf + 1 3079 3080 il_imid = il_iinf + INT(il_shape(1)/2) 3081 il_jmid = il_jinf + INT(il_shape(2)/2) 3082 3083 ! exit when close enough of point 3084 IF( ANY(il_shape(:) < 10 ) ) ll_continue=.FALSE. 3085 ENDIF 3086 ENDIF 3087 3088 ! 3089 DO WHILE( ll_continue .AND. .NOT. ll_north ) 3090 3091 ll_continue=.FALSE. 3092 IF( dl_lon1 == dl_lon0(il_imid,il_jmid) .AND. & 3093 & dd_lat1 == dd_lat0(il_imid,il_jmid) )THEN 3094 3095 il_iinf = il_imid ; il_isup = il_imid 3096 il_jinf = il_jmid ; il_jsup = il_jmid 3097 3098 ELSE 3099 IF( ALL(dl_lon0(il_imid,il_jinf:il_jsup) < dl_lon1) )THEN 3100 3101 ! point east 3102 il_iinf = il_imid 3103 ll_continue=.TRUE. 3104 3105 ELSE IF( ALL(dl_lon0(il_imid,il_jinf:il_jsup) > dl_lon1) )THEN 3106 3107 ! point west 3108 il_isup = il_imid 3109 ll_continue=.TRUE. 3110 3111 ENDIF 3112 3113 IF( ALL(dd_lat0(il_iinf:il_isup,il_jmid) < dd_lat1) )THEN 2999 IF( dd_lat1 > dd_lat0(il_imid,il_jmid) )THEN 3114 3000 3115 3001 ! point north 3116 3002 il_jinf = il_jmid 3117 ll_continue=.TRUE. 3118 3119 ELSE IF( ALL(dd_lat0(il_iinf:il_isup,il_jmid) > dd_lat1) )THEN 3003 3004 ELSE IF(dd_lat1 < dd_lat0(il_imid,il_jmid) )THEN 3120 3005 3121 3006 ! point south 3122 3007 il_jsup = il_jmid 3123 ll_continue=.TRUE.3124 3008 3125 3009 ENDIF … … 3130 3014 il_imid = il_iinf + INT(il_shape(1)/2) 3131 3015 il_jmid = il_jinf + INT(il_shape(2)/2) 3016 3017 ! exit if too close from north fold (safer) 3018 IF( dd_lat0(il_imid,il_jmid) > 50.0 ) ll_north=.TRUE. 3132 3019 3133 3020 ! exit when close enough of point … … 3162 3049 ! 3163 3050 !> @author J.Paul 3164 !> @date November, 2013- Initial Version3051 !> - November, 2013- Initial Version 3165 3052 ! 3166 3053 !> @param[in] dd_lon grid longitude array … … 3168 3055 !> @param[in] dd_lonA longitude of point A 3169 3056 !> @param[in] dd_latA latitude of point A 3170 !> @param[in] dd_fill3171 3057 !> @return array of distance between point A and grid points. 3172 3058 !------------------------------------------------------------------- 3173 FUNCTION grid_distance(dd_lon, dd_lat, dd_lonA, dd_latA 3059 FUNCTION grid_distance(dd_lon, dd_lat, dd_lonA, dd_latA) 3174 3060 IMPLICIT NONE 3175 3061 ! Argument … … 3224 3110 DO ji=1,il_shape(1) 3225 3111 IF( dl_lon(ji,jj) == dl_lonA .AND. & 3226 & dl_lat(ji,jj) == dl_la tA )THEN3112 & dl_lat(ji,jj) == dl_laTA )THEN 3227 3113 grid_distance(ji,jj)=0.0 3228 3114 ELSE 3229 3115 dl_tmp= SIN(dl_latA)*SIN(dl_lat(ji,jj)) + & 3230 & COS(dl_latA)*COS(dl_lat(ji,jj)) * & 3231 & COS(dl_lon(ji,jj)-dl_lonA) 3116 & COS(dl_latA)*COS(dl_lat(ji,jj))*COS(dl_lon(ji,jj)-dl_lonA) 3232 3117 ! check to avoid mistake with ACOS 3233 3118 IF( dl_tmp < -1.0 ) dl_tmp = -1.0 … … 3251 3136 ! 3252 3137 !> @author J.Paul 3253 !> @date September, 2014- Initial Version3138 !> - September, 2014- Initial Version 3254 3139 !> @date October, 2014 3255 3140 !> - work on mpp file structure instead of file structure … … 3285 3170 3286 3171 ! local variable 3287 INTEGER(i4) :: il_imin0 3288 INTEGER(i4) :: il_jmin0 3289 INTEGER(i4) :: il_imax0 3290 INTEGER(i4) :: il_jmax0 3291 INTEGER(i4) :: il_ind 3172 INTEGER(i4) :: il_imin0 3173 INTEGER(i4) :: il_jmin0 3174 INTEGER(i4) :: il_imax0 3175 INTEGER(i4) :: il_jmax0 3292 3176 3293 INTEGER(i4), DIMENSION(:), ALLOCATABLE 3177 INTEGER(i4), DIMENSION(:), ALLOCATABLE :: il_rho 3294 3178 3295 INTEGER(i4), DIMENSION(2,2) 3296 INTEGER(i4), DIMENSION(2,2) 3297 3298 CHARACTER(LEN= 1) 3299 CHARACTER(LEN=lc) 3179 INTEGER(i4), DIMENSION(2,2) :: il_xghost0 3180 INTEGER(i4), DIMENSION(2,2) :: il_xghost1 3181 3182 CHARACTER(LEN= 1) :: cl_point 3183 CHARACTER(LEN=lc) :: cl_name 3300 3184 3301 3185 REAL(dp) , DIMENSION(:,:), ALLOCATABLE :: dl_lon0 … … 3304 3188 REAL(dp) , DIMENSION(:,:), ALLOCATABLE :: dl_lat1 3305 3189 3306 TYPE(TVAR) 3307 TYPE(TVAR) 3308 TYPE(TVAR) 3309 TYPE(TVAR) 3310 3311 TYPE(TMPP) 3312 TYPE(TMPP) 3190 TYPE(TVAR) :: tl_lon0 3191 TYPE(TVAR) :: tl_lat0 3192 TYPE(TVAR) :: tl_lon1 3193 TYPE(TVAR) :: tl_lat1 3194 3195 TYPE(TMPP) :: tl_coord0 3196 TYPE(TMPP) :: tl_coord1 3313 3197 3314 3198 ! loop indices … … 3343 3227 ! read coarse longitue and latitude 3344 3228 WRITE(cl_name,*) 'longitude_'//TRIM(cl_point) 3345 il_ind=var_get_id(tl_coord0%t_proc(1)%t_var(:), cl_name)3346 IF( il_ind == 0 )THEN3347 CALL logger_warn("GRID GET FINE OFFSET: no variable "//&3348 & TRIM(cl_name)//" in file "//TRIM(tl_coord0%c_name)//". &3349 & try to use longitude.")3350 WRITE(cl_name,*) 'longitude'3351 ENDIF3352 3229 tl_lon0=iom_mpp_read_var(tl_coord0, TRIM(cl_name)) 3353 3354 3230 WRITE(cl_name,*) 'latitude_'//TRIM(cl_point) 3355 il_ind=var_get_id(tl_coord0%t_proc(1)%t_var(:), cl_name)3356 IF( il_ind == 0 )THEN3357 CALL logger_warn("GRID GET FINE OFFSET: no variable "//&3358 & TRIM(cl_name)//" in file "//TRIM(tl_coord0%c_name)//". &3359 & try to use latitude.")3360 WRITE(cl_name,*) 'latitude'3361 ENDIF3362 3231 tl_lat0=iom_mpp_read_var(tl_coord0, TRIM(cl_name)) 3363 3232 … … 3398 3267 ! read fine longitue and latitude 3399 3268 WRITE(cl_name,*) 'longitude_'//TRIM(cl_point) 3400 il_ind=var_get_id(tl_coord1%t_proc(1)%t_var(:), cl_name)3401 IF( il_ind == 0 )THEN3402 CALL logger_warn("GRID GET FINE OFFSET: no variable "//&3403 & TRIM(cl_name)//" in file "//TRIM(tl_coord1%c_name)//". &3404 & try to use longitude.")3405 WRITE(cl_name,*) 'longitude'3406 ENDIF3407 3269 tl_lon1=iom_mpp_read_var(tl_coord1, TRIM(cl_name)) 3408 3409 3270 WRITE(cl_name,*) 'latitude_'//TRIM(cl_point) 3410 il_ind=var_get_id(tl_coord1%t_proc(1)%t_var(:), cl_name)3411 IF( il_ind == 0 )THEN3412 CALL logger_warn("GRID GET FINE OFFSET: no variable "//&3413 & TRIM(cl_name)//" in file "//TRIM(tl_coord1%c_name)//". &3414 & try to use latitude.")3415 WRITE(cl_name,*) 'latitude'3416 ENDIF3417 3271 tl_lat1=iom_mpp_read_var(tl_coord1, TRIM(cl_name)) 3418 3272 … … 3464 3318 ! 3465 3319 !> @author J.Paul 3466 !> @date September, 2014- Initial Version3320 !> - September, 2014- Initial Version 3467 3321 !> @date October, 2014 3468 3322 !> - work on mpp file structure instead of file structure … … 3500 3354 3501 3355 ! local variable 3502 INTEGER(i4) :: il_ind 3503 INTEGER(i4), DIMENSION(2,2) :: il_xghost1 3504 INTEGER(i4), DIMENSION(:), ALLOCATABLE :: il_rho 3356 INTEGER(i4), DIMENSION(:), ALLOCATABLE :: il_rho 3505 3357 3506 CHARACTER(LEN= 1) :: cl_point 3507 CHARACTER(LEN=lc) :: cl_name 3358 INTEGER(i4), DIMENSION(2,2) :: il_xghost1 3359 3360 CHARACTER(LEN= 1) :: cl_point 3361 CHARACTER(LEN=lc) :: cl_name 3508 3362 3509 3363 REAL(dp) , DIMENSION(:,:), ALLOCATABLE :: dl_lon1 3510 3364 REAL(dp) , DIMENSION(:,:), ALLOCATABLE :: dl_lat1 3511 3365 3512 TYPE(TVAR) 3513 TYPE(TVAR) 3514 3515 TYPE(TMPP) 3366 TYPE(TVAR) :: tl_lon1 3367 TYPE(TVAR) :: tl_lat1 3368 3369 TYPE(TMPP) :: tl_coord1 3516 3370 ! loop indices 3517 3371 !---------------------------------------------------------------- … … 3543 3397 ! read fine longitue and latitude 3544 3398 WRITE(cl_name,*) 'longitude_'//TRIM(cl_point) 3545 il_ind=var_get_id(tl_coord1%t_proc(1)%t_var(:), cl_name)3546 IF( il_ind == 0 )THEN3547 CALL logger_warn("GRID GET FINE OFFSET: no variable "//&3548 & TRIM(cl_name)//" in file "//TRIM(tl_coord1%c_name)//". &3549 & try to use longitude.")3550 WRITE(cl_name,*) 'longitude'3551 ENDIF3552 3399 tl_lon1=iom_mpp_read_var(tl_coord1, TRIM(cl_name)) 3553 3554 3400 WRITE(cl_name,*) 'latitude_'//TRIM(cl_point) 3555 il_ind=var_get_id(tl_coord1%t_proc(1)%t_var(:), cl_name)3556 IF( il_ind == 0 )THEN3557 CALL logger_warn("GRID GET FINE OFFSET: no variable "//&3558 & TRIM(cl_name)//" in file "//TRIM(tl_coord1%c_name)//". &3559 & try to use latitude.")3560 WRITE(cl_name,*) 'latitude'3561 ENDIF3562 3401 tl_lat1=iom_mpp_read_var(tl_coord1, TRIM(cl_name)) 3563 3402 … … 3607 3446 ! 3608 3447 !> @author J.Paul 3609 !> @date September, 2014- Initial Version3448 !> - September, 2014- Initial Version 3610 3449 !> @date October, 2014 3611 3450 !> - work on mpp file structure instead of file structure … … 3644 3483 3645 3484 ! local variable 3646 INTEGER(i4) :: il_imin0 3647 INTEGER(i4) :: il_jmin0 3648 INTEGER(i4) :: il_imax0 3649 INTEGER(i4) :: il_jmax0 3650 INTEGER(i4) :: il_ind 3485 INTEGER(i4) :: il_imin0 3486 INTEGER(i4) :: il_jmin0 3487 INTEGER(i4) :: il_imax0 3488 INTEGER(i4) :: il_jmax0 3651 3489 3652 INTEGER(i4), DIMENSION(:), ALLOCATABLE 3490 INTEGER(i4), DIMENSION(:), ALLOCATABLE :: il_rho 3653 3491 3654 INTEGER(i4), DIMENSION(2,2) 3655 3656 CHARACTER(LEN= 1) 3657 CHARACTER(LEN=lc) 3492 INTEGER(i4), DIMENSION(2,2) :: il_xghost0 3493 3494 CHARACTER(LEN= 1) :: cl_point 3495 CHARACTER(LEN=lc) :: cl_name 3658 3496 3659 3497 REAL(dp) , DIMENSION(:,:), ALLOCATABLE :: dl_lon0 3660 3498 REAL(dp) , DIMENSION(:,:), ALLOCATABLE :: dl_lat0 3661 3499 3662 TYPE(TVAR) 3663 TYPE(TVAR) 3664 3665 TYPE(TMPP) 3500 TYPE(TVAR) :: tl_lon0 3501 TYPE(TVAR) :: tl_lat0 3502 3503 TYPE(TMPP) :: tl_coord0 3666 3504 ! loop indices 3667 3505 !---------------------------------------------------------------- … … 3692 3530 ! read coarse longitue and latitude 3693 3531 WRITE(cl_name,*) 'longitude_'//TRIM(cl_point) 3694 il_ind=var_get_id(tl_coord0%t_proc(1)%t_var(:), cl_name)3695 IF( il_ind == 0 )THEN3696 CALL logger_warn("GRID GET FINE OFFSET: no variable "//&3697 & TRIM(cl_name)//" in file "//TRIM(tl_coord0%c_name)//". &3698 & try to use longitude.")3699 WRITE(cl_name,*) 'longitude'3700 ENDIF3701 3532 tl_lon0=iom_mpp_read_var(tl_coord0, TRIM(cl_name)) 3702 3703 3533 WRITE(cl_name,*) 'latitude_'//TRIM(cl_point) 3704 il_ind=var_get_id(tl_coord0%t_proc(1)%t_var(:), cl_name)3705 IF( il_ind == 0 )THEN3706 CALL logger_warn("GRID GET FINE OFFSET: no variable "//&3707 & TRIM(cl_name)//" in file "//TRIM(tl_coord0%c_name)//". &3708 & try to use latitude.")3709 WRITE(cl_name,*) 'latitude'3710 ENDIF3711 3534 tl_lat0=iom_mpp_read_var(tl_coord0, TRIM(cl_name)) 3712 3535 … … 3762 3585 ! 3763 3586 !> @author J.Paul 3764 !> @date November, 2013 - Initial Version 3765 !> @date September, 2014 3766 !> - rename from grid_get_fine_offset 3767 !> @date May, 2015 3768 !> - improve way to find offset 3769 !> 3587 !> - November, 2013 - Initial Version 3588 !> @date September, 2014 - rename from grid_get_fine_offset 3589 ! 3770 3590 !> @param[in] dd_lon0 coarse grid longitude array 3771 3591 !> @param[in] dd_lat0 coarse grid latitude array … … 3800 3620 3801 3621 ! local variable 3802 INTEGER(i4), DIMENSION(2) :: il_shape0 3803 INTEGER(i4), DIMENSION(2) :: il_shape1 3804 3622 INTEGER(i4), DIMENSION(2) :: il_shape0 3623 INTEGER(i4), DIMENSION(2) :: il_shape1 3805 3624 REAL(dp) , DIMENSION(:,:), ALLOCATABLE :: dl_lon0 3806 3625 REAL(dp) , DIMENSION(:,:), ALLOCATABLE :: dl_lon1 3807 3808 LOGICAL :: ll_ii3809 LOGICAL :: ll_ij3810 3626 3811 3627 ! loop indices … … 3841 3657 grid__get_fine_offset_cc(:,:)=-1 3842 3658 3843 IF( il_shape1(jp_J) == 1 )THEN 3844 3845 grid__get_fine_offset_cc(jp_J,:)=((id_rho(jp_J)-1)/2) 3846 3847 ! work on i-direction 3848 ! look for i-direction left offset 3659 IF( il_shape1(1) > 1 )THEN 3660 3661 ! look for i-direction left offset 3849 3662 IF( dl_lon1(1,1) < dl_lon0(id_imin0+1,id_jmin0) )THEN 3850 3663 DO ji=1,id_rho(jp_I)+2 3851 3664 IF( dl_lon1(ji,1) > dl_lon0(id_imin0+1,id_jmin0) - dp_delta )THEN 3852 grid__get_fine_offset_cc( jp_I,1)=(id_rho(jp_I)+1)-ji3665 grid__get_fine_offset_cc(1,1)=(id_rho(jp_I)+1)-ji 3853 3666 EXIT 3854 3667 ENDIF … … 3858 3671 & " not match fine grid lower left corner.") 3859 3672 ENDIF 3673 3860 3674 ! look for i-direction right offset 3861 IF( dl_lon1(il_shape1( jp_I),1) > dl_lon0(id_imax0-1,id_jmin0) )THEN3675 IF( dl_lon1(il_shape1(1),1) > dl_lon0(id_imax0-1,id_jmin0) )THEN 3862 3676 DO ji=1,id_rho(jp_I)+2 3863 ii=il_shape1( jp_I)-ji+13677 ii=il_shape1(1)-ji+1 3864 3678 IF( dl_lon1(ii,1) < dl_lon0(id_imax0-1,id_jmin0) + dp_delta )THEN 3865 grid__get_fine_offset_cc( jp_I,2)=(id_rho(jp_I)+1)-ji3679 grid__get_fine_offset_cc(1,2)=(id_rho(jp_I)+1)-ji 3866 3680 EXIT 3867 3681 ENDIF … … 3872 3686 ENDIF 3873 3687 3874 ELSE IF( il_shape1(jp_I) == 1 )THEN3875 3876 grid__get_fine_offset_cc(jp_I,:)=((id_rho(jp_I)-1)/2)3877 3878 ! work on j-direction3688 ELSE 3689 grid__get_fine_offset_cc(1,:)=((id_rho(jp_I)-1)/2) 3690 ENDIF 3691 3692 IF( il_shape1(2) > 1 )THEN 3879 3693 3880 3694 ! look for j-direction lower offset … … 3882 3696 DO jj=1,id_rho(jp_J)+2 3883 3697 IF( dd_lat1(1,jj) > dd_lat0(id_imin0,id_jmin0+1) - dp_delta )THEN 3884 grid__get_fine_offset_cc( jp_J,1)=(id_rho(jp_J)+1)-jj3698 grid__get_fine_offset_cc(2,1)=(id_rho(jp_J)+1)-jj 3885 3699 EXIT 3886 3700 ENDIF … … 3892 3706 3893 3707 ! look for j-direction upper offset 3894 IF( dd_lat1(1,il_shape1( jp_J)) > dd_lat0(id_imin0,id_jmax0-1) )THEN3708 IF( dd_lat1(1,il_shape1(2)) > dd_lat0(id_imin0,id_jmax0-1) )THEN 3895 3709 DO jj=1,id_rho(jp_J)+2 3896 ij=il_shape1( jp_J)-jj+13710 ij=il_shape1(2)-jj+1 3897 3711 IF( dd_lat1(1,ij) < dd_lat0(id_imin0,id_jmax0-1) + dp_delta )THEN 3898 grid__get_fine_offset_cc( jp_J,2)=(id_rho(jp_J)+1)-jj3712 grid__get_fine_offset_cc(2,2)=(id_rho(jp_J)+1)-jj 3899 3713 EXIT 3900 3714 ENDIF … … 3903 3717 CALL logger_error("GRID GET FINE OFFSET: coarse grid indices do "//& 3904 3718 & " not match fine grid upper right corner.") 3905 ENDIF3906 3907 ELSE ! il_shape1(1) > 1 .AND. il_shape1(2) > 13908 3909 ! look for lower left offset3910 IF( dl_lon1(1,1) < dl_lon0(id_imin0+1,id_jmin0+1) )THEN3911 3912 ii=13913 ij=13914 DO ji=1,(id_rho(jp_I)+2)*(id_rho(jp_J)+2)3915 3916 ll_ii=.FALSE.3917 ll_ij=.FALSE.3918 3919 IF( dl_lon1(ii,ij) >= dl_lon0(id_imin0+1,id_jmin0+1)-dp_delta .AND. &3920 & dd_lat1(ii,ij) >= dd_lat0(id_imin0+1,id_jmin0+1)-dp_delta )THEN3921 grid__get_fine_offset_cc(jp_I,1)=(id_rho(jp_I)+1)-ii3922 grid__get_fine_offset_cc(jp_J,1)=(id_rho(jp_J)+1)-ij3923 EXIT3924 ENDIF3925 3926 IF( dl_lon1(ii+1,ij) <= dl_lon0(id_imin0+1,id_jmin0+1)+dp_delta .AND. &3927 & dd_lat1(ii+1,ij) <= dd_lat0(id_imin0+1,id_jmin0+1)+dp_delta )THEN3928 ll_ii=.TRUE.3929 ENDIF3930 IF( dl_lon1(ii,ij+1) <= dl_lon0(id_imin0+1,id_jmin0+1)+dp_delta .AND. &3931 & dd_lat1(ii,ij+1) <= dd_lat0(id_imin0+1,id_jmin0+1)+dp_delta )THEN3932 ll_ij=.TRUE.3933 ENDIF3934 3935 IF( ll_ii ) ii=ii+13936 IF( ll_ij ) ij=ij+13937 3938 ENDDO3939 3940 ELSE3941 CALL logger_error("GRID GET FINE OFFSET: coarse grid indices do "//&3942 & " not match fine grid lower left corner.")3943 3719 ENDIF 3944 3945 ! look for upper right offset 3946 IF( dl_lon1(il_shape1(jp_I),il_shape1(jp_J)) > & 3947 & dl_lon0(id_imax0-1,id_jmax0-1) )THEN 3948 3949 ii=il_shape1(jp_I) 3950 ij=il_shape1(jp_J) 3951 DO ji=1,(id_rho(jp_I)+2)*(id_rho(jp_J)+2) 3952 3953 ll_ii=.FALSE. 3954 ll_ij=.FALSE. 3955 3956 IF( dl_lon1(ii,ij) <= dl_lon0(id_imax0-1,id_jmax0-1)+dp_delta .AND. & 3957 & dd_lat1(ii,ij) <= dd_lat0(id_imax0-1,id_jmax0-1)+dp_delta )THEN 3958 grid__get_fine_offset_cc(jp_I,2)=(id_rho(jp_I)+1)-(il_shape1(jp_I)+1-ii) 3959 grid__get_fine_offset_cc(jp_J,2)=(id_rho(jp_J)+1)-(il_shape1(jp_J)+1-ij) 3960 EXIT 3961 ENDIF 3962 3963 IF( dl_lon1(ii-1,ij) >= dl_lon0(id_imax0-1,id_jmax0-1)-dp_delta .AND. & 3964 & dd_lat1(ii-1,ij) >= dd_lat0(id_imax0-1,id_jmax0-1)-dp_delta )THEN 3965 ll_ii=.TRUE. 3966 ENDIF 3967 IF( dl_lon1(ii,ij-1) >= dl_lon0(id_imax0-1,id_jmax0-1)-dp_delta .AND. & 3968 & dd_lat1(ii,ij-1) >= dd_lat0(id_imax0-1,id_jmax0-1)-dp_delta )THEN 3969 ll_ij=.TRUE. 3970 ENDIF 3971 3972 IF( ll_ii ) ii=ii-1 3973 IF( ll_ij ) ij=ij-1 3974 3975 ENDDO 3976 3977 ELSE 3978 CALL logger_error("GRID GET FINE OFFSET: coarse grid indices do "//& 3979 & " not match fine grid upper right corner.") 3980 ENDIF 3981 3720 ELSE 3721 grid__get_fine_offset_cc(2,:)=((id_rho(jp_J)-1)/2) 3982 3722 ENDIF 3983 3723 … … 3992 3732 ! 3993 3733 !> @author J.Paul 3994 !> @dateNovember, 2013- Initial Version3734 !> - November, 2013- Initial Version 3995 3735 !> @date October, 2014 3996 3736 !> - work on mpp file structure instead of file structure … … 4002 3742 !> @param[in] id_jmin0 coarse grid lower left corner j-indice of fine grid domain 4003 3743 !> @param[in] id_jmax0 coarse grid upper right corner j-indice of fine grid domain 4004 !> @param[in] id_rho array of refinement factor 3744 !> @param[in] id_rho array of refinement factor (default 1) 4005 3745 !------------------------------------------------------------------- 4006 3746 SUBROUTINE grid_check_coincidence( td_coord0, td_coord1, & … … 4302 4042 !> 4303 4043 !> @author J.Paul 4304 !> @date November, 2013- Initial Version4044 !> - November, 2013- Initial Version 4305 4045 ! 4306 4046 !> @param[in] dd_lon0 array of coarse grid longitude … … 4363 4103 dl_lon1 = dd_lon1(il_imin1, il_jmin1) 4364 4104 dl_lat1 = dd_lat1(il_imin1, il_jmin1) 4105 4365 4106 4366 4107 IF( (ABS(dl_lon1-dl_lon0)>dp_delta) .AND. (dl_lon1 < dl_lon0 ) .OR. & … … 4461 4202 ! 4462 4203 !> @author J.Paul 4463 !> @date November, 2013- Initial Version4204 !> - November, 2013- Initial Version 4464 4205 ! 4465 4206 !> @param[in] dd_lat0 array of coarse grid latitude … … 4531 4272 !> 4532 4273 !> @author J.Paul 4533 !> @date November, 2013 -Initial version4274 !> - November, 2013-Initial version 4534 4275 ! 4535 4276 !> @param[inout] td_var array of variable structure … … 4607 4348 !> 4608 4349 !> @author J.Paul 4609 !> @date November, 2013 -Initial version4350 !> - November, 2013-Initial version 4610 4351 ! 4611 4352 !> @param[inout] td_var array of variable structure … … 4633 4374 IF( ALL(td_var%t_dim(1:2)%l_use) )THEN 4634 4375 4635 IF( ANY(id_ghost(:,:)/=0) )THEN 4636 CALL logger_warn( "GRID DEL GHOST: dimension change in variable "//& 4637 & TRIM(td_var%c_name) ) 4638 ENDIF 4376 CALL logger_warn( "GRID DEL GHOST: dimension change in variable "//& 4377 & TRIM(td_var%c_name) ) 4639 4378 4640 4379 ! copy variable … … 4686 4425 !> 4687 4426 !> @author J.Paul 4688 !> @date September, 2014- Initial Version4427 !> - September, 2014- Initial Version 4689 4428 ! 4690 4429 !> @param[in] td_var variable sturcture … … 4816 4555 !> 4817 4556 !> @author J.Paul 4818 !> @dateSeptember, 2014 - Initial Version4557 !> - September, 2014 - Initial Version 4819 4558 !> @date October, 2014 4820 4559 !> - work on mpp file structure instead of file structure … … 4853 4592 tl_mpp=mpp_copy(td_mpp) 4854 4593 4855 CALL logger_info("GRID GET FINE GHOST perio"//TRIM(fct_str(tl_mpp%i_perio)))4856 4594 IF( tl_mpp%i_perio < 0 )THEN 4857 4595 ! compute NEMO periodicity index … … 4889 4627 !> 4890 4628 !> @author J.Paul 4891 !> @date November, 2013- Initial Version4629 !> - November, 2013- Initial Version 4892 4630 ! 4893 4631 !> @param[in] td_var variable strucutre … … 4956 4694 il_tmp(jim:jip,jjm:jjp)=1 4957 4695 END WHERE 4958 4959 4696 ENDIF 4960 4697 ENDDO … … 4983 4720 !> 4984 4721 !> @details 4985 !> the minimum size (n umber of point) of closed sea to be kept could be4722 !> the minimum size (nbumber of point) of closed sea to be kept could be 4986 4723 !> sepcify with id_minsize. 4987 4724 !> By default only the biggest sea is preserve. 4988 4725 !> 4989 4726 !> @author J.Paul 4990 !> @date November, 2013- Initial Version4727 !> - November, 2013- Initial Version 4991 4728 !> 4992 4729 !> @param[inout] td_var variable structure … … 5045 4782 5046 4783 END SUBROUTINE grid_fill_small_dom 5047 !-------------------------------------------------------------------5048 !> @brief This subroutine fill small domain inside bigger one.5049 !>5050 !> @details5051 !> the minimum size (number of point) of domain sea to be kept could be5052 !> is sepcified with id_minsize.5053 !> smaller domain are included in the one they are embedded.5054 !>5055 !> @author J.Paul5056 !> @date Ferbruay, 2015 - Initial Version5057 !>5058 !> @param[inout] id_mask domain mask (from grid_split_domain)5059 !> @param[in] id_minsize minimum size of sea to be kept5060 !-------------------------------------------------------------------5061 SUBROUTINE grid_fill_small_msk(id_mask, id_minsize)5062 IMPLICIT NONE5063 ! Argument5064 INTEGER(i4), DIMENSION(:,:), INTENT(INOUT) :: id_mask5065 INTEGER(i4), INTENT(IN ) :: id_minsize5066 5067 ! local variable5068 INTEGER(i4) :: il_ndom5069 INTEGER(i4) :: il_minsize5070 INTEGER(i4) :: il_msk5071 5072 INTEGER(i4) :: jim5073 INTEGER(i4) :: jjm5074 INTEGER(i4) :: jip5075 INTEGER(i4) :: jjp5076 5077 INTEGER(i4), DIMENSION(2) :: il_shape5078 INTEGER(i4), DIMENSION(:,:), ALLOCATABLE :: il_tmp5079 5080 ! loop indices5081 INTEGER(i4) :: ii5082 INTEGER(i4) :: ij5083 5084 INTEGER(i4) :: ji5085 INTEGER(i4) :: jj5086 !----------------------------------------------------------------5087 5088 il_shape(:)=SHAPE(id_mask(:,:))5089 il_ndom=MINVAL(id_mask(:,:))5090 5091 ALLOCATE( il_tmp(il_shape(1),il_shape(2)) )5092 il_tmp(:,:)=05093 DO ji=-1,il_ndom,-15094 WHERE( id_mask(:,:)==ji )5095 il_tmp(:,:)=SUM(id_mask(:,:),id_mask(:,:)==ji)/ji5096 END WHERE5097 ENDDO5098 5099 DO WHILE( id_minsize > MINVAL(il_tmp(:,:)) )5100 5101 DO jj=1,il_shape(2)5102 DO ji=1,il_shape(1)5103 5104 IF( il_tmp(ji,jj) < il_minsize )THEN5105 jim=MAX(1,ji-1) ; jip=MIN(il_shape(1),ji+1)5106 jjm=MAX(1,jj-1) ; jjp=MIN(il_shape(2),jj+1)5107 5108 il_msk=05109 DO ij=jjm,jjp5110 DO ii=jim,jip5111 IF( id_mask(ii,ij) /= id_mask(ji,jj) )THEN5112 IF( il_msk == 0 )THEN5113 il_msk=id_mask(ii,ij)5114 ELSEIF( il_msk /= id_mask(ii,ij) )THEN5115 CALL logger_error("GRID FILL SMALL MSK: "//&5116 & "small domain not embedded in bigger one"//&5117 & ". point should be between two different"//&5118 & " domain.")5119 ENDIF5120 ENDIF5121 ENDDO5122 ENDDO5123 IF( il_msk /= 0 ) id_mask(ji,jj)=il_msk5124 5125 ENDIF5126 5127 ENDDO5128 ENDDO5129 5130 5131 il_tmp(:,:)=05132 DO ji=-1,il_ndom,-15133 WHERE( id_mask(:,:)==ji )5134 il_tmp(:,:)=SUM(id_mask(:,:),id_mask(:,:)==ji)/ji5135 END WHERE5136 ENDDO5137 5138 ENDDO5139 5140 DEALLOCATE( il_tmp )5141 5142 5143 END SUBROUTINE grid_fill_small_msk5144 4784 END MODULE grid 5145 4785 -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/interp.f90
r10248 r10251 27 27 !> defining string character _cn\_varinfo_.<br/> 28 28 !> Example: 29 !> - cn_varinfo='varname1: int=cubic/rhoi', 'varname2:int=linear'29 !> - cn_varinfo='varname1:cubic/rhoi', 'varname2:linear' 30 30 !> 31 31 !> to create mixed grid (with coarse grid point needed to compute … … 137 137 !> 138 138 !> @author J.Paul 139 !> @date November, 2013- Initial Version139 !> - November, 2013- Initial Version 140 140 ! 141 141 !> @param[in] cd_method interpolation method … … 179 179 !> 180 180 !> @author J.Paul 181 !> @date November, 2013- Initial Version181 !> - November, 2013- Initial Version 182 182 !> 183 183 !> @param[in] td_mix mixed grid variable (to interpolate) … … 244 244 !> 245 245 !> @author J.Paul 246 !> @date November, 2013- Initial Version246 !> - November, 2013- Initial Version 247 247 ! 248 248 !> @param[in] td_mix mixed grid variable (to interpolate) … … 363 363 !> 364 364 !> @author J.Paul 365 !> @date November, 2013- Initial Version365 !> - November, 2013- Initial Version 366 366 !> 367 367 !> @param[in] td_var coarse grid variable (should be extrapolated) … … 449 449 !> 450 450 !> @author J.Paul 451 !> @date November, 2013- Initial Version451 !> - November, 2013- Initial Version 452 452 !> 453 453 !> @param[inout] td_mix mixed grid variable … … 610 610 !> 611 611 !> @author J.Paul 612 !> @date November, 2013- Initial Version612 !> - November, 2013- Initial Version 613 613 !> @date September, 2014 614 614 !> - use offset to save useful domain … … 716 716 !> 717 717 !> @author J.Paul 718 !> @date November, 2013- Initial Version718 !> - November, 2013- Initial Version 719 719 !> 720 720 !> @param[inout] td_var variable structure … … 828 828 !> 829 829 !> @author J.Paul 830 !> @date November, 2013- Initial Version830 !> - November, 2013- Initial Version 831 831 !> @date September, 2014 832 832 !> - use interpolation method modules … … 947 947 948 948 DEALLOCATE(il_detect) 949 950 949 !4- save useful domain (remove offset) 951 950 CALL interp_clean_mixed_grid( tl_mix, td_var, & -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/interp_cubic.f90
r10248 r10251 26 26 ! REVISION HISTORY: 27 27 !> @date September, 2014 -Initial version 28 !> @date June, 201529 !> - use math module30 28 !> 31 29 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 38 36 USE logger ! log file manager 39 37 USE fct ! basic useful function 40 USE math ! mathematical function38 USE extrap ! extrapolation manager 41 39 42 40 IMPLICIT NONE … … 63 61 !> 64 62 !> @author J.Paul 65 !> @date September, 2014 - Initial Version 66 !> @date July, 2015 67 !> - reinitialise detect array for each level 63 !> - September, 2014- Initial Version 68 64 !> 69 65 !> @param[inout] dd_value 2D array of variable value … … 86 82 87 83 ! local variable 88 INTEGER(i4), DIMENSION(4) :: il_shape 89 90 INTEGER(I4), DIMENSION(:,:,:), ALLOCATABLE :: il_detect 91 92 LOGICAL :: ll_discont 93 94 REAL(dp) , DIMENSION(:,:) , ALLOCATABLE :: dl_weight_IJ 95 REAL(dp) , DIMENSION(:,:) , ALLOCATABLE :: dl_weight_I 96 REAL(dp) , DIMENSION(:,:) , ALLOCATABLE :: dl_weight_J 84 INTEGER(i4), DIMENSION(4) :: il_shape 85 86 LOGICAL :: ll_discont 87 88 REAL(dp) , DIMENSION(:,:), ALLOCATABLE :: dl_weight_IJ 89 REAL(dp) , DIMENSION(:,:), ALLOCATABLE :: dl_weight_I 90 REAL(dp) , DIMENSION(:,:), ALLOCATABLE :: dl_weight_J 97 91 98 92 ! loop indices … … 119 113 & id_rho(jp_J), ld_even(jp_J)) 120 114 121 ALLOCATE(il_detect(il_shape(1),il_shape(2),il_shape(3)))122 123 115 DO jl=1,il_shape(4) 124 il_detect(:,:,:)=id_detect(:,:,:)125 116 ! loop on vertical level 126 117 DO jk=1,il_shape(3) … … 128 119 ! I-J plan 129 120 CALL interp_cubic__2D(dd_value(:,:,jk,jl), dd_fill, & 130 & i l_detect(:,:,jk), &121 & id_detect(:,:,jk), & 131 122 & dl_weight_IJ(:,:), & 132 123 & id_rho(jp_I), id_rho(jp_J), & 133 124 & ll_discont) 134 IF( ANY(i l_detect(:,:,jk)==1) )THEN125 IF( ANY(id_detect(:,:,jk)==1) )THEN 135 126 ! I direction 136 127 DO jj=1,il_shape(2) 137 128 CALL interp_cubic__1D( dd_value(:,jj,jk,jl), dd_fill, & 138 & i l_detect(:,jj,jk), &129 & id_detect(:,jj,jk), & 139 130 & dl_weight_I(:,:), & 140 131 & id_rho(jp_I), ll_discont ) 141 132 ENDDO 142 IF( ALL(i l_detect(:,:,jk)==0) )THEN133 IF( ALL(id_detect(:,:,jk)==0) )THEN 143 134 CYCLE 144 135 ELSE … … 146 137 DO ji=1,il_shape(1) 147 138 CALL interp_cubic__1D( dd_value(ji,:,jk,jl), dd_fill, & 148 & i l_detect(ji,:,jk), &139 & id_detect(ji,:,jk), & 149 140 & dl_weight_J(:,:), & 150 141 & id_rho(jp_J), ll_discont ) … … 156 147 ENDDO 157 148 158 id_detect(:,:,:)=il_detect(:,:,:)159 DEALLOCATE(il_detect)160 161 149 DEALLOCATE(dl_weight_IJ) 162 150 DEALLOCATE(dl_weight_I) … … 171 159 !> 172 160 !> @author J.Paul 173 !> @date September, 2014- Initial Version161 !> - September, 2014- Initial Version 174 162 !> 175 163 !> @param[inout] dd_value 2D array of variable value … … 193 181 REAL(dp) , INTENT(IN ) :: dd_fill 194 182 INTEGER(I4) , DIMENSION(:,:), INTENT(INOUT) :: id_detect 195 REAL(dp) , DIMENSION(:,:), INTENT(IN ) :: dd_weight 183 REAL(dp) , DIMENSION(:,:), INTENT(IN ) :: dd_weight 196 184 INTEGER(I4) , INTENT(IN ) :: id_rhoi 197 185 INTEGER(I4) , INTENT(IN ) :: id_rhoj … … 242 230 243 231 ! compute derivative on coarse grid 244 dl_dfdx(:,:)= math_deriv_2D(dl_coarse(:,:), dd_fill, 'I', ld_discont)245 dl_dfdy(:,:)= math_deriv_2D(dl_coarse(:,:), dd_fill, 'J', ld_discont)232 dl_dfdx(:,:)=extrap_deriv_2D(dl_coarse(:,:), dd_fill, 'I', ld_discont) 233 dl_dfdy(:,:)=extrap_deriv_2D(dl_coarse(:,:), dd_fill, 'J', ld_discont) 246 234 247 235 ! compute cross derivative on coarse grid 248 dl_d2fdxy(:,:)= math_deriv_2D(dl_dfdx(:,:), dd_fill, 'J', ld_discont)236 dl_d2fdxy(:,:)=extrap_deriv_2D(dl_dfdx(:,:), dd_fill, 'J', ld_discont) 249 237 250 238 ALLOCATE( dl_tmp(2,2) ) … … 331 319 !> 332 320 !> @author J.Paul 333 !> @date September, 2014- Initial Version321 !> - September, 2014- Initial Version 334 322 !> 335 323 !> @param[inout] dd_value 1D array of variable value … … 351 339 REAL(dp) , INTENT(IN ) :: dd_fill 352 340 INTEGER(I4) , DIMENSION(:) , INTENT(INOUT) :: id_detect 353 REAL(dp) , DIMENSION(:,:), INTENT(IN ) :: dd_weight 341 REAL(dp) , DIMENSION(:,:), INTENT(IN ) :: dd_weight 354 342 INTEGER(I4) , INTENT(IN ) :: id_rhoi 355 343 LOGICAL , INTENT(IN ) :: ld_discont … … 388 376 389 377 ! compute derivative on coarse grid 390 dl_dfdx(:)= math_deriv_1D(dl_coarse(:), dd_fill, ld_discont)378 dl_dfdx(:)=extrap_deriv_1D(dl_coarse(:), dd_fill, ld_discont) 391 379 392 380 ALLOCATE( dl_tmp(2) ) … … 452 440 !> 453 441 !> @author J.Paul 454 !> @date September, 2014- Initial Version442 !> - September, 2014- Initial Version 455 443 !> 456 444 !> @param[in] dd_value 2D array of value … … 515 503 !> 516 504 !> @author J.Paul 517 !> @date September, 2014- Initial Version505 !> - September, 2014- Initial Version 518 506 !> 519 507 !> @param[inout] dd_value 2D array of mixed grid value … … 577 565 !> 578 566 !> @author J.Paul 579 !> @date September, 2014- Initial Version567 !> - September, 2014- Initial Version 580 568 !> 581 569 !> @param[in] dd_value 1D array of value … … 620 608 !> 621 609 !> @author J.Paul 622 !> @date September, 2014- Initial Version610 !> - September, 2014- Initial Version 623 611 !> 624 612 !> @param[inout] dd_value 1D array of mixed grid value … … 671 659 !> 672 660 !> @author J.Paul 673 !> @date September, 2014- Initial Version661 !> - September, 2014- Initial Version 674 662 !> 675 663 !> @param[in] dd_weight interpolation weight of 2D array … … 752 740 !> 753 741 !> @author J.Paul 754 !> @date September, 2014- Initial Version742 !> - September, 2014- Initial Version 755 743 !> 756 744 !> @param[in] dd_weight interpolation weight of 1D array -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/interp_linear.f90
r10248 r10251 24 24 !> J.Paul 25 25 ! REVISION HISTORY: 26 !> @date September, 2014 - 26 !> @date September, 2014 -Initial version 27 27 !> 28 28 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 63 63 !> 64 64 !> @author J.Paul 65 !> @date September, 2014 - Initial Version 66 !> @date July, 2015 - reinitialise detect array for each level 65 !> - September, 2014- Initial Version 67 66 !> 68 67 !> @param[inout] dd_value 2D array of variable value … … 85 84 86 85 ! local variable 87 INTEGER(i4), DIMENSION(4) :: il_shape 88 89 INTEGER(I4), DIMENSION(:,:,:), ALLOCATABLE :: il_detect 90 91 LOGICAL :: ll_discont 92 93 REAL(dp) , DIMENSION(:,:) , ALLOCATABLE :: dl_weight_IJ 94 REAL(dp) , DIMENSION(:,:) , ALLOCATABLE :: dl_weight_I 95 REAL(dp) , DIMENSION(:,:) , ALLOCATABLE :: dl_weight_J 86 INTEGER(i4), DIMENSION(4) :: il_shape 87 88 LOGICAL :: ll_discont 89 90 REAL(dp) , DIMENSION(:,:), ALLOCATABLE :: dl_weight_IJ 91 REAL(dp) , DIMENSION(:,:), ALLOCATABLE :: dl_weight_I 92 REAL(dp) , DIMENSION(:,:), ALLOCATABLE :: dl_weight_J 96 93 97 94 ! loop indices … … 107 104 108 105 ! compute vect2D 109 ALLOCATE(dl_weight_IJ( 4,((id_rho(jp_I)+1)*(id_rho(jp_J)+1))) )106 ALLOCATE(dl_weight_IJ(16,((id_rho(jp_I)+1)*(id_rho(jp_J)+1))) ) 110 107 CALL interp_linear__get_weight2D(dl_weight_IJ(:,:), & 111 108 & id_rho(:), ld_even(:)) 112 109 113 ALLOCATE( dl_weight_I( 2,((id_rho(jp_I)+1) )) )114 ALLOCATE( dl_weight_J( 2,( (id_rho(jp_J)+1))) )110 ALLOCATE( dl_weight_I( 4,((id_rho(jp_I)+1) )) ) 111 ALLOCATE( dl_weight_J( 4,( (id_rho(jp_J)+1))) ) 115 112 CALL interp_linear__get_weight1D(dl_weight_I(:,:), & 116 113 & id_rho(jp_I), ld_even(jp_I)) … … 118 115 & id_rho(jp_J), ld_even(jp_J)) 119 116 120 ALLOCATE(il_detect(il_shape(1),il_shape(2),il_shape(3)))121 122 117 DO jl=1,il_shape(4) 123 il_detect(:,:,:)=id_detect(:,:,:)124 118 ! loop on vertical level 125 119 DO jk=1,il_shape(3) … … 127 121 ! I-J plan 128 122 CALL interp_linear__2D(dd_value(:,:,jk,jl), dd_fill,& 129 & i l_detect(:,:,jk), &123 & id_detect(:,:,jk), & 130 124 & dl_weight_IJ(:,:), & 131 125 & id_rho(jp_I), id_rho(jp_J), & 132 126 & ll_discont) 133 IF( ANY(i l_detect(:,:,jk)==1) )THEN127 IF( ANY(id_detect(:,:,jk)==1) )THEN 134 128 ! I direction 135 129 DO jj=1,il_shape(2) 136 130 CALL interp_linear__1D( dd_value(:,jj,jk,jl), dd_fill,& 137 & i l_detect(:,jj,jk), &131 & id_detect(:,jj,jk), & 138 132 & dl_weight_I(:,:), & 139 133 & id_rho(jp_I), ll_discont ) 140 134 ENDDO 141 IF( ALL(i l_detect(:,:,jk)==0) )THEN135 IF( ALL(id_detect(:,:,jk)==0) )THEN 142 136 CYCLE 143 137 ELSE … … 145 139 DO ji=1,il_shape(1) 146 140 CALL interp_linear__1D( dd_value(ji,:,jk,jl), dd_fill,& 147 & i l_detect(ji,:,jk), &141 & id_detect(ji,:,jk), & 148 142 & dl_weight_J(:,:), & 149 143 & id_rho(jp_J), ll_discont ) … … 155 149 ENDDO 156 150 157 id_detect(:,:,:)=il_detect(:,:,:)158 DEALLOCATE(il_detect)159 160 151 DEALLOCATE(dl_weight_IJ) 161 152 DEALLOCATE(dl_weight_I) 162 153 DEALLOCATE(dl_weight_J) 163 154 164 155 END SUBROUTINE interp_linear_fill 165 156 !------------------------------------------------------------------- … … 170 161 !> 171 162 !> @author J.Paul 172 !> @date September, 2014- Initial Version163 !> - September, 2014- Initial Version 173 164 !> 174 165 !> @param[inout] dd_value 2D array of variable value … … 244 235 IF( ALL(id_detect(ji:ji+id_rhoi, & 245 236 & jj:jj+id_rhoj)==0) ) CYCLE 246 ! check data needed to interpolate237 ! check data to needed to interpolate 247 238 IF( ANY(dl_coarse(ii:ii+1,ij:ij+1)==dd_fill) ) CYCLE 248 239 ! check longitude discontinuity … … 305 296 !> 306 297 !> @author J.Paul 307 !> @date September, 2014- Initial Version298 !> - September, 2014- Initial Version 308 299 !> 309 300 !> @param[inout] dd_value 1D array of variable value … … 417 408 !> 418 409 !> @author J.Paul 419 !> @date September, 2014- Initial Version410 !> - September, 2014- Initial Version 420 411 !> 421 412 !> @param[in] dd_value 2D array of value … … 454 445 !> 455 446 !> @author J.Paul 456 !> @date September, 2014- Initial Version457 !> 447 !> - September, 2014- Initial Version 448 !> 458 449 !> @param[inout] dd_value 2D array of mixed grid value 459 450 !> @param[inout] id_detect 2D array of point to be interpolated … … 486 477 !---------------------------------------------------------------- 487 478 488 IF( ANY( dd_coef(:)==dd_fill ) )THEN 489 CALL logger_error("INTERP LINEAR FILL: fill value detected in coef. "//& 490 & "can not compute interpolation.") 491 ELSE 492 493 ii=0 494 DO jj=1,id_rhoj+1 495 DO ji=1,id_rhoi+1 496 497 ii=ii+1 498 IF(id_detect(ji,jj)==1)THEN 499 500 dd_value(ji,jj)=DOT_PRODUCT(dd_coef(:),dd_weight(:,ii)) 501 id_detect(ji,jj)=0 502 503 ENDIF 504 479 IF( ANY( dd_coef(:)==dd_fill ) )THEN 480 CALL logger_error("INTERP LINEAR FILL: fill value detected in coef. "//& 481 & "can not compute interpolation.") 482 ELSE 483 484 ii=0 485 DO jj=1,id_rhoj+1 486 DO ji=1,id_rhoi+1 487 488 ii=ii+1 489 IF(id_detect(ji,jj)==1)THEN 490 491 dd_value(ji,jj)=DOT_PRODUCT(dd_coef(:),dd_weight(:,ii)) 492 id_detect(ji,jj)=0 493 494 ENDIF 495 496 ENDDO 505 497 ENDDO 506 ENDDO 507 508 ENDIF 498 499 ENDIF 509 500 510 501 END SUBROUTINE interp_linear__2D_fill … … 514 505 !> 515 506 !> @author J.Paul 516 !> @date September, 2014- Initial Version507 !> - September, 2014- Initial Version 517 508 !> 518 509 !> @param[in] dd_value 1D array of value … … 549 540 !> 550 541 !> @author J.Paul 551 !> @date September, 2014- Initial Version542 !> - September, 2014- Initial Version 552 543 !> 553 544 !> @param[inout] dd_value 1D array of mixed grid value … … 600 591 !> 601 592 !> @author J.Paul 602 !> @date September, 2014- Initial Version593 !> - September, 2014- Initial Version 603 594 !> 604 595 !> @param[in] dd_weight interpolation weight of 2D array … … 669 660 !> 670 661 !> @author J.Paul 671 !> @date September, 2014- Initial Version662 !> - September, 2014- Initial Version 672 663 !> 673 664 !> @param[in] dd_weight interpolation weight of 1D array -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/interp_nearest.f90
r10248 r10251 24 24 !> J.Paul 25 25 ! REVISION HISTORY: 26 !> @date September, 2014 - 26 !> @date September, 2014 -Initial version 27 27 !> 28 28 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 55 55 !> 56 56 !> @author J.Paul 57 !> @date September, 2014- Initial Version57 !> - September, 2014- Initial Version 58 58 !> 59 59 !> @param[inout] dd_value 2D array of variable value … … 69 69 70 70 ! local variable 71 INTEGER(i4), DIMENSION(4) :: il_shape 72 73 INTEGER(I4), DIMENSION(:,:,:), ALLOCATABLE :: il_detect 71 INTEGER(i4), DIMENSION(4) :: il_shape 74 72 75 73 ! loop indices … … 82 80 il_shape(:)=SHAPE(dd_value) 83 81 84 ALLOCATE(il_detect(il_shape(1),il_shape(2),il_shape(3)))85 82 DO jl=1,il_shape(4) 86 il_detect(:,:,:)=id_detect(:,:,:)87 83 ! loop on vertical level 88 84 DO jk=1,il_shape(3) … … 90 86 ! I-J plan 91 87 CALL interp_nearest__2D(dd_value(:,:,jk,jl),& 92 & i l_detect(:,:,jk), &88 & id_detect(:,:,jk), & 93 89 & id_rho(jp_I), id_rho(jp_J) ) 94 IF( ANY(i l_detect(:,:,jk)==1) )THEN90 IF( ANY(id_detect(:,:,jk)==1) )THEN 95 91 ! I direction 96 92 DO jj=1,il_shape(2) 97 93 CALL interp_nearest__1D( dd_value(:,jj,jk,jl),& 98 & i l_detect(:,jj,jk), &94 & id_detect(:,jj,jk), & 99 95 & id_rho(jp_I) ) 100 96 ENDDO 101 IF( ALL(i l_detect(:,:,jk)==0) )THEN97 IF( ALL(id_detect(:,:,jk)==0) )THEN 102 98 CYCLE 103 99 ELSE … … 105 101 DO ji=1,il_shape(1) 106 102 CALL interp_nearest__1D( dd_value(ji,:,jk,jl),& 107 & i l_detect(ji,:,jk), &103 & id_detect(ji,:,jk), & 108 104 & id_rho(jp_J) ) 109 105 ENDDO … … 114 110 ENDDO 115 111 116 id_detect(:,:,:)=il_detect(:,:,:)117 DEALLOCATE(il_detect)118 119 112 END SUBROUTINE interp_nearest_fill 120 113 !------------------------------------------------------------------- … … 123 116 !> 124 117 !> @author J.Paul 125 !> @date September, 2014- Initial Version118 !> - September, 2014- Initial Version 126 119 !> 127 120 !> @param[inout] dd_value 2D array of variable value … … 178 171 !> 179 172 !> @author J.Paul 180 !> @date September, 2014- Initial Version173 !> - September, 2014- Initial Version 181 174 !> 182 175 !> @param[inout] dd_value 1D array of variable value … … 223 216 !> 224 217 !> @author J.Paul 225 !> @date September, 2014- Initial Version218 !> - September, 2014- Initial Version 226 219 !> 227 220 !> @param[inout] dd_value 2D array of mixed grid value … … 307 300 !> 308 301 !> @author J.Paul 309 !> @date September, 2014- Initial Version302 !> - September, 2014- Initial Version 310 303 !> 311 304 !> @param[inout] dd_value 1D array of mixed grid value -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/iom.f90
r10248 r10251 156 156 !> 157 157 !> @author J.Paul 158 !> @date November, 2013- Initial Version158 !> - November, 2013- Initial Version 159 159 ! 160 160 !> @param[inout] td_file file structure … … 186 186 !> 187 187 !> @author J.Paul 188 !> @date November, 2013- Initial Version188 !> - November, 2013- Initial Version 189 189 ! 190 190 !> @param[inout] td_file file structure … … 223 223 !> 224 224 !> @author J.Paul 225 !> @date November, 2013- Initial Version225 !> - November, 2013- Initial Version 226 226 ! 227 227 !> @param[inout] td_file file structure … … 252 252 ! 253 253 !> @author J.Paul 254 !> @date November, 2013- Initial Version254 !> - November, 2013- Initial Version 255 255 ! 256 256 !> @param[in] td_file file structure … … 300 300 !> 301 301 !> @author J.Paul 302 !> @date November, 2013- Initial Version302 !> - November, 2013- Initial Version 303 303 ! 304 304 !> @param[in] td_file file structure … … 338 338 ! 339 339 !> @author J.Paul 340 !> @date November, 2013- Initial Version340 !> - November, 2013- Initial Version 341 341 ! 342 342 !> @param[in] td_file file structure … … 386 386 ! 387 387 !> @author J.Paul 388 !> @date November, 2013- Initial Version388 !> - November, 2013- Initial Version 389 389 ! 390 390 !> @param[in] td_file file structure … … 422 422 ! 423 423 !> @author J.Paul 424 !> @date November, 2013- Initial Version424 !> - November, 2013- Initial Version 425 425 ! 426 426 !> @param[in] td_file file structure … … 452 452 ! 453 453 !> @author J.Paul 454 !> @date November, 2013- Initial Version454 !> - November, 2013- Initial Version 455 455 ! 456 456 !> @param[in] td_file file structure … … 485 485 ! 486 486 !> @author J.Paul 487 !> @date November, 2013- Initial Version487 !> - November, 2013- Initial Version 488 488 ! 489 489 !> @param[in] td_file file structure … … 529 529 ! 530 530 !> @author J.Paul 531 !> @date November, 2013- Initial Version531 !> - November, 2013- Initial Version 532 532 ! 533 533 !> @param[in] td_file file structure … … 564 564 !------------------------------------------------------------------- 565 565 !> @brief This subroutine write file structure in an opened file. 566 !> 567 !> @details 568 !> optionally, you could specify dimension order (default 'xyzt') 569 !> 570 !> @author J.Paul 571 !> @date November, 2013 - Initial Version 572 !> @date July, 2015 - add dimension order option 566 ! 567 !> @author J.Paul 568 !> - November, 2013- Initial Version 573 569 ! 574 570 !> @param[in] td_file file structure 575 571 !------------------------------------------------------------------- 576 SUBROUTINE iom_write_file(td_file, cd_dimorder) 577 IMPLICIT NONE 578 ! Argument 579 TYPE(TFILE) , INTENT(INOUT) :: td_file 580 CHARACTER(LEN=*), INTENT(IN ), OPTIONAL :: cd_dimorder 581 !---------------------------------------------------------------- 582 583 ! open file 584 SELECT CASE(TRIM(td_file%c_type)) 585 CASE('cdf') 586 CALL iom_cdf_write_file(td_file, cd_dimorder) 587 CASE('dimg') 588 ! note: can not change dimension order in restart dimg file 572 SUBROUTINE iom_write_file(td_file) 573 IMPLICIT NONE 574 ! Argument 575 TYPE(TFILE), INTENT(INOUT) :: td_file 576 !---------------------------------------------------------------- 577 578 ! open file 579 SELECT CASE(TRIM(td_file%c_type)) 580 CASE('cdf') 581 CALL iom_cdf_write_file(td_file) 582 CASE('dimg') 589 583 CALL iom_rstdimg_write_file(td_file) 590 584 CASE DEFAULT -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/iom_cdf.f90
r10248 r10251 144 144 !> 145 145 !> @author J.Paul 146 !> @date November, 2013 - Initial Version 147 !> @date May, 2015 - add optional message to netcdf error message 148 !> 146 !> - November, 2013- Initial Version 147 ! 149 148 !> @param[in] id_status error status 150 !> @param[in] cd_msg message 151 !------------------------------------------------------------------- 152 SUBROUTINE iom_cdf__check(id_status, cd_msg) 153 IMPLICIT NONE 154 ! Argument 155 INTEGER(i4) , INTENT(IN) :: id_status 156 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_msg 157 ! local variable 158 CHARACTER(LEN=lc) :: cl_msg 159 !---------------------------------------------------------------- 160 161 cl_msg="" 162 IF( PRESENT(cd_msg) ) cl_msg=cd_msg 149 !------------------------------------------------------------------- 150 SUBROUTINE iom_cdf__check(id_status) 151 IMPLICIT NONE 152 ! Argument 153 INTEGER(i4), INTENT(IN) :: id_status 154 !---------------------------------------------------------------- 163 155 164 156 IF( id_status /= NF90_NOERR )THEN 165 CALL logger_error(TRIM( cl_msg)//TRIM(NF90_STRERROR(id_status)))157 CALL logger_error(TRIM(NF90_STRERROR(id_status))) 166 158 ENDIF 167 159 … … 181 173 !> 182 174 !> @author J.Paul 183 !> @date November, 2013- Initial Version175 !> - November, 2013- Initial Version 184 176 ! 185 177 !> @param[inout] td_file file structure … … 211 203 CALL logger_info( " IOM CDF CREATE: file "//TRIM(td_file%c_name) ) 212 204 213 il_status = NF90_CREATE(TRIM(td_file%c_name),& 214 & cmode=NF90_64BIT_OFFSET,& 215 & ncid=td_file%i_id) 216 !NF90_WRITE, & 217 CALL iom_cdf__check(il_status," IOM CDF CREATE: ") 205 il_status = NF90_CREATE( TRIM(td_file%c_name),& 206 & NF90_WRITE, & 207 & td_file%i_id) 208 CALL iom_cdf__check(il_status) 218 209 219 210 td_file%l_def=.TRUE. … … 237 228 & NF90_NOWRITE, & 238 229 & td_file%i_id) 239 CALL iom_cdf__check(il_status," IOM CDF OPEN: ") 240 241 CALL logger_trace("IOM CDF OPEN "//TRIM(td_file%c_name)//" "//& 242 & TRIM(fct_str(td_file%i_id))) 230 CALL iom_cdf__check(il_status) 231 232 CALL logger_trace("IOM CDF OPEN "//TRIM(td_file%c_name)//" "//TRIM(fct_str(td_file%i_id))) 243 233 ELSE 244 234 … … 249 239 & NF90_WRITE, & 250 240 & td_file%i_id) 251 CALL iom_cdf__check(il_status ,"IOM CDF OPEN: ")241 CALL iom_cdf__check(il_status) 252 242 253 243 ENDIF … … 277 267 !> 278 268 !> @author J.Paul 279 !> @date November, 2013- Initial Version269 !> - November, 2013- Initial Version 280 270 ! 281 271 !> @param[inout] td_file file structure … … 301 291 302 292 il_status = NF90_CLOSE(td_file%i_id) 303 CALL iom_cdf__check(il_status ,"IOM CDF CLOSE: ")293 CALL iom_cdf__check(il_status) 304 294 305 295 td_file%i_id = 0 … … 317 307 !> 318 308 !> @author J.Paul 319 !> @date November, 2013- Initial Version309 !> - November, 2013- Initial Version 320 310 ! 321 311 !> @param[inout] td_file file structure … … 336 326 il_status=NF90_INQUIRE(td_file%i_id, td_file%i_ndim, & 337 327 & td_file%i_nvar, td_file%i_natt, td_file%i_uldid, il_fmt) 338 CALL iom_cdf__check(il_status ,"IOM CDF GET INFO: ")328 CALL iom_cdf__check(il_status) 339 329 340 330 SELECT CASE(il_fmt) … … 355 345 ! 356 346 !> @author J.Paul 357 !> @date November, 2013- Initial Version347 !> - November, 2013- Initial Version 358 348 ! 359 349 !> @param[inout] td_file file structure … … 406 396 ! 407 397 !> @author J.Paul 408 !> @date November, 2013- Initial Version398 !> - November, 2013- Initial Version 409 399 !> @date September, 2014 410 400 !> - use attribute periodicity read from the file if present. … … 449 439 ! 450 440 !> @author J.Paul 451 !> @date November, 2013- Initial Version441 !> - November, 2013- Initial Version 452 442 ! 453 443 !> @param[inout] td_file file structure … … 490 480 491 481 ! look for depth id 492 IF( INDEX(TRIM( fct_lower(td_file%t_var(ji)%c_name)),'depth')/=0 )THEN482 IF( INDEX(TRIM(td_file%t_var(ji)%c_name),'depth') /= 0 )THEN 493 483 IF( td_file%i_depthid == 0 )THEN 494 484 td_file%i_depthid=ji 495 485 ELSE 496 486 IF( td_file%i_depthid /= ji )THEN 497 CALL logger_error("IOM CDF GET FILE VAR: find more "//&498 & " than onedepth variable in file "//&499 &TRIM(td_file%c_name) )487 CALL logger_error("IOM CDF GET FILE VAR: find more than one "//& 488 & "depth variable in file "//& 489 & TRIM(td_file%c_name) ) 500 490 ENDIF 501 491 ENDIF … … 503 493 504 494 ! look for time id 505 IF( INDEX(TRIM( fct_lower(td_file%t_var(ji)%c_name)),'time')/=0 )THEN495 IF( INDEX(TRIM(td_file%t_var(ji)%c_name),'time') /= 0 )THEN 506 496 IF( td_file%i_timeid == 0 )THEN 507 497 td_file%i_timeid=ji … … 514 504 td_file%i_timeid=ji 515 505 !ELSE 516 ! CALL logger_error("IOM CDF GET FILE VAR: find more "//& 517 ! & "than one time variable in file "//& 506 ! print *,'error' 507 ! CALL logger_error("IOM OPEN: find more than one "//& 508 ! & "time variable in file "//& 518 509 ! & TRIM(td_file%c_name) ) 519 510 ENDIF … … 535 526 ! 536 527 !> @author J.Paul 537 !> @date November, 2013- Initial Version528 !> - November, 2013- Initial Version 538 529 ! 539 530 !> @param[inout] td_file file structure … … 576 567 ! 577 568 !> @author J.Paul 578 !> @date November, 2013 - Initial Version 579 !> @date February, 2015 - create unused dimension, when reading dimension 580 !> of length less or equal to zero 569 !> - November, 2013- Initial Version 581 570 ! 582 571 !> @param[in] td_file file structure … … 594 583 INTEGER(i4) :: il_len 595 584 CHARACTER(LEN=lc) :: cl_name 596 LOGICAL :: ll_use597 585 !---------------------------------------------------------------- 598 586 … … 613 601 il_status=NF90_INQUIRE_DIMENSION(td_file%i_id, id_dimid, & 614 602 & cl_name, il_len ) 615 CALL iom_cdf__check(il_status,"IOM CDF READ DIM: ") 616 617 ll_use=.TRUE. 618 IF( il_len <= 0 )THEN 619 CALL logger_warn( & 620 & " IOM CDF READ DIM: dimension "//TRIM(fct_str(id_dimid))//& 621 & " in file "//TRIM(td_file%c_name)//" is less or equel to zero") 622 il_len=1 623 ll_use=.FALSE. 624 ENDIF 625 iom_cdf__read_dim_id=dim_init(cl_name, il_len, ld_use=ll_use) 603 CALL iom_cdf__check(il_status) 604 605 iom_cdf__read_dim_id=dim_init(cl_name, il_len) 626 606 627 607 ENDIF … … 633 613 ! 634 614 !> @author J.Paul 635 !> @date November, 2013- Initial Version615 !> - November, 2013- Initial Version 636 616 ! 637 617 !> @param[in] td_file file structure … … 654 634 655 635 CALL logger_error( & 656 & " IOM CDF READ DIM: no id associated to file "//& 657 & TRIM(td_file%c_name)) 636 & " IOM CDF READ DIM: no id associated to file "//TRIM(td_file%c_name)) 658 637 659 638 ELSE … … 661 640 il_status=NF90_INQ_DIMID( td_file%i_id, TRIM(ADJUSTL(cd_name)), & 662 641 & il_dimid) 663 CALL iom_cdf__check(il_status ,"IOM CDF READ DIM: ")642 CALL iom_cdf__check(il_status) 664 643 665 644 iom_cdf__read_dim_name=iom_cdf_read_dim(td_file, il_dimid) … … 673 652 ! 674 653 !> @author J.Paul 675 !> @date November, 2013- Initial Version654 !> - November, 2013- Initial Version 676 655 ! 677 656 !> @param[in] td_file file structure … … 735 714 & il_len, & 736 715 & il_attid ) 737 CALL iom_cdf__check(il_status ,"IOM CDF READ ATT: ")716 CALL iom_cdf__check(il_status) 738 717 739 718 !! get attribute value 740 CALL logger_debug( " IOM CDF READ ATT: get attribute "// &741 & TRIM(cl_name)//" in file "//TRIM(td_file%c_name))719 CALL logger_debug( " IOM CDF READ ATT: get attribute "//TRIM(cl_name)//& 720 & " in file "//TRIM(td_file%c_name)) 742 721 743 722 SELECT CASE( il_type ) … … 749 728 750 729 CALL logger_error( & 751 & " IOM CDF READ ATT: not enough space to put "//&752 & "attribute "//TRIM(cl_name) )730 & " IOM CDF READ ATT: not enough space to put attribute "//& 731 & TRIM(cl_name) ) 753 732 754 733 ELSE … … 758 737 & cl_name, & 759 738 & cl_value ) 760 CALL iom_cdf__check(il_status ,"IOM CDF READ ATT: ")739 CALL iom_cdf__check(il_status) 761 740 762 741 iom_cdf__read_att_name=att_init(cl_name, cl_value) … … 779 758 & cl_name, & 780 759 & bl_value(:)) 781 CALL iom_cdf__check(il_status ,"IOM CDF READ ATT: ")760 CALL iom_cdf__check(il_status) 782 761 783 762 iom_cdf__read_att_name=att_init(cl_name, bl_value(:)) … … 794 773 795 774 CALL logger_error( & 796 & " IOM CDF READ ATT: not enough space to put "//&797 & "attribute "//TRIM(cl_name) )775 & " IOM CDF READ ATT: not enough space to put attribute "//& 776 & TRIM(cl_name) ) 798 777 799 778 ELSE … … 803 782 & cl_name, & 804 783 & sl_value(:)) 805 CALL iom_cdf__check(il_status ,"IOM CDF READ ATT: ")784 CALL iom_cdf__check(il_status) 806 785 807 786 iom_cdf__read_att_name=att_init(cl_name, sl_value(:)) … … 818 797 819 798 CALL logger_error( & 820 & " IOM CDF READ ATT: not enough space to put "//&821 & "attribute "//TRIM(cl_name) )799 & " IOM CDF READ ATT: not enough space to put attribute "//& 800 & TRIM(cl_name) ) 822 801 823 802 ELSE … … 827 806 & cl_name, & 828 807 & il_value(:)) 829 CALL iom_cdf__check(il_status ,"IOM CDF READ ATT: ")808 CALL iom_cdf__check(il_status) 830 809 831 810 iom_cdf__read_att_name=att_init(cl_name, il_value(:)) … … 841 820 842 821 CALL logger_error( & 843 & " IOM CDF READ ATT: not enough space to put "//&844 & "attribute "//TRIM(cl_name) )822 & " IOM CDF READ ATT: not enough space to put attribute "//& 823 & TRIM(cl_name) ) 845 824 846 825 ELSE … … 850 829 & cl_name, & 851 830 & fl_value(:)) 852 CALL iom_cdf__check(il_status ,"IOM CDF READ ATT: ")831 CALL iom_cdf__check(il_status) 853 832 854 833 iom_cdf__read_att_name=att_init(cl_name, fl_value(:)) … … 865 844 866 845 CALL logger_error( & 867 & " IOM CDF READ ATT: not enough space to put "//&868 & "attribute "//TRIM(cl_name) )846 & " IOM CDF READ ATT: not enough space to put attribute "//& 847 & TRIM(cl_name) ) 869 848 870 849 ELSE … … 874 853 & cl_name, & 875 854 & dl_value(:)) 876 CALL iom_cdf__check(il_status ,"IOM CDF READ ATT: ")855 CALL iom_cdf__check(il_status) 877 856 878 857 iom_cdf__read_att_name=att_init(cl_name, dl_value(:)) … … 894 873 ! 895 874 !> @author J.Paul 896 !> @date November, 2013- Initial Version875 !> - November, 2013- Initial Version 897 876 ! 898 877 !> @param[in] td_file file structure … … 923 902 ! get attribute name 924 903 il_status=NF90_INQ_ATTNAME(td_file%i_id, id_varid, id_attid, cl_name) 925 CALL iom_cdf__check(il_status ,"IOM CDF READ ATT: ")904 CALL iom_cdf__check(il_status) 926 905 927 906 ! read attribute … … 939 918 ! 940 919 !> @author J.Paul 941 !> @date November, 2013- Initial Version920 !> - November, 2013- Initial Version 942 921 ! 943 922 !> @param[in] td_file file structure … … 997 976 ! 998 977 !> @author J.Paul 999 !> @date November, 2013- Initial Version978 !> - November, 2013- Initial Version 1000 979 ! 1001 980 !> @param[in] td_file file structure … … 1064 1043 ! 1065 1044 !> @author J.Paul 1066 !> @date November, 2013- Initial Version1045 !> - November, 2013- Initial Version 1067 1046 ! 1068 1047 !> @param[inout] td_file file structure … … 1106 1085 ! 1107 1086 !> @author J.Paul 1108 !> @date November, 2013- Initial Version1087 !> - November, 2013- Initial Version 1109 1088 ! 1110 1089 !> @param[inout] td_file file structure … … 1169 1148 ! 1170 1149 !> @author J.Paul 1171 !> @date November, 2013- Initial Version1150 !> - November, 2013- Initial Version 1172 1151 ! 1173 1152 !> @param[inout] td_file file structure … … 1220 1199 ! 1221 1200 !> @author J.Paul 1222 !> @date November, 2013- Initial Version1201 !> - November, 2013- Initial Version 1223 1202 !> @date September, 2014 1224 1203 !> - force to use FillValue=1.e20 if no FillValue for coordinate variable. … … 1261 1240 1262 1241 ! inquire variable 1263 CALL logger_ debug( &1242 CALL logger_trace( & 1264 1243 & " IOM CDF READ VAR META: inquire variable "//& 1265 1244 & TRIM(fct_str(id_varid))//& … … 1274 1253 & il_dimid(:),& 1275 1254 & il_natt ) 1276 CALL iom_cdf__check(il_status ,"IOM CDF READ VAR META: ")1255 CALL iom_cdf__check(il_status) 1277 1256 !!! fill variable dimension structure 1278 1257 tl_dim(:)=iom_cdf__read_var_dim( td_file, il_ndim, il_dimid(:) ) 1279 1280 1258 IF( il_natt /= 0 )THEN 1281 1259 ALLOCATE( tl_att(il_natt) ) … … 1298 1276 ELSE 1299 1277 ! create attribute _FillValue 1300 SELECT CASE(TRIM( fct_lower(cl_name)))1278 SELECT CASE(TRIM(cl_name)) 1301 1279 CASE DEFAULT 1302 1280 CALL logger_info("IOM CDF READ VAR META: assume _FillValue is equal to "//& 1303 1281 & "zero for variable "//TRIM(cl_name) ) 1304 1282 tl_fill=att_init('_FillValue',0.) 1305 CASE('nav_lon','nav_lat', 'nav_lev',&1283 CASE('nav_lon','nav_lat', & 1306 1284 & 'glamt','glamu','glamv','glamf', & 1307 1285 & 'gphit','gphiu','gphiv','gphif') … … 1333 1311 ALLOCATE(tl_att(il_natt+1) ) 1334 1312 ! create attribute _FillValue 1335 SELECT CASE(TRIM( fct_lower(cl_name)))1313 SELECT CASE(TRIM(cl_name)) 1336 1314 CASE DEFAULT 1337 1315 CALL logger_info("IOM CDF READ VAR META: assume _FillValue is equal to "//& … … 1375 1353 ! 1376 1354 !> @author J.Paul 1377 !> @date November, 2013 - Initial Version 1378 !> @date July, 2015 1379 !> - Bug fix: use order to disorder table (see dim_init) 1380 !> 1355 !> - November, 2013- Initial Version 1356 ! 1381 1357 !> @param[in] td_file file structure 1382 1358 !> @param[in] id_ndim number of dimension … … 1395 1371 1396 1372 ! local variable 1397 INTEGER(i4), DIMENSION(ip_maxdim) :: il_ xyzt21373 INTEGER(i4), DIMENSION(ip_maxdim) :: il_2xyzt 1398 1374 1399 1375 TYPE(TDIM) , DIMENSION(ip_maxdim) :: tl_dim … … 1419 1395 1420 1396 DO ji = 1, id_ndim 1421 CALL logger_ debug( " IOM CDF READ VAR DIM: get variable"//&1422 & "dimension "//TRIM(fct_str(ji)) )1423 1424 il_ xyzt2(ji)=td_file%t_dim(id_dimid(ji))%i_xyzt21397 CALL logger_trace( " IOM CDF READ VAR DIM: get variable dimension "//& 1398 & TRIM(fct_str(ji)) ) 1399 1400 il_2xyzt(ji)=td_file%t_dim(id_dimid(ji))%i_2xyzt 1425 1401 1426 1402 ! read dimension information 1427 tl_dim(ji) = dim_init( td_file%t_dim(il_ xyzt2(ji))%c_name, &1428 & td_file%t_dim(il_ xyzt2(ji))%i_len )1403 tl_dim(ji) = dim_init( td_file%t_dim(il_2xyzt(ji))%c_name, & 1404 & td_file%t_dim(il_2xyzt(ji))%i_len ) 1429 1405 ENDDO 1430 1406 1431 1407 ! reorder dimension to ('x','y','z','t') 1432 1408 CALL dim_reorder(tl_dim(:)) 1433 1409 1434 1410 iom_cdf__read_var_dim(:)=dim_copy(tl_dim(:)) 1435 1411 … … 1450 1426 ! 1451 1427 !> @author J.Paul 1452 !> @date November, 2013- Initial Version1428 !> - November, 2013- Initial Version 1453 1429 ! 1454 1430 !> @param[in] td_file file structure … … 1499 1475 ! 1500 1476 !> @author J.Paul 1501 !> @date November, 2013 - Initial Version 1502 !> @date June, 2015 1503 !> - use scale factor and offset, as soon as read variable value 1477 !> - November, 2013- Initial Version 1504 1478 ! 1505 1479 !> @param[in] td_file file structure … … 1508 1482 !> @param[in] id_count number of indices selected along each dimension 1509 1483 !> @return variable structure completed 1484 ! 1485 !> @todo 1486 !> - warning do not change fill value when use scale factor.. 1510 1487 !------------------------------------------------------------------- 1511 1488 SUBROUTINE iom_cdf__read_var_value(td_file, td_var, & … … 1519 1496 1520 1497 ! local variable 1521 INTEGER(i4) :: il_status 1522 INTEGER(i4) :: il_tmp1 1523 INTEGER(i4) :: il_tmp2 1524 INTEGER(i4) :: il_varid 1525 INTEGER(i4), DIMENSION(ip_maxdim) :: il_start 1526 INTEGER(i4), DIMENSION(ip_maxdim) :: il_count 1527 INTEGER(i4), DIMENSION(ip_maxdim) :: il_start_ord 1528 INTEGER(i4), DIMENSION(ip_maxdim) :: il_count_ord 1529 1498 INTEGER(i4) :: il_status 1499 INTEGER(i4) :: il_tmp1 1500 INTEGER(i4) :: il_tmp2 1501 INTEGER(i4) :: il_varid 1502 INTEGER(i4), DIMENSION(ip_maxdim) :: il_start 1503 INTEGER(i4), DIMENSION(ip_maxdim) :: il_count 1504 INTEGER(i4), DIMENSION(ip_maxdim) :: il_start_ord 1505 INTEGER(i4), DIMENSION(ip_maxdim) :: il_count_ord 1530 1506 REAL(dp) , DIMENSION(:,:,:,:) , ALLOCATABLE :: dl_value 1531 1507 REAL(dp) , DIMENSION(:,:,:,:) , ALLOCATABLE :: dl_tmp … … 1542 1518 IF( ( PRESENT(id_start) .AND. (.NOT. PRESENT(id_count))) .OR. & 1543 1519 ((.NOT. PRESENT(id_start)) .AND. PRESENT(id_count) ) )THEN 1544 CALL logger_warn( "IOM CDF READ VAR VALUE: id_start and id_count"//&1545 & "should be both specify")1520 CALL logger_warn( & 1521 & "IOM CDF READ VAR VALUE: id_start and id_count should be both specify") 1546 1522 ENDIF 1547 1523 IF( PRESENT(id_start).AND.PRESENT(id_count) )THEN … … 1549 1525 IF( SIZE(id_start(:)) /= ip_maxdim .OR. & 1550 1526 & SIZE(id_count(:)) /= ip_maxdim )THEN 1551 CALL logger_error("IOM CDF READ VAR: dimension of array start "//&1552 & " or count are invalid to read variable "//&1553 & TRIM(td_var%c_name)//" in file "//TRIM(td_file%c_name) )1527 CALL logger_error("IOM CDF READ VAR: dimension of array start or count "//& 1528 & " are invalid to read variable "//TRIM(td_var%c_name)//& 1529 & " in file "//TRIM(td_file%c_name) ) 1554 1530 ENDIF 1555 1531 … … 1588 1564 & td_var%t_dim( 4 )%i_len & 1589 1565 & /)) )THEN 1566 1567 CALL logger_error( "IOM CDF READ VAR VALUE: start + count exceed "//& 1568 & "variable dimension for "//TRIM(td_var%c_name) ) 1590 1569 1591 1570 DO ji = 1, ip_maxdim … … 1596 1575 & TRIM(fct_str(il_tmp2))) 1597 1576 ENDDO 1598 CALL logger_error( "IOM CDF READ VAR VALUE: start + count exceed "//&1599 & "variable dimension for "//TRIM(td_var%c_name) )1600 1577 1601 1578 ELSE 1602 1579 1603 ! Allocate space to hold variable value ( disorder)1580 ! Allocate space to hold variable value (unorder) 1604 1581 ALLOCATE(dl_value( il_count(1), & 1605 1582 & il_count(2), & … … 1624 1601 & start = il_start(:),& 1625 1602 & count = il_count(:) ) 1626 CALL iom_cdf__check(il_status ,"IOM CDF READ VAR VALUE: ")1603 CALL iom_cdf__check(il_status) 1627 1604 1628 1605 ! Allocate space to hold variable value in structure … … 1686 1663 CALL var_chg_FillValue(td_var) 1687 1664 ENDIF 1688 1689 ! use scale factor and offset1690 WHERE( td_var%d_value(:,:,:,:) /= td_var%d_fill )1691 td_var%d_value(:,:,:,:) = &1692 & td_var%d_value(:,:,:,:)*td_var%d_scf + td_var%d_ofs1693 END WHERE1694 1695 1665 ENDIF 1696 1666 ELSE … … 1703 1673 !------------------------------------------------------------------- 1704 1674 !> @brief This subroutine write file structure in an opened netcdf file. 1705 !> 1706 !> @details 1707 !> optionally, you could specify dimension order (default 'xyzt') 1708 !> 1709 !> @author J.Paul 1710 !> @date November, 2013 - Initial Version 1711 !> @date July, 2015 1712 !> - add dimension order option 1675 ! 1676 !> @author J.Paul 1677 !> - November, 2013- Initial Version 1713 1678 ! 1714 1679 !> @param[inout] td_file file structure 1715 1680 !------------------------------------------------------------------- 1716 SUBROUTINE iom_cdf_write_file(td_file, cd_dimorder) 1717 IMPLICIT NONE 1718 ! Argument 1719 TYPE(TFILE) , INTENT(INOUT) :: td_file 1720 CHARACTER(LEN=*), INTENT(IN ), OPTIONAL :: cd_dimorder 1681 SUBROUTINE iom_cdf_write_file(td_file) 1682 IMPLICIT NONE 1683 ! Argument 1684 TYPE(TFILE), INTENT(INOUT) :: td_file 1721 1685 1722 1686 ! local variable 1723 1687 INTEGER(i4), DIMENSION(:), ALLOCATABLE :: il_value 1724 1725 CHARACTER(LEN=lc) :: cl_dimorder1726 1688 1727 1689 TYPE(TVAR) :: tl_var … … 1732 1694 INTEGER(i4) :: ji 1733 1695 INTEGER(i4) :: jj 1734 INTEGER(i4) :: jvar 1735 !---------------------------------------------------------------- 1736 1737 cl_dimorder='xyzt' 1738 IF( PRESENT(cd_dimorder) ) cl_dimorder=TRIM(cd_dimorder) 1696 !---------------------------------------------------------------- 1739 1697 1740 1698 ! check if file opened … … 1768 1726 ENDIF 1769 1727 1770 ! change dimension order1771 IF( TRIM(cl_dimorder) /= 'xyzt' )THEN1772 CALL dim_reorder(td_file%t_dim(:),TRIM(cl_dimorder))1773 DO jvar=1,td_file%i_nvar1774 CALL logger_debug("VAR REORDER: "//TRIM(td_file%t_var(jvar)%c_name))1775 CALL var_reorder(td_file%t_var(jvar),TRIM(cl_dimorder))1776 ENDDO1777 ENDIF1778 1779 1728 ! write dimension in file 1780 1729 DO ji = 1, ip_maxdim … … 1827 1776 ! 1828 1777 !> @author J.Paul 1829 !> @date November, 2013- Initial Version1778 !> - November, 2013- Initial Version 1830 1779 ! 1831 1780 !> @param[inout] td_file file structure … … 1849 1798 ! Enter define mode 1850 1799 il_status=NF90_REDEF(td_file%i_id) 1851 CALL iom_cdf__check(il_status ,"IOM CDF WRITE FILE DIM: ")1800 CALL iom_cdf__check(il_status) 1852 1801 1853 1802 td_file%l_def=.TRUE. … … 1864 1813 il_status=NF90_DEF_DIM(td_file%i_id, fct_upper(td_dim%c_sname), & 1865 1814 & NF90_UNLIMITED, td_dim%i_id) 1866 CALL iom_cdf__check(il_status ,"IOM CDF WRITE FILE DIM: ")1815 CALL iom_cdf__check(il_status) 1867 1816 1868 1817 ELSE 1869 1818 ! write not unlimited dimension 1870 CALL logger_ debug( &1819 CALL logger_trace( & 1871 1820 & "IOM CDF WRITE FILE DIM: write dimension "//TRIM(td_dim%c_name)//& 1872 1821 & " in file "//TRIM(td_file%c_name)) … … 1874 1823 il_status=NF90_DEF_DIM(td_file%i_id, fct_upper(td_dim%c_sname), & 1875 1824 & td_dim%i_len, td_dim%i_id) 1876 CALL iom_cdf__check(il_status ,"IOM CDF WRITE FILE DIM: ")1825 CALL iom_cdf__check(il_status) 1877 1826 1878 1827 ENDIF … … 1885 1834 ! 1886 1835 !> @author J.Paul 1887 !> @date November, 2013- Initial Version1836 !> - November, 2013- Initial Version 1888 1837 ! 1889 1838 !> @param[inout] td_file file structure … … 1910 1859 ! Enter define mode 1911 1860 il_status=NF90_REDEF(td_file%i_id) 1912 CALL iom_cdf__check(il_status ,"IOM CDF WRITE FILE ATT: ")1861 CALL iom_cdf__check(il_status) 1913 1862 1914 1863 td_file%l_def=.TRUE. … … 1927 1876 il_status = NF90_PUT_ATT(td_file%i_id, id_varid, & 1928 1877 & td_att%c_name, td_att%c_value ) 1929 CALL iom_cdf__check(il_status ,"IOM CDF WRITE FILE ATT: ")1878 CALL iom_cdf__check(il_status) 1930 1879 1931 1880 CASE(NF90_BYTE, NF90_SHORT, NF90_INT, NF90_FLOAT, NF90_DOUBLE) … … 1933 1882 il_status = NF90_PUT_ATT(td_file%i_id, id_varid, & 1934 1883 & td_att%c_name, td_att%d_value ) 1935 CALL iom_cdf__check(il_status ,"IOM CDF WRITE FILE ATT: ")1884 CALL iom_cdf__check(il_status) 1936 1885 1937 1886 END SELECT … … 1942 1891 ! 1943 1892 !> @author J.Paul 1944 !> @date November, 2013- Initial Version1893 !> - November, 2013- Initial Version 1945 1894 ! 1946 1895 !> @param[inout] td_file file structure … … 1968 1917 ! Enter define mode 1969 1918 il_status=NF90_REDEF(td_file%i_id) 1970 CALL iom_cdf__check(il_status ,"IOM CDF WRITE VAR: ")1919 CALL iom_cdf__check(il_status) 1971 1920 1972 1921 td_file%l_def=.TRUE. 1973 1922 1974 1923 ENDIF 1975 1924 1976 1925 ! check if file and variable dimension conform 1977 1926 IF( file_check_var_dim(td_file, td_var) )THEN … … 1989 1938 ENDIF 1990 1939 ENDDO 1991 ! ugly patch until NEMO do not force to use 0. as FillValue1992 1940 IF( ll_chg )THEN 1993 1941 ! not a dimension variable 1994 1942 ! change FillValue 1995 SELECT CASE( TRIM(fct_lower(td_var%c_name)) ) 1996 CASE DEFAULT 1997 CALL var_chg_FillValue(td_var,0._dp) 1998 CASE('nav_lon','nav_lat', & 1999 & 'glamt','glamu','glamv','glamf', & 2000 & 'gphit','gphiu','gphiv','gphif') 2001 END SELECT 1943 1944 ! ugly patch until NEMO do not force to use 0. as FillValue 1945 CALL var_chg_FillValue(td_var,0._dp) 2002 1946 ENDIF 2003 1947 … … 2013 1957 ! Leave define mode 2014 1958 il_status=NF90_ENDDEF(td_file%i_id) 2015 CALL iom_cdf__check(il_status ,"IOM CDF WRITE VAR: ")1959 CALL iom_cdf__check(il_status) 2016 1960 2017 1961 td_file%l_def=.FALSE. … … 2031 1975 ! 2032 1976 !> @author J.Paul 2033 !> @date November, 2013- Initial Version1977 !> - November, 2013- Initial Version 2034 1978 ! 2035 1979 !> @param[in] td_file file structure … … 2058 2002 tl_var=var_copy(td_var) 2059 2003 2060 ! forced to use float type2061 IF( tl_var%d_unf /= 1. .AND. tl_var%i_type==NF90_SHORT )THEN2062 tl_var%i_type=NF90_FLOAT2063 ENDIF2064 2065 2004 IF( ALL( .NOT. tl_var%t_dim(:)%l_use ) )THEN 2066 CALL logger_debug( &2067 & "IOM CDF WRITE VAR DEF scalar: define variable "//&2068 & TRIM(tl_var%c_name)//" in file "//TRIM(td_file%c_name))2069 2005 ! scalar value 2070 2006 il_status = NF90_DEF_VAR(td_file%i_id, TRIM(tl_var%c_name), & 2071 2007 & tl_var%i_type, varid=iom_cdf__write_var_def) 2072 CALL iom_cdf__check(il_status ,"IOM CDF WRITE VAR DEF: ")2008 CALL iom_cdf__check(il_status) 2073 2009 ELSE 2074 2010 … … 2084 2020 ENDDO 2085 2021 2086 CALL logger_ debug( &2022 CALL logger_trace( & 2087 2023 & "IOM CDF WRITE VAR DEF: define dimension to be used for variable "//& 2088 2024 & TRIM(tl_var%c_name)//" in file "//TRIM(td_file%c_name)) 2089 2025 2090 2026 DO ji=1,jj 2091 CALL logger_ debug("IOM CDF WRITE VAR DEF: dimid "//TRIM(fct_str(il_dimid(ji))) )2027 CALL logger_trace("IOM CDF WRITE VAR DEF: dimid "//TRIM(fct_str(il_dimid(ji))) ) 2092 2028 ENDDO 2093 2094 2029 il_status = NF90_DEF_VAR(td_file%i_id, TRIM(tl_var%c_name), & 2095 2030 & tl_var%i_type, & 2096 2031 & il_dimid(1:jj), & 2097 2032 & varid=iom_cdf__write_var_def ) 2098 CALL iom_cdf__check(il_status ,"IOM CDF WRITE VAR DEF: ")2033 CALL iom_cdf__check(il_status) 2099 2034 ENDIF 2100 2035 … … 2108 2043 2109 2044 DO ji = 1, tl_var%i_natt 2110 CALL logger_ debug( &2045 CALL logger_trace( & 2111 2046 & " IOM CDF WRITE VAR DEF: put attribute "//TRIM(tl_var%t_att(ji)%c_name)//& 2112 2047 & " for variable "//TRIM(tl_var%c_name)//& 2113 2048 & " in file "//TRIM(td_file%c_name) ) 2114 2115 ! forced FillValue to have same type than variable2116 IF( TRIM(tl_var%t_att(ji)%c_name) == '_FillValue' )THEN2117 tl_var%t_att(ji)%i_type=tl_var%i_type2118 ENDIF2119 2049 2120 2050 IF( tl_var%t_att(ji)%i_type == NF90_CHAR )THEN … … 2123 2053 & TRIM(tl_var%t_att(ji)%c_name), & 2124 2054 & TRIM(tl_var%t_att(ji)%c_value) ) 2125 CALL iom_cdf__check(il_status ,"IOM CDF WRITE VAR DEF: ")2055 CALL iom_cdf__check(il_status) 2126 2056 ENDIF 2127 2057 ELSE … … 2152 2082 & TRIM(tl_var%t_att(ji)%c_name), & 2153 2083 & REAL(tl_var%t_att(ji)%d_value(:),dp)) 2154 END SELECT2155 CALL iom_cdf__check(il_status ,"IOM CDF WRITE VAR DEF: ")2084 END SELECT 2085 CALL iom_cdf__check(il_status) 2156 2086 ENDIF 2157 2087 ENDDO … … 2167 2097 ! 2168 2098 !> @author J.Paul 2169 !> @date November, 2013 - Initial Version 2170 !> @date June, 2015 2171 !> - reuse scale factor and offset, before writing variable 2099 !> - November, 2013- Initial Version 2172 2100 ! 2173 2101 !> @param[in] td_file file structure … … 2194 2122 & "IOM CDF WRITE VAR VALUE: get dimension to be used for variable "//& 2195 2123 & TRIM(td_var%c_name)//" in file "//TRIM(td_file%c_name)) 2196 2197 ! use scale factor and offset 2198 WHERE( td_var%d_value(:,:,:,:) /= td_var%d_fill ) 2199 td_var%d_value(:,:,:,:) = & 2200 & (td_var%d_value(:,:,:,:)-td_var%d_ofs)/td_var%d_scf 2201 END WHERE 2202 2124 2203 2125 jj=0 2204 2126 DO ji = 1, ip_maxdim … … 2231 2153 2232 2154 il_status = NF90_PUT_VAR( td_file%i_id, td_var%i_id, dl_value(:,:,:,:)) 2233 CALL iom_cdf__check(il_status ,"IOM CDF WRITE VAR VALUE: ")2155 CALL iom_cdf__check(il_status) 2234 2156 2235 2157 DEALLOCATE( dl_value ) -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/iom_dom.f90
r10248 r10251 71 71 !> 72 72 !> @author J.Paul 73 !> @date October, 2014- Initial Version73 !> - October, 2014- Initial Version 74 74 ! 75 75 !> @param[inout] td_mpp mpp structure … … 106 106 !> 107 107 !> @author J.Paul 108 !> @date October, 2014- Initial Version108 !> - October, 2014- Initial Version 109 109 ! 110 110 !> @param[in] td_mpp mpp structure … … 130 130 !> 131 131 !> @author J.Paul 132 !> @date October, 2014- Initial Version132 !> - October, 2014- Initial Version 133 133 !> 134 134 !> @param[in] td_mpp mpp structure … … 194 194 ! 195 195 !> @author J.Paul 196 !> @date October, 2014- Initial Version196 !> - October, 2014- Initial Version 197 197 ! 198 198 !> @param[in] td_mpp mpp structure … … 246 246 !> 247 247 !> @author J.Paul 248 !> @date October, 2014- Initial Version248 !> - October, 2014- Initial Version 249 249 !> 250 250 !> @todo … … 411 411 !> 412 412 !> @author J.Paul 413 !> @date October, 2014- Initial Version413 !> - October, 2014- Initial Version 414 414 ! 415 415 !> @param[in] td_mpp mpp structure … … 465 465 !> 466 466 !> @author J.Paul 467 !> @date October, 2014- Initial Version467 !> - October, 2014- Initial Version 468 468 !> 469 469 !> @param[in] td_mpp mpp structure … … 524 524 !> 525 525 !> @author J.Paul 526 !> @date October, 2014- Initial Version526 !> - October, 2014- Initial Version 527 527 !> 528 528 !> @param[in] td_mpp mpp structure … … 636 636 !> 637 637 !> @author J.Paul 638 !> @date October, 2014- Initial Version638 !> - October, 2014- Initial Version 639 639 ! 640 640 !> @param[in] td_mpp mpp structure … … 663 663 !> 664 664 !> @author J.Paul 665 !> @date October, 2014- Initial Version665 !> - October, 2014- Initial Version 666 666 ! 667 667 !> @param[in] td_mpp mpp structure … … 691 691 !> 692 692 !> @author J.Paul 693 !> @date October, 2014- Initial Version693 !> - October, 2014- Initial Version 694 694 ! 695 695 !> @param[in] td_mpp mpp structure -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/iom_mpp.f90
r10248 r10251 87 87 !> J.Paul 88 88 ! REVISION HISTORY: 89 !> @date Nov ember, 2013 - Initial Version89 !> @date Nov, 2013 - Initial Version 90 90 !> 91 91 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 137 137 !> 138 138 !> @author J.Paul 139 !> @date November, 2013- Initial Version139 !> - November, 2013- Initial Version 140 140 ! 141 141 !> @param[inout] td_mpp mpp structure … … 161 161 162 162 ELSE 163 !164 td_mpp%i_id=1165 166 163 ! if no processor file selected 167 164 ! force to open all files … … 224 221 !> 225 222 !> @author J.Paul 226 !> @date November, 2013- Initial Version223 !> - November, 2013- Initial Version 227 224 ! 228 225 !> @param[inout] td_mpp mpp structure … … 251 248 !> 252 249 !> @author J.Paul 253 !> @date November, 2013- Initial Version250 !> - November, 2013- Initial Version 254 251 ! 255 252 !> @param[in] td_mpp mpp structure … … 270 267 271 268 ELSE 272 !273 td_mpp%i_id=0274 275 269 DO ji=1,td_mpp%i_nproc 276 270 IF( td_mpp%t_proc(ji)%i_id /= 0 )THEN … … 291 285 !> 292 286 !> @author J.Paul 293 !> @date November, 2013- Initial Version287 !> - November, 2013- Initial Version 294 288 !> @date October, 2014 295 289 !> - use start and count array instead of domain structure. … … 320 314 & " in mpp strcuture "//TRIM(td_mpp%c_name)) 321 315 322 ELSEIF( td_mpp%i_id == 0 )THEN323 324 CALL logger_error( " IOM MPP READ VAR: mpp structure not opened. "//&325 & " can not read variable in "//TRIM(td_mpp%c_name))326 327 316 ELSE 328 329 317 330 318 IF( ANY(td_mpp%t_proc(:)%i_id /= 0) )THEN … … 367 355 ! 368 356 !> @author J.Paul 369 !> @date November, 2013- Initial Version357 !> - November, 2013- Initial Version 370 358 !> @date October, 2014 371 359 !> - use start and count array instead of domain structure. … … 396 384 & " in mpp strcuture "//TRIM(td_mpp%c_name)) 397 385 398 ELSEIF( td_mpp%i_id == 0 )THEN399 400 CALL logger_error( " IOM MPP READ VAR: mpp structure not opened. "//&401 & " can not read variable in "//TRIM(td_mpp%c_name))402 403 386 ELSE 404 387 … … 417 400 CALL logger_error( & 418 401 & " IOM MPP READ VAR: there is no variable with "//& 419 & "name or standard name 402 & "name or standard name"//TRIM(cd_name)//& 420 403 & " in processor/file "//TRIM(td_mpp%t_proc(1)%c_name)) 421 404 ENDIF … … 433 416 ! 434 417 !> @author J.Paul 435 !> @date November, 2013- Initial Version418 !> - November, 2013- Initial Version 436 419 !> @date October, 2014 437 420 !> - use start and count array instead of domain structure. … … 484 467 IF( PRESENT(id_count) ) il_count(:)=id_count(:) 485 468 486 CALL logger_debug("IOM MPP READ VAR VALUE: start "//&487 & TRIM(fct_str(il_start(jp_I)))//","//&488 & TRIM(fct_str(il_start(jp_J)))//","//&489 & TRIM(fct_str(il_start(jp_K)))//","//&490 & TRIM(fct_str(il_start(jp_L))) )491 CALL logger_debug("IOM MPP READ VAR VALUE: count "//&492 & TRIM(fct_str(il_count(jp_I)))//","//&493 & TRIM(fct_str(il_count(jp_J)))//","//&494 & TRIM(fct_str(il_count(jp_K)))//","//&495 & TRIM(fct_str(il_count(jp_L))) )496 497 469 DO jk=1,ip_maxdim 498 470 IF( .NOT. td_var%t_dim(jk)%l_use )THEN … … 504 476 ENDDO 505 477 478 506 479 IF( ANY(il_end(:) > td_mpp%t_dim(:)%i_len) )THEN 507 CALL logger_debug("IOM MPP READ VAR VALUE: start + count "//&508 & TRIM(fct_str(il_end(jp_I)))//","//&509 & TRIM(fct_str(il_end(jp_J)))//","//&510 & TRIM(fct_str(il_end(jp_K)))//","//&511 & TRIM(fct_str(il_end(jp_L))) )512 CALL logger_debug("IOM MPP READ VAR VALUE: dimension "//&513 & TRIM(fct_str(td_mpp%t_dim(jp_I)%i_len))//","//&514 & TRIM(fct_str(td_mpp%t_dim(jp_J)%i_len))//","//&515 & TRIM(fct_str(td_mpp%t_dim(jp_K)%i_len))//","//&516 & TRIM(fct_str(td_mpp%t_dim(jp_L)%i_len)) )517 480 CALL logger_fatal("IOM MPP READ VAR VALUE: start + count "//& 518 481 & "exceed dimension bound.") … … 620 583 ! 621 584 !> @details 622 !> optionally, you could specify the dimension order (default 'xyzt')623 585 ! 624 586 !> @author J.Paul 625 !> @date November, 2013 - Initial Version 626 !> @date July, 2015 - add dimension order option 587 !> - November, 2013- Initial Version 627 588 ! 628 589 !> @param[inout] td_mpp mpp structure 629 !> @param[In] cd_dimorder dimension order 630 !------------------------------------------------------------------- 631 SUBROUTINE iom_mpp_write_file(td_mpp, cd_dimorder) 590 !------------------------------------------------------------------- 591 SUBROUTINE iom_mpp_write_file(td_mpp) 632 592 IMPLICIT NONE 633 593 ! Argument 634 TYPE(TMPP) , INTENT(INOUT) :: td_mpp 635 CHARACTER(LEN=*), INTENT(IN ), OPTIONAL :: cd_dimorder 594 TYPE(TMPP), INTENT(INOUT) :: td_mpp 636 595 637 596 ! local variable … … 651 610 !CALL file_del_att(td_mpp%t_proc(ji), 'ew_overlap') 652 611 653 CALL iom_write_file(td_mpp%t_proc(ji) , cd_dimorder)612 CALL iom_write_file(td_mpp%t_proc(ji)) 654 613 ELSE 655 614 CALL logger_debug( " MPP WRITE: no id associated to file "//& -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/iom_rstdimg.f90
r10248 r10251 131 131 !> 132 132 !> @author J.Paul 133 !> @date November, 2013- Initial Version133 !> - November, 2013- Initial Version 134 134 ! 135 135 !> @param[inout] td_file file structure … … 284 284 !> 285 285 !> @author J.Paul 286 !> @date November, 2013- Initial Version286 !> - November, 2013- Initial Version 287 287 ! 288 288 !> @param[inout] td_file file structure … … 328 328 !> 329 329 !> @author J.Paul 330 !> @date November, 2013- Initial Version330 !> - November, 2013- Initial Version 331 331 ! 332 332 !> @param[inout] td_file file structure … … 394 394 !> 395 395 !> @author J.Paul 396 !> @date November, 2013- Initial Version396 !> - November, 2013- Initial Version 397 397 ! 398 398 !> @param[inout] td_file file structure … … 544 544 ! 545 545 !> @author J.Paul 546 !> @date November, 2013- Initial Version546 !> - November, 2013- Initial Version 547 547 ! 548 548 !> @param[inout] td_file file structure … … 636 636 ! 637 637 !> @author J.Paul 638 !> @date November, 2013- Initial Version638 !> - November, 2013- Initial Version 639 639 ! 640 640 !> @param[inout] td_file file structure … … 688 688 ! 689 689 !> @author J.Paul 690 !> @date November, 2013- Initial Version690 !> - November, 2013- Initial Version 691 691 ! 692 692 !> @param[inout] td_file file structure … … 733 733 ! 734 734 !> @author J.Paul 735 !> @date November, 2013- Initial Version735 !> - November, 2013- Initial Version 736 736 ! 737 737 !> @param[inout] td_file file structure … … 778 778 ! 779 779 !> @author J.Paul 780 !> @date November, 2013- Initial Version780 !> - November, 2013- Initial Version 781 781 ! 782 782 !> @param[inout] td_file file structure … … 820 820 ! 821 821 !> @author J.Paul 822 !> @date November, 2013- Initial Version822 !> - Nov, 2013- Initial Version 823 823 ! 824 824 !> @param[in] td_file file structure … … 863 863 ! 864 864 !> @author J.Paul 865 !> @date November, 2013- Initial Version865 !> - Nov, 2013- Initial Version 866 866 ! 867 867 !> @param[in] td_file file structure … … 907 907 ! 908 908 !> @author J.Paul 909 !> @date November, 2013- Initial Version909 !> - November, 2013- Initial Version 910 910 ! 911 911 !> @param[in] td_file file structure … … 972 972 ! 973 973 !> @author J.Paul 974 !> @date November, 2013- Initial Version974 !> - November, 2013- Initial Version 975 975 ! 976 976 !> @param[in] td_file file structure … … 1037 1037 !> 1038 1038 !> @author J.Paul 1039 !> @date November, 2013- Initial Version1039 !> - November, 2013- Initial Version 1040 1040 ! 1041 1041 !> @param[in] td_file file structure … … 1058 1058 INTEGER(i4), DIMENSION(ip_maxdim) :: il_start 1059 1059 INTEGER(i4), DIMENSION(ip_maxdim) :: il_count 1060 1061 1060 REAL(dp), DIMENSION(:,:,:,:), ALLOCATABLE :: dl_value 1062 1061 … … 1205 1204 ENDIF 1206 1205 1207 ! force to change _FillValue to avoid mistake1208 ! with dummy zero _FillValue1209 IF( td_var%d_fill == 0._dp )THEN1210 CALL var_chg_FillValue(td_var)1211 ENDIF1212 1213 ! use scale factor and offset1214 WHERE( td_var%d_value(:,:,:,:) /= td_var%d_fill )1215 td_var%d_value(:,:,:,:) = &1216 & td_var%d_value(:,:,:,:)*td_var%d_scf + td_var%d_ofs1217 END WHERE1218 1219 1206 END SUBROUTINE iom_rstdimg__read_var_value 1220 1207 !------------------------------------------------------------------- … … 1225 1212 !> 1226 1213 !> @author J.Paul 1227 !> @date November, 2013- Initial Version1214 !> - November, 2013- Initial Version 1228 1215 !> @date September, 2014 1229 1216 !> - use iom_rstdimg__get_rec … … 1321 1308 !> 1322 1309 !> @author J.Paul 1323 !> @date September, 2014- Initial Version1310 !> - September, 2014- Initial Version 1324 1311 ! 1325 1312 !> @param[inout] td_file file structure … … 1426 1413 ! 1427 1414 !> @author J.Paul 1428 !> @date November, 2013- Initial Version1415 !> - November, 2013- Initial Version 1429 1416 ! 1430 1417 !> @param[inout] td_file file structure … … 1643 1630 !> 1644 1631 !> @author J.Paul 1645 !> @date November, 2013 - Initial Version 1646 !> @date July, 2015 1647 !> - bug fix: do not use scale factor an offset for case no0d, no1d... 1632 !> - November, 2013- Initial Version 1648 1633 !> 1649 !> @param[in] td_file file structure1634 !> @param[in] id_fileid file id 1650 1635 !------------------------------------------------------------------- 1651 1636 SUBROUTINE iom_rstdimg__write_var(td_file) … … 1682 1667 CASE('no0d','no1d','no2d','no3d') 1683 1668 CASE DEFAULT 1684 1685 ! use scale factor and offset1686 WHERE( td_file%t_var(ji)%d_value(:,:,:,:) /= &1687 & td_file%t_var(ji)%d_fill )1688 td_file%t_var(ji)%d_value(:,:,:,:) = &1689 & ( td_file%t_var(ji)%d_value(:,:,:,:) - &1690 & td_file%t_var(ji)%d_ofs ) / &1691 & td_file%t_var(ji)%d_scf1692 END WHERE1693 1694 1669 DO jk=1,td_file%t_var(ji)%t_dim(3)%i_len 1695 1670 SELECT CASE (td_file%t_var(ji)%i_ndim) -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/logger.f90
r10248 r10251 16 16 !> but not necessarily "wrong". 17 17 !> - error : Other runtime errors or unexpected conditions. 18 !> - fatal : Severe errors that cause premature termination. 18 !> - fatal : Severe errors that cause premature termination.<br /> 19 19 !> default verbosity is warning 20 !> - none : to not create and write any information in logger file.<br />21 20 ! 22 21 !> If total number of error exceeded maximum number … … 25 24 !> to open/create logger file:<br/> 26 25 !> @code 27 !> CALL logger_open(cd_file, [cd_verbosity,] [id_ maxerror,] [id_loggerid])26 !> CALL logger_open(cd_file, [cd_verbosity,] [id_loggerid,] [id_maxerror]) 28 27 !> @endcode 29 28 !> - cd_file is logger file name … … 121 120 !> J.Paul 122 121 ! REVISION HISTORY: 123 !> @date November, 2013 - Initial Version 124 !> @date February, 2015 125 !> - check verbosity validity 126 !> - add 'none' verbosity level to not used logger file 122 !> @date November, 2013- Initial Version 127 123 !> 128 124 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 155 151 156 152 PRIVATE :: logger__write ! cut message to get maximum of 80 character by line in log file 157 PRIVATE :: logger__check_verb! check verbosity validity158 153 159 154 TYPE TLOGGER !< logger structure 160 155 INTEGER(i4) :: i_id = 0 !< log file id 161 LOGICAL :: l_use=.TRUE. !< use logger or not162 156 CHARACTER(LEN=lc) :: c_name !< log file name 163 157 CHARACTER(LEN=lc) :: c_verbosity = "warning" !< verbosity choose … … 169 163 170 164 ! module variable 171 INTEGER(i4), PARAMETER :: im_nverbosity= 7!< number of log level165 INTEGER(i4), PARAMETER :: im_nverbosity=6 !< number of log level 172 166 CHARACTER(len=*), DIMENSION(im_nverbosity), PARAMETER :: cm_verbosity= & !< verbosity array 173 167 & (/ 'trace ',& … … 176 170 & 'warning ',& 177 171 & 'error ',& 178 & 'fatal ',& 179 & 'none '/) 172 & 'fatal '/) 180 173 181 174 TYPE(TLOGGER), SAVE :: tm_logger !< logger structure … … 191 184 !> 192 185 !> @author J.Paul 193 !> @date November, 2013- Initial Version186 !> - November, 2013- Initial Version 194 187 ! 195 188 !> @param[in] cd_file log file name 196 189 !> @param[in] cd_verbosity log file verbosity 190 !> @param[in] id_logid log file id (use to flush) 197 191 !> @param[in] id_maxerror maximum number of error 198 !> @param[in] id_logid log file id (use to flush) 199 !------------------------------------------------------------------- 200 SUBROUTINE logger_open(cd_file, cd_verbosity, id_maxerror, id_logid) 192 !------------------------------------------------------------------- 193 SUBROUTINE logger_open(cd_file, cd_verbosity, id_logid, id_maxerror) 201 194 IMPLICIT NONE 202 195 ! Argument 203 196 CHARACTER(len=*), INTENT(IN) :: cd_file ! log file name 204 197 CHARACTER(len=*), INTENT(IN), OPTIONAL :: cd_verbosity ! log file verbosity 198 INTEGER(i4), INTENT(IN), OPTIONAL :: id_logid ! log file id 205 199 INTEGER(i4), INTENT(IN), OPTIONAL :: id_maxerror ! log max error 206 INTEGER(i4), INTENT(IN), OPTIONAL :: id_logid ! log file id207 200 208 201 ! local variable 209 202 INTEGER(i4) :: il_status 210 203 211 LOGICAL :: ll_valid212 213 204 ! loop 214 205 INTEGER(i4) :: ji 215 206 !---------------------------------------------------------------- 207 ! get id if not already define 208 IF( PRESENT(id_logid) )THEN 209 tm_logger%i_id=id_logid 210 ELSE 211 tm_logger%i_id=fct_getunit() 212 ENDIF 213 214 ! open log file 215 OPEN( tm_logger%i_id, & 216 & STATUS="unknown", & 217 & FILE=TRIM(ADJUSTL(cd_file)), & 218 & ACTION="write", & 219 & POSITION="append", & 220 & IOSTAT=il_status) 221 CALL fct_err(il_status) 222 223 ! keep filename 224 tm_logger%c_name=TRIM(ADJUSTL(cd_file)) 216 225 217 226 ! if present, change verbosity value 218 227 IF( PRESENT(cd_verbosity) )THEN 219 ll_valid=logger__check_verb(TRIM(ADJUSTL(cd_verbosity))) 220 IF( ll_valid )THEN 221 tm_logger%c_verbosity=TRIM(ADJUSTL(cd_verbosity)) 222 ENDIF 223 ENDIF 224 225 IF( TRIM(tm_logger%c_verbosity) == 'none' ) tm_logger%l_use=.FALSE. 226 227 IF( tm_logger%l_use )THEN 228 229 ! get id if not already define 230 IF( PRESENT(id_logid) )THEN 231 tm_logger%i_id=id_logid 232 ELSE 233 tm_logger%i_id=fct_getunit() 234 ENDIF 235 236 ! open log file 237 OPEN( tm_logger%i_id, & 238 & STATUS="unknown", & 239 & FILE=TRIM(ADJUSTL(cd_file)), & 240 & ACTION="write", & 241 & POSITION="append", & 242 & IOSTAT=il_status) 243 CALL fct_err(il_status) 244 245 ! keep filename 246 tm_logger%c_name=TRIM(ADJUSTL(cd_file)) 247 248 ! compute "tab" of verbosity to be used 249 IF( TRIM(ADJUSTL(tm_logger%c_verb)) == "" )THEN 250 DO ji=im_nverbosity,1,-1 251 tm_logger%c_verb = & 252 & TRIM(tm_logger%c_verb)//" "//TRIM(ADJUSTL(cm_verbosity(ji))) 253 IF( TRIM(tm_logger%c_verbosity) == TRIM(cm_verbosity(ji)) )THEN 254 EXIT 255 ENDIF 256 ENDDO 257 ENDIF 258 259 IF( PRESENT(id_maxerror) )THEN 260 tm_logger%i_maxerror=id_maxerror 261 ENDIF 262 228 tm_logger%c_verbosity=TRIM(ADJUSTL(cd_verbosity)) 229 ENDIF 230 231 ! compute "tab" of verbosity to be used 232 IF( TRIM(ADJUSTL(tm_logger%c_verb)) == "" )THEN 233 DO ji=im_nverbosity,1,-1 234 tm_logger%c_verb = & 235 & TRIM(tm_logger%c_verb)//" "//TRIM(ADJUSTL(cm_verbosity(ji))) 236 IF( TRIM(tm_logger%c_verbosity) == TRIM(cm_verbosity(ji)) )THEN 237 EXIT 238 ENDIF 239 ENDDO 240 ENDIF 241 242 IF( PRESENT(id_maxerror) )THEN 243 tm_logger%i_maxerror=id_maxerror 263 244 ENDIF 264 245 … … 268 249 !> 269 250 !> @author J.Paul 270 !> @date November, 2013- Initial Version251 !> - November, 2013- Initial Version 271 252 !------------------------------------------------------------------- 272 253 SUBROUTINE logger_close() … … 275 256 INTEGER(i4) :: il_status 276 257 !---------------------------------------------------------------- 277 IF( tm_logger%l_use )THEN 278 IF( tm_logger%i_id /= 0 )THEN 279 tm_logger%i_id = 0 280 CLOSE( tm_logger%i_id, & 281 & IOSTAT=il_status) 282 CALL fct_err(il_status) 283 ELSE 284 CALL logger_open('logger.log') 285 CALL logger_header() 286 CALL logger_fatal('you must have create logger to use logger_close') 287 ENDIF 258 IF( tm_logger%i_id /= 0 )THEN 259 tm_logger%i_id = 0 260 CLOSE( tm_logger%i_id, & 261 & IOSTAT=il_status) 262 CALL fct_err(il_status) 263 ELSE 264 CALL logger_open('logger.log') 265 CALL logger_header() 266 CALL logger_fatal('you must have create logger to use logger_close') 288 267 ENDIF 289 268 … … 293 272 !> 294 273 !> @author J.Paul 295 !> @date November, 2013- Initial Version274 !> - November, 2013- Initial Version 296 275 !------------------------------------------------------------------- 297 276 SUBROUTINE logger_flush() 298 277 IMPLICIT NONE 299 278 !---------------------------------------------------------------- 300 IF( tm_logger%l_use )THEN 301 IF( tm_logger%i_id /= 0 )THEN 302 CALL logger_close() 303 CALL logger_open( tm_logger%c_name, tm_logger%c_verbosity, & 304 & tm_logger%i_maxerror, tm_logger%i_id ) 305 ELSE 306 CALL logger_open('logger.log') 307 CALL logger_header() 308 CALL logger_fatal('you must have create logger to use logger_flush') 309 ENDIF 279 IF( tm_logger%i_id /= 0 )THEN 280 CALL logger_close() 281 CALL logger_open( tm_logger%c_name, tm_logger%c_verbosity, tm_logger%i_id, & 282 & tm_logger%i_maxerror ) 283 ELSE 284 CALL logger_open('logger.log') 285 CALL logger_header() 286 CALL logger_fatal('you must have create logger to use logger_flush') 310 287 ENDIF 311 288 … … 315 292 !> 316 293 !> @author J.Paul 317 !> @date November, 2013- Initial Version294 !> - November, 2013- Initial Version 318 295 !------------------------------------------------------------------- 319 296 RECURSIVE SUBROUTINE logger_header() … … 322 299 INTEGER(i4) :: il_status 323 300 !---------------------------------------------------------------- 324 IF( tm_logger%l_use )THEN 325 IF( tm_logger%i_id /= 0 )THEN 326 WRITE( tm_logger%i_id, & 327 & FMT='(4(a/))', & 328 & IOSTAT=il_status ) & 329 & "--------------------------------------------------",& 330 & "INIT : verbosity "//TRIM(tm_logger%c_verbosity),& 331 & "INIT : max error "//TRIM(fct_str(tm_logger%i_maxerror)), & 332 & "--------------------------------------------------" 333 CALL fct_err(il_status) 334 ELSE 335 CALL logger_open('logger.log') 336 CALL logger_header() 337 CALL logger_fatal('you must have create logger to use logger_header') 338 ENDIF 301 IF( tm_logger%i_id /= 0 )THEN 302 WRITE( tm_logger%i_id, & 303 & FMT='(4(a/))', & 304 & IOSTAT=il_status ) & 305 & "--------------------------------------------------",& 306 & "INIT : verbosity "//TRIM(tm_logger%c_verbosity),& 307 & "INIT : max error "//TRIM(fct_str(tm_logger%i_maxerror)), & 308 & "--------------------------------------------------" 309 CALL fct_err(il_status) 310 ELSE 311 CALL logger_open('logger.log') 312 CALL logger_header() 313 CALL logger_fatal('you must have create logger to use logger_header') 339 314 ENDIF 340 315 … … 344 319 !> 345 320 !> @author J.Paul 346 !> @date November, 2013- Initial Version321 !> - November, 2013- Initial Version 347 322 !------------------------------------------------------------------- 348 323 SUBROUTINE logger_footer() … … 351 326 INTEGER(i4) :: il_status 352 327 !---------------------------------------------------------------- 353 IF( tm_logger%l_use )THEN 354 IF( tm_logger%i_id /= 0 )THEN 355 WRITE( tm_logger%i_id, & 356 & FMT='(4(/a))', & 357 & IOSTAT=il_status ) & 358 & "--------------------------------------------------",& 359 & "END : log ended ", & 360 & "END : "//TRIM(fct_str(tm_logger%i_nerror))// & 361 & " ERROR detected ", & 362 & "END : "//TRIM(fct_str(tm_logger%i_nfatal))// & 363 & " FATAL detected ", & 364 & "--------------------------------------------------" 365 CALL fct_err(il_status) 366 ELSE 367 CALL logger_open('logger.log') 368 CALL logger_header() 369 CALL logger_fatal('you must have create logger to use logger_footer') 370 ENDIF 328 IF( tm_logger%i_id /= 0 )THEN 329 WRITE( tm_logger%i_id, & 330 & FMT='(4(/a))', & 331 & IOSTAT=il_status ) & 332 & "--------------------------------------------------",& 333 & "END : log ended ", & 334 & "END : "//TRIM(fct_str(tm_logger%i_nerror))// & 335 & " ERROR detected ", & 336 & "END : "//TRIM(fct_str(tm_logger%i_nfatal))// & 337 & " FATAL detected ", & 338 & "--------------------------------------------------" 339 CALL fct_err(il_status) 340 ELSE 341 CALL logger_open('logger.log') 342 CALL logger_header() 343 CALL logger_fatal('you must have create logger to use logger_footer') 371 344 ENDIF 372 345 END SUBROUTINE logger_footer … … 377 350 !> 378 351 !> @author J.Paul 379 !> @date November, 2013- Initial Version352 !> - November, 2013- Initial Version 380 353 ! 381 354 !> @param[in] cd_msg message to write … … 388 361 LOGICAL, INTENT(IN), OPTIONAL :: ld_flush 389 362 !---------------------------------------------------------------- 390 IF( tm_logger%l_use )THEN 391 IF( tm_logger%i_id /= 0 )THEN 392 IF( INDEX(TRIM(tm_logger%c_verb),'trace')/=0 )THEN 393 394 CALL logger__write("TRACE :",cd_msg) 395 396 IF( PRESENT(ld_flush) )THEN 397 IF( ld_flush )THEN 398 CALL logger_flush() 399 ENDIF 400 ENDIF 401 ENDIF 402 ELSE 403 CALL logger_open('logger.log') 404 CALL logger_header() 405 CALL logger_fatal('you must have create logger to use logger_trace') 363 IF( tm_logger%i_id /= 0 )THEN 364 IF( INDEX(TRIM(tm_logger%c_verb),'trace')/=0 )THEN 365 366 CALL logger__write("TRACE :",cd_msg) 367 368 IF( PRESENT(ld_flush) )THEN 369 IF( ld_flush )THEN 370 CALL logger_flush() 371 ENDIF 372 ENDIF 406 373 ENDIF 374 ELSE 375 CALL logger_open('logger.log') 376 CALL logger_header() 377 CALL logger_fatal('you must have create logger to use logger_trace') 407 378 ENDIF 408 379 END SUBROUTINE logger_trace … … 413 384 !> 414 385 !> @author J.Paul 415 !> @date November, 2013- Initial Version386 !> - November, 2013- Initial Version 416 387 ! 417 388 !> @param[in] cd_msg message to write … … 424 395 LOGICAL, INTENT(IN), OPTIONAL :: ld_flush 425 396 !---------------------------------------------------------------- 426 IF( tm_logger%l_use )THEN 427 IF( tm_logger%i_id /= 0 )THEN 428 IF( INDEX(TRIM(tm_logger%c_verb),'debug')/=0 )THEN 429 430 CALL logger__write("DEBUG :",cd_msg) 431 432 IF( PRESENT(ld_flush) )THEN 433 IF( ld_flush )THEN 434 CALL logger_flush() 435 ENDIF 436 ENDIF 437 ENDIF 438 ELSE 439 CALL logger_open('logger.log') 440 CALL logger_header() 441 CALL logger_fatal('you must have create logger to use logger_debug') 397 IF( tm_logger%i_id /= 0 )THEN 398 IF( INDEX(TRIM(tm_logger%c_verb),'debug')/=0 )THEN 399 400 CALL logger__write("DEBUG :",cd_msg) 401 402 IF( PRESENT(ld_flush) )THEN 403 IF( ld_flush )THEN 404 CALL logger_flush() 405 ENDIF 406 ENDIF 442 407 ENDIF 408 ELSE 409 CALL logger_open('logger.log') 410 CALL logger_header() 411 CALL logger_fatal('you must have create logger to use logger_debug') 443 412 ENDIF 444 413 END SUBROUTINE logger_debug … … 449 418 !> 450 419 !> @author J.Paul 451 !> @date November, 2013- Initial Version420 !> - November, 2013- Initial Version 452 421 ! 453 422 !> @param[in] cd_msg message to write … … 460 429 LOGICAL, INTENT(IN), OPTIONAL :: ld_flush 461 430 !---------------------------------------------------------------- 462 IF( tm_logger%l_use )THEN 463 IF( tm_logger%i_id /= 0 )THEN 464 IF( INDEX(TRIM(tm_logger%c_verb),'info')/=0 )THEN 465 466 CALL logger__write("INFO :",cd_msg) 467 468 IF( PRESENT(ld_flush) )THEN 469 IF( ld_flush )THEN 470 CALL logger_flush() 471 ENDIF 472 ENDIF 473 ENDIF 474 ELSE 475 CALL logger_open('logger.log') 476 CALL logger_header() 477 CALL logger_fatal('you must have create logger to use logger_info') 431 IF( tm_logger%i_id /= 0 )THEN 432 IF( INDEX(TRIM(tm_logger%c_verb),'info')/=0 )THEN 433 434 CALL logger__write("INFO :",cd_msg) 435 436 IF( PRESENT(ld_flush) )THEN 437 IF( ld_flush )THEN 438 CALL logger_flush() 439 ENDIF 440 ENDIF 478 441 ENDIF 442 ELSE 443 CALL logger_open('logger.log') 444 CALL logger_header() 445 CALL logger_fatal('you must have create logger to use logger_info') 479 446 ENDIF 480 447 END SUBROUTINE logger_info … … 485 452 !> 486 453 !> @author J.Paul 487 !> @date November, 2013- Initial Version454 !> - November, 2013- Initial Version 488 455 ! 489 456 !> @param[in] cd_msg message to write … … 496 463 LOGICAL, INTENT(IN), OPTIONAL :: ld_flush 497 464 !---------------------------------------------------------------- 498 IF( tm_logger%l_use )THEN 499 IF( tm_logger%i_id /= 0 )THEN 500 IF( INDEX(TRIM(tm_logger%c_verb),'warn')/=0 )THEN 501 502 CALL logger__write("WARNING :",cd_msg) 503 504 IF( PRESENT(ld_flush) )THEN 505 IF( ld_flush )THEN 506 CALL logger_flush() 507 ENDIF 508 ENDIF 509 ENDIF 510 ELSE 511 CALL logger_open('logger.log') 512 CALL logger_header() 513 CALL logger_fatal('you must have create logger to use logger_warn') 465 IF( tm_logger%i_id /= 0 )THEN 466 IF( INDEX(TRIM(tm_logger%c_verb),'warn')/=0 )THEN 467 468 CALL logger__write("WARNING :",cd_msg) 469 470 IF( PRESENT(ld_flush) )THEN 471 IF( ld_flush )THEN 472 CALL logger_flush() 473 ENDIF 474 ENDIF 514 475 ENDIF 476 ELSE 477 CALL logger_open('logger.log') 478 CALL logger_header() 479 CALL logger_fatal('you must have create logger to use logger_warn') 515 480 ENDIF 516 481 END SUBROUTINE logger_warn … … 521 486 !> 522 487 !> @author J.Paul 523 !> @date November, 2013- Initial Version488 !> - November, 2013- Initial Version 524 489 ! 525 490 !> @param[in] cd_msg message to write … … 535 500 CHARACTER(LEN=lc) :: cl_nerror 536 501 !---------------------------------------------------------------- 537 IF( tm_logger%l_use )THEN 538 IF( tm_logger%i_id /= 0 )THEN 539 IF( TRIM(tm_logger%c_verb) /= 'none' )THEN 540 ! increment the error number 541 tm_logger%i_nerror=tm_logger%i_nerror+1 542 ENDIF 543 544 IF( INDEX(TRIM(tm_logger%c_verb),'error')/=0 )THEN 545 546 CALL logger__write("ERROR :",cd_msg) 547 548 IF( PRESENT(ld_flush) )THEN 549 IF( ld_flush )THEN 550 CALL logger_flush() 551 ENDIF 552 ENDIF 553 ENDIF 554 555 IF( tm_logger%i_nerror >= tm_logger%i_maxerror )THEN 556 WRITE(cl_nerror,*) tm_logger%i_maxerror 557 CALL logger_fatal(& 558 & 'Error count reached limit of '//TRIM(ADJUSTL(cl_nerror)) ) 559 ENDIF 560 ELSE 561 CALL logger_open('logger.log') 562 CALL logger_header() 563 CALL logger_fatal('you must have create logger to use logger_error') 502 IF( tm_logger%i_id /= 0 )THEN 503 ! increment the error number 504 tm_logger%i_nerror=tm_logger%i_nerror+1 505 506 IF( INDEX(TRIM(tm_logger%c_verb),'error')/=0 )THEN 507 508 CALL logger__write("ERROR :",cd_msg) 509 510 IF( PRESENT(ld_flush) )THEN 511 IF( ld_flush )THEN 512 CALL logger_flush() 513 ENDIF 514 ENDIF 564 515 ENDIF 565 ENDIF 516 517 IF( tm_logger%i_nerror >= tm_logger%i_maxerror )THEN 518 WRITE(cl_nerror,*) tm_logger%i_maxerror 519 CALL logger_fatal(& 520 & 'Error count reached limit of '//TRIM(ADJUSTL(cl_nerror)) ) 521 ENDIF 522 ELSE 523 CALL logger_open('logger.log') 524 CALL logger_header() 525 CALL logger_fatal('you must have create logger to use logger_error') 526 ENDIF 527 566 528 END SUBROUTINE logger_error 567 529 !------------------------------------------------------------------- … … 570 532 !> 571 533 !> @author J.Paul 572 !> @date November, 2013- Initial Version534 !> - November, 2013- Initial Version 573 535 ! 574 536 !> @param[in] cd_msg message to write … … 579 541 CHARACTER(LEN=*), INTENT(IN) :: cd_msg 580 542 !---------------------------------------------------------------- 581 IF( tm_logger%l_use )THEN 582 IF( tm_logger%i_id /= 0 )THEN 583 IF( INDEX(TRIM(tm_logger%c_verb),'fatal')/=0 )THEN 584 ! increment the error number 585 tm_logger%i_nfatal=tm_logger%i_nfatal+1 586 587 CALL logger__write("FATAL :",cd_msg) 588 589 CALL logger_footer() 590 CALL logger_close() 591 592 WRITE(*,*) 'FATAL ERROR' 593 STOP 594 ENDIF 595 ELSE 596 CALL logger_open('logger.log') 597 CALL logger_header() 598 CALL logger_fatal('you must have create logger to use logger_fatal') 543 IF( tm_logger%i_id /= 0 )THEN 544 IF( INDEX(TRIM(tm_logger%c_verb),'fatal')/=0 )THEN 545 ! increment the error number 546 tm_logger%i_nfatal=tm_logger%i_nfatal+1 547 548 CALL logger__write("FATAL :",cd_msg) 549 550 CALL logger_footer() 551 CALL logger_close() 552 553 WRITE(*,*) 'FATAL ERROR' 554 STOP 599 555 ENDIF 556 ELSE 557 CALL logger_open('logger.log') 558 CALL logger_header() 559 CALL logger_fatal('you must have create logger to use logger_fatal') 600 560 ENDIF 601 561 END SUBROUTINE logger_fatal … … 605 565 !> 606 566 !> @author J.Paul 607 !> @date November, 2013- Initial Version567 !> - November, 2013- Initial Version 608 568 ! 609 569 !> @param[in] cd_verb verbosity of the message to write … … 655 615 656 616 END SUBROUTINE logger__write 657 !-------------------------------------------------------------------658 !> @brief This function check validity of verbosity.659 !>660 !> @author J.Paul661 !> @date February, 2015 - Initial Version662 !663 !> @param[in] cd_verb verbosity of the message to write664 !> @return verbosity is valid or not665 !-------------------------------------------------------------------666 FUNCTION logger__check_verb(cd_verb)667 IMPLICIT NONE668 ! Argument669 CHARACTER(LEN=*), INTENT(IN) :: cd_verb670 671 !function672 LOGICAL :: logger__check_verb673 674 ! local variable675 ! loop indices676 INTEGER(i4) :: ji677 678 !----------------------------------------------------------------679 logger__check_verb=.FALSE.680 681 DO ji=1,im_nverbosity682 IF( TRIM(cd_verb) == TRIM(cm_verbosity(ji)) )THEN683 logger__check_verb=.TRUE.684 EXIT685 ENDIF686 ENDDO687 688 IF( .NOT. logger__check_verb )THEN689 CALL logger_open('logger.log')690 CALL logger_header()691 CALL logger_fatal('LOGGER : invalid verbosity, check namelist.'//&692 & ' default one will be used.')693 CALL logger_footer()694 ENDIF695 END FUNCTION logger__check_verb696 617 END MODULE logger 697 618 -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/merge_bathy.f90
r10248 r10251 28 28 !> @endcode 29 29 !> 30 !> @note31 !> you could find a template of the namelist in templates directory.32 !>33 30 !> merge_bathy.nam comprise 8 namelists: 34 31 !> - logger namelist (namlog) … … 48 45 !> - cn_logfile : logger filename 49 46 !> - cn_verbosity : verbosity ('trace','debug','info', 50 !> 'warning','error','fatal' ,'none')47 !> 'warning','error','fatal') 51 48 !> - in_maxerror : maximum number of error allowed 52 49 !> … … 65 62 !> * _variable namelist (namvar)_: 66 63 !> - cn_varinfo : list of variable and extra information about request(s) 67 !> to be used (separated by ',').<br/>64 !> to be used.<br/> 68 65 !> each elements of *cn_varinfo* is a string character.<br/> 69 66 !> it is composed of the variable name follow by ':', 70 67 !> then request(s) to be used on this variable.<br/> 71 68 !> request could be: 72 !> - int = interpolation method69 !> - interpolation method 73 70 !> 74 71 !> requests must be separated by ';'.<br/> … … 77 74 !> informations about available method could be find in 78 75 !> @ref interp modules.<br/> 79 !> Example: 'bathymetry: int=cubic'76 !> Example: 'bathymetry: cubic' 80 77 !> @note 81 78 !> If you do not specify a method which is required, … … 98 95 !> segments are separated by '|'.<br/> 99 96 !> each segments of the boundary is composed of: 100 !> - indice of velocity (orthogonal to boundary .ie.101 !> for north boundary, J-indice).102 !> - indice of segment start(I-indice for north boundary)103 !> - indice of segment end(I-indice for north boundary)<br/>104 !> indices must be separated by ' :' .<br/>97 !> - orthogonal indice (.ie. for north boundary, 98 !> J-indice where boundary are). 99 !> - first indice of boundary (I-indice for north boundary) 100 !> - last indice of boundary (I-indice for north boundary)<br/> 101 !> indices must be separated by ',' .<br/> 105 102 !> - optionally, boundary size could be added between '(' and ')' 106 103 !> in the first segment defined. … … 109 106 !> 110 107 !> Examples: 111 !> - cn_north='index1,first1:last1(width)' 112 !> - cn_north='index1(width),first1:last1|index2,first2:last2' 113 !> 108 !> - cn_north='index1,first1,last1(width)' 109 !> - cn_north='index1(width),first1,last1|index2,first2,last2' 114 110 !> - cn_south : south boundary indices on fine grid<br/> 115 111 !> - cn_east : east boundary indices on fine grid<br/> … … 125 121 !> @date Sepember, 2014 126 122 !> - add header for user 127 !> @date July, 2015128 !> - extrapolate all land points129 !> - add attributes with boundary string character (as in namelist)130 123 !> 131 124 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 160 153 CHARACTER(LEN=lc) :: cl_namelist 161 154 CHARACTER(LEN=lc) :: cl_date 162 CHARACTER(LEN=lc) :: cl_tmp163 155 164 156 INTEGER(i4) :: il_narg … … 170 162 INTEGER(i4) :: il_jmin0 171 163 INTEGER(i4) :: il_jmax0 172 INTEGER(i4) :: il_shift173 164 INTEGER(i4) , DIMENSION(ip_maxdim) :: il_rho 174 165 INTEGER(i4) , DIMENSION(2,2) :: il_ind … … 240 231 NAMELIST /namlog/ & !< logger namelist 241 232 & cn_logfile, & !< log file 242 & cn_verbosity, & !< log verbosity 243 & in_maxerror !< logger maximum error 233 & cn_verbosity !< log verbosity 244 234 245 235 NAMELIST /namcfg/ & !< config namelist … … 308 298 READ( il_fileid, NML = namlog ) 309 299 ! define log file 310 CALL logger_open(TRIM(cn_logfile),TRIM(cn_verbosity), in_maxerror)300 CALL logger_open(TRIM(cn_logfile),TRIM(cn_verbosity), in_maxerror) 311 301 CALL logger_header() 312 302 … … 520 510 ENDIF 521 511 522 523 IF( tl_bdy(jp_north)%l_use )THEN524 ! add shift on north boundary525 ! boundary compute on T point but express on U or V point526 il_shift=1527 528 cl_tmp=TRIM(fct_str(tl_bdy(jp_north)%t_seg(1)%i_index-il_shift))//','//&529 & TRIM(fct_str(tl_bdy(jp_north)%t_seg(1)%i_first))//':'//&530 & TRIM(fct_str(tl_bdy(jp_north)%t_seg(1)%i_last))//&531 & '('//TRIM(fct_str(tl_bdy(jp_north)%t_seg(1)%i_width))//')'532 DO ji=2,tl_bdy(jp_north)%i_nseg533 cl_tmp=TRIM(cl_tmp)//'|'//&534 & TRIM(fct_str(tl_bdy(jp_north)%t_seg(ji)%i_index-il_shift))//','//&535 & TRIM(fct_str(tl_bdy(jp_north)%t_seg(ji)%i_first))//':'//&536 & TRIM(fct_str(tl_bdy(jp_north)%t_seg(ji)%i_last))537 ENDDO538 tl_att=att_init("bdy_north",TRIM(cl_tmp))539 CALL file_add_att(tl_fileout, tl_att)540 ENDIF541 542 IF( tl_bdy(jp_south)%l_use )THEN543 544 cl_tmp=TRIM(fct_str(tl_bdy(jp_south)%t_seg(1)%i_index))//','//&545 & TRIM(fct_str(tl_bdy(jp_south)%t_seg(1)%i_first))//':'//&546 & TRIM(fct_str(tl_bdy(jp_south)%t_seg(1)%i_last))//&547 & '('//TRIM(fct_str(tl_bdy(jp_south)%t_seg(1)%i_width))//')'548 DO ji=2,tl_bdy(jp_south)%i_nseg549 cl_tmp=TRIM(cl_tmp)//'|'//&550 & TRIM(fct_str(tl_bdy(jp_south)%t_seg(ji)%i_index))//','//&551 & TRIM(fct_str(tl_bdy(jp_south)%t_seg(ji)%i_first))//':'//&552 & TRIM(fct_str(tl_bdy(jp_south)%t_seg(ji)%i_last))553 ENDDO554 555 tl_att=att_init("bdy_south",TRIM(cl_tmp))556 CALL file_add_att(tl_fileout, tl_att)557 ENDIF558 559 IF( tl_bdy(jp_east)%l_use )THEN560 ! add shift on east boundary561 ! boundary compute on T point but express on U or V point562 il_shift=1563 564 cl_tmp=TRIM(fct_str(tl_bdy(jp_east)%t_seg(1)%i_index-il_shift))//','//&565 & TRIM(fct_str(tl_bdy(jp_east)%t_seg(1)%i_first))//':'//&566 & TRIM(fct_str(tl_bdy(jp_east)%t_seg(1)%i_last))//&567 & '('//TRIM(fct_str(tl_bdy(jp_east)%t_seg(1)%i_width))//')'568 DO ji=2,tl_bdy(jp_east)%i_nseg569 cl_tmp=TRIM(cl_tmp)//'|'//&570 & TRIM(fct_str(tl_bdy(jp_east)%t_seg(ji)%i_index-il_shift))//','//&571 & TRIM(fct_str(tl_bdy(jp_east)%t_seg(ji)%i_first))//':'//&572 & TRIM(fct_str(tl_bdy(jp_east)%t_seg(ji)%i_last))573 ENDDO574 575 tl_att=att_init("bdy_east",TRIM(cl_tmp))576 CALL file_add_att(tl_fileout, tl_att)577 ENDIF578 579 IF( tl_bdy(jp_west)%l_use )THEN580 581 cl_tmp=TRIM(fct_str(tl_bdy(jp_west)%t_seg(1)%i_index))//','//&582 & TRIM(fct_str(tl_bdy(jp_west)%t_seg(1)%i_first))//':'//&583 & TRIM(fct_str(tl_bdy(jp_west)%t_seg(1)%i_last))//&584 & '('//TRIM(fct_str(tl_bdy(jp_west)%t_seg(1)%i_width))//')'585 DO ji=2,tl_bdy(jp_west)%i_nseg586 cl_tmp=TRIM(cl_tmp)//'|'//&587 & TRIM(fct_str(tl_bdy(jp_west)%t_seg(ji)%i_index))//','//&588 & TRIM(fct_str(tl_bdy(jp_west)%t_seg(ji)%i_first))//':'//&589 & TRIM(fct_str(tl_bdy(jp_west)%t_seg(ji)%i_last))590 ENDDO591 592 tl_att=att_init("bdy_west",TRIM(cl_tmp))593 CALL file_add_att(tl_fileout, tl_att)594 ENDIF595 596 512 ! create file 597 513 CALL iom_create(tl_fileout) … … 609 525 CALL mpp_clean(tl_bathy0) 610 526 DEALLOCATE(dl_weight) 611 CALL boundary_clean(tl_bdy(:))612 527 613 528 ! close log file … … 993 908 994 909 ! extrapolate variable 995 CALL extrap_fill_value( td_var ) 910 CALL extrap_fill_value( td_var, id_offset=id_offset(:,:), & 911 & id_rho=id_rho(:), & 912 & id_iext=il_iext, id_jext=il_jext ) 996 913 997 914 ! interpolate Bathymetry -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/mpp.f90
r10248 r10251 165 165 !> to get processors to be used:<br/> 166 166 !> @code 167 !> CALL mpp_get_use( td_mpp, id_imin, id_imax, &168 !> & id_jmin, id_jmax )167 !> CALL mpp_get_use( td_mpp, id_imin, id_imax, id_idim, & 168 !> & id_jmin, id_jmax, id_jdim ) 169 169 !> @endcode 170 170 !> - id_imin 171 171 !> - id_imax 172 !> - id_idim 172 173 !> - id_jmin 173 174 !> - id_jmax 175 !> - id_jdim 174 176 !> 175 177 !> to get sub domains which form global domain contour:<br/> … … 350 352 !> 351 353 !> @author J.Paul 352 !> @date November, 2013- Initial Version354 !> - November, 2013- Initial Version 353 355 !> @date November, 2014 354 356 !> - use function instead of overload assignment operator … … 377 379 ! copy mpp variable 378 380 mpp__copy_unit%c_name = TRIM(td_mpp%c_name) 379 mpp__copy_unit%i_id = td_mpp%i_id380 381 mpp__copy_unit%i_niproc = td_mpp%i_niproc 381 382 mpp__copy_unit%i_njproc = td_mpp%i_njproc … … 424 425 !> 425 426 !> @author J.Paul 426 !> @date November, 2013- Initial Version427 !> - November, 2013- Initial Version 427 428 !> @date November, 2014 428 429 !> - use function instead of overload assignment operator … … 453 454 ! 454 455 !> @author J.Paul 455 !> @date November, 2013- Initial Version456 !> - Nov, 2013- Initial Version 456 457 ! 457 458 !> @param[in] td_mpp mpp structure … … 494 495 ! print dimension 495 496 IF( td_mpp%i_ndim /= 0 )THEN 496 WRITE(*,'(/a)') " MPPdimension"497 WRITE(*,'(/a)') " File dimension" 497 498 DO ji=1,ip_maxdim 498 499 IF( td_mpp%t_dim(ji)%l_use )THEN … … 697 698 CALL dim_clean(tl_dim) 698 699 699 IF( ( PRESENT(id_niproc) .AND. (.NOT. PRESENT(id_n jproc))) .OR. &700 IF( ( PRESENT(id_niproc) .AND. (.NOT. PRESENT(id_niproc))) .OR. & 700 701 ((.NOT. PRESENT(id_niproc)) .AND. PRESENT(id_njproc) ) )THEN 701 702 CALL logger_warn( "MPP INIT: number of processors following I and J "//& … … 911 912 !> 912 913 !> @author J.Paul 913 !> @date November, 2013- Initial Version914 !> - November, 2013- Initial Version 914 915 ! 915 916 !> @param[in] td_file file strcuture … … 1027 1028 ! create some attributes for domain decomposition (use with dimg file) 1028 1029 tl_att=att_init( "DOMAIN_number_total", mpp__init_file%i_nproc ) 1029 CALL mpp_ move_att(mpp__init_file, tl_att)1030 CALL mpp_add_att(mpp__init_file, tl_att) 1030 1031 1031 1032 tl_att=att_init( "DOMAIN_I_position_first", mpp__init_file%t_proc(:)%i_impp ) 1032 CALL mpp_ move_att(mpp__init_file, tl_att)1033 CALL mpp_add_att(mpp__init_file, tl_att) 1033 1034 1034 1035 tl_att=att_init( "DOMAIN_J_position_first", mpp__init_file%t_proc(:)%i_jmpp ) 1035 CALL mpp_ move_att(mpp__init_file, tl_att)1036 CALL mpp_add_att(mpp__init_file, tl_att) 1036 1037 1037 1038 tl_att=att_init( "DOMAIN_I_position_last", mpp__init_file%t_proc(:)%i_lci ) 1038 CALL mpp_ move_att(mpp__init_file, tl_att)1039 CALL mpp_add_att(mpp__init_file, tl_att) 1039 1040 1040 1041 tl_att=att_init( "DOMAIN_J_position_last", mpp__init_file%t_proc(:)%i_lcj ) 1041 CALL mpp_ move_att(mpp__init_file, tl_att)1042 CALL mpp_add_att(mpp__init_file, tl_att) 1042 1043 1043 1044 tl_att=att_init( "DOMAIN_I_halo_size_start", mpp__init_file%t_proc(:)%i_ldi ) 1044 CALL mpp_ move_att(mpp__init_file, tl_att)1045 CALL mpp_add_att(mpp__init_file, tl_att) 1045 1046 1046 1047 tl_att=att_init( "DOMAIN_J_halo_size_start", mpp__init_file%t_proc(:)%i_ldj ) 1047 CALL mpp_ move_att(mpp__init_file, tl_att)1048 CALL mpp_add_att(mpp__init_file, tl_att) 1048 1049 1049 1050 tl_att=att_init( "DOMAIN_I_halo_size_end", mpp__init_file%t_proc(:)%i_lei ) 1050 CALL mpp_ move_att(mpp__init_file, tl_att)1051 CALL mpp_add_att(mpp__init_file, tl_att) 1051 1052 1052 1053 tl_att=att_init( "DOMAIN_J_halo_size_end", mpp__init_file%t_proc(:)%i_lej ) 1053 CALL mpp_ move_att(mpp__init_file, tl_att)1054 CALL mpp_add_att(mpp__init_file, tl_att) 1054 1055 1055 1056 ! clean … … 1121 1122 CALL file_clean(tl_file) 1122 1123 1124 CALL logger_debug("MPP INIT READ: fin init_read ") 1123 1125 END FUNCTION mpp__init_file 1124 1126 !------------------------------------------------------------------- … … 1129 1131 ! 1130 1132 !> @author J.Paul 1131 !> @date November, 2013 - Initial Version 1132 !> @date July, 2015 - add only use dimension in MPP structure 1133 !> - November, 2013- Initial Version 1133 1134 !> 1134 1135 !> @param[in] td_file file strcuture … … 1162 1163 IF( td_file%i_id == 0 )THEN 1163 1164 CALL logger_info(" id "//TRIM(fct_str(td_file%i_id))) 1164 CALL logger_error("MPP INIT READ: netcdf file "// &1165 & TRIM(td_file%c_name)//" not opened")1165 CALL logger_error("MPP INIT READ: netcdf file "//TRIM(td_file%c_name)//& 1166 & " not opened") 1166 1167 ELSE 1167 1168 … … 1190 1191 CALL mpp_add_dim(mpp__init_file_cdf,tl_dim) 1191 1192 ENDIF 1192 1193 IF( td_file%t_dim(3)%l_use )THEN 1194 tl_dim=dim_init( td_file%t_dim(3)%c_name, td_file%t_dim(3)%i_len) 1195 CALL mpp_add_dim(mpp__init_file_cdf,tl_dim) 1196 ENDIF 1197 1198 IF( td_file%t_dim(4)%l_use )THEN 1199 tl_dim=dim_init( td_file%t_dim(4)%c_name, td_file%t_dim(4)%i_len) 1200 CALL mpp_add_dim(mpp__init_file_cdf,tl_dim) 1201 ENDIF 1193 tl_dim=dim_init( td_file%t_dim(3)%c_name, td_file%t_dim(3)%i_len) 1194 CALL mpp_add_dim(mpp__init_file_cdf,tl_dim) 1195 1196 tl_dim=dim_init( td_file%t_dim(4)%c_name, td_file%t_dim(4)%i_len) 1197 CALL mpp_add_dim(mpp__init_file_cdf,tl_dim) 1202 1198 1203 1199 ! initialise file/processor … … 1316 1312 ! 1317 1313 !> @author J.Paul 1318 !> @date November, 2013- Initial Version1314 !> - November, 2013- Initial Version 1319 1315 ! 1320 1316 !> @param[in] td_file file strcuture … … 1536 1532 ! 1537 1533 !> @author J.Paul 1538 !> @date November, 2013- Initial Version1534 !> - Nov, 2013- Initial Version 1539 1535 ! 1540 1536 !> @param[in] td_mpp mpp structure … … 1628 1624 IF( il_varid /= 0 )THEN 1629 1625 1626 CALL logger_error( " MPP ADD VAR: variable "//TRIM(td_var%c_name)//& 1627 & ", standard name "//TRIM(td_var%c_stdname)//& 1628 & ", already in mpp "//TRIM(td_mpp%c_name) ) 1629 1630 1630 DO ji=1,td_mpp%t_proc(1)%i_nvar 1631 1631 CALL logger_debug( " MPP ADD VAR: in mpp structure : & … … 1634 1634 & TRIM(td_mpp%t_proc(1)%t_var(ji)%c_stdname) ) 1635 1635 ENDDO 1636 CALL logger_error( " MPP ADD VAR: variable "//TRIM(td_var%c_name)//&1637 & ", standard name "//TRIM(td_var%c_stdname)//&1638 & ", already in mpp "//TRIM(td_mpp%c_name) )1639 1636 1640 1637 ELSE … … 1678 1675 ! 1679 1676 !> @author J.Paul 1680 !> @date November, 2013- Initial Version1677 !> - November, 2013- Initial Version 1681 1678 ! 1682 1679 !> @param[in] td_mpp mpp structure … … 1843 1840 !> @author J.Paul 1844 1841 !> @date November, 2013 - Initial version 1845 !> @date February, 20151846 !> - define local variable structure to avoid mistake with pointer1847 1842 ! 1848 1843 !> @param[inout] td_mpp mpp strcuture … … 1857 1852 ! local variable 1858 1853 INTEGER(i4) :: il_varid 1859 TYPE(TVAR) :: tl_var1860 1854 !---------------------------------------------------------------- 1861 1855 ! check if mpp exist … … 1888 1882 ELSE 1889 1883 1890 tl_var=var_copy(td_mpp%t_proc(1)%t_var(il_varid)) 1891 CALL mpp_del_var(td_mpp, tl_var) 1884 CALL mpp_del_var(td_mpp, td_mpp%t_proc(1)%t_var(il_varid)) 1892 1885 1893 1886 ENDIF … … 2200 2193 !> 2201 2194 !> @author J.Paul 2202 !> @date November, 2013 - Initial Version 2203 !> @date July, 2015 2204 !> - rewrite the same as way var_add_dim 2195 !> - November, 2013- Initial Version 2205 2196 !> 2206 2197 !> @param[inout] td_mpp mpp structure … … 2217 2208 2218 2209 ! loop indices 2210 INTEGER(i4) :: ji 2219 2211 !---------------------------------------------------------------- 2220 2212 IF( td_mpp%i_ndim <= ip_maxdim )THEN 2221 2213 2222 ! check if dimension already used in mpp structure 2223 il_ind=SCAN(TRIM(cp_dimorder),TRIM(td_dim%c_sname)) 2224 IF( il_ind == 0 )THEN 2225 CALL logger_warn( & 2226 & " MPP ADD DIM: dimension "//TRIM(td_dim%c_name)//& 2227 & ", short name "//TRIM(td_dim%c_sname)//& 2228 & ", will not be added in mpp "//TRIM(td_mpp%c_name) ) 2229 ELSEIF( td_mpp%t_dim(il_ind)%l_use )THEN 2230 CALL logger_error( & 2231 & " MPP ADD DIM: dimension "//TRIM(td_dim%c_name)//& 2232 & ", short name "//TRIM(td_dim%c_sname)//& 2233 & ", already used in mpp "//TRIM(td_mpp%c_name) ) 2214 ! check if dimension already in mpp structure 2215 il_ind=dim_get_index(td_mpp%t_dim(:), td_dim%c_name, td_dim%c_sname) 2216 IF( il_ind /= 0 )THEN 2217 2218 IF( td_mpp%t_dim(il_ind)%l_use )THEN 2219 CALL logger_error( & 2220 & "MPP ADD DIM: dimension "//TRIM(td_dim%c_name)//& 2221 & ", short name "//TRIM(td_dim%c_sname)//& 2222 & ", already used in mpp "//TRIM(td_mpp%c_name) ) 2223 ELSE 2224 ! replace dimension 2225 td_mpp%t_dim(il_ind)=dim_copy(td_dim) 2226 td_mpp%t_dim(il_ind)%i_id=il_ind 2227 td_mpp%t_dim(il_ind)%l_use=.TRUE. 2228 ENDIF 2229 2234 2230 ELSE 2235 2231 2236 ! back to disorder dimension array 2237 CALL dim_disorder(td_mpp%t_dim(:)) 2238 2239 ! add new dimension 2240 td_mpp%t_dim(td_mpp%i_ndim+1)=dim_copy(td_dim) 2241 2242 ! update number of attribute 2243 td_mpp%i_ndim=COUNT(td_mpp%t_dim(:)%l_use) 2232 IF( td_mpp%i_ndim == ip_maxdim )THEN 2233 CALL logger_error( & 2234 & "MPP ADD DIM: can not add dimension "//TRIM(td_dim%c_name)//& 2235 & ", short name "//TRIM(td_dim%c_sname)//& 2236 & ", in mpp "//TRIM(td_mpp%c_name)//". Already "//& 2237 & TRIM(fct_str(ip_maxdim))//" dimensions." ) 2238 ELSE 2239 ! search empty dimension 2240 DO ji=1,ip_maxdim 2241 IF( td_mpp%t_dim(ji)%i_id == 0 )THEN 2242 il_ind=ji 2243 EXIT 2244 ENDIF 2245 ENDDO 2246 2247 ! add new dimension 2248 td_mpp%t_dim(il_ind)=dim_copy(td_dim) 2249 ! update number of attribute 2250 td_mpp%i_ndim=COUNT(td_mpp%t_dim(:)%l_use) 2251 2252 td_mpp%t_dim(il_ind)%l_use=.TRUE. 2253 td_mpp%t_dim(il_ind)%i_id=td_mpp%i_ndim 2254 ENDIF 2244 2255 2245 2256 ENDIF 2246 ! reorder dimension to ('x','y','z','t')2247 CALL dim_reorder(td_mpp%t_dim(:))2248 2257 2249 2258 ELSE … … 2259 2268 !> 2260 2269 !> @author J.Paul 2261 !> @date November, 2013 - Initial Version 2262 !> @date July, 2015 2263 !> - rewrite the same as way var_del_dim 2270 !> - November, 2013- Initial Version 2264 2271 !> 2265 2272 !> @param[inout] td_mpp mpp structure … … 2273 2280 2274 2281 ! local variable 2282 INTEGER(i4) :: il_status 2275 2283 INTEGER(i4) :: il_ind 2276 TYPE(TDIM) :: tl_dim2284 TYPE(TDIM), DIMENSION(:), ALLOCATABLE :: tl_dim 2277 2285 2278 2286 ! loop indices 2279 !---------------------------------------------------------------- 2280 2281 2282 IF( td_mpp%i_ndim <= ip_maxdim )THEN 2283 2284 CALL logger_trace( & 2285 & " MPP DEL DIM: delete dimension "//TRIM(td_dim%c_name)//& 2287 INTEGER(i4) :: ji 2288 !---------------------------------------------------------------- 2289 ! check if dimension already in mpp structure 2290 il_ind=dim_get_index(td_mpp%t_dim(:), td_dim%c_name, td_dim%c_sname) 2291 IF( il_ind == 0 )THEN 2292 2293 CALL logger_error( & 2294 & "MPP DEL DIM: no dimension "//TRIM(td_dim%c_name)//& 2286 2295 & ", short name "//TRIM(td_dim%c_sname)//& 2287 2296 & ", in mpp "//TRIM(td_mpp%c_name) ) 2288 2289 ! check if dimension already in variable structure2290 il_ind=SCAN(TRIM(cp_dimorder),TRIM(td_dim%c_sname))2291 2292 ! replace dimension by empty one2293 td_mpp%t_dim(il_ind)=dim_copy(tl_dim)2294 2295 ! update number of dimension2296 td_mpp%i_ndim=COUNT(td_mpp%t_dim(:)%l_use)2297 2298 ! reorder dimension to ('x','y','z','t')2299 CALL dim_reorder(td_mpp%t_dim)2300 2297 2301 2298 ELSE 2302 CALL logger_error( & 2303 & " MPP DEL DIM: too much dimension in mpp "//& 2304 & TRIM(td_mpp%c_name)//" ("//TRIM(fct_str(td_mpp%i_ndim))//")") 2299 2300 ALLOCATE( tl_dim(td_mpp%i_ndim-1), stat=il_status ) 2301 IF(il_status /= 0 )THEN 2302 2303 CALL logger_error( & 2304 & "MPP DEL DIM: not enough space to put dimensions from "//& 2305 & TRIM(td_mpp%c_name)//" in temporary dimension structure") 2306 2307 ELSE 2308 2309 ! save temporary dimension's mpp structure 2310 tl_dim( 1 : il_ind-1 ) = dim_copy(td_mpp%t_dim( 1 : il_ind-1 )) 2311 tl_dim( il_ind : td_mpp%i_ndim-1 ) = & 2312 & dim_copy(td_mpp%t_dim( il_ind+1 : td_mpp%i_ndim )) 2313 2314 ! remove dimension from file 2315 CALL dim_clean(td_mpp%t_dim(:)) 2316 ! copy dimension in file, except one 2317 td_mpp%t_dim(1:td_mpp%i_ndim)=dim_copy(tl_dim(:)) 2318 2319 ! update number of dimension 2320 td_mpp%i_ndim=td_mpp%i_ndim-1 2321 2322 ! update dimension id 2323 DO ji=1,td_mpp%i_ndim 2324 td_mpp%t_dim(ji)%i_id=ji 2325 ENDDO 2326 2327 ! clean 2328 CALL dim_clean(tl_dim(:)) 2329 DEALLOCATE(tl_dim) 2330 2331 ENDIF 2332 2305 2333 ENDIF 2306 2334 … … 2312 2340 !> 2313 2341 !> @author J.Paul 2314 !> @date November, 2013- Initial Version2342 !> - November, 2013- Initial Version 2315 2343 !> 2316 2344 !> @param[inout] td_mpp mpp structure … … 2460 2488 & ", in mpp structure "//TRIM(td_mpp%c_name) ) 2461 2489 2462 IF( ASSOCIATED(td_mpp%t_proc(1)%t_ att) )THEN2490 IF( ASSOCIATED(td_mpp%t_proc(1)%t_var) )THEN 2463 2491 DO ji=1,td_mpp%t_proc(1)%i_natt 2464 2492 CALL logger_debug( "MPP DEL ATT: in mpp structure : & 2465 & attribute : "//TRIM(td_mpp%t_proc(1)%t_ att(ji)%c_name) )2493 & attribute : "//TRIM(td_mpp%t_proc(1)%t_var(ji)%c_name) ) 2466 2494 ENDDO 2467 2495 ENDIF … … 2488 2516 !> @author J.Paul 2489 2517 !> @date November, 2013 - Initial version 2490 !> @date February, 20152491 !> - define local attribute structure to avoid mistake with pointer2492 2518 ! 2493 2519 !> @param[inout] td_mpp mpp strcuture … … 2501 2527 2502 2528 ! local variable 2503 INTEGER(i4) :: il_attid 2504 TYPE(TATT) :: tl_att 2529 INTEGER(i4) :: il_attid 2505 2530 !---------------------------------------------------------------- 2506 2531 ! check if mpp exist … … 2526 2551 IF( il_attid == 0 )THEN 2527 2552 2528 CALL logger_ debug( &2553 CALL logger_warn( & 2529 2554 & "MPP DEL ATT : there is no attribute with "//& 2530 2555 & "name "//TRIM(cd_name)//" in mpp structure "//& … … 2533 2558 ELSE 2534 2559 2535 tl_att=att_copy(td_mpp%t_proc(1)%t_att(il_attid)) 2536 CALL mpp_del_att(td_mpp, tl_att) 2560 CALL mpp_del_att(td_mpp, td_mpp%t_proc(1)%t_att(il_attid)) 2537 2561 2538 2562 ENDIF … … 2839 2863 2840 2864 CALL logger_info("MPP OPTIMIZ: number of processor "//& 2841 & TRIM(fct_str(ji))//"x"//TRIM(fct_str(jj))//"="//& 2842 & TRIM(fct_str(tl_mpp%i_nproc)) ) 2865 & TRIM(fct_str(tl_mpp%i_nproc)) ) 2843 2866 IF( tl_mpp%i_nproc > td_mpp%i_nproc .AND. & 2844 2867 & tl_mpp%i_nproc <= il_maxproc )THEN 2845 2868 ! save optimiz decomposition 2846 2847 CALL logger_info("MPP OPTIMIZ:save this decomposition "//&2848 & TRIM(fct_str(ji))//"x"//TRIM(fct_str(jj))//"="//&2849 & TRIM(fct_str(tl_mpp%i_nproc)) )2850 2869 2851 2870 ! clean mpp … … 3127 3146 !> 3128 3147 !> @author J.Paul 3129 !> @date November, 2013 - Initial version3148 !> @date November, 2013 3130 3149 !> 3131 3150 !> @param[inout] td_mpp mpp strcuture … … 3165 3184 !> 3166 3185 !> @author J.Paul 3167 !> @date November, 2013 - Initial version3186 !> @date November, 2013 3168 3187 !> 3169 3188 !> @param[in] td_mpp mpp strcuture … … 3230 3249 ! 3231 3250 !> @author J.Paul 3232 !> @date November, 2013 - Initial version3251 !> @date November, 2013 3233 3252 ! 3234 3253 !> @param[in] td_mpp mpp strcuture … … 3292 3311 !> 3293 3312 !> @author J.Paul 3294 !> @date November, 2013 - Initial version3313 !> @date November, 2013 3295 3314 !> 3296 3315 !> @param[inout] td_mpp mpp strcuture … … 3385 3404 !> 3386 3405 !> @author J.Paul 3387 !> @date November, 2013- Initial Version3406 !> - November, 2013- Initial Version 3388 3407 !> 3389 3408 !> @param[in] td_mpp mpp structure … … 3398 3417 3399 3418 ! local variable 3419 INTEGER(i4) :: il_ndim 3400 3420 3401 3421 ! loop indices … … 3409 3429 mpp__check_var_dim=.FALSE. 3410 3430 3431 CALL logger_error( & 3432 & "MPP CHECK DIM: variable and mpp dimension differ"//& 3433 & " for variable "//TRIM(td_var%c_name)//& 3434 & " and mpp "//TRIM(td_mpp%c_name)) 3435 3411 3436 CALL logger_debug( & 3412 3437 & " mpp dimension: "//TRIM(fct_str(td_mpp%i_ndim))//& 3413 3438 & " variable dimension: "//TRIM(fct_str(td_var%i_ndim)) ) 3414 DO ji = 1, ip_maxdim 3439 il_ndim=MIN(td_var%i_ndim, td_mpp%i_ndim ) 3440 DO ji = 1, il_ndim 3415 3441 CALL logger_debug( & 3416 3442 & "MPP CHECK DIM: for dimension "//& … … 3422 3448 & ", variable used "//TRIM(fct_str(td_var%t_dim(ji)%l_use))) 3423 3449 ENDDO 3424 3425 CALL logger_error( &3426 & "MPP CHECK DIM: variable and mpp dimension differ"//&3427 & " for variable "//TRIM(td_var%c_name)//&3428 & " and mpp "//TRIM(td_mpp%c_name))3429 3430 3450 ENDIF 3431 3451 … … 3436 3456 ! 3437 3457 !> @author J.Paul 3438 !> @date November, 2013- Initial Version3458 !> - November, 2013- Initial Version 3439 3459 ! 3440 3460 !> @param[in] td_file array of file structure … … 3476 3496 ! 3477 3497 !> @author J.Paul 3478 !> @date Ocotber, 2014- Initial Version3498 !> - Ocotber, 2014- Initial Version 3479 3499 ! 3480 3500 !> @param[in] td_mpp mpp file structure -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/multi.f90
r10248 r10251 61 61 !> @date October, 2014 62 62 !> - use mpp file structure instead of file 63 !> @date November, 2014 64 !> - Fix memory leaks bug 63 !> @date November, 2014 - Fix memory leaks bug 65 64 ! 66 65 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 119 118 !> 120 119 !> @author J.Paul 121 !> @date November, 2013- Initial Version120 !> - November, 2013- Initial Version 122 121 !> @date November, 2014 123 122 !> - use function instead of overload assignment operator (to avoid memory leak) … … 170 169 !> 171 170 !> @author J.Paul 172 !> @date November, 2013 - Initial Version 173 !> @date July, 2015 174 !> - check if variable to be read is in file 171 !> - November, 2013- Initial Version 175 172 !> 176 173 !> @param[in] cd_varfile variable location information (from namelist) … … 193 190 194 191 INTEGER(i4) :: il_nvar 195 INTEGER(i4) :: il_varid196 192 197 193 LOGICAL :: ll_dim … … 246 242 ! define variable 247 243 IF( TRIM(fct_lower(cl_lower)) /= 'all' )THEN 248 249 ! check if variable is in file250 il_varid=var_get_index(tl_mpp%t_proc(1)%t_var(:),cl_lower)251 IF( il_varid == 0 )THEN252 CALL logger_fatal("MULTI INIT: variable "//&253 & TRIM(cl_name)//" not in file "//&254 & TRIM(cl_file) )255 ENDIF256 244 257 245 ! clean var … … 329 317 ! 330 318 !> @author J.Paul 331 !> @date November, 2013- Initial Version319 !> - November, 2013- Initial Version 332 320 ! 333 321 !> @param[in] td_multi multi file structure … … 360 348 ! 361 349 !> @author J.Paul 362 !> @date November, 2013- Initial Version350 !> - November, 2013- Initial Version 363 351 ! 364 352 !> @param[in] td_multi multi file structure … … 403 391 ! 404 392 !> @author J.Paul 405 !> @date November, 2013- Initial Version393 !> - November, 2013- Initial Version 406 394 !> @date October, 2014 407 395 !> - use mpp file structure instead of file -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/phycst.f90
r10248 r10251 25 25 PUBLIC :: dp_rearth !< earth radius (km) 26 26 PUBLIC :: dp_deg2rad !< degree to radian ratio 27 PUBLIC :: dp_rad2deg !< radian to degree ratio28 27 PUBLIC :: dp_delta !< 29 28 … … 32 31 REAL(dp), PARAMETER :: dp_rearth = 6871._dp 33 32 REAL(dp), PARAMETER :: dp_deg2rad = dp_pi/180.0 34 REAL(dp), PARAMETER :: dp_rad2deg = 180.0/dp_pi35 33 36 REAL(dp), PARAMETER :: dp_delta=1.e- 634 REAL(dp), PARAMETER :: dp_delta=1.e-2 37 35 END MODULE phycst 38 36 -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/variable.f90
r10248 r10251 281 281 !> @date November, 2014 282 282 !> - Fix memory leaks bug 283 !> @date June, 2015284 !> - change way to get variable information in namelist285 !> @date July, 2015286 !> - add subroutine var_chg_unit to change unit of output variable287 283 ! 288 284 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 297 293 USE att ! attribute manager 298 294 USE dim ! dimension manager 299 USE math ! mathematical function300 295 IMPLICIT NONE 301 296 ! NOTE_avoid_public_variables_if_possible … … 323 318 PUBLIC :: var_concat !< concatenate two variables 324 319 PUBLIC :: var_limit_value !< forced min and max value 325 PUBLIC :: var_chg_unit !< change variable unit and value326 320 PUBLIC :: var_max_dim !< get array of maximum dimension use 327 321 PUBLIC :: var_reorder !< reorder table of value in variable structure … … 388 382 PRIVATE :: var__get_max ! get maximum value from namelist 389 383 PRIVATE :: var__get_min ! get minimum value from namelist 390 PRIVATE :: var__get_unf ! get scale factor value from namelist391 PRIVATE :: var__get_unt ! get unit from namelist392 384 PRIVATE :: var__get_interp ! get interpolation method from namelist 393 385 PRIVATE :: var__get_extrap ! get extrapolation method from namelist … … 409 401 TYPE(TATT), DIMENSION(:), POINTER :: t_att => NULL() !< variable attributes 410 402 TYPE(TDIM), DIMENSION(ip_maxdim) :: t_dim !< variable dimension 411 403 412 404 LOGICAL :: l_file = .FALSE. !< variable read in a file 413 405 … … 422 414 REAL(dp) :: d_min = dp_fill !< minimum value 423 415 REAL(dp) :: d_max = dp_fill !< maximum value 424 425 CHARACTER(LEN=lc) :: c_unt = '' !< new variables units (linked to units factor) 426 REAL(dp) :: d_unf = 1._dp !< units factor 427 416 428 417 !!! netcdf4 429 418 LOGICAL :: l_contiguous = .FALSE. !< use contiguous storage or not … … 529 518 !> 530 519 !> @author J.Paul 531 !> @date November, 2013- Initial Version520 !> - November, 2013- Initial Version 532 521 !> @date November, 2014 533 522 !> - use function instead of overload assignment operator (to avoid memory leak) … … 559 548 var__copy_unit%d_min = td_var%d_min 560 549 var__copy_unit%d_max = td_var%d_max 561 562 var__copy_unit%c_unt = TRIM(td_var%c_unt)563 var__copy_unit%d_unf = td_var%d_unf564 550 565 551 var__copy_unit%i_type = td_var%i_type … … 591 577 var__copy_unit%c_units = TRIM(td_var%c_units) 592 578 var__copy_unit%c_axis = TRIM(td_var%c_axis) 593 var__copy_unit%d_unf = td_var%d_unf594 579 var__copy_unit%d_scf = td_var%d_scf 595 580 var__copy_unit%d_ofs = td_var%d_ofs … … 642 627 !> 643 628 !> @author J.Paul 644 !> @date November, 2013- Initial Version629 !> - November, 2013- Initial Version 645 630 !> @date November, 2014 646 631 !> - use function instead of overload assignment operator … … 671 656 !> 672 657 !> @author J.Paul 673 !> @date November, 2013- Initial Version658 !> - November, 2013- Initial Version 674 659 !> 675 660 !> @param[inout] td_var variable strucutre … … 710 695 ! 711 696 !> @author J.Paul 712 !> @date September, 2014- Initial Version697 !> - September, 2014- Initial Version 713 698 ! 714 699 !> @param[inout] td_var array of variable strucutre … … 733 718 ! 734 719 !> @author J.Paul 735 !> @date September, 2014- Initial Version720 !> - September, 2014- Initial Version 736 721 ! 737 722 !> @param[inout] td_var array of variable strucutre … … 759 744 ! 760 745 !> @author J.Paul 761 !> @date September, 2014- Initial Version746 !> - September, 2014- Initial Version 762 747 ! 763 748 !> @param[inout] td_var array of variable strucutre … … 803 788 !> - id_id : variable id (read from a file). 804 789 !> - id_ew : number of point composing east west wrap band. 805 !> - dd_unf : real(8) value for units factor attribute.806 790 !> - dd_scf : real(8) value for scale factor attribute. 807 791 !> - dd_ofs : real(8) value for add offset attribute. … … 817 801 !> - cd_extrap : a array of character defining extrapolation method. 818 802 !> - cd_filter : a array of character defining filtering method. 819 !> - cd_unt : a string character to define output unit820 !> - dd_unf : real(8) factor applied to change unit821 803 !> 822 804 !> @note most of these optionals arguments will be inform automatically, … … 824 806 !> 825 807 !> @author J.Paul 826 !> @date November, 2013 - Initial Version 827 !> @date February, 2015 828 !> - Bug fix: conversion of the FillValue type (float case) 829 !> @date June, 2015 830 !> - add unit factor (to change unit) 808 !> - November, 2013- Initial Version 831 809 !> 832 810 !> @param[in] cd_name variable name … … 855 833 !> @param[in] cd_extrap extrapolation method 856 834 !> @param[in] cd_filter filter method 857 !> @param[in] cd_unt new units (linked to units factor)858 !> @param[in] dd_unf units factor859 835 !> @return variable structure 860 836 !------------------------------------------------------------------- … … 867 843 & ld_contiguous, ld_shuffle,& 868 844 & ld_fletcher32, id_deflvl, id_chunksz, & 869 & cd_interp, cd_extrap, cd_filter, & 870 & cd_unt, dd_unf ) 845 & cd_interp, cd_extrap, cd_filter ) 871 846 IMPLICIT NONE 872 847 ! Argument … … 896 871 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap 897 872 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter 898 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt899 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf900 873 901 874 … … 960 933 tl_att=att_init('_FillValue', INT(dd_fill,i4) ) 961 934 CASE(NF90_FLOAT) 962 tl_att=att_init('_FillValue', REAL(dd_fill,sp) )935 tl_att=att_init('_FillValue', INT(dd_fill,sp) ) 963 936 CASE DEFAULT ! NF90_DOUBLE 964 tl_att=att_init('_FillValue', dd_fill )937 tl_att=att_init('_FillValue', dd_fill ) 965 938 END SELECT 966 939 CALL var_move_att(var__init, tl_att) … … 1065 1038 ENDIF 1066 1039 1067 ! units factor1068 IF( PRESENT(dd_unf) )THEN1069 tl_att=att_init('units_factor',dd_unf)1070 CALL var_move_att(var__init, tl_att)1071 ENDIF1072 1073 ! new units (linked to units factor)1074 IF( PRESENT(cd_unt) )THEN1075 tl_att=att_init('new_units',cd_units)1076 CALL var_move_att(var__init, tl_att)1077 ENDIF1078 1079 1040 ! add extra information 1080 1041 CALL var__get_extra(var__init) … … 1086 1047 CALL var_del_att(var__init, 'filter') 1087 1048 CALL var_del_att(var__init, 'src_file') 1088 CALL var_del_att(var__init, 'src_i_indices')1089 CALL var_del_att(var__init, 'src_j_indices')1090 1049 CALL var_del_att(var__init, 'valid_min') 1091 1050 CALL var_del_att(var__init, 'valid_max') … … 1113 1072 ! 1114 1073 !> @author J.Paul 1115 !> @date November, 2013 - Initial Version 1116 !> @date June, 2015 1117 !> - add interp, extrap, and filter argument 1118 !> @date July, 2015 1119 !> - add unit factor (to change unit) 1120 !> 1074 !> - November, 2013- Initial Version 1075 ! 1121 1076 !> @param[in] cd_name variable name 1122 1077 !> @param[in] dd_value 1D array of real(8) value … … 1145 1100 !> @param[in] id_deflvl deflate level from 0 to 9, 0 indicates no deflation is in use 1146 1101 !> @param[in] id_chunksz chunk size 1147 !> @param[in] cd_interp interpolation method1148 !> @param[in] cd_extrap extrapolation method1149 !> @param[in] cd_filter filter method1150 !> @param[in] cd_unt new units (linked to units factor)1151 !> @param[in] dd_unf units factor1152 1102 !> @return variable structure 1153 1103 !------------------------------------------------------------------- … … 1160 1110 & dd_min, dd_max, & 1161 1111 & ld_contiguous, ld_shuffle,& 1162 & ld_fletcher32, id_deflvl, id_chunksz, & 1163 & cd_interp, cd_extrap, cd_filter, & 1164 & cd_unt, dd_unf) 1112 & ld_fletcher32, id_deflvl, id_chunksz) 1165 1113 IMPLICIT NONE 1166 1114 ! Argument … … 1190 1138 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 1191 1139 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 1192 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp1193 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap1194 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter1195 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt1196 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf1197 1140 1198 1141 ! local variable … … 1250 1193 & ld_fletcher32=ld_fletcher32, & 1251 1194 & id_deflvl=id_deflvl, & 1252 & id_chunksz=id_chunksz(:), & 1253 & cd_interp=cd_interp(:), & 1254 & cd_extrap=cd_extrap(:), & 1255 & cd_filter=cd_filter(:), & 1256 & cd_unt=cd_unt, dd_unf=dd_unf ) 1195 & id_chunksz=id_chunksz(:)) 1257 1196 1258 1197 ! add value … … 1300 1239 ! 1301 1240 !> @author J.Paul 1302 !> @date November, 2013 - Initial Version 1303 !> @date February, 2015 1304 !> - bug fix: array initialise with dimension 1305 !> array not only one value 1306 !> @date June, 2015 1307 !> - add interp, extrap, and filter argument 1308 !> - Bux fix: dimension array initialise not only one value 1309 !> @date July, 2015 1310 !> - add unit factor (to change unit) 1241 !> - November, 2013- Initial Version 1311 1242 ! 1312 1243 !> @param[in] cd_name variable name … … 1338 1269 !> no deflation is in use 1339 1270 !> @param[in] id_chunksz chunk size 1340 !> @param[in] cd_interp interpolation method1341 !> @param[in] cd_extrap extrapolation method1342 !> @param[in] cd_filter filter method1343 !> @param[in] cd_unt new units (linked to units factor)1344 !> @param[in] dd_unf units factor1345 1271 !> @return variable structure 1346 1272 !------------------------------------------------------------------- … … 1353 1279 & dd_min, dd_max, & 1354 1280 & ld_contiguous, ld_shuffle,& 1355 & ld_fletcher32, id_deflvl, id_chunksz, & 1356 & cd_interp, cd_extrap, cd_filter, & 1357 & cd_unt, dd_unf) 1281 & ld_fletcher32, id_deflvl, id_chunksz) 1358 1282 IMPLICIT NONE 1359 1283 ! Argument … … 1383 1307 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 1384 1308 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 1385 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp1386 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap1387 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter1388 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt1389 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf1390 1309 1391 1310 ! local variable … … 1431 1350 ENDIF 1432 1351 1433 il_count(:)=tl_dim( :)%i_len1352 il_count(:)=tl_dim(1)%i_len 1434 1353 IF( PRESENT(id_count) )THEN 1435 1354 IF( SIZE(id_count(:)) /= 2 )THEN … … 1462 1381 & ld_fletcher32=ld_fletcher32, & 1463 1382 & id_deflvl=id_deflvl, & 1464 & id_chunksz=id_chunksz(:), & 1465 & cd_interp=cd_interp(:), & 1466 & cd_extrap=cd_extrap(:), & 1467 & cd_filter=cd_filter(:), & 1468 & cd_unt=cd_unt, dd_unf=dd_unf ) 1383 & id_chunksz=id_chunksz(:)) 1469 1384 1470 1385 ! add value … … 1516 1431 ! 1517 1432 !> @author J.Paul 1518 !> @date November, 2013 - Initial Version 1519 !> @date June, 2015 1520 !> - add interp, extrap, and filter argument 1521 !> @date July, 2015 1522 !> - add unit factor (to change unit) 1523 !> 1433 !> - November, 2013- Initial Version 1434 ! 1524 1435 !> @param[in] cd_name variable name 1525 1436 !> @param[in] dd_value 1D array of real(8) value … … 1550 1461 !> deflation is in use 1551 1462 !> @param[in] id_chunksz chunk size 1552 !> @param[in] cd_interp interpolation method1553 !> @param[in] cd_extrap extrapolation method1554 !> @param[in] cd_filter filter method1555 !> @param[in] cd_unt new units (linked to units factor)1556 !> @param[in] dd_unf units factor1557 1463 !> @return variable structure 1558 1464 !------------------------------------------------------------------- … … 1565 1471 & dd_min, dd_max, & 1566 1472 & ld_contiguous, ld_shuffle,& 1567 & ld_fletcher32, id_deflvl, id_chunksz, & 1568 & cd_interp, cd_extrap, cd_filter, & 1569 & cd_unt, dd_unf) 1473 & ld_fletcher32, id_deflvl, id_chunksz) 1570 1474 IMPLICIT NONE 1571 1475 ! Argument … … 1595 1499 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 1596 1500 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 1597 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp1598 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap1599 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter1600 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt1601 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf1602 1501 1603 1502 ! local variable … … 1678 1577 & ld_fletcher32=ld_fletcher32, & 1679 1578 & id_deflvl=id_deflvl, & 1680 & id_chunksz=id_chunksz(:), & 1681 & cd_interp=cd_interp(:), & 1682 & cd_extrap=cd_extrap(:), & 1683 & cd_filter=cd_filter(:), & 1684 & cd_unt=cd_unt, dd_unf=dd_unf ) 1579 & id_chunksz=id_chunksz(:)) 1685 1580 1686 1581 ! add value … … 1728 1623 ! 1729 1624 !> @author J.Paul 1730 !> @date November, 2013 - Initial Version 1731 !> @date June, 2015 1732 !> - add interp, extrap, and filter argument 1733 !> @date July, 2015 1734 !> - add unit factor (to change unit) 1735 !> 1625 !> - November, 2013- Initial Version 1626 ! 1736 1627 !> @param[in] cd_name variable name 1737 1628 !> @param[in] dd_value 4D array of real(8) value … … 1762 1653 !> deflation is in use 1763 1654 !> @param[in] id_chunksz chunk size 1764 !> @param[in] cd_interp interpolation method1765 !> @param[in] cd_extrap extrapolation method1766 !> @param[in] cd_filter filter method1767 !> @param[in] cd_unt new units (linked to units factor)1768 !> @param[in] dd_unf units factor1769 1655 !> @return variable structure 1770 1656 !------------------------------------------------------------------- … … 1777 1663 & dd_min, dd_max, & 1778 1664 & ld_contiguous, ld_shuffle,& 1779 & ld_fletcher32, id_deflvl, id_chunksz, & 1780 & cd_interp, cd_extrap, cd_filter, & 1781 & cd_unt, dd_unf ) 1665 & ld_fletcher32, id_deflvl, id_chunksz) 1782 1666 IMPLICIT NONE 1783 1667 ! Argument … … 1807 1691 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 1808 1692 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 1809 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp1810 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap1811 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter1812 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt1813 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf1814 1693 1815 1694 ! local variable … … 1844 1723 & ld_fletcher32=ld_fletcher32, & 1845 1724 & id_deflvl=id_deflvl, & 1846 & id_chunksz=id_chunksz(:), & 1847 & cd_interp=cd_interp(:), & 1848 & cd_extrap=cd_extrap(:), & 1849 & cd_filter=cd_filter(:), & 1850 & cd_unt=cd_unt, dd_unf=dd_unf ) 1725 & id_chunksz=id_chunksz(:)) 1851 1726 1852 1727 ! add value … … 1883 1758 ! 1884 1759 !> @author J.Paul 1885 !> @date November, 2013 - Initial Version 1886 !> @date June, 2015 1887 !> - add interp, extrap, and filter argument 1888 !> @date July, 2015 1889 !> - add unit factor (to change unit) 1760 !> - November, 2013- Initial Version 1890 1761 ! 1891 1762 !> @param[in] cd_name variable name … … 1917 1788 !> deflation is in use 1918 1789 !> @param[in] id_chunksz chunk size 1919 !> @param[in] cd_interp interpolation method1920 !> @param[in] cd_extrap extrapolation method1921 !> @param[in] cd_filter filter method1922 !> @param[in] cd_unt new units (linked to units factor)1923 !> @param[in] dd_unf units factor1924 1790 !> @return variable structure 1925 1791 !------------------------------------------------------------------- … … 1932 1798 & dd_min, dd_max, & 1933 1799 & ld_contiguous, ld_shuffle,& 1934 & ld_fletcher32, id_deflvl, id_chunksz, & 1935 & cd_interp, cd_extrap, cd_filter, & 1936 & cd_unt, dd_unf) 1800 & ld_fletcher32, id_deflvl, id_chunksz) 1937 1801 1938 1802 IMPLICIT NONE … … 1963 1827 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 1964 1828 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 1965 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp1966 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap1967 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter1968 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt1969 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf1970 1971 1829 1972 1830 ! local variable … … 2012 1870 & ld_fletcher32=ld_fletcher32, & 2013 1871 & id_deflvl=id_deflvl, & 2014 & id_chunksz=id_chunksz(:), & 2015 & cd_interp=cd_interp(:), & 2016 & cd_extrap=cd_extrap(:), & 2017 & cd_filter=cd_filter(:), & 2018 & cd_unt=cd_unt, dd_unf=dd_unf ) 1872 & id_chunksz=id_chunksz(:)) 2019 1873 2020 1874 DEALLOCATE( dl_value ) … … 2038 1892 ! 2039 1893 !> @author J.Paul 2040 !> @date November, 2013 - Initial Version 2041 !> @date June, 2015 2042 !> - add interp, extrap, and filter argument 2043 !> @date July, 2015 2044 !> - add unit factor (to change unit) 1894 !> - November, 2013- Initial Version 2045 1895 ! 2046 1896 !> @param[in] cd_name : variable name … … 2072 1922 !> deflation is in use 2073 1923 !> @param[in] id_chunksz : chunk size 2074 !> @param[in] cd_interp interpolation method2075 !> @param[in] cd_extrap extrapolation method2076 !> @param[in] cd_filter filter method2077 !> @param[in] cd_unt new units (linked to units factor)2078 !> @param[in] dd_unf units factor2079 1924 !> @return variable structure 2080 1925 !------------------------------------------------------------------- … … 2087 1932 & dd_min, dd_max, & 2088 1933 & ld_contiguous, ld_shuffle,& 2089 & ld_fletcher32, id_deflvl, id_chunksz, & 2090 & cd_interp, cd_extrap, cd_filter, & 2091 & cd_unt, dd_unf) 1934 & ld_fletcher32, id_deflvl, id_chunksz) 2092 1935 2093 1936 IMPLICIT NONE … … 2118 1961 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 2119 1962 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 2120 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp2121 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap2122 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter2123 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt2124 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf2125 1963 2126 1964 ! local variable … … 2168 2006 & ld_fletcher32=ld_fletcher32, & 2169 2007 & id_deflvl=id_deflvl, & 2170 & id_chunksz=id_chunksz(:), & 2171 & cd_interp=cd_interp(:), & 2172 & cd_extrap=cd_extrap(:), & 2173 & cd_filter=cd_filter(:), & 2174 & cd_unt=cd_unt, dd_unf=dd_unf ) 2008 & id_chunksz=id_chunksz(:)) 2175 2009 2176 2010 DEALLOCATE( dl_value ) … … 2194 2028 ! 2195 2029 !> @author J.Paul 2196 !> @date November, 2013 - Initial Version 2197 !> @date June, 2015 2198 !> - add interp, extrap, and filter argument 2199 !> @date July, 2015 2200 !> - add unit factor (to change unit) 2030 !> - November, 2013- Initial Version 2201 2031 ! 2202 2032 !> @param[in] cd_name : variable name … … 2228 2058 !> deflation is in use 2229 2059 !> @param[in] id_chunksz : chunk size 2230 !> @param[in] cd_interp interpolation method2231 !> @param[in] cd_extrap extrapolation method2232 !> @param[in] cd_filter filter method2233 !> @param[in] cd_unt new units (linked to units factor)2234 !> @param[in] dd_unf units factor2235 2060 !> @return variable structure 2236 2061 !------------------------------------------------------------------- … … 2243 2068 & dd_min, dd_max, & 2244 2069 & ld_contiguous, ld_shuffle,& 2245 & ld_fletcher32, id_deflvl, id_chunksz, & 2246 & cd_interp, cd_extrap, cd_filter, & 2247 & cd_unt, dd_unf) 2070 & ld_fletcher32, id_deflvl, id_chunksz) 2248 2071 2249 2072 IMPLICIT NONE … … 2274 2097 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 2275 2098 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 2276 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp2277 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap2278 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter2279 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt2280 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf2281 2099 2282 2100 ! local variable … … 2325 2143 & ld_fletcher32=ld_fletcher32, & 2326 2144 & id_deflvl=id_deflvl, & 2327 & id_chunksz=id_chunksz(:), & 2328 & cd_interp=cd_interp(:), & 2329 & cd_extrap=cd_extrap(:), & 2330 & cd_filter=cd_filter(:), & 2331 & cd_unt=cd_unt, dd_unf=dd_unf) 2145 & id_chunksz=id_chunksz(:)) 2332 2146 2333 2147 DEALLOCATE( dl_value ) … … 2351 2165 ! 2352 2166 !> @author J.Paul 2353 !> @date November, 2013 - Initial Version 2354 !> @date June, 2015 2355 !> - add interp, extrap, and filter argument 2356 !> @date July, 2015 2357 !> - add unit factor (to change unit) 2167 !> - November, 2013- Initial Version 2358 2168 ! 2359 2169 !> @param[in] cd_name variable name … … 2385 2195 !> deflation is in use 2386 2196 !> @param[in] id_chunksz chunk size 2387 !> @param[in] cd_interp interpolation method2388 !> @param[in] cd_extrap extrapolation method2389 !> @param[in] cd_filter filter method2390 !> @param[in] cd_unt new units (linked to units factor)2391 !> @param[in] dd_unf units factor2392 2197 !> @return variable structure 2393 2198 !------------------------------------------------------------------- … … 2400 2205 & dd_min, dd_max, & 2401 2206 & ld_contiguous, ld_shuffle,& 2402 & ld_fletcher32, id_deflvl, id_chunksz, & 2403 & cd_interp, cd_extrap, cd_filter, & 2404 & cd_unt, dd_unf) 2207 & ld_fletcher32, id_deflvl, id_chunksz) 2405 2208 2406 2209 IMPLICIT NONE … … 2431 2234 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 2432 2235 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 2433 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp2434 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap2435 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter2436 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt2437 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf2438 2236 2439 2237 ! local variable … … 2483 2281 & ld_fletcher32=ld_fletcher32, & 2484 2282 & id_deflvl=id_deflvl, & 2485 & id_chunksz=id_chunksz(:), & 2486 & cd_interp=cd_interp(:), & 2487 & cd_extrap=cd_extrap(:), & 2488 & cd_filter=cd_filter(:), & 2489 & cd_unt=cd_unt, dd_unf=dd_unf) 2283 & id_chunksz=id_chunksz(:)) 2490 2284 2491 2285 DEALLOCATE( dl_value ) … … 2509 2303 ! 2510 2304 !> @author J.Paul 2511 !> @date November, 2013 - Initial Version 2512 !> @date June, 2015 2513 !> - add interp, extrap, and filter argument 2514 !> @date July, 2015 2515 !> - add unit factor (to change unit) 2305 !> - November, 2013- Initial Version 2516 2306 ! 2517 2307 !> @param[in] cd_name : variable name … … 2543 2333 !> deflation is in use 2544 2334 !> @param[in] id_chunksz : chunk size 2545 !> @param[in] cd_interp interpolation method2546 !> @param[in] cd_extrap extrapolation method2547 !> @param[in] cd_filter filter method2548 !> @param[in] cd_unt new units (linked to units factor)2549 !> @param[in] dd_unf units factor2550 2335 !> @return variable structure 2551 2336 !------------------------------------------------------------------- … … 2558 2343 & dd_min, dd_max, & 2559 2344 & ld_contiguous, ld_shuffle,& 2560 & ld_fletcher32, id_deflvl, id_chunksz, & 2561 & cd_interp, cd_extrap, cd_filter, & 2562 & cd_unt, dd_unf) 2345 & ld_fletcher32, id_deflvl, id_chunksz) 2563 2346 2564 2347 IMPLICIT NONE … … 2589 2372 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 2590 2373 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 2591 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp2592 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap2593 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter2594 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt2595 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf2596 2374 2597 2375 ! local variable … … 2637 2415 & ld_fletcher32=ld_fletcher32, & 2638 2416 & id_deflvl=id_deflvl, & 2639 & id_chunksz=id_chunksz(:), & 2640 & cd_interp=cd_interp(:), & 2641 & cd_extrap=cd_extrap(:), & 2642 & cd_filter=cd_filter(:), & 2643 & cd_unt=cd_unt, dd_unf=dd_unf) 2417 & id_chunksz=id_chunksz(:)) 2644 2418 2645 2419 DEALLOCATE( dl_value ) … … 2663 2437 ! 2664 2438 !> @author J.Paul 2665 !> @date November, 2013 - Initial Version 2666 !> @date June, 2015 2667 !> - add interp, extrap, and filter argument 2668 !> @date July, 2015 2669 !> - add unit factor (to change unit) 2439 !> - November, 2013- Initial Version 2670 2440 ! 2671 2441 !> @param[in] cd_name variable name … … 2695 2465 !> @param[in] id_deflvl deflate level from 0 to 9, 0 indicates no deflation is in use 2696 2466 !> @param[in] id_chunksz chunk size 2697 !> @param[in] cd_interp interpolation method2698 !> @param[in] cd_extrap extrapolation method2699 !> @param[in] cd_filter filter method2700 !> @param[in] cd_unt new units (linked to units factor)2701 !> @param[in] dd_unf units factor2702 2467 !> @return variable structure 2703 2468 !------------------------------------------------------------------- … … 2710 2475 & dd_min, dd_max, & 2711 2476 & ld_contiguous, ld_shuffle,& 2712 & ld_fletcher32, id_deflvl, id_chunksz, & 2713 & cd_interp, cd_extrap, cd_filter, & 2714 & cd_unt, dd_unf) 2477 & ld_fletcher32, id_deflvl, id_chunksz) 2715 2478 2716 2479 IMPLICIT NONE … … 2741 2504 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 2742 2505 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 2743 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp2744 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap2745 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter2746 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt2747 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf2748 2506 2749 2507 ! local variable … … 2791 2549 & ld_fletcher32=ld_fletcher32, & 2792 2550 & id_deflvl=id_deflvl, & 2793 & id_chunksz=id_chunksz(:), & 2794 & cd_interp=cd_interp(:), & 2795 & cd_extrap=cd_extrap(:), & 2796 & cd_filter=cd_filter(:), & 2797 & cd_unt=cd_unt, dd_unf=dd_unf) 2551 & id_chunksz=id_chunksz(:)) 2798 2552 2799 2553 DEALLOCATE( dl_value ) … … 2817 2571 ! 2818 2572 !> @author J.Paul 2819 !> @date November, 2013 - Initial Version 2820 !> @date June, 2015 2821 !> - add interp, extrap, and filter argument 2822 !> @date July, 2015 2823 !> - add unit factor (to change unit) 2573 !> - November, 2013- Initial Version 2824 2574 ! 2825 2575 !> @param[in] cd_name variable name … … 2851 2601 !> deflation is in use 2852 2602 !> @param[in] id_chunksz chunk size 2853 !> @param[in] cd_interp interpolation method2854 !> @param[in] cd_extrap extrapolation method2855 !> @param[in] cd_filter filter method2856 !> @param[in] cd_unt new units (linked to units factor)2857 !> @param[in] dd_unf units factor2858 2603 !> @return variable structure 2859 2604 !------------------------------------------------------------------- … … 2866 2611 & dd_min, dd_max, & 2867 2612 & ld_contiguous, ld_shuffle,& 2868 & ld_fletcher32, id_deflvl, id_chunksz, & 2869 & cd_interp, cd_extrap, cd_filter, & 2870 & cd_unt, dd_unf) 2613 & ld_fletcher32, id_deflvl, id_chunksz) 2871 2614 2872 2615 IMPLICIT NONE … … 2897 2640 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 2898 2641 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 2899 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp2900 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap2901 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter2902 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt2903 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf2904 2642 2905 2643 ! local variable … … 2948 2686 & ld_fletcher32=ld_fletcher32, & 2949 2687 & id_deflvl=id_deflvl, & 2950 & id_chunksz=id_chunksz(:), & 2951 & cd_interp=cd_interp(:), & 2952 & cd_extrap=cd_extrap(:), & 2953 & cd_filter=cd_filter(:), & 2954 & cd_unt=cd_unt, dd_unf=dd_unf) 2688 & id_chunksz=id_chunksz(:)) 2955 2689 2956 2690 DEALLOCATE( dl_value ) … … 2974 2708 ! 2975 2709 !> @author J.Paul 2976 !> @date November, 2013 - Initial Version 2977 !> @date June, 2015 2978 !> - add interp, extrap, and filter argument 2979 !> @date July, 2015 2980 !> - add unit factor (to change unit) 2710 !> - November, 2013- Initial Version 2981 2711 ! 2982 2712 !> @param[in] cd_name variable name … … 3008 2738 !> deflation is in use 3009 2739 !> @param[in] id_chunksz chunk size 3010 !> @param[in] cd_interp interpolation method3011 !> @param[in] cd_extrap extrapolation method3012 !> @param[in] cd_filter filter method3013 !> @param[in] cd_unt new units (linked to units factor)3014 !> @param[in] dd_unf units factor3015 2740 !> @return variable structure 3016 2741 !------------------------------------------------------------------- … … 3023 2748 & dd_min, dd_max, & 3024 2749 & ld_contiguous, ld_shuffle,& 3025 & ld_fletcher32, id_deflvl, id_chunksz, & 3026 & cd_interp, cd_extrap, cd_filter, & 3027 & cd_unt, dd_unf) 2750 & ld_fletcher32, id_deflvl, id_chunksz) 3028 2751 3029 2752 IMPLICIT NONE … … 3054 2777 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 3055 2778 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 3056 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp3057 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap3058 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter3059 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt3060 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf3061 3062 2779 3063 2780 ! local variable … … 3107 2824 & ld_fletcher32=ld_fletcher32, & 3108 2825 & id_deflvl=id_deflvl, & 3109 & id_chunksz=id_chunksz(:), & 3110 & cd_interp=cd_interp(:), & 3111 & cd_extrap=cd_extrap(:), & 3112 & cd_filter=cd_filter(:), & 3113 & cd_unt=cd_unt, dd_unf=dd_unf) 2826 & id_chunksz=id_chunksz(:)) 3114 2827 3115 2828 DEALLOCATE( dl_value ) … … 3133 2846 ! 3134 2847 !> @author J.Paul 3135 !> @date November, 2013 - Initial Version 3136 !> @date June, 2015 3137 !> - add interp, extrap, and filter argument 3138 !> @date July, 2015 3139 !> - add unit factor (to change unit) 2848 !> - November, 2013- Initial Version 3140 2849 ! 3141 2850 !> @param[in] cd_name variable name … … 3167 2876 !> deflation is in use 3168 2877 !> @param[in] id_chunksz chunk size 3169 !> @param[in] cd_interp interpolation method3170 !> @param[in] cd_extrap extrapolation method3171 !> @param[in] cd_filter filter method3172 !> @param[in] cd_unt new units (linked to units factor)3173 !> @param[in] dd_unf units factor3174 2878 !> @return variable structure 3175 2879 !------------------------------------------------------------------- … … 3182 2886 & dd_min, dd_max, & 3183 2887 & ld_contiguous, ld_shuffle,& 3184 & ld_fletcher32, id_deflvl, id_chunksz, & 3185 & cd_interp, cd_extrap, cd_filter, & 3186 & cd_unt, dd_unf) 2888 & ld_fletcher32, id_deflvl, id_chunksz) 3187 2889 3188 2890 IMPLICIT NONE … … 3213 2915 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 3214 2916 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 3215 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp3216 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap3217 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter3218 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt3219 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf3220 2917 3221 2918 ! local variable … … 3261 2958 & ld_fletcher32=ld_fletcher32, & 3262 2959 & id_deflvl=id_deflvl, & 3263 & id_chunksz=id_chunksz(:), & 3264 & cd_interp=cd_interp(:), & 3265 & cd_extrap=cd_extrap(:), & 3266 & cd_filter=cd_filter(:), & 3267 & cd_unt=cd_unt, dd_unf=dd_unf) 2960 & id_chunksz=id_chunksz(:)) 3268 2961 3269 2962 DEALLOCATE( dl_value ) … … 3287 2980 ! 3288 2981 !> @author J.Paul 3289 !> @date November, 2013 - Initial Version 3290 !> @date June, 2015 3291 !> - add interp, extrap, and filter argument 3292 !> @date July, 2015 3293 !> - add unit factor (to change unit) 2982 !> - November, 2013- Initial Version 3294 2983 ! 3295 2984 !> @param[in] cd_name variable name … … 3321 3010 !> deflation is in use 3322 3011 !> @param[in] id_chunksz chunk size 3323 !> @param[in] cd_interp interpolation method3324 !> @param[in] cd_extrap extrapolation method3325 !> @param[in] cd_filter filter method3326 !> @param[in] cd_unt new units (linked to units factor)3327 !> @param[in] dd_unf units factor3328 3012 !> @return variable structure 3329 3013 !------------------------------------------------------------------- … … 3336 3020 & dd_min, dd_max, & 3337 3021 & ld_contiguous, ld_shuffle,& 3338 & ld_fletcher32, id_deflvl, id_chunksz, & 3339 & cd_interp, cd_extrap, cd_filter, & 3340 & cd_unt, dd_unf) 3022 & ld_fletcher32, id_deflvl, id_chunksz) 3341 3023 3342 3024 IMPLICIT NONE … … 3367 3049 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 3368 3050 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 3369 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp3370 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap3371 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter3372 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt3373 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf3374 3051 3375 3052 ! local variable … … 3417 3094 & ld_fletcher32=ld_fletcher32, & 3418 3095 & id_deflvl=id_deflvl, & 3419 & id_chunksz=id_chunksz(:), & 3420 & cd_interp=cd_interp(:), & 3421 & cd_extrap=cd_extrap(:), & 3422 & cd_filter=cd_filter(:), & 3423 & cd_unt=cd_unt, dd_unf=dd_unf) 3096 & id_chunksz=id_chunksz(:)) 3424 3097 3425 3098 DEALLOCATE( dl_value ) … … 3443 3116 ! 3444 3117 !> @author J.Paul 3445 !> @date November, 2013 - Initial Version 3446 !> @date June, 2015 3447 !> - add interp, extrap, and filter argument 3448 !> @date July, 2015 3449 !> - add unit factor (to change unit) 3118 !> - November, 2013- Initial Version 3450 3119 ! 3451 3120 !> @param[in] cd_name variable name … … 3477 3146 !> deflation is in use 3478 3147 !> @param[in] id_chunksz chunk size 3479 !> @param[in] cd_interp interpolation method3480 !> @param[in] cd_extrap extrapolation method3481 !> @param[in] cd_filter filter method3482 !> @param[in] cd_unt new units (linked to units factor)3483 !> @param[in] dd_unf units factor3484 3148 !> @return variable structure 3485 3149 !------------------------------------------------------------------- … … 3492 3156 & dd_min, dd_max, & 3493 3157 & ld_contiguous, ld_shuffle,& 3494 & ld_fletcher32, id_deflvl, id_chunksz, & 3495 & cd_interp, cd_extrap, cd_filter, & 3496 & cd_unt, dd_unf) 3158 & ld_fletcher32, id_deflvl, id_chunksz) 3497 3159 3498 3160 IMPLICIT NONE … … 3523 3185 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 3524 3186 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 3525 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp3526 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap3527 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter3528 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt3529 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf3530 3187 3531 3188 ! local variable … … 3574 3231 & ld_fletcher32=ld_fletcher32, & 3575 3232 & id_deflvl=id_deflvl, & 3576 & id_chunksz=id_chunksz(:), & 3577 & cd_interp=cd_interp(:), & 3578 & cd_extrap=cd_extrap(:), & 3579 & cd_filter=cd_filter(:), & 3580 & cd_unt=cd_unt, dd_unf=dd_unf) 3233 & id_chunksz=id_chunksz(:)) 3581 3234 3582 3235 DEALLOCATE( dl_value ) … … 3600 3253 ! 3601 3254 !> @author J.Paul 3602 !> @date November, 2013 - Initial Version 3603 !> @date June, 2015 3604 !> - add interp, extrap, and filter argument 3605 !> @date July, 2015 3606 !> - add unit factor (to change unit) 3255 !> - November, 2013- Initial Version 3607 3256 ! 3608 3257 !> @param[in] cd_name variable name … … 3634 3283 !> deflation is in use 3635 3284 !> @param[in] id_chunksz chunk size 3636 !> @param[in] cd_interp interpolation method3637 !> @param[in] cd_extrap extrapolation method3638 !> @param[in] cd_filter filter method3639 !> @param[in] cd_unt new units (linked to units factor)3640 !> @param[in] dd_unf units factor3641 3642 3285 !> @return variable structure 3643 3286 !------------------------------------------------------------------- … … 3650 3293 & dd_min, dd_max, & 3651 3294 & ld_contiguous, ld_shuffle,& 3652 & ld_fletcher32, id_deflvl, id_chunksz, & 3653 & cd_interp, cd_extrap, cd_filter, & 3654 & cd_unt, dd_unf) 3295 & ld_fletcher32, id_deflvl, id_chunksz) 3655 3296 3656 3297 IMPLICIT NONE … … 3681 3322 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 3682 3323 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 3683 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp3684 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap3685 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter3686 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt3687 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf3688 3324 3689 3325 ! local variable … … 3733 3369 & ld_fletcher32=ld_fletcher32, & 3734 3370 & id_deflvl=id_deflvl, & 3735 & id_chunksz=id_chunksz(:), & 3736 & cd_interp=cd_interp(:), & 3737 & cd_extrap=cd_extrap(:), & 3738 & cd_filter=cd_filter(:), & 3739 & cd_unt=cd_unt, dd_unf=dd_unf) 3371 & id_chunksz=id_chunksz(:)) 3740 3372 3741 3373 DEALLOCATE( dl_value ) … … 3759 3391 ! 3760 3392 !> @author J.Paul 3761 !> @date November, 2013 - Initial Version 3762 !> @date June, 2015 3763 !> - add interp, extrap, and filter argument 3764 !> @date July, 2015 3765 !> - add unit factor (to change unit) 3393 !> - November, 2013- Initial Version 3766 3394 ! 3767 3395 !> @param[in] cd_name variable name … … 3793 3421 !> deflation is in use 3794 3422 !> @param[in] id_chunksz chunk size 3795 !> @param[in] cd_interp interpolation method3796 !> @param[in] cd_extrap extrapolation method3797 !> @param[in] cd_filter filter method3798 !> @param[in] cd_unt new units (linked to units factor)3799 !> @param[in] dd_unf units factor3800 3423 !> @return variable structure 3801 3424 !------------------------------------------------------------------- … … 3808 3431 & dd_min, dd_max, & 3809 3432 & ld_contiguous, ld_shuffle,& 3810 & ld_fletcher32, id_deflvl, id_chunksz, & 3811 & cd_interp, cd_extrap, cd_filter, & 3812 & cd_unt, dd_unf) 3433 & ld_fletcher32, id_deflvl, id_chunksz) 3813 3434 3814 3435 IMPLICIT NONE … … 3839 3460 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 3840 3461 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 3841 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp3842 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap3843 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter3844 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt3845 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf3846 3847 3462 3848 3463 ! local variable … … 3888 3503 & ld_fletcher32=ld_fletcher32, & 3889 3504 & id_deflvl=id_deflvl, & 3890 & id_chunksz=id_chunksz(:), & 3891 & cd_interp=cd_interp(:), & 3892 & cd_extrap=cd_extrap(:), & 3893 & cd_filter=cd_filter(:), & 3894 & cd_unt=cd_unt, dd_unf=dd_unf) 3505 & id_chunksz=id_chunksz(:)) 3895 3506 3896 3507 DEALLOCATE( dl_value ) … … 3914 3525 ! 3915 3526 !> @author J.Paul 3916 !> @date November, 2013 - Initial Version 3917 !> @date June, 2015 3918 !> - add interp, extrap, and filter argument 3919 !> @date July, 2015 3920 !> - add unit factor (to change unit) 3527 !> - November, 2013- Initial Version 3921 3528 ! 3922 3529 !> @param[in] cd_name variable name … … 3948 3555 !> deflation is in use 3949 3556 !> @param[in] id_chunksz chunk size 3950 !> @param[in] cd_interp interpolation method3951 !> @param[in] cd_extrap extrapolation method3952 !> @param[in] cd_filter filter method3953 !> @param[in] cd_unt new units (linked to units factor)3954 !> @param[in] dd_unf units factor3955 3557 !> @return variable structure 3956 3558 !------------------------------------------------------------------- … … 3963 3565 & dd_min, dd_max, & 3964 3566 & ld_contiguous, ld_shuffle,& 3965 & ld_fletcher32, id_deflvl, id_chunksz, & 3966 & cd_interp, cd_extrap, cd_filter, & 3967 & cd_unt, dd_unf) 3567 & ld_fletcher32, id_deflvl, id_chunksz) 3968 3568 3969 3569 IMPLICIT NONE … … 3994 3594 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 3995 3595 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 3996 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp3997 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap3998 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter3999 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt4000 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf4001 4002 3596 4003 3597 ! local variable … … 4045 3639 & ld_fletcher32=ld_fletcher32, & 4046 3640 & id_deflvl=id_deflvl, & 4047 & id_chunksz=id_chunksz(:), & 4048 & cd_interp=cd_interp(:), & 4049 & cd_extrap=cd_extrap(:), & 4050 & cd_filter=cd_filter(:), & 4051 & cd_unt=cd_unt, dd_unf=dd_unf) 3641 & id_chunksz=id_chunksz(:)) 4052 3642 4053 3643 DEALLOCATE( dl_value ) … … 4071 3661 ! 4072 3662 !> @author J.Paul 4073 !> @date November, 2013 - Initial Version 4074 !> @date June, 2015 4075 !> - add interp, extrap, and filter argument 4076 !> @date July, 2015 4077 !> - add unit factor (to change unit) 3663 !> - November, 2013- Initial Version 4078 3664 ! 4079 3665 !> @param[in] cd_name variable name … … 4105 3691 !> deflation is in use 4106 3692 !> @param[in] id_chunksz chunk size 4107 !> @param[in] cd_interp interpolation method4108 !> @param[in] cd_extrap extrapolation method4109 !> @param[in] cd_filter filter method4110 !> @param[in] cd_unt new units (linked to units factor)4111 !> @param[in] dd_unf units factor4112 3693 !> @return variable structure 4113 3694 !------------------------------------------------------------------- … … 4120 3701 & dd_min, dd_max, & 4121 3702 & ld_contiguous, ld_shuffle,& 4122 & ld_fletcher32, id_deflvl, id_chunksz, & 4123 & cd_interp, cd_extrap, cd_filter, & 4124 & cd_unt, dd_unf) 3703 & ld_fletcher32, id_deflvl, id_chunksz) 4125 3704 4126 3705 IMPLICIT NONE … … 4151 3730 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 4152 3731 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 4153 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp4154 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap4155 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter4156 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt4157 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf4158 3732 4159 3733 ! local variable … … 4202 3776 & ld_fletcher32=ld_fletcher32, & 4203 3777 & id_deflvl=id_deflvl, & 4204 & id_chunksz=id_chunksz(:), & 4205 & cd_interp=cd_interp(:), & 4206 & cd_extrap=cd_extrap(:), & 4207 & cd_filter=cd_filter(:), & 4208 & cd_unt=cd_unt, dd_unf=dd_unf) 3778 & id_chunksz=id_chunksz(:)) 4209 3779 4210 3780 DEALLOCATE( dl_value ) … … 4228 3798 ! 4229 3799 !> @author J.Paul 4230 !> @date November, 2013 - Initial Version 4231 !> @date June, 2015 4232 !> - add interp, extrap, and filter argument 4233 !> @date July, 2015 4234 !> - add unit factor (to change unit) 3800 !> - November, 2013- Initial Version 4235 3801 ! 4236 3802 !> @param[in] cd_name variable name … … 4262 3828 !> deflation is in use 4263 3829 !> @param[in] id_chunksz chunk size 4264 !> @param[in] cd_interp interpolation method4265 !> @param[in] cd_extrap extrapolation method4266 !> @param[in] cd_filter filter method4267 !> @param[in] cd_unt new units (linked to units factor)4268 !> @param[in] dd_unf units factor4269 3830 !> @return variable structure 4270 3831 !------------------------------------------------------------------- … … 4277 3838 & dd_min, dd_max, & 4278 3839 & ld_contiguous, ld_shuffle,& 4279 & ld_fletcher32, id_deflvl, id_chunksz, & 4280 & cd_interp, cd_extrap, cd_filter, & 4281 & cd_unt, dd_unf) 3840 & ld_fletcher32, id_deflvl, id_chunksz) 4282 3841 4283 3842 IMPLICIT NONE … … 4308 3867 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 4309 3868 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 4310 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp4311 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap4312 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter4313 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt4314 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf4315 3869 4316 3870 ! local variable … … 4360 3914 & ld_fletcher32=ld_fletcher32, & 4361 3915 & id_deflvl=id_deflvl, & 4362 & id_chunksz=id_chunksz(:), & 4363 & cd_interp=cd_interp(:), & 4364 & cd_extrap=cd_extrap(:), & 4365 & cd_filter=cd_filter(:), & 4366 & cd_unt=cd_unt, dd_unf=dd_unf) 3916 & id_chunksz=id_chunksz(:)) 4367 3917 4368 3918 DEALLOCATE( dl_value ) … … 4386 3936 ! 4387 3937 !> @author J.Paul 4388 !> @date November, 2013 - Initial Version 4389 !> @date June, 2015 4390 !> - add interp, extrap, and filter argument 4391 !> @date July, 2015 4392 !> - add unit factor (to change unit) 3938 !> - November, 2013- Initial Version 4393 3939 ! 4394 3940 !> @param[in] cd_name variable name … … 4420 3966 !> deflation is in use 4421 3967 !> @param[in] id_chunksz chunk size 4422 !> @param[in] cd_interp interpolation method4423 !> @param[in] cd_extrap extrapolation method4424 !> @param[in] cd_filter filter method4425 !> @param[in] cd_unt new units (linked to units factor)4426 !> @param[in] dd_unf units factor4427 3968 !> @return variable structure 4428 3969 !------------------------------------------------------------------- … … 4435 3976 & dd_min, dd_max, & 4436 3977 & ld_contiguous, ld_shuffle,& 4437 & ld_fletcher32, id_deflvl, id_chunksz, & 4438 & cd_interp, cd_extrap, cd_filter, & 4439 & cd_unt, dd_unf) 3978 & ld_fletcher32, id_deflvl, id_chunksz) 4440 3979 4441 3980 IMPLICIT NONE … … 4466 4005 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 4467 4006 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 4468 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp4469 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap4470 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter4471 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt4472 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf4473 4007 4474 4008 ! local variable … … 4514 4048 & ld_fletcher32=ld_fletcher32, & 4515 4049 & id_deflvl=id_deflvl, & 4516 & id_chunksz=id_chunksz(:), & 4517 & cd_interp=cd_interp(:), & 4518 & cd_extrap=cd_extrap(:), & 4519 & cd_filter=cd_filter(:), & 4520 & cd_unt=cd_unt, dd_unf=dd_unf) 4050 & id_chunksz=id_chunksz(:)) 4521 4051 4522 4052 DEALLOCATE( dl_value ) … … 4540 4070 ! 4541 4071 !> @author J.Paul 4542 !> @date November, 2013 - Initial Version 4543 !> @date June, 2015 4544 !> - add interp, extrap, and filter argument 4545 !> @date July, 2015 4546 !> - add unit factor (to change unit) 4072 !> - November, 2013- Initial Version 4547 4073 ! 4548 4074 !> @param[in] cd_name variable name … … 4574 4100 !> deflation is in use 4575 4101 !> @param[in] id_chunksz chunk size 4576 !> @param[in] cd_interp interpolation method4577 !> @param[in] cd_extrap extrapolation method4578 !> @param[in] cd_filter filter method4579 !> @param[in] cd_unt new units (linked to units factor)4580 !> @param[in] dd_unf units factor4581 4102 !> @return variable structure 4582 4103 !------------------------------------------------------------------- … … 4589 4110 & dd_min, dd_max, & 4590 4111 & ld_contiguous, ld_shuffle,& 4591 & ld_fletcher32, id_deflvl, id_chunksz, & 4592 & cd_interp, cd_extrap, cd_filter, & 4593 & cd_unt, dd_unf) 4112 & ld_fletcher32, id_deflvl, id_chunksz) 4594 4113 4595 4114 IMPLICIT NONE … … 4620 4139 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 4621 4140 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 4622 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp4623 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap4624 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter4625 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt4626 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf4627 4141 4628 4142 ! local variable … … 4670 4184 & ld_fletcher32=ld_fletcher32, & 4671 4185 & id_deflvl=id_deflvl, & 4672 & id_chunksz=id_chunksz(:), & 4673 & cd_interp=cd_interp(:), & 4674 & cd_extrap=cd_extrap(:), & 4675 & cd_filter=cd_filter(:), & 4676 & cd_unt=cd_unt, dd_unf=dd_unf) 4186 & id_chunksz=id_chunksz(:)) 4677 4187 4678 4188 DEALLOCATE( dl_value ) … … 4696 4206 ! 4697 4207 !> @author J.Paul 4698 !> @date November, 2013 - Initial Version 4699 !> @date June, 2015 4700 !> - add interp, extrap, and filter argument 4701 !> @date July, 2015 4702 !> - add unit factor (to change unit) 4208 !> - November, 2013- Initial Version 4703 4209 ! 4704 4210 !> @param[in] cd_name variable name … … 4730 4236 !> deflation is in use 4731 4237 !> @param[in] id_chunksz chunk size 4732 !> @param[in] cd_interp interpolation method4733 !> @param[in] cd_extrap extrapolation method4734 !> @param[in] cd_filter filter method4735 !> @param[in] cd_unt new units (linked to units factor)4736 !> @param[in] dd_unf units factor4737 4238 !> @return variable structure 4738 4239 !------------------------------------------------------------------- … … 4745 4246 & dd_min, dd_max, & 4746 4247 & ld_contiguous, ld_shuffle,& 4747 & ld_fletcher32, id_deflvl, id_chunksz, & 4748 & cd_interp, cd_extrap, cd_filter, & 4749 & cd_unt, dd_unf) 4248 & ld_fletcher32, id_deflvl, id_chunksz) 4750 4249 4751 4250 IMPLICIT NONE … … 4776 4275 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 4777 4276 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 4778 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp4779 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap4780 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter4781 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt4782 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf4783 4277 4784 4278 ! local variable … … 4827 4321 & ld_fletcher32=ld_fletcher32, & 4828 4322 & id_deflvl=id_deflvl, & 4829 & id_chunksz=id_chunksz(:), & 4830 & cd_interp=cd_interp(:), & 4831 & cd_extrap=cd_extrap(:), & 4832 & cd_filter=cd_filter(:), & 4833 & cd_unt=cd_unt, dd_unf=dd_unf) 4323 & id_chunksz=id_chunksz(:)) 4834 4324 4835 4325 DEALLOCATE( dl_value ) … … 4853 4343 ! 4854 4344 !> @author J.Paul 4855 !> @date November, 2013 - Initial Version 4856 !> @date June, 2015 4857 !> - add interp, extrap, and filter argument 4858 !> @date July, 2015 4859 !> - add unit factor (to change unit) 4345 !> - November, 2013- Initial Version 4860 4346 ! 4861 4347 !> @param[in] cd_name variable name … … 4887 4373 !> deflation is in use 4888 4374 !> @param[in] id_chunksz chunk size 4889 !> @param[in] cd_interp interpolation method4890 !> @param[in] cd_extrap extrapolation method4891 !> @param[in] cd_filter filter method4892 !> @param[in] cd_unt new units (linked to units factor)4893 !> @param[in] dd_unf units factor4894 4375 !> @return variable structure 4895 4376 !------------------------------------------------------------------- … … 4902 4383 & dd_min, dd_max, & 4903 4384 & ld_contiguous, ld_shuffle,& 4904 & ld_fletcher32, id_deflvl, id_chunksz, & 4905 & cd_interp, cd_extrap, cd_filter, & 4906 & cd_unt, dd_unf) 4385 & ld_fletcher32, id_deflvl, id_chunksz) 4907 4386 4908 4387 IMPLICIT NONE … … 4933 4412 INTEGER(i4) , INTENT(IN), OPTIONAL :: id_deflvl 4934 4413 INTEGER(i4) , DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_chunksz 4935 CHARACTER(LEN=*), DIMENSION(2) , INTENT(IN), OPTIONAL :: cd_interp4936 CHARACTER(LEN=*), DIMENSION(1) , INTENT(IN), OPTIONAL :: cd_extrap4937 CHARACTER(LEN=*), DIMENSION(5) , INTENT(IN), OPTIONAL :: cd_filter4938 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_unt4939 REAL(dp) , INTENT(IN), OPTIONAL :: dd_unf4940 4414 4941 4415 ! local variable … … 4985 4459 & ld_fletcher32=ld_fletcher32, & 4986 4460 & id_deflvl=id_deflvl, & 4987 & id_chunksz=id_chunksz(:), & 4988 & cd_interp=cd_interp(:), & 4989 & cd_extrap=cd_extrap(:), & 4990 & cd_filter=cd_filter(:), & 4991 & cd_unt=cd_unt, dd_unf=dd_unf) 4461 & id_chunksz=id_chunksz(:)) 4992 4462 4993 4463 DEALLOCATE( dl_value ) … … 5003 4473 !> 5004 4474 !> @author J.Paul 5005 !> @date November, 2013- Initial Version4475 !> - November, 2013- Initial Version 5006 4476 ! 5007 4477 !> @param[in] td_var1 variable structure … … 5053 4523 !> 5054 4524 !> @author J.Paul 5055 !> @date November, 2013- Initial Version4525 !> - November, 2013- Initial Version 5056 4526 ! 5057 4527 !> @param[in] td_var1 variable structure … … 5125 4595 !> 5126 4596 !> @author J.Paul 5127 !> @date November, 2013- Initial Version4597 !> - November, 2013- Initial Version 5128 4598 ! 5129 4599 !> @param[in] td_var1 variable structure … … 5200 4670 !> 5201 4671 !> @author J.Paul 5202 !> @date November, 2013- Initial Version4672 !> - November, 2013- Initial Version 5203 4673 ! 5204 4674 !> @param[in] td_var1 variable structure … … 5275 4745 !> 5276 4746 !> @author J.Paul 5277 !> @date November, 2013- Initial Version4747 !> - November, 2013- Initial Version 5278 4748 ! 5279 4749 !> @param[in] td_var1 variable structure … … 5350 4820 !> 5351 4821 !> @author J.Paul 5352 !> @date November, 2013 - Initial Version 5353 !> @date June, 2015 5354 !> - add all element of the array in the same time 4822 !> - November, 2013- Initial Version 5355 4823 !> 5356 4824 !> @param[inout] td_var variable structure … … 5365 4833 ! local variable 5366 4834 INTEGER(i4) :: il_natt 5367 INTEGER(i4) :: il_status5368 INTEGER(i4) :: il_ind5369 TYPE(TATT), DIMENSION(:), ALLOCATABLE :: tl_att5370 4835 5371 4836 ! loop indices … … 5375 4840 il_natt=SIZE(td_att(:)) 5376 4841 5377 IF( td_var%i_natt > 0 )THEN5378 ! already other attribute in variable structure5379 ALLOCATE( tl_att(td_var%i_natt), stat=il_status )5380 IF(il_status /= 0 )THEN5381 5382 CALL logger_error( &5383 & " VAR ADD ATT: not enough space to put attributes from "//&5384 & TRIM(td_var%c_name)//" in temporary attribute structure")5385 5386 ELSE5387 5388 ! save temporary global attribute's variable structure5389 tl_att(:)=att_copy(td_var%t_att(:))5390 5391 CALL att_clean(td_var%t_att(:))5392 DEALLOCATE( td_var%t_att )5393 ALLOCATE( td_var%t_att(td_var%i_natt+il_natt), stat=il_status )5394 IF(il_status /= 0 )THEN5395 5396 CALL logger_error( &5397 & " VAR ADD ATT: not enough space to put attributes "//&5398 & "in variable structure "//TRIM(td_var%c_name) )5399 5400 ENDIF5401 5402 ! copy attribute in variable before5403 td_var%t_att(1:td_var%i_natt)=att_copy(tl_att(:))5404 5405 ! clean5406 CALL att_clean(tl_att(:))5407 DEALLOCATE(tl_att)5408 5409 ENDIF5410 ELSE5411 ! no attribute in variable structure5412 IF( ASSOCIATED(td_var%t_att) )THEN5413 CALL att_clean(td_var%t_att(:))5414 DEALLOCATE(td_var%t_att)5415 ENDIF5416 ALLOCATE( td_var%t_att(td_var%i_natt+il_natt), stat=il_status )5417 IF(il_status /= 0 )THEN5418 5419 CALL logger_error( &5420 & " VAR ADD ATT: not enough space to put attributes "//&5421 & "in variable structure "//TRIM(td_var%c_name) )5422 5423 ENDIF5424 ENDIF5425 5426 ALLOCATE( tl_att(il_natt) )5427 tl_att(:)=att_copy(td_att(:))5428 5429 ! check if attribute already in variable structure5430 4842 DO ji=1,il_natt 5431 il_ind=0 5432 il_ind=att_get_index( td_var%t_att(:), tl_att(ji)%c_name ) 5433 IF( il_ind /= 0 )THEN 5434 CALL logger_error( & 5435 & " VAR ADD ATT: attribute "//TRIM(tl_att(ji)%c_name)//& 5436 & ", already in variable "//TRIM(td_var%c_name) ) 5437 CALL att_clean(tl_att(ji)) 5438 ENDIF 4843 CALL var_add_att(td_var, td_att(ji)) 5439 4844 ENDDO 5440 5441 ! add new attributes5442 td_var%t_att(td_var%i_natt+1:td_var%i_natt+il_natt)=att_copy(tl_att(:))5443 5444 DEALLOCATE(tl_att)5445 5446 DO ji=1,il_natt5447 ! highlight some attribute5448 IF( ASSOCIATED(td_var%t_att(td_var%i_natt+ji)%d_value) .OR. &5449 & td_var%t_att(td_var%i_natt+ji)%c_value /= 'none' )THEN5450 SELECT CASE(TRIM(td_var%t_att(td_var%i_natt+ji)%c_name))5451 5452 CASE("add_offset")5453 td_var%d_ofs = td_var%t_att(td_var%i_natt+ji)%d_value(1)5454 CASE("scale_factor")5455 td_var%d_scf = td_var%t_att(td_var%i_natt+ji)%d_value(1)5456 CASE("_FillValue")5457 td_var%d_fill = td_var%t_att(td_var%i_natt+ji)%d_value(1)5458 CASE("ew_overlap")5459 td_var%i_ew = INT(td_var%t_att(td_var%i_natt+ji)%d_value(1),i4)5460 CASE("standard_name")5461 td_var%c_stdname = TRIM(td_var%t_att(td_var%i_natt+ji)%c_value)5462 CASE("long_name")5463 td_var%c_longname = TRIM(td_var%t_att(td_var%i_natt+ji)%c_value)5464 CASE("units")5465 td_var%c_units = TRIM(td_var%t_att(td_var%i_natt+ji)%c_value)5466 CASE("grid_point")5467 td_var%c_point = TRIM(td_var%t_att(td_var%i_natt+ji)%c_value)5468 5469 END SELECT5470 ENDIF5471 ENDDO5472 5473 ! update number of attribute5474 td_var%i_natt=td_var%i_natt+il_natt5475 5476 4845 5477 4846 END SUBROUTINE var__add_att_arr … … 5481 4850 ! 5482 4851 !> @author J.Paul 5483 !> @date November, 2013 - Initial Version 5484 !> @date June, 2015 5485 !> - use var__add_att_arr subroutine 4852 !> - November, 2013- Initial Version 5486 4853 ! 5487 4854 !> @param[inout] td_var variable structure … … 5495 4862 5496 4863 ! local variable 5497 TYPE(TATT), DIMENSION(1) :: tl_att 4864 INTEGER(i4) :: il_status 4865 INTEGER(i4) :: il_ind 4866 TYPE(TATT), DIMENSION(:), ALLOCATABLE :: tl_att 5498 4867 5499 4868 ! loop indices 4869 INTEGER(i4) :: ji 5500 4870 !---------------------------------------------------------------- 5501 4871 5502 ! copy structure in an array 5503 tl_att(1)=att_copy(td_att) 5504 5505 ! 5506 CALL var_add_att( td_var, tl_att(:) ) 4872 ! check if attribute already in variable structure 4873 il_ind=0 4874 IF( ASSOCIATED(td_var%t_att) )THEN 4875 il_ind=att_get_index( td_var%t_att(:), td_att%c_name ) 4876 ENDIF 4877 4878 IF( il_ind /= 0 )THEN 4879 4880 CALL logger_error( & 4881 & " VAR ADD ATT: attribute "//TRIM(td_att%c_name)//& 4882 & ", already in variable "//TRIM(td_var%c_name) ) 4883 4884 DO ji=1,td_var%i_natt 4885 CALL logger_debug( & 4886 & " VAR ADD ATT: in variable "//TRIM(td_var%t_att(ji)%c_name) ) 4887 ENDDO 4888 4889 ELSE 4890 4891 CALL logger_trace( & 4892 & " VAR ADD ATT: add attribute "//TRIM(td_att%c_name)//& 4893 & ", in variable "//TRIM(td_var%c_name) ) 4894 4895 IF( td_var%i_natt > 0 )THEN 4896 ! already other attribute in variable structure 4897 ALLOCATE( tl_att(td_var%i_natt), stat=il_status ) 4898 IF(il_status /= 0 )THEN 4899 4900 CALL logger_error( & 4901 & " VAR ADD ATT: not enough space to put attributes from "//& 4902 & TRIM(td_var%c_name)//" in temporary attribute structure") 4903 4904 ELSE 4905 4906 ! save temporary global attribute's variable structure 4907 tl_att(:)=att_copy(td_var%t_att(:)) 4908 4909 CALL att_clean(td_var%t_att(:)) 4910 DEALLOCATE( td_var%t_att ) 4911 ALLOCATE( td_var%t_att(td_var%i_natt+1), stat=il_status ) 4912 IF(il_status /= 0 )THEN 4913 4914 CALL logger_error( & 4915 & " VAR ADD ATT: not enough space to put attributes "//& 4916 & "in variable structure "//TRIM(td_var%c_name) ) 4917 4918 ENDIF 4919 4920 ! copy attribute in variable before 4921 td_var%t_att(1:td_var%i_natt)=att_copy(tl_att(:)) 4922 4923 ! clean 4924 CALL att_clean(tl_att(:)) 4925 DEALLOCATE(tl_att) 4926 4927 ENDIF 4928 ELSE 4929 ! no attribute in variable structure 4930 IF( ASSOCIATED(td_var%t_att) )THEN 4931 CALL att_clean(td_var%t_att(:)) 4932 DEALLOCATE(td_var%t_att) 4933 ENDIF 4934 ALLOCATE( td_var%t_att(td_var%i_natt+1), stat=il_status ) 4935 IF(il_status /= 0 )THEN 4936 4937 CALL logger_error( & 4938 & " VAR ADD ATT: not enough space to put attributes "//& 4939 & "in variable structure "//TRIM(td_var%c_name) ) 4940 4941 ENDIF 4942 ENDIF 4943 ! update number of attribute 4944 td_var%i_natt=td_var%i_natt+1 4945 4946 ! add new attribute 4947 td_var%t_att(td_var%i_natt)=att_copy(td_att) 4948 4949 !! add new attribute id 4950 !td_var%t_att(td_var%i_natt)%i_id=att_get_unit(td_var%t_att(:)) 4951 4952 ! highlight some attribute 4953 IF( ASSOCIATED(td_var%t_att(td_var%i_natt)%d_value) .OR. & 4954 & td_var%t_att(td_var%i_natt)%c_value /= "none" )THEN 4955 SELECT CASE(TRIM(td_var%t_att(td_var%i_natt)%c_name)) 4956 4957 CASE("add_offset") 4958 td_var%d_ofs = td_var%t_att(td_var%i_natt)%d_value(1) 4959 CASE("scale_factor") 4960 td_var%d_scf = td_var%t_att(td_var%i_natt)%d_value(1) 4961 CASE("_FillValue") 4962 td_var%d_fill = td_var%t_att(td_var%i_natt)%d_value(1) 4963 CASE("ew_overlap") 4964 td_var%i_ew = INT(td_var%t_att(td_var%i_natt)%d_value(1),i4) 4965 CASE("standard_name") 4966 td_var%c_stdname = TRIM(td_var%t_att(td_var%i_natt)%c_value) 4967 CASE("long_name") 4968 td_var%c_longname = TRIM(td_var%t_att(td_var%i_natt)%c_value) 4969 CASE("units") 4970 td_var%c_units = TRIM(td_var%t_att(td_var%i_natt)%c_value) 4971 CASE("grid_point") 4972 td_var%c_point = TRIM(td_var%t_att(td_var%i_natt)%c_value) 4973 4974 END SELECT 4975 ENDIF 4976 ENDIF 5507 4977 5508 4978 END SUBROUTINE var__add_att_unit … … 5512 4982 ! 5513 4983 !> @author J.Paul 5514 !> @date November, 2013 - Initial Version 5515 !> @date February, 2015 5516 !> - define local attribute structure to avoid mistake 5517 !> with pointer 4984 !> - November, 2013- Initial Version 5518 4985 ! 5519 4986 !> @param[inout] td_var variable structure … … 5529 4996 INTEGER(i4) :: il_ind 5530 4997 5531 TYPE(TATT) :: tl_att5532 4998 ! loop indices 5533 4999 !---------------------------------------------------------------- … … 5541 5007 IF( il_ind == 0 )THEN 5542 5008 5543 CALL logger_ debug( &5009 CALL logger_warn( & 5544 5010 & " VAR DEL ATT: no attribute "//TRIM(cd_name)//& 5545 5011 & ", in variable "//TRIM(td_var%c_name) ) … … 5547 5013 ELSE 5548 5014 5549 tl_att=att_copy(td_var%t_att(il_ind)) 5550 CALL var_del_att(td_var, tl_att) 5015 CALL var_del_att(td_var, td_var%t_att(il_ind)) 5551 5016 5552 5017 ENDIF … … 5558 5023 ! 5559 5024 !> @author J.Paul 5560 !> @date November, 2013- Initial Version 5561 !> @date February, 2015 5562 !> - delete highlight attribute too, when attribute 5563 !> is deleted 5025 !> - November, 2013- Initial Version 5564 5026 ! 5565 5027 !> @param[inout] td_var variable structure … … 5578 5040 5579 5041 ! loop indices 5042 !INTEGER(i4) :: ji 5580 5043 !---------------------------------------------------------------- 5581 5044 … … 5588 5051 IF( il_ind == 0 )THEN 5589 5052 5590 CALL logger_ debug( &5053 CALL logger_warn( & 5591 5054 & " VAR DEL ATT: no attribute "//TRIM(td_att%c_name)//& 5592 5055 & ", in variable "//TRIM(td_var%c_name) ) … … 5640 5103 td_var%t_att(1:td_var%i_natt)=att_copy(tl_att(:)) 5641 5104 5105 !! change attribute id 5106 !DO ji=1,td_var%i_natt 5107 ! td_var%t_att(ji)%i_id=ji 5108 !ENDDO 5109 5642 5110 ! clean 5643 5111 CALL att_clean(tl_att(:)) … … 5645 5113 ENDIF 5646 5114 ENDIF 5647 5648 ! highlight attribute5649 SELECT CASE( TRIM(td_att%c_name) )5650 5651 CASE("add_offset")5652 td_var%d_ofs = 0._dp5653 CASE("scale_factor")5654 td_var%d_scf = 1._dp5655 CASE("_FillValue")5656 td_var%d_fill = 0._dp5657 CASE("ew_overlap")5658 td_var%i_ew = -15659 CASE("standard_name")5660 td_var%c_stdname = ''5661 CASE("long_name")5662 td_var%c_longname = ''5663 CASE("units")5664 td_var%c_units = ''5665 CASE("grid_point")5666 td_var%c_point = ''5667 5668 END SELECT5669 5670 5115 ENDIF 5671 5116 … … 5676 5121 ! 5677 5122 !> @author J.Paul 5678 !> @date November, 2013- Initial Version5123 !> - November, 2013- Initial Version 5679 5124 ! 5680 5125 !> @param[inout] td_var variable structure … … 5711 5156 ! 5712 5157 !> @author J.Paul 5713 !> @date November, 2013- Initial Version5158 !> - November, 2013- Initial Version 5714 5159 ! 5715 5160 !> @param[inout] td_var variable structure … … 5750 5195 ! 5751 5196 !> @author J.Paul 5752 !> @date November, 2013- Initial Version5197 !> - November, 2013- Initial Version 5753 5198 ! 5754 5199 !> @param[inout] td_var variable structure … … 5766 5211 !---------------------------------------------------------------- 5767 5212 5768 IF( td_var%i_ndim <= ip_maxdim)THEN5213 IF( td_var%i_ndim <= 4 )THEN 5769 5214 5770 5215 ! check if dimension already used in variable structure … … 5782 5227 ELSE 5783 5228 5784 ! back to disorder dimension array 5785 CALL dim_disorder(td_var%t_dim(:)) 5786 5229 ! back to unorder dimension array 5230 CALL dim_unorder(td_var%t_dim(:)) 5787 5231 ! add new dimension 5788 5232 td_var%t_dim(td_var%i_ndim+1)=dim_copy(td_dim) … … 5809 5253 ! 5810 5254 !> @author J.Paul 5811 !> @date November, 2013- Initial Version5255 !> - November, 2013- Initial Version 5812 5256 ! 5813 5257 !> @param[inout] td_var variable structure … … 5828 5272 !---------------------------------------------------------------- 5829 5273 5830 IF( td_var%i_ndim <= ip_maxdim)THEN5274 IF( td_var%i_ndim <= 4 )THEN 5831 5275 5832 5276 CALL logger_trace( & … … 5873 5317 ! 5874 5318 !> @author J.Paul 5875 !> @date November, 2013- Initial Version5319 !> - November, 2013- Initial Version 5876 5320 ! 5877 5321 !> @param[inout] td_var variable structure … … 5916 5360 !> 5917 5361 !> @author J.Paul 5918 !> @date June, 2014- Initial Version5362 !> - June, 2014- Initial Version 5919 5363 ! 5920 5364 !> @param[in] td_var array of variables structure … … 5942 5386 !> 5943 5387 !> @author J.Paul 5944 !> @date November, 2013- Initial Version5388 !> - November, 2013- Initial Version 5945 5389 ! 5946 5390 !> @param[in] td_var variable structure … … 6049 5493 !> 6050 5494 !> @author J.Paul 6051 !> @date November, 2013- Initial Version5495 !> - November, 2013- Initial Version 6052 5496 !> 6053 5497 !> @param[inout] td_var variable structure … … 6187 5631 !> 6188 5632 !> @author J.Paul 6189 !> @date November, 2013- Initial Version5633 !> - November, 2013- Initial Version 6190 5634 !> 6191 5635 !> @param[inout] td_var variable structure … … 6241 5685 !> 6242 5686 !> @author J.Paul 6243 !> @date November, 2013- Initial Version5687 !> - November, 2013- Initial Version 6244 5688 ! 6245 5689 !> @param[inout] td_var variable structure … … 6317 5761 ! 6318 5762 !> @author J.Paul 6319 !> @date November, 2013- Initial Version5763 !> - November, 2013- Initial Version 6320 5764 ! 6321 5765 !> @param[inout] td_var variabele structure … … 6393 5837 ! 6394 5838 !> @author J.Paul 6395 !> @date November, 2013- Initial Version5839 !> - November, 2013- Initial Version 6396 5840 ! 6397 5841 !> @param[inout] td_var variabele structure … … 6469 5913 ! 6470 5914 !> @author J.Paul 6471 !> @date November, 2013- Initial Version5915 !> - November, 2013- Initial Version 6472 5916 ! 6473 5917 !> @param[inout] td_var variabele structure … … 6543 5987 !> 6544 5988 !> @author J.Paul 6545 !> @date November, 2013- Initial Version5989 !> - November, 2013- Initial Version 6546 5990 ! 6547 5991 !> @param[inout] td_var variable structure … … 6613 6057 !> 6614 6058 !> @author J.Paul 6615 !> @date November, 2013- Initial Version6059 !> - November, 2013- Initial Version 6616 6060 !> 6617 6061 !> @param[inout] td_var variable structure … … 6636 6080 !> 6637 6081 !> @author J.Paul 6638 !> @date September, 2014- Initial Version6082 !> - September, 2014- Initial Version 6639 6083 !> 6640 6084 !> @param[in] td_var array of variable structure … … 6701 6145 !> 6702 6146 !> @author J.Paul 6703 !> @date November, 2013- Initial Version6147 !> - November, 2013- Initial Version 6704 6148 ! 6705 6149 !> @param[in] td_var array of variable structure … … 6756 6200 !> 6757 6201 !> @author J.Paul 6758 !> @date November, 2013- Initial Version6202 !> - November, 2013- Initial Version 6759 6203 ! 6760 6204 !> @param[in] td_var array of variable structure … … 6795 6239 !> 6796 6240 !> @author J.Paul 6797 !> @date November, 2013- Initial Version6241 !> - November, 2013- Initial Version 6798 6242 ! 6799 6243 !> @param[inout] td_var array of variable structure … … 6878 6322 !> 6879 6323 !> @author J.Paul 6880 !> @date November, 2013 - Initial Version 6881 !> @date June, 2015 6882 !> - new namelist format to get extra information (interpolation,...) 6324 !> - November, 2013- Initial Version 6883 6325 ! 6884 6326 !> @param[in] cd_file configuration file of variable … … 6915 6357 6916 6358 il_fileid=fct_getunit() 6359 CALL logger_trace("VAR DEF EXTRA: open "//TRIM(cd_file)) 6917 6360 OPEN( il_fileid, FILE=TRIM(cd_file), & 6918 6361 & FORM='FORMATTED', & … … 6923 6366 CALL fct_err(il_status) 6924 6367 IF( il_status /= 0 )THEN 6925 CALL logger_fatal("VAR DEF EXTRA: can not open file "//& 6926 & TRIM(cd_file)) 6368 CALL logger_error("VAR DEF EXTRA: opening file "//TRIM(cd_file)) 6927 6369 ENDIF 6928 6370 … … 6933 6375 DO WHILE( il_status == 0 ) 6934 6376 6935 ! search line not beginning with comment character6377 ! search line do not beginning with comment character 6936 6378 IF( SCAN( TRIM(fct_concat(cp_com(:))) ,cl_line(1:1)) == 0 )THEN 6937 6379 il_nvar=il_nvar+1 … … 6977 6419 tg_varextra(ji)%c_axis =TRIM(fct_split(cl_line,3)) 6978 6420 tg_varextra(ji)%c_point =TRIM(fct_split(cl_line,4)) 6979 6980 cl_interp='int='//TRIM(fct_split(cl_line,5)) 6421 tg_varextra(ji)%c_stdname =TRIM(fct_split(cl_line,5)) 6422 tg_varextra(ji)%c_longname=TRIM(fct_split(cl_line,6)) 6423 6424 cl_interp=TRIM(fct_split(cl_line,7)) 6981 6425 tg_varextra(ji)%c_interp(:) = & 6982 6426 & var__get_interp(TRIM(tg_varextra(ji)%c_name), cl_interp) 6983 6427 CALL logger_debug("VAR DEF EXTRA: "//& 6984 6428 & TRIM(tg_varextra(ji)%c_name)//& 6985 & " "//TRIM(tg_varextra(ji)%c_interp(1))) 6986 6987 tg_varextra(ji)%c_longname=TRIM(fct_split(cl_line,6)) 6988 tg_varextra(ji)%c_stdname =TRIM(fct_split(cl_line,7)) 6429 & " "//TRIM(cl_interp)) 6989 6430 ELSE 6990 6431 ji=ji-1 … … 7017 6458 !> @details 7018 6459 !> string character format must be : <br/> 7019 !> "varname:int =interp; flt=filter; ext=extrap; min=min; max=max"<br/>6460 !> "varname:interp; filter; extrap; > min; < max"<br/> 7020 6461 !> you could specify only interpolation, filter or extrapolation method, 7021 6462 !> whatever the order. you could find more … … 7023 6464 !> \ref extrap module.<br/> 7024 6465 !> Examples: 7025 !> cn_varinfo='Bathymetry:flt=2*hamming(2,3); min=10.' 7026 !> cn_varinfo='votemper:int=cubic; ext=dist_weight; max=40.' 7027 !> 7028 !> 7029 !> @warning variable should be define in tg_varextra (ie in configuration 7030 !> file, to be able to add information from namelist 6466 !> cn_varinfo='Bathymetry:2*hamming(2,3); > 10.' 6467 !> cn_varinfo='votemper:cubic; dist_weight; <40.' 7031 6468 !> 7032 6469 !> @note If you do not specify a method which is required, default one is … … 7034 6471 !> 7035 6472 !> @author J.Paul 7036 !> @date November, 2013 - Initial Version 7037 !> @date July, 2015 7038 !> - get unit and unit factor (to change unit) 6473 !> - November, 2013- Initial Version 7039 6474 ! 7040 6475 !> @param[in] cd_varinfo variable information from namelist … … 7051 6486 CHARACTER(LEN=lc), DIMENSION(1) :: cl_extrap 7052 6487 CHARACTER(LEN=lc), DIMENSION(5) :: cl_filter 7053 CHARACTER(LEN=lc) :: cl_unt7054 6488 7055 6489 INTEGER(i4) :: il_ind … … 7058 6492 REAL(dp) :: dl_min 7059 6493 REAL(dp) :: dl_max 7060 REAL(dp) :: dl_unf7061 6494 7062 6495 TYPE(TVAR) , DIMENSION(:), ALLOCATABLE :: tl_varextra … … 7075 6508 dl_min=var__get_min(cl_name, cl_method) 7076 6509 dl_max=var__get_max(cl_name, cl_method) 7077 dl_unf=var__get_unf(cl_name, cl_method)7078 6510 cl_interp(:)=var__get_interp(cl_name, cl_method) 7079 6511 cl_extrap(:)=var__get_extrap(cl_name, cl_method) 7080 6512 cl_filter(:)=var__get_filter(cl_name, cl_method) 7081 cl_unt=var__get_unt(cl_name, cl_method)7082 7083 6513 7084 6514 il_ind=var_get_index(tg_varextra(:), TRIM(cl_name)) … … 7086 6516 IF( dl_min /= dp_fill ) tg_varextra(il_ind)%d_min=dl_min 7087 6517 IF( dl_max /= dp_fill ) tg_varextra(il_ind)%d_max=dl_max 7088 IF( dl_unf /= dp_fill ) tg_varextra(il_ind)%d_unf=dl_unf7089 IF(cl_unt /='') tg_varextra(il_ind)%c_unt =cl_unt7090 6518 IF(cl_interp(1)/='') tg_varextra(il_ind)%c_interp(:)=cl_interp(:) 7091 6519 IF(cl_extrap(1)/='') tg_varextra(il_ind)%c_extrap(:)=cl_extrap(:) … … 7123 6551 & cd_filter=cl_filter(:), & 7124 6552 & dd_min = dl_min, & 7125 & dd_max = dl_max, & 7126 & cd_unt = cl_unt, & 7127 & dd_unf = dl_unf ) 6553 & dd_max = dl_max ) 7128 6554 7129 6555 ENDIF 7130 6556 7131 6557 ji=ji+1 7132 CALL logger_ debug( "VAR CHG EXTRA: name "//&6558 CALL logger_trace( "VAR CHG EXTRA: name "//& 7133 6559 & TRIM(tg_varextra(il_ind)%c_name) ) 7134 CALL logger_ debug( "VAR CHG EXTRA: interp "//&6560 CALL logger_trace( "VAR CHG EXTRA: interp "//& 7135 6561 & TRIM(tg_varextra(il_ind)%c_interp(1)) ) 7136 CALL logger_ debug( "VAR CHG EXTRA: filter "//&6562 CALL logger_trace( "VAR CHG EXTRA: filter "//& 7137 6563 & TRIM(tg_varextra(il_ind)%c_filter(1)) ) 7138 CALL logger_ debug( "VAR CHG EXTRA: extrap "//&6564 CALL logger_trace( "VAR CHG EXTRA: extrap "//& 7139 6565 & TRIM(tg_varextra(il_ind)%c_extrap(1)) ) 7140 6566 IF( tg_varextra(il_ind)%d_min /= dp_fill )THEN 7141 CALL logger_ debug( "VAR CHG EXTRA: min value "//&6567 CALL logger_trace( "VAR CHG EXTRA: min value "//& 7142 6568 & TRIM(fct_str(tg_varextra(il_ind)%d_min)) ) 7143 6569 ENDIF 7144 6570 IF( tg_varextra(il_ind)%d_max /= dp_fill )THEN 7145 CALL logger_ debug( "VAR CHG EXTRA: max value "//&6571 CALL logger_trace( "VAR CHG EXTRA: max value "//& 7146 6572 & TRIM(fct_str(tg_varextra(il_ind)%d_max)) ) 7147 ENDIF7148 IF( TRIM(tg_varextra(il_ind)%c_unt) /= '' )THEN7149 CALL logger_debug( "VAR CHG EXTRA: new unit "//&7150 & TRIM(tg_varextra(il_ind)%c_unt) )7151 ENDIF7152 IF( tg_varextra(il_ind)%d_unf /= 1. )THEN7153 CALL logger_debug( "VAR CHG EXTRA: new unit factor "//&7154 & TRIM(fct_str(tg_varextra(il_ind)%d_unf)) )7155 6573 ENDIF 7156 6574 ENDDO … … 7175 6593 !> 7176 6594 !> @author J.Paul 7177 !> @date November, 2013- Initial Version6595 !> - November, 2013- Initial Version 7178 6596 ! 7179 6597 !> @param[inout] td_var variable structure … … 7269 6687 !> 7270 6688 !> @author J.Paul 7271 !> @date November, 2013- Initial Version6689 !> - November, 2013- Initial Version 7272 6690 !> 7273 6691 !> @param[inout] td_var variable structure … … 7390 6808 ENDIF 7391 6809 7392 ! unt 7393 IF( TRIM(td_var%c_unt) == '' .AND. & 7394 & TRIM(tg_varextra(il_ind)%c_unt) /= '' )THEN 7395 td_var%c_unt=TRIM(tg_varextra(il_ind)%c_unt) 7396 ENDIF 7397 7398 ! units factor 7399 IF( td_var%d_unf == 1._dp .AND. & 7400 & tg_varextra(il_ind)%d_unf /= 1._dp )THEN 7401 td_var%d_unf=tg_varextra(il_ind)%d_unf 7402 ENDIF 7403 6810 CALL logger_trace("VAR GET EXTRA: name "//TRIM(td_var%c_name)) 6811 CALL logger_trace("VAR GET EXTRA: stdname "//TRIM(td_var%c_stdname)) 6812 CALL logger_trace("VAR GET EXTRA: longname "//TRIM(td_var%c_longname)) 6813 CALL logger_trace("VAR GET EXTRA: units "//TRIM(td_var%c_units)) 6814 CALL logger_trace("VAR GET EXTRA: point "//TRIM(td_var%c_point)) 6815 CALL logger_trace("VAR GET EXTRA: interp "//TRIM(td_var%c_interp(1))) 6816 CALL logger_trace("VAR GET EXTRA: filter "//TRIM(td_var%c_filter(1))) 6817 CALL logger_trace("VAR GET EXTRA: min value "//TRIM(fct_str(td_var%d_min))) 6818 CALL logger_trace("VAR GET EXTRA: max value "//TRIM(fct_str(td_var%d_max))) 7404 6819 ENDIF 7405 6820 … … 7418 6833 !> 7419 6834 !> @details 7420 !> minimum value is assume to follow s tring "min ="6835 !> minimum value is assume to follow sign '>' 7421 6836 !> 7422 6837 !> @author J.Paul 7423 !> @date November, 2013 - Initial Version 7424 !> @date June, 2015 7425 !> - change way to get information in namelist, 7426 !> value follows string "min =" 6838 !> - November, 2013- Initial Version 7427 6839 ! 7428 6840 !> @param[in] cd_name variable name … … 7455 6867 cl_tmp=fct_split(cd_varinfo,ji,';') 7456 6868 DO WHILE( TRIM(cl_tmp) /= '' ) 7457 il_ind= INDEX(TRIM(cl_tmp),'min')6869 il_ind=SCAN(TRIM(cl_tmp),'>') 7458 6870 IF( il_ind /= 0 )THEN 7459 cl_min= fct_split(cl_tmp,2,'=')6871 cl_min=TRIM(ADJUSTL(cl_tmp(il_ind+1:))) 7460 6872 EXIT 7461 6873 ENDIF … … 7465 6877 7466 6878 IF( TRIM(cl_min) /= '' )THEN 7467 IF( fct_is_ real(cl_min) )THEN6879 IF( fct_is_num(cl_min) )THEN 7468 6880 READ(cl_min,*) var__get_min 7469 6881 CALL logger_debug("VAR GET MIN: will use minimum value of "//& … … 7482 6894 !> 7483 6895 !> @details 7484 !> maximum value is assume to follow s tring "max ="6896 !> maximum value is assume to follow sign '<' 7485 6897 !> 7486 6898 !> @author J.Paul 7487 !> @date November, 2013 - Initial Version 7488 !> @date June, 2015 7489 !> - change way to get information in namelist, 7490 !> value follows string "max =" 6899 !> - November, 2013- Initial Version 7491 6900 ! 7492 6901 !> @param[in] cd_name variable name … … 7519 6928 cl_tmp=fct_split(cd_varinfo,ji,';') 7520 6929 DO WHILE( TRIM(cl_tmp) /= '' ) 7521 il_ind= INDEX(TRIM(cl_tmp),'max')6930 il_ind=SCAN(TRIM(cl_tmp),'<') 7522 6931 IF( il_ind /= 0 )THEN 7523 cl_max= fct_split(cl_tmp,2,'=')6932 cl_max=TRIM(ADJUSTL(cl_tmp(il_ind+1:))) 7524 6933 EXIT 7525 6934 ENDIF … … 7529 6938 7530 6939 IF( TRIM(cl_max) /= '' )THEN 7531 IF( fct_is_ real(cl_max) )THEN6940 IF( fct_is_num(cl_max) )THEN 7532 6941 READ(cl_max,*) var__get_max 7533 6942 CALL logger_debug("VAR GET MAX: will use maximum value of "//& … … 7543 6952 !> @brief 7544 6953 !> This function check if variable information read in namelist contains 7545 !> units factor value and return it if true.7546 !>7547 !> @details7548 !> units factor value is assume to follow string "unf ="7549 !>7550 !> @author J.Paul7551 !> @date June, 2015 - Initial Version7552 !7553 !> @param[in] cd_name variable name7554 !> @param[in] cd_varinfo variable information read in namelist7555 !> @return untis factor value to be used (FillValue if none)7556 !-------------------------------------------------------------------7557 FUNCTION var__get_unf( cd_name, cd_varinfo )7558 IMPLICIT NONE7559 ! Argument7560 CHARACTER(LEN=*), INTENT(IN ) :: cd_name7561 CHARACTER(LEN=*), INTENT(IN ) :: cd_varinfo7562 7563 ! function7564 REAL(dp) :: var__get_unf7565 7566 ! local variable7567 CHARACTER(LEN=lc) :: cl_tmp7568 CHARACTER(LEN=lc) :: cl_unf7569 7570 INTEGER(i4) :: il_ind7571 7572 REAL(dp) :: rl_unf7573 7574 ! loop indices7575 INTEGER(i4) :: ji7576 !----------------------------------------------------------------7577 ! init7578 cl_unf=''7579 var__get_unf=dp_fill7580 7581 ji=17582 cl_tmp=fct_split(cd_varinfo,ji,';')7583 DO WHILE( TRIM(cl_tmp) /= '' )7584 il_ind=INDEX(TRIM(cl_tmp),'unf')7585 IF( il_ind /= 0 )THEN7586 cl_unf=fct_split(cl_tmp,2,'=')7587 EXIT7588 ENDIF7589 ji=ji+17590 cl_tmp=fct_split(cd_varinfo,ji,';')7591 ENDDO7592 7593 IF( TRIM(cl_unf) /= '' )THEN7594 rl_unf=math_compute(cl_unf)7595 IF( rl_unf /= dp_fill )THEN7596 var__get_unf = rl_unf7597 CALL logger_debug("VAR GET UNITS FACTOR: will use units factor "//&7598 & "value of "//TRIM(fct_str(var__get_unf))//" for variable "//&7599 & TRIM(cd_name) )7600 ELSE7601 CALL logger_error("VAR GET UNITS FACTOR: invalid units factor "//&7602 & "value for variable "//TRIM(cd_name)//". check namelist." )7603 ENDIF7604 ENDIF7605 7606 END FUNCTION var__get_unf7607 !-------------------------------------------------------------------7608 !> @brief7609 !> This function check if variable information read in namelist contains7610 6954 !> interpolation method and return it if true. 7611 6955 !> 7612 6956 !> @details 7613 !> interpolation method is assume to follow string "int =" 7614 !> 6957 !> split namelist information, using ';' as separator. 7615 6958 !> compare method name with the list of interpolation method available (see 7616 6959 !> module global). 7617 6960 !> check if factor (*rhoi, /rhoj..) are present.<br/> 7618 6961 !> Example:<br/> 7619 !> - int=cubic/rhoi ; ext=dist_weight7620 !> - int=bilin6962 !> - cubic/rhoi ; dist_weight 6963 !> - bilin 7621 6964 !> see @ref interp module for more information. 7622 6965 !> 7623 6966 !> @author J.Paul 7624 !> @date November, 2013 - Initial Version 7625 !> @date June, 2015 7626 !> - change way to get information in namelist, 7627 !> value follows string "int =" 6967 !> - November, 2013- Initial Version 7628 6968 ! 7629 6969 !> @param[in] cd_name variable name … … 7642 6982 ! local variable 7643 6983 CHARACTER(LEN=lc) :: cl_tmp 7644 CHARACTER(LEN=lc) :: cl_int7645 6984 CHARACTER(LEN=lc) :: cl_factor 7646 6985 … … 7661 7000 cl_tmp=fct_split(cd_varinfo,ji,';') 7662 7001 DO WHILE( TRIM(cl_tmp) /= '' ) 7663 il_ind=INDEX(TRIM(cl_tmp),'int')7664 IF( il_ind /= 0 )THEN7665 cl_int=fct_split(cl_tmp,2,'=')7666 EXIT7667 ENDIF7668 ji=ji+17669 cl_tmp=fct_split(cd_varinfo,ji,';')7670 ENDDO7671 7672 IF( TRIM(cl_int) /= '' )THEN7673 7002 DO jj=1,ip_ninterp 7674 il_ind= INDEX(fct_lower(cl_ int),TRIM(cp_interp_list(jj)))7003 il_ind= INDEX(fct_lower(cl_tmp),TRIM(cp_interp_list(jj))) 7675 7004 IF( il_ind /= 0 )THEN 7676 7005 … … 7680 7009 ! look for factor 7681 7010 IF( il_ind==1 )THEN 7682 cl_factor=cl_ int(il_len+1:)7011 cl_factor=cl_tmp(il_len+1:) 7683 7012 ELSE 7684 cl_factor=cl_ int(1:il_ind-1)7013 cl_factor=cl_tmp(1:il_ind-1) 7685 7014 ENDIF 7686 7015 il_mul=SCAN(TRIM(cl_factor),'*') … … 7723 7052 ENDIF 7724 7053 ENDDO 7725 ENDIF 7054 IF( jj /= ip_ninterp + 1 ) EXIT 7055 ji=ji+1 7056 cl_tmp=fct_split(cd_varinfo,ji,';') 7057 ENDDO 7726 7058 7727 7059 END FUNCTION var__get_interp … … 7732 7064 !> 7733 7065 !> @details 7734 !> extrapolation method is assume to follow string "ext =" 7735 !> 7066 !> split namelist information, using ';' as separator. 7736 7067 !> compare method name with the list of extrapolation method available (see 7737 7068 !> module global).<br/> 7738 7069 !> Example:<br/> 7739 !> - int=cubic ; ext=dist_weight7740 !> - ext=min_error7070 !> - cubic ; dist_weight 7071 !> - min_error 7741 7072 !> see @ref extrap module for more information. 7742 7073 !> 7743 7074 !> @author J.Paul 7744 !> @date November, 2013 - Initial Version 7745 !> @date June, 2015 7746 !> - change way to get information in namelist, 7747 !> value follows string "ext =" 7075 !> - November, 2013- Initial Version 7748 7076 ! 7749 7077 !> @param[in] cd_name variable name … … 7762 7090 ! local variable 7763 7091 CHARACTER(LEN=lc) :: cl_tmp 7764 CHARACTER(LEN=lc) :: cl_ext7765 7766 INTEGER(i4) :: il_ind7767 7092 7768 7093 ! loop indices … … 7776 7101 cl_tmp=fct_split(cd_varinfo,ji,';') 7777 7102 DO WHILE( TRIM(cl_tmp) /= '' ) 7778 il_ind=INDEX(TRIM(cl_tmp),'ext') 7779 IF( il_ind /= 0 )THEN 7780 cl_ext=fct_split(cl_tmp,2,'=') 7781 EXIT 7782 ENDIF 7103 DO jj=1,ip_nextrap 7104 IF( TRIM(fct_lower(cl_tmp)) == TRIM(cp_extrap_list(jj)) )THEN 7105 var__get_extrap(1)=TRIM(cp_extrap_list(jj)) 7106 7107 CALL logger_trace("VAR GET EXTRAP: variable "//TRIM(cd_name)//& 7108 & " will use extrapolation method "//TRIM(var__get_extrap(1)) ) 7109 7110 EXIT 7111 ENDIF 7112 ENDDO 7113 IF( jj /= ip_nextrap + 1 ) EXIT 7783 7114 ji=ji+1 7784 7115 cl_tmp=fct_split(cd_varinfo,ji,';') 7785 7116 ENDDO 7786 7787 IF( TRIM(cl_ext) /= '' )THEN7788 DO jj=1,ip_nextrap7789 IF( TRIM(fct_lower(cl_ext)) == TRIM(cp_extrap_list(jj)) )THEN7790 var__get_extrap(1)=TRIM(cp_extrap_list(jj))7791 7792 CALL logger_trace("VAR GET EXTRAP: variable "//TRIM(cd_name)//&7793 & " will use extrapolation method "//TRIM(var__get_extrap(1)) )7794 7795 EXIT7796 ENDIF7797 ENDDO7798 ENDIF7799 7117 7800 7118 … … 7806 7124 !> 7807 7125 !> @details 7808 !> filter method is assume to follow string "flt =" 7809 !> 7126 !> split namelist information, using ';' as separator. 7810 7127 !> compare method name with the list of filter method available (see 7811 7128 !> module global). 7812 !> look for the number of run, using '*' separator, and method parameters inside7129 !> look for the number of turn, using '*' separator, and method parameters inside 7813 7130 !> bracket.<br/> 7814 7131 !> Example:<br/> 7815 !> - int=cubic ; flt=2*hamming(2,3)7816 !> - flt=hann7132 !> - cubic ; 2*hamming(2,3) 7133 !> - hann 7817 7134 !> see @ref filter module for more information. 7818 7135 !> 7819 7136 !> @author J.Paul 7820 !> @date November, 2013 - Initial Version 7821 !> @date June, 2015 7822 !> - change way to get information in namelist, 7823 !> value follows string "flt =" 7824 !> 7137 !> - November, 2013- Initial Version 7138 ! 7825 7139 !> @param[in] cd_name variable name 7826 7140 !> @param[in] cd_varinfo variable information read in namelist … … 7837 7151 ! local variable 7838 7152 CHARACTER(LEN=lc) :: cl_tmp 7839 CHARACTER(LEN=lc) :: cl_flt7840 7153 INTEGER(i4) :: il_ind 7841 7154 … … 7850 7163 cl_tmp=fct_split(cd_varinfo,ji,';') 7851 7164 DO WHILE( TRIM(cl_tmp) /= '' ) 7852 il_ind=INDEX(TRIM(cl_tmp),'flt')7853 IF( il_ind /= 0 )THEN7854 cl_flt=fct_split(cl_tmp,2,'=')7855 EXIT7856 ENDIF7857 ji=ji+17858 cl_tmp=fct_split(cd_varinfo,ji,';')7859 ENDDO7860 7861 IF( TRIM(cl_flt) /= '' )THEN7862 7165 DO jj=1,ip_nfilter 7863 il_ind=INDEX(fct_lower(cl_ flt),TRIM(cp_filter_list(jj)))7166 il_ind=INDEX(fct_lower(cl_tmp),TRIM(cp_filter_list(jj))) 7864 7167 IF( il_ind /= 0 )THEN 7865 7168 var__get_filter(1)=TRIM(cp_filter_list(jj)) 7866 7169 7867 ! look for number of run7868 il_ind=SCAN(fct_lower(cl_ flt),'*')7170 ! look for number of turn 7171 il_ind=SCAN(fct_lower(cl_tmp),'*') 7869 7172 IF( il_ind /=0 )THEN 7870 IF( fct_is_num(cl_ flt(1:il_ind-1)) )THEN7871 var__get_filter(2)=TRIM(cl_ flt(1:il_ind-1))7872 ELSE IF( fct_is_num(cl_ flt(il_ind+1:)) )THEN7873 var__get_filter(2)=TRIM(cl_ flt(il_ind+1:))7173 IF( fct_is_num(cl_tmp(1:il_ind-1)) )THEN 7174 var__get_filter(2)=TRIM(cl_tmp(1:il_ind-1)) 7175 ELSE IF( fct_is_num(cl_tmp(il_ind+1:)) )THEN 7176 var__get_filter(2)=TRIM(cl_tmp(il_ind+1:)) 7874 7177 ELSE 7875 7178 var__get_filter(2)='1' … … 7880 7183 7881 7184 ! look for filter parameter 7882 il_ind=SCAN(fct_lower(cl_ flt),'(')7185 il_ind=SCAN(fct_lower(cl_tmp),'(') 7883 7186 IF( il_ind /=0 )THEN 7884 cl_ flt=TRIM(cl_flt(il_ind+1:))7885 il_ind=SCAN(fct_lower(cl_ flt),')')7187 cl_tmp=TRIM(cl_tmp(il_ind+1:)) 7188 il_ind=SCAN(fct_lower(cl_tmp),')') 7886 7189 IF( il_ind /=0 )THEN 7887 cl_ flt=TRIM(cl_flt(1:il_ind-1))7190 cl_tmp=TRIM(cl_tmp(1:il_ind-1)) 7888 7191 ! look for cut-off frequency 7889 var__get_filter(3)=fct_split(cl_ flt,1,',')7192 var__get_filter(3)=fct_split(cl_tmp,1,',') 7890 7193 ! look for halo size 7891 var__get_filter(4)=fct_split(cl_ flt,2,',')7194 var__get_filter(4)=fct_split(cl_tmp,2,',') 7892 7195 ! look for alpha parameter 7893 var__get_filter(5)=fct_split(cl_ flt,3,',')7196 var__get_filter(5)=fct_split(cl_tmp,3,',') 7894 7197 ELSE 7895 7198 CALL logger_error("VAR GET FILTER: variable "//& … … 7912 7215 ENDIF 7913 7216 ENDDO 7914 ENDIF 7915 7916 END FUNCTION var__get_filter 7917 !------------------------------------------------------------------- 7918 !> @brief 7919 !> This function check if variable information read in namelist contains 7920 !> unit and return it if true. 7921 !> 7922 !> @details 7923 !> unit is assume to follow string "unt =" 7924 !> 7925 !> @author J.Paul 7926 !> @date June, 2015 - Initial Version 7927 ! 7928 !> @param[in] cd_name variable name 7929 !> @param[in] cd_varinfo variable information read in namelist 7930 !> @return unit string character 7931 !------------------------------------------------------------------- 7932 FUNCTION var__get_unt( cd_name, cd_varinfo ) 7933 IMPLICIT NONE 7934 ! Argument 7935 CHARACTER(LEN=*), INTENT(IN ) :: cd_name 7936 CHARACTER(LEN=*), INTENT(IN ) :: cd_varinfo 7937 7938 ! function 7939 CHARACTER(LEN=lc) :: var__get_unt 7940 7941 ! local variable 7942 CHARACTER(LEN=lc) :: cl_tmp 7943 7944 INTEGER(i4) :: il_ind 7945 7946 ! loop indices 7947 INTEGER(i4) :: ji 7948 !---------------------------------------------------------------- 7949 7950 var__get_unt='' 7951 7952 ji=1 7953 cl_tmp=fct_split(cd_varinfo,ji,';') 7954 DO WHILE( TRIM(cl_tmp) /= '' ) 7955 il_ind=INDEX(TRIM(cl_tmp),'unt') 7956 IF( il_ind /= 0 )THEN 7957 var__get_unt=fct_split(cl_tmp,2,'=') 7958 EXIT 7959 ENDIF 7217 IF( jj /= ip_nfilter + 1 ) EXIT 7960 7218 ji=ji+1 7961 7219 cl_tmp=fct_split(cd_varinfo,ji,';') 7962 7220 ENDDO 7963 7221 7964 IF( TRIM(var__get_unt) /= '' )THEN 7965 CALL logger_debug("VAR GET UNIT: will use units "//& 7966 & TRIM(var__get_unt)//" for variable "//& 7967 & TRIM(cd_name) ) 7968 ENDIF 7969 7970 END FUNCTION var__get_unt 7222 END FUNCTION var__get_filter 7971 7223 !------------------------------------------------------------------- 7972 7224 !> @brief … … 7975 7227 !> 7976 7228 !> @author J.Paul 7977 !> @date November, 2013- Initial Version7229 !> - November, 2013- Initial Version 7978 7230 ! 7979 7231 !> @param[in] td_var array of variable structure … … 8033 7285 !> 8034 7286 !> @author J.Paul 8035 !> @date November, 2013- Initial Version7287 !> - November, 2013- Initial Version 8036 7288 ! 8037 7289 !> @param[inout] td_var variable structure … … 8069 7321 !------------------------------------------------------------------- 8070 7322 !> @brief 8071 !> This subroutine replace unit name of the variable,8072 !> and apply unit factor to the value of this variable.8073 !>8074 !> @details8075 !> new unit name (unt) and unit factor (unf) are read from the namelist.8076 !>8077 !> @note the variable value should be already read.8078 !>8079 !> @author J.Paul8080 !> @date June, 2015 - Initial Version8081 !8082 !> @param[inout] td_var variable structure8083 !-------------------------------------------------------------------8084 SUBROUTINE var_chg_unit( td_var )8085 IMPLICIT NONE8086 ! Argument8087 TYPE(TVAR), INTENT(INOUT) :: td_var8088 8089 ! local variable8090 TYPE(TATT) :: tl_att8091 8092 ! loop indices8093 !----------------------------------------------------------------8094 8095 IF( ASSOCIATED(td_var%d_value) )THEN8096 !- change value8097 IF( td_var%d_unf /= 1._dp )THEN8098 WHERE( td_var%d_value(:,:,:,:) /= td_var%d_fill )8099 td_var%d_value(:,:,:,:)=td_var%d_value(:,:,:,:)*td_var%d_unf8100 END WHERE8101 8102 !- change scale factor and offset to avoid mistake8103 tl_att=att_init('scale_factor',1)8104 CALL var_move_att(td_var, tl_att)8105 8106 tl_att=att_init('add_offset',0)8107 CALL var_move_att(td_var, tl_att)8108 ENDIF8109 8110 !- change unit name8111 IF( TRIM(td_var%c_unt) /= TRIM(td_var%c_units) .AND. &8112 & TRIM(td_var%c_unt) /= '' )THEN8113 tl_att=att_init('units',TRIM(td_var%c_unt))8114 CALL var_move_att(td_var,tl_att)8115 ENDIF8116 8117 ENDIF8118 8119 END SUBROUTINE var_chg_unit8120 !-------------------------------------------------------------------8121 !> @brief8122 7323 !> This subroutine check variable dimension expected, as defined in 8123 7324 !> file 'variable.cfg'. … … 8128 7329 !> 8129 7330 !> @author J.Paul 8130 !> @date November, 2013- Initial Version7331 !> - November, 2013- Initial Version 8131 7332 ! 8132 7333 !> @param[inout] td_var variable structure … … 8213 7414 !> 8214 7415 !> @author J.Paul 8215 !> @date August, 2014 - Initial Version 8216 !> @date July 2015 8217 !> - do not use dim_disorder anymore 7416 !> - August, 2014- Initial Version 8218 7417 ! 8219 7418 !> @param[inout] td_var variable structure … … 8239 7438 IF( PRESENT(cd_dimorder) ) cl_dimorder=TRIM(ADJUSTL(cd_dimorder)) 8240 7439 8241 CALL logger_debug("VAR REORDER: work on "//TRIM(td_var%c_name)//&8242 & " new dimension order "//TRIM(cl_dimorder))8243 8244 7440 tl_dim(:)=dim_copy(td_var%t_dim(:)) 8245 7441 7442 CALL dim_unorder(tl_dim(:)) 8246 7443 CALL dim_reorder(tl_dim(:),TRIM(cl_dimorder)) 8247 7444 … … 8270 7467 !> 8271 7468 !> @author J.Paul 8272 !> @date September, 2014- Initial Version7469 !> - September, 2014- Initial Version 8273 7470 ! 8274 7471 !> @param[in] td_var array of variable structure … … 8295 7492 !> 8296 7493 !> @author J.Paul 8297 !> @date November, 2014- Initial Version7494 !> - November, 2014- Initial Version 8298 7495 ! 8299 7496 !> @param[in] td_var time variable structure -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/vgrid.f90
r10248 r10251 70 70 !> @date Spetember, 2014 71 71 !> - add header 72 !> @date June, 2015 - update subroutine with NEMO 3.673 72 !> 74 73 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 119 118 !> 120 119 !> @author G. Madec 121 !> @date Marsh,2008 -F90: Free form and module120 !> - 03,08- G. Madec: F90: Free form and module 122 121 ! 123 122 !> @note Reference : Marti, Madec & Delecluse, 1992, JGR, 97, No8, 12,763-12,766. … … 140 139 !------------------------------------------------------------------- 141 140 SUBROUTINE vgrid_zgr_z( dd_gdepw, dd_gdept, dd_e3w, dd_e3t, & 142 & dd_e3w_1d, dd_e3t_1d, &143 141 & dd_ppkth, dd_ppkth2, dd_ppacr, dd_ppacr2, & 144 142 & dd_ppdzmin, dd_pphmax, dd_pp_to_be_computed, & … … 150 148 REAL(dp), DIMENSION(:), INTENT(INOUT) :: dd_e3w 151 149 REAL(dp), DIMENSION(:), INTENT(INOUT) :: dd_e3t 152 REAL(dp), DIMENSION(:), INTENT(INOUT) :: dd_e3w_1d153 REAL(dp), DIMENSION(:), INTENT(INOUT) :: dd_e3t_1d154 150 155 151 REAL(dp) , INTENT(IN ) :: dd_ppkth … … 230 226 DO jk = 1, il_jpk 231 227 dl_zw = REAL(jk,dp) 232 dl_zt = REAL(jk,dp) + 0.5 _dp228 dl_zt = REAL(jk,dp) + 0.5 233 229 dd_gdepw(jk) = ( dl_zw - 1.0 ) * dl_za1 234 230 dd_gdept(jk) = ( dl_zt - 1.0 ) * dl_za1 … … 241 237 DO jk = 1, il_jpk 242 238 dl_zw = REAL( jk,dp) 243 dl_zt = REAL( jk,dp) + 0.5 _dp239 dl_zt = REAL( jk,dp) + 0.5 244 240 dd_gdepw(jk) = ( dl_zsur + dl_za0 * dl_zw + & 245 241 & dl_za1 * dl_zacr * LOG( COSH( (dl_zw-dl_zkth)/dl_zacr ) ) + & … … 259 255 ENDIF 260 256 261 ! need to be like this to compute the pressure gradient with ISF.262 ! If not, level beneath the ISF are not aligned (sum(e3t) /= depth)263 ! define e3t_0 and e3w_0 as the differences between gdept and gdepw respectively264 DO jk = 1, il_jpk-1265 dd_e3t_1d(jk) = dd_gdepw(jk+1)-dd_gdepw(jk)266 END DO267 dd_e3t_1d(il_jpk) = dd_e3t_1d(il_jpk-1) ! we don't care because this level is masked in NEMO268 269 DO jk = 2, il_jpk270 dd_e3w_1d(jk) = dd_gdept(jk) - dd_gdept(jk-1)271 END DO272 dd_e3w_1d(1 ) = 2._dp * (dd_gdept(1) - dd_gdepw(1))273 274 257 ! Control and print 275 258 ! ================== … … 277 260 DO jk = 1, il_jpk 278 261 IF( dd_e3w(jk) <= 0. .OR. dd_e3t(jk) <= 0. )then 279 CALL logger_debug("VGRID ZGR Z: e3w or e3t <=0 ")262 CALL logger_debug("VGRID ZGR Z: e3w or e3t =< 0 ") 280 263 ENDIF 281 282 IF( dd_e3w_1d(jk) <= 0. .OR. dd_e3t_1d(jk) <= 0. )then283 CALL logger_debug("VGRID ZGR Z: e3w_1d or e3t_1d <= 0 ")284 ENDIF285 264 286 265 IF( dd_gdepw(jk) < 0. .OR. dd_gdept(jk) < 0. )then … … 290 269 291 270 END SUBROUTINE vgrid_zgr_z 292 !-------------------------------------------------------------------293 !-------------------------------------------------------------------294 SUBROUTINE vgrid_zgr_bat( dd_bathy, dd_gdepw, dd_hmin, dd_fill )295 IMPLICIT NONE296 ! Argument297 REAL(dp), DIMENSION(:,:), INTENT(INOUT) :: dd_bathy298 REAL(dp), DIMENSION(:) , INTENT(IN ) :: dd_gdepw299 REAL(dp) , INTENT(IN ) :: dd_hmin300 REAL(dp) , INTENT(IN ), OPTIONAL :: dd_fill301 302 ! local303 INTEGER(i4) :: il_jpk304 305 REAL(dp) :: dl_hmin306 REAL(dp) :: dl_fill307 308 ! loop indices309 INTEGER(i4) :: jk310 !----------------------------------------------------------------311 il_jpk = SIZE(dd_gdepw(:))312 313 dl_fill=0._dp314 IF( PRESENT(dd_fill) ) dl_fill=dd_fill315 316 IF( dd_hmin < 0._dp ) THEN317 jk = - INT( dd_hmin ) ! from a nb of level318 ELSE319 jk = MINLOC( dd_gdepw, mask = dd_gdepw > dd_hmin, dim = 1 ) ! from a depth320 ENDIF321 322 dl_hmin = dd_gdepw(jk+1) ! minimum depth = ik+1 w-levels323 WHERE( dd_bathy(:,:) <= 0._wp .OR. dd_bathy(:,:) == dl_fill )324 dd_bathy(:,:) = dl_fill ! min=0 over the lands325 ELSE WHERE326 dd_bathy(:,:) = MAX( dl_hmin , dd_bathy(:,:) ) ! min=dl_hmin over the oceans327 END WHERE328 WRITE(*,*) 'Minimum ocean depth: ', dl_hmin, ' minimum number of ocean levels : ', jk329 330 END SUBROUTINE vgrid_zgr_bat331 271 !------------------------------------------------------------------- 332 272 !> @brief This subroutine set the depth and vertical scale factor in partial step … … 373 313 ! 374 314 !> @author A. Bozec, G. Madec 375 !> @date February, 2009 - F90: Free form and module 376 !> @date February, 2009 377 !> - A. de Miranda : rigid-lid + islands 315 !> - 02-09 (A. Bozec, G. Madec) F90: Free form and module 316 !> - 02-09 (A. de Miranda) rigid-lid + islands 378 317 !> 379 318 !> @note Reference : Pacanowsky & Gnanadesikan 1997, Mon. Wea. Rev., 126, 3248-3270. … … 388 327 !------------------------------------------------------------------- 389 328 SUBROUTINE vgrid_zgr_zps( id_mbathy, dd_bathy, id_jpkmax, & 390 & dd_gdepw, dd_e3t, & 391 & dd_e3zps_min, dd_e3zps_rat, & 392 & dd_fill ) 329 & dd_gdepw, dd_e3t, & 330 & dd_e3zps_min, dd_e3zps_rat ) 393 331 IMPLICIT NONE 394 332 ! Argument … … 398 336 REAL(dp) , DIMENSION(:) , INTENT(IN ) :: dd_gdepw 399 337 REAL(dp) , DIMENSION(:) , INTENT(IN ) :: dd_e3t 400 REAL(dp) , INTENT(IN ) :: dd_e3zps_min 401 REAL(dp) , INTENT(IN ) :: dd_e3zps_rat 402 REAL(dp) , INTENT(IN ), OPTIONAL :: dd_fill 338 REAL(dp) :: dd_e3zps_min 339 REAL(dp) :: dd_e3zps_rat 403 340 404 341 ! local variable 405 342 REAL(dp) :: dl_zmax ! Maximum depth 406 !REAL(dp) :: dl_zmin ! Minimum depth343 REAL(dp) :: dl_zmin ! Minimum depth 407 344 REAL(dp) :: dl_zdepth ! Ajusted ocean depth to avoid too small e3t 408 REAL(dp) :: dl_fill409 345 410 346 INTEGER(i4) :: il_jpk … … 423 359 il_jpjglo=SIZE(id_mbathy(:,:),DIM=2) 424 360 425 dl_fill=0._dp426 IF( PRESENT(dd_fill) ) dl_fill=dd_fill427 428 361 ! Initialization of constant 429 dl_zmax = dd_gdepw(il_jpk) + dd_e3t(il_jpk) ! maximum depth (i.e. the last ocean level thickness <= 2*e3t_1d(jpkm1) ) 430 431 ! bounded value of bathy (min already set at the end of zgr_bat) 432 WHERE( dd_bathy(:,:) /= dl_fill ) 433 dd_bathy(:,:) = MIN( dl_zmax , dd_bathy(:,:) ) 434 END WHERE 362 dl_zmax = dd_gdepw(il_jpk) + dd_e3t(il_jpk) 363 dl_zmin = dd_gdepw(4) 435 364 436 365 ! bathymetry in level (from bathy_meter) … … 443 372 DO jj = 1, il_jpjglo 444 373 DO ji= 1, il_jpiglo 445 IF( dd_bathy(ji,jj) <= 0._dp )THEN 446 id_mbathy(ji,jj) = INT(dd_bathy(ji,jj),i4) 447 ELSEIF( dd_bathy(ji,jj) == dl_fill )THEN 448 id_mbathy(ji,jj) = 0_i4 374 IF( dd_bathy(ji,jj) <= 0. ) id_mbathy(ji,jj) = INT(dd_bathy(ji,jj),i4) 375 END DO 376 END DO 377 378 ! bounded value of bathy 379 ! minimum depth == 3 levels 380 ! maximum depth == gdepw(jpk)+e3t(jpk) 381 ! i.e. the last ocean level thickness cannot exceed e3t(jpkm1)+e3t(jpk) 382 DO jj = 1, il_jpjglo 383 DO ji= 1, il_jpiglo 384 IF( dd_bathy(ji,jj) <= 0. ) THEN 385 dd_bathy(ji,jj) = 0.e0 386 ELSE 387 dd_bathy(ji,jj) = MAX( dd_bathy(ji,jj), dl_zmin ) 388 dd_bathy(ji,jj) = MIN( dd_bathy(ji,jj), dl_zmax ) 449 389 ENDIF 450 390 END DO … … 461 401 DO jj = 1, il_jpjglo 462 402 DO ji = 1, il_jpiglo 463 IF( dd_bathy(ji,jj) /= dl_fill )THEN 464 IF( 0. < dd_bathy(ji,jj) .AND. & 465 & dd_bathy(ji,jj) <= dl_zdepth ) id_mbathy(ji,jj) = jk-1 466 ENDIF 403 IF( 0. < dd_bathy(ji,jj) .AND. dd_bathy(ji,jj) <= dl_zdepth ) id_mbathy(ji,jj) = jk-1 467 404 END DO 468 405 END DO … … 497 434 498 435 !> @author G.Madec 499 !> @date Marsh, 2008 -Original code436 !> - 03-08 Original code 500 437 ! 501 438 !> @param[in] id_mbathy … … 606 543 !> 607 544 !> @author J.Paul 608 !> @date November, 2013- Initial Version545 !> - November, 2013- Initial Version 609 546 ! 610 547 !> @param[in] td_bathy Bathymetry file structure … … 630 567 REAL(dp) , DIMENSION(:) , ALLOCATABLE :: dl_e3w 631 568 REAL(dp) , DIMENSION(:) , ALLOCATABLE :: dl_e3t 632 REAL(dp) , DIMENSION(:) , ALLOCATABLE :: dl_e3w_1d633 REAL(dp) , DIMENSION(:) , ALLOCATABLE :: dl_e3t_1d634 569 635 570 INTEGER(i4) :: il_status … … 775 710 ALLOCATE( dl_gdepw(in_nlevel), dl_gdept(in_nlevel) ) 776 711 ALLOCATE( dl_e3w(in_nlevel), dl_e3t(in_nlevel) ) 777 ALLOCATE( dl_e3w_1d(in_nlevel), dl_e3t_1d(in_nlevel) )778 712 CALL vgrid_zgr_z( dl_gdepw(:), dl_gdept(:), dl_e3w(:), dl_e3t(:), & 779 & dl_e3w_1d, dl_e3t_1d, &780 713 & dn_ppkth, dn_ppkth2, dn_ppacr, dn_ppacr2, & 781 714 & dn_ppdzmin, dn_pphmax, dn_pp_to_be_computed, & -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/templates/create_bathy.nam
r10248 r10251 19 19 20 20 &namvar 21 cn_varinfo= 21 22 cn_varfile= 22 cn_varinfo=23 23 / 24 24 -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/templates/create_boundary.nam
r10248 r10251 60 60 cn_west = 61 61 ln_oneseg= 62 in_extrap= 62 63 / 63 64 64 65 &namout 65 66 cn_fileout="boundary_out.nc" 66 dn_dayofs=67 ln_extrap=68 67 / -
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/templates/create_restart.nam
r10248 r10251 12 12 cn_coord0= 13 13 in_perio0= 14 /15 16 &namfin17 cn_coord1=18 cn_bathy1=19 in_perio1=20 14 / 21 15 … … 40 34 / 41 35 36 &namfin 37 cn_coord1= 38 cn_bathy1= 39 in_perio1= 40 in_extrap= 41 / 42 42 43 &namvar 43 44 cn_varinfo= … … 52 53 &namout 53 54 cn_fileout="restart_out.nc" 54 ln_extrap=55 in_nipro=56 in_njproc=57 in_nproc=58 cn_type=59 55 /
Note: See TracChangeset
for help on using the changeset viewer.