Changeset 1669 for LMDZ5/branches/testing/libf/bibio/simple.F90
- Timestamp:
- Oct 16, 2012, 2:41:50 PM (12 years ago)
- Location:
- LMDZ5/branches/testing
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/branches/testing
- Property svn:mergeinfo changed
/LMDZ5/trunk merged: 1629-1633,1635,1637-1659,1666-1668
- Property svn:mergeinfo changed
-
LMDZ5/branches/testing/libf/bibio/simple.F90
r1279 r1669 2 2 module simple 3 3 4 use handle_err_m, only: handle_err 5 4 6 implicit none 5 7 8 private handle_err 9 6 10 contains 7 11 … … 9 13 10 14 use netcdf, only: nf90_open 11 use handle_err_m, only: handle_err12 15 13 16 character(len=*), intent(in):: path … … 36 39 37 40 use netcdf, only: nf90_inq_dimid 38 use handle_err_m, only: handle_err 39 40 integer, intent( in) :: ncid 41 character (len = *), intent( in) :: name 41 42 integer, intent(in) :: ncid 43 character (len = *), intent(in) :: name 42 44 integer, intent(out) :: dimid 43 45 integer, intent(out), optional:: ncerr … … 52 54 ncerr = ncerr_not_opt 53 55 else 54 call handle_err("nf95_inq_dimid ", ncerr_not_opt, ncid)56 call handle_err("nf95_inq_dimid " // name, ncerr_not_opt, ncid) 55 57 end if 56 58 … … 59 61 !************************ 60 62 61 subroutine nf95_inquire_dimension(ncid, dimid, name, len, ncerr)63 subroutine nf95_inquire_dimension(ncid, dimid, name, nclen, ncerr) 62 64 63 65 use netcdf, only: nf90_inquire_dimension 64 use handle_err_m, only: handle_err65 66 66 67 integer, intent( in) :: ncid, dimid 67 68 character (len = *), optional, intent(out) :: name 68 integer, optional, intent(out) :: len69 integer, intent(out), optional:: ncerr 70 71 ! Variable local to the procedure: 72 integer ncerr_not_opt 73 74 !------------------- 75 76 ncerr_not_opt = nf90_inquire_dimension(ncid, dimid, name, len)69 integer, optional, intent(out) :: nclen 70 integer, intent(out), optional:: ncerr 71 72 ! Variable local to the procedure: 73 integer ncerr_not_opt 74 75 !------------------- 76 77 ncerr_not_opt = nf90_inquire_dimension(ncid, dimid, name, nclen) 77 78 if (present(ncerr)) then 78 79 ncerr = ncerr_not_opt … … 88 89 89 90 use netcdf, only: nf90_inq_varid 90 use handle_err_m, only: handle_err91 91 92 92 integer, intent(in) :: ncid 93 character (len = *), intent(in):: name93 character(len=*), intent(in):: name 94 94 integer, intent(out) :: varid 95 95 integer, intent(out), optional:: ncerr … … 115 115 116 116 ! In "nf90_inquire_variable", "dimids" is an assumed-size array. 117 ! This is the classical case of an array the size of which is 117 ! This is not optimal. 118 ! We are in the classical case of an array the size of which is 118 119 ! unknown in the calling procedure, before the call. 119 120 ! Here we use a better solution: a pointer argument array. … … 121 122 122 123 use netcdf, only: nf90_inquire_variable, nf90_max_var_dims 123 use handle_err_m, only: handle_err124 124 125 125 integer, intent(in):: ncid, varid … … 151 151 ncerr = ncerr_not_opt 152 152 else 153 call handle_err("nf95_inquire_variable", ncerr_not_opt, ncid )153 call handle_err("nf95_inquire_variable", ncerr_not_opt, ncid, varid) 154 154 end if 155 155 … … 161 161 162 162 use netcdf, only: nf90_create 163 use handle_err_m, only: handle_err164 163 165 164 character (len = *), intent(in ) :: path … … 186 185 !************************ 187 186 188 subroutine nf95_def_dim(ncid, name, len, dimid, ncerr)187 subroutine nf95_def_dim(ncid, name, nclen, dimid, ncerr) 189 188 190 189 use netcdf, only: nf90_def_dim 191 use handle_err_m, only: handle_err192 190 193 191 integer, intent( in) :: ncid 194 192 character (len = *), intent( in) :: name 195 integer, intent( in) :: len193 integer, intent( in) :: nclen 196 194 integer, intent(out) :: dimid 197 195 integer, intent(out), optional :: ncerr … … 202 200 !------------------- 203 201 204 ncerr_not_opt = nf90_def_dim(ncid, name, len, dimid)205 if (present(ncerr)) then 206 ncerr = ncerr_not_opt 207 else 208 call handle_err("nf95_def_dim ", ncerr_not_opt, ncid)202 ncerr_not_opt = nf90_def_dim(ncid, name, nclen, dimid) 203 if (present(ncerr)) then 204 ncerr = ncerr_not_opt 205 else 206 call handle_err("nf95_def_dim " // name, ncerr_not_opt, ncid) 209 207 end if 210 208 … … 216 214 217 215 use netcdf, only: nf90_redef 218 use handle_err_m, only: handle_err219 216 220 217 integer, intent( in) :: ncid … … 240 237 241 238 use netcdf, only: nf90_enddef 242 use handle_err_m, only: handle_err243 239 244 240 integer, intent( in) :: ncid … … 265 261 266 262 use netcdf, only: nf90_close 267 use handle_err_m, only: handle_err268 263 269 264 integer, intent( in) :: ncid … … 289 284 290 285 use netcdf, only: nf90_copy_att 291 use handle_err_m, only: handle_err292 286 293 287 integer, intent( in):: ncid_in, varid_in … … 305 299 ncerr = ncerr_not_opt 306 300 else 307 call handle_err("nf95_copy_att ", ncerr_not_opt, ncid_out)301 call handle_err("nf95_copy_att " // name, ncerr_not_opt, ncid_out) 308 302 end if 309 303 310 304 end subroutine nf95_copy_att 311 305 306 !*********************** 307 308 subroutine nf95_inquire_attribute(ncid, varid, name, xtype, nclen, attnum, & 309 ncerr) 310 311 use netcdf, only: nf90_inquire_attribute 312 313 integer, intent( in) :: ncid, varid 314 character (len = *), intent( in) :: name 315 integer, intent(out), optional :: xtype, nclen, attnum 316 integer, intent(out), optional:: ncerr 317 318 ! Variable local to the procedure: 319 integer ncerr_not_opt 320 321 !------------------- 322 323 ncerr_not_opt = nf90_inquire_attribute(ncid, varid, name, xtype, nclen, & 324 attnum) 325 if (present(ncerr)) then 326 ncerr = ncerr_not_opt 327 else 328 call handle_err("nf95_inquire_attribute " // name, ncerr_not_opt, & 329 ncid, varid) 330 end if 331 332 end subroutine nf95_inquire_attribute 333 334 !*********************** 335 336 subroutine nf95_inquire(ncid, nDimensions, nVariables, nAttributes, & 337 unlimitedDimId, formatNum, ncerr) 338 339 use netcdf, only: nf90_inquire 340 341 integer, intent( in) :: ncid 342 integer, optional, intent(out) :: nDimensions, nVariables, nAttributes 343 integer, optional, intent(out) :: unlimitedDimId, formatNum 344 integer, intent(out), optional:: ncerr 345 346 ! Variable local to the procedure: 347 integer ncerr_not_opt 348 349 !------------------- 350 351 ncerr_not_opt = nf90_inquire(ncid, nDimensions, nVariables, nAttributes, & 352 unlimitedDimId, formatNum) 353 if (present(ncerr)) then 354 ncerr = ncerr_not_opt 355 else 356 call handle_err("nf95_inquire", ncerr_not_opt, ncid) 357 end if 358 359 end subroutine nf95_inquire 360 312 361 end module simple
Note: See TracChangeset
for help on using the changeset viewer.