18 real(r_kind) :: observation_type
19 real(r_kind) :: latitude
20 real(r_kind) :: longitude
23 real(r_kind) :: observation
24 real(r_kind) :: observation_error
25 real(r_kind) :: obs_minus_forecast
30 character(len=120) :: filename
31 logical :: append=.false.
44 subroutine init(self, nobs, filename)
48 class(diag_marine_obs) ,
intent(out) :: self
49 integer ,
intent(in) :: nobs
50 character(len=120) ,
intent(in) :: filename
53 self%filename=filename
54 allocate(self%diag(nobs))
64 class(diag_marine_obs),
intent(inout) :: self
81 class(diag_marine_obs),
intent(inout) :: self
84 integer(kind=4) :: iNcid,i,iStationNo
85 integer(kind=4) :: iDimStation_ID,iDimTime_ID,iDimLenStringName_ID, iDimLev_ID
86 integer(kind=4) :: iVarLON_ID, iVarLAT_ID, iVarLev_ID, iVarObs_ID
87 integer(kind=4) :: iVarOMF_ID, iVarOMA_ID, iVarSIGO_ID, iVarOBSID_ID
89 integer,
allocatable :: obsid(:)
90 integer :: nlev,nobs,iobs
93 call check(nf90_create(self%filename, nf90_clobber, incid))
94 call check(nf90_def_dim(incid,
"nobs", nf90_unlimited, idimstation_id))
98 call check( nf90_def_var(incid,
"OBSID", nf90_int, (/ idimstation_id /), ivarobsid_id) )
99 call check( nf90_def_var(incid,
"lon", nf90_real, (/ idimstation_id /), ivarlon_id) )
100 call check( nf90_def_var(incid,
"lat", nf90_real, (/ idimstation_id /), ivarlat_id) )
101 call check( nf90_def_var(incid,
"lev", nf90_real, (/ idimstation_id /), ivarlev_id) )
102 call check( nf90_def_var(incid,
"obs", nf90_real, (/ idimstation_id /), ivarobs_id) )
103 call check( nf90_def_var(incid,
"sigo", nf90_real, (/ idimstation_id /), ivarsigo_id) )
104 call check( nf90_def_var(incid,
"omf", nf90_real, (/ idimstation_id /), ivaromf_id) )
107 call check(nf90_enddef(incid))
110 call check(nf90_put_var(incid, ivarlon_id , self%diag(:)%Station_ID))
111 call check(nf90_put_var(incid, ivarlon_id , self%diag(:)%Longitude))
112 call check(nf90_put_var(incid, ivarlat_id , self%diag(:)%Latitude))
113 call check(nf90_put_var(incid, ivarlev_id , self%diag(:)%Depth))
114 call check(nf90_put_var(incid, ivarsigo_id , self%diag(:)%Observation_error))
115 call check(nf90_put_var(incid, ivarobs_id , self%diag(:)%Observation))
116 call check(nf90_put_var(incid, ivaromf_id , self%diag(:)%Obs_Minus_Forecast))
119 call check(nf90_close(incid))
125 subroutine write_geoval(self,varname,geoval,arg_dim_name)
133 class(diag_marine_obs) ,
intent(in) :: self
134 character(len=MAXVARLEN) ,
intent(in) :: varname
135 type(ufo_geoval) ,
pointer,
intent(in) :: geoval
136 character(len=MAXVARLEN),
optional ,
intent(in) :: arg_dim_name
138 integer(kind=4) :: iNcid
139 integer(kind=4) :: iDimStation_ID, iDimLev_ID
140 integer(kind=4) :: iVargeoval_ID
141 integer :: nlev, ndims
142 character(len=MAXVARLEN) :: dim_name
145 if (
present(arg_dim_name)) dim_name=arg_dim_name
147 if (self%append)
then 148 call check( nf90_open(self%filename, nf90_write, incid) )
149 call check( nf90_inquire(incid, ndimensions = ndims) )
150 call check( nf90_inq_dimid(incid,
"nobs", idimstation_id) )
152 call check( nf90_inq_dimid(incid, dim_name, idimlev_id) )
154 call check( nf90_redef(incid) )
157 call check(nf90_def_dim(incid, dim_name, nlev, idimlev_id))
160 call check(nf90_create(self%filename, nf90_clobber, incid))
161 call check(nf90_def_dim(incid,
"nobs", nf90_unlimited, idimstation_id))
163 call check(nf90_def_dim(incid, dim_name, nlev, idimlev_id))
167 call check( nf90_def_var(incid, varname, nf90_real, (/ idimlev_id, idimstation_id /), ivargeoval_id) )
170 call check(nf90_enddef(incid))
173 call check(nf90_put_var(incid, ivargeoval_id , geoval%vals))
176 call check(nf90_close(incid))
182 subroutine check(status)
186 integer(4),
intent ( in) :: status
187 if(status /= nf90_noerr)
then 188 print *, trim(nf90_strerror(status))
subroutine finalize(self)
Fortran module to handle temperature profile observations.
subroutine write_geoval(self, varname, geoval, arg_dim_name)
subroutine write_diag(self)
subroutine init(self, nobs, filename)