1 |
guez |
3 |
module o3_Mob_ph_m |
2 |
|
|
|
3 |
|
|
implicit none |
4 |
|
|
|
5 |
|
|
contains |
6 |
|
|
|
7 |
|
|
function o3_Mob_ph(ncid, name) |
8 |
|
|
|
9 |
|
|
! This function reads a single Mobidic ozone parameter from a file and |
10 |
|
|
! packs it on the "physics" grid. |
11 |
|
|
|
12 |
|
|
use dimens_m, only: iim, jjm, llm |
13 |
|
|
use dimphy, only: klon |
14 |
|
|
use netcdf95, only: nf95_inq_varid, nf90_get_var, handle_err |
15 |
|
|
use grid_change, only: dyn_phy |
16 |
|
|
|
17 |
|
|
integer, intent(in):: ncid ! NetCDF ID of the file |
18 |
|
|
character(len=*), intent(in):: name ! of the NetCDF variable |
19 |
|
|
|
20 |
|
|
real o3_Mob_ph(klon, llm, 12) |
21 |
|
|
! (ozone parameter from Mobidic on the "physics" grid) |
22 |
|
|
! (Third dimension is the number of the month in the year. |
23 |
|
|
! "o3_Mob_ph(i, k, month)" is at longitude "xlon(i)", latitude |
24 |
|
|
! "xlat(i)", middle of layer "k".) |
25 |
|
|
|
26 |
|
|
! Variables local to the procedure: |
27 |
|
|
integer varid, ncerr |
28 |
|
|
integer k, month |
29 |
|
|
|
30 |
|
|
real o3_Mob_dyn(iim + 1, jjm + 1, llm, 12) |
31 |
|
|
! (ozone parameter from Mobidic on the "dynamics" grid) |
32 |
|
|
! Fourth dimension is the number of the month in the year. |
33 |
|
|
! "o3_Mob_dyn(i, j, k, month)" is at longitude "rlonv(i)", latitude |
34 |
|
|
! "rlatu(j)", middle of layer "k".) |
35 |
|
|
|
36 |
|
|
!-------------------------------------------- |
37 |
|
|
|
38 |
|
|
call nf95_inq_varid(ncid, name, varid) |
39 |
|
|
ncerr = nf90_get_var(ncid, varid, o3_Mob_dyn) |
40 |
|
|
call handle_err("o3_Mob_ph nf90_get_var " // name, ncerr, ncid) |
41 |
|
|
|
42 |
|
|
! Latitudes are in increasing order in the input file while |
43 |
|
|
! "rlatu" is in decreasing order, so invert: |
44 |
|
|
o3_Mob_dyn = o3_Mob_dyn(:, jjm+1:1:-1, :, :) |
45 |
|
|
forall (k = 1:llm, month = 1:12) & |
46 |
|
|
o3_Mob_ph(:, k, month) = pack(o3_Mob_dyn(:, :, k, month), dyn_phy) |
47 |
|
|
|
48 |
|
|
end function o3_Mob_ph |
49 |
|
|
|
50 |
|
|
end module o3_Mob_ph_m |