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

User/jpk/cmor named diagnostics #34

Closed
wants to merge 5 commits into from
Closed
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
2 changes: 1 addition & 1 deletion config_src/solo_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,7 @@ subroutine surface_forcing_init(Time, G, param_file, diag, CS, tracer_flow_CSp)
type(time_type), intent(in) :: Time
type(ocean_grid_type), intent(in) :: G
type(param_file_type), intent(in) :: param_file
type(diag_ctrl), target, intent(in) :: diag
type(diag_ctrl), target,intent(inout) :: diag
type(surface_forcing_CS), pointer :: CS
type(tracer_flow_control_CS), pointer :: tracer_flow_CSp
! Arguments: Time - The current model time.
Expand Down
23 changes: 23 additions & 0 deletions examples/solo_ocean/global_ALE/common/diag_table
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
"sfc_ave", 12,"hours",1,"days","Time",
"ocean_static", -1,"days",1,"days","time",

"prog_cmor", 1,"days",1,"days","Time",
"prog_z_cmor", 1,"days",1,"days","Time",
"scalar_cmor", 1,"days",1,"days","Time",
"ocean_static_cmor", -1,"days",1,"days","time",

#This is the field section of the diag_table.

# Prognostic Ocean fields:
Expand Down Expand Up @@ -52,13 +57,23 @@
"ocean_model","SSU","SSU","sfc_ave","all",.true.,"none",2
"ocean_model","SSV","SSV","sfc_ave","all",.true.,"none",2

# Prognostic Ocean fields (CMOR Names):
#=========================
"ocean_model","so","so","prog_cmor","all",.false.,"none",2 #GFDL Name: salt


# Z-space fields:
#==================
"ocean_model","u_z","u","prog_z","all",.true.,"none",2
"ocean_model","v_z","v","prog_z","all",.true.,"none",2
"ocean_model","temp_z","temp","prog_z","all",.true.,"none",2
"ocean_model","salt_z","salt","prog_z","all",.true.,"none",2

# Z-space fields (CMOR Names):
#==================
"ocean_model","so_z","so","prog_z_cmor","all",.true.,"none",2 #GFDL Name: salt_z


# Auxilary Tracers:
#==================
#"ocean_model","vintage","vintage","prog","all",.false.,"none",2
Expand Down Expand Up @@ -214,6 +229,14 @@
"ocean_model", "wet_v", "wet_v", "ocean_static", "all", .false., "none", 2
"ocean_model", "Coriolis", "Coriolis", "ocean_static", "all", .false., "none", 2

# Static ocean fields:
#=====================
"ocean_model", "areacello", "areacello", "ocean_static_cmor", "all", .false., "none", 2

# Scalar ocean fields (CMOR Names):
#=====================
"ocean_model", "tosga", "tosga", "scalar_cmor", "all", .true., "none",2 #GFDL Name: SST_global

#=============================================================================================
#
#====> This file can be used with diag_manager/v2.0a (or higher) <====
Expand Down
22 changes: 15 additions & 7 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1880,8 +1880,10 @@ subroutine initialize_MOM(Time, param_file, dirs, CS, Time_in)
CS%S_diffx_2d, CS%S_diffy_2d)
call register_Z_tracer(CS%tv%T, "temp_z", "Potential Temperature", "degC", Time, &
G, CS%diag_to_Z_CSp)
call register_Z_tracer(CS%tv%S, "salt_z", "Salinity", "PSU", Time, &
G, CS%diag_to_Z_CSp)
call register_Z_tracer(CS%tv%S, "salt_z", "Salinity", "PSU", Time, &
G, CS%diag_to_Z_CSp, cmor_field_name="so_z", cmor_units="psu", &
cmor_standard_name="sea_water_salinity", &
cmor_long_name ="Sea Water Salinity")
endif

