Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CF compliance work #7

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 35 additions & 9 deletions components/iobridge/src/iobridge.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ module iobridge_mod
use collections_mod, only : hashmap_type, map_type, list_type, c_contains, c_get_generic, c_get_string, c_put_generic, &
c_put_integer, c_size, c_key_at, c_free
use conversions_mod, only : conv_to_string
use state_mod, only : model_state_type
use state_mod, only : model_state_type, get_prognostic_field_units, get_prognostic_field_long_name, &
get_prognostic_field_standard_name
use grids_mod, only : X_INDEX, Y_INDEX, Z_INDEX, local_grid_type
use optionsdatabase_mod, only : options_size, options_get_logical
use prognostics_mod, only : prognostic_field_type
use datadefn_mod, only : DEFAULT_PRECISION, SINGLE_PRECISION, DOUBLE_PRECISION, STRING_LENGTH
use logging_mod, only : LOG_ERROR, LOG_WARN, log_log, log_master_log
use logging_mod, only : LOG_ERROR, LOG_WARN, log_log, log_master_log, LOG_INFO
use optionsdatabase_mod, only : options_get_integer
use q_indices_mod, only : q_metadata_type, get_indices_descriptor
use registry_mod, only : get_all_component_published_fields, get_component_field_value, get_component_field_information
use registry_mod, only : get_all_component_published_fields, get_component_field_value, get_component_field_information, &
is_component_field_available
use io_server_client_mod, only : COMMAND_TAG, DATA_TAG, REGISTER_COMMAND, DEREGISTER_COMMAND, DATA_COMMAND_START, &
ARRAY_FIELD_TYPE, SCALAR_FIELD_TYPE, MAP_FIELD_TYPE, INTEGER_DATA_TYPE, BOOLEAN_DATA_TYPE, STRING_DATA_TYPE, &
FLOAT_DATA_TYPE, DOUBLE_DATA_TYPE, LOCAL_SIZES_KEY, LOCAL_START_POINTS_KEY, LOCAL_END_POINTS_KEY, NUMBER_Q_INDICIES_KEY, &
Expand Down Expand Up @@ -458,6 +460,7 @@ integer function send_data_field_sizes_to_server(current_state, mpi_type_data_si
type(model_state_type), target, intent(inout) :: current_state
integer, intent(in) :: mpi_type_data_sizing_description, number_unique_fields
type(data_sizing_description_type), dimension(:), intent(inout) :: data_description
type(component_field_information_type) :: field_information

integer :: ierr, i, next_index, request_handle
character(len=STRING_LENGTH) :: field_name
Expand All @@ -467,7 +470,14 @@ integer function send_data_field_sizes_to_server(current_state, mpi_type_data_si
do i=1, number_unique_fields
field_name=c_key_at(unique_field_names, i)
if (c_contains(sendable_fields, field_name)) then
call assemble_individual_description(data_description, next_index, field_name, get_sendable_field_sizing(field_name))
if (is_component_field_available(field_name)) then
field_information = get_component_field_information(current_state, field_name)
call assemble_individual_description(data_description, next_index, field_name, get_sendable_field_sizing(field_name), &
field_units=field_information%units, field_long_name=field_information%long_name, &
field_standard_name=field_information%standard_name)
else
call assemble_individual_description(data_description, next_index, field_name, get_sendable_field_sizing(field_name))
endif
next_index=next_index+1
end if
end do
Expand Down Expand Up @@ -574,17 +584,33 @@ end function get_component_field_descriptor
!! @param index The index of this current field
!! @param field_name The corresponding field name that we are describing
!! @param dimensions The number of dimensions (zero means the field is inactive)
!! @param dim1 Optional size of dimension 1
!! @param dim2 Optional size of dimension 2
!! @param dim3 Optional size of dimension 3
!! @param dim4 Optional size of dimension 4
subroutine assemble_individual_description(data_description, index, field_name, field_sizing_description)
!! @param field_units
!! @param field_long_name
!! @param field_standard_name
subroutine assemble_individual_description(data_description, index, field_name, field_sizing_description, &
field_units, field_long_name, field_standard_name)
integer, intent(in) :: index
character(len=*), intent(in) :: field_name
type(io_server_sendable_field_sizing), intent(in) :: field_sizing_description
type(data_sizing_description_type), dimension(:), intent(inout) :: data_description
character(len=*), intent(in), optional :: field_units, field_long_name, field_standard_name

data_description(index)%field_name=field_name
if (present(field_units)) then
data_description(index)%field_units=field_units
else
data_description(index)%field_units=get_prognostic_field_units(field_name)
endif
if (present(field_long_name)) then
data_description(index)%field_long_name=field_long_name
else
data_description(index)%field_long_name=get_prognostic_field_long_name(field_name)
endif
if (present(field_standard_name)) then
data_description(index)%field_standard_name=field_standard_name
else
data_description(index)%field_standard_name=get_prognostic_field_standard_name(field_name)
endif
data_description(index)%dimensions=field_sizing_description%number_dimensions
data_description(index)%dim_sizes=field_sizing_description%dimensions
end subroutine assemble_individual_description
Expand Down
20 changes: 20 additions & 0 deletions components/profile_diagnostics/src/profile_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,26 @@ subroutine field_information_retrieval_callback(current_state, name, field_infor
else
field_information%enabled=.true.
end if

if (name .eq. "prefn_local") then
field_information%units = "Pa"
field_information%long_name = "reference pressure at cell-faces"
else if (name .eq. "u_wind_total_local") then
field_information%units = "m/s"
field_information%long_name = "per-MONC horizontal sum of u-wind"
else if (name .eq. "v_wind_total_local") then
field_information%units = "m/s"
field_information%long_name = "per-MONC horizontal sum of v-wind"
else if (name .eq. "w_wind_total_local") then
field_information%units = "m/s"
field_information%long_name = "per-MONC horizontal sum of w-wind"
else if (name .eq. "theta_total_local") then
field_information%units = "K"
field_information%long_name = "per-MONC horizontal sum of potential temperature"
else if (name .eq. "thinit_local") then
field_information%units = "K"
field_information%long_name = "initial vertical profile of potential temperature"
endif
end subroutine field_information_retrieval_callback

!> Field value retrieval callback, this returns the value of a specific published field
Expand Down
30 changes: 29 additions & 1 deletion components/scalar_diagnostics/src/scalar_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,35 @@ subroutine field_information_retrieval_callback(current_state, name, field_infor
else
field_information%enabled=.true.
end if


if (name .eq. "qlmax_local") then
field_information%units = 'kg/kg'
field_information%long_name = "per-column maximum liquid water specific mass"
else if (name .eq. "wmax_local") then
field_information%units = 'm/s'
field_information%long_name = "per-column maximum vertical velocity"
else if (name .eq. "wmin_local") then
field_information%units = 'm/s'
field_information%long_name = "per-column minimum vertical velocity"
else if (name .eq. "cltop_local") then
field_information%units = 'm'
field_information%long_name = "per-column maximum condensate height"
else if (name .eq. "clbas_local") then
field_information%units = 'm'
field_information%long_name = "per-column minimum condensate height"
else if (name .eq. "lwp_local") then
field_information%units = 'kg/m^2'
field_information%long_name = "per-column liquid-water path"
else if (name .eq. "vwp_local") then
field_information%units = 'kg/m^2'
field_information%long_name = "per-column water-vapour path"
else if (name .eq. "lathf_local") then
field_information%units = 'W/m^2'
field_information%long_name = "per-column surface latent-heat flux"
else if (name .eq. "senhf_local") then
field_information%units = 'W/m^2'
field_information%long_name = "per-column surface sensible-heat flux"
endif
end subroutine field_information_retrieval_callback

!> Field value retrieval callback, this returns the value of a specific published field
Expand Down
26 changes: 13 additions & 13 deletions io/io_cfg_files/profile_fields.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,31 @@
</data-definition>

<data-handling namespace="profile_fields">
<diagnostic field="prefn" type="array" data_type="double" size="zn" units="K">
<diagnostic field="prefn" type="array" data_type="double" size="zn">
<communication name="reduction" operator="mean" result="prefn" field="prefn_local" root="auto"/>
</diagnostic>
<diagnostic field="rho" type="array" data_type="double" size="z" units="K">
<diagnostic field="rho" type="array" data_type="double" size="z">
<communication name="reduction" operator="mean" result="rho" field="rho_local" root="auto"/>
</diagnostic>
<diagnostic field="rhon" type="array" data_type="double" size="zn" units="K">
<diagnostic field="rhon" type="array" data_type="double" size="zn">
<communication name="reduction" operator="mean" result="rhon" field="rhon_local" root="auto"/>
</diagnostic>
<diagnostic field="thinit" type="array" data_type="double" size="zn" units="K">
<diagnostic field="thinit" type="array" data_type="double" size="zn">
<communication name="reduction" operator="mean" result="thinit" field="thinit_local" root="auto"/>
</diagnostic>
<diagnostic field="thref" type="array" data_type="double" size="zn" units="K">
<diagnostic field="thref" type="array" data_type="double" size="zn">
<communication name="reduction" operator="mean" result="thref" field="thref_local" root="auto"/>
</diagnostic>
<diagnostic field="u_wind_mean" type="array" data_type="double" size="zn" units="m/s">
<operator name="arithmetic" result="u_wind_mean" equation="u_wind_mean_g/({x_size}*{y_size})"/>
<diagnostic field="u_wind_mean" type="array" data_type="double" size="zn">
<operator name="arithmetic" result="u_wind_mean" equation="u_wind_mean_g/({x_size}*{y_size})" units="1" description="divided by domain xy-cell-count"/>
<communication name="reduction" operator="sum" result="u_wind_mean_g" field="u_wind_total_local" root="auto"/>
</diagnostic>
<diagnostic field="v_wind_mean" type="array" data_type="double" size="zn" units="m/s">
<operator name="arithmetic" result="v_wind_mean" equation="v_wind_mean_g/({x_size}*{y_size})"/>
<diagnostic field="v_wind_mean" type="array" data_type="double" size="zn">
<operator name="arithmetic" result="v_wind_mean" equation="v_wind_mean_g/({x_size}*{y_size})" units="1" description="divided by domain xy-cell-count"/>
<communication name="reduction" operator="sum" result="v_wind_mean_g" field="v_wind_total_local" root="auto"/>
</diagnostic>
<diagnostic field="w_wind_mean" type="array" data_type="double" size="z" units="K">
<operator name="arithmetic" result="w_wind_mean" equation="w_wind_total_g/({x_size}*{y_size})"/>
<diagnostic field="w_wind_mean" type="array" data_type="double" size="z">
<operator name="arithmetic" result="w_wind_mean" equation="w_wind_total_g/({x_size}*{y_size})" units="1" description="divided by domain xy-cell-count"/>
<communication name="reduction" operator="sum" result="w_wind_total_g" field="w_wind_total_local" root="auto"/>
</diagnostic>
<diagnostic field="uu_mean" type="array" data_type="double" size="zn" units="m^2/s^2">
Expand All @@ -70,8 +70,8 @@
<operator name="arithmetic" result="ww_mean" equation="ww_mean_g/({x_size}*{y_size})"/>
<communication name="reduction" operator="sum" result="ww_mean_g" field="ww_total_local" root="auto"/>
</diagnostic>
<diagnostic field="theta_mean" type="array" data_type="double" size="zn" units="K">
<operator name="arithmetic" result="theta_mean" equation="theta_mean_g/({x_size}*{y_size})"/>
<diagnostic field="theta_mean" type="array" data_type="double" size="zn">
<operator name="arithmetic" result="theta_mean" equation="theta_mean_g/({x_size}*{y_size})" units="1" description="divided by domain xy-cell-count"/>
<communication name="reduction" operator="sum" result="theta_mean_g" field="theta_total_local" root="auto"/>
</diagnostic>
<diagnostic field="vapour_mmr_mean" type="array" data_type="double" size="zn" units="kg/kg">
Expand Down
Loading