1 module fms_diag_field_object_mod
14 use diag_data_mod,
only: diag_null, diag_not_found, diag_not_registered, diag_registered_id, &
17 use fms_string_utils_mod,
only: int2str=>
string
24 use fms2_io_mod,
only: fmsnetcdffile_t, fmsnetcdfdomainfile_t, fmsnetcdfunstructureddomainfile_t,
register_field, &
25 register_variable_attribute
41 integer,
allocatable,
dimension(:) :: file_ids
43 integer,
allocatable,
private :: diag_id
44 integer,
allocatable,
dimension(:) :: buffer_ids
46 integer,
private :: num_attributes
47 logical,
allocatable,
private :: static
48 logical,
allocatable,
private :: scalar
49 logical,
allocatable,
private :: registered
50 logical,
allocatable,
private :: mask_variant
51 logical,
allocatable,
private :: var_is_masked
52 logical,
allocatable,
private :: do_not_log
53 logical,
allocatable,
private :: local
54 integer,
allocatable,
private :: vartype
55 character(len=:),
allocatable,
private :: varname
56 character(len=:),
allocatable,
private :: longname
57 character(len=:),
allocatable,
private :: standname
58 character(len=:),
allocatable,
private :: units
59 character(len=:),
allocatable,
private :: modname
60 character(len=:),
allocatable,
private :: realm
62 character(len=:),
allocatable,
private :: interp_method
66 integer,
allocatable,
dimension(:),
private :: frequency
67 integer,
allocatable,
private :: tile_count
68 integer,
allocatable,
dimension(:),
private :: axis_ids
70 INTEGER ,
private :: type_of_domain
72 integer,
allocatable,
private :: area, volume
73 class(*),
allocatable,
private :: missing_value
74 class(*),
allocatable,
private :: data_range(:)
77 logical,
allocatable,
private :: multiple_send_data
79 logical,
allocatable,
private :: data_buffer_is_allocated
81 logical,
allocatable,
private :: math_needs_to_be_done
83 logical,
allocatable :: buffer_allocated
86 logical,
allocatable :: mask(:,:,:,:)
87 logical :: halo_present = .false.
91 procedure :: get_id => fms_diag_get_id
92 procedure :: id_from_name => diag_field_id_from_name
93 procedure :: copy => copy_diag_obj
94 procedure :: register => fms_register_diag_field_obj
95 procedure :: setid => set_diag_id
96 procedure :: set_type => set_vartype
97 procedure :: set_data_buffer => set_data_buffer
98 procedure :: prepare_data_buffer
99 procedure :: init_data_buffer
100 procedure :: set_data_buffer_is_allocated
101 procedure :: set_send_data_time
102 procedure :: get_send_data_time
103 procedure :: is_data_buffer_allocated
104 procedure :: allocate_data_buffer
105 procedure :: set_math_needs_to_be_done => set_math_needs_to_be_done
106 procedure :: add_attribute => diag_field_add_attribute
107 procedure :: vartype_inq => what_is_vartype
108 procedure :: set_var_is_masked
109 procedure :: get_var_is_masked
111 procedure :: is_static => diag_obj_is_static
112 procedure :: is_scalar
113 procedure :: is_registered => get_registered
114 procedure :: is_registeredb => diag_obj_is_registered
115 procedure :: is_mask_variant => get_mask_variant
116 procedure :: is_local => get_local
119 procedure :: has_diag_id
120 procedure :: has_attributes
121 procedure :: has_static
122 procedure :: has_registered
123 procedure :: has_mask_variant
124 procedure :: has_local
125 procedure :: has_vartype
126 procedure :: has_varname
127 procedure :: has_longname
128 procedure :: has_standname
129 procedure :: has_units
130 procedure :: has_modname
131 procedure :: has_realm
132 procedure :: has_interp_method
133 procedure :: has_frequency
134 procedure :: has_tile_count
135 procedure :: has_axis_ids
136 procedure :: has_area
137 procedure :: has_volume
138 procedure :: has_missing_value
139 procedure :: has_data_range
140 procedure :: has_input_data_buffer
142 procedure :: get_attributes
143 procedure :: get_static
144 procedure :: get_registered
145 procedure :: get_mask_variant
146 procedure :: get_local
147 procedure :: get_vartype
148 procedure :: get_varname
149 procedure :: get_longname
150 procedure :: get_standname
151 procedure :: get_units
152 procedure :: get_modname
153 procedure :: get_realm
154 procedure :: get_interp_method
155 procedure :: get_frequency
156 procedure :: get_tile_count
157 procedure :: get_area
158 procedure :: get_volume
159 procedure :: get_missing_value
160 procedure :: get_data_range
161 procedure :: get_axis_id
162 procedure :: get_data_buffer
163 procedure :: get_mask
164 procedure :: get_weight
165 procedure :: dump_field_obj
166 procedure :: get_domain
167 procedure :: get_type_of_domain
168 procedure :: set_file_ids
169 procedure :: get_dimnames
170 procedure :: get_var_skind
171 procedure :: get_longname_to_write
172 procedure :: get_multiple_send_data
173 procedure :: write_field_metadata
174 procedure :: write_coordinate_attribute
175 procedure :: get_math_needs_to_be_done
176 procedure :: add_area_volume
177 procedure :: append_time_cell_methods
178 procedure :: get_file_ids
179 procedure :: set_mask
180 procedure :: allocate_mask
181 procedure :: set_halo_present
182 procedure :: is_halo_present
183 procedure :: find_missing_value
184 procedure :: has_mask_allocated
185 procedure :: is_variable_in_file
186 procedure :: get_field_file_name
187 procedure :: generate_associated_files_att
192 logical,
private :: module_is_initialized = .false.
197 public :: fms_diag_fields_object_init
199 public :: fms_diag_field_object_end
200 public :: get_default_missing_value
201 public :: check_for_slices
209 subroutine fms_diag_field_object_end (ob)
211 if (
allocated(ob))
deallocate(ob)
212 module_is_initialized = .false.
213 end subroutine fms_diag_field_object_end
218 logical function fms_diag_fields_object_init(ob)
223 ob(i)%diag_id = diag_not_registered
224 ob(i)%registered = .false.
226 module_is_initialized = .true.
227 fms_diag_fields_object_init = .true.
228 end function fms_diag_fields_object_init
231 subroutine fms_register_diag_field_obj &
232 (this, modname, varname, diag_field_indices, diag_axis, axes, &
233 longname, units, missing_value, varrange, mask_variant, standname, &
234 do_not_log, err_msg, interp_method, tile_count, area, volume, realm, static, &
238 CHARACTER(len=*),
INTENT(in) :: modname
239 CHARACTER(len=*),
INTENT(in) :: varname
240 integer,
INTENT(in) :: diag_field_indices(:)
243 INTEGER,
TARGET,
OPTIONAL,
INTENT(in) :: axes(:)
244 CHARACTER(len=*),
OPTIONAL,
INTENT(in) :: longname
245 CHARACTER(len=*),
OPTIONAL,
INTENT(in) :: units
246 CHARACTER(len=*),
OPTIONAL,
INTENT(in) :: standname
247 class(*),
OPTIONAL,
INTENT(in) :: missing_value
248 class(*),
OPTIONAL,
INTENT(in) :: varrange(2)
249 LOGICAL,
OPTIONAL,
INTENT(in) :: mask_variant
250 LOGICAL,
OPTIONAL,
INTENT(in) :: do_not_log
251 CHARACTER(len=*),
OPTIONAL,
INTENT(out) :: err_msg
252 CHARACTER(len=*),
OPTIONAL,
INTENT(in) :: interp_method
256 INTEGER,
OPTIONAL,
INTENT(in) :: tile_count
257 INTEGER,
OPTIONAL,
INTENT(in) :: area
258 INTEGER,
OPTIONAL,
INTENT(in) :: volume
259 CHARACTER(len=*),
OPTIONAL,
INTENT(in) :: realm
261 LOGICAL,
OPTIONAL,
INTENT(in) :: static
262 LOGICAL,
OPTIONAL,
INTENT(in) :: multiple_send_data
265 character(len=:),
allocatable,
target :: a_name_tmp
269 this%varname = trim(varname)
270 this%modname = trim(modname)
275 if (
present(static))
then
278 this%static = .false.
282 if (
present(axes))
then
284 this%scalar = .false.
290 do i=1,
SIZE(diag_field_indices)
291 yaml_var_ptr => diag_yaml%get_diag_field_from_id(diag_field_indices(i))
294 a_name_tmp = diag_axis(axes(j))%axis%get_axis_name( yaml_var_ptr%is_file_subregional())
295 if(yaml_var_ptr%has_var_zbounds() .and. a_name_tmp .eq.
'z') &
296 a_name_tmp = trim(a_name_tmp)//
"_sub01"
297 call yaml_var_ptr%add_axis_name(a_name_tmp)
300 if(yaml_var_ptr%has_n_diurnal())
then
301 a_name_tmp =
"time_of_day_"// int2str(yaml_var_ptr%get_n_diurnal())
302 call yaml_var_ptr%add_axis_name(a_name_tmp)
305 if(.not. this%static)
then
307 call yaml_var_ptr%add_axis_name(a_name_tmp)
313 this%type_of_domain = no_domain
314 this%domain => null()
316 if(.not. this%static)
then
317 do i=1,
SIZE(diag_field_indices)
319 yaml_var_ptr => diag_yaml%get_diag_field_from_id(diag_field_indices(i))
320 call yaml_var_ptr%add_axis_name(a_name_tmp)
324 nullify(yaml_var_ptr)
327 if (
present(longname)) this%longname = trim(longname)
328 if (
present(standname)) this%standname = trim(standname)
331 if (
present(units))
then
332 if (trim(units) .ne.
"none") this%units = trim(units)
334 if (
present(realm)) this%realm = trim(realm)
335 if (
present(interp_method)) this%interp_method = trim(interp_method)
337 if (
present(tile_count))
then
338 allocate(this%tile_count)
339 this%tile_count = tile_count
342 if (
present(missing_value))
then
343 select type (missing_value)
344 type is (
integer(kind=i4_kind))
345 allocate(
integer(kind=i4_kind) :: this%missing_value)
346 this%missing_value = missing_value
347 type is (
integer(kind=i8_kind))
348 allocate(
integer(kind=i8_kind) :: this%missing_value)
349 this%missing_value = missing_value
350 type is (real(kind=r4_kind))
351 allocate(real(kind=r4_kind) :: this%missing_value)
352 this%missing_value = missing_value
353 type is (real(kind=r8_kind))
354 allocate(real(kind=r8_kind) :: this%missing_value)
355 this%missing_value = missing_value
357 call mpp_error(
"fms_register_diag_field_obj", &
358 "The missing value passed to register a diagnostic is not a r8, r4, i8, or i4",&
363 if (
present(varrange))
then
364 select type (varrange)
365 type is (
integer(kind=i4_kind))
366 allocate(
integer(kind=i4_kind) :: this%data_range(2))
367 this%data_RANGE = varrange
368 type is (
integer(kind=i8_kind))
369 allocate(
integer(kind=i8_kind) :: this%data_range(2))
370 this%data_RANGE = varrange
371 type is (real(kind=r4_kind))
372 allocate(
integer(kind=r4_kind) :: this%data_range(2))
373 this%data_RANGE = varrange
374 type is (real(kind=r8_kind))
375 allocate(
integer(kind=r8_kind) :: this%data_range(2))
376 this%data_RANGE = varrange
378 call mpp_error(
"fms_register_diag_field_obj", &
379 "The varRange passed to register a diagnostic is not a r8, r4, i8, or i4",&
384 if (
present(area))
then
385 if (area < 0)
call mpp_error(
"fms_register_diag_field_obj", &
386 "The area id passed with field_name"//trim(varname)//
" has not been registered. &
387 &Check that there is a register_diag_field call for the AREA measure and that is in the &
388 &diag_table.yaml", fatal)
393 if (
present(volume))
then
394 if (volume < 0)
call mpp_error(
"fms_register_diag_field_obj", &
395 "The volume id passed with field_name"//trim(varname)//
" has not been registered. &
396 &Check that there is a register_diag_field call for the VOLUME measure and that is in the &
397 &diag_table.yaml", fatal)
398 allocate(this%volume)
402 this%mask_variant = .false.
403 if (
present(mask_variant))
then
404 this%mask_variant = mask_variant
407 if (
present(do_not_log))
then
408 allocate(this%do_not_log)
409 this%do_not_log = do_not_log
412 if (
present(multiple_send_data))
then
413 this%multiple_send_data = multiple_send_data
415 this%multiple_send_data = .false.
420 allocate(this%attributes(max_field_attributes))
421 this%num_attributes = 0
422 this%registered = .true.
423 end subroutine fms_register_diag_field_obj
427 subroutine set_diag_id(this , id)
430 if (
allocated(this%registered))
then
431 if (this%registered)
then
432 call mpp_error(
"set_diag_id",
"The variable"//this%varname//
" is already registered", fatal)
439 end subroutine set_diag_id
442 subroutine set_vartype(objin , var)
446 type is (real(kind=8))
448 type is (real(kind=4))
450 type is (
integer(kind=8))
452 type is (
integer(kind=4))
454 type is (
character(*))
457 objin%vartype = null_type_int
458 call mpp_error(
"set_vartype",
"The variable"//objin%varname//
" is not a supported type "// &
459 " r8, r4, i8, i4, or string.", warning)
461 end subroutine set_vartype
464 subroutine set_send_data_time (this, time)
468 call this%input_data_buffer%set_send_data_time(time)
469 end subroutine set_send_data_time
473 function get_send_data_time(this) &
478 rslt = this%input_data_buffer%get_send_data_time()
479 end function get_send_data_time
482 subroutine prepare_data_buffer(this)
485 if (.not. this%multiple_send_data)
return
486 if (this%mask_variant)
return
487 call this%input_data_buffer%prepare_input_buffer_object(this%modname//
":"//this%varname)
488 end subroutine prepare_data_buffer
491 subroutine init_data_buffer(this)
494 if (.not. this%multiple_send_data)
return
495 if (this%mask_variant)
return
496 call this%input_data_buffer%init_input_buffer_object()
497 end subroutine init_data_buffer
500 subroutine set_data_buffer (this, input_data, mask, weight, is, js, ks, ie, je, ke)
502 class(*),
intent(in) :: input_data(:,:,:,:)
503 logical,
intent(in) :: mask(:,:,:,:)
505 real(kind=r8_kind),
intent(in) :: weight
506 integer,
intent(in) :: is, js, ks
508 integer,
intent(in) :: ie, je, ke
511 character(len=128) :: err_msg
512 if (.not.this%data_buffer_is_allocated) &
513 call mpp_error (
"set_data_buffer",
"The data buffer for the field "//trim(this%varname)//
" was unable to be "//&
515 if (this%multiple_send_data)
then
516 err_msg = this%input_data_buffer%update_input_buffer_object(input_data, is, js, ks, ie, je, ke, &
517 mask, this%mask, this%mask_variant, this%var_is_masked)
519 this%mask(is:ie, js:je, ks:ke, :) = mask
520 err_msg = this%input_data_buffer%set_input_buffer_object(input_data, weight, is, js, ks, ie, je, ke)
522 if (trim(err_msg) .ne.
"")
call mpp_error(fatal,
"Field:"//trim(this%varname)//
" -"//trim(err_msg))
524 end subroutine set_data_buffer
527 logical function allocate_data_buffer(this, input_data, diag_axis)
529 class(*),
dimension(:,:,:,:),
intent(in) :: input_data
532 character(len=128) :: err_msg
535 allocate(this%input_data_buffer)
536 err_msg = this%input_data_buffer%allocate_input_buffer_object(input_data, this%axis_ids, diag_axis)
537 if (trim(err_msg) .ne.
"")
then
538 call mpp_error(fatal,
"Field:"//trim(this%varname)//
" -"//trim(err_msg))
542 allocate_data_buffer = .true.
543 end function allocate_data_buffer
545 subroutine set_math_needs_to_be_done (this, math_needs_to_be_done)
547 logical,
intent (in) :: math_needs_to_be_done
548 this%math_needs_to_be_done = math_needs_to_be_done
549 end subroutine set_math_needs_to_be_done
552 subroutine set_var_is_masked(this, is_masked)
554 logical,
intent (in) :: is_masked
556 this%var_is_masked = is_masked
557 end subroutine set_var_is_masked
561 function get_var_is_masked(this) &
566 rslt = this%var_is_masked
567 end function get_var_is_masked
570 subroutine set_data_buffer_is_allocated (this, data_buffer_is_allocated)
572 logical,
intent (in) :: data_buffer_is_allocated
574 this%data_buffer_is_allocated = data_buffer_is_allocated
575 end subroutine set_data_buffer_is_allocated
579 pure logical function is_data_buffer_allocated (this)
582 is_data_buffer_allocated = .false.
583 if (
allocated(this%data_buffer_is_allocated)) is_data_buffer_allocated = this%data_buffer_is_allocated
587 subroutine what_is_vartype(this)
589 if (.not.
allocated(this%vartype))
then
590 call mpp_error(
"what_is_vartype",
"The variable type has not been set prior to this call", warning)
593 select case (this%vartype)
595 call mpp_error(
"what_is_vartype",
"The variable type of "//trim(this%varname)//&
596 " is REAL(kind=8)", note)
598 call mpp_error(
"what_is_vartype",
"The variable type of "//trim(this%varname)//&
599 " is REAL(kind=4)", note)
601 call mpp_error(
"what_is_vartype",
"The variable type of "//trim(this%varname)//&
602 " is INTEGER(kind=8)", note)
604 call mpp_error(
"what_is_vartype",
"The variable type of "//trim(this%varname)//&
605 " is INTEGER(kind=4)", note)
607 call mpp_error(
"what_is_vartype",
"The variable type of "//trim(this%varname)//&
608 " is CHARACTER(*)", note)
610 call mpp_error(
"what_is_vartype",
"The variable type of "//trim(this%varname)//&
611 " was not set", warning)
613 call mpp_error(
"what_is_vartype",
"The variable type of "//trim(this%varname)//&
614 " is not supported by diag_manager", fatal)
616 end subroutine what_is_vartype
620 subroutine copy_diag_obj(this , objout)
626 if (
allocated(this%registered))
then
627 objout%registered = this%registered
629 call mpp_error(
"copy_diag_obj",
"You can only copy objects that have been registered",warning)
631 objout%diag_id = this%diag_id
633 if (
allocated(this%attributes)) objout%attributes = this%attributes
634 objout%static = this%static
635 if (
allocated(this%frequency)) objout%frequency = this%frequency
636 if (
allocated(this%varname)) objout%varname = this%varname
638 end subroutine copy_diag_obj
643 pure integer function fms_diag_get_id (this)
result(diag_id)
646 if (
allocated(this%registered))
then
648 diag_id = this%diag_id
651 diag_id = diag_not_registered
653 end function fms_diag_get_id
660 function fms_diag_obj_as_string_basic(this)
result(rslt)
662 character(:),
allocatable :: rslt
663 character (len=:),
allocatable :: registered, vartype, varname, diag_id
664 if ( .not.
allocated (this))
then
669 rslt =
"[Obj:" // varname //
"," // vartype //
"," // registered //
"," // diag_id //
"]"
691 if(
allocated (this%varname))
then
692 varname = this%varname
697 rslt =
"[Obj:" // varname //
"," // vartype //
"," // registered //
"," // diag_id //
"]"
699 end function fms_diag_obj_as_string_basic
702 function diag_obj_is_registered (this)
result (rslt)
705 rslt = this%registered
706 end function diag_obj_is_registered
708 function diag_obj_is_static (this)
result (rslt)
712 if (
allocated(this%static)) rslt = this%static
713 end function diag_obj_is_static
717 function is_scalar (this)
result (rslt)
721 end function is_scalar
728 function get_attributes (this) &
734 if (this%num_attributes > 0 ) rslt => this%attributes
735 end function get_attributes
739 pure function get_static (this) &
744 end function get_static
748 pure function get_registered (this) &
752 rslt = this%registered
753 end function get_registered
757 pure function get_mask_variant (this) &
762 if (
allocated(this%mask_variant)) rslt = this%mask_variant
763 end function get_mask_variant
767 pure function get_local (this) &
772 end function get_local
776 pure function get_vartype (this) &
781 end function get_vartype
785 pure function get_varname (this, to_write) &
788 logical,
optional,
intent(in) :: to_write
789 character(len=:),
allocatable :: rslt
793 if (
present(to_write))
then
796 rslt = this%diag_field(1)%get_var_outname()
800 end function get_varname
804 pure function get_longname (this) &
807 character(len=:),
allocatable :: rslt
808 if (
allocated(this%longname))
then
811 rslt = diag_null_string
813 end function get_longname
817 pure function get_standname (this) &
820 character(len=:),
allocatable :: rslt
821 if (
allocated(this%standname))
then
822 rslt = this%standname
824 rslt = diag_null_string
826 end function get_standname
830 pure function get_units (this) &
833 character(len=:),
allocatable :: rslt
834 if (
allocated(this%units))
then
837 rslt = diag_null_string
839 end function get_units
843 pure function get_modname (this) &
846 character(len=:),
allocatable :: rslt
847 if (
allocated(this%modname))
then
850 rslt = diag_null_string
852 end function get_modname
856 pure function get_realm (this) &
859 character(len=:),
allocatable :: rslt
860 if (
allocated(this%realm))
then
863 rslt = diag_null_string
865 end function get_realm
869 pure function get_interp_method (this) &
872 character(len=:),
allocatable :: rslt
873 if (
allocated(this%interp_method))
then
874 rslt = this%interp_method
876 rslt = diag_null_string
878 end function get_interp_method
882 pure function get_frequency (this) &
885 integer,
allocatable,
dimension (:) :: rslt
886 if (
allocated(this%frequency))
then
887 allocate (rslt(
size(this%frequency)))
888 rslt = this%frequency
893 end function get_frequency
897 pure function get_tile_count (this) &
901 if (
allocated(this%tile_count))
then
902 rslt = this%tile_count
906 end function get_tile_count
910 pure function get_area (this) &
914 if (
allocated(this%area))
then
919 end function get_area
923 pure function get_volume (this) &
927 if (
allocated(this%volume))
then
932 end function get_volume
939 function get_missing_value (this, var_type) &
942 integer,
intent(in) :: var_type
945 class(*),
allocatable :: rslt
947 if (.not.
allocated(this%missing_value))
then
949 "The missing value is not allocated", fatal)
954 select case (var_type)
956 allocate (real(kind=r4_kind) :: rslt)
957 select type (miss => this%missing_value)
958 type is (real(kind=r4_kind))
960 type is (real(kind=r4_kind))
961 rslt = real(miss, kind=r4_kind)
963 type is (real(kind=r8_kind))
965 type is (real(kind=r4_kind))
966 rslt = real(miss, kind=r4_kind)
970 allocate (real(kind=r8_kind) :: rslt)
971 select type (miss => this%missing_value)
972 type is (real(kind=r4_kind))
974 type is (real(kind=r8_kind))
975 rslt = real(miss, kind=r8_kind)
977 type is (real(kind=r8_kind))
979 type is (real(kind=r8_kind))
980 rslt = real(miss, kind=r8_kind)
985 end function get_missing_value
992 function get_data_range (this, var_type) &
995 integer,
intent(in) :: var_type
997 class(*),
allocatable :: rslt(:)
999 if ( .not.
allocated(this%data_RANGE))
call mpp_error (
"get_data_RANGE", &
1000 "The data_RANGE value is not allocated", fatal)
1004 select case (var_type)
1006 allocate (real(kind=r4_kind) :: rslt(2))
1007 select type (r => this%data_RANGE)
1008 type is (real(kind=r4_kind))
1010 type is (real(kind=r4_kind))
1011 rslt = real(r, kind=r4_kind)
1013 type is (real(kind=r8_kind))
1015 type is (real(kind=r4_kind))
1016 rslt = real(r, kind=r4_kind)
1020 allocate (real(kind=r8_kind) :: rslt(2))
1021 select type (r => this%data_RANGE)
1022 type is (real(kind=r4_kind))
1024 type is (real(kind=r8_kind))
1025 rslt = real(r, kind=r8_kind)
1027 type is (real(kind=r8_kind))
1029 type is (real(kind=r8_kind))
1030 rslt = real(r, kind=r8_kind)
1034 end function get_data_range
1038 function get_axis_id (this) &
1041 integer,
pointer,
dimension(:) :: rslt
1043 if(
allocated(this%axis_ids))
then
1044 rslt => this%axis_ids
1048 end function get_axis_id
1052 function get_domain (this) &
1057 if (
associated(this%domain))
then
1063 end function get_domain
1067 pure function get_type_of_domain (this) &
1072 rslt = this%type_of_domain
1073 end function get_type_of_domain
1076 subroutine set_file_ids(this, file_ids)
1078 integer,
intent(in) :: file_ids(:)
1080 allocate(this%file_ids(
size(file_ids)))
1081 this%file_ids = file_ids
1082 end subroutine set_file_ids
1086 pure function get_var_skind(this, field_yaml) &
1091 character(len=:),
allocatable :: rslt
1095 var_kind = field_yaml%get_var_kind()
1096 select case (var_kind)
1107 end function get_var_skind
1111 pure function get_multiple_send_data(this) &
1115 rslt = this%multiple_send_data
1116 end function get_multiple_send_data
1120 pure function get_longname_to_write(this, field_yaml) &
1125 character(len=:),
allocatable :: rslt
1127 rslt = field_yaml%get_var_longname()
1128 if (rslt .eq.
"")
then
1130 rslt = this%get_longname()
1134 if (rslt .eq.
"")
then
1136 rslt = field_yaml%get_var_varname()
1138 end function get_longname_to_write
1141 subroutine get_dimnames(this, diag_axis, field_yaml, unlim_dimname, dimnames, is_regional)
1145 character(len=*),
intent(in) :: unlim_dimname
1146 character(len=120),
allocatable,
intent(out) :: dimnames(:)
1148 logical,
intent(in) :: is_regional
1153 character(len=23) :: diurnal_axis_name
1155 if (this%is_static())
then
1156 naxis =
size(this%axis_ids)
1158 naxis =
size(this%axis_ids) + 1
1161 if (field_yaml%has_n_diurnal())
then
1165 allocate(dimnames(naxis))
1168 if (field_yaml%has_var_zbounds())
then
1169 do i = 1,
size(this%axis_ids)
1170 axis_ptr => diag_axis(this%axis_ids(i))
1171 if (axis_ptr%axis%is_z_axis())
then
1172 dimnames(i) = axis_ptr%axis%get_axis_name(is_regional)//
"_sub01"
1174 dimnames(i) = axis_ptr%axis%get_axis_name(is_regional)
1178 do i = 1,
size(this%axis_ids)
1179 axis_ptr => diag_axis(this%axis_ids(i))
1180 dimnames(i) = axis_ptr%axis%get_axis_name(is_regional)
1185 if (field_yaml%has_n_diurnal())
then
1186 WRITE (diurnal_axis_name,
'(a,i2.2)')
'time_of_day_', field_yaml%get_n_diurnal()
1187 dimnames(naxis - 1) = trim(diurnal_axis_name)
1191 if (.not. this%is_static()) dimnames(naxis) = unlim_dimname
1193 end subroutine get_dimnames
1197 subroutine register_field_wrap(fms2io_fileobj, varname, vartype, dimensions)
1198 class(fmsnetcdffile_t),
INTENT(INOUT) :: fms2io_fileobj
1199 character(len=*),
INTENT(IN) :: varname
1200 character(len=*),
INTENT(IN) :: vartype
1201 character(len=*),
optional,
INTENT(IN) :: dimensions(:)
1203 select type(fms2io_fileobj)
1204 type is (fmsnetcdffile_t)
1205 call register_field(fms2io_fileobj, varname, vartype, dimensions)
1206 type is (fmsnetcdfdomainfile_t)
1207 call register_field(fms2io_fileobj, varname, vartype, dimensions)
1208 type is (fmsnetcdfunstructureddomainfile_t)
1209 call register_field(fms2io_fileobj, varname, vartype, dimensions)
1211 end subroutine register_field_wrap
1214 subroutine write_field_metadata(this, fms2io_fileobj, file_id, yaml_id, diag_axis, unlim_dimname, is_regional, &
1217 class(fmsnetcdffile_t),
INTENT(INOUT) :: fms2io_fileobj
1218 integer,
intent(in) :: file_id
1219 integer,
intent(in) :: yaml_id
1221 character(len=*),
intent(in) :: unlim_dimname
1222 logical,
intent(in) :: is_regional
1223 character(len=*),
intent(in) :: cell_measures
1226 character(len=:),
allocatable :: var_name
1227 character(len=:),
allocatable :: long_name
1228 character(len=:),
allocatable :: units
1229 character(len=120),
allocatable :: dimnames(:)
1230 character(len=120) :: cell_methods
1232 character (len=MAX_STR_LEN),
allocatable :: yaml_field_attributes(:,:)
1233 character(len=:),
allocatable :: interp_method_tmp
1234 integer :: interp_method_len
1236 field_yaml => diag_yaml%get_diag_field_from_id(yaml_id)
1237 var_name = field_yaml%get_var_outname()
1239 if (
allocated(this%axis_ids))
then
1240 call this%get_dimnames(diag_axis, field_yaml, unlim_dimname, dimnames, is_regional)
1241 call register_field_wrap(fms2io_fileobj, var_name, this%get_var_skind(field_yaml), dimnames)
1243 if (this%is_static())
then
1244 call register_field_wrap(fms2io_fileobj, var_name, this%get_var_skind(field_yaml))
1248 call register_field_wrap(fms2io_fileobj, var_name, this%get_var_skind(field_yaml), (/unlim_dimname/))
1252 long_name = this%get_longname_to_write(field_yaml)
1253 call register_variable_attribute(fms2io_fileobj, var_name,
"long_name", long_name, str_len=len_trim(long_name))
1255 units = this%get_units()
1256 if (units .ne. diag_null_string) &
1257 call register_variable_attribute(fms2io_fileobj, var_name,
"units", units, str_len=len_trim(units))
1259 if (this%has_missing_value())
then
1260 call register_variable_attribute(fms2io_fileobj, var_name,
"missing_value", &
1261 this%get_missing_value(field_yaml%get_var_kind()))
1262 call register_variable_attribute(fms2io_fileobj, var_name,
"_FillValue", &
1263 this%get_missing_value(field_yaml%get_var_kind()))
1265 call register_variable_attribute(fms2io_fileobj, var_name,
"missing_value", &
1266 get_default_missing_value(field_yaml%get_var_kind()))
1267 call register_variable_attribute(fms2io_fileobj, var_name,
"_FillValue", &
1268 get_default_missing_value(field_yaml%get_var_kind()))
1271 if (this%has_data_RANGE())
then
1272 call register_variable_attribute(fms2io_fileobj, var_name,
"valid_range", &
1273 this%get_data_range(field_yaml%get_var_kind()))
1276 if (this%has_interp_method())
then
1277 interp_method_tmp = this%interp_method
1278 interp_method_len = len_trim(interp_method_tmp)
1279 call register_variable_attribute(fms2io_fileobj, var_name,
"interp_method", interp_method_tmp, &
1280 str_len=interp_method_len)
1286 do i = 1, this%num_attributes
1287 call this%attributes(i)%write_metadata(fms2io_fileobj, var_name, &
1288 cell_methods=cell_methods)
1292 call this%append_time_cell_methods(cell_methods, field_yaml)
1293 if (trim(cell_methods) .ne.
"") &
1294 call register_variable_attribute(fms2io_fileobj, var_name,
"cell_methods", &
1295 trim(adjustl(cell_methods)), str_len=len_trim(adjustl(cell_methods)))
1300 if (trim(cell_measures) .ne.
"") &
1301 call register_variable_attribute(fms2io_fileobj, var_name,
"cell_measures", &
1302 trim(adjustl(cell_measures)), str_len=len_trim(adjustl(cell_measures)))
1305 if (this%has_standname()) &
1306 call register_variable_attribute(fms2io_fileobj, var_name,
"standard_name", &
1307 trim(this%get_standname()), str_len=len_trim(this%get_standname()))
1309 call this%write_coordinate_attribute(fms2io_fileobj, var_name, diag_axis)
1311 if (field_yaml%has_var_attributes())
then
1312 yaml_field_attributes = field_yaml%get_var_attributes()
1313 do i = 1,
size(yaml_field_attributes,1)
1314 call register_variable_attribute(fms2io_fileobj, var_name, trim(yaml_field_attributes(i,1)), &
1315 trim(yaml_field_attributes(i,2)), str_len=len_trim(yaml_field_attributes(i,2)))
1317 deallocate(yaml_field_attributes)
1319 end subroutine write_field_metadata
1323 subroutine write_coordinate_attribute (this, fms2io_fileobj, var_name, diag_axis)
1325 class(fmsnetcdffile_t),
INTENT(INOUT) :: fms2io_fileobj
1326 character(len=*),
intent(in) :: var_name
1330 character(len = 252) :: aux_coord
1333 if (.not.
allocated(this%axis_ids))
return
1338 do i = 1,
size(this%axis_ids)
1339 select type (obj => diag_axis(this%axis_ids(i))%axis)
1341 if (obj%has_aux())
then
1342 aux_coord = trim(aux_coord)//
" "//obj%get_aux()
1347 if (trim(aux_coord) .eq.
"")
return
1349 call register_variable_attribute(fms2io_fileobj, var_name,
"coordinates", &
1350 trim(adjustl(aux_coord)), str_len=len_trim(adjustl(aux_coord)))
1352 end subroutine write_coordinate_attribute
1356 function get_data_buffer (this) &
1359 class(*),
dimension(:,:,:,:),
pointer :: rslt
1361 if (.not. this%data_buffer_is_allocated) &
1362 call mpp_error(fatal,
"The input data buffer for the field:"&
1363 //trim(this%varname)//
" was never allocated.")
1365 rslt => this%input_data_buffer%get_buffer()
1366 end function get_data_buffer
1371 function get_weight (this) &
1374 type(
real(kind=r8_kind)),
pointer :: rslt
1376 if (.not. this%data_buffer_is_allocated) &
1377 call mpp_error(fatal,
"The input data buffer for the field:"&
1378 //trim(this%varname)//
" was never allocated.")
1380 rslt => this%input_data_buffer%get_weight()
1381 end function get_weight
1385 pure logical function get_math_needs_to_be_done(this)
1387 get_math_needs_to_be_done = .false.
1388 if (
allocated(this%math_needs_to_be_done)) get_math_needs_to_be_done = this%math_needs_to_be_done
1389 end function get_math_needs_to_be_done
1401 pure logical function has_diag_id (this)
1403 has_diag_id =
allocated(this%diag_id)
1404 end function has_diag_id
1408 pure logical function has_attributes (this)
1410 has_attributes = this%num_attributes > 0
1411 end function has_attributes
1415 pure logical function has_static (this)
1417 has_static =
allocated(this%static)
1418 end function has_static
1422 pure logical function has_registered (this)
1424 has_registered =
allocated(this%registered)
1425 end function has_registered
1429 pure logical function has_mask_variant (this)
1431 has_mask_variant =
allocated(this%mask_variant)
1432 end function has_mask_variant
1436 pure logical function has_local (this)
1438 has_local =
allocated(this%local)
1439 end function has_local
1443 pure logical function has_vartype (this)
1445 has_vartype =
allocated(this%vartype)
1446 end function has_vartype
1450 pure logical function has_varname (this)
1452 has_varname =
allocated(this%varname)
1453 end function has_varname
1457 pure logical function has_longname (this)
1459 has_longname =
allocated(this%longname)
1460 end function has_longname
1464 pure logical function has_standname (this)
1466 has_standname =
allocated(this%standname)
1467 end function has_standname
1471 pure logical function has_units (this)
1473 has_units =
allocated(this%units)
1474 end function has_units
1478 pure logical function has_modname (this)
1480 has_modname =
allocated(this%modname)
1481 end function has_modname
1485 pure logical function has_realm (this)
1487 has_realm =
allocated(this%realm)
1488 end function has_realm
1492 pure logical function has_interp_method (this)
1494 has_interp_method =
allocated(this%interp_method)
1495 end function has_interp_method
1499 pure logical function has_frequency (this)
1501 has_frequency =
allocated(this%frequency)
1502 end function has_frequency
1506 pure logical function has_tile_count (this)
1508 has_tile_count =
allocated(this%tile_count)
1509 end function has_tile_count
1513 pure logical function has_axis_ids (this)
1515 has_axis_ids =
allocated(this%axis_ids)
1516 end function has_axis_ids
1520 pure logical function has_area (this)
1522 has_area =
allocated(this%area)
1523 end function has_area
1527 pure logical function has_volume (this)
1529 has_volume =
allocated(this%volume)
1530 end function has_volume
1534 pure logical function has_missing_value (this)
1536 has_missing_value =
allocated(this%missing_value)
1537 end function has_missing_value
1541 pure logical function has_data_range (this)
1543 has_data_range =
allocated(this%data_RANGE)
1544 end function has_data_range
1548 pure logical function has_input_data_buffer (this)
1550 has_input_data_buffer =
allocated(this%input_data_buffer)
1551 end function has_input_data_buffer
1554 subroutine diag_field_add_attribute(this, att_name, att_value)
1556 character(len=*),
intent(in) :: att_name
1557 class(*),
intent(in) :: att_value(:)
1559 this%num_attributes = this%num_attributes + 1
1560 if (this%num_attributes > max_field_attributes) &
1561 call mpp_error(fatal,
"diag_field_add_attribute: Number of attributes exceeds max_field_attributes for field:"&
1562 //trim(this%varname)//
". Increase diag_manager_nml:max_field_attributes.")
1564 call this%attributes(this%num_attributes)%add(att_name, att_value)
1565 end subroutine diag_field_add_attribute
1569 function get_default_missing_value(var_type) &
1572 integer,
intent(in) :: var_type
1573 class(*),
allocatable :: rslt
1575 select case(var_type)
1577 allocate(real(kind=r4_kind) :: rslt)
1578 rslt = real(cmor_missing_value, kind=r4_kind)
1580 allocate(real(kind=r8_kind) :: rslt)
1581 rslt = real(cmor_missing_value, kind=r8_kind)
1588 PURE FUNCTION diag_field_id_from_name(this, module_name, field_name) &
1589 result(diag_field_id)
1591 CHARACTER(len=*),
INTENT(in) :: module_name
1592 CHARACTER(len=*),
INTENT(in) :: field_name
1594 integer :: diag_field_id
1597 if (this%get_varname() .eq. trim(field_name) .and. &
1598 this%get_modname() .eq. trim(module_name))
then
1599 diag_field_id = this%get_id()
1601 end function diag_field_id_from_name
1604 subroutine add_area_volume(this, area, volume)
1606 INTEGER,
optional,
INTENT(in) :: area
1607 INTEGER,
optional,
INTENT(in) :: volume
1609 if (
present(area))
then
1613 call mpp_error(fatal,
"diag_field_add_cell_measures: the area id is not valid. &
1614 &Verify that the area_id passed in to the field:"//this%varname// &
1615 " is valid and that the field is registered and in the diag_table.yaml")
1619 if (
present(volume))
then
1620 if (volume > 0)
then
1621 this%volume = volume
1623 call mpp_error(fatal,
"diag_field_add_cell_measures: the volume id is not valid. &
1624 &Verify that the volume_id passed in to the field:"//this%varname// &
1625 " is valid and that the field is registered and in the diag_table.yaml")
1629 end subroutine add_area_volume
1632 subroutine append_time_cell_methods(this, cell_methods, field_yaml)
1634 character(len=*),
intent(inout) :: cell_methods
1637 if (this%static)
then
1638 cell_methods = trim(cell_methods)//
" time: point "
1642 select case (field_yaml%get_var_reduction())
1644 cell_methods = trim(cell_methods)//
" time: point "
1646 cell_methods = trim(cell_methods)//
" time: mean"
1648 cell_methods = trim(cell_methods)//
" time: mean_pow"//int2str(field_yaml%get_pow_value())
1650 cell_methods = trim(cell_methods)//
" time: root_mean_square"
1652 cell_methods = trim(cell_methods)//
" time: max"
1654 cell_methods = trim(cell_methods)//
" time: min"
1656 cell_methods = trim(cell_methods)//
" time: mean"
1658 cell_methods = trim(cell_methods)//
" time: sum"
1660 end subroutine append_time_cell_methods
1663 subroutine dump_field_obj (this, unit_num)
1665 integer,
intent(in) :: unit_num
1668 if(
mpp_pe() .eq. mpp_root_pe())
then
1669 if(
allocated(this%file_ids))
write(unit_num, *)
'file_ids:' ,this%file_ids
1670 if(
allocated(this%diag_id))
write(unit_num, *)
'diag_id:' ,this%diag_id
1671 if(
allocated(this%static))
write(unit_num, *)
'static:' ,this%static
1672 if(
allocated(this%registered))
write(unit_num, *)
'registered:' ,this%registered
1673 if(
allocated(this%mask_variant))
write(unit_num, *)
'mask_variant:' ,this%mask_variant
1674 if(
allocated(this%do_not_log))
write(unit_num, *)
'do_not_log:' ,this%do_not_log
1675 if(
allocated(this%local))
write(unit_num, *)
'local:' ,this%local
1676 if(
allocated(this%vartype))
write(unit_num, *)
'vartype:' ,this%vartype
1677 if(
allocated(this%varname))
write(unit_num, *)
'varname:' ,this%varname
1678 if(
allocated(this%longname))
write(unit_num, *)
'longname:' ,this%longname
1679 if(
allocated(this%standname))
write(unit_num, *)
'standname:' ,this%standname
1680 if(
allocated(this%units))
write(unit_num, *)
'units:' ,this%units
1681 if(
allocated(this%modname))
write(unit_num, *)
'modname:' ,this%modname
1682 if(
allocated(this%realm))
write(unit_num, *)
'realm:' ,this%realm
1683 if(
allocated(this%interp_method))
write(unit_num, *)
'interp_method:' ,this%interp_method
1684 if(
allocated(this%tile_count))
write(unit_num, *)
'tile_count:' ,this%tile_count
1685 if(
allocated(this%axis_ids))
write(unit_num, *)
'axis_ids:' ,this%axis_ids
1686 write(unit_num, *)
'type_of_domain:' ,this%type_of_domain
1687 if(
allocated(this%area))
write(unit_num, *)
'area:' ,this%area
1688 if(
allocated(this%missing_value))
then
1689 select type(missing_val => this%missing_value)
1690 type is (real(r4_kind))
1691 write(unit_num, *)
'missing_value:', missing_val
1692 type is (real(r8_kind))
1693 write(unit_num, *)
'missing_value:' ,missing_val
1694 type is(
integer(i4_kind))
1695 write(unit_num, *)
'missing_value:' ,missing_val
1696 type is(
integer(i8_kind))
1697 write(unit_num, *)
'missing_value:' ,missing_val
1700 if(
allocated( this%data_RANGE))
then
1701 select type(drange => this%data_RANGE)
1702 type is (real(r4_kind))
1703 write(unit_num, *)
'data_RANGE:' ,drange
1704 type is (real(r8_kind))
1705 write(unit_num, *)
'data_RANGE:' ,drange
1706 type is(
integer(i4_kind))
1707 write(unit_num, *)
'data_RANGE:' ,drange
1708 type is(
integer(i8_kind))
1709 write(unit_num, *)
'data_RANGE:' ,drange
1712 write(unit_num, *)
'num_attributes:' ,this%num_attributes
1713 if(
allocated(this%attributes))
then
1714 do i=1, this%num_attributes
1715 if(
allocated(this%attributes(i)%att_value))
then
1716 select type( val => this%attributes(i)%att_value)
1717 type is (real(r8_kind))
1718 write(unit_num, *)
'attribute name', this%attributes(i)%att_name,
'val:', val
1719 type is (real(r4_kind))
1720 write(unit_num, *)
'attribute name', this%attributes(i)%att_name,
'val:', val
1721 type is (
integer(i4_kind))
1722 write(unit_num, *)
'attribute name', this%attributes(i)%att_name,
'val:', val
1723 type is (
integer(i8_kind))
1724 write(unit_num, *)
'attribute name', this%attributes(i)%att_name,
'val:', val
1736 function get_starting_compute_domain(axis_ids, diag_axis) &
1737 result(compute_domain)
1738 integer,
intent(in) :: axis_ids(:)
1741 integer :: compute_domain(4)
1743 integer :: compute_idx(2)
1747 axis_loop:
do a = 1,
size(axis_ids)
1748 select type (axis => diag_axis(axis_ids(a))%axis)
1750 call axis%get_compute_domain(compute_idx, dummy)
1751 if ( compute_idx(1) .ne. diag_null) compute_domain(a) = compute_idx(1)
1754 end function get_starting_compute_domain
1757 pure function get_file_ids(this)
1759 integer,
allocatable :: get_file_ids(:)
1760 get_file_ids = this%file_ids
1765 function get_mask(this)
1767 logical,
pointer :: get_mask(:,:,:,:)
1768 get_mask => this%mask
1769 end function get_mask
1773 subroutine allocate_mask(this, mask_in, omp_axis)
1775 logical,
intent(in) :: mask_in(:,:,:,:)
1777 integer :: axis_num, length(4)
1778 integer,
pointer :: id_num
1780 if(.not.
present(omp_axis))
then
1781 allocate(this%mask(
size(mask_in,1),
size(mask_in,2),
size(mask_in,3), &
1786 do axis_num=1,
size(this%axis_ids)
1787 id_num => this%axis_ids(axis_num)
1788 select type(axis => omp_axis(id_num)%axis)
1790 length(axis_num) = axis%axis_length()
1793 allocate(this%mask(length(1), length(2), length(3), length(4)))
1795 end subroutine allocate_mask
1798 subroutine set_mask(this, mask_in, field_info, is, js, ks, ie, je, ke)
1800 logical,
intent(in) :: mask_in(:,:,:,:)
1801 character(len=*),
intent(in) :: field_info
1802 integer,
optional,
intent(in) :: is, js, ks, ie, je, ke
1803 if(
present(is))
then
1804 if(is .lt. lbound(this%mask,1) .or. ie .gt. ubound(this%mask,1) .or. &
1805 js .lt. lbound(this%mask,2) .or. je .gt. ubound(this%mask,2) .or. &
1806 ks .lt. lbound(this%mask,3) .or. ke .gt. ubound(this%mask,3))
then
1807 print *,
"PE:", int2str(
mpp_pe()),
"The size of the mask is", &
1809 "But the indices passed in are is=", int2str(is),
" ie=", int2str(ie),&
1810 " js=", int2str(js),
" je=", int2str(je), &
1811 " ks=", int2str(ks),
" ke=", int2str(ke), &
1812 " ", trim(field_info)
1813 call mpp_error(fatal,
"set_mask:: given indices out of bounds for allocated mask")
1815 this%mask(is:ie, js:je, ks:ke, :) = mask_in
1819 end subroutine set_mask
1822 subroutine set_halo_present(this)
1824 this%halo_present = .true.
1825 end subroutine set_halo_present
1828 pure function is_halo_present(this)
1830 logical :: is_halo_present
1831 is_halo_present = this%halo_present
1832 end function is_halo_present
1837 function find_missing_value(this, missing_val) &
1840 class(*),
allocatable,
intent(out) :: missing_val
1841 real(r8_kind),
allocatable :: res
1844 if(this%has_missing_value())
then
1845 missing_val = this%get_missing_value(this%get_vartype())
1847 vtype = this%get_vartype()
1848 if(vtype .eq. r8)
then
1849 missing_val = cmor_missing_value
1851 missing_val = real(cmor_missing_value, r4_kind)
1855 select type(missing_val)
1856 type is (real(r8_kind))
1858 type is (real(r4_kind))
1859 res = real(missing_val, r8_kind)
1861 end function find_missing_value
1866 pure logical function has_mask_allocated(this)
1868 has_mask_allocated =
allocated(this%mask)
1869 end function has_mask_allocated
1873 pure function is_variable_in_file(this, file_id) &
1876 integer,
intent(in) :: file_id
1882 if (any(this%file_ids .eq. file_id)) res = .true.
1883 end function is_variable_in_file
1887 function get_field_file_name(this) &
1890 character(len=:),
allocatable :: res
1892 res = this%diag_field(1)%get_var_fname()
1893 end function get_field_file_name
1896 subroutine generate_associated_files_att(this, att, start_time)
1898 character(len=*),
intent(inout) :: att
1899 type(
time_type),
intent(in) :: start_time
1901 character(len=:),
allocatable :: field_name
1902 character(len=FMS_FILE_LEN) :: file_name
1903 character(len=128) :: start_date
1905 integer :: year, month, day, hour, minute, second
1906 field_name = this%get_varname(to_write = .true.)
1910 if (index(att, field_name) .ne. 0)
return
1912 file_name = this%get_field_file_name()
1914 if (prepend_date)
then
1915 call get_date(start_time, year, month, day, hour, minute, second)
1916 write (start_date,
'(1I20.4, 2I2.2)') year, month, day
1917 file_name = trim(adjustl(start_date))//
'.'//trim(file_name)
1920 att = trim(att)//
" "//trim(field_name)//
": "//trim(file_name)//
".nc"
1921 end subroutine generate_associated_files_att
1925 function check_for_slices(field, diag_axis, var_size) &
1929 integer,
intent(in) :: var_size(:)
1936 if (.not. field%has_axis_ids())
then
1940 do i = 1,
size(field%axis_ids)
1941 select type (axis_obj => diag_axis(field%axis_ids(i))%axis)
1943 if (axis_obj%axis_length() .ne. var_size(i))
then
1951 end module fms_diag_field_object_mod
integer, parameter max_str_len
Max length for a string.
integer, parameter no_domain
Use the FmsNetcdfFile_t fileobj.
character(len=7) avg_name
Name of the average fields.
integer, parameter diag_field_not_found
Return value for a diag_field that isn't found in the diag_table.
integer, parameter string
s is the 19th letter of the alphabet
integer, parameter time_min
The reduction method is min value.
integer, parameter time_diurnal
The reduction method is diurnal.
integer, parameter time_power
The reduction method is average with exponents.
real(r8_kind), parameter cmor_missing_value
CMOR standard missing value.
logical prepend_date
Should the history file have the start date prepended to the file name. .TRUE. is only supported if t...
integer, parameter time_average
The reduction method is average of values.
integer, parameter time_sum
The reduction method is sum of values.
integer, parameter time_rms
The reudction method is root mean square of values.
integer, parameter time_none
There is no reduction method.
integer, parameter time_max
The reduction method is max value.
integer, parameter r8
Supported type/kind of the variable.
integer max_field_attributes
Maximum number of user definable attributes per field. Liptak: Changed from 2 to 4 20170718.
Type to hold the attributes of the field/axis/file.
Defines a new field within the given file Example usage:
type(diagyamlfilesvar_type) function, dimension(:), allocatable, public get_diag_fields_entries(indices)
Gets the diag_field entries corresponding to the indices of the sorted variable_list.
integer function, public get_num_unique_fields()
Determine the number of unique diag_fields in the diag_yaml_object.
integer function, dimension(:), allocatable, public find_diag_field(diag_field_name, module_name)
Determines if a diag_field is in the diag_yaml_object.
integer function, dimension(:), allocatable, public get_diag_files_id(indices)
Finds the indices of the diag_yamldiag_files(:) corresponding to fields in variable_list(indices)
subroutine, public get_domain_and_domain_type(diag_axis, axis_id, domain_type, domain, var_name)
Loop through a variable's axis_id to determine and return the domain type and domain to use.
character(:) function, allocatable, public string(v, fmt)
Converts a number or a Boolean value to a string.
integer function mpp_pe()
Returns processor ID.
subroutine, public get_date(time, year, month, day, hour, minute, second, tick, err_msg)
Gets the date for different calendar types. Given a time_interval, returns the corresponding date und...
Type to represent amounts of time. Implemented as seconds and days to allow for larger intervals.
Type to hold the domain info for an axis This type was created to avoid having to send in "Domain",...
Type to hold the diagnostic axis description.
Type to hold the diag_axis (either subaxis or a full axis)
Type to hold the diagnostic axis description.
Object that holds all variable information.
type to hold the info a diag_field