22 mpp_overwr, mpp_netcdf, mpp_multi, mpp_single,&
62 character(len=*),
intent(in) :: name
63 integer,
intent(in),
optional :: nvar
64 real,
dimension(:),
optional,
intent(in) :: grid_lon, grid_lat
65 integer,
intent(in),
optional :: thread, fset
68 integer :: threading, fileset
69 character(len=128) :: units, time_units
70 real,
dimension(max_levels_file) :: array
72 type(
axistype) :: depth_axis, station_axis, lon_axis, lat_axis
77 if (
PRESENT(thread)) threading=thread
78 if (
PRESENT(fset)) fileset=fset
82 call mpp_open(unit, trim(name), action=mpp_overwr, form=mpp_netcdf,&
83 threading=threading, fileset=fileset)
90 &in module write_ocean_data, increase param : max_files')
98 if (
PRESENT(grid_lon) .and.
PRESENT(grid_lat))
then 100 'observational grid longitude',cartesian=
'X',sense=1,data=grid_lon)
103 'observational grid latitude', cartesian=
'Y',sense=1,data=grid_lat)
110 call mpp_write_meta(unit,depth_axis,
'depth_index',
'none',
'depth index',&
111 cartesian=
'Z',sense=-1,data=array)
114 'station index', cartesian=
'T',sense=1)
116 if (
PRESENT(grid_lon) .and.
PRESENT(grid_lat))
then 118 'longitude_index',
'none',
'longitude_index', missing=missing_value)
120 'latitude_index',
'none',
'latitude_index',missing=missing_value)
124 'nvar',
'none',
'temp (1) or temp and salt (2)')
127 'longitude',
'degrees_E',
'longitude',&
131 'latitude',
'degrees_N',
'latitude',&
135 'profile_flag',
'none',
'profile_flag',&
136 min=0.0,
max=10.0,missing=missing_value)
140 'profile_flag_s',
'none',
'profile_flag for salt',&
141 min=0.0,
max=10.0,missing=missing_value)
144 write(time_units,
'(a,i4.4,a,i2.2,a,i2.2,a)')
'days since ',
ref_yr,
'-',
ref_mon,
'-',
ref_day,
' 00:00:00' 147 'time',trim(time_units),
'time')
150 'yyyy',
'none',
'yyyy')
153 'mmdd',
'none',
'mmdd')
159 'temp_error',trim(units),
'measurement error of temperature',missing=missing_value)
163 'salt_error',trim(units),
'measurement error of salinity',missing=missing_value)
166 'project',
'none',
'see NODC codes')
169 'probe',
'none',
'see NODC codes')
172 'ref_inst',
'none',
'see NODC codes')
175 'fix_depth',
'none',
'see NODC codes')
178 'database_id',
'none',
'see NODC codes')
181 'ocn_vehicle',
'none',
'see NODC codes')
184 'link',
'none',
'partial_profile flag')
189 'temp',trim(units),
'in-situ temperature',&
190 min=-10.0,
max=50.0,missing=missing_value)
194 'salt',trim(units),
'salinity',&
195 min=0.0,
max=50.0,missing=missing_value)
198 'depth',
'meters',
'depth of obs',&
199 min=0.0,
max=7000.0,missing=missing_value)
204 'temp_flag',
'none',
'temperature level flag (see NODC codes)',missing=missing_value)
207 'salt_flag',
'none',
'salinity level flag (see NODC codes)',missing=missing_value)
213 if (
PRESENT(grid_lon).and.
PRESENT(grid_lat))
then 227 integer,
intent(in) :: unit
230 real,
dimension(max_levels_file) :: data_t, data_s, depth
231 integer :: levels, secs, days, i, j, nlinks
232 real :: profile_flag, profile_flag_s, days_since, error, nvar, station
234 real,
dimension(max_levels_file) :: flag_t, flag_s
235 logical :: grid_ptr = .false.
237 integer :: isc,iec,jsc,jec,isd,ied,jsd,jed
238 logical :: debug=.false.
250 if (findex .eq. -1)
call mpp_error(fatal,
'Attempt write to unopened file in& 251 &write_ocean_data_mod:write_profile_data')
259 data_t=missing_value;data_s=missing_value;depth=missing_value
260 flag_t=missing_value;flag_s=missing_value
261 data_t(1:levels)=profile%data_t(1:levels)
262 flag_t(1:levels)=profile%flag_t(1:levels)
264 if (
ASSOCIATED(profile%Model_Grid)) grid_ptr = .true.
269 if (floor(profile%i_index) .lt. isc .or. floor(profile%i_index) .gt. iec)
return 270 if (floor(profile%j_index) .lt. jsc .or. floor(profile%j_index) .gt. jec)
return 273 if (profile%nvar == 2)
then 274 data_s(1:levels) = profile%data_s(1:levels)
275 flag_s(1:levels)=profile%flag_s(1:levels)
278 depth(1:levels)=profile%depth(1:levels)
281 days_since = days + secs/86400.
295 profile_flag = profile%profile_flag
297 profile_flag = profile%profile_flag_s
302 tmp_s =
real(profile%yyyy)
304 tmp_s =
real(profile%mmdd)
314 if (nlinks .gt. 0)
then 320 if (profile%i_index .ne. -1.0 .and. profile%j_index .ne. -1.0)
then 328 if (i.eq.nlinks)
then 334 data_t = missing_value; data_s = missing_value; depth = missing_value
335 flag_t=missing_value;flag_s=missing_value
340 if (profile%nvar == 2)
then 360 profile_flag = profile%profile_flag
362 profile_flag = profile%profile_flag_s
367 tmp_s =
real(profile%yyyy)
369 tmp_s =
real(profile%mmdd)
374 if (profile%i_index .ne. -1.0 .and. profile%j_index .ne. -1.0)
then 379 if (i .lt. nlinks)
then 391 integer,
intent(in) :: unit
type(fieldtype), save probe_field
type(fieldtype), save ocn_vehicle_field
integer, parameter, public max_levels_file
Controls record length for optimal storage.
type(fieldtype), save lon_index_field
type(fieldtype), save mmdd_field
integer, dimension(max_files), save unit_num
integer, parameter ref_sec
type(fieldtype), save lat_field
integer, parameter ref_yr
integer function, public open_profile_file(name, nvar, grid_lon, grid_lat, thread, fset)
integer, parameter ref_hr
type(fieldtype), save profile_flag_s_field
type(fieldtype), save yyyy_field
type(fieldtype), save data_s_field
type(fieldtype), save link_field
type(fieldtype), save nvar_field
integer, dimension(max_files), save sta_num
type(fieldtype), save lat_index_field
type(fieldtype), save salt_err_field
type(fieldtype), save project_field
type(fieldtype), save depth_field
integer, parameter ref_min
integer, parameter max_files
subroutine, public write_ocean_data_init()
subroutine, public write_profile(unit, profile)
logical module_is_initialized
type(fieldtype), save flag_t_field
type(fieldtype), save profile_flag_field
type(fieldtype), save flag_s_field
type(fieldtype), save data_t_field
type(fieldtype), save ref_inst_field
integer, parameter ref_mon
real, parameter, public missing_value
type(fieldtype), save fix_depth_field
subroutine, public close_profile_file(unit)
type(fieldtype), save lon_field
subroutine, public get_time(Time, seconds, days, ticks, err_msg)
type(fieldtype), save temp_err_field
type(fieldtype), save time_field
type(fieldtype), save database_id_field
integer, parameter ref_day