32 |
! We assume that the grid is rectilinear. |
! We assume that the grid is rectilinear. |
33 |
|
|
34 |
USE errioipsl, ONLY: histerr |
USE errioipsl, ONLY: histerr |
35 |
USE histcom_var, ONLY: full_size, hax_name, nb_hax, ncdf_ids, & |
USE histcom_var, ONLY: full_size, hax_name, nb_hax, ncdf_ids, slab_sz, & |
36 |
slab_ori, slab_sz, xid, yid |
xid, yid |
37 |
USE netcdf, ONLY: nf90_def_var, nf90_enddef, nf90_float, & |
USE netcdf, ONLY: nf90_float |
38 |
nf90_put_att, nf90_put_var, nf90_redef |
use netcdf95, only: nf95_redef, nf95_def_var, nf95_enddef, nf95_put_att, & |
39 |
|
nf95_put_var |
40 |
|
|
41 |
INTEGER, INTENT (IN):: pfileid, pim, pjm |
INTEGER, INTENT (IN):: pfileid, pim, pjm |
42 |
REAL, INTENT (IN), DIMENSION (pim, pjm):: plon, plat |
REAL, INTENT (IN), DIMENSION (pim, pjm):: plon, plat |
46 |
CHARACTER (len=25):: lon_name, lat_name |
CHARACTER (len=25):: lon_name, lat_name |
47 |
CHARACTER (len=80):: tmp_title, tmp_name |
CHARACTER (len=80):: tmp_title, tmp_name |
48 |
INTEGER:: ndim |
INTEGER:: ndim |
49 |
INTEGER, DIMENSION (2):: dims(2) |
INTEGER dims(2) |
50 |
INTEGER:: nlonid, nlatid |
INTEGER:: nlonid, nlatid |
51 |
INTEGER:: orix, oriy, par_szx, par_szy |
INTEGER:: par_szx, par_szy |
52 |
INTEGER:: iret, ncid |
INTEGER ncid |
53 |
|
|
54 |
!--------------------------------------------------------------------- |
!--------------------------------------------------------------------- |
55 |
|
|
91 |
ndim = 1 |
ndim = 1 |
92 |
dims(1:1) = (/ xid(pfileid) /) |
dims(1:1) = (/ xid(pfileid) /) |
93 |
|
|
94 |
iret = nf90_def_var(ncid, lon_name, nf90_float, dims(1:ndim), nlonid) |
call nf95_def_var(ncid, lon_name, nf90_float, dims(1:ndim), nlonid) |
95 |
iret = nf90_put_att(ncid, nlonid, 'units', 'degrees_east') |
call nf95_put_att(ncid, nlonid, 'units', 'degrees_east') |
96 |
iret = nf90_put_att(ncid, nlonid, 'valid_min', real(minval(plon))) |
call nf95_put_att(ncid, nlonid, 'valid_min', real(minval(plon))) |
97 |
iret = nf90_put_att(ncid, nlonid, 'valid_max', real(maxval(plon))) |
call nf95_put_att(ncid, nlonid, 'valid_max', real(maxval(plon))) |
98 |
iret = nf90_put_att(ncid, nlonid, 'long_name', 'Longitude') |
call nf95_put_att(ncid, nlonid, 'long_name', 'Longitude') |
99 |
iret = nf90_put_att(ncid, nlonid, 'nav_model', trim(tmp_title)) |
call nf95_put_att(ncid, nlonid, 'nav_model', trim(tmp_title)) |
100 |
|
|
101 |
! 3.0 Latitude |
! 3.0 Latitude |
102 |
|
|
103 |
ndim = 1 |
ndim = 1 |
104 |
dims(1:1) = (/ yid(pfileid) /) |
dims(1:1) = (/ yid(pfileid) /) |
105 |
|
|
106 |
iret = nf90_def_var(ncid, lat_name, nf90_float, dims(1:ndim), nlatid) |
call nf95_def_var(ncid, lat_name, nf90_float, dims(1:ndim), nlatid) |
107 |
iret = nf90_put_att(ncid, nlatid, 'units', 'degrees_north') |
call nf95_put_att(ncid, nlatid, 'units', 'degrees_north') |
108 |
iret = nf90_put_att(ncid, nlatid, 'valid_min', real(minval(plat))) |
call nf95_put_att(ncid, nlatid, 'valid_min', real(minval(plat))) |
109 |
iret = nf90_put_att(ncid, nlatid, 'valid_max', real(maxval(plat))) |
call nf95_put_att(ncid, nlatid, 'valid_max', real(maxval(plat))) |
110 |
iret = nf90_put_att(ncid, nlatid, 'long_name', 'Latitude') |
call nf95_put_att(ncid, nlatid, 'long_name', 'Latitude') |
111 |
iret = nf90_put_att(ncid, nlatid, 'nav_model', trim(tmp_title)) |
call nf95_put_att(ncid, nlatid, 'nav_model', trim(tmp_title)) |
112 |
|
|
113 |
iret = nf90_enddef(ncid) |
call nf95_enddef(ncid) |
114 |
|
|
115 |
! 4.0 storing the geographical coordinates |
! 4.0 storing the geographical coordinates |
116 |
|
|
|
orix = slab_ori(pfileid, 1) |
|
|
oriy = slab_ori(pfileid, 2) |
|
117 |
par_szx = slab_sz(pfileid, 1) |
par_szx = slab_sz(pfileid, 1) |
118 |
par_szy = slab_sz(pfileid, 2) |
par_szy = slab_sz(pfileid, 2) |
119 |
|
|
120 |
! Transfer the longitude |
! Transfer the longitude |
121 |
|
|
122 |
iret = nf90_put_var(ncid, nlonid, plon(1:par_szx, 1)) |
call nf95_put_var(ncid, nlonid, plon(1:par_szx, 1)) |
123 |
|
|
124 |
! Transfer the latitude |
! Transfer the latitude |
125 |
|
|
126 |
iret = nf90_put_var(ncid, nlatid, plat(1, 1:par_szy)) |
call nf95_put_var(ncid, nlatid, plat(1, 1:par_szy)) |
127 |
|
|
128 |
iret = nf90_redef(ncid) |
call nf95_redef(ncid) |
129 |
|
|
130 |
END SUBROUTINE histhori_regular |
END SUBROUTINE histhori_regular |
131 |
|
|