[1635] | 1 | module nf95_get_var_m |
---|
| 2 | |
---|
| 3 | use netcdf, only: nf90_get_var |
---|
| 4 | use handle_err_m, only: handle_err |
---|
| 5 | |
---|
| 6 | implicit none |
---|
| 7 | |
---|
| 8 | interface nf95_get_var |
---|
| 9 | module procedure nf95_get_var_FourByteReal, nf95_get_var_FourByteInt, & |
---|
| 10 | nf95_get_var_1D_FourByteReal, nf95_get_var_1D_FourByteInt, & |
---|
| 11 | nf95_get_var_2D_FourByteReal, & |
---|
| 12 | nf95_get_var_3D_FourByteInt, & |
---|
| 13 | nf95_get_var_3D_FourByteReal, & |
---|
| 14 | nf95_get_var_4D_FourByteReal, & |
---|
| 15 | nf95_get_var_5D_FourByteReal |
---|
| 16 | end interface |
---|
| 17 | |
---|
| 18 | private |
---|
| 19 | public nf95_get_var |
---|
| 20 | |
---|
| 21 | contains |
---|
| 22 | |
---|
| 23 | subroutine nf95_get_var_FourByteReal(ncid, varid, values, start, ncerr) |
---|
| 24 | |
---|
| 25 | integer, intent(in) :: ncid, varid |
---|
| 26 | real, intent(out) :: values |
---|
| 27 | integer, dimension(:), optional, intent(in) :: start |
---|
| 28 | integer, intent(out), optional:: ncerr |
---|
| 29 | |
---|
| 30 | ! Variable local to the procedure: |
---|
| 31 | integer ncerr_not_opt |
---|
| 32 | |
---|
| 33 | !------------------- |
---|
| 34 | |
---|
| 35 | ncerr_not_opt = nf90_get_var(ncid, varid, values, start) |
---|
| 36 | if (present(ncerr)) then |
---|
| 37 | ncerr = ncerr_not_opt |
---|
| 38 | else |
---|
| 39 | call handle_err("nf95_get_var_FourByteReal", ncerr_not_opt, ncid, & |
---|
| 40 | varid) |
---|
| 41 | end if |
---|
| 42 | |
---|
| 43 | end subroutine nf95_get_var_FourByteReal |
---|
| 44 | |
---|
| 45 | !*********************** |
---|
| 46 | |
---|
| 47 | subroutine nf95_get_var_FourByteInt(ncid, varid, values, start, ncerr) |
---|
| 48 | |
---|
| 49 | integer, intent(in) :: ncid, varid |
---|
| 50 | integer, intent(out) :: values |
---|
| 51 | integer, dimension(:), optional, intent(in) :: start |
---|
| 52 | integer, intent(out), optional:: ncerr |
---|
| 53 | |
---|
| 54 | ! Variable local to the procedure: |
---|
| 55 | integer ncerr_not_opt |
---|
| 56 | |
---|
| 57 | !------------------- |
---|
| 58 | |
---|
| 59 | ncerr_not_opt = nf90_get_var(ncid, varid, values, start) |
---|
| 60 | if (present(ncerr)) then |
---|
| 61 | ncerr = ncerr_not_opt |
---|
| 62 | else |
---|
| 63 | call handle_err("nf95_get_var_FourByteInt", ncerr_not_opt, ncid, & |
---|
| 64 | varid) |
---|
| 65 | end if |
---|
| 66 | |
---|
| 67 | end subroutine nf95_get_var_FourByteInt |
---|
| 68 | |
---|
| 69 | !*********************** |
---|
| 70 | |
---|
| 71 | subroutine nf95_get_var_1D_FourByteReal(ncid, varid, values, start, & |
---|
| 72 | count_nc, stride, map, ncerr) |
---|
| 73 | |
---|
| 74 | integer, intent(in) :: ncid, varid |
---|
| 75 | real, intent(out) :: values(:) |
---|
| 76 | integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map |
---|
| 77 | integer, intent(out), optional:: ncerr |
---|
| 78 | |
---|
| 79 | ! Variable local to the procedure: |
---|
| 80 | integer ncerr_not_opt |
---|
| 81 | |
---|
| 82 | !------------------- |
---|
| 83 | |
---|
| 84 | ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, & |
---|
| 85 | stride, map) |
---|
| 86 | if (present(ncerr)) then |
---|
| 87 | ncerr = ncerr_not_opt |
---|
| 88 | else |
---|
| 89 | call handle_err("nf95_get_var_1D_FourByteReal", ncerr_not_opt, ncid, & |
---|
| 90 | varid) |
---|
| 91 | end if |
---|
| 92 | |
---|
| 93 | end subroutine nf95_get_var_1D_FourByteReal |
---|
| 94 | |
---|
| 95 | !*********************** |
---|
| 96 | |
---|
| 97 | subroutine nf95_get_var_1D_FourByteInt(ncid, varid, values, start, & |
---|
| 98 | count_nc, stride, map, ncerr) |
---|
| 99 | |
---|
| 100 | integer, intent(in) :: ncid, varid |
---|
| 101 | integer, intent(out) :: values(:) |
---|
| 102 | integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map |
---|
| 103 | integer, intent(out), optional:: ncerr |
---|
| 104 | |
---|
| 105 | ! Variable local to the procedure: |
---|
| 106 | integer ncerr_not_opt |
---|
| 107 | |
---|
| 108 | !------------------- |
---|
| 109 | |
---|
| 110 | ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, & |
---|
| 111 | stride, map) |
---|
| 112 | if (present(ncerr)) then |
---|
| 113 | ncerr = ncerr_not_opt |
---|
| 114 | else |
---|
| 115 | call handle_err("nf95_get_var_1D_FourByteInt", ncerr_not_opt, ncid, & |
---|
| 116 | varid) |
---|
| 117 | end if |
---|
| 118 | |
---|
| 119 | end subroutine nf95_get_var_1D_FourByteInt |
---|
| 120 | |
---|
| 121 | !*********************** |
---|
| 122 | |
---|
| 123 | subroutine nf95_get_var_1D_EightByteReal(ncid, varid, values, start, & |
---|
| 124 | count_nc, stride, map, ncerr) |
---|
| 125 | |
---|
| 126 | use typesizes, only: eightByteReal |
---|
| 127 | |
---|
| 128 | integer, intent(in) :: ncid, varid |
---|
| 129 | real (kind = EightByteReal), intent(out) :: values(:) |
---|
| 130 | integer, dimension(:), optional, intent(in):: start, count_nc, stride, map |
---|
| 131 | integer, intent(out), optional:: ncerr |
---|
| 132 | |
---|
| 133 | ! Variable local to the procedure: |
---|
| 134 | integer ncerr_not_opt |
---|
| 135 | |
---|
| 136 | !------------------- |
---|
| 137 | |
---|
| 138 | ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, & |
---|
| 139 | stride, map) |
---|
| 140 | if (present(ncerr)) then |
---|
| 141 | ncerr = ncerr_not_opt |
---|
| 142 | else |
---|
| 143 | call handle_err("nf95_get_var_1D_eightByteReal", ncerr_not_opt, ncid, & |
---|
| 144 | varid) |
---|
| 145 | end if |
---|
| 146 | |
---|
| 147 | end subroutine nf95_get_var_1D_EightByteReal |
---|
| 148 | |
---|
| 149 | !*********************** |
---|
| 150 | |
---|
| 151 | subroutine nf95_get_var_2D_FourByteReal(ncid, varid, values, start, & |
---|
| 152 | count_nc, stride, map, ncerr) |
---|
| 153 | |
---|
| 154 | integer, intent(in) :: ncid, varid |
---|
| 155 | real , intent(out) :: values(:, :) |
---|
| 156 | integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map |
---|
| 157 | integer, intent(out), optional:: ncerr |
---|
| 158 | |
---|
| 159 | ! Variable local to the procedure: |
---|
| 160 | integer ncerr_not_opt |
---|
| 161 | |
---|
| 162 | !------------------- |
---|
| 163 | |
---|
| 164 | ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, & |
---|
| 165 | stride, map) |
---|
| 166 | if (present(ncerr)) then |
---|
| 167 | ncerr = ncerr_not_opt |
---|
| 168 | else |
---|
| 169 | call handle_err("nf95_get_var_2D_FourByteReal", ncerr_not_opt, ncid, & |
---|
| 170 | varid) |
---|
| 171 | end if |
---|
| 172 | |
---|
| 173 | end subroutine nf95_get_var_2D_FourByteReal |
---|
| 174 | |
---|
| 175 | !*********************** |
---|
| 176 | |
---|
| 177 | subroutine nf95_get_var_2D_EightByteReal(ncid, varid, values, start, & |
---|
| 178 | count_nc, stride, map, ncerr) |
---|
| 179 | |
---|
| 180 | use typesizes, only: EightByteReal |
---|
| 181 | |
---|
| 182 | integer, intent(in) :: ncid, varid |
---|
| 183 | real (kind = EightByteReal), intent(out) :: values(:, :) |
---|
| 184 | integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map |
---|
| 185 | integer, intent(out), optional:: ncerr |
---|
| 186 | |
---|
| 187 | ! Variable local to the procedure: |
---|
| 188 | integer ncerr_not_opt |
---|
| 189 | |
---|
| 190 | !------------------- |
---|
| 191 | |
---|
| 192 | ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, & |
---|
| 193 | stride, map) |
---|
| 194 | if (present(ncerr)) then |
---|
| 195 | ncerr = ncerr_not_opt |
---|
| 196 | else |
---|
| 197 | call handle_err("nf95_get_var_2D_EightByteReal", ncerr_not_opt, ncid, & |
---|
| 198 | varid) |
---|
| 199 | end if |
---|
| 200 | |
---|
| 201 | end subroutine nf95_get_var_2D_EightByteReal |
---|
| 202 | |
---|
| 203 | !*********************** |
---|
| 204 | |
---|
| 205 | subroutine nf95_get_var_3D_FourByteInt(ncid, varid, values, start, & |
---|
| 206 | count_nc, stride, map, ncerr) |
---|
| 207 | |
---|
| 208 | integer, intent(in):: ncid, varid |
---|
| 209 | integer, intent(out):: values(:, :, :) |
---|
| 210 | integer, dimension(:), optional, intent(in):: start, count_nc, stride, map |
---|
| 211 | integer, intent(out), optional:: ncerr |
---|
| 212 | |
---|
| 213 | ! Variable local to the procedure: |
---|
| 214 | integer ncerr_not_opt |
---|
| 215 | |
---|
| 216 | !------------------- |
---|
| 217 | |
---|
| 218 | ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, & |
---|
| 219 | stride, map) |
---|
| 220 | if (present(ncerr)) then |
---|
| 221 | ncerr = ncerr_not_opt |
---|
| 222 | else |
---|
| 223 | call handle_err("nf95_get_var_3D_FourByteInt", ncerr_not_opt, ncid, & |
---|
| 224 | varid) |
---|
| 225 | end if |
---|
| 226 | |
---|
| 227 | end subroutine nf95_get_var_3D_FourByteInt |
---|
| 228 | |
---|
| 229 | !*********************** |
---|
| 230 | |
---|
| 231 | subroutine nf95_get_var_3D_FourByteReal(ncid, varid, values, start, & |
---|
| 232 | count_nc, stride, map, ncerr) |
---|
| 233 | |
---|
| 234 | integer, intent(in) :: ncid, varid |
---|
| 235 | real , intent(out) :: values(:, :, :) |
---|
| 236 | integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map |
---|
| 237 | integer, intent(out), optional:: ncerr |
---|
| 238 | |
---|
| 239 | ! Variable local to the procedure: |
---|
| 240 | integer ncerr_not_opt |
---|
| 241 | |
---|
| 242 | !------------------- |
---|
| 243 | |
---|
| 244 | ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, & |
---|
| 245 | stride, map) |
---|
| 246 | if (present(ncerr)) then |
---|
| 247 | ncerr = ncerr_not_opt |
---|
| 248 | else |
---|
| 249 | call handle_err("nf95_get_var_3D_FourByteReal", ncerr_not_opt, ncid, & |
---|
| 250 | varid) |
---|
| 251 | end if |
---|
| 252 | |
---|
| 253 | end subroutine nf95_get_var_3D_FourByteReal |
---|
| 254 | |
---|
| 255 | !*********************** |
---|
| 256 | |
---|
| 257 | subroutine nf95_get_var_3D_EightByteReal(ncid, varid, values, start, & |
---|
| 258 | count_nc, stride, map, ncerr) |
---|
| 259 | |
---|
| 260 | use typesizes, only: eightByteReal |
---|
| 261 | |
---|
| 262 | integer, intent(in) :: ncid, varid |
---|
| 263 | real (kind = EightByteReal), intent(out) :: values(:, :, :) |
---|
| 264 | integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map |
---|
| 265 | integer, intent(out), optional:: ncerr |
---|
| 266 | |
---|
| 267 | ! Variable local to the procedure: |
---|
| 268 | integer ncerr_not_opt |
---|
| 269 | |
---|
| 270 | !------------------- |
---|
| 271 | |
---|
| 272 | ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, & |
---|
| 273 | stride, map) |
---|
| 274 | if (present(ncerr)) then |
---|
| 275 | ncerr = ncerr_not_opt |
---|
| 276 | else |
---|
| 277 | call handle_err("nf95_get_var_3D_eightByteReal", ncerr_not_opt, ncid, & |
---|
| 278 | varid) |
---|
| 279 | end if |
---|
| 280 | |
---|
| 281 | end subroutine nf95_get_var_3D_EightByteReal |
---|
| 282 | |
---|
| 283 | !*********************** |
---|
| 284 | |
---|
| 285 | subroutine nf95_get_var_4D_FourByteReal(ncid, varid, values, start, & |
---|
| 286 | count_nc, stride, map, ncerr) |
---|
| 287 | |
---|
| 288 | integer, intent(in) :: ncid, varid |
---|
| 289 | real , intent(out) :: values(:, :, :, :) |
---|
| 290 | integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map |
---|
| 291 | integer, intent(out), optional:: ncerr |
---|
| 292 | |
---|
| 293 | ! Variable local to the procedure: |
---|
| 294 | integer ncerr_not_opt |
---|
| 295 | |
---|
| 296 | !------------------- |
---|
| 297 | |
---|
| 298 | ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, & |
---|
| 299 | stride, map) |
---|
| 300 | if (present(ncerr)) then |
---|
| 301 | ncerr = ncerr_not_opt |
---|
| 302 | else |
---|
| 303 | call handle_err("nf95_get_var_4D_FourByteReal", ncerr_not_opt, ncid, & |
---|
| 304 | varid) |
---|
| 305 | end if |
---|
| 306 | |
---|
| 307 | end subroutine nf95_get_var_4D_FourByteReal |
---|
| 308 | |
---|
| 309 | !*********************** |
---|
| 310 | |
---|
| 311 | subroutine nf95_get_var_4D_EightByteReal(ncid, varid, values, start, & |
---|
| 312 | count_nc, stride, map, ncerr) |
---|
| 313 | |
---|
| 314 | use typesizes, only: EightByteReal |
---|
| 315 | |
---|
| 316 | integer, intent(in):: ncid, varid |
---|
| 317 | real(kind = EightByteReal), intent(out):: values(:, :, :, :) |
---|
| 318 | integer, dimension(:), optional, intent(in):: start, count_nc, stride, map |
---|
| 319 | integer, intent(out), optional:: ncerr |
---|
| 320 | |
---|
| 321 | ! Variable local to the procedure: |
---|
| 322 | integer ncerr_not_opt |
---|
| 323 | |
---|
| 324 | !------------------- |
---|
| 325 | |
---|
| 326 | ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, & |
---|
| 327 | stride, map) |
---|
| 328 | if (present(ncerr)) then |
---|
| 329 | ncerr = ncerr_not_opt |
---|
| 330 | else |
---|
| 331 | call handle_err("nf95_get_var_4D_EightByteReal", ncerr_not_opt, ncid, & |
---|
| 332 | varid) |
---|
| 333 | end if |
---|
| 334 | |
---|
| 335 | end subroutine nf95_get_var_4D_EightByteReal |
---|
| 336 | |
---|
| 337 | !*********************** |
---|
| 338 | |
---|
| 339 | subroutine nf95_get_var_5D_FourByteReal(ncid, varid, values, start, & |
---|
| 340 | count_nc, stride, map, ncerr) |
---|
| 341 | |
---|
| 342 | integer, intent(in):: ncid, varid |
---|
| 343 | real, intent(out):: values(:, :, :, :, :) |
---|
| 344 | integer, dimension(:), optional, intent(in):: start, count_nc, stride, map |
---|
| 345 | integer, intent(out), optional:: ncerr |
---|
| 346 | |
---|
| 347 | ! Variable local to the procedure: |
---|
| 348 | integer ncerr_not_opt |
---|
| 349 | |
---|
| 350 | !------------------- |
---|
| 351 | |
---|
| 352 | ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, & |
---|
| 353 | stride, map) |
---|
| 354 | if (present(ncerr)) then |
---|
| 355 | ncerr = ncerr_not_opt |
---|
| 356 | else |
---|
| 357 | call handle_err("nf95_get_var_5D_FourByteReal", ncerr_not_opt, ncid, & |
---|
| 358 | varid) |
---|
| 359 | end if |
---|
| 360 | |
---|
| 361 | end subroutine nf95_get_var_5D_FourByteReal |
---|
| 362 | |
---|
| 363 | !*********************** |
---|
| 364 | |
---|
| 365 | subroutine nf95_get_var_5D_EightByteReal(ncid, varid, values, start, & |
---|
| 366 | count_nc, stride, map, ncerr) |
---|
| 367 | |
---|
| 368 | use typesizes, only: EightByteReal |
---|
| 369 | |
---|
| 370 | integer, intent(in):: ncid, varid |
---|
| 371 | real(kind = EightByteReal), intent(out):: values(:, :, :, :, :) |
---|
| 372 | integer, dimension(:), optional, intent(in):: start, count_nc, stride, map |
---|
| 373 | integer, intent(out), optional:: ncerr |
---|
| 374 | |
---|
| 375 | ! Variable local to the procedure: |
---|
| 376 | integer ncerr_not_opt |
---|
| 377 | |
---|
| 378 | !------------------- |
---|
| 379 | |
---|
| 380 | ncerr_not_opt = nf90_get_var(ncid, varid, values, start, count_nc, & |
---|
| 381 | stride, map) |
---|
| 382 | if (present(ncerr)) then |
---|
| 383 | ncerr = ncerr_not_opt |
---|
| 384 | else |
---|
| 385 | call handle_err("nf95_get_var_5D_EightByteReal", ncerr_not_opt, ncid, & |
---|
| 386 | varid) |
---|
| 387 | end if |
---|
| 388 | |
---|
| 389 | end subroutine nf95_get_var_5D_EightByteReal |
---|
| 390 | |
---|
| 391 | end module nf95_get_var_m |
---|