- Timestamp:
- 2015-02-17T10:06:39+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2014/dev_r4650_UKMO3_masked_damping/NEMOGCM/TOOLS/SIREN/src/iom.f90
r4213 r5086 6 6 ! 7 7 ! DESCRIPTION: 8 !> @brief Input/Output manager : Library to read input files <br/>8 !> @brief Input/Output manager : Library to read input files 9 9 !> 10 10 !> @details 11 !> to open file:<br/> 12 !> @code 13 !> CALL iom_open(td_file) 14 !> @endcode 15 !> - td_file is file structure 16 !> 17 !> to create file:<br/> 18 !> @code 19 !> CALL iom_create(td_file) 20 !> @endcode 21 !> - td_file is file structure 11 22 !> 12 !> to open file:<br/>13 !> CALL iom_open(td_file)14 !> - td_file is file structure15 !>16 23 !> to write in file:<br/> 24 !> @code 17 25 !> CALL iom_write_file(td_file) 26 !> @endcode 18 27 !> 19 28 !> to close file:<br/> 29 !> @code 20 30 !> CALL iom_close(tl_file) 31 !> @endcode 21 32 !> 22 33 !> to read one dimension in file:<br/> 23 !> tl_dim = iom_read_dim(tl_file, id_dimid)<br/> 34 !> @code 35 !> tl_dim = iom_read_dim(tl_file, id_dimid) 36 !> @endcode 24 37 !> or<br/> 25 !> tl_dim = iom_read_dim(tl_file, cd_name)<br/> 38 !> @code 39 !> tl_dim = iom_read_dim(tl_file, cd_name) 40 !> @endcode 26 41 !> - id_dimid is dimension id 27 42 !> - cd_name is dimension name 28 43 !> 29 44 !> to read variable or global attribute in file:<br/> 30 !> tl_att = iom_read_att(tl_file, id_varid, id_attid)<br/> 31 !> or<br/> 32 !> tl_att = iom_read_att(tl_file, id_varid, cd_attname)<br/> 33 !> or<br/> 34 !> tl_att = iom_read_att(tl_file, cd_varname, cd_attid, [cd_stdname])<br/> 35 !> or<br/> 36 !> tl_att = iom_read_att(tl_file, cd_varname, cd_attname, cd_stdname) 45 !> @code 46 !> tl_att = iom_read_att(tl_file, id_varid, id_attid) 47 !> @endcode 48 !> or 49 !> @code 50 !> tl_att = iom_read_att(tl_file, id_varid, cd_attname) 51 !> @endcode 52 !> or 53 !> @code 54 !> tl_att = iom_read_att(tl_file, cd_varname, id_attid) 55 !> @endcode 56 !> or 57 !> @code 58 !> tl_att = iom_read_att(tl_file, cd_varname, cd_attname) 59 !> @endcode 37 60 !> - id_varid is variable id 38 61 !> - id_attid is attribute id 39 62 !> - cd_attname is attribute name 40 !> - cd_varname is variable name 41 !> - cd_stdname is variable standard name (optional) 63 !> - cd_varname is variable name or standard name 42 64 !> 43 65 !> to read one variable in file:<br/> 44 !> tl_var = iom_read_var(td_file, id_varid, [id_start, id_count])<br/> 45 !> or<br/> 46 !> tl_var = iom_read_var(td_file, cd_name, [id_start, [id_count,]] [cd_stdname]) 66 !> @code 67 !> tl_var = iom_read_var(td_file, id_varid, [id_start, id_count]) 68 !> @endcode 69 !> or 70 !> @code 71 !> tl_var = iom_read_var(td_file, cd_name, [id_start, [id_count,]]) 72 !> @endcode 47 73 !> - id_varid is variabale id 48 !> - cd_name is variabale name 49 !> - id_start is a integer(4) 1D table of index from which the data 50 !> values will be read (optional) 51 !> - id_count is a integer(4) 1D table of the number of indices selected 52 !> along each dimension (optional) 53 !> - cd_stdname is variable standard name (optional) 74 !> - cd_name is variabale name or standard name. 75 !> - id_start is a integer(4) 1D array of index from which the data 76 !> values will be read [optional] 77 !> - id_count is a integer(4) 1D array of the number of indices selected 78 !> along each dimension [optional] 54 79 !> 55 80 !> @author 56 81 !> J.Paul 57 82 ! REVISION HISTORY: 58 !> @date Nov, 2013 - Initial Version 59 ! 60 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 83 !> @date November, 2013 - Initial Version 84 !> 61 85 !> @todo 62 86 !> - see lbc_lnk 63 87 !> - see goup netcdf4 64 !> - add iom_fill_var_value : complete tl_file avec valeur de la variable 88 !> 89 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 65 90 !---------------------------------------------------------------------- 66 91 MODULE iom 67 92 USE netcdf ! nf90 library 93 USE global ! global parameter 68 94 USE kind ! F90 kind parameter 69 95 USE fct ! basic useful function 70 USE logger 96 USE logger ! log file manager 71 97 USE dim ! dimension manager 72 98 USE att ! attribute manager … … 76 102 USE iom_rstdimg ! restart dimg I/O manager 77 103 IMPLICIT NONE 78 PRIVATE79 104 ! NOTE_avoid_public_variables_if_possible 80 105 … … 86 111 PUBLIC :: iom_read_att !< read one attribute in an opened file 87 112 PUBLIC :: iom_read_var !< read one variable in an opened file 88 PUBLIC :: iom_fill_var !< fill variable value89 113 PUBLIC :: iom_write_file !< write file structure contents in an opened file 90 ! PUBLIC :: iom_get_mpp ! get sub domain decomposition 91 92 !< read variable or global attribute in an opened file 93 PRIVATE :: iom__read_var_name_att_id !< given variable name or standard name and attribute id. 94 PRIVATE :: iom__read_var_id_att_id !< given variable id and attribute id. 95 PRIVATE :: iom__read_var_name_att_name !< given variable name or standard name, and attribute name. 96 PRIVATE :: iom__read_var_id_att_name !< given variable id and attribute name. 97 98 PRIVATE :: iom__read_dim_id !< read one dimension in an opened file, given dimension id. 99 PRIVATE :: iom__read_dim_name !< read one dimension in an opened netcdf file, given dimension name. 100 PRIVATE :: iom__read_var_id !< read variable value in an opened file, given variable id. 101 PRIVATE :: iom__read_var_name !< read variable value in an opened file, given variable name or standard name. 102 PRIVATE :: iom__fill_var_id !< fill variable value in an opened file, given variable id 103 PRIVATE :: iom__fill_var_name !< fill variable value in an opened file, given variable name 104 PRIVATE :: iom__fill_var_all !< fill all variable value in an opened file 114 115 ! read variable or global attribute in an opened file 116 PRIVATE :: iom__read_att_varname_id ! given variable name or standard name and attribute id. 117 PRIVATE :: iom__read_att_varid_id ! given variable id and attribute id. 118 PRIVATE :: iom__read_att_varname_name ! given variable name or standard name, and attribute name. 119 PRIVATE :: iom__read_att_varid_name ! given variable id and attribute name. 120 121 PRIVATE :: iom__read_dim_id ! read one dimension in an opened file, given dimension id. 122 PRIVATE :: iom__read_dim_name ! read one dimension in an opened netcdf file, given dimension name. 123 PRIVATE :: iom__read_var_id ! read variable value in an opened file, given variable id. 124 PRIVATE :: iom__read_var_name ! read variable value in an opened file, given variable name or standard name. 105 125 106 126 INTERFACE iom_read_var … … 109 129 END INTERFACE iom_read_var 110 130 111 INTERFACE iom_fill_var112 MODULE PROCEDURE iom__fill_var_id113 MODULE PROCEDURE iom__fill_var_name114 MODULE PROCEDURE iom__fill_var_all115 END INTERFACE116 117 131 INTERFACE iom_read_dim 118 132 MODULE PROCEDURE iom__read_dim_id … … 121 135 122 136 INTERFACE iom_read_att !< read variable or global attribute in an opened file 123 MODULE PROCEDURE iom__read_ var_name_att_id !< given variable name or standard name and attribute id.124 MODULE PROCEDURE iom__read_ var_id_att_id !< given variable id and attribute id.125 MODULE PROCEDURE iom__read_ var_name_att_name !< given variable name or standard name, and attribute name.126 MODULE PROCEDURE iom__read_ var_id_att_name !< given variable id and attribute name.137 MODULE PROCEDURE iom__read_att_varname_id !< given variable name or standard name and attribute id. 138 MODULE PROCEDURE iom__read_att_varid_id !< given variable id and attribute id. 139 MODULE PROCEDURE iom__read_att_varname_name !< given variable name or standard name, and attribute name. 140 MODULE PROCEDURE iom__read_att_varid_name !< given variable id and attribute name. 127 141 END INTERFACE iom_read_att 128 142 129 143 CONTAINS 130 144 !------------------------------------------------------------------- 131 !> @brief This function open a file in read or write mode<br/> 145 !> @brief This function open a file in read or write mode 146 !> @details 132 147 !> If try to open a file in write mode that did not exist, create it.<br/> 133 148 !> 134 !> If file alreadyexist, get information about:149 !> If file exist, get information about: 135 150 !> - the number of variables 136 151 !> - the number of dimensions … … 141 156 !> 142 157 !> @author J.Paul 143 !> - Nov, 2013- Initial Version 144 ! 145 !> @param[inout] td_file : file structure 146 !------------------------------------------------------------------- 147 !> @code 158 !> - November, 2013- Initial Version 159 ! 160 !> @param[inout] td_file file structure 161 !------------------------------------------------------------------- 148 162 SUBROUTINE iom_open(td_file) 149 163 IMPLICIT NONE … … 163 177 CALL iom_rstdimg_open(td_file) 164 178 CASE DEFAULT 165 CALL logger_error(" OPEN: unknow type : "//TRIM(td_file%c_name))179 CALL logger_error("IOM OPEN: unknow type : "//TRIM(td_file%c_name)) 166 180 167 181 END SELECT 168 182 169 183 END SUBROUTINE iom_open 170 !> @endcode 171 !------------------------------------------------------------------- 172 !> @brief This function create a file<br/> 184 !------------------------------------------------------------------- 185 !> @brief This function create a file. 173 186 !> 174 187 !> @author J.Paul 175 !> - Nov, 2013- Initial Version 176 ! 177 !> @param[inout] td_file : file structure 178 !------------------------------------------------------------------- 179 !> @code 188 !> - November, 2013- Initial Version 189 ! 190 !> @param[inout] td_file file structure 191 !------------------------------------------------------------------- 180 192 SUBROUTINE iom_create(td_file) 181 193 IMPLICIT NONE … … 202 214 CALL iom_rstdimg_open(td_file) 203 215 CASE DEFAULT 204 CALL logger_error( " CREATE: can't create file "//&216 CALL logger_error( "IOM CREATE: can't create file "//& 205 217 & TRIM(td_file%c_name)//": type unknown " ) 206 218 END SELECT 207 219 208 220 END SUBROUTINE iom_create 209 !> @endcode210 221 !------------------------------------------------------------------- 211 222 !> @brief This subroutine close file 212 223 !> 213 224 !> @author J.Paul 214 !> - Nov, 2013- Initial Version 215 ! 216 !> @param[inout] td_file : file structure 217 !------------------------------------------------------------------- 218 !> @code 225 !> - November, 2013- Initial Version 226 ! 227 !> @param[inout] td_file file structure 228 !------------------------------------------------------------------- 219 229 SUBROUTINE iom_close(td_file) 220 230 IMPLICIT NONE … … 230 240 CALL iom_rstdimg_close(td_file) 231 241 CASE DEFAULT 232 CALL logger_error( " CLOSE: can't close file "//&242 CALL logger_error( "IOM CLOSE: can't close file "//& 233 243 & TRIM(td_file%c_name)//": type unknown " ) 234 244 END SELECT 235 245 236 246 END SUBROUTINE iom_close 237 !> @endcode238 247 !------------------------------------------------------------------- 239 248 !> @brief This function read attribute (of variable or global) in an opened 240 249 !> file, given variable name or standard name and attribute id. 241 !> to get global attribute use 'GLOBAL' as variable name 242 !> 243 !> To check only standard name of the variable, put variable name to '' 244 ! 245 !> @author J.Paul 246 !> - Nov, 2013- Initial Version 247 ! 248 !> @param[in] td_file : file structure 249 !> @param[in] cd_varname : variable name. use 'GLOBAL' to read global 250 !> @details 251 !> - to get global attribute use 'GLOBAL' as variable name. 252 ! 253 !> @author J.Paul 254 !> - November, 2013- Initial Version 255 ! 256 !> @param[in] td_file file structure 257 !> @param[in] cd_varname variable name. use 'GLOBAL' to read global 250 258 !> attribute in a file 251 !> @param[in] id_attid : attribute id 252 !> @param[in] cd_stdname : variable standard name 259 !> @param[in] id_attid attribute id 253 260 !> @return attribute structure 254 261 !------------------------------------------------------------------- 255 !> @code 256 TYPE(TATT) FUNCTION iom__read_var_name_att_id( td_file, cd_varname, & 257 & id_attid) 262 TYPE(TATT) FUNCTION iom__read_att_varname_id( td_file, cd_varname, & 263 & id_attid) 258 264 IMPLICIT NONE 259 265 ! Argument … … 277 283 SELECT CASE(TRIM(td_file%c_type)) 278 284 CASE('cdf') 279 iom__read_ var_name_att_id=iom_read_att( td_file, il_varid, &285 iom__read_att_varname_id=iom_read_att( td_file, il_varid, & 280 286 & id_attid) 281 287 CASE('dimg') 282 CALL logger_warn( " READ ATT: can't read attribute "//&288 CALL logger_warn( " IOM READ ATT: can't read attribute "//& 283 289 & "in dimg file : "//TRIM(td_file%c_name) ) 284 290 CASE DEFAULT 285 CALL logger_error( " READ ATT: can't read attribute in file "//&286 & 291 CALL logger_error( " IOM READ ATT: can't read attribute "//& 292 & " in file "//TRIM(td_file%c_name)//" : type unknown " ) 287 293 END SELECT 288 294 ENDIF 289 295 290 END FUNCTION iom__read_var_name_att_id 291 !> @endcode 296 END FUNCTION iom__read_att_varname_id 292 297 !------------------------------------------------------------------- 293 298 !> @brief This function read attribute (of variable or global) in an opened … … 295 300 !> 296 301 !> @author J.Paul 297 !> - Nov , 2013- Initial Version298 ! 299 !> @param[in] td_file :file structure300 !> @param[in] id_varid :variable id. use NF90_GLOBAL to read global302 !> - November, 2013- Initial Version 303 ! 304 !> @param[in] td_file file structure 305 !> @param[in] id_varid variable id. use NF90_GLOBAL to read global 301 306 !> attribute in a file 302 !> @param[in] id_attid :attribute id307 !> @param[in] id_attid attribute id 303 308 !> @return attribute structure 304 309 !------------------------------------------------------------------- 305 !> @code 306 TYPE(TATT) FUNCTION iom__read_var_id_att_id( td_file, id_varid, & 310 TYPE(TATT) FUNCTION iom__read_att_varid_id( td_file, id_varid, & 307 311 & id_attid) 308 312 IMPLICIT NONE … … 316 320 SELECT CASE(TRIM(td_file%c_type)) 317 321 CASE('cdf') 318 iom__read_ var_id_att_id=iom_cdf_read_att( td_file, id_varid, &322 iom__read_att_varid_id=iom_cdf_read_att( td_file, id_varid, & 319 323 & id_attid) 320 324 CASE('dimg') 321 CALL logger_warn( " READ ATT: can't read attribute in dimg file "//&325 CALL logger_warn( " IOM READ ATT: can't read attribute in dimg file "//& 322 326 & TRIM(td_file%c_name) ) 323 327 CASE DEFAULT 324 CALL logger_error( " READ ATT: can't read attribute in file "//& 325 & TRIM(td_file%c_name)//" : type unknown " ) 326 END SELECT 327 328 END FUNCTION iom__read_var_id_att_id 329 !> @endcode 328 CALL logger_error( " IOM READ ATT: can't read attribute in file "//& 329 & TRIM(td_file%c_name)//" : type unknown " ) 330 END SELECT 331 332 END FUNCTION iom__read_att_varid_id 330 333 !------------------------------------------------------------------- 331 334 !> @brief This function read attribute (of variable or global) in an opened 332 335 !> file, given variable name or standard name, and attribute name. 333 !> to get global attribute use 'GLOBAL' as variable name. 334 !> 335 !> To check only standard name of the variable, put variable name to '' 336 ! 337 !> @author J.Paul 338 !> - Nov, 2013- Initial Version 339 ! 340 !> @param[in] td_file : file structure 341 !> @param[in] cd_varname : variable name or standard name. use 'GLOBAL' to read global 336 !> @details 337 !> - to get global attribute use 'GLOBAL' as variable name. 338 ! 339 !> @author J.Paul 340 !> - November, 2013- Initial Version 341 ! 342 !> @param[in] td_file file structure 343 !> @param[in] cd_varname variable name or standard name. use 'GLOBAL' to read global 342 344 !> attribute in a file 343 !> @param[in] cd_attname :attribute name345 !> @param[in] cd_attname attribute name 344 346 !> @return attribute structure 345 347 !------------------------------------------------------------------- 346 !> @code 347 TYPE(TATT) FUNCTION iom__read_var_name_att_name( td_file, cd_varname, & 348 TYPE(TATT) FUNCTION iom__read_att_varname_name( td_file, cd_varname, & 348 349 & cd_attname) 349 350 IMPLICIT NONE … … 368 369 SELECT CASE(TRIM(td_file%c_type)) 369 370 CASE('cdf') 370 iom__read_ var_name_att_name=iom_cdf_read_att( td_file, il_varid, &371 iom__read_att_varname_name=iom_cdf_read_att( td_file, il_varid, & 371 372 & cd_attname) 372 373 CASE('dimg') 373 CALL logger_warn( " READ ATT: can't read attribute "//&374 CALL logger_warn( " IOM READ ATT: can't read attribute "//& 374 375 & "in dimg file :"//TRIM(td_file%c_name) ) 375 376 CASE DEFAULT 376 CALL logger_error( " READ ATT: can't read attribute in file "//&377 CALL logger_error( " IOM READ ATT: can't read attribute in file "//& 377 378 & TRIM(td_file%c_name)//" : type unknown " ) 378 379 END SELECT 379 380 ENDIF 380 381 381 END FUNCTION iom__read_var_name_att_name 382 !> @endcode 382 END FUNCTION iom__read_att_varname_name 383 383 !------------------------------------------------------------------- 384 384 !> @brief This function read attribute (of variable or global) in an opened … … 386 386 ! 387 387 !> @author J.Paul 388 !> - Nov , 2013- Initial Version389 ! 390 !> @param[in] td_file :file structure391 !> @param[in] id_varid :variable id. use NF90_GLOBAL to read global388 !> - November, 2013- Initial Version 389 ! 390 !> @param[in] td_file file structure 391 !> @param[in] id_varid variable id. use NF90_GLOBAL to read global 392 392 !> attribute in a file 393 !> @param[in] cd_ name :attribute name393 !> @param[in] cd_attname attribute name 394 394 !> @return attribute structure 395 395 !------------------------------------------------------------------- 396 !> @code 397 TYPE(TATT) FUNCTION iom__read_var_id_att_name( td_file, id_varid, & 396 TYPE(TATT) FUNCTION iom__read_att_varid_name( td_file, id_varid, & 398 397 & cd_attname) 399 398 IMPLICIT NONE … … 407 406 SELECT CASE(TRIM(td_file%c_type)) 408 407 CASE('cdf') 409 iom__read_ var_id_att_name=iom_cdf_read_att( td_file, id_varid, &408 iom__read_att_varid_name=iom_cdf_read_att( td_file, id_varid, & 410 409 & cd_attname) 411 410 CASE('dimg') 412 CALL logger_warn( " READ ATT: can't read attribute in dimg file :"&411 CALL logger_warn( " IOM READ ATT: can't read attribute in dimg file :"& 413 412 & //TRIM(td_file%c_name) ) 414 413 CASE DEFAULT 415 CALL logger_error( " READ ATT: can't read attribute in file "//& 416 & TRIM(td_file%c_name)//" : type unknown " ) 417 END SELECT 418 419 END FUNCTION iom__read_var_id_att_name 420 !> @endcode 414 CALL logger_error( " IOM READ ATT: can't read attribute in file "//& 415 & TRIM(td_file%c_name)//" : type unknown " ) 416 END SELECT 417 418 END FUNCTION iom__read_att_varid_name 421 419 !------------------------------------------------------------------- 422 420 !> @brief This function read one dimension in an opened file, … … 424 422 ! 425 423 !> @author J.Paul 426 !> - Nov , 2013- Initial Version427 ! 428 !> @param[in] td_file :file structure429 !> @param[in] id_dimid :dimension id424 !> - November, 2013- Initial Version 425 ! 426 !> @param[in] td_file file structure 427 !> @param[in] id_dimid dimension id 430 428 !> @return dimension structure 431 429 !------------------------------------------------------------------- 432 !> @code433 430 TYPE(TDIM) FUNCTION iom__read_dim_id(td_file, id_dimid) 434 431 IMPLICIT NONE … … 445 442 iom__read_dim_id=iom_rstdimg_read_dim(td_file, id_dimid) 446 443 CASE DEFAULT 447 CALL logger_error( " READ DIM: can't read dimension in file "//&444 CALL logger_error( " IOM READ DIM: can't read dimension in file "//& 448 445 & TRIM(td_file%c_name)//" : type unknown " ) 449 446 END SELECT 450 447 451 448 END FUNCTION iom__read_dim_id 452 !> @endcode453 449 !------------------------------------------------------------------- 454 450 !> @brief This function read one dimension in an opened netcdf file, … … 456 452 ! 457 453 !> @author J.Paul 458 !> - Nov , 2013- Initial Version459 ! 460 !> @param[in] td_file :file structure461 !> @param[in] cd_name :dimension name454 !> - November, 2013- Initial Version 455 ! 456 !> @param[in] td_file file structure 457 !> @param[in] cd_name dimension name 462 458 !> @return dimension structure 463 459 !------------------------------------------------------------------- 464 !> @code465 460 TYPE(TDIM) FUNCTION iom__read_dim_name(td_file, cd_name) 466 461 IMPLICIT NONE … … 477 472 iom__read_dim_name=iom_rstdimg_read_dim(td_file, cd_name) 478 473 CASE DEFAULT 479 CALL logger_error( " READ DIM: can't read dimension in file "//&474 CALL logger_error( " IOM READ DIM: can't read dimension in file "//& 480 475 & TRIM(td_file%c_name)//" : type unknown " ) 481 476 END SELECT 482 477 483 478 END FUNCTION iom__read_dim_name 484 !> @endcode485 479 !------------------------------------------------------------------- 486 480 !> @brief This function read variable value in an opened 487 !> file, given variable id.</br/> 481 !> file, given variable id. 482 !> @details 488 483 !> start indices and number of indices selected along each dimension 489 !> could be specify in a 4 dimension table(/'x','y','z','t'/)490 ! 491 !> @author J.Paul 492 !> - Nov , 2013- Initial Version493 ! 494 !> @param[in] td_file :file structure495 !> @param[in] id_varid :variable id496 !> @param[in] id_start :index in the variable from which the data values484 !> could be specify in a 4 dimension array (/'x','y','z','t'/) 485 ! 486 !> @author J.Paul 487 !> - November, 2013- Initial Version 488 ! 489 !> @param[in] td_file file structure 490 !> @param[in] id_varid variable id 491 !> @param[in] id_start index in the variable from which the data values 497 492 !> will be read 498 !> @param[in] id_count :number of indices selected along each dimension493 !> @param[in] id_count number of indices selected along each dimension 499 494 !> @return variable structure 500 495 !------------------------------------------------------------------- 501 !> @code502 496 TYPE(TVAR) FUNCTION iom__read_var_id( td_file, id_varid,& 503 497 & id_start, id_count) … … 519 513 & id_start, id_count) 520 514 CASE DEFAULT 521 CALL logger_error( " READ VAR: can't read variable in file "//&515 CALL logger_error( " IOM READ VAR: can't read variable in file "//& 522 516 & TRIM(td_file%c_name)//" : type unknown " ) 523 517 END SELECT 524 518 525 519 END FUNCTION iom__read_var_id 526 !> @endcode527 520 !------------------------------------------------------------------- 528 521 !> @brief This function read variable value in an opened 529 !> file, given variable name or standard name.</br/> 522 !> file, given variable name or standard name. 523 !> @details 530 524 !> start indices and number of indices selected along each dimension 531 !> could be specify in a 4 dimension table (/'x','y','z','t'/) 532 ! 533 !> @details 525 !> could be specify in a 4 dimension array (/'x','y','z','t'/) 526 !> 534 527 !> look first for variable name. If it doesn't 535 528 !> exist in file, look for variable standard name.<br/> 536 !> If variable name is not present, check variable standard name.<br/> 537 ! 538 !> @author J.Paul 539 !> - Nov, 2013- Initial Version 540 ! 541 !> @param[in] td_file : file structure 542 !> @param[in] cd_name : variable name or standard name 543 !> @param[in] id_start : index in the variable from which the data values 529 ! 530 !> @author J.Paul 531 !> - November, 2013- Initial Version 532 ! 533 !> @param[in] td_file file structure 534 !> @param[in] cd_name variable name or standard name 535 !> @param[in] id_start index in the variable from which the data values 544 536 !> will be read 545 !> @param[in] id_count :number of indices selected along each dimension537 !> @param[in] id_count number of indices selected along each dimension 546 538 !> @return variable structure 547 539 !------------------------------------------------------------------- 548 !> @code549 540 TYPE(TVAR) FUNCTION iom__read_var_name(td_file, cd_name, & 550 541 & id_start, id_count ) … … 552 543 ! Argument 553 544 TYPE(TFILE) , INTENT(IN) :: td_file 554 CHARACTER(LEN=*) , INTENT(IN) , OPTIONAL:: cd_name545 CHARACTER(LEN=*) , INTENT(IN) :: cd_name 555 546 INTEGER(i4) , DIMENSION(:), INTENT(IN), OPTIONAL :: id_start 556 547 INTEGER(i4) , DIMENSION(:), INTENT(IN), OPTIONAL :: id_count 557 !INTEGER(i4), DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_start558 !INTEGER(i4), DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_count559 548 !---------------------------------------------------------------- 560 549 … … 568 557 & id_start, id_count ) 569 558 CASE DEFAULT 570 CALL logger_error( " READ VAR: can't read variable in file "//&559 CALL logger_error( " IOM READ VAR: can't read variable in file "//& 571 560 & TRIM(td_file%c_name)//" : type unknown " ) 572 561 END SELECT 573 562 574 563 END FUNCTION iom__read_var_name 575 !> @endcode576 !-------------------------------------------------------------------577 !> @brief This subroutine fill all variables value in an opened578 !> file.</br/>579 !> start indices and number of indices selected along each dimension580 !> could be specify in a 4 dimension table (/'x','y','z','t'/)581 !582 !> @author J.Paul583 !> - Nov, 2013- Initial Version584 !585 !> @param[inout] td_file : file structure586 !> @param[in] id_start : index in the variable from which the data values587 !> will be read588 !> @param[in] id_count : number of indices selected along each dimension589 !-------------------------------------------------------------------590 !> @code591 SUBROUTINE iom__fill_var_all( td_file, id_start, id_count)592 IMPLICIT NONE593 ! Argument594 TYPE(TFILE), INTENT(INOUT) :: td_file595 INTEGER(i4), DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_start596 INTEGER(i4), DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_count597 !----------------------------------------------------------------598 599 ! open file600 SELECT CASE(TRIM(td_file%c_type))601 CASE('cdf')602 CALL iom_cdf_fill_var(td_file, id_start, id_count)603 CASE('dimg')604 CALL iom_rstdimg_fill_var(td_file, id_start, id_count)605 CASE DEFAULT606 CALL logger_error( " FILL VAR: can't read variable in file "//&607 & TRIM(td_file%c_name)//" : type unknown " )608 END SELECT609 610 END SUBROUTINE iom__fill_var_all611 !> @endcode612 !-------------------------------------------------------------------613 !> @brief This subroutine fill variable value in an opened614 !> file, given variable id.</br/>615 !> start indices and number of indices selected along each dimension616 !> could be specify in a 4 dimension table (/'x','y','z','t'/)617 !618 !> @author J.Paul619 !> - Nov, 2013- Initial Version620 !621 !> @param[inout] td_file : file structure622 !> @param[in] id_varid : variable id623 !> @param[in] id_start : index in the variable from which the data values624 !> will be read625 !> @param[in] id_count : number of indices selected along each dimension626 !-------------------------------------------------------------------627 !> @code628 SUBROUTINE iom__fill_var_id( td_file, id_varid, id_start, id_count)629 IMPLICIT NONE630 ! Argument631 TYPE(TFILE), INTENT(INOUT) :: td_file632 INTEGER(i4), INTENT(IN) :: id_varid633 INTEGER(i4), DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_start634 INTEGER(i4), DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_count635 !----------------------------------------------------------------636 637 ! open file638 SELECT CASE(TRIM(td_file%c_type))639 CASE('cdf')640 CALL iom_cdf_fill_var(td_file, id_varid, id_start, id_count)641 CASE('dimg')642 CALL iom_rstdimg_fill_var(td_file, id_varid, id_start, id_count)643 CASE DEFAULT644 CALL logger_error( " FILL VAR: can't read variable in file "//&645 & TRIM(td_file%c_name)//" : type unknown " )646 END SELECT647 648 END SUBROUTINE iom__fill_var_id649 !> @endcode650 !-------------------------------------------------------------------651 !> @brief This subroutine fill variable value in an opened652 !> file, given variable name or standard name.</br/>653 !> start indices and number of indices selected along each dimension654 !> could be specify in a 4 dimension table (/'x','y','z','t'/)655 !656 !> @details657 !> look first for variable name. If it doesn't658 !> exist in file, look for variable standard name.<br/>659 !> If variable name is not present, check variable standard name.<br/>660 !661 !> @author J.Paul662 !> - Nov, 2013- Initial Version663 !664 !> @param[inout] td_file : file structure665 !> @param[in] cd_name : variable name or standard name666 !> @param[in] id_start : index in the variable from which the data values667 !> will be read668 !> @param[in] id_count : number of indices selected along each dimension669 !-------------------------------------------------------------------670 !> @code671 SUBROUTINE iom__fill_var_name( td_file, cd_name, id_start, id_count )672 IMPLICIT NONE673 ! Argument674 TYPE(TFILE), INTENT(INOUT) :: td_file675 CHARACTER(LEN=*), INTENT(IN) :: cd_name676 INTEGER(i4), DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_start677 INTEGER(i4), DIMENSION(ip_maxdim), INTENT(IN), OPTIONAL :: id_count678 !----------------------------------------------------------------679 680 ! open file681 SELECT CASE(TRIM(td_file%c_type))682 CASE('cdf')683 CALL iom_cdf_fill_var(td_file, cd_name, id_start, id_count )684 CASE('dimg')685 CALL iom_rstdimg_fill_var(td_file, cd_name, id_start, id_count )686 CASE DEFAULT687 CALL logger_error( " FILL VAR: can't read variable in file "//&688 & TRIM(td_file%c_name)//" : type unknown " )689 END SELECT690 691 END SUBROUTINE iom__fill_var_name692 !> @endcode693 564 !------------------------------------------------------------------- 694 565 !> @brief This subroutine write file structure in an opened file. 695 566 ! 696 !> @details 697 ! 698 !> @author J.Paul 699 !> - Nov, 2013- Initial Version 700 ! 701 !> @param[in] td_file : file structure 702 !------------------------------------------------------------------- 703 !> @code 567 !> @author J.Paul 568 !> - November, 2013- Initial Version 569 ! 570 !> @param[in] td_file file structure 571 !------------------------------------------------------------------- 704 572 SUBROUTINE iom_write_file(td_file) 705 573 IMPLICIT NONE … … 715 583 CALL iom_rstdimg_write_file(td_file) 716 584 CASE DEFAULT 717 CALL logger_error( " WRITE: can't write file "//&585 CALL logger_error( " IOM WRITE: can't write file "//& 718 586 & TRIM(td_file%c_name)//" : type unknown " ) 719 587 END SELECT 720 588 721 589 END SUBROUTINE iom_write_file 722 !> @endcode723 ! !-------------------------------------------------------------------724 ! !> @brief This function get sub domain decomposition.725 ! !726 ! !> @details727 ! !728 ! !> @author J.Paul729 ! !> - Nov, 2013- Initial Version730 ! !731 ! !> @param[in] td_file : file structure732 ! !-------------------------------------------------------------------733 ! !> @code734 ! TYPE(TMPP) FUNCTION iom_get_mpp(td_file)735 ! IMPLICIT NONE736 ! ! Argument737 ! TYPE(TFILE), INTENT(INOUT) :: td_file738 ! !----------------------------------------------------------------739 !740 ! ! open file741 ! SELECT CASE(TRIM(td_file%c_type))742 ! CASE('cdf')743 ! iom_get_mpp = iom_cdf_get_mpp(td_file)744 ! CASE('dimg')745 ! iom_get_mpp = iom_rstdimg_get_mpp(td_file)746 ! CASE DEFAULT747 ! CALL logger_error( " WRITE: can't write file "//&748 ! & TRIM(td_file%c_name)//" : type unknown " )749 ! END SELECT750 !751 ! END FUNCTION iom_get_mpp752 ! !> @endcode753 590 END MODULE iom 754 591
Note: See TracChangeset
for help on using the changeset viewer.