- Timestamp:
- Jul 12, 2012, 1:37:16 PM (12 years ago)
- Location:
- LMDZ5/trunk/libf
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/trunk/libf/bibio/netcdf95.F90
r1279 r1635 3 3 4 4 ! Author: Lionel GUEZ 5 6 ! Three criticisms may be made about the Fortran 90 NetCDF interface: 7 8 ! -- NetCDF procedures are usually functions with side effects. 9 ! First, they have "intent(out)" arguments. 10 ! Furthermore, there is obviously data transfer inside the procedures. 11 ! Any data transfer inside a function is considered as a side effect. 12 13 ! -- The caller of a NetCDF procedure usually has to handle the error 14 ! status. NetCDF procedures would be much friendlier if they behaved 15 ! like the Fortran input/output statements. That is, the error status 16 ! should be an optional output argument. 17 ! If the caller does not request the error status and there is an 18 ! error then the NetCDF procedure should produce an error message 19 ! and stop the program. 20 21 ! -- Some procedures use array arguments with assumed size. 22 ! It would be better to use the pointer attribute. 23 24 ! This module produces a NetCDF interface that answers those three 25 ! criticisms for some (not all) procedures. 26 27 ! "nf95_get_att" is more secure than "nf90_get_att" because it 28 ! checks that the "values" argument is long enough and removes the 29 ! null terminator, if any. 30 31 ! This module replaces some of the official NetCDF procedures. 32 ! This module also provides the procedures "handle_err" and "nf95_gw_var". 33 34 ! This module provides only a partial replacement for some generic 35 ! procedures such as "nf90_def_var". 5 ! See: 6 ! http://www.lmd.jussieu.fr/~lglmd/NetCDF95 36 7 37 8 use nf95_def_var_m 38 9 use nf95_put_var_m 10 use nf95_get_var_m 39 11 use nf95_gw_var_m 40 12 use nf95_put_att_m -
LMDZ5/trunk/libf/bibio/nf95_get_att_m.F90
r1279 r1635 1 1 ! $Id$ 2 2 module nf95_get_att_m 3 4 use handle_err_m, only: handle_err 5 use netcdf, only: nf90_get_att, nf90_noerr 6 use simple, only: nf95_inquire_attribute 3 7 4 8 implicit none 5 9 6 10 interface nf95_get_att 7 module procedure nf95_get_att_text 11 module procedure nf95_get_att_text, nf95_get_att_one_FourByteInt 12 13 ! The difference between the specific procedures is the type of 14 ! argument "values". 8 15 end interface 9 16 … … 15 22 subroutine nf95_get_att_text(ncid, varid, name, values, ncerr) 16 23 17 use netcdf, only: nf90_get_att, nf90_inquire_attribute, nf90_noerr18 use handle_err_m, only: handle_err19 20 24 integer, intent( in) :: ncid, varid 21 25 character(len = *), intent( in) :: name … … 23 27 integer, intent(out), optional:: ncerr 24 28 25 ! Variable local to the procedure:29 ! Variables local to the procedure: 26 30 integer ncerr_not_opt 27 31 integer att_len … … 30 34 31 35 ! Check that the length of "values" is large enough: 32 ncerr_not_opt = nf90_inquire_attribute(ncid, varid, name, len=att_len) 33 call handle_err("nf95_get_att_text nf90_inquire_attribute " & 34 // trim(name), ncerr_not_opt, ncid, varid) 35 if (len(values) < att_len) then 36 print *, "nf95_get_att_text" 37 print *, "varid = ", varid 38 print *, "attribute name: ", name 39 print *, 'length of "values" is not large enough' 40 print *, "len(values) = ", len(values) 41 print *, "number of characters in attribute: ", att_len 42 stop 1 36 call nf95_inquire_attribute(ncid, varid, name, nclen=att_len, & 37 ncerr=ncerr_not_opt) 38 if (ncerr_not_opt == nf90_noerr) then 39 if (len(values) < att_len) then 40 print *, "nf95_get_att_text" 41 print *, "varid = ", varid 42 print *, "attribute name: ", name 43 print *, 'length of "values" is not large enough' 44 print *, "len(values) = ", len(values) 45 print *, "number of characters in attribute: ", att_len 46 stop 1 47 end if 43 48 end if 44 49 … … 48 53 ncerr = ncerr_not_opt 49 54 else 50 call handle_err("nf95_get_att_text", ncerr_not_opt, ncid, varid) 55 call handle_err("nf95_get_att_text " // trim(name), ncerr_not_opt, & 56 ncid, varid) 51 57 end if 52 58 … … 58 64 end subroutine nf95_get_att_text 59 65 66 !*********************** 67 68 subroutine nf95_get_att_one_FourByteInt(ncid, varid, name, values, ncerr) 69 70 integer, intent( in) :: ncid, varid 71 character(len = *), intent( in) :: name 72 integer , intent(out) :: values 73 integer, intent(out), optional:: ncerr 74 75 ! Variables local to the procedure: 76 integer ncerr_not_opt 77 integer att_len 78 79 !------------------- 80 81 ! Check that the attribute contains a single value: 82 call nf95_inquire_attribute(ncid, varid, name, nclen=att_len, & 83 ncerr=ncerr_not_opt) 84 if (ncerr_not_opt == nf90_noerr) then 85 if (att_len /= 1) then 86 print *, "nf95_get_att_one_FourByteInt" 87 print *, "varid = ", varid 88 print *, "attribute name: ", name 89 print *, 'the attribute does not contain a single value' 90 print *, "number of values in attribute: ", att_len 91 stop 1 92 end if 93 end if 94 95 ncerr_not_opt = nf90_get_att(ncid, varid, name, values) 96 if (present(ncerr)) then 97 ncerr = ncerr_not_opt 98 else 99 call handle_err("nf95_get_att_one_FourByteInt " // trim(name), & 100 ncerr_not_opt, ncid, varid) 101 end if 102 103 end subroutine nf95_get_att_one_FourByteInt 104 60 105 end module nf95_get_att_m -
LMDZ5/trunk/libf/bibio/nf95_gw_var_m.F90
r1279 r1635 1 1 ! $Id$ 2 2 module nf95_gw_var_m 3 4 use nf95_get_var_m, only: NF95_GET_VAR 5 use simple, only: nf95_inquire_variable, nf95_inquire_dimension 3 6 4 7 implicit none … … 8 11 ! These procedures read a whole NetCDF variable (coordinate or 9 12 ! primary) into an array. 10 ! The difference between the procedures is the rank of the array11 ! a nd the type of Fortran values.13 ! The difference between the procedures is the rank and type of 14 ! argument "values". 12 15 ! The procedures do not check the type of the NetCDF variable. 13 16 14 !!$ module procedure nf95_gw_var_real_1d, nf95_gw_var_real_2d, & 15 !!$ nf95_gw_var_real_3d, nf95_gw_var_real_4d, nf95_gw_var_dble_1d, & 16 !!$ nf95_gw_var_dble_3d, nf95_gw_var_int_1d, nf95_gw_var_int_3d 17 ! Not including double precision procedures in the generic 18 ! interface because we use a compilation option that changes default 19 ! real precision. 17 20 module procedure nf95_gw_var_real_1d, nf95_gw_var_real_2d, & 18 nf95_gw_var_real_3d, nf95_gw_var_real_4d, nf95_gw_var_ int_1d, &19 nf95_gw_var_int_ 3d21 nf95_gw_var_real_3d, nf95_gw_var_real_4d, nf95_gw_var_real_5d, & 22 nf95_gw_var_int_1d, nf95_gw_var_int_3d 20 23 end interface 21 24 … … 29 32 ! Real type, the array has rank 1. 30 33 31 use netcdf, only: NF90_GET_VAR32 use simple, only: nf95_inquire_variable, nf95_inquire_dimension33 use handle_err_m, only: handle_err34 35 34 integer, intent(in):: ncid 36 35 integer, intent(in):: varid … … 38 37 39 38 ! Variables local to the procedure: 40 integer ierr,len41 integer, pointer 39 integer nclen 40 integer, pointer:: dimids(:) 42 41 43 42 !--------------------- … … 46 45 47 46 if (size(dimids) /= 1) then 48 print *, "nf95_gw_var_real_1d: NetCDF variable is not of rank 1" 49 stop 1 50 end if 51 52 call nf95_inquire_dimension(ncid, dimids(1), len=len) 53 deallocate(dimids) ! pointer 54 55 allocate(values(len)) 56 if (len /= 0) then 57 ierr = NF90_GET_VAR(ncid, varid, values) 58 call handle_err("NF90_GET_VAR", ierr, ncid, varid) 59 end if 47 print *, "nf95_gw_var_real_1d:" 48 print *, "varid = ", varid 49 print *, "rank of NetCDF variable is ", size(dimids), ", not 1" 50 stop 1 51 end if 52 53 call nf95_inquire_dimension(ncid, dimids(1), nclen=nclen) 54 deallocate(dimids) ! pointer 55 56 allocate(values(nclen)) 57 if (nclen /= 0) call NF95_GET_VAR(ncid, varid, values) 60 58 61 59 end subroutine nf95_gw_var_real_1d … … 67 65 ! Real type, the array has rank 2. 68 66 69 use netcdf, only: NF90_GET_VAR70 use simple, only: nf95_inquire_variable, nf95_inquire_dimension71 use handle_err_m, only: handle_err72 73 67 integer, intent(in):: ncid 74 68 integer, intent(in):: varid … … 76 70 77 71 ! Variables local to the procedure: 78 integer ierr, len1,len279 integer, pointer 72 integer nclen1, nclen2 73 integer, pointer:: dimids(:) 80 74 81 75 !--------------------- … … 84 78 85 79 if (size(dimids) /= 2) then 86 print *, "nf95_gw_var_real_2d: NetCDF variable is not of rank 2" 87 stop 1 88 end if 89 90 call nf95_inquire_dimension(ncid, dimids(1), len=len1) 91 call nf95_inquire_dimension(ncid, dimids(2), len=len2) 92 deallocate(dimids) ! pointer 93 94 allocate(values(len1, len2)) 95 if (len1 /= 0 .and. len2 /= 0) then 96 ierr = NF90_GET_VAR(ncid, varid, values) 97 call handle_err("NF90_GET_VAR", ierr, ncid, varid) 98 end if 80 print *, "nf95_gw_var_real_2d:" 81 print *, "varid = ", varid 82 print *, "rank of NetCDF variable is ", size(dimids), ", not 2" 83 stop 1 84 end if 85 86 call nf95_inquire_dimension(ncid, dimids(1), nclen=nclen1) 87 call nf95_inquire_dimension(ncid, dimids(2), nclen=nclen2) 88 deallocate(dimids) ! pointer 89 90 allocate(values(nclen1, nclen2)) 91 if (nclen1 /= 0 .and. nclen2 /= 0) call NF95_GET_VAR(ncid, varid, values) 99 92 100 93 end subroutine nf95_gw_var_real_2d … … 106 99 ! Real type, the array has rank 3. 107 100 108 use netcdf, only: NF90_GET_VAR109 use simple, only: nf95_inquire_variable, nf95_inquire_dimension110 use handle_err_m, only: handle_err111 112 101 integer, intent(in):: ncid 113 102 integer, intent(in):: varid … … 115 104 116 105 ! Variables local to the procedure: 117 integer ierr, len1, len2,len3118 integer, pointer 106 integer nclen1, nclen2, nclen3 107 integer, pointer:: dimids(:) 119 108 120 109 !--------------------- … … 123 112 124 113 if (size(dimids) /= 3) then 125 print *, "nf95_gw_var_real_3d: NetCDF variable is not of rank 3" 126 stop 1 127 end if 128 129 call nf95_inquire_dimension(ncid, dimids(1), len=len1) 130 call nf95_inquire_dimension(ncid, dimids(2), len=len2) 131 call nf95_inquire_dimension(ncid, dimids(3), len=len3) 132 deallocate(dimids) ! pointer 133 134 allocate(values(len1, len2, len3)) 135 if (len1 * len2 * len3 /= 0) then 136 ierr = NF90_GET_VAR(ncid, varid, values) 137 call handle_err("NF90_GET_VAR", ierr, ncid, varid) 138 end if 114 print *, "nf95_gw_var_real_3d:" 115 print *, "varid = ", varid 116 print *, "rank of NetCDF variable is ", size(dimids), ", not 3" 117 stop 1 118 end if 119 120 call nf95_inquire_dimension(ncid, dimids(1), nclen=nclen1) 121 call nf95_inquire_dimension(ncid, dimids(2), nclen=nclen2) 122 call nf95_inquire_dimension(ncid, dimids(3), nclen=nclen3) 123 deallocate(dimids) ! pointer 124 125 allocate(values(nclen1, nclen2, nclen3)) 126 if (nclen1 * nclen2 * nclen3 /= 0) call NF95_GET_VAR(ncid, varid, values) 139 127 140 128 end subroutine nf95_gw_var_real_3d … … 146 134 ! Real type, the array has rank 4. 147 135 148 use netcdf, only: NF90_GET_VAR149 use simple, only: nf95_inquire_variable, nf95_inquire_dimension150 use handle_err_m, only: handle_err151 152 136 integer, intent(in):: ncid 153 137 integer, intent(in):: varid … … 155 139 156 140 ! Variables local to the procedure: 157 integer ierr,len_dim(4), i158 integer, pointer 141 integer len_dim(4), i 142 integer, pointer:: dimids(:) 159 143 160 144 !--------------------- … … 163 147 164 148 if (size(dimids) /= 4) then 165 print *, "nf95_gw_var_real_4d: NetCDF variable is not of rank 4" 149 print *, "nf95_gw_var_real_4d:" 150 print *, "varid = ", varid 151 print *, "rank of NetCDF variable is ", size(dimids), ", not 4" 166 152 stop 1 167 153 end if 168 154 169 155 do i = 1, 4 170 call nf95_inquire_dimension(ncid, dimids(i), len=len_dim(i))156 call nf95_inquire_dimension(ncid, dimids(i), nclen=len_dim(i)) 171 157 end do 172 158 deallocate(dimids) ! pointer 173 159 174 160 allocate(values(len_dim(1), len_dim(2), len_dim(3), len_dim(4))) 175 if (all(len_dim /= 0)) then 176 ierr = NF90_GET_VAR(ncid, varid, values) 177 call handle_err("NF90_GET_VAR", ierr, ncid, varid) 178 end if 161 if (all(len_dim /= 0)) call NF95_GET_VAR(ncid, varid, values) 179 162 180 163 end subroutine nf95_gw_var_real_4d … … 182 165 !************************************ 183 166 184 !!$ subroutine nf95_gw_var_dble_1d(ncid, varid, values) 185 !!$ 186 !!$ ! Double precision, the array has rank 1. 187 !!$ 188 !!$ use netcdf, only: NF90_GET_VAR 189 !!$ use simple, only: nf95_inquire_variable, nf95_inquire_dimension 190 !!$ use handle_err_m, only: handle_err 191 !!$ 192 !!$ integer, intent(in):: ncid 193 !!$ integer, intent(in):: varid 194 !!$ double precision, pointer:: values(:) 195 !!$ 196 !!$ ! Variables local to the procedure: 197 !!$ integer ierr, len 198 !!$ integer, pointer :: dimids(:) 199 !!$ 200 !!$ !--------------------- 201 !!$ 202 !!$ call nf95_inquire_variable(ncid, varid, dimids=dimids) 203 !!$ 204 !!$ if (size(dimids) /= 1) then 205 !!$ print *, "nf95_gw_var_dble_1d: NetCDF variable is not of rank 1" 206 !!$ stop 1 207 !!$ end if 208 !!$ 209 !!$ call nf95_inquire_dimension(ncid, dimids(1), len=len) 210 !!$ deallocate(dimids) ! pointer 211 !!$ 212 !!$ allocate(values(len)) 213 !!$ if (len /= 0) then 214 !!$ ierr = NF90_GET_VAR(ncid, varid, values) 215 !!$ call handle_err("NF90_GET_VAR", ierr, ncid, varid) 216 !!$ end if 217 !!$ 218 !!$ end subroutine nf95_gw_var_dble_1d 219 !!$ 220 !!$ !************************************ 221 !!$ 222 !!$ subroutine nf95_gw_var_dble_3d(ncid, varid, values) 223 !!$ 224 !!$ ! Double precision, the array has rank 3. 225 !!$ 226 !!$ use netcdf, only: NF90_GET_VAR 227 !!$ use simple, only: nf95_inquire_variable, nf95_inquire_dimension 228 !!$ use handle_err_m, only: handle_err 229 !!$ 230 !!$ integer, intent(in):: ncid 231 !!$ integer, intent(in):: varid 232 !!$ double precision, pointer:: values(:, :, :) 233 !!$ 234 !!$ ! Variables local to the procedure: 235 !!$ integer ierr, len1, len2, len3 236 !!$ integer, pointer :: dimids(:) 237 !!$ 238 !!$ !--------------------- 239 !!$ 240 !!$ call nf95_inquire_variable(ncid, varid, dimids=dimids) 241 !!$ 242 !!$ if (size(dimids) /= 3) then 243 !!$ print *, "nf95_gw_var_dble_3d: NetCDF variable is not of rank 3" 244 !!$ stop 1 245 !!$ end if 246 !!$ 247 !!$ call nf95_inquire_dimension(ncid, dimids(1), len=len1) 248 !!$ call nf95_inquire_dimension(ncid, dimids(2), len=len2) 249 !!$ call nf95_inquire_dimension(ncid, dimids(3), len=len3) 250 !!$ deallocate(dimids) ! pointer 251 !!$ 252 !!$ allocate(values(len1, len2, len3)) 253 !!$ if (len1 * len2 * len3 /= 0) then 254 !!$ ierr = NF90_GET_VAR(ncid, varid, values) 255 !!$ call handle_err("NF90_GET_VAR", ierr, ncid, varid) 256 !!$ end if 257 !!$ 258 !!$ end subroutine nf95_gw_var_dble_3d 167 subroutine nf95_gw_var_real_5d(ncid, varid, values) 168 169 ! Real type, the array has rank 5. 170 171 integer, intent(in):: ncid 172 integer, intent(in):: varid 173 real, pointer:: values(:, :, :, :, :) 174 175 ! Variables local to the procedure: 176 integer len_dim(5), i 177 integer, pointer:: dimids(:) 178 179 !--------------------- 180 181 call nf95_inquire_variable(ncid, varid, dimids=dimids) 182 183 if (size(dimids) /= 5) then 184 print *, "nf95_gw_var_real_5d:" 185 print *, "varid = ", varid 186 print *, "rank of NetCDF variable is ", size(dimids), ", not 5" 187 stop 1 188 end if 189 190 do i = 1, 5 191 call nf95_inquire_dimension(ncid, dimids(i), nclen=len_dim(i)) 192 end do 193 deallocate(dimids) ! pointer 194 195 allocate(values(len_dim(1), len_dim(2), len_dim(3), len_dim(4), len_dim(5))) 196 if (all(len_dim /= 0)) call NF95_GET_VAR(ncid, varid, values) 197 198 end subroutine nf95_gw_var_real_5d 199 200 !************************************ 201 202 subroutine nf95_gw_var_dble_1d(ncid, varid, values) 203 204 ! Double precision, the array has rank 1. 205 206 integer, intent(in):: ncid 207 integer, intent(in):: varid 208 double precision, pointer:: values(:) 209 210 ! Variables local to the procedure: 211 integer nclen 212 integer, pointer:: dimids(:) 213 214 !--------------------- 215 216 call nf95_inquire_variable(ncid, varid, dimids=dimids) 217 218 if (size(dimids) /= 1) then 219 print *, "nf95_gw_var_dble_1d:" 220 print *, "varid = ", varid 221 print *, "rank of NetCDF variable is ", size(dimids), ", not 1" 222 stop 1 223 end if 224 225 call nf95_inquire_dimension(ncid, dimids(1), nclen=nclen) 226 deallocate(dimids) ! pointer 227 228 allocate(values(nclen)) 229 if (nclen /= 0) call NF95_GET_VAR(ncid, varid, values) 230 231 end subroutine nf95_gw_var_dble_1d 232 233 !************************************ 234 235 subroutine nf95_gw_var_dble_3d(ncid, varid, values) 236 237 ! Double precision, the array has rank 3. 238 239 integer, intent(in):: ncid 240 integer, intent(in):: varid 241 double precision, pointer:: values(:, :, :) 242 243 ! Variables local to the procedure: 244 integer nclen1, nclen2, nclen3 245 integer, pointer:: dimids(:) 246 247 !--------------------- 248 249 call nf95_inquire_variable(ncid, varid, dimids=dimids) 250 251 if (size(dimids) /= 3) then 252 print *, "nf95_gw_var_dble_3d:" 253 print *, "varid = ", varid 254 print *, "rank of NetCDF variable is ", size(dimids), ", not 3" 255 stop 1 256 end if 257 258 call nf95_inquire_dimension(ncid, dimids(1), nclen=nclen1) 259 call nf95_inquire_dimension(ncid, dimids(2), nclen=nclen2) 260 call nf95_inquire_dimension(ncid, dimids(3), nclen=nclen3) 261 deallocate(dimids) ! pointer 262 263 allocate(values(nclen1, nclen2, nclen3)) 264 if (nclen1 * nclen2 * nclen3 /= 0) call NF95_GET_VAR(ncid, varid, values) 265 266 end subroutine nf95_gw_var_dble_3d 259 267 260 268 !************************************ … … 264 272 ! Integer type, the array has rank 1. 265 273 266 use netcdf, only: NF90_GET_VAR267 use simple, only: nf95_inquire_variable, nf95_inquire_dimension268 use handle_err_m, only: handle_err269 270 274 integer, intent(in):: ncid 271 275 integer, intent(in):: varid … … 273 277 274 278 ! Variables local to the procedure: 275 integer ierr,len276 integer, pointer 279 integer nclen 280 integer, pointer:: dimids(:) 277 281 278 282 !--------------------- … … 281 285 282 286 if (size(dimids) /= 1) then 283 print *, "nf95_gw_var_int_1d: NetCDF variable is not of rank 1" 284 stop 1 285 end if 286 287 call nf95_inquire_dimension(ncid, dimids(1), len=len) 288 deallocate(dimids) ! pointer 289 290 allocate(values(len)) 291 if (len /= 0) then 292 ierr = NF90_GET_VAR(ncid, varid, values) 293 call handle_err("NF90_GET_VAR", ierr, ncid, varid) 294 end if 287 print *, "nf95_gw_var_int_1d:" 288 print *, "varid = ", varid 289 print *, "rank of NetCDF variable is ", size(dimids), ", not 1" 290 stop 1 291 end if 292 293 call nf95_inquire_dimension(ncid, dimids(1), nclen=nclen) 294 deallocate(dimids) ! pointer 295 296 allocate(values(nclen)) 297 if (nclen /= 0) call NF95_GET_VAR(ncid, varid, values) 295 298 296 299 end subroutine nf95_gw_var_int_1d … … 302 305 ! Integer type, the array has rank 3. 303 306 304 use netcdf, only: NF90_GET_VAR305 use simple, only: nf95_inquire_variable, nf95_inquire_dimension306 use handle_err_m, only: handle_err307 308 307 integer, intent(in):: ncid 309 308 integer, intent(in):: varid … … 311 310 312 311 ! Variables local to the procedure: 313 integer ierr, len1, len2,len3314 integer, pointer 312 integer nclen1, nclen2, nclen3 313 integer, pointer:: dimids(:) 315 314 316 315 !--------------------- … … 319 318 320 319 if (size(dimids) /= 3) then 321 print *, "nf95_gw_var_int_3d: NetCDF variable is not of rank 3" 322 stop 1 323 end if 324 325 call nf95_inquire_dimension(ncid, dimids(1), len=len1) 326 call nf95_inquire_dimension(ncid, dimids(2), len=len2) 327 call nf95_inquire_dimension(ncid, dimids(3), len=len3) 328 deallocate(dimids) ! pointer 329 330 allocate(values(len1, len2, len3)) 331 if (len1 * len2 * len3 /= 0) then 332 ierr = NF90_GET_VAR(ncid, varid, values) 333 call handle_err("NF90_GET_VAR", ierr, ncid, varid) 334 end if 320 print *, "nf95_gw_var_int_3d:" 321 print *, "varid = ", varid 322 print *, "rank of NetCDF variable is ", size(dimids), ", not 3" 323 stop 1 324 end if 325 326 call nf95_inquire_dimension(ncid, dimids(1), nclen=nclen1) 327 call nf95_inquire_dimension(ncid, dimids(2), nclen=nclen2) 328 call nf95_inquire_dimension(ncid, dimids(3), nclen=nclen3) 329 deallocate(dimids) ! pointer 330 331 allocate(values(nclen1, nclen2, nclen3)) 332 if (nclen1 * nclen2 * nclen3 /= 0) call NF95_GET_VAR(ncid, varid, values) 335 333 336 334 end subroutine nf95_gw_var_int_3d -
LMDZ5/trunk/libf/bibio/nf95_put_var_m.F90
r1279 r1635 9 9 nf95_put_var_2D_FourByteReal, nf95_put_var_3D_FourByteReal, & 10 10 nf95_put_var_4D_FourByteReal 11 !!$ module procedure nf95_put_var_1D_FourByteReal, &12 !!$ nf95_put_var_2D_FourByteReal, nf95_put_var_3D_FourByteReal, &13 !!$ nf95_put_var_4D_FourByteReal, nf90_put_var_1D_EightByteReal, &14 !!$ nf90_put_var_3D_EightByteReal15 11 end interface 16 12 … … 25 21 use handle_err_m, only: handle_err 26 22 27 integer, intent( 28 real, intent( 29 integer, dimension(:), optional, intent( 23 integer, intent(in) :: ncid, varid 24 real, intent(in) :: values 25 integer, dimension(:), optional, intent(in) :: start 30 26 integer, intent(out), optional:: ncerr 31 27 … … 52 48 use handle_err_m, only: handle_err 53 49 54 integer, intent( 55 integer, intent( 56 integer, dimension(:), optional, intent( 50 integer, intent(in) :: ncid, varid 51 integer, intent(in) :: values 52 integer, dimension(:), optional, intent(in) :: start 57 53 integer, intent(out), optional:: ncerr 58 54 … … 74 70 !*********************** 75 71 76 subroutine nf95_put_var_1D_FourByteReal(ncid, varid, values, start, count,&77 stride, map, ncerr)72 subroutine nf95_put_var_1D_FourByteReal(ncid, varid, values, start, & 73 count_nc, stride, map, ncerr) 78 74 79 75 use netcdf, only: nf90_put_var … … 82 78 integer, intent(in) :: ncid, varid 83 79 real, intent(in) :: values(:) 84 integer, dimension(:), optional, intent(in) :: start, count , stride, map85 integer, intent(out), optional:: ncerr 86 87 ! Variable local to the procedure: 88 integer ncerr_not_opt 89 90 !------------------- 91 92 ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count , stride, &93 map)80 integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map 81 integer, intent(out), optional:: ncerr 82 83 ! Variable local to the procedure: 84 integer ncerr_not_opt 85 86 !------------------- 87 88 ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, & 89 stride, map) 94 90 if (present(ncerr)) then 95 91 ncerr = ncerr_not_opt … … 103 99 !*********************** 104 100 105 subroutine nf95_put_var_1D_FourByteInt(ncid, varid, values, start, count,&106 stride, map, ncerr)101 subroutine nf95_put_var_1D_FourByteInt(ncid, varid, values, start, & 102 count_nc, stride, map, ncerr) 107 103 108 104 use netcdf, only: nf90_put_var … … 111 107 integer, intent(in) :: ncid, varid 112 108 integer, intent(in) :: values(:) 113 integer, dimension(:), optional, intent(in) :: start, count , stride, map114 integer, intent(out), optional:: ncerr 115 116 ! Variable local to the procedure: 117 integer ncerr_not_opt 118 119 !------------------- 120 121 ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count , stride, &122 map)109 integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map 110 integer, intent(out), optional:: ncerr 111 112 ! Variable local to the procedure: 113 integer ncerr_not_opt 114 115 !------------------- 116 117 ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, & 118 stride, map) 123 119 if (present(ncerr)) then 124 120 ncerr = ncerr_not_opt … … 132 128 !*********************** 133 129 134 subroutine nf95_put_var_2D_FourByteReal(ncid, varid, values, start, count, & 135 stride, map, ncerr) 136 137 use netcdf, only: nf90_put_var 138 use handle_err_m, only: handle_err 139 140 integer, intent( in) :: ncid, varid 141 real, intent( in) :: values(:, :) 142 integer, dimension(:), optional, intent( in) :: start, count, stride, map 143 integer, intent(out), optional:: ncerr 144 145 ! Variable local to the procedure: 146 integer ncerr_not_opt 147 148 !------------------- 149 150 ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, & 151 map) 130 subroutine nf95_put_var_1D_EightByteReal(ncid, varid, values, start, & 131 count_nc, stride, map, ncerr) 132 133 use typesizes, only: eightByteReal 134 use netcdf, only: nf90_put_var 135 use handle_err_m, only: handle_err 136 137 integer, intent(in) :: ncid, varid 138 real (kind = EightByteReal), intent(in) :: values(:) 139 integer, dimension(:), optional, intent(in):: start, count_nc, stride, map 140 integer, intent(out), optional:: ncerr 141 142 ! Variable local to the procedure: 143 integer ncerr_not_opt 144 145 !------------------- 146 147 ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, & 148 stride, map) 149 if (present(ncerr)) then 150 ncerr = ncerr_not_opt 151 else 152 call handle_err("nf95_put_var_1D_eightByteReal", ncerr_not_opt, ncid, & 153 varid) 154 end if 155 156 end subroutine nf95_put_var_1D_EightByteReal 157 158 !*********************** 159 160 subroutine nf95_put_var_2D_FourByteReal(ncid, varid, values, start, & 161 count_nc, stride, map, ncerr) 162 163 use netcdf, only: nf90_put_var 164 use handle_err_m, only: handle_err 165 166 integer, intent(in) :: ncid, varid 167 real, intent(in) :: values(:, :) 168 integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map 169 integer, intent(out), optional:: ncerr 170 171 ! Variable local to the procedure: 172 integer ncerr_not_opt 173 174 !------------------- 175 176 ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, & 177 stride, map) 152 178 if (present(ncerr)) then 153 179 ncerr = ncerr_not_opt … … 161 187 !*********************** 162 188 163 subroutine nf95_put_var_3D_FourByteReal(ncid, varid, values, start, count, & 164 stride, map, ncerr) 165 166 use netcdf, only: nf90_put_var 167 use handle_err_m, only: handle_err 168 169 integer, intent( in) :: ncid, varid 170 real, intent( in) :: values(:, :, :) 171 integer, dimension(:), optional, intent( in) :: start, count, stride, map 172 integer, intent(out), optional:: ncerr 173 174 ! Variable local to the procedure: 175 integer ncerr_not_opt 176 177 !------------------- 178 179 ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, & 180 map) 189 subroutine nf95_put_var_2D_EightByteReal(ncid, varid, values, start, & 190 count_nc, stride, map, ncerr) 191 192 use typesizes, only: EightByteReal 193 use netcdf, only: nf90_put_var 194 use handle_err_m, only: handle_err 195 196 integer, intent(in) :: ncid, varid 197 real (kind = EightByteReal), intent(in) :: values(:, :) 198 integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map 199 integer, intent(out), optional:: ncerr 200 201 ! Variable local to the procedure: 202 integer ncerr_not_opt 203 204 !------------------- 205 206 ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, & 207 stride, map) 208 if (present(ncerr)) then 209 ncerr = ncerr_not_opt 210 else 211 call handle_err("nf95_put_var_2D_EightByteReal", ncerr_not_opt, ncid, & 212 varid) 213 end if 214 215 end subroutine nf95_put_var_2D_EightByteReal 216 217 !*********************** 218 219 subroutine nf95_put_var_3D_FourByteReal(ncid, varid, values, start, & 220 count_nc, stride, map, ncerr) 221 222 use netcdf, only: nf90_put_var 223 use handle_err_m, only: handle_err 224 225 integer, intent(in) :: ncid, varid 226 real, intent(in) :: values(:, :, :) 227 integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map 228 integer, intent(out), optional:: ncerr 229 230 ! Variable local to the procedure: 231 integer ncerr_not_opt 232 233 !------------------- 234 235 ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, & 236 stride, map) 181 237 if (present(ncerr)) then 182 238 ncerr = ncerr_not_opt … … 190 246 !*********************** 191 247 192 subroutine nf95_put_var_4D_FourByteReal(ncid, varid, values, start, count, & 193 stride, map, ncerr) 194 195 use netcdf, only: nf90_put_var 196 use handle_err_m, only: handle_err 197 198 integer, intent( in) :: ncid, varid 199 real, intent( in) :: values(:, :, :, :) 200 integer, dimension(:), optional, intent( in) :: start, count, stride, map 201 integer, intent(out), optional:: ncerr 202 203 ! Variable local to the procedure: 204 integer ncerr_not_opt 205 206 !------------------- 207 208 ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, & 209 map) 248 subroutine nf95_put_var_3D_EightByteReal(ncid, varid, values, start, & 249 count_nc, stride, map, ncerr) 250 251 use typesizes, only: eightByteReal 252 use netcdf, only: nf90_put_var 253 use handle_err_m, only: handle_err 254 255 integer, intent(in) :: ncid, varid 256 real (kind = EightByteReal), intent(in) :: values(:, :, :) 257 integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map 258 integer, intent(out), optional:: ncerr 259 260 ! Variable local to the procedure: 261 integer ncerr_not_opt 262 263 !------------------- 264 265 ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, & 266 stride, map) 267 if (present(ncerr)) then 268 ncerr = ncerr_not_opt 269 else 270 call handle_err("nf95_put_var_3D_eightByteReal", ncerr_not_opt, ncid, & 271 varid) 272 end if 273 274 end subroutine nf95_put_var_3D_EightByteReal 275 276 !*********************** 277 278 subroutine nf95_put_var_4D_FourByteReal(ncid, varid, values, start, & 279 count_nc, stride, map, ncerr) 280 281 use netcdf, only: nf90_put_var 282 use handle_err_m, only: handle_err 283 284 integer, intent(in) :: ncid, varid 285 real, intent(in) :: values(:, :, :, :) 286 integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map 287 integer, intent(out), optional:: ncerr 288 289 ! Variable local to the procedure: 290 integer ncerr_not_opt 291 292 !------------------- 293 294 ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, & 295 stride, map) 210 296 if (present(ncerr)) then 211 297 ncerr = ncerr_not_opt … … 219 305 !*********************** 220 306 221 !!$ subroutine nf90_put_var_1D_EightByteReal(ncid, varid, values, start, count, & 222 !!$ stride, map, ncerr) 223 !!$ 224 !!$ use typesizes, only: eightByteReal 225 !!$ use netcdf, only: nf90_put_var 226 !!$ use handle_err_m, only: handle_err 227 !!$ 228 !!$ integer, intent( in) :: ncid, varid 229 !!$ real (kind = EightByteReal), intent( in) :: values(:) 230 !!$ integer, dimension(:), optional, intent( in) :: start, count, stride, map 231 !!$ integer, intent(out), optional:: ncerr 232 !!$ 233 !!$ ! Variable local to the procedure: 234 !!$ integer ncerr_not_opt 235 !!$ 236 !!$ !------------------- 237 !!$ 238 !!$ ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, & 239 !!$ map) 240 !!$ if (present(ncerr)) then 241 !!$ ncerr = ncerr_not_opt 242 !!$ else 243 !!$ call handle_err("nf95_put_var_1D_eightByteReal", ncerr_not_opt, ncid, & 244 !!$ varid) 245 !!$ end if 246 !!$ 247 !!$ end subroutine nf90_put_var_1D_EightByteReal 248 !!$ 249 !!$ !*********************** 250 !!$ 251 !!$ subroutine nf90_put_var_3D_EightByteReal(ncid, varid, values, start, count, & 252 !!$ stride, map, ncerr) 253 !!$ 254 !!$ use typesizes, only: eightByteReal 255 !!$ use netcdf, only: nf90_put_var 256 !!$ use handle_err_m, only: handle_err 257 !!$ 258 !!$ integer, intent( in) :: ncid, varid 259 !!$ real (kind = EightByteReal), intent( in) :: values(:, :, :) 260 !!$ integer, dimension(:), optional, intent( in) :: start, count, stride, map 261 !!$ integer, intent(out), optional:: ncerr 262 !!$ 263 !!$ ! Variable local to the procedure: 264 !!$ integer ncerr_not_opt 265 !!$ 266 !!$ !------------------- 267 !!$ 268 !!$ ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, & 269 !!$ map) 270 !!$ if (present(ncerr)) then 271 !!$ ncerr = ncerr_not_opt 272 !!$ else 273 !!$ call handle_err("nf95_put_var_3D_eightByteReal", ncerr_not_opt, ncid, & 274 !!$ varid) 275 !!$ end if 276 !!$ 277 !!$ end subroutine nf90_put_var_3D_EightByteReal 307 subroutine nf95_put_var_4D_EightByteReal(ncid, varid, values, start, & 308 count_nc, stride, map, ncerr) 309 310 use typesizes, only: EightByteReal 311 use netcdf, only: nf90_put_var 312 use handle_err_m, only: handle_err 313 314 integer, intent(in):: ncid, varid 315 real(kind = EightByteReal), intent(in):: values(:, :, :, :) 316 integer, dimension(:), optional, intent(in):: start, count_nc, stride, map 317 integer, intent(out), optional:: ncerr 318 319 ! Variable local to the procedure: 320 integer ncerr_not_opt 321 322 !------------------- 323 324 ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, & 325 stride, map) 326 if (present(ncerr)) then 327 ncerr = ncerr_not_opt 328 else 329 call handle_err("nf95_put_var_4D_EightByteReal", ncerr_not_opt, ncid, & 330 varid) 331 end if 332 333 end subroutine nf95_put_var_4D_EightByteReal 278 334 279 335 end module nf95_put_var_m -
LMDZ5/trunk/libf/bibio/simple.F90
r1279 r1635 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 -
LMDZ5/trunk/libf/dyn3d/dynetat0.F
r1577 r1635 6 6 7 7 USE infotrac 8 use netcdf, only: nf90_get_var 8 9 IMPLICIT NONE 9 10 … … 28 29 #include "comconst.h" 29 30 #include "comvert.h" 30 #include "comgeom .h"31 #include "comgeom2.h" 31 32 #include "ener.h" 32 33 #include "netcdf.inc" … … 40 41 41 42 CHARACTER*(*) fichnom 42 REAL vcov(i p1jm,llm),ucov(ip1jmp1,llm),teta(ip1jmp1,llm)43 REAL q(i p1jmp1,llm,nqtot),masse(ip1jmp1,llm)44 REAL ps(i p1jmp1),phis(ip1jmp1)43 REAL vcov(iip1, jjm,llm),ucov(iip1, jjp1,llm),teta(iip1, jjp1,llm) 44 REAL q(iip1,jjp1,llm,nqtot),masse(iip1, jjp1,llm) 45 REAL ps(iip1, jjp1),phis(iip1, jjp1) 45 46 46 47 REAL time … … 70 71 CALL abort 71 72 ENDIF 72 #ifdef NC_DOUBLE 73 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tab_cntrl) 74 #else 75 ierr = NF_GET_VAR_REAL(nid, nvarid, tab_cntrl) 76 #endif 73 ierr = nf90_get_var(nid, nvarid, tab_cntrl) 77 74 IF (ierr .NE. NF_NOERR) THEN 78 75 write(lunout,*)"dynetat0: Lecture echoue pour <controle>" … … 142 139 CALL abort 143 140 ENDIF 144 #ifdef NC_DOUBLE 145 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlonu) 146 #else 147 ierr = NF_GET_VAR_REAL(nid, nvarid, rlonu) 148 #endif 141 ierr = nf90_get_var(nid, nvarid, rlonu) 149 142 IF (ierr .NE. NF_NOERR) THEN 150 143 write(lunout,*)"dynetat0: Lecture echouee pour <rlonu>" … … 157 150 CALL abort 158 151 ENDIF 159 #ifdef NC_DOUBLE 160 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlatu) 161 #else 162 ierr = NF_GET_VAR_REAL(nid, nvarid, rlatu) 163 #endif 152 ierr = nf90_get_var(nid, nvarid, rlatu) 164 153 IF (ierr .NE. NF_NOERR) THEN 165 154 write(lunout,*)"dynetat0: Lecture echouee pour <rlatu>" … … 172 161 CALL abort 173 162 ENDIF 174 #ifdef NC_DOUBLE 175 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlonv) 176 #else 177 ierr = NF_GET_VAR_REAL(nid, nvarid, rlonv) 178 #endif 163 ierr = nf90_get_var(nid, nvarid, rlonv) 179 164 IF (ierr .NE. NF_NOERR) THEN 180 165 write(lunout,*)"dynetat0: Lecture echouee pour <rlonv>" … … 187 172 CALL abort 188 173 ENDIF 189 #ifdef NC_DOUBLE 190 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlatv) 191 #else 192 ierr = NF_GET_VAR_REAL(nid, nvarid, rlatv) 193 #endif 174 ierr = nf90_get_var(nid, nvarid, rlatv) 194 175 IF (ierr .NE. NF_NOERR) THEN 195 176 write(lunout,*)"dynetat0: Lecture echouee pour rlatv" … … 202 183 CALL abort 203 184 ENDIF 204 #ifdef NC_DOUBLE 205 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, cu) 206 #else 207 ierr = NF_GET_VAR_REAL(nid, nvarid, cu) 208 #endif 185 ierr = nf90_get_var(nid, nvarid, cu) 209 186 IF (ierr .NE. NF_NOERR) THEN 210 187 write(lunout,*)"dynetat0: Lecture echouee pour <cu>" … … 217 194 CALL abort 218 195 ENDIF 219 #ifdef NC_DOUBLE 220 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, cv) 221 #else 222 ierr = NF_GET_VAR_REAL(nid, nvarid, cv) 223 #endif 196 ierr = nf90_get_var(nid, nvarid, cv) 224 197 IF (ierr .NE. NF_NOERR) THEN 225 198 write(lunout,*)"dynetat0: Lecture echouee pour <cv>" … … 232 205 CALL abort 233 206 ENDIF 234 #ifdef NC_DOUBLE 235 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, aire) 236 #else 237 ierr = NF_GET_VAR_REAL(nid, nvarid, aire) 238 #endif 207 ierr = nf90_get_var(nid, nvarid, aire) 239 208 IF (ierr .NE. NF_NOERR) THEN 240 209 write(lunout,*)"dynetat0: Lecture echouee pour <aire>" … … 247 216 CALL abort 248 217 ENDIF 249 #ifdef NC_DOUBLE 250 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, phis) 251 #else 252 ierr = NF_GET_VAR_REAL(nid, nvarid, phis) 253 #endif 218 ierr = nf90_get_var(nid, nvarid, phis) 254 219 IF (ierr .NE. NF_NOERR) THEN 255 220 write(lunout,*)"dynetat0: Lecture echouee pour <phisinit>" … … 262 227 CALL abort 263 228 ENDIF 264 #ifdef NC_DOUBLE 265 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, time) 266 #else 267 ierr = NF_GET_VAR_REAL(nid, nvarid, time) 268 #endif 229 ierr = nf90_get_var(nid, nvarid, time) 269 230 IF (ierr .NE. NF_NOERR) THEN 270 231 write(lunout,*)"dynetat0: Lecture echouee <temps>" … … 277 238 CALL abort 278 239 ENDIF 279 #ifdef NC_DOUBLE 280 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, ucov) 281 #else 282 ierr = NF_GET_VAR_REAL(nid, nvarid, ucov) 283 #endif 240 ierr = nf90_get_var(nid, nvarid, ucov) 284 241 IF (ierr .NE. NF_NOERR) THEN 285 242 write(lunout,*)"dynetat0: Lecture echouee pour <ucov>" … … 292 249 CALL abort 293 250 ENDIF 294 #ifdef NC_DOUBLE 295 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, vcov) 296 #else 297 ierr = NF_GET_VAR_REAL(nid, nvarid, vcov) 298 #endif 251 ierr = nf90_get_var(nid, nvarid, vcov) 299 252 IF (ierr .NE. NF_NOERR) THEN 300 253 write(lunout,*)"dynetat0: Lecture echouee pour <vcov>" … … 307 260 CALL abort 308 261 ENDIF 309 #ifdef NC_DOUBLE 310 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, teta) 311 #else 312 ierr = NF_GET_VAR_REAL(nid, nvarid, teta) 313 #endif 262 ierr = nf90_get_var(nid, nvarid, teta) 314 263 IF (ierr .NE. NF_NOERR) THEN 315 264 write(lunout,*)"dynetat0: Lecture echouee pour <teta>" … … 325 274 & "> est absent" 326 275 write(lunout,*)" Il est donc initialise a zero" 327 q(:,:, iq)=0.276 q(:,:,:,iq)=0. 328 277 ELSE 329 #ifdef NC_DOUBLE 330 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, q(1,1,iq)) 331 #else 332 ierr = NF_GET_VAR_REAL(nid, nvarid, q(1,1,iq)) 333 #endif 278 ierr = NF90_GET_VAR(nid, nvarid, q(:,:,:,iq)) 334 279 IF (ierr .NE. NF_NOERR) THEN 335 280 write(lunout,*)"dynetat0: Lecture echouee pour "//tname(iq) … … 345 290 CALL abort 346 291 ENDIF 347 #ifdef NC_DOUBLE 348 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, masse) 349 #else 350 ierr = NF_GET_VAR_REAL(nid, nvarid, masse) 351 #endif 292 ierr = nf90_get_var(nid, nvarid, masse) 352 293 IF (ierr .NE. NF_NOERR) THEN 353 294 write(lunout,*)"dynetat0: Lecture echouee pour <masse>" … … 360 301 CALL abort 361 302 ENDIF 362 #ifdef NC_DOUBLE 363 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, ps) 364 #else 365 ierr = NF_GET_VAR_REAL(nid, nvarid, ps) 366 #endif 303 ierr = nf90_get_var(nid, nvarid, ps) 367 304 IF (ierr .NE. NF_NOERR) THEN 368 305 write(lunout,*)"dynetat0: Lecture echouee pour <ps>" -
LMDZ5/trunk/libf/dyn3d/dynredem.F
r1577 r1635 8 8 #endif 9 9 USE infotrac 10 use netcdf95, only: NF95_PUT_VAR 10 11 11 12 IMPLICIT NONE … … 19 20 #include "comconst.h" 20 21 #include "comvert.h" 21 #include "comgeom .h"22 #include "comgeom2.h" 22 23 #include "temps.h" 23 24 #include "ener.h" … … 31 32 c ---------- 32 33 INTEGER iday_end 33 REAL phis(i p1jmp1)34 REAL phis(iip1, jjp1) 34 35 CHARACTER*(*) fichnom 35 36 … … 166 167 . "Parametres de controle") 167 168 ierr = NF_ENDDEF(nid) 168 #ifdef NC_DOUBLE 169 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) 170 #else 171 ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) 172 #endif 169 call NF95_PUT_VAR(nid,nvarid,tab_cntrl) 173 170 c 174 171 ierr = NF_REDEF (nid) … … 183 180 . "Longitudes des points U") 184 181 ierr = NF_ENDDEF(nid) 185 #ifdef NC_DOUBLE 186 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu) 187 #else 188 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu) 189 #endif 182 call NF95_PUT_VAR(nid,nvarid,rlonu) 190 183 c 191 184 ierr = NF_REDEF (nid) … … 200 193 . "Latitudes des points U") 201 194 ierr = NF_ENDDEF(nid) 202 #ifdef NC_DOUBLE 203 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu) 204 #else 205 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu) 206 #endif 195 call NF95_PUT_VAR (nid,nvarid,rlatu) 207 196 c 208 197 ierr = NF_REDEF (nid) … … 217 206 . "Longitudes des points V") 218 207 ierr = NF_ENDDEF(nid) 219 #ifdef NC_DOUBLE 220 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv) 221 #else 222 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv) 223 #endif 208 call NF95_PUT_VAR(nid,nvarid,rlonv) 224 209 c 225 210 ierr = NF_REDEF (nid) … … 234 219 . "Latitudes des points V") 235 220 ierr = NF_ENDDEF(nid) 236 #ifdef NC_DOUBLE 237 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv) 238 #else 239 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv) 240 #endif 221 call NF95_PUT_VAR(nid,nvarid,rlatv) 241 222 c 242 223 ierr = NF_REDEF (nid) … … 251 232 . "Numero naturel des couches s") 252 233 ierr = NF_ENDDEF(nid) 253 #ifdef NC_DOUBLE 254 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsigs) 255 #else 256 ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsigs) 257 #endif 234 call NF95_PUT_VAR(nid,nvarid,nivsigs) 258 235 c 259 236 ierr = NF_REDEF (nid) … … 268 245 . "Numero naturel des couches sigma") 269 246 ierr = NF_ENDDEF(nid) 270 #ifdef NC_DOUBLE 271 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsig) 272 #else 273 ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsig) 274 #endif 247 call NF95_PUT_VAR(nid,nvarid,nivsig) 275 248 c 276 249 ierr = NF_REDEF (nid) … … 285 258 . "Coefficient A pour hybride") 286 259 ierr = NF_ENDDEF(nid) 287 #ifdef NC_DOUBLE 288 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ap) 289 #else 290 ierr = NF_PUT_VAR_REAL (nid,nvarid,ap) 291 #endif 260 call NF95_PUT_VAR(nid,nvarid,ap) 292 261 c 293 262 ierr = NF_REDEF (nid) … … 302 271 . "Coefficient B pour hybride") 303 272 ierr = NF_ENDDEF(nid) 304 #ifdef NC_DOUBLE 305 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bp) 306 #else 307 ierr = NF_PUT_VAR_REAL (nid,nvarid,bp) 308 #endif 273 call NF95_PUT_VAR(nid,nvarid,bp) 309 274 c 310 275 ierr = NF_REDEF (nid) … … 317 282 cIM 220306 END 318 283 ierr = NF_ENDDEF(nid) 319 #ifdef NC_DOUBLE 320 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,presnivs) 321 #else 322 ierr = NF_PUT_VAR_REAL (nid,nvarid,presnivs) 323 #endif 284 call NF95_PUT_VAR(nid,nvarid,presnivs) 324 285 c 325 286 c Coefficients de passage cov. <-> contra. <--> naturel … … 338 299 . "Coefficient de passage pour U") 339 300 ierr = NF_ENDDEF(nid) 340 #ifdef NC_DOUBLE 341 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu) 342 #else 343 ierr = NF_PUT_VAR_REAL (nid,nvarid,cu) 344 #endif 301 call NF95_PUT_VAR(nid,nvarid,cu) 345 302 c 346 303 ierr = NF_REDEF (nid) … … 357 314 . "Coefficient de passage pour V") 358 315 ierr = NF_ENDDEF(nid) 359 #ifdef NC_DOUBLE 360 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv) 361 #else 362 ierr = NF_PUT_VAR_REAL (nid,nvarid,cv) 363 #endif 316 call NF95_PUT_VAR(nid,nvarid,cv) 364 317 c 365 318 c Aire de chaque maille: … … 378 331 . "Aires de chaque maille") 379 332 ierr = NF_ENDDEF(nid) 380 #ifdef NC_DOUBLE 381 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire) 382 #else 383 ierr = NF_PUT_VAR_REAL (nid,nvarid,aire) 384 #endif 333 call NF95_PUT_VAR(nid,nvarid,aire) 385 334 c 386 335 c Geopentiel au sol: … … 399 348 . "Geopotentiel au sol") 400 349 ierr = NF_ENDDEF(nid) 401 #ifdef NC_DOUBLE 402 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,phis) 403 #else 404 ierr = NF_PUT_VAR_REAL (nid,nvarid,phis) 405 #endif 350 call NF95_PUT_VAR(nid,nvarid,phis) 406 351 c 407 352 c Definir les variables pour pouvoir les enregistrer plus tard: … … 524 469 USE infotrac 525 470 USE control_mod 471 use netcdf, only: NF90_get_VAR 472 use netcdf95, only: NF95_PUT_VAR 526 473 527 474 IMPLICIT NONE … … 540 487 541 488 INTEGER l 542 REAL vcov(i p1jm,llm),ucov(ip1jmp1,llm)543 REAL teta(i p1jmp1,llm)544 REAL ps(i p1jmp1),masse(ip1jmp1,llm)545 REAL q(i p1jmp1,llm,nqtot)489 REAL vcov(iip1,jjm,llm),ucov(iip1, jjp1,llm) 490 REAL teta(iip1, jjp1,llm) 491 REAL ps(iip1, jjp1),masse(iip1, jjp1,llm) 492 REAL q(iip1, jjp1, llm, nqtot) 546 493 CHARACTER*(*) fichnom 547 494 … … 577 524 CALL abort_gcm(modname,abort_message,ierr) 578 525 ENDIF 579 #ifdef NC_DOUBLE 580 ierr = NF_PUT_VAR1_DOUBLE (nid,nvarid,nb,time) 581 #else 582 ierr = NF_PUT_VAR1_REAL (nid,nvarid,nb,time) 583 #endif 526 call NF95_PUT_VAR(nid,nvarid,time,start=(/nb/)) 584 527 write(lunout,*) "dynredem1: Enregistrement pour ", nb, time 585 528 … … 593 536 CALL abort_gcm(modname,abort_message,ierr) 594 537 ENDIF 595 #ifdef NC_DOUBLE 596 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tab_cntrl) 597 #else 598 ierr = NF_GET_VAR_REAL(nid, nvarid, tab_cntrl) 599 #endif 538 ierr = NF90_GET_VAR(nid, nvarid, tab_cntrl) 600 539 tab_cntrl(31) = REAL(itau_dyn + itaufin) 601 #ifdef NC_DOUBLE 602 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) 603 #else 604 ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) 605 #endif 540 call NF95_PUT_VAR(nid,nvarid,tab_cntrl) 606 541 607 542 c Ecriture des champs … … 613 548 CALL abort_gcm(modname,abort_message,ierr) 614 549 ENDIF 615 #ifdef NC_DOUBLE 616 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ucov) 617 #else 618 ierr = NF_PUT_VAR_REAL (nid,nvarid,ucov) 619 #endif 550 call NF95_PUT_VAR(nid,nvarid,ucov) 620 551 621 552 ierr = NF_INQ_VARID(nid, "vcov", nvarid) … … 625 556 CALL abort_gcm(modname,abort_message,ierr) 626 557 ENDIF 627 #ifdef NC_DOUBLE 628 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,vcov) 629 #else 630 ierr = NF_PUT_VAR_REAL (nid,nvarid,vcov) 631 #endif 558 call NF95_PUT_VAR(nid,nvarid,vcov) 632 559 633 560 ierr = NF_INQ_VARID(nid, "teta", nvarid) … … 637 564 CALL abort_gcm(modname,abort_message,ierr) 638 565 ENDIF 639 #ifdef NC_DOUBLE 640 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,teta) 641 #else 642 ierr = NF_PUT_VAR_REAL (nid,nvarid,teta) 643 #endif 566 call NF95_PUT_VAR(nid,nvarid,teta) 644 567 645 568 IF (type_trac == 'inca') THEN … … 663 586 CALL abort_gcm(modname,abort_message,ierr) 664 587 ENDIF 665 #ifdef NC_DOUBLE 666 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) 667 #else 668 ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) 669 #endif 588 call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq)) 670 589 ELSE ! type_trac = inca 671 590 ! lecture de la valeur du traceur dans start_trac.nc … … 682 601 CALL abort_gcm(modname,abort_message,ierr) 683 602 ENDIF 684 #ifdef NC_DOUBLE 685 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) 686 #else 687 ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) 688 #endif 603 call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq)) 689 604 690 605 ELSE 691 606 write(lunout,*) "dynredem1: ",trim(tname(iq)), 692 607 & " est present dans start_trac.nc" 693 #ifdef NC_DOUBLE 694 ierr = NF_GET_VAR_DOUBLE(nid_trac, nvarid_trac, trac_tmp) 695 #else 696 ierr = NF_GET_VAR_REAL(nid_trac, nvarid_trac, trac_tmp) 697 #endif 608 ierr = NF90_GET_VAR(nid_trac, nvarid_trac, trac_tmp) 698 609 IF (ierr .NE. NF_NOERR) THEN 699 610 abort_message="dynredem1: Lecture echouee pour"// … … 709 620 CALL abort_gcm(modname,abort_message,ierr) 710 621 ENDIF 711 #ifdef NC_DOUBLE 712 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,trac_tmp) 713 #else 714 ierr = NF_PUT_VAR_REAL (nid,nvarid,trac_tmp) 715 #endif 622 call NF95_PUT_VAR(nid, nvarid, trac_tmp) 716 623 717 624 ENDIF ! IF (ierr .NE. NF_NOERR) … … 726 633 CALL abort_gcm(modname,abort_message,ierr) 727 634 ENDIF 728 #ifdef NC_DOUBLE 729 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) 730 #else 731 ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) 732 #endif 635 call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq)) 733 636 ENDIF ! (ierr_file .ne. 2) 734 637 END IF !type_trac … … 743 646 CALL abort_gcm(modname,abort_message,ierr) 744 647 ENDIF 745 #ifdef NC_DOUBLE 746 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,masse) 747 #else 748 ierr = NF_PUT_VAR_REAL (nid,nvarid,masse) 749 #endif 648 call NF95_PUT_VAR(nid,nvarid,masse) 750 649 c 751 650 ierr = NF_INQ_VARID(nid, "ps", nvarid) … … 755 654 CALL abort_gcm(modname,abort_message,ierr) 756 655 ENDIF 757 #ifdef NC_DOUBLE 758 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ps) 759 #else 760 ierr = NF_PUT_VAR_REAL (nid,nvarid,ps) 761 #endif 656 call NF95_PUT_VAR(nid,nvarid,ps) 762 657 763 658 ierr = NF_CLOSE(nid) -
LMDZ5/trunk/libf/dyn3dpar/dynetat0.F
r1577 r1635 6 6 7 7 USE infotrac 8 use netcdf, only: nf90_get_var 8 9 IMPLICIT NONE 9 10 … … 28 29 #include "comconst.h" 29 30 #include "comvert.h" 30 #include "comgeom .h"31 #include "comgeom2.h" 31 32 #include "ener.h" 32 33 #include "netcdf.inc" … … 40 41 41 42 CHARACTER*(*) fichnom 42 REAL vcov(i p1jm,llm),ucov(ip1jmp1,llm),teta(ip1jmp1,llm)43 REAL q(i p1jmp1,llm,nqtot),masse(ip1jmp1,llm)44 REAL ps(i p1jmp1),phis(ip1jmp1)43 REAL vcov(iip1, jjm,llm),ucov(iip1, jjp1,llm),teta(iip1, jjp1,llm) 44 REAL q(iip1,jjp1,llm,nqtot),masse(iip1, jjp1,llm) 45 REAL ps(iip1, jjp1),phis(iip1, jjp1) 45 46 46 47 REAL time … … 70 71 CALL abort 71 72 ENDIF 72 #ifdef NC_DOUBLE 73 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tab_cntrl) 74 #else 75 ierr = NF_GET_VAR_REAL(nid, nvarid, tab_cntrl) 76 #endif 73 ierr = nf90_get_var(nid, nvarid, tab_cntrl) 77 74 IF (ierr .NE. NF_NOERR) THEN 78 75 write(lunout,*)"dynetat0: Lecture echoue pour <controle>" … … 142 139 CALL abort 143 140 ENDIF 144 #ifdef NC_DOUBLE 145 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlonu) 146 #else 147 ierr = NF_GET_VAR_REAL(nid, nvarid, rlonu) 148 #endif 141 ierr = nf90_get_var(nid, nvarid, rlonu) 149 142 IF (ierr .NE. NF_NOERR) THEN 150 143 write(lunout,*)"dynetat0: Lecture echouee pour <rlonu>" … … 157 150 CALL abort 158 151 ENDIF 159 #ifdef NC_DOUBLE 160 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlatu) 161 #else 162 ierr = NF_GET_VAR_REAL(nid, nvarid, rlatu) 163 #endif 152 ierr = nf90_get_var(nid, nvarid, rlatu) 164 153 IF (ierr .NE. NF_NOERR) THEN 165 154 write(lunout,*)"dynetat0: Lecture echouee pour <rlatu>" … … 172 161 CALL abort 173 162 ENDIF 174 #ifdef NC_DOUBLE 175 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlonv) 176 #else 177 ierr = NF_GET_VAR_REAL(nid, nvarid, rlonv) 178 #endif 163 ierr = nf90_get_var(nid, nvarid, rlonv) 179 164 IF (ierr .NE. NF_NOERR) THEN 180 165 write(lunout,*)"dynetat0: Lecture echouee pour <rlonv>" … … 187 172 CALL abort 188 173 ENDIF 189 #ifdef NC_DOUBLE 190 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, rlatv) 191 #else 192 ierr = NF_GET_VAR_REAL(nid, nvarid, rlatv) 193 #endif 174 ierr = nf90_get_var(nid, nvarid, rlatv) 194 175 IF (ierr .NE. NF_NOERR) THEN 195 176 write(lunout,*)"dynetat0: Lecture echouee pour rlatv" … … 202 183 CALL abort 203 184 ENDIF 204 #ifdef NC_DOUBLE 205 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, cu) 206 #else 207 ierr = NF_GET_VAR_REAL(nid, nvarid, cu) 208 #endif 185 ierr = nf90_get_var(nid, nvarid, cu) 209 186 IF (ierr .NE. NF_NOERR) THEN 210 187 write(lunout,*)"dynetat0: Lecture echouee pour <cu>" … … 217 194 CALL abort 218 195 ENDIF 219 #ifdef NC_DOUBLE 220 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, cv) 221 #else 222 ierr = NF_GET_VAR_REAL(nid, nvarid, cv) 223 #endif 196 ierr = nf90_get_var(nid, nvarid, cv) 224 197 IF (ierr .NE. NF_NOERR) THEN 225 198 write(lunout,*)"dynetat0: Lecture echouee pour <cv>" … … 232 205 CALL abort 233 206 ENDIF 234 #ifdef NC_DOUBLE 235 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, aire) 236 #else 237 ierr = NF_GET_VAR_REAL(nid, nvarid, aire) 238 #endif 207 ierr = nf90_get_var(nid, nvarid, aire) 239 208 IF (ierr .NE. NF_NOERR) THEN 240 209 write(lunout,*)"dynetat0: Lecture echouee pour <aire>" … … 247 216 CALL abort 248 217 ENDIF 249 #ifdef NC_DOUBLE 250 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, phis) 251 #else 252 ierr = NF_GET_VAR_REAL(nid, nvarid, phis) 253 #endif 218 ierr = nf90_get_var(nid, nvarid, phis) 254 219 IF (ierr .NE. NF_NOERR) THEN 255 220 write(lunout,*)"dynetat0: Lecture echouee pour <phisinit>" … … 262 227 CALL abort 263 228 ENDIF 264 #ifdef NC_DOUBLE 265 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, time) 266 #else 267 ierr = NF_GET_VAR_REAL(nid, nvarid, time) 268 #endif 229 ierr = nf90_get_var(nid, nvarid, time) 269 230 IF (ierr .NE. NF_NOERR) THEN 270 231 write(lunout,*)"dynetat0: Lecture echouee <temps>" … … 277 238 CALL abort 278 239 ENDIF 279 #ifdef NC_DOUBLE 280 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, ucov) 281 #else 282 ierr = NF_GET_VAR_REAL(nid, nvarid, ucov) 283 #endif 240 ierr = nf90_get_var(nid, nvarid, ucov) 284 241 IF (ierr .NE. NF_NOERR) THEN 285 242 write(lunout,*)"dynetat0: Lecture echouee pour <ucov>" … … 292 249 CALL abort 293 250 ENDIF 294 #ifdef NC_DOUBLE 295 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, vcov) 296 #else 297 ierr = NF_GET_VAR_REAL(nid, nvarid, vcov) 298 #endif 251 ierr = nf90_get_var(nid, nvarid, vcov) 299 252 IF (ierr .NE. NF_NOERR) THEN 300 253 write(lunout,*)"dynetat0: Lecture echouee pour <vcov>" … … 307 260 CALL abort 308 261 ENDIF 309 #ifdef NC_DOUBLE 310 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, teta) 311 #else 312 ierr = NF_GET_VAR_REAL(nid, nvarid, teta) 313 #endif 262 ierr = nf90_get_var(nid, nvarid, teta) 314 263 IF (ierr .NE. NF_NOERR) THEN 315 264 write(lunout,*)"dynetat0: Lecture echouee pour <teta>" … … 325 274 & "> est absent" 326 275 write(lunout,*)" Il est donc initialise a zero" 327 q(:,:, iq)=0.276 q(:,:,:,iq)=0. 328 277 ELSE 329 #ifdef NC_DOUBLE 330 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, q(1,1,iq)) 331 #else 332 ierr = NF_GET_VAR_REAL(nid, nvarid, q(1,1,iq)) 333 #endif 278 ierr = NF90_GET_VAR(nid, nvarid, q(:,:,:,iq)) 334 279 IF (ierr .NE. NF_NOERR) THEN 335 280 write(lunout,*)"dynetat0: Lecture echouee pour "//tname(iq) … … 345 290 CALL abort 346 291 ENDIF 347 #ifdef NC_DOUBLE 348 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, masse) 349 #else 350 ierr = NF_GET_VAR_REAL(nid, nvarid, masse) 351 #endif 292 ierr = nf90_get_var(nid, nvarid, masse) 352 293 IF (ierr .NE. NF_NOERR) THEN 353 294 write(lunout,*)"dynetat0: Lecture echouee pour <masse>" … … 360 301 CALL abort 361 302 ENDIF 362 #ifdef NC_DOUBLE 363 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, ps) 364 #else 365 ierr = NF_GET_VAR_REAL(nid, nvarid, ps) 366 #endif 303 ierr = nf90_get_var(nid, nvarid, ps) 367 304 IF (ierr .NE. NF_NOERR) THEN 368 305 write(lunout,*)"dynetat0: Lecture echouee pour <ps>" -
LMDZ5/trunk/libf/dyn3dpar/dynredem.F
r1577 r1635 8 8 #endif 9 9 USE infotrac 10 use netcdf95, only: NF95_PUT_VAR 10 11 11 12 IMPLICIT NONE … … 19 20 #include "comconst.h" 20 21 #include "comvert.h" 21 #include "comgeom .h"22 #include "comgeom2.h" 22 23 #include "temps.h" 23 24 #include "ener.h" … … 31 32 c ---------- 32 33 INTEGER iday_end 33 REAL phis(i p1jmp1)34 REAL phis(iip1, jjp1) 34 35 CHARACTER*(*) fichnom 35 36 … … 166 167 . "Parametres de controle") 167 168 ierr = NF_ENDDEF(nid) 168 #ifdef NC_DOUBLE 169 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) 170 #else 171 ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) 172 #endif 169 call NF95_PUT_VAR(nid,nvarid,tab_cntrl) 173 170 c 174 171 ierr = NF_REDEF (nid) … … 183 180 . "Longitudes des points U") 184 181 ierr = NF_ENDDEF(nid) 185 #ifdef NC_DOUBLE 186 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu) 187 #else 188 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu) 189 #endif 182 call NF95_PUT_VAR(nid,nvarid,rlonu) 190 183 c 191 184 ierr = NF_REDEF (nid) … … 200 193 . "Latitudes des points U") 201 194 ierr = NF_ENDDEF(nid) 202 #ifdef NC_DOUBLE 203 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu) 204 #else 205 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu) 206 #endif 195 call NF95_PUT_VAR (nid,nvarid,rlatu) 207 196 c 208 197 ierr = NF_REDEF (nid) … … 217 206 . "Longitudes des points V") 218 207 ierr = NF_ENDDEF(nid) 219 #ifdef NC_DOUBLE 220 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv) 221 #else 222 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv) 223 #endif 208 call NF95_PUT_VAR(nid,nvarid,rlonv) 224 209 c 225 210 ierr = NF_REDEF (nid) … … 234 219 . "Latitudes des points V") 235 220 ierr = NF_ENDDEF(nid) 236 #ifdef NC_DOUBLE 237 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv) 238 #else 239 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv) 240 #endif 221 call NF95_PUT_VAR(nid,nvarid,rlatv) 241 222 c 242 223 ierr = NF_REDEF (nid) … … 251 232 . "Numero naturel des couches s") 252 233 ierr = NF_ENDDEF(nid) 253 #ifdef NC_DOUBLE 254 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsigs) 255 #else 256 ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsigs) 257 #endif 234 call NF95_PUT_VAR(nid,nvarid,nivsigs) 258 235 c 259 236 ierr = NF_REDEF (nid) … … 268 245 . "Numero naturel des couches sigma") 269 246 ierr = NF_ENDDEF(nid) 270 #ifdef NC_DOUBLE 271 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsig) 272 #else 273 ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsig) 274 #endif 247 call NF95_PUT_VAR(nid,nvarid,nivsig) 275 248 c 276 249 ierr = NF_REDEF (nid) … … 285 258 . "Coefficient A pour hybride") 286 259 ierr = NF_ENDDEF(nid) 287 #ifdef NC_DOUBLE 288 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ap) 289 #else 290 ierr = NF_PUT_VAR_REAL (nid,nvarid,ap) 291 #endif 260 call NF95_PUT_VAR(nid,nvarid,ap) 292 261 c 293 262 ierr = NF_REDEF (nid) … … 302 271 . "Coefficient B pour hybride") 303 272 ierr = NF_ENDDEF(nid) 304 #ifdef NC_DOUBLE 305 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bp) 306 #else 307 ierr = NF_PUT_VAR_REAL (nid,nvarid,bp) 308 #endif 273 call NF95_PUT_VAR(nid,nvarid,bp) 309 274 c 310 275 ierr = NF_REDEF (nid) … … 317 282 cIM 220306 END 318 283 ierr = NF_ENDDEF(nid) 319 #ifdef NC_DOUBLE 320 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,presnivs) 321 #else 322 ierr = NF_PUT_VAR_REAL (nid,nvarid,presnivs) 323 #endif 284 call NF95_PUT_VAR(nid,nvarid,presnivs) 324 285 c 325 286 c Coefficients de passage cov. <-> contra. <--> naturel … … 338 299 . "Coefficient de passage pour U") 339 300 ierr = NF_ENDDEF(nid) 340 #ifdef NC_DOUBLE 341 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu) 342 #else 343 ierr = NF_PUT_VAR_REAL (nid,nvarid,cu) 344 #endif 301 call NF95_PUT_VAR(nid,nvarid,cu) 345 302 c 346 303 ierr = NF_REDEF (nid) … … 357 314 . "Coefficient de passage pour V") 358 315 ierr = NF_ENDDEF(nid) 359 #ifdef NC_DOUBLE 360 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv) 361 #else 362 ierr = NF_PUT_VAR_REAL (nid,nvarid,cv) 363 #endif 316 call NF95_PUT_VAR(nid,nvarid,cv) 364 317 c 365 318 c Aire de chaque maille: … … 378 331 . "Aires de chaque maille") 379 332 ierr = NF_ENDDEF(nid) 380 #ifdef NC_DOUBLE 381 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire) 382 #else 383 ierr = NF_PUT_VAR_REAL (nid,nvarid,aire) 384 #endif 333 call NF95_PUT_VAR(nid,nvarid,aire) 385 334 c 386 335 c Geopentiel au sol: … … 399 348 . "Geopotentiel au sol") 400 349 ierr = NF_ENDDEF(nid) 401 #ifdef NC_DOUBLE 402 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,phis) 403 #else 404 ierr = NF_PUT_VAR_REAL (nid,nvarid,phis) 405 #endif 350 call NF95_PUT_VAR(nid,nvarid,phis) 406 351 c 407 352 c Definir les variables pour pouvoir les enregistrer plus tard: … … 524 469 USE infotrac 525 470 USE control_mod 471 use netcdf, only: NF90_get_VAR 472 use netcdf95, only: NF95_PUT_VAR 526 473 527 474 IMPLICIT NONE … … 540 487 541 488 INTEGER l 542 REAL vcov(i p1jm,llm),ucov(ip1jmp1,llm)543 REAL teta(i p1jmp1,llm)544 REAL ps(i p1jmp1),masse(ip1jmp1,llm)545 REAL q(i p1jmp1,llm,nqtot)489 REAL vcov(iip1,jjm,llm),ucov(iip1, jjp1,llm) 490 REAL teta(iip1, jjp1,llm) 491 REAL ps(iip1, jjp1),masse(iip1, jjp1,llm) 492 REAL q(iip1, jjp1, llm, nqtot) 546 493 CHARACTER*(*) fichnom 547 494 … … 577 524 CALL abort_gcm(modname,abort_message,ierr) 578 525 ENDIF 579 #ifdef NC_DOUBLE 580 ierr = NF_PUT_VAR1_DOUBLE (nid,nvarid,nb,time) 581 #else 582 ierr = NF_PUT_VAR1_REAL (nid,nvarid,nb,time) 583 #endif 526 call NF95_PUT_VAR(nid,nvarid,time,start=(/nb/)) 584 527 write(lunout,*) "dynredem1: Enregistrement pour ", nb, time 585 528 … … 593 536 CALL abort_gcm(modname,abort_message,ierr) 594 537 ENDIF 595 #ifdef NC_DOUBLE 596 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tab_cntrl) 597 #else 598 ierr = NF_GET_VAR_REAL(nid, nvarid, tab_cntrl) 599 #endif 538 ierr = NF90_GET_VAR(nid, nvarid, tab_cntrl) 600 539 tab_cntrl(31) = REAL(itau_dyn + itaufin) 601 #ifdef NC_DOUBLE 602 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) 603 #else 604 ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) 605 #endif 540 call NF95_PUT_VAR(nid,nvarid,tab_cntrl) 606 541 607 542 c Ecriture des champs … … 613 548 CALL abort_gcm(modname,abort_message,ierr) 614 549 ENDIF 615 #ifdef NC_DOUBLE 616 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ucov) 617 #else 618 ierr = NF_PUT_VAR_REAL (nid,nvarid,ucov) 619 #endif 550 call NF95_PUT_VAR(nid,nvarid,ucov) 620 551 621 552 ierr = NF_INQ_VARID(nid, "vcov", nvarid) … … 625 556 CALL abort_gcm(modname,abort_message,ierr) 626 557 ENDIF 627 #ifdef NC_DOUBLE 628 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,vcov) 629 #else 630 ierr = NF_PUT_VAR_REAL (nid,nvarid,vcov) 631 #endif 558 call NF95_PUT_VAR(nid,nvarid,vcov) 632 559 633 560 ierr = NF_INQ_VARID(nid, "teta", nvarid) … … 637 564 CALL abort_gcm(modname,abort_message,ierr) 638 565 ENDIF 639 #ifdef NC_DOUBLE 640 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,teta) 641 #else 642 ierr = NF_PUT_VAR_REAL (nid,nvarid,teta) 643 #endif 566 call NF95_PUT_VAR(nid,nvarid,teta) 644 567 645 568 IF (type_trac == 'inca') THEN … … 663 586 CALL abort_gcm(modname,abort_message,ierr) 664 587 ENDIF 665 #ifdef NC_DOUBLE 666 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) 667 #else 668 ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) 669 #endif 670 ELSE ! type_trac=inca 588 call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq)) 589 ELSE ! type_trac = inca 671 590 ! lecture de la valeur du traceur dans start_trac.nc 672 591 IF (ierr_file .ne. 2) THEN … … 682 601 CALL abort_gcm(modname,abort_message,ierr) 683 602 ENDIF 684 #ifdef NC_DOUBLE 685 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) 686 #else 687 ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) 688 #endif 603 call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq)) 689 604 690 605 ELSE 691 606 write(lunout,*) "dynredem1: ",trim(tname(iq)), 692 607 & " est present dans start_trac.nc" 693 #ifdef NC_DOUBLE 694 ierr = NF_GET_VAR_DOUBLE(nid_trac, nvarid_trac, trac_tmp) 695 #else 696 ierr = NF_GET_VAR_REAL(nid_trac, nvarid_trac, trac_tmp) 697 #endif 608 ierr = NF90_GET_VAR(nid_trac, nvarid_trac, trac_tmp) 698 609 IF (ierr .NE. NF_NOERR) THEN 699 610 abort_message="dynredem1: Lecture echouee pour"// … … 709 620 CALL abort_gcm(modname,abort_message,ierr) 710 621 ENDIF 711 #ifdef NC_DOUBLE 712 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,trac_tmp) 713 #else 714 ierr = NF_PUT_VAR_REAL (nid,nvarid,trac_tmp) 715 #endif 622 call NF95_PUT_VAR(nid, nvarid, trac_tmp) 716 623 717 624 ENDIF ! IF (ierr .NE. NF_NOERR) … … 726 633 CALL abort_gcm(modname,abort_message,ierr) 727 634 ENDIF 728 #ifdef NC_DOUBLE 729 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) 730 #else 731 ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) 732 #endif 635 call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq)) 733 636 ENDIF ! (ierr_file .ne. 2) 734 END IF ! 637 END IF !type_trac 735 638 736 639 ENDDO … … 743 646 CALL abort_gcm(modname,abort_message,ierr) 744 647 ENDIF 745 #ifdef NC_DOUBLE 746 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,masse) 747 #else 748 ierr = NF_PUT_VAR_REAL (nid,nvarid,masse) 749 #endif 648 call NF95_PUT_VAR(nid,nvarid,masse) 750 649 c 751 650 ierr = NF_INQ_VARID(nid, "ps", nvarid) … … 755 654 CALL abort_gcm(modname,abort_message,ierr) 756 655 ENDIF 757 #ifdef NC_DOUBLE 758 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ps) 759 #else 760 ierr = NF_PUT_VAR_REAL (nid,nvarid,ps) 761 #endif 656 call NF95_PUT_VAR(nid,nvarid,ps) 762 657 763 658 ierr = NF_CLOSE(nid) -
LMDZ5/trunk/libf/dyn3dpar/dynredem_p.F
r1577 r1635 9 9 USE parallel 10 10 USE infotrac 11 use netcdf95, only: NF95_PUT_VAR 12 11 13 IMPLICIT NONE 12 14 c======================================================================= … … 19 21 #include "comconst.h" 20 22 #include "comvert.h" 21 #include "comgeom .h"23 #include "comgeom2.h" 22 24 #include "temps.h" 23 25 #include "ener.h" … … 30 32 c ---------- 31 33 INTEGER iday_end 32 REAL phis(i p1jmp1)34 REAL phis(iip1, jjp1) 33 35 CHARACTER*(*) fichnom 34 36 … … 56 58 character*30 unites 57 59 60 58 61 c----------------------------------------------------------------------- 59 62 if (mpi_rank==0) then … … 69 72 mmois0=1 70 73 jjour0=1 71 #endif 74 #endif 72 75 73 76 DO l=1,length 74 77 tab_cntrl(l) = 0. 75 78 ENDDO 76 tab_cntrl(1) = 77 tab_cntrl(2) = 78 tab_cntrl(3) = 79 tab_cntrl(4) = 80 tab_cntrl(5) = 79 tab_cntrl(1) = REAL(iim) 80 tab_cntrl(2) = REAL(jjm) 81 tab_cntrl(3) = REAL(llm) 82 tab_cntrl(4) = REAL(day_ref) 83 tab_cntrl(5) = REAL(annee_ref) 81 84 tab_cntrl(6) = rad 82 85 tab_cntrl(7) = omeg … … 118 121 ENDIF 119 122 120 tab_cntrl(30) = 121 tab_cntrl(31) = 123 tab_cntrl(30) = REAL(iday_end) 124 tab_cntrl(31) = REAL(itau_dyn + itaufin) 122 125 c start_time: start_time of simulation (not necessarily 0.) 123 126 tab_cntrl(32) = start_time … … 165 168 . "Parametres de controle") 166 169 ierr = NF_ENDDEF(nid) 167 #ifdef NC_DOUBLE 168 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) 169 #else 170 ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) 171 #endif 170 call NF95_PUT_VAR(nid,nvarid,tab_cntrl) 172 171 c 173 172 ierr = NF_REDEF (nid) … … 182 181 . "Longitudes des points U") 183 182 ierr = NF_ENDDEF(nid) 184 #ifdef NC_DOUBLE 185 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu) 186 #else 187 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu) 188 #endif 183 call NF95_PUT_VAR(nid,nvarid,rlonu) 189 184 c 190 185 ierr = NF_REDEF (nid) … … 199 194 . "Latitudes des points U") 200 195 ierr = NF_ENDDEF(nid) 201 #ifdef NC_DOUBLE 202 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu) 203 #else 204 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu) 205 #endif 196 call NF95_PUT_VAR (nid,nvarid,rlatu) 206 197 c 207 198 ierr = NF_REDEF (nid) … … 216 207 . "Longitudes des points V") 217 208 ierr = NF_ENDDEF(nid) 218 #ifdef NC_DOUBLE 219 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv) 220 #else 221 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv) 222 #endif 209 call NF95_PUT_VAR(nid,nvarid,rlonv) 223 210 c 224 211 ierr = NF_REDEF (nid) … … 233 220 . "Latitudes des points V") 234 221 ierr = NF_ENDDEF(nid) 235 #ifdef NC_DOUBLE 236 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv) 237 #else 238 ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv) 239 #endif 222 call NF95_PUT_VAR(nid,nvarid,rlatv) 240 223 c 241 224 ierr = NF_REDEF (nid) … … 250 233 . "Numero naturel des couches s") 251 234 ierr = NF_ENDDEF(nid) 252 #ifdef NC_DOUBLE 253 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsigs) 254 #else 255 ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsigs) 256 #endif 235 call NF95_PUT_VAR(nid,nvarid,nivsigs) 257 236 c 258 237 ierr = NF_REDEF (nid) … … 267 246 . "Numero naturel des couches sigma") 268 247 ierr = NF_ENDDEF(nid) 269 #ifdef NC_DOUBLE 270 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsig) 271 #else 272 ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsig) 273 #endif 248 call NF95_PUT_VAR(nid,nvarid,nivsig) 274 249 c 275 250 ierr = NF_REDEF (nid) … … 284 259 . "Coefficient A pour hybride") 285 260 ierr = NF_ENDDEF(nid) 286 #ifdef NC_DOUBLE 287 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ap) 288 #else 289 ierr = NF_PUT_VAR_REAL (nid,nvarid,ap) 290 #endif 261 call NF95_PUT_VAR(nid,nvarid,ap) 291 262 c 292 263 ierr = NF_REDEF (nid) … … 301 272 . "Coefficient B pour hybride") 302 273 ierr = NF_ENDDEF(nid) 303 #ifdef NC_DOUBLE 304 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bp) 305 #else 306 ierr = NF_PUT_VAR_REAL (nid,nvarid,bp) 307 #endif 274 call NF95_PUT_VAR(nid,nvarid,bp) 308 275 c 309 276 ierr = NF_REDEF (nid) … … 316 283 cIM 220306 END 317 284 ierr = NF_ENDDEF(nid) 318 #ifdef NC_DOUBLE 319 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,presnivs) 320 #else 321 ierr = NF_PUT_VAR_REAL (nid,nvarid,presnivs) 322 #endif 285 call NF95_PUT_VAR(nid,nvarid,presnivs) 323 286 c 324 287 c Coefficients de passage cov. <-> contra. <--> naturel … … 337 300 . "Coefficient de passage pour U") 338 301 ierr = NF_ENDDEF(nid) 339 #ifdef NC_DOUBLE 340 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu) 341 #else 342 ierr = NF_PUT_VAR_REAL (nid,nvarid,cu) 343 #endif 302 call NF95_PUT_VAR(nid,nvarid,cu) 344 303 c 345 304 ierr = NF_REDEF (nid) … … 356 315 . "Coefficient de passage pour V") 357 316 ierr = NF_ENDDEF(nid) 358 #ifdef NC_DOUBLE 359 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv) 360 #else 361 ierr = NF_PUT_VAR_REAL (nid,nvarid,cv) 362 #endif 317 call NF95_PUT_VAR(nid,nvarid,cv) 363 318 c 364 319 c Aire de chaque maille: … … 377 332 . "Aires de chaque maille") 378 333 ierr = NF_ENDDEF(nid) 379 #ifdef NC_DOUBLE 380 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire) 381 #else 382 ierr = NF_PUT_VAR_REAL (nid,nvarid,aire) 383 #endif 334 call NF95_PUT_VAR(nid,nvarid,aire) 384 335 c 385 336 c Geopentiel au sol: … … 398 349 . "Geopotentiel au sol") 399 350 ierr = NF_ENDDEF(nid) 400 #ifdef NC_DOUBLE 401 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,phis) 402 #else 403 ierr = NF_PUT_VAR_REAL (nid,nvarid,phis) 404 #endif 351 call NF95_PUT_VAR(nid,nvarid,phis) 405 352 c 406 353 c Definir les variables pour pouvoir les enregistrer plus tard: … … 510 457 ierr = NF_ENDDEF(nid) ! sortir du mode de definition 511 458 ierr = NF_CLOSE(nid) ! fermer le fichier 512 513 459 514 460 PRINT*,'iim,jjm,llm,iday_end',iim,jjm,llm,iday_end … … 524 470 USE infotrac 525 471 USE control_mod 472 use netcdf, only: NF90_get_VAR 473 use netcdf95, only: NF95_PUT_VAR 474 526 475 IMPLICIT NONE 527 476 c================================================================= … … 536 485 #include "temps.h" 537 486 487 538 488 INTEGER l 539 REAL vcov(i p1jm,llm),ucov(ip1jmp1,llm)540 REAL teta(i p1jmp1,llm)541 REAL ps(i p1jmp1),masse(ip1jmp1,llm)542 REAL q(i p1jmp1,llm,nqtot)489 REAL vcov(iip1,jjm,llm),ucov(iip1, jjp1,llm) 490 REAL teta(iip1, jjp1,llm) 491 REAL ps(iip1, jjp1),masse(iip1, jjp1,llm) 492 REAL q(iip1, jjp1, llm, nqtot) 543 493 CHARACTER*(*) fichnom 544 494 … … 546 496 INTEGER nid, nvarid, nid_trac, nvarid_trac 547 497 REAL trac_tmp(ip1jmp1,llm) 548 INTEGER ierr, ierr_file 498 INTEGER ierr, ierr_file 549 499 INTEGER iq 550 500 INTEGER length … … 567 517 568 518 do iq=1,nqtot 569 call Gather_Field(q( 1,1,iq),ip1jmp1,llm,0)519 call Gather_Field(q(:,:,:,iq),ip1jmp1,llm,0) 570 520 enddo 571 521 … … 589 539 CALL abort_gcm(modname,abort_message,ierr) 590 540 ENDIF 591 #ifdef NC_DOUBLE 592 ierr = NF_PUT_VAR1_DOUBLE (nid,nvarid,nb,time) 593 #else 594 ierr = NF_PUT_VAR1_REAL (nid,nvarid,nb,time) 595 #endif 541 call NF95_PUT_VAR(nid,nvarid,time,start=(/nb/)) 596 542 PRINT*, "Enregistrement pour ", nb, time 597 543 … … 605 551 CALL abort_gcm(modname,abort_message,ierr) 606 552 ENDIF 607 #ifdef NC_DOUBLE 608 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tab_cntrl) 609 #else 610 ierr = NF_GET_VAR_REAL(nid, nvarid, tab_cntrl) 611 #endif 612 tab_cntrl(31) = REAL(itau_dyn + itaufin) 613 #ifdef NC_DOUBLE 614 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) 615 #else 616 ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) 617 #endif 553 ierr = NF90_GET_VAR(nid, nvarid, tab_cntrl) 554 tab_cntrl(31) = REAL(itau_dyn + itaufin) 555 call NF95_PUT_VAR(nid,nvarid,tab_cntrl) 618 556 619 557 c Ecriture des champs … … 624 562 CALL abort 625 563 ENDIF 626 #ifdef NC_DOUBLE 627 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ucov) 628 #else 629 ierr = NF_PUT_VAR_REAL (nid,nvarid,ucov) 630 #endif 564 call NF95_PUT_VAR(nid,nvarid,ucov) 631 565 632 566 ierr = NF_INQ_VARID(nid, "vcov", nvarid) … … 635 569 CALL abort 636 570 ENDIF 637 #ifdef NC_DOUBLE 638 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,vcov) 639 #else 640 ierr = NF_PUT_VAR_REAL (nid,nvarid,vcov) 641 #endif 571 call NF95_PUT_VAR(nid,nvarid,vcov) 642 572 643 573 ierr = NF_INQ_VARID(nid, "teta", nvarid) … … 646 576 CALL abort 647 577 ENDIF 648 #ifdef NC_DOUBLE 649 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,teta) 650 #else 651 ierr = NF_PUT_VAR_REAL (nid,nvarid,teta) 652 #endif 578 call NF95_PUT_VAR(nid,nvarid,teta) 653 579 654 580 IF (type_trac == 'inca') THEN … … 675 601 CALL abort 676 602 ENDIF 677 #ifdef NC_DOUBLE 678 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) 679 #else 680 ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) 681 #endif 603 call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq)) 682 604 ELSE ! type_trac = inca 683 605 ! lecture de la valeur du traceur dans start_trac.nc … … 691 613 CALL abort 692 614 ENDIF 693 #ifdef NC_DOUBLE 694 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) 695 #else 696 ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) 697 #endif 615 call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq)) 698 616 699 617 ELSE 700 618 PRINT*, tname(iq), "est present dans start_trac.nc" 701 #ifdef NC_DOUBLE 702 ierr = NF_GET_VAR_DOUBLE(nid_trac, nvarid_trac, trac_tmp) 703 #else 704 ierr = NF_GET_VAR_REAL(nid_trac, nvarid_trac, trac_tmp) 705 #endif 619 ierr = NF90_GET_VAR(nid_trac, nvarid_trac, trac_tmp) 706 620 IF (ierr .NE. NF_NOERR) THEN 707 621 PRINT*, "Lecture echouee pour", tname(iq) … … 713 627 CALL abort 714 628 ENDIF 715 #ifdef NC_DOUBLE 716 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,trac_tmp) 717 #else 718 ierr = NF_PUT_VAR_REAL (nid,nvarid,trac_tmp) 719 #endif 629 call NF95_PUT_VAR(nid, nvarid, trac_tmp) 720 630 721 631 ENDIF ! IF (ierr .NE. NF_NOERR) … … 728 638 CALL abort 729 639 ENDIF 730 #ifdef NC_DOUBLE 731 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) 732 #else 733 ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) 734 #endif 640 call NF95_PUT_VAR(nid,nvarid,q(:,:,:,iq)) 735 641 ENDIF ! (ierr_file .ne. 2) 736 END IF ! 642 END IF !type_trac 737 643 738 644 ENDDO … … 746 652 CALL abort 747 653 ENDIF 748 #ifdef NC_DOUBLE 749 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,masse) 750 #else 751 ierr = NF_PUT_VAR_REAL (nid,nvarid,masse) 752 #endif 654 call NF95_PUT_VAR(nid,nvarid,masse) 753 655 c 754 656 ierr = NF_INQ_VARID(nid, "ps", nvarid) … … 757 659 CALL abort 758 660 ENDIF 759 #ifdef NC_DOUBLE 760 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ps) 761 #else 762 ierr = NF_PUT_VAR_REAL (nid,nvarid,ps) 763 #endif 661 call NF95_PUT_VAR(nid,nvarid,ps) 764 662 765 663 ierr = NF_CLOSE(nid) -
LMDZ5/trunk/libf/phylmd/regr_lat_time_climoz_m.F90
r1279 r1635 224 224 ! Get the number of months: 225 225 call nf95_inq_dimid(ncid_in, "time", dimid) 226 call nf95_inquire_dimension(ncid_in, dimid, len=n_month)226 call nf95_inquire_dimension(ncid_in, dimid, nclen=n_month) 227 227 228 228 allocate(o3_in(n_lat, n_plev, n_month, read_climoz))
Note: See TracChangeset
for help on using the changeset viewer.