! This subroutine initializes any tracer packages.
Expand Down Expand Up @@ -2027,11 +2029,15 @@ subroutine register_diags(Time, G, CS, ADp)
CS%id_T = register_diag_field('ocean_model', 'temp', diag%axesTL, Time, &
'Potential Temperature', 'Celsius')
CS%id_S = register_diag_field('ocean_model', 'salt', diag%axesTL, Time, &
'Salinity', 'PSU')
long_name='Salinity', units='PSU', cmor_field_name='so', &
cmor_long_name='Sea Water Salinity', cmor_units='psu', &
cmor_standard_name='sea_water_salinity')
CS%id_sst = register_diag_field('ocean_model', 'SST', diag%axesT1, Time, &
'Sea Surface Temperature', 'Celsius', CS%missing)
CS%id_sst_global = register_scalar_field('ocean_model', 'SST_global', Time, diag, &
'Global Average Sea Surface Temperature', 'Celsius', CS%missing)
CS%id_sst_global = register_scalar_field('ocean_model', field_name='SST_global', &
init_time=Time, diag=diag, long_name='Global Average Sea Surface Temperature', &
units='Celsius', missing_value=CS%missing, cmor_field_name='tosga', &
cmor_units='deg C', cmor_standard_name='global_average_sea_surface_temperature')
CS%id_sst_sq = register_diag_field('ocean_model', 'SST_sq', diag%axesT1, Time, &
'Sea Surface Temperature Squared', 'Celsius**2', CS%missing)
CS%id_sss = register_diag_field('ocean_model', 'SSS', diag%axesT1, Time, &
Expand Down Expand Up @@ -2209,8 +2215,10 @@ subroutine write_static_fields(G, diag)
'Longitude of zonal velocity (Cu) points', 'degrees_E')
if (id > 0) call post_data(id, G%geoLonCu, diag, .true.)

id = register_static_field('ocean_model', 'area_t', diag%axesT1, &
'Surface area of tracer (T) cells', 'degrees_E')
id = register_static_field('ocean_model', 'area_t', diag%axesT1, &
'Surface area of tracer (T) cells', 'degrees_E', &
cmor_field_name='areacello', cmor_standard_name='cell_area', &
cmor_units='m-2', cmor_long_name='Ocean Grid-Cell Area')
if (id > 0) then
do j=js,je ; do i=is,ie ; out_h(i,j) = G%areaT(i,j) ; enddo ; enddo
call post_data(id, out_h, diag, .true.)
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_forcing_type.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ end subroutine forcing_SinglePointPrint
!> Register members of the forcing type for diagnostics
subroutine register_forcing_type_diags(Time, diag, use_temperature, handles)
type(time_type), intent(in) :: Time
type(diag_ctrl), intent(in) :: diag
type(diag_ctrl), intent(inout) :: diag
logical, intent(in) :: use_temperature !< True if T/S are in use
type(forcing_diags), intent(inout) :: handles

