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