Changeset 5037 for trunk/NEMOGCM/TOOLS/SIREN/src/iom_cdf.f90
- Timestamp:
- 2015-01-16T14:31:19+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEMOGCM/TOOLS/SIREN/src/iom_cdf.f90
r4213 r5037 6 6 ! 7 7 ! DESCRIPTION: 8 !> @brief 9 !> This module is a library to read/write Netcdf file. 8 !> @brief NETCDF Input/Output manager : Library to read Netcdf input files 10 9 !> 11 10 !> @details 12 !>13 11 !> to open netcdf file:<br/> 12 !> @code 14 13 !> CALL iom_cdf_open(td_file) 15 !> - td_file is file structure (see file.f90) 14 !> @endcode 15 !> - td_file is file structure (see @ref file) 16 16 !> 17 17 !> to write in netcdf file:<br/> 18 !> @code 18 19 !> CALL iom_cdf_write_file(td_file) 20 !> @endcode 19 21 !> 20 22 !> to close netcdf file:<br/> 23 !> @code 21 24 !> CALL iom_cdf_close(tl_file) 25 !> @endcode 22 26 !> 23 27 !> to read one dimension in netcdf file:<br/> 24 !> tl_dim = iom_cdf_read_dim(tl_file, id_dimid)<br/> 25 !> or<br/> 28 !> @code 29 !> tl_dim = iom_cdf_read_dim(tl_file, id_dimid) 30 !> @endcode 31 !> or 32 !> @code 26 33 !> tl_dim = iom_cdf_read_dim(tl_file, cd_name) 34 !> @endcode 27 35 !> - id_dimid is dimension id<br/> 28 36 !> - cd_name is dimension name 29 37 !> 30 !> to read one global attribute in netcdf file:<br/> 31 !> tl_att = iom_cdf_read_att(tl_file, id_varid, id_attid)<br/> 32 !> or<br/> 38 !> to read one attribute in netcdf file:<br/> 39 !> @code 40 !> tl_att = iom_cdf_read_att(tl_file, id_varid, id_attid) 41 !> @endcode 42 !> or 43 !> @code 33 44 !> tl_att = iom_cdf_read_att(tl_file, id_varid, cd_name) 45 !> @endcode 34 46 !> - id_varid is variable id 35 47 !> - id_attid is attribute id<br/> … … 37 49 !> 38 50 !> to read one variable in netcdf file:<br/> 39 !> tl_var = iom_cdf_read_var(td_file, id_varid, [id_start, id_count])<br/> 40 !> or<br/> 41 !> tl_var = iom_cdf_read_var(td_file, cd_name, [id_start, [id_count,]] [cd_stdname]) 51 !> @code 52 !> tl_var = iom_cdf_read_var(td_file, id_varid, [id_start, id_count]) 53 !> @endcode 54 !> or 55 !> @code 56 !> tl_var = iom_cdf_read_var(td_file, cd_name, [id_start, [id_count,]]) 57 !> @endcode 42 58 !> - id_varid is variabale id 43 59 !> - cd_name is variabale name 44 !> - id_start is a integer(4) 1D table of index from which the data 45 !> values will be read (optional) 46 !> - id_count is a integer(4) 1D table of the number of indices selected 47 !> along each dimension (optional) 48 !> - cd_stdname is variable standard name (optional) 60 !> - id_start is a integer(4) 1D array of index from which the data 61 !> values will be read [optional] 62 !> - id_count is a integer(4) 1D array of the number of indices selected 63 !> along each dimension [optional] 49 64 !> 50 65 !> @author 51 66 !> J.Paul 52 67 ! REVISION HISTORY: 53 !> @date Nov, 2013 - Initial Version 54 ! 55 !> @param MyModule_type : brief_description 68 !> @date November, 2013 - Initial Version 56 69 ! 57 70 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 58 !59 !> @todo60 !> - inform variable pni, pnj, pnij, area, iglo, jglo61 !> - use var_init when read new variable62 !> - use dim_init when read new dimension63 !> - use att_init when read new attribute64 !> - add read td_dom65 !> @todo66 !> - voir si il ne faut pas redefinir (__copy) variable si elle vient de mpp67 !> exemple CALL mpp_move_var( td_mpp, td_mpp%t_var )68 71 !---------------------------------------------------------------------- 69 72 MODULE iom_cdf … … 72 75 USE kind ! F90 kind parameter 73 76 USE fct ! basic useful function 74 USE logger 77 USE logger ! log file manager 75 78 USE att ! attribute manage 76 79 USE dim ! dimension manager 77 80 USE var ! variable manager 78 81 USE file ! file manager 79 USE dom ! domain manager80 ! USE proc ! processor manager81 82 IMPLICIT NONE 82 PRIVATE83 83 ! NOTE_avoid_public_variables_if_possible 84 84 … … 91 91 PUBLIC :: iom_cdf_fill_var !< fill variable value in an opened netcdf file 92 92 PUBLIC :: iom_cdf_write_file !< write file structure contents in an opened netcdf file 93 ! PUBLIC :: iom_cdf_get_mpp ! get sub domain decomposition in a netcdf file 94 95 PRIVATE :: iom_cdf__check !< provides a simple interface to netcdf error message 96 PRIVATE :: iom_cdf__get_info !< get global information in an opened netcdf file 97 PRIVATE :: iom_cdf__get_file_dim !< read dimension on an opened netcdf file, and reorder it 98 PRIVATE :: iom_cdf__get_file_att !< read global attribute on an opened netcdf file 99 PRIVATE :: iom_cdf__get_file_var !< read information about variable on an opened netcdf file 100 PRIVATE :: iom_cdf__read_dim_id !< read one dimension in an opened netcdf file, given dimension id. 101 PRIVATE :: iom_cdf__read_dim_name !< read one dimension in an opened netcdf file, given dimension name. 102 PRIVATE :: iom_cdf__read_att_name !< read variable or global attribute in an opened netcdf file, given attribute name. 103 PRIVATE :: iom_cdf__read_att_id !< read variable or global attribute in an opened netcdf file, given attribute id. 104 PRIVATE :: iom_cdf__read_var_id !< read variable value in an opened netcdf file, given variable id. 105 PRIVATE :: iom_cdf__read_var_name !< read variable value in an opened netcdf file, given variable name or standard name. 106 PRIVATE :: iom_cdf__read_var_meta !< read metadata of a variable in an opened netcdf file. 107 PRIVATE :: iom_cdf__read_var_dim !< read variable dimension in an opened netcdf file. 108 PRIVATE :: iom_cdf__read_var_att !< read variable attributes in an opened netcdf file. 109 PRIVATE :: iom_cdf__read_var_value !< read variable value in an opened netcdf file. 110 PRIVATE :: iom_cdf__write_dim !< write one dimension in an opened netcdf file in write mode. 111 PRIVATE :: iom_cdf__write_att !< write a variable attribute in an opened netcdf file. 112 PRIVATE :: iom_cdf__write_var !< write a variable in an opened netcdf file. 113 PRIVATE :: iom_cdf__write_var_def !< define variable in an opened netcdf file. 114 PRIVATE :: iom_cdf__write_var_value !< put variable value in an opened netcdf file. 115 PRIVATE :: iom_cdf__fill_var_id !< fill variable value in an opened netcdf file, given variable id 116 PRIVATE :: iom_cdf__fill_var_name !< fill variable value in an opened netcdf file, given variable name 117 PRIVATE :: iom_cdf__fill_var_all !< fill all variable value in an opened netcdf file 118 PRIVATE :: iom_cdf__del_var_dim !< remove variable dimension from an opened netcdf file 93 94 PRIVATE :: iom_cdf__check ! provides a simple interface to netcdf error message 95 PRIVATE :: iom_cdf__get_info ! get global information in an opened netcdf file 96 PRIVATE :: iom_cdf__get_file_dim ! read dimension on an opened netcdf file, and reorder it 97 PRIVATE :: iom_cdf__get_file_att ! read global attribute on an opened netcdf file 98 PRIVATE :: iom_cdf__get_file_var ! read information about variable on an opened netcdf file 99 PRIVATE :: iom_cdf__read_dim_id ! read one dimension in an opened netcdf file, given dimension id. 100 PRIVATE :: iom_cdf__read_dim_name ! read one dimension in an opened netcdf file, given dimension name. 101 PRIVATE :: iom_cdf__read_att_name ! read variable or global attribute in an opened netcdf file, given attribute name. 102 PRIVATE :: iom_cdf__read_att_id ! read variable or global attribute in an opened netcdf file, given attribute id. 103 PRIVATE :: iom_cdf__read_var_id ! read variable value in an opened netcdf file, given variable id. 104 PRIVATE :: iom_cdf__read_var_name ! read variable value in an opened netcdf file, given variable name or standard name. 105 PRIVATE :: iom_cdf__read_var_meta ! read metadata of a variable in an opened netcdf file. 106 PRIVATE :: iom_cdf__read_var_dim ! read variable dimension in an opened netcdf file. 107 PRIVATE :: iom_cdf__read_var_att ! read variable attributes in an opened netcdf file. 108 PRIVATE :: iom_cdf__read_var_value ! read variable value in an opened netcdf file. 109 PRIVATE :: iom_cdf__write_dim ! write one dimension in an opened netcdf file in write mode. 110 PRIVATE :: iom_cdf__write_att ! write a variable attribute in an opened netcdf file. 111 PRIVATE :: iom_cdf__write_var ! write a variable in an opened netcdf file. 112 PRIVATE :: iom_cdf__write_var_def ! define variable in an opened netcdf file. 113 PRIVATE :: iom_cdf__write_var_value ! put variable value in an opened netcdf file. 114 PRIVATE :: iom_cdf__fill_var_id ! fill variable value in an opened netcdf file, given variable id 115 PRIVATE :: iom_cdf__fill_var_name ! fill variable value in an opened netcdf file, given variable name 116 PRIVATE :: iom_cdf__fill_var_all ! fill all variable value in an opened netcdf file 117 PRIVATE :: iom_cdf__del_coord_var ! remove coordinate variable from an opened netcdf file 119 118 120 119 INTERFACE iom_cdf_read_var … … 145 144 !> 146 145 !> @author J.Paul 147 !> - Nov, 2013- Initial Version 148 ! 149 !> @param[in] id_status : error status 150 !------------------------------------------------------------------- 151 !> @code 146 !> - November, 2013- Initial Version 147 ! 148 !> @param[in] id_status error status 149 !------------------------------------------------------------------- 152 150 SUBROUTINE iom_cdf__check(id_status) 153 151 IMPLICIT NONE … … 161 159 162 160 END SUBROUTINE iom_cdf__check 163 ! > @endcode164 ! -------------------------------------------------------------------165 !> @ brief This subroutine open a netcdf file in read or write mode<br/>161 !------------------------------------------------------------------- 162 !> @brief This subroutine open a netcdf file in read or write mode. 163 !> @details 166 164 !> if try to open a file in write mode that did not exist, create it.<br/> 167 !> if file already exist, get information about :165 !> if file already exist, get information about0:<br/> 168 166 !> - the number of variables 169 167 !> - the number of dimensions … … 171 169 !> - the ID of the unlimited dimension 172 170 !> - the file format 173 !> and finally read dimensions. 171 !> Finally it read dimensions, and 'longitude' variable to compute East-West 172 !> overlap. 174 173 !> 175 174 !> @author J.Paul 176 !> - Nov, 2013- Initial Version 177 ! 178 !> @param[inout] td_file : file structure 179 !------------------------------------------------------------------- 180 !> @code 175 !> - November, 2013- Initial Version 176 ! 177 !> @param[inout] td_file file structure 178 !------------------------------------------------------------------- 181 179 SUBROUTINE iom_cdf_open(td_file) 182 180 IMPLICIT NONE … … 189 187 190 188 INTEGER(i4) :: il_status 191 192 TYPE(TVAR) :: tl_lon193 ! loop indices194 INTEGER(i4) :: ji195 189 !---------------------------------------------------------------- 196 190 … … 202 196 IF( .NOT. td_file%l_wrt )THEN 203 197 204 CALL logger_fatal( " OPEN: can not open file "//&198 CALL logger_fatal( " IOM CDF OPEN: can not open file "//& 205 199 & TRIM(td_file%c_name) ) 206 td_file%i_id=-1 207 200 208 201 ELSE 209 202 210 CALL logger_info( " CREATE: file "//TRIM(td_file%c_name) )203 CALL logger_info( " IOM CDF CREATE: file "//TRIM(td_file%c_name) ) 211 204 212 205 il_status = NF90_CREATE( TRIM(td_file%c_name),& … … 220 213 221 214 ELSE 222 223 215 IF( td_file%i_id /= 0 )THEN 224 216 225 CALL logger_error( " OPEN: file "//&217 CALL logger_error( " IOM CDF OPEN: file "//& 226 218 & TRIM(td_file%c_name)//" already opened") 227 219 228 220 ELSE 229 221 230 222 IF( .NOT. td_file%l_wrt )THEN 231 223 232 CALL logger_info( " OPEN: file "//&224 CALL logger_info( " IOM CDF OPEN: file "//& 233 225 & TRIM(td_file%c_name)//" in read only mode" ) 234 226 235 227 il_status = NF90_OPEN( TRIM(td_file%c_name), & 236 & NF90_NOWRITE, 228 & NF90_NOWRITE, & 237 229 & td_file%i_id) 238 230 CALL iom_cdf__check(il_status) 239 231 240 CALL logger_ debug("OPEN "//TRIM(td_file%c_name)//" "//TRIM(fct_str(td_file%i_id)))232 CALL logger_trace("IOM CDF OPEN "//TRIM(td_file%c_name)//" "//TRIM(fct_str(td_file%i_id))) 241 233 ELSE 242 234 243 CALL logger_info( " OPEN: file "//&235 CALL logger_info( "IOM CDF OPEN: file "//& 244 236 & TRIM(td_file%c_name)//" in write mode" ) 245 237 … … 263 255 CALL iom_cdf__get_file_var(td_file) 264 256 265 ! get ew overlap266 tl_lon=iom_cdf_read_var(td_file,'longitude')267 td_file%i_ew=dom_get_ew_overlap(tl_lon)268 CALL logger_debug(" IOM OPEN EW "//TRIM(fct_str(td_file%i_ew)) )269 WHERE( td_file%t_var(:)%t_dim(1)%l_use )270 td_file%t_var(:)%i_ew=td_file%i_ew271 END WHERE272 CALL var_clean(tl_lon)273 274 DO ji=1,td_file%i_nvar275 CALL logger_debug(TRIM(td_file%t_var(ji)%c_name)//": "//TRIM(fct_str(td_file%t_var(ji)%i_ew)) )276 ENDDO277 278 257 ! remove dimension variable from list of variable 279 CALL iom_cdf__del_ var_dim(td_file)258 CALL iom_cdf__del_coord_var(td_file) 280 259 281 260 ENDIF … … 284 263 285 264 END SUBROUTINE iom_cdf_open 286 !> @endcode 287 !------------------------------------------------------------------- 288 !> @brief This subroutine close netcdf file 265 !------------------------------------------------------------------- 266 !> @brief This subroutine close netcdf file. 289 267 !> 290 268 !> @author J.Paul 291 !> - Nov, 2013- Initial Version 292 ! 293 !> @param[inout] td_file : file structure 294 !------------------------------------------------------------------- 295 !> @code 269 !> - November, 2013- Initial Version 270 ! 271 !> @param[inout] td_file file structure 272 !------------------------------------------------------------------- 296 273 SUBROUTINE iom_cdf_close(td_file) 297 274 IMPLICIT NONE … … 307 284 308 285 CALL logger_error( & 309 & " CLOSE: no id associated to file "//TRIM(td_file%c_name))286 & " IOM CDF CLOSE: no id associated to file "//TRIM(td_file%c_name)) 310 287 311 288 ELSE 312 289 CALL logger_info( & 313 & " CLOSE: file "//TRIM(td_file%c_name))290 & " IOM CDF CLOSE: file "//TRIM(td_file%c_name)) 314 291 315 292 il_status = NF90_CLOSE(td_file%i_id) … … 321 298 322 299 END SUBROUTINE iom_cdf_close 323 !> @endcode324 300 !------------------------------------------------------------------- 325 301 !> @brief This subroutine get global information in an opened netcdf 326 !> file. <br/>302 !> file. 327 303 !> @details 328 304 !> It gets the number of variables, the number of dimensions, … … 331 307 !> 332 308 !> @author J.Paul 333 !> - Nov, 2013- Initial Version 334 ! 335 !> @param[inout] td_file : file structure 336 !> @return file structure completed 337 !------------------------------------------------------------------- 338 !> @code 309 !> - November, 2013- Initial Version 310 ! 311 !> @param[inout] td_file file structure 312 !------------------------------------------------------------------- 339 313 SUBROUTINE iom_cdf__get_info(td_file) 340 314 IMPLICIT NONE … … 348 322 349 323 CALL logger_trace( & 350 & " GET INFO: about netcdf file "//TRIM(td_file%c_name))324 & " IOM CDF GET INFO: about netcdf file "//TRIM(td_file%c_name)) 351 325 352 326 il_status=NF90_INQUIRE(td_file%i_id, td_file%i_ndim, & … … 365 339 366 340 END SUBROUTINE iom_cdf__get_info 367 !> @endcode368 341 !------------------------------------------------------------------- 369 342 !> @brief This subroutine read dimension on an opened netcdf file, and 370 !> reorder dimension to ('x', 'y', 'z', 't'). <br/>343 !> reorder dimension to ('x', 'y', 'z', 't'). 371 344 !> The dimension structure inside file structure is then completed. 372 345 ! 373 346 !> @author J.Paul 374 !> - Nov, 2013- Initial Version 375 ! 376 !> @param[inout] td_file : file structure 377 !> @return file structure completed 378 !------------------------------------------------------------------- 379 !> @code 347 !> - November, 2013- Initial Version 348 ! 349 !> @param[inout] td_file file structure 350 !------------------------------------------------------------------- 380 351 SUBROUTINE iom_cdf__get_file_dim(td_file) 381 352 IMPLICIT NONE … … 401 372 IF( td_file%i_uldid == -1 )THEN 402 373 CALL logger_warn( & 403 & " GET FILE DIM: there is no unlimited dimension in file "//&374 & " IOM CDF GET FILE DIM: there is no unlimited dimension in file "//& 404 375 & TRIM(td_file%c_name)) 405 376 ELSE … … 410 381 411 382 CALL logger_warn( & 412 & " GET FILE DIM: there is no dimension in file "//&383 & " IOM CDF GET FILE DIM: there is no dimension in file "//& 413 384 & TRIM(td_file%c_name)) 414 385 … … 419 390 420 391 END SUBROUTINE iom_cdf__get_file_dim 421 !> @endcode422 392 !------------------------------------------------------------------- 423 393 !> @brief This subroutine read global attribute on an opened netcdf 424 !> file. <br/>394 !> file. 425 395 !> The attribute structure inside file structure is then completed. 426 396 ! 427 397 !> @author J.Paul 428 !> - Nov , 2013- Initial Version429 ! 430 !> @param[inout] td_file : file structure431 ! > @return file structure completed432 ! -------------------------------------------------------------------433 ! > @code398 !> - November, 2013- Initial Version 399 !> @date September, 2014 400 !> - use attribute periodicity read from the file if present. 401 ! 402 !> @param[inout] td_file file structure 403 !------------------------------------------------------------------- 434 404 SUBROUTINE iom_cdf__get_file_att(td_file) 435 405 IMPLICIT NONE … … 437 407 TYPE(TFILE), INTENT(INOUT) :: td_file 438 408 409 ! local variable 439 410 ! loop indices 440 411 INTEGER(i4) :: ji … … 443 414 IF( td_file%i_natt > 0 )THEN 444 415 IF(ASSOCIATED(td_file%t_att))THEN 416 CALL att_clean(td_file%t_att(:)) 445 417 DEALLOCATE(td_file%t_att) 446 418 ENDIF … … 451 423 td_file%t_att(ji)=iom_cdf_read_att( td_file, NF90_GLOBAL, ji) 452 424 453 SELECT CASE(TRIM(td_file%t_att(ji)%c_name))454 CASE('periodicity')455 td_file%i_perio=INT(td_file%t_att(ji)%d_value(1),i4)456 CASE('pivot_point')457 td_file%i_pivot=INT(td_file%t_att(ji)%d_value(1),i4)458 CASE('ew_overlap')459 td_file%i_ew=INT(td_file%t_att(ji)%d_value(1),i4)460 END SELECT461 462 425 ENDDO 463 426 464 427 ELSE 465 428 CALL logger_debug( & 466 & " GET FILE ATT: there is no global attribute in file "//&429 & " IOM CDF GET FILE ATT: there is no global attribute in file "//& 467 430 & TRIM(td_file%c_name)) 468 431 ENDIF 469 432 470 433 END SUBROUTINE iom_cdf__get_file_att 471 !> @endcode472 434 !------------------------------------------------------------------- 473 435 !> @brief This subroutine read information about variable of an 474 !> opened netcdf file. <br/>436 !> opened netcdf file. 475 437 !> The variable structure inside file structure is then completed. 476 438 !> @note variable value are not read ! 477 439 ! 478 440 !> @author J.Paul 479 !> - Nov, 2013- Initial Version 480 ! 481 !> @param[inout] td_file : file structure 482 !> @return file structure completed 483 !------------------------------------------------------------------- 484 !> @code 441 !> - November, 2013- Initial Version 442 ! 443 !> @param[inout] td_file file structure 444 !------------------------------------------------------------------- 485 445 SUBROUTINE iom_cdf__get_file_var(td_file) 486 446 IMPLICIT NONE … … 497 457 IF( td_file%i_nvar > 0 )THEN 498 458 IF(ASSOCIATED(td_file%t_var))THEN 459 CALL var_clean(td_file%t_var(:)) 499 460 DEALLOCATE(td_file%t_var) 500 461 ENDIF … … 504 465 ! read dimension information 505 466 td_file%t_var(ji)=iom_cdf__read_var_meta( td_file, ji) 506 507 467 SELECT CASE(td_file%t_var(ji)%i_ndim) 508 468 CASE(0) … … 524 484 td_file%i_depthid=ji 525 485 ELSE 526 CALL logger_error("IOM OPEN: find more than one "//& 527 & "depth variable in file "//& 528 & TRIM(td_file%c_name) ) 486 IF( td_file%i_depthid /= ji )THEN 487 CALL logger_error("IOM CDF GET FILE VAR: find more than one "//& 488 & "depth variable in file "//& 489 & TRIM(td_file%c_name) ) 490 ENDIF 529 491 ENDIF 530 492 ENDIF … … 554 516 ELSE 555 517 CALL logger_debug( & 556 & " GET FILE VAR: there is no variable in file "//&518 & " IOM CDF GET FILE VAR: there is no variable in file "//& 557 519 & TRIM(td_file%c_name)) 558 520 ENDIF 559 521 560 522 END SUBROUTINE iom_cdf__get_file_var 561 !> @endcode 562 !------------------------------------------------------------------- 563 !> @brief This subroutine delete variable dimension from an 564 !> opened netcdf file.<br/> 565 ! 566 !> @author J.Paul 567 !> - 2013- Initial Version 568 ! 569 !> @param[inout] td_file : file structure 570 !------------------------------------------------------------------- 571 !> @code 572 SUBROUTINE iom_cdf__del_var_dim(td_file) 523 !------------------------------------------------------------------- 524 !> @brief This subroutine delete coordinate variable from an 525 !> opened netcdf file if present. 526 ! 527 !> @author J.Paul 528 !> - November, 2013- Initial Version 529 ! 530 !> @param[inout] td_file file structure 531 !------------------------------------------------------------------- 532 SUBROUTINE iom_cdf__del_coord_var(td_file) 573 533 IMPLICIT NONE 574 534 ! Argument … … 598 558 ELSE 599 559 CALL logger_debug( & 600 & " DEL VAR DIM: there is no variable in file "//&560 & " IOM CDF DEL VAR DIM: there is no variable in file "//& 601 561 & TRIM(td_file%c_name)) 602 562 ENDIF 603 END SUBROUTINE iom_cdf__del_var_dim 604 !> @endcode 605 ! !------------------------------------------------------------------- 606 ! !> @brief This subroutine get variable time from an 607 ! !> opened netcdf file.<br/> 608 ! ! 609 ! !> @author J.Paul 610 ! !> - 2013- Initial Version 611 ! ! 612 ! !> @param[inout] td_file : file structure 613 ! !------------------------------------------------------------------- 614 ! !> @code 615 ! SUBROUTINE iom_cdf__get_var_time(td_file) 616 ! IMPLICIT NONE 617 ! ! Argument 618 ! TYPE(TFILE), INTENT(INOUT) :: td_file 619 ! 620 ! ! local variable 621 ! CHARACTER(LEN=lc) :: cl_name 622 ! 623 ! ! loop indices 624 ! INTEGER(i4) :: ji 625 ! !---------------------------------------------------------------- 626 ! IF( td_file%i_nvar > 0 )THEN 627 ! DO ji=1,td_file%i_nvar 628 ! cl_name=TRIM(td_file%t_var(ji)%c_name) 629 ! IF( INDEX(cl_name,'time') /= 0 )THEN 630 ! ! read time variable 631 ! td_file%t_time=iom_cdf_read_var(td_file,ji) 632 ! ! remove time variable from variable list 633 ! CALL file_del_ver(td_file,TRIM(cl_name)) 634 ! EXIT 635 ! ENDIF 636 ! ENDDO 637 ! ELSE 638 ! CALL logger_debug( & 639 ! & " GET VAR TIME: there is no variable in file "//& 640 ! & TRIM(td_file%c_name)) 641 ! ENDIF 642 ! END SUBROUTINE iom_cdf__get_var_time 643 ! !> @endcode 644 ! !------------------------------------------------------------------- 645 ! !> @brief This subroutine get variable depth from an 646 ! !> opened netcdf file.<br/> 647 ! ! 648 ! !> @author J.Paul 649 ! !> - 2013- Initial Version 650 ! ! 651 ! !> @param[inout] td_file : file structure 652 ! !------------------------------------------------------------------- 653 ! !> @code 654 ! SUBROUTINE iom_cdf__get_var_depth(td_file) 655 ! IMPLICIT NONE 656 ! ! Argument 657 ! TYPE(TFILE), INTENT(INOUT) :: td_file 658 ! 659 ! ! local variable 660 ! CHARACTER(LEN=lc) :: cl_name 661 ! 662 ! ! loop indices 663 ! INTEGER(i4) :: ji 664 ! !---------------------------------------------------------------- 665 ! IF( td_file%i_nvar > 0 )THEN 666 ! DO ji=1,td_file%i_nvar 667 ! cl_name=TRIM(td_file%t_var(ji)%c_name) 668 ! IF( INDEX(cl_name,'depth') /= 0 )THEN 669 ! ! read depth variable 670 ! td_file%t_depth=iom_cdf_read_var(td_file,ji) 671 ! ! remove depth variable from variable list 672 ! CALL file_del_ver(td_file,TRIM(cl_name)) 673 ! EXIT 674 ! ENDIF 675 ! ENDDO 676 ! ELSE 677 ! CALL logger_debug( & 678 ! & " GET VAR TIME: there is no variable in file "//& 679 ! & TRIM(td_file%c_name)) 680 ! ENDIF 681 ! END SUBROUTINE iom_cdf__get_var_depth 682 ! !> @endcode 563 END SUBROUTINE iom_cdf__del_coord_var 683 564 !------------------------------------------------------------------- 684 565 !> @brief This function read one dimension in an opened netcdf file, … … 686 567 ! 687 568 !> @author J.Paul 688 !> - Nov , 2013- Initial Version689 ! 690 !> @param[in] td_file :file structure691 !> @param[in] id_dimid :dimension id569 !> - November, 2013- Initial Version 570 ! 571 !> @param[in] td_file file structure 572 !> @param[in] id_dimid dimension id 692 573 !> @return dimension structure 693 574 !------------------------------------------------------------------- 694 !> @code695 575 TYPE(TDIM) FUNCTION iom_cdf__read_dim_id(td_file, id_dimid) 696 576 IMPLICIT NONE … … 709 589 710 590 CALL logger_error( & 711 & " READ DIM: no id associated to file "//TRIM(td_file%c_name))591 & " IOM CDF READ DIM: no id associated to file "//TRIM(td_file%c_name)) 712 592 713 593 ELSE … … 715 595 iom_cdf__read_dim_id%i_id=id_dimid 716 596 717 CALL logger_ debug( &718 & " READ DIM: dimension "//TRIM(fct_str(id_dimid))//&597 CALL logger_trace( & 598 & " IOM CDF READ DIM: dimension "//TRIM(fct_str(id_dimid))//& 719 599 & " in file "//TRIM(td_file%c_name)) 720 600 … … 728 608 729 609 END FUNCTION iom_cdf__read_dim_id 730 !> @endcode731 610 !------------------------------------------------------------------- 732 611 !> @brief This function read one dimension in an opened netcdf file, … … 734 613 ! 735 614 !> @author J.Paul 736 !> - Nov , 2013- Initial Version737 ! 738 !> @param[in] td_file :file structure739 !> @param[in] cd_name :dimension name615 !> - November, 2013- Initial Version 616 ! 617 !> @param[in] td_file file structure 618 !> @param[in] cd_name dimension name 740 619 !> @return dimension structure 741 620 !------------------------------------------------------------------- 742 !> @code743 621 TYPE(TDIM) FUNCTION iom_cdf__read_dim_name(td_file, cd_name) 744 622 IMPLICIT NONE … … 756 634 757 635 CALL logger_error( & 758 & " READ DIM: no id associated to file "//TRIM(td_file%c_name))636 & " IOM CDF READ DIM: no id associated to file "//TRIM(td_file%c_name)) 759 637 760 638 ELSE … … 769 647 770 648 END FUNCTION iom_cdf__read_dim_name 771 !> @endcode772 649 !------------------------------------------------------------------- 773 650 !> @brief This function read variable or global attribute in an opened … … 775 652 ! 776 653 !> @author J.Paul 777 !> - Nov , 2013- Initial Version778 ! 779 !> @param[in] td_file :file structure780 !> @param[in] id_varid :variable id. use NF90_GLOBAL to read global654 !> - November, 2013- Initial Version 655 ! 656 !> @param[in] td_file file structure 657 !> @param[in] id_varid variable id. use NF90_GLOBAL to read global 781 658 !> attribute in a file 782 !> @param[in] cd_name :attribute name659 !> @param[in] cd_name attribute name 783 660 !> @return attribute structure 784 661 !------------------------------------------------------------------- 785 !> @code786 662 TYPE(TATT) FUNCTION iom_cdf__read_att_name(td_file, id_varid, cd_name) 787 663 IMPLICIT NONE … … 800 676 801 677 CHARACTER(LEN=lc) :: cl_value 678 802 679 INTEGER(i1), DIMENSION(:), ALLOCATABLE :: bl_value 803 680 INTEGER(i2), DIMENSION(:), ALLOCATABLE :: sl_value … … 810 687 811 688 CALL logger_error( & 812 & " READ ATT: no id associated to file "//TRIM(td_file%c_name))689 & " IOM CDF READ ATT: no id associated to file "//TRIM(td_file%c_name)) 813 690 814 691 ELSE … … 819 696 IF( id_varid == NF90_GLOBAL )THEN 820 697 821 CALL logger_ debug( &822 & " READ ATT: inquire global attribute "//&698 CALL logger_trace( & 699 & " IOM CDF READ ATT: inquire global attribute "//& 823 700 & " in file "//TRIM(td_file%c_name)) 824 701 825 702 ELSE 826 703 827 CALL logger_ debug( &828 & " READ ATT: inquire attribute "//&704 CALL logger_trace( & 705 & " IOM CDF READ ATT: inquire attribute "//& 829 706 & " of variable "//TRIM(fct_str(id_varid))//& 830 707 & " in file "//TRIM(td_file%c_name)) … … 840 717 841 718 !! get attribute value 842 CALL logger_debug( " READ ATT: get attribute "//TRIM(cl_name)//&719 CALL logger_debug( " IOM CDF READ ATT: get attribute "//TRIM(cl_name)//& 843 720 & " in file "//TRIM(td_file%c_name)) 844 721 … … 851 728 852 729 CALL logger_error( & 853 & " READ ATT: not enough space to put attribute "//&730 & " IOM CDF READ ATT: not enough space to put attribute "//& 854 731 & TRIM(cl_name) ) 855 732 … … 872 749 IF(il_status /= 0 )THEN 873 750 874 CALL logger_error( & 875 & " READ ATT: not enough space to put attribute "//& 876 & TRIM(cl_name) ) 751 CALL logger_error( "IOM CDF READ ATT: "//& 752 & "not enough space to put attribute "//TRIM(cl_name) ) 877 753 878 754 ELSE … … 897 773 898 774 CALL logger_error( & 899 & " READ ATT: not enough space to put attribute "//&775 & " IOM CDF READ ATT: not enough space to put attribute "//& 900 776 & TRIM(cl_name) ) 901 777 … … 921 797 922 798 CALL logger_error( & 923 & " READ ATT: not enough space to put attribute "//&799 & " IOM CDF READ ATT: not enough space to put attribute "//& 924 800 & TRIM(cl_name) ) 925 801 … … 944 820 945 821 CALL logger_error( & 946 & " READ ATT: not enough space to put attribute "//&822 & " IOM CDF READ ATT: not enough space to put attribute "//& 947 823 & TRIM(cl_name) ) 948 824 … … 968 844 969 845 CALL logger_error( & 970 & " READ ATT: not enough space to put attribute "//&846 & " IOM CDF READ ATT: not enough space to put attribute "//& 971 847 & TRIM(cl_name) ) 972 848 … … 992 868 993 869 END FUNCTION iom_cdf__read_att_name 994 !> @endcode995 870 !------------------------------------------------------------------- 996 871 !> @brief This function read variable or global attribute in an opened … … 998 873 ! 999 874 !> @author J.Paul 1000 !> - Nov , 2013- Initial Version1001 ! 1002 !> @param[in] td_file :file structure1003 !> @param[in] id_varid :variable id. use NF90_GLOBAL to read global875 !> - November, 2013- Initial Version 876 ! 877 !> @param[in] td_file file structure 878 !> @param[in] id_varid variable id. use NF90_GLOBAL to read global 1004 879 !> attribute in a file 1005 !> @param[in] id_attid :attribute id880 !> @param[in] id_attid attribute id 1006 881 !> @return attribute structure 1007 882 !------------------------------------------------------------------- 1008 !> @code1009 883 TYPE(TATT) FUNCTION iom_cdf__read_att_id(td_file, id_varid, id_attid) 1010 884 IMPLICIT NONE … … 1022 896 1023 897 CALL logger_error( & 1024 & " READ ATT: no id associated to file "//TRIM(td_file%c_name))1025 1026 ELSE 898 & "IOM CDF READ ATT: no id associated to file "//TRIM(td_file%c_name)) 899 900 ELSE 1027 901 1028 902 ! get attribute name … … 1036 910 1037 911 END FUNCTION iom_cdf__read_att_id 1038 !> @endcode1039 912 !------------------------------------------------------------------- 1040 913 !> @brief This function read variable value in an opened 1041 !> netcdf file, given variable id.</br/> 1042 !> start indices and number of indices selected along each dimension 1043 !> could be specify in a 4 dimension table (/'x','y','z','t'/) 1044 ! 1045 !> @author J.Paul 1046 !> - Nov, 2013- Initial Version 1047 ! 1048 !> @param[in] td_file : file structure 1049 !> @param[in] id_varid : variable id 1050 !> @param[in] id_start : index in the variable from which the data values 914 !> netcdf file, given variable id. 915 !> @details 916 !> Optionaly, start indices and number of indices selected along each dimension 917 !> could be specify in a 4 dimension array (/'x','y','z','t'/) 918 ! 919 !> @author J.Paul 920 !> - November, 2013- Initial Version 921 ! 922 !> @param[in] td_file file structure 923 !> @param[in] id_varid variable id 924 !> @param[in] id_start index in the variable from which the data values 1051 925 !> will be read 1052 !> @param[in] id_count :number of indices selected along each dimension926 !> @param[in] id_count number of indices selected along each dimension 1053 927 !> @return variable structure 1054 928 !------------------------------------------------------------------- 1055 !> @code1056 929 TYPE(TVAR) FUNCTION iom_cdf__read_var_id(td_file, id_varid,& 1057 930 & id_start, id_count) … … 1070 943 1071 944 CALL logger_error( & 1072 & " IOM READ VAR: no id associated to file "//TRIM(td_file%c_name))945 & " IOM CDF READ VAR: no id associated to file "//TRIM(td_file%c_name)) 1073 946 1074 947 ELSE 1075 948 1076 ! look for variable i d949 ! look for variable index 1077 950 il_ind(:)=MINLOC(td_file%t_var(:)%i_id,mask=(td_file%t_var(:)%i_id==id_varid)) 1078 951 IF( il_ind(1) /= 0 )THEN 1079 952 1080 iom_cdf__read_var_id=td_file%t_var(il_ind(1)) 1081 1082 print *,"iom_cdf__read_var_id ",trim(iom_cdf__read_var_id%c_name)," ",iom_cdf__read_var_id%i_ew 953 iom_cdf__read_var_id=var_copy(td_file%t_var(il_ind(1))) 954 1083 955 !!! read variable value 1084 956 CALL iom_cdf__read_var_value(td_file, iom_cdf__read_var_id, & … … 1086 958 1087 959 ELSE 1088 print *,"iom_cdf__read_var_id "1089 960 CALL logger_error( & 1090 & " IOM READ VAR: there is no variable with id "//&961 & " IOM CDF READ VAR: there is no variable with id "//& 1091 962 & TRIM(fct_str(id_varid))//" in file "//TRIM(td_file%c_name)) 1092 963 ENDIF … … 1094 965 ENDIF 1095 966 END FUNCTION iom_cdf__read_var_id 1096 !> @endcode1097 967 !------------------------------------------------------------------- 1098 968 !> @brief This function read variable value in an opened 1099 !> netcdf file, given variable name or standard name.</br/> 1100 !> start indices and number of indices selected along each dimension 1101 !> could be specify in a 4 dimension table (/'x','y','z','t'/) 1102 ! 969 !> netcdf file, given variable name or standard name. 1103 970 !> @details 971 !> Optionaly, start indices and number of indices selected along each dimension 972 !> could be specify in a 4 dimension array (/'x','y','z','t'/) 973 !> 1104 974 !> look first for variable name. If it doesn't 1105 975 !> exist in file, look for variable standard name.<br/> 1106 !> If variable name is not present, check variable standard name.<br/> 1107 ! 1108 !> @author J.Paul 1109 !> - Nov, 2013- Initial Version 1110 ! 1111 !> @param[in] td_file : file structure 1112 !> @param[in] cd_name : variable name 1113 !> @param[in] id_start : index in the variable from which the data values will be read 1114 !> @param[in] id_count : number of indices selected along each dimension 1115 !> @param[in] cd_stdname : variable standard name 976 ! 977 !> @author J.Paul 978 !> - November, 2013- Initial Version 979 ! 980 !> @param[in] td_file file structure 981 !> @param[in] cd_name variable name or standard name. 982 !> @param[in] id_start index in the variable from which the data values will be read 983 !> @param[in] id_count number of indices selected along each dimension 1116 984 !> @return variable structure 1117 985 !------------------------------------------------------------------- 1118 !> @code1119 986 TYPE(TVAR) FUNCTION iom_cdf__read_var_name(td_file, cd_name, & 1120 987 & id_start, id_count ) … … 1127 994 1128 995 ! local variable 1129 INTEGER(i4) :: il_ ind996 INTEGER(i4) :: il_varid 1130 997 !---------------------------------------------------------------- 1131 998 ! check if file opened … … 1133 1000 1134 1001 CALL logger_error( & 1135 & " IOM READ VAR: no id associated to file "//TRIM(td_file%c_name))1002 & " IOM CDF READ VAR: no id associated to file "//TRIM(td_file%c_name)) 1136 1003 1137 1004 ELSE … … 1140 1007 1141 1008 CALL logger_error( & 1142 & " IOM READ VAR: you must specify a variable to read "//&1009 & " IOM CDF READ VAR: you must specify a variable to read "//& 1143 1010 & " in file "//TRIM(td_file%c_name)) 1144 1011 1145 1012 ELSE 1146 1013 1147 il_ ind=var_get_id(td_file%t_var(:), cd_name)1148 IF( il_ ind /= 0 )THEN1149 1150 iom_cdf__read_var_name= td_file%t_var(il_ind)1014 il_varid=var_get_index(td_file%t_var(:), cd_name) 1015 IF( il_varid /= 0 )THEN 1016 1017 iom_cdf__read_var_name=var_copy(td_file%t_var(il_varid)) 1151 1018 1152 1019 !!! read variable value … … 1158 1025 1159 1026 CALL logger_error( & 1160 & " IOM READ VAR: there is no variable with "//&1027 & " IOM CDF READ VAR: there is no variable with "//& 1161 1028 & " name or standard name "//TRIM(cd_name)//& 1162 1029 & " in file "//TRIM(td_file%c_name) ) … … 1168 1035 1169 1036 END FUNCTION iom_cdf__read_var_name 1170 !> @endcode 1171 !------------------------------------------------------------------- 1172 !> @brief This subroutine fill variable value in an opened 1173 !> netcdf file, given variable id.</br/> 1174 !> start indices and number of indices selected along each dimension 1175 !> could be specify in a 4 dimension table (/'x','y','z','t'/) 1176 ! 1177 !> @note ne peut pas marcher qd on fait boucle sur les variable d'un 1178 !> fichier. puisque change id. 1179 1180 !> @author J.Paul 1181 !> - Nov, 2013- Initial Version 1182 ! 1183 !> @param[inout] td_file : file structure 1184 !> @param[in] id_start : index in the variable from which the data values 1037 !------------------------------------------------------------------- 1038 !> @brief This subroutine fill all variable value from an opened 1039 !> netcdf file. 1040 !> @details 1041 !> Optionaly, start indices and number of indices selected along each dimension 1042 !> could be specify in a 4 dimension array (/'x','y','z','t'/) 1043 ! 1044 !> @author J.Paul 1045 !> - November, 2013- Initial Version 1046 ! 1047 !> @param[inout] td_file file structure 1048 !> @param[in] id_start index in the variable from which the data values 1185 1049 !> will be read 1186 !> @param[in] id_count : number of indices selected along each dimension 1187 !------------------------------------------------------------------- 1188 !> @code 1050 !> @param[in] id_count number of indices selected along each dimension 1051 !------------------------------------------------------------------- 1189 1052 SUBROUTINE iom_cdf__fill_var_all(td_file, id_start, id_count) 1190 1053 IMPLICIT NONE … … 1203 1066 1204 1067 CALL logger_error( & 1205 & " FILL VAR: no id associated to file "//TRIM(td_file%c_name))1068 & " IOM CDF FILL VAR: no id associated to file "//TRIM(td_file%c_name)) 1206 1069 1207 1070 ELSE 1208 1071 1209 1072 DO ji=1,td_file%i_nvar 1210 CALL iom_cdf_fill_var(td_file, ji, id_start, id_count) 1073 CALL iom_cdf_fill_var(td_file, td_file%t_var(ji)%i_id, & 1074 & id_start, id_count) 1211 1075 ENDDO 1212 1076 1213 1077 ENDIF 1214 1078 END SUBROUTINE iom_cdf__fill_var_all 1215 !> @endcode1216 1079 !------------------------------------------------------------------- 1217 1080 !> @brief This subroutine fill variable value in an opened 1218 !> netcdf file, given variable id.</br/> 1219 !> start indices and number of indices selected along each dimension 1220 !> could be specify in a 4 dimension table (/'x','y','z','t'/) 1221 ! 1222 !> @note ne peut pas marcher qd on fait boucle sur les variable d'un 1223 !> fichier. puisque change id. 1224 1225 !> @author J.Paul 1226 !> - Nov, 2013- Initial Version 1227 ! 1228 !> @param[inout] td_file : file structure 1229 !> @param[in] id_varid : variable id 1230 !> @param[in] id_start : index in the variable from which the data values 1081 !> netcdf file, given variable id. 1082 !> @details 1083 !> Optionaly, start indices and number of indices selected along each dimension 1084 !> could be specify in a 4 dimension array (/'x','y','z','t'/) 1085 ! 1086 !> @author J.Paul 1087 !> - November, 2013- Initial Version 1088 ! 1089 !> @param[inout] td_file file structure 1090 !> @param[in] id_varid variable id 1091 !> @param[in] id_start index in the variable from which the data values 1231 1092 !> will be read 1232 !> @param[in] id_count : number of indices selected along each dimension 1233 !------------------------------------------------------------------- 1234 !> @code 1093 !> @param[in] id_count number of indices selected along each dimension 1094 !------------------------------------------------------------------- 1235 1095 SUBROUTINE iom_cdf__fill_var_id(td_file, id_varid, id_start, id_count) 1236 1096 IMPLICIT NONE … … 1242 1102 1243 1103 ! local variable 1244 INTEGER(i4), DIMENSION(1) :: il_ ind1104 INTEGER(i4), DIMENSION(1) :: il_varid 1245 1105 1246 1106 ! loop indices … … 1251 1111 1252 1112 CALL logger_error( & 1253 & " FILL VAR: no id associated to file "//TRIM(td_file%c_name))1113 & "IOM CDF FILL VAR: no id associated to file "//TRIM(td_file%c_name)) 1254 1114 1255 1115 ELSE 1256 1116 1257 1117 ! look for variable id 1258 il_ ind(:)=MINLOC( td_file%t_var(:)%i_id, &1118 il_varid(:)=MINLOC( td_file%t_var(:)%i_id, & 1259 1119 & mask=(td_file%t_var(:)%i_id==id_varid)) 1260 IF( il_ ind(1) /= 0 )THEN1120 IF( il_varid(1) /= 0 )THEN 1261 1121 1262 1122 !!! read variable value 1263 CALL iom_cdf__read_var_value(td_file, td_file%t_var(il_ ind(1)), &1123 CALL iom_cdf__read_var_value(td_file, td_file%t_var(il_varid(1)), & 1264 1124 & id_start, id_count) 1265 1125 1266 1126 DO ji=1,td_file%i_nvar 1267 CALL logger_debug(" var id "//TRIM(td_file%t_var(ji)%c_name)//" "//TRIM(fct_str(td_file%t_var(ji)%i_id)) ) 1127 CALL logger_debug(" IOM CDF FILL VAR: var id "//& 1128 & TRIM(td_file%t_var(ji)%c_name)//" "//& 1129 & TRIM(fct_str(td_file%t_var(ji)%i_id)) ) 1268 1130 ENDDO 1269 1131 ELSE 1270 1132 CALL logger_error( & 1271 & " FILL VAR: there is no variable with id "//&1133 & " IOM CDF FILL VAR: there is no variable with id "//& 1272 1134 & TRIM(fct_str(id_varid))//" in file "//TRIM(td_file%c_name)) 1273 1135 ENDIF … … 1275 1137 ENDIF 1276 1138 END SUBROUTINE iom_cdf__fill_var_id 1277 !> @endcode1278 1139 !------------------------------------------------------------------- 1279 1140 !> @brief This subroutine fill variable value in an opened 1280 !> netcdf file, given variable name or standard name.</br/> 1281 !> start indices and number of indices selected along each dimension 1282 !> could be specify in a 4 dimension table (/'x','y','z','t'/) 1283 ! 1141 !> netcdf file, given variable name or standard name. 1284 1142 !> @details 1143 !> Optionaly, start indices and number of indices selected along each dimension 1144 !> could be specify in a 4 dimension array (/'x','y','z','t'/) 1145 !> 1285 1146 !> look first for variable name. If it doesn't 1286 1147 !> exist in file, look for variable standard name.<br/> 1287 !> If variable name is not present, check variable standard name.<br/> 1288 ! 1289 !> @author J.Paul 1290 !> - Nov, 2013- Initial Version 1291 ! 1292 !> @param[inout] td_file : file structure 1293 !> @param[in] cd_name : variable name or standard name 1294 !> @param[in] id_start : index in the variable from which the data values will be read 1295 !> @param[in] id_count : number of indices selected along each dimension 1296 !------------------------------------------------------------------- 1297 !> @code 1148 ! 1149 !> @author J.Paul 1150 !> - November, 2013- Initial Version 1151 ! 1152 !> @param[inout] td_file file structure 1153 !> @param[in] cd_name variable name or standard name 1154 !> @param[in] id_start index in the variable from which the data values will be read 1155 !> @param[in] id_count number of indices selected along each dimension 1156 !------------------------------------------------------------------- 1298 1157 SUBROUTINE iom_cdf__fill_var_name(td_file, cd_name, id_start, id_count ) 1299 1158 IMPLICIT NONE … … 1305 1164 1306 1165 ! local variable 1307 INTEGER(i4) :: il_ ind1166 INTEGER(i4) :: il_varid 1308 1167 !---------------------------------------------------------------- 1309 1168 ! check if file opened … … 1311 1170 1312 1171 CALL logger_error( & 1313 & " FILL VAR: no id associated to file "//TRIM(td_file%c_name))1172 & "IOM CDF FILL VAR: no id associated to file "//TRIM(td_file%c_name)) 1314 1173 1315 1174 ELSE 1316 1175 1317 il_ ind=var_get_id(td_file%t_var(:), cd_name)1318 IF( il_ ind /= 0 )THEN1176 il_varid=var_get_index(td_file%t_var(:), cd_name) 1177 IF( il_varid /= 0 )THEN 1319 1178 1320 1179 !!! read variable value 1321 CALL iom_cdf__read_var_value(td_file, td_file%t_var(il_ ind), &1180 CALL iom_cdf__read_var_value(td_file, td_file%t_var(il_varid), & 1322 1181 & id_start, id_count) 1323 1182 … … 1325 1184 1326 1185 CALL logger_error( & 1327 & " FILL VAR: there is no variable with "//&1186 & "IOM CDF FILL VAR: there is no variable with "//& 1328 1187 & "name or standard name"//TRIM(cd_name)//& 1329 1188 & " in file "//TRIM(td_file%c_name)) … … 1333 1192 1334 1193 END SUBROUTINE iom_cdf__fill_var_name 1335 !> @endcode1336 1194 !------------------------------------------------------------------- 1337 1195 !> @brief This function read metadata of a variable in an opened 1338 !> netcdf file. </br/>1196 !> netcdf file. 1339 1197 ! 1340 1198 !> @note variable value are not read 1341 1199 ! 1342 1200 !> @author J.Paul 1343 !> - Nov, 2013- Initial Version 1344 ! 1345 !> @param[in] id_fileid : file id 1346 !> @param[in] id_varid : variable id 1201 !> - November, 2013- Initial Version 1202 !> @date September, 2014 1203 !> - force to use FillValue=1.e20 if no FillValue for coordinate variable. 1204 ! 1205 !> @param[in] td_file file structure 1206 !> @param[in] id_varid variable id 1347 1207 !> @return variable structure 1348 1208 !------------------------------------------------------------------- 1349 !> @code1350 1209 TYPE(TVAR) FUNCTION iom_cdf__read_var_meta(td_file, id_varid) 1351 1210 IMPLICIT NONE … … 1375 1234 1376 1235 CALL logger_error( & 1377 & " READ ATT: no id associated to file "//TRIM(td_file%c_name)) 1236 & " IOM CDF READ VAR META: no id associated to file "//& 1237 & TRIM(td_file%c_name)) 1378 1238 1379 1239 ELSE … … 1381 1241 ! inquire variable 1382 1242 CALL logger_trace( & 1383 & " READ VAR: inquire variable "//TRIM(fct_str(id_varid))//& 1243 & " IOM CDF READ VAR META: inquire variable "//& 1244 & TRIM(fct_str(id_varid))//& 1384 1245 & " in file "//TRIM(td_file%c_name)) 1385 1246 … … 1393 1254 & il_natt ) 1394 1255 CALL iom_cdf__check(il_status) 1395 1396 1256 !!! fill variable dimension structure 1397 1257 tl_dim(:)=iom_cdf__read_var_dim( td_file, il_ndim, il_dimid(:) ) 1398 1399 1258 IF( il_natt /= 0 )THEN 1400 1259 ALLOCATE( tl_att(il_natt) ) … … 1405 1264 il_attid=att_get_id(tl_att(:),'_FillValue') 1406 1265 IF( il_attid == 0 )THEN 1407 CALL logger_ warn("IOM READ VAR: no _FillValue for variable "//&1266 CALL logger_info("IOM CDF READ VAR META: no _FillValue for variable "//& 1408 1267 & TRIM(cl_name)//" in file "//TRIM(td_file%c_name) ) 1409 1268 … … 1411 1270 IF( il_attid /= 0 )THEN 1412 1271 ! create attribute _FillValue 1413 CALL logger_ warn("IOM READ VAR: assume _FillValue is equal to "//&1272 CALL logger_info("IOM CDF READ VAR META: assume _FillValue is equal to "//& 1414 1273 & "missing_value for variable "//TRIM(cl_name) ) 1415 tl_fill=att_init('_FillValue',tl_att(il_attid)%d_value(:)) 1274 tl_fill=att_init('_FillValue',tl_att(il_attid)%d_value(:), & 1275 & id_type=tl_att(il_attid)%i_type) 1416 1276 ELSE 1417 1277 ! create attribute _FillValue 1418 CALL logger_warn("IOM READ VAR: assume _FillValue is equal to "//& 1419 & "zero for variable "//TRIM(cl_name) ) 1420 tl_fill=att_init('_FillValue',0.) 1421 !tl_fill=att_init('_FillValue',1.e20) 1278 SELECT CASE(TRIM(cl_name)) 1279 CASE DEFAULT 1280 CALL logger_info("IOM CDF READ VAR META: assume _FillValue is equal to "//& 1281 & "zero for variable "//TRIM(cl_name) ) 1282 tl_fill=att_init('_FillValue',0.) 1283 CASE('nav_lon','nav_lat', & 1284 & 'glamt','glamu','glamv','glamf', & 1285 & 'gphit','gphiu','gphiv','gphif') 1286 CALL logger_info("IOM CDF READ VAR META: assume _FillValue is equal to "//& 1287 & "dummy fillValue (1.e20) for variable "//TRIM(cl_name) ) 1288 tl_fill=att_init('_FillValue',1.e20) 1289 END SELECT 1422 1290 ENDIF 1423 1291 1424 1292 ALLOCATE( tl_tmp(il_natt) ) 1425 1293 ! save read attribut 1426 tl_tmp(:)=tl_att(:) 1427 ! change number of attribute in table 1294 tl_tmp(:)=att_copy(tl_att(:)) 1295 ! change number of attribute in array 1296 CALL att_clean(tl_att(:)) 1428 1297 DEALLOCATE( tl_att ) 1429 1298 ALLOCATE( tl_att(il_natt+1) ) 1430 1299 ! copy read attribut 1431 tl_att(1:il_natt)=tl_tmp(:) 1300 tl_att(1:il_natt)=att_copy(tl_tmp(:)) 1301 ! clean 1302 CALL att_clean(tl_tmp(:)) 1432 1303 DEALLOCATE( tl_tmp ) 1433 1304 1434 1305 ! create attribute _FillValue 1435 tl_att(il_natt+1)= tl_fill1306 tl_att(il_natt+1)=att_copy(tl_fill) 1436 1307 1437 1308 ENDIF … … 1440 1311 ALLOCATE(tl_att(il_natt+1) ) 1441 1312 ! create attribute _FillValue 1442 CALL logger_warn("IOM READ VAR: assume _FillValue is equal to "//& 1443 & "zero for variable "//TRIM(cl_name) ) 1444 tl_fill=att_init('_FillValue',0.) 1313 SELECT CASE(TRIM(cl_name)) 1314 CASE DEFAULT 1315 CALL logger_info("IOM CDF READ VAR META: assume _FillValue is equal to "//& 1316 & "zero for variable "//TRIM(cl_name) ) 1317 tl_fill=att_init('_FillValue',0.) 1318 CASE('nav_lon','nav_lat', & 1319 & 'glamt','glamu','glamv','glamf', & 1320 & 'gphit','gphiu','gphiv','gphif') 1321 CALL logger_info("IOM CDF READ VAR META: assume _FillValue is equal to "//& 1322 & "dummy fillValue (1.e20) for variable "//TRIM(cl_name) ) 1323 tl_fill=att_init('_FillValue',1.e20) 1324 END SELECT 1445 1325 ! create attribute _FillValue 1446 tl_att(il_natt+1)= tl_fill1326 tl_att(il_natt+1)=att_copy(tl_fill) 1447 1327 ENDIF 1448 1328 … … 1451 1331 & tl_att(:), id_id=id_varid ) 1452 1332 1333 ! clean 1334 CALL dim_clean(tl_dim(:)) 1335 CALL att_clean(tl_fill) 1336 CALL att_clean(tl_att(:)) 1453 1337 DEALLOCATE( tl_att ) 1454 1338 … … 1456 1340 1457 1341 END FUNCTION iom_cdf__read_var_meta 1458 !> @endcode1459 1342 !------------------------------------------------------------------- 1460 1343 !> @brief This subroutine read variable dimension 1461 1344 !> in an opened netcdf file. 1462 ! 1345 !> 1463 1346 !> @details 1464 1347 !> the number of dimension can't exceed 4, 1465 1348 !> and should be 'x', 'y', 'z', 't' (whatever their order).<br/> 1466 !> If the number of dimension read is less than 4, the tableof dimension1349 !> If the number of dimension read is less than 4, the array of dimension 1467 1350 !> strucure is filled with unused dimension.<br/> 1468 !> So the tableof dimension structure of a variable is always compose of 41351 !> So the array of dimension structure of a variable is always compose of 4 1469 1352 !> dimension (use or not). 1470 1353 ! 1471 1354 !> @author J.Paul 1472 !> - Nov, 2013- Initial Version 1473 ! 1474 !> @param[inout] td_file : file structure 1475 !> @return file structure completed 1476 !------------------------------------------------------------------- 1477 !> @code 1355 !> - November, 2013- Initial Version 1356 ! 1357 !> @param[in] td_file file structure 1358 !> @param[in] id_ndim number of dimension 1359 !> @param[in] id_dimid array of dimension id 1360 !> @return array dimension structure 1361 !------------------------------------------------------------------- 1478 1362 FUNCTION iom_cdf__read_var_dim(td_file, id_ndim, id_dimid) 1479 1363 IMPLICIT NONE … … 1502 1386 CALL dim_reorder(tl_dim(:)) 1503 1387 1504 iom_cdf__read_var_dim(:)=tl_dim(:) 1388 iom_cdf__read_var_dim(:)=dim_copy(tl_dim(:)) 1389 1390 ! clean 1391 CALL dim_clean(tl_dim(:)) 1505 1392 1506 1393 ELSE IF( id_ndim > 0 .AND. id_ndim <= 4 )THEN … … 1508 1395 1509 1396 DO ji = 1, id_ndim 1510 CALL logger_ debug( "READ VAR DIM: get variable dimension "//&1397 CALL logger_trace( " IOM CDF READ VAR DIM: get variable dimension "//& 1511 1398 & TRIM(fct_str(ji)) ) 1512 1399 … … 1521 1408 CALL dim_reorder(tl_dim(:)) 1522 1409 1523 iom_cdf__read_var_dim(:)=tl_dim(:) 1410 iom_cdf__read_var_dim(:)=dim_copy(tl_dim(:)) 1411 1412 ! clean 1413 CALL dim_clean(tl_dim(:)) 1524 1414 1525 1415 ELSE 1526 1416 1527 CALL logger_error(" READ VAR DIM: can't manage "//&1417 CALL logger_error(" IOM CDF READ VAR DIM: can't manage "//& 1528 1418 & TRIM(fct_str(id_ndim))//" dimension(s)" ) 1529 1419 … … 1531 1421 1532 1422 END FUNCTION iom_cdf__read_var_dim 1533 !> @endcode1534 1423 !------------------------------------------------------------------- 1535 1424 !> @brief This subroutine read variable attributes … … 1537 1426 ! 1538 1427 !> @author J.Paul 1539 !> - Nov , 2013- Initial Version1540 ! 1541 !> @param[in] td_file :file structure1542 !> @param[in out] td_var : variable structure1543 !> @ return filled variable attribute structure1544 ! -------------------------------------------------------------------1545 ! > @code1428 !> - November, 2013- Initial Version 1429 ! 1430 !> @param[in] td_file file structure 1431 !> @param[in] id_varid variable id 1432 !> @param[in] id_natt number of attributes 1433 !> @return array of attribute structure 1434 !------------------------------------------------------------------- 1546 1435 FUNCTION iom_cdf__read_var_att(td_file, id_varid, id_natt) 1547 1436 IMPLICIT NONE … … 1555 1444 1556 1445 ! local variable 1557 TYPE(TATT), DIMENSION(id_natt) :: tl_att1558 1446 1559 1447 ! loop indices … … 1562 1450 1563 1451 IF( id_natt > 0 )THEN 1564 1452 1565 1453 ! read attributes 1566 1454 DO ji = 1, id_natt 1567 CALL logger_ debug( "READ VAR ATT: get attribute "//&1455 CALL logger_trace( " IOM CDF READ VAR ATT: get attribute "//& 1568 1456 & TRIM(fct_str(ji)) ) 1569 1457 1570 tl_att(ji)=iom_cdf_read_att(td_file, id_varid, ji)1458 iom_cdf__read_var_att(ji)=iom_cdf_read_att(td_file, id_varid, ji) 1571 1459 1572 1460 ENDDO 1573 1461 1574 iom_cdf__read_var_att(:)=tl_att(:)1575 1576 1462 ELSE 1577 1463 1578 CALL logger_debug( " READ VAR ATT: no attribute for variable " )1464 CALL logger_debug( " IOM CDF READ VAR ATT: no attribute for variable " ) 1579 1465 1580 1466 ENDIF 1581 1467 1582 1468 END FUNCTION iom_cdf__read_var_att 1583 !> @endcode1584 1469 !------------------------------------------------------------------- 1585 1470 !> @brief This subroutine read variable value 1586 1471 !> in an opened netcdf file. 1587 ! 1588 !> @author J.Paul 1589 !> - Nov, 2013- Initial Version 1590 ! 1591 !> @param[in] td_file : file structure 1592 !> @param[inout] td_var : variable structure 1593 !> @param[in] id_start : index in the variable from which the data values will be read 1594 !> @param[in] id_count : number of indices selected along each dimension 1472 !> @details 1473 !> Optionaly, start indices and number of indices selected along each dimension 1474 !> could be specify in a 4 dimension array (/'x','y','z','t'/) 1475 ! 1476 !> @author J.Paul 1477 !> - November, 2013- Initial Version 1478 ! 1479 !> @param[in] td_file file structure 1480 !> @param[inout] td_var variable structure 1481 !> @param[in] id_start index in the variable from which the data values will be read 1482 !> @param[in] id_count number of indices selected along each dimension 1595 1483 !> @return variable structure completed 1596 1484 ! … … 1598 1486 !> - warning do not change fill value when use scale factor.. 1599 1487 !------------------------------------------------------------------- 1600 !> @code1601 1488 SUBROUTINE iom_cdf__read_var_value(td_file, td_var, & 1602 1489 & id_start, id_count ) … … 1610 1497 ! local variable 1611 1498 INTEGER(i4) :: il_status 1612 INTEGER(i4) :: il_tmp1, il_tmp2, il_varid 1499 INTEGER(i4) :: il_tmp1 1500 INTEGER(i4) :: il_tmp2 1501 INTEGER(i4) :: il_varid 1613 1502 INTEGER(i4), DIMENSION(ip_maxdim) :: il_start 1614 1503 INTEGER(i4), DIMENSION(ip_maxdim) :: il_count 1615 1504 INTEGER(i4), DIMENSION(ip_maxdim) :: il_start_ord 1616 1505 INTEGER(i4), DIMENSION(ip_maxdim) :: il_count_ord 1617 REAL(dp) , DIMENSION(:,:,:,:) , ALLOCATABLE :: dl_value1618 1619 TYPE(TDIM), DIMENSION(ip_maxdim) :: tl_dim 1506 REAL(dp) , DIMENSION(:,:,:,:) , ALLOCATABLE :: dl_value 1507 REAL(dp) , DIMENSION(:,:,:,:) , ALLOCATABLE :: dl_tmp 1508 1620 1509 ! loop indices 1621 1510 INTEGER(i4) :: ji 1622 1511 !---------------------------------------------------------------- 1623 1512 1624 ! check id_count and id_start optionals parameters... 1625 IF( ( PRESENT(id_start) .AND. (.NOT. PRESENT(id_count))) .OR. & 1626 ((.NOT. PRESENT(id_start)) .AND. PRESENT(id_count) ) )THEN 1627 CALL logger_warn( & 1628 & " READ VAR VALUE: id_start and id_count should be both specify") 1629 ENDIF 1630 1631 IF( PRESENT(id_start).AND.PRESENT(id_count) )THEN 1632 1633 IF( SIZE(id_start(:)) /= ip_maxdim .OR. & 1634 & SIZE(id_count(:)) /= ip_maxdim )THEN 1635 CALL logger_error("READ VAR: dimension of table start or count "//& 1636 & " are invalid to read variable "//TRIM(td_var%c_name)//& 1637 & " in file "//TRIM(td_file%c_name) ) 1638 ENDIF 1639 1640 ! change dimension order from ('x','y','z','t') 1641 il_start(:)=dim_reorder_xyzt2(td_var%t_dim, id_start(:)) 1642 il_count(:)=dim_reorder_xyzt2(td_var%t_dim, id_count(:)) 1643 1644 ! keep ordered table ('x','y','z','t') 1645 il_start_ord(:)=il_start(:) 1646 il_count_ord(:)=il_count(:) 1647 1513 ! check if variable in file structure 1514 il_varid=var_get_id(td_file%t_var(:),TRIM(td_var%c_name)) 1515 IF( il_varid /= 0 )THEN 1516 1517 ! check id_count and id_start optionals parameters... 1518 IF( ( PRESENT(id_start) .AND. (.NOT. PRESENT(id_count))) .OR. & 1519 ((.NOT. PRESENT(id_start)) .AND. PRESENT(id_count) ) )THEN 1520 CALL logger_warn( & 1521 & "IOM CDF READ VAR VALUE: id_start and id_count should be both specify") 1522 ENDIF 1523 IF( PRESENT(id_start).AND.PRESENT(id_count) )THEN 1524 1525 IF( SIZE(id_start(:)) /= ip_maxdim .OR. & 1526 & SIZE(id_count(:)) /= ip_maxdim )THEN 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) ) 1530 ENDIF 1531 1532 ! change dimension order from ('x','y','z','t') 1533 il_start(:)=dim_reorder_xyzt2(td_var%t_dim, id_start(:)) 1534 il_count(:)=dim_reorder_xyzt2(td_var%t_dim, id_count(:)) 1535 1536 ! keep ordered array ('x','y','z','t') 1537 il_start_ord(:)=id_start(:) 1538 il_count_ord(:)=id_count(:) 1539 1540 ELSE 1541 1542 ! change dimension order from ('x','y','z','t') 1543 il_start(:)=(/1,1,1,1/) 1544 il_count(:)=dim_reorder_xyzt2(td_var%t_dim(:),td_var%t_dim(:)%i_len) 1545 1546 ! keep ordered array ('x','y','z','t') 1547 il_start_ord(:)=(/1,1,1,1/) 1548 il_count_ord(:)=td_var%t_dim(:)%i_len 1549 1550 ENDIF 1551 1552 ! check dimension 1553 IF( .NOT. ALL(il_start_ord(:)>=(/1,1,1,1/)) )THEN 1554 1555 CALL logger_error( "IOM CDF READ VAR VALUE: start indices should"//& 1556 & " be greater than or equal to 1") 1557 1558 ENDIF 1559 1560 IF(.NOT.ALL(il_start_ord(:)+il_count_ord(:)-1 <= & 1561 & (/td_var%t_dim( 1 )%i_len,& 1562 & td_var%t_dim( 2 )%i_len,& 1563 & td_var%t_dim( 3 )%i_len,& 1564 & td_var%t_dim( 4 )%i_len & 1565 & /)) )THEN 1566 1567 CALL logger_error( "IOM CDF READ VAR VALUE: start + count exceed "//& 1568 & "variable dimension for "//TRIM(td_var%c_name) ) 1569 1570 DO ji = 1, ip_maxdim 1571 il_tmp1=il_start_ord(ji)+il_count_ord(ji)-1 1572 il_tmp2=td_var%t_dim(ji)%i_len 1573 CALL logger_debug( "IOM CDF READ VAR VALUE: start + count -1:"//& 1574 & TRIM(fct_str(il_tmp1))//" variable dimension"//& 1575 & TRIM(fct_str(il_tmp2))) 1576 ENDDO 1577 1578 ELSE 1579 1580 ! Allocate space to hold variable value (unorder) 1581 ALLOCATE(dl_value( il_count(1), & 1582 & il_count(2), & 1583 & il_count(3), & 1584 & il_count(4)),& 1585 & stat=il_status) 1586 IF( il_status /= 0 )THEN 1587 1588 CALL logger_error( & 1589 & "IOM CDF READ VAR VALUE: not enough space to put variable "//& 1590 & TRIM(td_var%c_name)) 1591 1592 ENDIF 1593 1594 ! read values 1595 CALL logger_debug( & 1596 & "IOM CDF READ VAR VALUE: get variable "//TRIM(td_var%c_name)//& 1597 & " in file "//TRIM(td_file%c_name)) 1598 1599 il_status = NF90_GET_VAR( td_file%i_id, il_varid, & 1600 & dl_value(:,:,:,:), & 1601 & start = il_start(:),& 1602 & count = il_count(:) ) 1603 CALL iom_cdf__check(il_status) 1604 1605 ! Allocate space to hold variable value in structure 1606 IF( ASSOCIATED(td_var%d_value) )THEN 1607 DEALLOCATE(td_var%d_value) 1608 ENDIF 1609 1610 ! new dimension length 1611 td_var%t_dim(:)%i_len=il_count_ord(:) 1612 1613 !> dummy patch for pgf95 1614 ALLOCATE( dl_tmp( td_var%t_dim(1)%i_len, & 1615 & td_var%t_dim(2)%i_len, & 1616 & td_var%t_dim(3)%i_len, & 1617 & td_var%t_dim(4)%i_len),& 1618 & stat=il_status) 1619 IF(il_status /= 0 )THEN 1620 1621 CALL logger_error( & 1622 & "IOM CDF READ VAR VALUE: not enough space to put variable "//& 1623 & TRIM(td_var%c_name)//& 1624 & " in variable structure") 1625 ENDIF 1626 dl_tmp(:,:,:,:)=td_var%d_fill 1627 1628 ! reshape values to be ordered as ('x','y','z','t') 1629 dl_tmp(:,:,:,:)=dim_reshape_2xyzt(td_var%t_dim(:), & 1630 & dl_value(:,:,:,:)) 1631 1632 DEALLOCATE(dl_value) 1633 1634 ALLOCATE(td_var%d_value( td_var%t_dim(1)%i_len, & 1635 & td_var%t_dim(2)%i_len, & 1636 & td_var%t_dim(3)%i_len, & 1637 & td_var%t_dim(4)%i_len),& 1638 & stat=il_status) 1639 IF(il_status /= 0 )THEN 1640 1641 CALL logger_error( & 1642 & "IOM CDF READ VAR VALUE: not enough space to put variable "//& 1643 & TRIM(td_var%c_name)//& 1644 & " in variable structure") 1645 1646 ENDIF 1647 ! ! FillValue by default 1648 ! td_var%d_value(:,:,:,:)=td_var%d_fill 1649 ! 1650 ! ! reshape values to be ordered as ('x','y','z','t') 1651 ! td_var%d_value(:,:,:,:)=dim_reshape_2xyzt(td_var%t_dim(:), & 1652 ! & dl_value(:,:,:,:)) 1653 ! 1654 ! DEALLOCATE(dl_value) 1655 1656 td_var%d_value(:,:,:,:)=dl_tmp(:,:,:,:) 1657 DEALLOCATE(dl_tmp) 1658 !< dummy patch for pgf95 1659 1660 ! force to change _FillValue to avoid mistake 1661 ! with dummy zero _FillValue 1662 IF( td_var%d_fill == 0._dp )THEN 1663 CALL var_chg_FillValue(td_var) 1664 ENDIF 1665 ENDIF 1648 1666 ELSE 1649 1650 ! change dimension order from ('x','y','z','t')1651 il_start(:)=(/1,1,1,1/)1652 il_count(:)=dim_reorder_xyzt2(td_var%t_dim(:),td_var%t_dim(:)%i_len)1653 1654 ! keep ordered table ('x','y','z','t')1655 il_start_ord(:)=(/1,1,1,1/)1656 il_count_ord(:)=td_var%t_dim(:)%i_len1657 1658 ENDIF1659 1660 ! check dimension1661 IF( .NOT. ALL(il_start_ord(:)>=(/1,1,1,1/)) )THEN1662 1663 1667 CALL logger_error( & 1664 &" READ VAR VALUE: start indices should be greater than or equal to 1") 1665 1666 ENDIF 1667 1668 IF(.NOT.ALL(il_start_ord(:)+il_count_ord(:)-1<=(/td_var%t_dim(1)%i_len,& 1669 & td_var%t_dim(2)%i_len,& 1670 & td_var%t_dim(3)%i_len,& 1671 & td_var%t_dim(4)%i_len & 1672 & /)) )THEN 1673 1674 CALL logger_error( & 1675 & " READ VAR VALUE: start + count exceed variable dimension" ) 1676 1677 DO ji = 1, ip_maxdim 1678 il_tmp1=il_start_ord(ji)+il_count_ord(ji) 1679 il_tmp2=td_var%t_dim(ji)%i_len 1680 CALL logger_debug( & 1681 & " READ VAR VALUE: start + count -1 "//TRIM(fct_str(il_tmp1))//& 1682 & " variable dimension"//TRIM(fct_str(il_tmp2))) 1683 ENDDO 1684 1685 ELSE 1686 1687 ! Allocate space to hold variable value (unorder) 1688 ALLOCATE(dl_value( il_count(1), & 1689 & il_count(2), & 1690 & il_count(3), & 1691 & il_count(4)),& 1692 & stat=il_status) 1693 IF( il_status /= 0 )THEN 1694 1695 CALL logger_error( & 1696 & " READ VAR VALUE: not enough space to put variable "//& 1697 & TRIM(td_var%c_name)) 1698 1699 ENDIF 1700 1701 ! read values 1702 CALL logger_debug( & 1703 & " READ VAR VALUE: get variable "//TRIM(td_var%c_name)//& 1704 & " in file "//TRIM(td_file%c_name)) 1705 CALL logger_debug("start "//TRIM(fct_str(il_start(1)))//','//& 1706 & TRIM(fct_str(il_start(2)))//','//& 1707 & TRIM(fct_str(il_start(3)))//','//& 1708 & TRIM(fct_str(il_start(4)))//')' ) 1709 CALL logger_debug("count "//TRIM(fct_str(il_count(1)))//','//& 1710 & TRIM(fct_str(il_count(2)))//','//& 1711 & TRIM(fct_str(il_count(3)))//','//& 1712 & TRIM(fct_str(il_count(4)))//')' ) 1713 CALL logger_debug("dim "//TRIM(fct_str(td_file%t_dim(1)%i_len))//','//& 1714 & TRIM(fct_str(td_file%t_dim(2)%i_len))//','//& 1715 & TRIM(fct_str(td_file%t_dim(3)%i_len))//','//& 1716 & TRIM(fct_str(td_file%t_dim(4)%i_len))//')' ) 1717 CALL logger_debug("shape "//TRIM(fct_str(SIZE(dl_value,DIM=1)))//","//& 1718 & TRIM(fct_str(SIZE(dl_value,DIM=2)))//","//& 1719 & TRIM(fct_str(SIZE(dl_value,DIM=3)))//","//& 1720 & TRIM(fct_str(SIZE(dl_value,DIM=4)))//")" ) 1721 CALL logger_debug("var "//TRIM(td_var%c_name)) 1722 il_varid=var_get_id(td_file%t_var(:),TRIM(td_var%c_name)) 1723 CALL logger_debug("var id "//TRIM(fct_str(il_varid))//' '//TRIM(fct_str(td_var%i_id))) 1724 CALL logger_debug("file id "//TRIM(fct_str(td_file%i_id))) 1725 il_status = NF90_GET_VAR( td_file%i_id, td_var%i_id, & 1726 & dl_value(:,:,:,:), & 1727 & start = il_start(:),& 1728 & count = il_count(:) ) 1729 CALL iom_cdf__check(il_status) 1730 1731 ! Allocate space to hold variable value in structure 1732 IF( ASSOCIATED(td_var%d_value) )THEN 1733 DEALLOCATE(td_var%d_value) 1734 ENDIF 1735 1736 ! new dimension length 1737 td_var%t_dim(:)%i_len=il_count_ord(:) 1738 1739 ALLOCATE(td_var%d_value( il_count_ord(1), & 1740 & il_count_ord(2), & 1741 & il_count_ord(3), & 1742 & il_count_ord(4)),& 1743 & stat=il_status) 1744 IF(il_status /= 0 )THEN 1745 1746 CALL logger_error( & 1747 & " READ VAR VALUE: not enough space to put variable "//& 1748 & TRIM(td_var%c_name)//& 1749 & " in variable structure") 1750 1751 ENDIF 1752 ! FillValue by default 1753 td_var%d_value(:,:,:,:)=td_var%d_fill 1754 1755 ! reshape values to be ordered as ('x','y','z','t') 1756 tl_dim(:)=td_var%t_dim(:) 1757 td_var%d_value(:,:,:,:)=dim_reshape_2xyzt(tl_dim,dl_value(:,:,:,:)) 1758 1759 DEALLOCATE(dl_value) 1760 1761 ! force to change _FillValue to avoid mistake 1762 ! with dummy zero _FillValue 1763 IF( td_var%d_fill == 0._dp )THEN 1764 CALL var_chg_FillValue(td_var) 1765 ENDIF 1668 & "IOM CDF READ VAR VALUE: no variable "//TRIM(td_var%c_name)//& 1669 & " in file structure "//TRIM(td_file%c_name)) 1766 1670 ENDIF 1767 1671 1768 1672 END SUBROUTINE iom_cdf__read_var_value 1769 !> @endcode1770 1673 !------------------------------------------------------------------- 1771 1674 !> @brief This subroutine write file structure in an opened netcdf file. 1772 1675 ! 1773 !> @details 1774 ! 1775 !> @author J.Paul 1776 !> - Nov, 2013- Initial Version 1777 ! 1778 !> @param[in] td_file : file structure 1779 !------------------------------------------------------------------- 1780 !> @code 1676 !> @author J.Paul 1677 !> - November, 2013- Initial Version 1678 ! 1679 !> @param[inout] td_file file structure 1680 !------------------------------------------------------------------- 1781 1681 SUBROUTINE iom_cdf_write_file(td_file) 1782 1682 IMPLICIT NONE … … 1800 1700 1801 1701 CALL logger_error( & 1802 & " WRITE FILE: no id associated to file "//TRIM(td_file%c_name))1702 & " IOM CDF WRITE FILE: no id associated to file "//TRIM(td_file%c_name)) 1803 1703 1804 1704 ELSE 1805 1705 IF( td_file%l_wrt )THEN 1806 1706 1807 ! delete dummy variable1808 CALL file_del_var( td_file, 'no0d')1809 CALL file_del_var( td_file, 'no1d')1810 CALL file_del_var( td_file, 'no2d')1811 CALL file_del_var( td_file, 'no3d')1707 ! remove dummy variable 1708 CALL file_del_var(td_file,'no0d') 1709 CALL file_del_var(td_file,'no1d') 1710 CALL file_del_var(td_file,'no2d') 1711 CALL file_del_var(td_file,'no3d') 1812 1712 1813 1713 DO ji = 1, td_file%i_nvar … … 1816 1716 1817 1717 ! save usefull dimension 1818 tl_dim(:)=var_max_dim(td_file%t_var(:)) 1819 1820 DO ji=1,ip_maxdim 1821 IF( tl_dim(ji)%l_use ) CALL file_move_dim(td_file, tl_dim(ji)) 1822 ENDDO 1718 IF( ASSOCIATED(td_file%t_var) )THEN 1719 tl_dim(:)=var_max_dim(td_file%t_var(:)) 1720 1721 DO ji=1,ip_maxdim 1722 IF( tl_dim(ji)%l_use ) CALL file_move_dim(td_file, tl_dim(ji)) 1723 ENDDO 1724 ! clean 1725 CALL dim_clean(tl_dim(:)) 1726 ENDIF 1823 1727 1824 1728 ! write dimension in file … … 1836 1740 1837 1741 DEALLOCATE(il_value) 1742 1743 ! do not use FillValue for dimension variable 1744 CALL var_del_att(tl_var, "_FillValue") 1838 1745 1839 1746 CALL iom_cdf__write_var(td_file,tl_var) 1747 ! clean 1840 1748 CALL var_clean(tl_var) 1841 1749 … … 1856 1764 1857 1765 CALL logger_error( & 1858 & " WRITE FILE: try to write in file "//TRIM(td_file%c_name)//&1766 & "IOM CDF WRITE FILE: try to write in file "//TRIM(td_file%c_name)//& 1859 1767 & ", not opened in write mode") 1860 1768 … … 1863 1771 1864 1772 END SUBROUTINE iom_cdf_write_file 1865 !> @endcode1866 1773 !------------------------------------------------------------------- 1867 1774 !> @brief This subroutine write one dimension in an opened netcdf … … 1869 1776 ! 1870 1777 !> @author J.Paul 1871 !> - Nov, 2013- Initial Version 1872 ! 1873 !> @param[inout] td_file : file structure 1874 !> @param[inout] td_dim : dimension structure 1875 !------------------------------------------------------------------- 1876 !> @code 1778 !> - November, 2013- Initial Version 1779 ! 1780 !> @param[inout] td_file file structure 1781 !> @param[inout] td_dim dimension structure 1782 !------------------------------------------------------------------- 1877 1783 SUBROUTINE iom_cdf__write_dim(td_file, td_dim) 1878 1784 IMPLICIT NONE … … 1887 1793 IF( .NOT. td_file%l_def )THEN 1888 1794 1889 CALL logger_ debug( &1890 & " WRITE FILE DIM: Enter define mode, file "//TRIM(td_file%c_name))1795 CALL logger_trace( & 1796 & " IOM CDF WRITE FILE DIM: Enter define mode, file "//TRIM(td_file%c_name)) 1891 1797 1892 1798 ! Enter define mode … … 1901 1807 IF( td_dim%l_uld )THEN 1902 1808 ! write unlimited dimension 1903 CALL logger_ debug( &1904 & " WRITE FILE DIM: write unlimited dimension "//&1809 CALL logger_trace( & 1810 & "IOM CDF WRITE FILE DIM: write unlimited dimension "//& 1905 1811 & TRIM(td_dim%c_name)//" in file "//TRIM(td_file%c_name)) 1906 1812 … … 1911 1817 ELSE 1912 1818 ! write not unlimited dimension 1913 CALL logger_ debug( &1914 & " WRITE FILE DIM: write dimension "//TRIM(td_dim%c_name)//&1819 CALL logger_trace( & 1820 & "IOM CDF WRITE FILE DIM: write dimension "//TRIM(td_dim%c_name)//& 1915 1821 & " in file "//TRIM(td_file%c_name)) 1916 1822 … … 1923 1829 1924 1830 END SUBROUTINE iom_cdf__write_dim 1925 !> @endcode1926 1831 !------------------------------------------------------------------- 1927 1832 !> @brief This subroutine write a variable attribute in … … 1929 1834 ! 1930 1835 !> @author J.Paul 1931 !> - Nov, 2013- Initial Version 1932 ! 1933 !> @param[inout] td_file : file structure 1934 !> @param[in] id_varid : variable id. use NF90_GLOBAL to write global attribute 1935 !> in a file 1936 !> @param[in] td_att : attribute structure 1937 !------------------------------------------------------------------- 1938 !> @code 1836 !> - November, 2013- Initial Version 1837 ! 1838 !> @param[inout] td_file file structure 1839 !> @param[in] id_varid variable id. use NF90_GLOBAL to write 1840 !> global attribute in a file 1841 !> @param[in] td_att attribute structure 1842 !------------------------------------------------------------------- 1939 1843 SUBROUTINE iom_cdf__write_att(td_file, id_varid, td_att) 1940 1844 IMPLICIT NONE … … 1950 1854 IF( .NOT. td_file%l_def )THEN 1951 1855 1952 CALL logger_ debug( &1953 & " WRITE FILE ATT: Enter define mode, file "//TRIM(td_file%c_name))1856 CALL logger_trace( & 1857 & "IOM CDF WRITE FILE ATT: Enter define mode, file "//TRIM(td_file%c_name)) 1954 1858 1955 1859 ! Enter define mode … … 1962 1866 1963 1867 !! put attribute value 1964 CALL logger_ debug( &1965 & " WRITE FILE ATT: write attribute "//TRIM(td_att%c_name)//&1868 CALL logger_trace( & 1869 & "IOM CDF WRITE FILE ATT: write attribute "//TRIM(td_att%c_name)//& 1966 1870 & " of variable "//TRIM(fct_str(id_varid))//& 1967 1871 & " in file "//TRIM(td_file%c_name)) … … 1983 1887 1984 1888 END SUBROUTINE iom_cdf__write_att 1985 !> @endcode 1986 !------------------------------------------------------------------- 1987 !> @brief This subroutine write a variable in an opened netcdf file.</br/> 1988 ! 1989 !> @author J.Paul 1990 !> - Nov, 2013- Initial Version 1991 ! 1992 !> @param[inout] td_file : file structure 1993 !> @param[inout] td_var : variable structure 1994 !------------------------------------------------------------------- 1995 !> @code 1889 !------------------------------------------------------------------- 1890 !> @brief This subroutine write a variable in an opened netcdf file. 1891 ! 1892 !> @author J.Paul 1893 !> - November, 2013- Initial Version 1894 ! 1895 !> @param[inout] td_file file structure 1896 !> @param[inout] td_var variable structure 1897 !------------------------------------------------------------------- 1996 1898 SUBROUTINE iom_cdf__write_var(td_file, td_var) 1997 1899 IMPLICIT NONE … … 2002 1904 ! local variable 2003 1905 INTEGER(i4) :: il_status 1906 LOGICAL :: ll_chg 1907 ! loop indices 1908 INTEGER(i4) :: ji 2004 1909 !---------------------------------------------------------------- 2005 1910 2006 1911 IF( .NOT. td_file%l_def )THEN 2007 1912 2008 CALL logger_debug( & 2009 & " WRITE FILE VAR: Enter define mode, file "//TRIM(td_file%c_name)) 1913 CALL logger_trace( & 1914 & " IOM CDF WRITE VAR: Enter define mode, file "//& 1915 & TRIM(td_file%c_name)) 2010 1916 2011 1917 ! Enter define mode … … 2023 1929 CALL var_check_dim(td_var) 2024 1930 2025 ! change fill value to NETCDF standard 2026 CALL var_chg_FillValue(td_var) 1931 ll_chg=.TRUE. 1932 DO ji=1,ip_maxdim 1933 IF( TRIM(fct_lower(cp_dimorder(ji:ji))) == & 1934 & TRIM(fct_lower(td_var%c_name)) )THEN 1935 ll_chg=.FALSE. 1936 CALL logger_trace(TRIM(fct_lower(td_var%c_name))//' is var dimension') 1937 EXIT 1938 ENDIF 1939 ENDDO 1940 IF( ll_chg )THEN 1941 ! not a dimension variable 1942 ! change FillValue 1943 1944 ! ugly patch until NEMO do not force to use 0. as FillValue 1945 CALL var_chg_FillValue(td_var,0._dp) 1946 ENDIF 2027 1947 2028 1948 ! define variable in file … … 2031 1951 IF( td_file%l_def )THEN 2032 1952 2033 CALL logger_debug( & 2034 & " WRITE FILE VAR: Leave define mode, file "//TRIM(td_file%c_name)) 1953 CALL logger_trace( & 1954 & " IOM CDF WRITE VAR: Leave define mode, file "//& 1955 & TRIM(td_file%c_name)) 2035 1956 2036 1957 ! Leave define mode … … 2050 1971 2051 1972 END SUBROUTINE iom_cdf__write_var 2052 !> @endcode2053 1973 !------------------------------------------------------------------- 2054 1974 !> @brief This function define variable in an opened netcdf file. 2055 1975 ! 2056 1976 !> @author J.Paul 2057 !> - Nov , 2013- Initial Version2058 ! 2059 !> @param[in] td_file :file structure2060 !> @param[in] td_var :variable structure1977 !> - November, 2013- Initial Version 1978 ! 1979 !> @param[in] td_file file structure 1980 !> @param[in] td_var variable structure 2061 1981 !> @return variable id 2062 1982 !------------------------------------------------------------------- 2063 !> @code2064 1983 INTEGER(i4) FUNCTION iom_cdf__write_var_def(td_file, td_var) 2065 1984 IMPLICIT NONE … … 2070 1989 ! local variable 2071 1990 INTEGER(i4) :: il_status 1991 INTEGER(i4) :: il_ind 2072 1992 INTEGER(i4), DIMENSION(ip_maxdim) :: il_dimid 1993 1994 TYPE(TVAR) :: tl_var 2073 1995 2074 1996 ! loop indices … … 2077 1999 !---------------------------------------------------------------- 2078 2000 2079 CALL logger_debug( & 2080 & " WRITE FILE VAR DEF: get dimension to be used for variable "//& 2081 & TRIM(td_var%c_name)//" in file "//TRIM(td_file%c_name)) 2082 2083 IF( ALL( .NOT. td_var%t_dim(:)%l_use ) )THEN 2001 ! copy structure 2002 tl_var=var_copy(td_var) 2003 2004 IF( ALL( .NOT. tl_var%t_dim(:)%l_use ) )THEN 2084 2005 ! scalar value 2085 il_status = NF90_DEF_VAR(td_file%i_id, TRIM(t d_var%c_name), &2086 & t d_var%i_type, varid=iom_cdf__write_var_def)2006 il_status = NF90_DEF_VAR(td_file%i_id, TRIM(tl_var%c_name), & 2007 & tl_var%i_type, varid=iom_cdf__write_var_def) 2087 2008 CALL iom_cdf__check(il_status) 2088 2009 ELSE … … 2093 2014 ! reorder dimension, so unused dimension won't be written 2094 2015 DO ji = 1, ip_maxdim 2095 IF( t d_var%t_dim(ji)%l_use )THEN2016 IF( tl_var%t_dim(ji)%l_use )THEN 2096 2017 jj=jj+1 2097 CALL logger_debug(" get dim id for dimension "//TRIM(td_var%t_dim(ji)%c_name)) 2098 il_dimid(jj)=dim_get_id(td_file%t_dim(:),td_var%t_dim(ji)%c_name) 2018 il_dimid(jj)=dim_get_id(td_file%t_dim(:),tl_var%t_dim(ji)%c_name) 2099 2019 ENDIF 2100 2020 ENDDO 2101 2021 2102 CALL logger_ debug( &2103 & " WRITE FILE VAR DEF: define dimension to be used for variable "//&2104 & TRIM(t d_var%c_name)//" in file "//TRIM(td_file%c_name))2022 CALL logger_trace( & 2023 & "IOM CDF WRITE VAR DEF: define dimension to be used for variable "//& 2024 & TRIM(tl_var%c_name)//" in file "//TRIM(td_file%c_name)) 2105 2025 2106 2026 DO ji=1,jj 2107 CALL logger_ debug(" WRITE FILE 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))) ) 2108 2028 ENDDO 2109 il_status = NF90_DEF_VAR(td_file%i_id, TRIM(t d_var%c_name), &2110 & t d_var%i_type, &2029 il_status = NF90_DEF_VAR(td_file%i_id, TRIM(tl_var%c_name), & 2030 & tl_var%i_type, & 2111 2031 & il_dimid(1:jj), & 2112 2032 & varid=iom_cdf__write_var_def ) … … 2114 2034 ENDIF 2115 2035 2116 DO ji = 1, td_var%i_natt 2117 CALL logger_debug( & 2118 & " WRITE FILE VAR DEF: put attribute "//TRIM(td_var%t_att(ji)%c_name)//& 2119 & " for variable "//TRIM(td_var%c_name)//& 2036 ! remove unuseful attribute 2037 il_ind=att_get_index( tl_var%t_att(:), "ew_overlap" ) 2038 IF( il_ind /= 0 )THEN 2039 IF( tl_var%t_att(il_ind)%d_value(1) == -1 )THEN 2040 CALL var_del_att(tl_var, tl_var%t_att(il_ind)) 2041 ENDIF 2042 ENDIF 2043 2044 DO ji = 1, tl_var%i_natt 2045 CALL logger_trace( & 2046 & " IOM CDF WRITE VAR DEF: put attribute "//TRIM(tl_var%t_att(ji)%c_name)//& 2047 & " for variable "//TRIM(tl_var%c_name)//& 2120 2048 & " in file "//TRIM(td_file%c_name) ) 2121 2049 2122 IF( td_var%t_att(ji)%i_type == NF90_CHAR )THEN 2123 !IF( TRIM(td_var%t_att(ji)%c_value) /= 'unknown' )THEN 2124 IF( TRIM(td_var%t_att(ji)%c_value) /= '' )THEN 2050 IF( tl_var%t_att(ji)%i_type == NF90_CHAR )THEN 2051 IF( TRIM(tl_var%t_att(ji)%c_value) /= '' )THEN 2125 2052 il_status = NF90_PUT_ATT(td_file%i_id, iom_cdf__write_var_def, & 2126 & TRIM(t d_var%t_att(ji)%c_name), &2127 & TRIM(t d_var%t_att(ji)%c_value) )2053 & TRIM(tl_var%t_att(ji)%c_name), & 2054 & TRIM(tl_var%t_att(ji)%c_value) ) 2128 2055 CALL iom_cdf__check(il_status) 2129 2056 ENDIF 2130 2057 ELSE 2131 SELECT CASE(t d_var%t_att(ji)%i_type)2058 SELECT CASE(tl_var%t_att(ji)%i_type) 2132 2059 CASE(NF90_BYTE) 2133 2060 il_status = NF90_PUT_ATT(td_file%i_id, & 2134 2061 & iom_cdf__write_var_def, & 2135 & TRIM(t d_var%t_att(ji)%c_name), &2136 & INT(t d_var%t_att(ji)%d_value(:),i1))2062 & TRIM(tl_var%t_att(ji)%c_name), & 2063 & INT(tl_var%t_att(ji)%d_value(:),i1)) 2137 2064 CASE(NF90_SHORT) 2138 2065 il_status = NF90_PUT_ATT(td_file%i_id, & 2139 2066 & iom_cdf__write_var_def, & 2140 & TRIM(t d_var%t_att(ji)%c_name), &2141 & INT(t d_var%t_att(ji)%d_value(:),i2))2067 & TRIM(tl_var%t_att(ji)%c_name), & 2068 & INT(tl_var%t_att(ji)%d_value(:),i2)) 2142 2069 CASE(NF90_INT) 2143 2070 il_status = NF90_PUT_ATT(td_file%i_id, & 2144 2071 & iom_cdf__write_var_def, & 2145 & TRIM(t d_var%t_att(ji)%c_name), &2146 & INT(t d_var%t_att(ji)%d_value(:),i4))2072 & TRIM(tl_var%t_att(ji)%c_name), & 2073 & INT(tl_var%t_att(ji)%d_value(:),i4)) 2147 2074 CASE(NF90_FLOAT) 2148 2075 il_status = NF90_PUT_ATT(td_file%i_id, & 2149 2076 & iom_cdf__write_var_def, & 2150 & TRIM(t d_var%t_att(ji)%c_name), &2151 & REAL(t d_var%t_att(ji)%d_value(:),sp))2077 & TRIM(tl_var%t_att(ji)%c_name), & 2078 & REAL(tl_var%t_att(ji)%d_value(:),sp)) 2152 2079 CASE(NF90_DOUBLE) 2153 2080 il_status = NF90_PUT_ATT(td_file%i_id, & 2154 2081 & iom_cdf__write_var_def, & 2155 & TRIM(t d_var%t_att(ji)%c_name), &2156 & REAL(t d_var%t_att(ji)%d_value(:),dp))2082 & TRIM(tl_var%t_att(ji)%c_name), & 2083 & REAL(tl_var%t_att(ji)%d_value(:),dp)) 2157 2084 END SELECT 2158 2085 CALL iom_cdf__check(il_status) … … 2161 2088 2162 2089 END FUNCTION iom_cdf__write_var_def 2163 !> @endcode2164 2090 !------------------------------------------------------------------- 2165 2091 !> @brief This subroutine put variable value in an opened netcdf file. … … 2167 2093 !> @details 2168 2094 !> The variable is written in the type define in variable structure. 2169 !> Only dimension used are printed, and fillValue in tableare2095 !> Only dimension used are printed, and fillValue in array are 2170 2096 !> replaced by default fill values defined in module netcdf for each type. 2171 2097 ! 2172 2098 !> @author J.Paul 2173 !> - Nov, 2013- Initial Version 2174 ! 2175 !> @param[in] td_file : file structure 2176 !> @param[in] td_var : variable structure 2177 !------------------------------------------------------------------- 2178 !> @code 2099 !> - November, 2013- Initial Version 2100 ! 2101 !> @param[in] td_file file structure 2102 !> @param[in] td_var variable structure 2103 !------------------------------------------------------------------- 2179 2104 SUBROUTINE iom_cdf__write_var_value(td_file, td_var) 2180 2105 IMPLICIT NONE … … 2194 2119 2195 2120 ! check which dimension use 2196 CALL logger_ debug( &2197 & " WRITE FILE VAR VALUE: get dimension to be used for variable "//&2121 CALL logger_trace( & 2122 & "IOM CDF WRITE VAR VALUE: get dimension to be used for variable "//& 2198 2123 & TRIM(td_var%c_name)//" in file "//TRIM(td_file%c_name)) 2199 2124 … … 2202 2127 IF( td_var%t_dim(ji)%l_use )THEN 2203 2128 jj=jj+1 2204 !il_order(ji)=jj2205 !il_shape(ji)=td_var%t_dim(jj)%i_len2206 2129 il_order(jj)=ji 2207 2130 il_shape(jj)=td_var%t_dim(ji)%i_len … … 2212 2135 IF( .NOT. td_var%t_dim(ji)%l_use )THEN 2213 2136 jj=jj+1 2214 !il_order(ji)=jj2215 !il_shape(ji)=td_var%t_dim(jj)%i_len2216 2137 il_order(jj)=ji 2217 2138 il_shape(jj)=td_var%t_dim(ji)%i_len … … 2221 2142 ALLOCATE( dl_value( il_shape(1),il_shape(2),il_shape(3),il_shape(4) ) ) 2222 2143 2223 ! reshape table, so unused dimension won't be written2144 ! reshape array, so unused dimension won't be written 2224 2145 dl_value(:,:,:,:)=RESHAPE(source=td_var%d_value(:,:,:,:),& 2225 2146 & SHAPE = il_shape(:), & … … 2227 2148 2228 2149 ! put value 2229 CALL logger_ debug( &2230 & " WRITE FILE VAR VALUE: put "//TRIM(td_var%c_name)//" value "//&2150 CALL logger_trace( & 2151 & "IOM CDF WRITE VAR VALUE: put "//TRIM(td_var%c_name)//" value "//& 2231 2152 & "in file "//TRIM(td_file%c_name)) 2232 2153 … … 2237 2158 2238 2159 END SUBROUTINE iom_cdf__write_var_value 2239 !> @endcode2240 2160 END MODULE iom_cdf
Note: See TracChangeset
for help on using the changeset viewer.