Expand Down
73 changes: 68 additions & 5 deletions src/diagnostics/MOM_diag_to_Z.F90
Original file line number Diff line number Diff line change
Expand Up @@ -705,16 +705,19 @@ subroutine calc_Zint_diags(h, in_ptrs, ids, num_diags, &
enddo

end subroutine calc_Zint_diags


subroutine register_Z_tracer(tr_ptr, name, long_name, units, Time, G, CS)
subroutine register_Z_tracer(tr_ptr, name, long_name, units, Time, G, CS, standard_name, &
cmor_field_name, cmor_long_name, cmor_units, cmor_standard_name)
real, dimension(NIMEM_,NJMEM_,NKMEM_), target, intent(in) :: tr_ptr
character(len=*), intent(in) :: name
character(len=*), intent(in) :: long_name
character(len=*), intent(in) :: units
character(len=*), optional, intent(in) :: standard_name
type(time_type), intent(in) :: Time
type(ocean_grid_type), intent(in) :: G
type(diag_to_Z_CS), pointer :: CS
character(len=*), optional, intent(in) :: cmor_field_name, cmor_long_name
character(len=*), optional, intent(in) :: cmor_units, cmor_standard_name
! This subroutine registers a tracer to be output in depth space.
! Arguments: tr_ptr - the tracer that is being offered for translation to Z-space.
! (in) name - The name to be used for the output tracer.
Expand All @@ -724,6 +727,64 @@ subroutine register_Z_tracer(tr_ptr, name, long_name, units, Time, G, CS)
! (in) G - The ocean's grid structure.
! (in) CS - The control structure returned by a previous call to
! diagnostics_init.
! (in,opt) cmor_field_name - The cmor name of a field.
! (in,opt) cmor_long_name - The cmor long name of a field.
! (in,opt) cmor_units - The cmor units of a field.
! (in,opt) cmor_standard_name - The cmor standardized name associated with a field.
character(len=256) :: posted_standard_name
character(len=256) :: posted_cmor_units, posted_cmor_standard_name, posted_cmor_long_name

if (present(standard_name)) then
posted_standard_name = standard_name
else
posted_standard_name = 'not provided'
endif

call register_Z_tracer_low(tr_ptr, name, long_name, units, trim(posted_standard_name), Time, G, CS)

if (present(cmor_field_name)) then
! Fallback values for strings set to "NULL"
posted_cmor_units = "not provided" !
posted_cmor_standard_name = "not provided" ! Values might be able to be replaced with a CS%missing field?
posted_cmor_long_name = "not provided" !

! If attributes are present for MOM variable names, use them first for the register_diag_field
! call for CMOR verison of the variable
posted_cmor_units = units
posted_cmor_long_name = long_name
posted_cmor_standard_name = posted_standard_name

! If specified in the call to register_diag_field, override attributes with the CMOR versions
if (present(cmor_units)) posted_cmor_units = cmor_units
if (present(cmor_standard_name)) posted_cmor_standard_name = cmor_standard_name
if (present(cmor_long_name)) posted_cmor_long_name = cmor_long_name

call register_Z_tracer_low(tr_ptr, trim(cmor_field_name), trim(posted_cmor_long_name), &
trim(posted_cmor_units), trim(posted_cmor_standard_name), Time, G, CS)

endif

end subroutine register_Z_tracer

subroutine register_Z_tracer_low(tr_ptr, name, long_name, units, standard_name, Time, G, CS)
real, dimension(NIMEM_,NJMEM_,NKMEM_), target, intent(in) :: tr_ptr
character(len=*), intent(in) :: name
character(len=*), intent(in) :: long_name
character(len=*), intent(in) :: units
character(len=*), intent(in) :: standard_name
type(time_type), intent(in) :: Time
type(ocean_grid_type), intent(in) :: G
type(diag_to_Z_CS), pointer :: CS
! This subroutine registers a tracer to be output in depth space.
! Arguments: tr_ptr - the tracer that is being offered for translation to Z-space.
! (in) name - The name to be used for the output tracer.
! (in) long_name - The long name to be used for the output tracer.
! (in) units - The units of the output tracer.
! (in) Time - The current model time.
! (in) G - The ocean's grid structure.
! (in) CS - The control structure returned by a previous call to
! diagnostics_init.
character(len=256) :: posted_standard_name
integer :: isd, ied, jsd, jed, nk, m, id_test
isd = G%isd ; ied = G%ied ; jsd = G%jsd ; jed = G%jed ; nk = G%ke
if (.not.associated(CS)) call MOM_error(FATAL, &
Expand All @@ -740,10 +801,12 @@ subroutine register_Z_tracer(tr_ptr, name, long_name, units, Time, G, CS)
CS%missing_tr(m) = CS%missing_value ! This could be changed later, if desired.
if (CS%nk_zspace > 0) then
CS%id_tr(m) = register_diag_field('ocean_model', name, CS%axesTz, Time, &
long_name, units, missing_value=CS%missing_tr(m))
long_name, units, missing_value=CS%missing_tr(m), &
standard_name=standard_name)
else
id_test = register_diag_field('ocean_model', name, CS%diag%axesT1, Time, &
long_name, units, missing_value=CS%missing_tr(m))
long_name, units, missing_value=CS%missing_tr(m), &
standard_name=standard_name)
if (id_test>0) call MOM_error(WARNING, &
"MOM_diag_to_Z_init: "//trim(name)// &
" cannot be output without an appropriate depth-space target file.")
Expand All @@ -755,7 +818,7 @@ subroutine register_Z_tracer(tr_ptr, name, long_name, units, Time, G, CS)
call safe_alloc_ptr(CS%tr_z(m)%p,isd,ied,jsd,jed,CS%nk_zspace)
CS%tr_model(m)%p => tr_ptr

end subroutine register_Z_tracer
end subroutine register_Z_tracer_low

subroutine MOM_diag_to_Z_init(Time, G, param_file, diag, CS)
type(time_type), intent(in) :: Time
Expand Down
Loading