Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
11c446a
fixes to evap_ice evap_snow
Nov 13, 2024
63f7641
bug fix
Dec 2, 2024
e146cff
added timestep, FLAGGED diff with CICE6
Dec 2, 2024
b59601a
add siflfwdrain, minor changes to FLAG comments
Dec 16, 2024
19e550d
missing variable definitions
anton-seaice May 1, 2025
e49e0eb
use kelvin for sitemptop
anton-seaice Jun 3, 2025
50ce815
use kelvin for sitempsnic
anton-seaice Jun 3, 2025
bc4a51f
tidy comments
anton-seaice Jun 3, 2025
86dd0e1
Update source/ice_history.F90
anton-seaice Jul 4, 2025
462a1bd
port CICE6 history features for CMIP variables: avg_ice_present, mask…
anton-seaice Aug 20, 2025
e26beb9
add sidmassgrowthsi (same as sidmasssi)
anton-seaice Aug 21, 2025
cb3bce8
neaten formatting of history tape logging
anton-seaice Aug 21, 2025
8ae3a8b
add sidmassmeltlat
anton-seaice Aug 22, 2025
4f24ad2
fix namelist error handling
anton-seaice Aug 22, 2025
00dcd15
fix f_sidmassgrowthsi
anton-seaice Aug 22, 2025
4f46545
fix f_sidmassgrowthsi
anton-seaice Aug 22, 2025
b57d7ec
fix name for sidmassmeltlat and possible loop optimise of sidmasstran…
anton-seaice Aug 22, 2025
a9cf7f7
add siflsensbot
anton-seaice Aug 22, 2025
003961c
simass and sisnmass
anton-seaice Aug 22, 2025
6daf211
add siconc, fix sisnconc for aice weighting
anton-seaice Aug 22, 2025
2c26cfc
fix siconc
anton-seaice Aug 22, 2025
aec5e8d
sisndmassdyn
anton-seaice Aug 22, 2025
77622b3
some fixes and add sisndmasssi
anton-seaice Sep 5, 2025
6eb67cd
sisndmasssnf?
anton-seaice Sep 5, 2025
8e65dec
add sisndmasssubl, although probably 0 for zero-layer thermodynamics?
anton-seaice Sep 15, 2025
8f6f206
sitimefrac
anton-seaice Sep 15, 2025
fe5e7a0
sivol
anton-seaice Sep 15, 2025
061fada
notes
anton-seaice Sep 15, 2025
d0a7db6
fix my bugs
anton-seaice Sep 22, 2025
1673cb2
fix my bugs
anton-seaice Sep 22, 2025
d518ff7
fix my bugs
anton-seaice Sep 22, 2025
d3c1fa0
some corrections adn tidyup
anton-seaice Sep 23, 2025
0f0df60
Update source/ice_history.F90
anton-seaice Sep 23, 2025
db55587
fix C->K conversion for sitempsnic
anton-seaice Sep 23, 2025
a8c2d26
Tsnice based on https://github.com/CICE-Consortium/Icepack/pull/542
anton-seaice Sep 24, 2025
e081c14
fix units on sisnmass
anton-seaice Sep 24, 2025
81f2080
reset evap_ice each timestep and adjust diagnostic
anton-seaice Sep 25, 2025
f914d6b
Merge remote-tracking branch 'origin/access-esm1.6' into spo_edit_gsi8.1
anton-seaice Sep 26, 2025
60179c8
use cice6 calc for freeboard
anton-seaice Oct 7, 2025
387dc7b
use cice6 implementation for temperature diags
anton-seaice Oct 7, 2025
a6cd05b
sisaltmass is extensive
anton-seaice Oct 7, 2025
15656b4
siitdconc
anton-seaice Oct 7, 2025
a426958
some tidyup and average sisndmasssubl by aice
anton-seaice Oct 7, 2025
34759cd
snow mass melt should be grid cell average
anton-seaice Oct 7, 2025
c549af9
average all snow by aice
anton-seaice Oct 7, 2025
b09a985
fix sivol
anton-seaice Oct 9, 2025
1db42f3
Some fixes:
anton-seaice Oct 13, 2025
5da1061
better Tsnice weighting
anton-seaice Oct 13, 2025
aafe598
better Tsnice weighting
anton-seaice Oct 13, 2025
79ad707
Apply suggestion from @anton-seaice
anton-seaice Oct 13, 2025
62dcb7e
syntax
anton-seaice Oct 13, 2025
8c7035f
Fix name for sivol var
anton-seaice Oct 14, 2025
acbecaf
test with aice_init masking
anton-seaice Oct 17, 2025
6781f62
test with aice_init masking
anton-seaice Oct 17, 2025
d15555b
some error handling and moving of aice weighting
anton-seaice Oct 20, 2025
cf9c0eb
some error handling and moving of aice weighting
anton-seaice Oct 20, 2025
ac52cb6
corrections
anton-seaice Oct 20, 2025
d8e6797
corrections
anton-seaice Oct 20, 2025
62fd66f
reorder avg_ice_present and conb steps so that temp diagnostics work
anton-seaice Oct 22, 2025
22dcdf9
fixes to metadata
anton-seaice Oct 22, 2025
edd67f0
Use long names based on CMIP7 variable title
anton-seaice Oct 22, 2025
cd905a8
consistentize units
anton-seaice Oct 22, 2025
3f0f381
we arent CF compliant
anton-seaice Oct 22, 2025
d083b62
don't save sipr if it's passed straight through (per Notz 2016)
anton-seaice Oct 24, 2025
bf9a479
try with less masking
anton-seaice Oct 24, 2025
25150ff
some prep for review
anton-seaice Oct 28, 2025
1b8fa36
self review
anton-seaice Oct 28, 2025
14e1ecb
Apply suggestions from code review
anton-seaice Nov 6, 2025
a43343a
Apply suggestions from code review
anton-seaice Nov 6, 2025
2a9f9e4
review feedback, and _ai variables
anton-seaice Nov 6, 2025
d18bc58
some corrections from the data request
anton-seaice Nov 7, 2025
1fe8164
update comments and weightings
anton-seaice Nov 10, 2025
4eccf53
allow for both _intensive and not _intensive for snow variables
anton-seaice Nov 11, 2025
5e378b3
bug fixes and sign corrections
anton-seaice Nov 11, 2025
6a912f8
Apply suggestions from code review
anton-seaice Nov 11, 2025
2e8071f
review comments
anton-seaice Nov 12, 2025
adff66c
Apply suggestions from code review
anton-seaice Nov 12, 2025
fd8ccf3
Update source/ice_therm_vertical.F90
anton-seaice Nov 12, 2025
41c6a64
Update source/ice_history.F90
anton-seaice Nov 12, 2025
67863be
Update source/ice_history.F90
anton-seaice Nov 12, 2025
eb9583d
fix n_sndmasssnf
anton-seaice Nov 12, 2025
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
62 changes: 40 additions & 22 deletions drivers/access/CICE_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,13 @@ subroutine CICE_Run
use ice_timers, only: ice_timer_start, &
ice_timer_stop, timer_couple, timer_step, &
timer_from_atm, timer_into_atm, timer_from_ocn, timer_into_ocn
use ice_grid, only: t2ugrid_vector, u2tgrid_vector
use ice_grid, only: t2ugrid_vector
integer (kind=int_kind) :: time_sec, itap, icpl_ai, tmp_time
integer (kind=int_kind) :: rtimestamp_ai, stimestamp_ai
integer (kind=int_kind) :: rtimestamp_io, stimestamp_io
!receive and send timestamps (seconds)
integer (kind=int_kind) :: imon

logical :: write_tmp_dump = .true.
#endif

!--------------------------------------------------------------------
Expand All @@ -83,9 +82,12 @@ subroutine CICE_Run
!--------------------------------------------------------------------

#ifdef ACCESS
write(il_out,*)'A <==> I coupling num_cpl_ai = ',num_cpl_ai
write(il_out,*)' ice steps per ai interval num_ice_ai = ',num_ice_ai
write(il_out,*)' runtime, runtime0 = ',runtime, runtime0

if (my_task == master_task) then
write(il_out,*)'A <==> I coupling num_cpl_ai = ',num_cpl_ai
write(il_out,*)' ice steps per ai interval num_ice_ai = ',num_ice_ai
write(il_out,*)' runtime, runtime0 = ',runtime, runtime0
endif

time_sec = 0

Expand All @@ -94,7 +96,7 @@ subroutine CICE_Run
!receive a2i fields
rtimestamp_ai = time_sec
!call ice_timer_start(timer_from_atm) ! atm/ice coupling
write(il_out,*)' calling from_atm at icpl_ai, time_sec = ', icpl_ai, time_sec
! write(il_out,*)' calling from_atm at icpl_ai, time_sec = ', icpl_ai, time_sec
!===========================
call from_atm(rtimestamp_ai)
!===========================
Expand All @@ -116,8 +118,8 @@ subroutine CICE_Run
call t2ugrid_vector(io_strsu)
call t2ugrid_vector(io_strsv)

write(il_out,'(a,3i10)') &
' calling into_ocn at icpl_ai, itap, time_sec = ', icpl_ai, itap, time_sec
! write(il_out,'(a,3i10)') &
! ' calling into_ocn at icpl_ai, itap, time_sec = ', icpl_ai, itap, time_sec
!call ice_timer_start(timer_into_ocn) ! atm/ocn coupling
!===========================
!call check_iceberg_fields('chk_iceberg_i2o.nc')
Expand Down Expand Up @@ -161,8 +163,8 @@ subroutine CICE_Run

stimestamp_ai = time_sec

write(il_out,'(a,3i10)') &
' calling into_atm at icpl_ai, itap, time_sec = ',icpl_ai, itap, time_sec
! write(il_out,'(a,3i10)') &
! ' calling into_atm at icpl_ai, itap, time_sec = ',icpl_ai, itap, time_sec
!===========================
call into_atm(stimestamp_ai)
!===========================
Expand Down Expand Up @@ -292,6 +294,10 @@ subroutine ice_step
use ice_algae, only: bgc_diags, write_restart_bgc
use ice_zbgc, only: init_history_bgc, biogeochemistry
use ice_zbgc_shared, only: skl_bgc
#ifdef ACCESS
use ice_state, only: vsno, aice, tr_pond
use ice_flux, only: snowfrac
#endif

integer (kind=int_kind) :: &
iblk , & ! block index
Expand Down Expand Up @@ -428,20 +434,12 @@ subroutine coupling_prep (iblk)
use ice_constants, only: c0, c1, puny, rhofresh
use ice_coupling, only: top_layer_Tandk_run, sfcflux_to_ocn
use ice_domain_size, only: ncat
use ice_flux, only: alvdf, alidf, alvdr, alidr, albice, albsno, &
albpnd, albcnt, apeff_ai, coszen, fpond, fresh, &
alvdf_ai, alidf_ai, alvdr_ai, alidr_ai, fhocn_ai, &
fresh_ai, fsalt_ai, fsalt, &
fswthru_ai, fhocn, fswthru, scale_factor, &
swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyt, &
fsens, flat, fswabs, flwout, evap, Tref, Qref, faero_ocn, &
fsurfn_f, flatn_f, scale_fluxes, frzmlt_init, frzmlt, &
snowfrac, snowfracn, evap_ice, evap_snow
use ice_flux
use ice_grid, only: tmask
use ice_ocean, only: oceanmixed_ice, ocean_mixed_layer
use ice_shortwave, only: alvdfn, alidfn, alvdrn, alidrn, &
albicen, albsnon, albpndn, apeffn
use ice_state, only: aicen, aice, aice_init, nbtrcr
use ice_state, only: aicen, aice, aice_init, nbtrcr, tr_pond, vsno
use ice_therm_shared, only: calc_Tsfc, heat_capacity
use ice_timers, only: timer_couple, ice_timer_start, ice_timer_stop
use ice_zbgc_shared, only: flux_bio, flux_bio_ai
Expand Down Expand Up @@ -527,8 +525,19 @@ subroutine coupling_prep (iblk)

apeff_ai(i,j,iblk) = apeff_ai(i,j,iblk) & ! for history
+ apeffn(i,j,n,iblk)*aicen(i,j,n,iblk)
snowfrac(i,j,iblk) = snowfrac(i,j,iblk) & ! for history
+ snowfracn(i,j,n,iblk)*aicen(i,j,n,iblk)

if ( .not. tr_pond .and. .not. calc_Tsfc ) then
! calculate a snowfrac diagnostic in the same way the UM does
! set snow fraction using JULES empirical formula based
! on snow volume
! ref: https://github.com/ACCESS-NRI/UM7/blob/6602dadd15c190ee37c6644190f52d428bc66917/umbase_hg3/src/atmosphere/short_wave_radiation/ftsa.F90#L201-L202
if (aice(i,j,iblk) > 2e-4) &
snowfrac(i,j,iblk) = c1 - exp(-p2*rhos*(vsno(i,j,iblk) / aice(i,j,iblk)))
else
snowfrac(i,j,iblk) = snowfrac(i,j,iblk) & ! for history
+ snowfracn(i,j,n,iblk)*aicen(i,j,n,iblk)
endif
Comment on lines +534 to +539
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interpretation of snowfrac might not be consistent between the two cases here. I think it will be a fraction of the ice area for the .not. tr_pond .and. .not. calc_Tsfc case, and a fraction of the grid cell area otherwise.

For the .not. tr_pond .and. .not. calc_Tsfc, we might need to multiply by aice to make the intensive diagnostics work properly.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anton-seaice what are your thoughts on this one. In the ( .not. tr_pond .and. .not. calc_Tsfc ) case, I'm guessing snowfrac would be a fraction of the ice as the calculation is using the actual snow hight?

The diagnostics treat it as a grid cell fraction:

call define_hist_field(n_snowfrac,"snowfrac","1",tstr2D, tcstr, &
"grid cell mean snow fraction", &
"snow fraction per unit grid cell area", c1, c0, &

cice5/source/ice_history.F90

Lines 2202 to 2204 in 2e8071f

if (f_sisnconc(1:1) /= 'x') &
! intensive + ice area mean -> use snowfrac (grid box mean)
call accum_hist_field(n_sisnconc, iblk, snowfrac(:,:,iblk), a2D)

Though we might need to be careful with sisnthick

cice5/source/ice_history.F90

Lines 2206 to 2212 in 2e8071f

if (f_sisnthick(1:1) /= 'x') then
worka(:,:) = c0
do j = jlo, jhi
do i = ilo, ihi
if (snowfrac(i,j,iblk) > puny) then
! intensive + ice area mean -> calculate grid box mean
worka(i,j) = vsno(i,j,iblk) / snowfrac(i,j,iblk)

Copy link

@ofa001 ofa001 Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @anton-seaice @blimlim Just went and looked at some of these old conversations which my email system dates from around the 6 Nov so before the sisnconc and sisnthick got dropped from the set up so its probably what is behind the reasoning that we used back then. But I still think we should have a snow thickness its on the list from the observational community key variables, but if we are concerned what snow concentration to use and there are multiple definitions, depending on which version of CICE4/5/6 and then we are dividing snow volume by concentration to get thickness then its awkward.

Its about half way down the page after 2206-2212 in 28071f on the definition of sisnthick.


enddo
enddo
enddo
Expand All @@ -555,6 +564,15 @@ subroutine coupling_prep (iblk)
fsalt_ai (i,j,iblk) = fsalt (i,j,iblk)
fhocn_ai (i,j,iblk) = fhocn (i,j,iblk)
fswthru_ai(i,j,iblk) = fswthru(i,j,iblk)
fsens_ai (i,j,iblk) = fsens(i,j,iblk)
flat_ai (i,j,iblk) = flat(i,j,iblk)
fswabs_ai (i,j,iblk) = fswabs(i,j,iblk)
flwout_ai (i,j,iblk) = flwout(i,j,iblk)
evap_ai (i,j,iblk) = evap(i,j,iblk)
evap_ice_ai(i,j,iblk) = evap_ice(i,j,iblk)
evap_snow_ai(i,j,iblk) = evap_snow(i,j,iblk)
fcondtop_ai(i,j,iblk) = fcondtop(i,j,iblk)
fsurf_ai(i,j,iblk) = fsurf(i,j,iblk)

if (nbtrcr > 0) then
do k = 1, nbtrcr
Expand Down
4 changes: 2 additions & 2 deletions drivers/access/cpl_forcing_handler.F90
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,9 @@ subroutine get_lice_discharge(fname)
case (4); myvar = 'FICEBERG_GC3_AVE'
end select
write(il_out,*)'(get_lice_discharge), iceberg = ', iceberg
write(il_out,'(a,a)') '(get_lice_discharge) reading in iceberg data, myvar= ',trim(myvar)
! write(il_out,'(a,a)') '(get_lice_discharge) reading in iceberg data, myvar= ',trim(myvar)
do im = 1, 12
write(il_out,*) '(get_lice_discharge) reading in data, month= ',im
! write(il_out,*) '(get_lice_discharge) reading in data, month= ',im
call ice_read_nc(ncid_i2o, im, trim(myvar), vwork, dbug)

! Restrict iceberg fluxes to ocean points
Expand Down
53 changes: 26 additions & 27 deletions drivers/access/cpl_interface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -92,24 +92,23 @@ subroutine prism_init
! Initialise MPI
mpiflag = .FALSE.
call MPI_Initialized (mpiflag, ierror)
print *,'CICE: (prism_init) BF MPI_INIT, mpiflag = ',mpiflag
! print *,'CICE: (prism_init) BF MPI_INIT, mpiflag = ',mpiflag

if ( .not. mpiflag ) then
call MPI_INIT(ierror)
endif

call MPI_Initialized (mpiflag, ierror)
print *, 'CICE: (prism_init) AF MPI_INIT, mpiflag = ',mpiflag
! print *, 'CICE: (prism_init) AF MPI_INIT, mpiflag = ',mpiflag

print *
print *, 'CICE: (prism_init) calling prism_init_comp_proto...'
! print *, 'CICE: (prism_init) calling prism_init_comp_proto...'

call prism_init_comp_proto (il_comp_id, cp_modnam, ierror)

if (ierror /= PRISM_Ok) then
call prism_abort_proto(il_comp_id, 'cice prism_init','STOP 1')
else
print *, 'CICE: (prism_init) called prism_init_comp_proto !'
! else
! if ( my_task == master_task ) print *, 'CICE: (prism_init) called prism_init_comp_proto !'
endif

!B: the following part may not be really needed(?)
Expand All @@ -132,8 +131,8 @@ subroutine prism_init
if (ierror /= PRISM_Ok) then
print *, 'CICE: (prism_init) Error in MPI_Buffer_Attach.'
call prism_abort_proto(il_comp_id, 'cice prism_init','STOP 2')
else
print *, 'CICE: (prism_init) MPI_Buffer_Attach ok!'
! else
! print *, 'CICE: (prism_init) MPI_Buffer_Attach ok!'
endif
!
! PSMILe attribution of local communicator.
Expand All @@ -147,21 +146,21 @@ subroutine prism_init
print *, 'CICE: Error in prism_get_localcomm_proto'
call prism_abort_proto(il_comp_id, 'cice prism_init','STOP 3')
else
print *, 'CICE: _get_localcomm_ OK! il_commlocal= ',il_commlocal
if ( my_task == master_task ) print *, 'CICE: _get_localcomm_ OK! il_commlocal= ',il_commlocal
endif

!
! Inquire if model is parallel or not and open the process log file
!
! print *, '* CICE: Entering init_cpl.....'

print *, '* CICE (prism_init) calling MPI_Comm_Size ...'
!print *, '* CICE (prism_init) calling MPI_Comm_Size ...'
call MPI_Comm_Size(il_commlocal, il_nbtotproc, ierror)
print *, '* CICE (prism_init) calling MPI_Comm_Rank ...'
!print *, '* CICE (prism_init) calling MPI_Comm_Rank ...'
call MPI_Comm_Rank(il_commlocal, my_task, ierror)

print *, '* CICE (prism_init) il_commlocal, il_nbtotproc, my_task = '
print *, '* CICE (prism_init) ', il_commlocal, il_nbtotproc, my_task
if ( my_task == master_task ) print *, '* CICE (prism_init) il_commlocal, il_nbtotproc, my_task = '
if ( my_task == master_task ) print *, '* CICE (prism_init) ', il_commlocal, il_nbtotproc, my_task
!
il_nbcplproc = il_nbtotproc !multi-process coupling (real parallel cpl)!
!il_nbcplproc = 1 !mono process coupling
Expand Down Expand Up @@ -258,18 +257,18 @@ subroutine init_cpl
! end do

!!debug
if (my_task == 0) then
write(il_out,*) "all block info:"
do iblk=1,nblocks_tot
this_block = get_block(iblk,iblk)
ilo = this_block%ilo
ihi = this_block%ihi
jlo = this_block%jlo
jhi = this_block%jhi
write(il_out,*) ' this block: cpu, iblock, jblock=', distrb_info%blockLocation(iblk)-1, this_block%iblock, this_block%jblock
write(il_out,*) ' block:', iblk, "gilo, gjlo, gihi, gjhi=", this_block%i_glob(ilo), this_block%j_glob(jlo), this_block%i_glob(ihi), this_block%j_glob(jhi)
end do
end if
! if (my_task == 0) then
! write(il_out,*) "all block info:"
! do iblk=1,nblocks_tot
! this_block = get_block(iblk,iblk)
! ilo = this_block%ilo
! ihi = this_block%ihi
! jlo = this_block%jlo
! jhi = this_block%jhi
! write(il_out,*) ' this block: cpu, iblock, jblock=', distrb_info%blockLocation(iblk)-1, this_block%iblock, this_block%jblock
! write(il_out,*) ' block:', iblk, "gilo, gjlo, gihi, gjhi=", this_block%i_glob(ilo), this_block%j_glob(jlo), this_block%i_glob(ihi), this_block%j_glob(jhi)
! end do
! end if

do iblk=1,nblocks_tot

Expand Down Expand Up @@ -781,8 +780,8 @@ subroutine from_atm(isteps)
call ncheck( nf_open('fields_a2i_in_ice.nc',nf_write,ncid) )
call write_nc_1Dtime(real(isteps),currstep,'time',ncid)
endif
write(il_out,*)
write(il_out,*) '(from_atm) Total number of fields to be rcvd: ', nrecv_a2i
! write(il_out,*)
! write(il_out,*) '(from_atm) Total number of fields to be rcvd: ', nrecv_a2i
endif

if (debug) write(il_out,*) "prism_get from_atm at sec: ", isteps
Expand Down
57 changes: 52 additions & 5 deletions io_netcdf/ice_history_write.F90
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,11 @@ subroutine ice_hist_create(ns, ncfile, ncid, var, coord_var, var_nverts, var_nz)
call check(nf90_put_att(ncid,varid,'cell_measures', &
avail_hist_fields(n)%vcellmeas), &
'put att cell_measures '//avail_hist_fields(n)%vname)
if (avail_hist_fields(n)%vcomment /= "none") then
call check(nf90_put_att(ncid,varid,'comment', &
avail_hist_fields(n)%vcomment), &
'put att comment '//avail_hist_fields(n)%vname)
endif
call check(nf90_put_att(ncid,varid,'missing_value',spval), &
'put att missing_value '//avail_hist_fields(n)%vname)
call check(nf90_put_att(ncid,varid,'_FillValue',spval), &
Expand All @@ -679,9 +684,20 @@ subroutine ice_hist_create(ns, ncfile, ncid, var, coord_var, var_nverts, var_nz)
if (hist_avg) then
if (TRIM(avail_hist_fields(n)%vname)/='sig1' .or. &
TRIM(avail_hist_fields(n)%vname)/='sig2') then

call check(nf90_put_att(ncid,varid,'cell_methods','time: mean'), &
if (avail_hist_fields(n)%avg_ice_present) then
call check(nf90_put_att(ncid,varid,'cell_methods',&
'area: time: mean where sea_ice (mask=siconc)'), &
'put att cell methods time mean '//avail_hist_fields(n)%vname)
else
if (TRIM(avail_hist_fields(n)%vname(1:2))/='si') then !native diags
call check(nf90_put_att(ncid,varid,'cell_methods','time: mean'), &
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not hugely important, but would this also slightly alter the cell methods for sice

call define_hist_field(n_sice,"sice","ppt",tstr2D, tcstr, &
"bulk ice salinity", &
"none", c1, c0, &
ns1, f_sice)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it will, this is a bit hacky, it really needs an extra cell_methods field added to avail_hist_fields

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would there be problems caused by swapping over everything to the CMIP style cell methods?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its possibly ok, as all native diags use a time:mean over all timesteps.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anton-seaice should I defer this to a separate issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'area: mean where sea time: mean' is ok for sice - so fine to ignore I think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good to leave as is!

'put att cell methods time mean '//avail_hist_fields(n)%vname)
else !cmip diags
call check(nf90_put_att(ncid,varid,'cell_methods', &
'area: mean where sea time: mean'), &
'put att cell methods time mean '//avail_hist_fields(n)%vname)
endif
endif
Comment on lines +687 to +700
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should mean cell_methods are unchanged for native diagnostics, but for cmip diagnostics, they now include area:mean information as well

endif
endif

Expand Down Expand Up @@ -739,6 +755,11 @@ subroutine ice_hist_create(ns, ncfile, ncid, var, coord_var, var_nverts, var_nz)
avail_hist_fields(n)%vcellmeas)
if (status /= nf90_noerr) call abort_ice( &
'Error defining cell measures for '//avail_hist_fields(n)%vname)
if (avail_hist_fields(n)%vcomment /= "none") then
call check(nf90_put_att(ncid,varid,'comment', &
avail_hist_fields(n)%vcomment), &
'put att comment '//avail_hist_fields(n)%vname)
endif
status = nf90_put_att(ncid,varid,'missing_value',spval)
if (status /= nf90_noerr) call abort_ice( &
'Error defining missing_value for '//avail_hist_fields(n)%vname)
Expand Down Expand Up @@ -802,6 +823,11 @@ subroutine ice_hist_create(ns, ncfile, ncid, var, coord_var, var_nverts, var_nz)
avail_hist_fields(n)%vcellmeas)
if (status /= nf90_noerr) call abort_ice( &
'Error defining cell measures for '//avail_hist_fields(n)%vname)
if (avail_hist_fields(n)%vcomment /= "none") then
call check(nf90_put_att(ncid,varid,'comment', &
avail_hist_fields(n)%vcomment), &
'put att comment '//avail_hist_fields(n)%vname)
endif
status = nf90_put_att(ncid,varid,'missing_value',spval)
if (status /= nf90_noerr) call abort_ice( &
'Error defining missing_value for '//avail_hist_fields(n)%vname)
Expand Down Expand Up @@ -851,6 +877,11 @@ subroutine ice_hist_create(ns, ncfile, ncid, var, coord_var, var_nverts, var_nz)
avail_hist_fields(n)%vcellmeas)
if (status /= nf90_noerr) call abort_ice( &
'Error defining cell measures for '//avail_hist_fields(n)%vname)
if (avail_hist_fields(n)%vcomment /= "none") then
call check(nf90_put_att(ncid,varid,'comment', &
avail_hist_fields(n)%vcomment), &
'put att comment '//avail_hist_fields(n)%vname)
endif
status = nf90_put_att(ncid,varid,'missing_value',spval)
if (status /= nf90_noerr) call abort_ice( &
'Error defining missing_value for '//avail_hist_fields(n)%vname)
Expand Down Expand Up @@ -901,6 +932,11 @@ subroutine ice_hist_create(ns, ncfile, ncid, var, coord_var, var_nverts, var_nz)
avail_hist_fields(n)%vcellmeas)
if (status /= nf90_noerr) call abort_ice( &
'Error defining cell measures for '//avail_hist_fields(n)%vname)
if (avail_hist_fields(n)%vcomment /= "none") then
call check(nf90_put_att(ncid,varid,'comment', &
avail_hist_fields(n)%vcomment), &
'put att comment '//avail_hist_fields(n)%vname)
endif
status = nf90_put_att(ncid,varid,'missing_value',spval)
if (status /= nf90_noerr) call abort_ice( &
'Error defining missing_value for '//avail_hist_fields(n)%vname)
Expand Down Expand Up @@ -966,6 +1002,11 @@ subroutine ice_hist_create(ns, ncfile, ncid, var, coord_var, var_nverts, var_nz)
avail_hist_fields(n)%vcellmeas)
if (status /= nf90_noerr) call abort_ice( &
'Error defining cell measures for '//avail_hist_fields(n)%vname)
if (avail_hist_fields(n)%vcomment /= "none") then
call check(nf90_put_att(ncid,varid,'comment', &
avail_hist_fields(n)%vcomment), &
'put att comment '//avail_hist_fields(n)%vname)
endif
status = nf90_put_att(ncid,varid,'missing_value',spval)
if (status /= nf90_noerr) call abort_ice( &
'Error defining missing_value for '//avail_hist_fields(n)%vname)
Expand Down Expand Up @@ -1031,6 +1072,11 @@ subroutine ice_hist_create(ns, ncfile, ncid, var, coord_var, var_nverts, var_nz)
avail_hist_fields(n)%vcellmeas)
if (status /= nf90_noerr) call abort_ice( &
'Error defining cell measures for '//avail_hist_fields(n)%vname)
if (avail_hist_fields(n)%vcomment /= "none") then
call check(nf90_put_att(ncid,varid,'comment', &
avail_hist_fields(n)%vcomment), &
'put att comment '//avail_hist_fields(n)%vname)
endif
status = nf90_put_att(ncid,varid,'missing_value',spval)
if (status /= nf90_noerr) call abort_ice( &
'Error defining missing_value for '//avail_hist_fields(n)%vname)
Expand Down Expand Up @@ -1094,9 +1140,10 @@ subroutine ice_hist_create(ns, ncfile, ncid, var, coord_var, var_nverts, var_nz)
call check(nf90_put_att(ncid,nf90_global,'comment2',title), &
'global attribute comment2')

title = 'CF-1.0'
call check(nf90_put_att(ncid,nf90_global,'conventions',title), &
'global attribute conventions')
! TO-DO: Update output for CF compliance !
! title = 'CF-1.0'
! call check(nf90_put_att(ncid,nf90_global,'conventions',title), &
! 'global attribute conventions')

call date_and_time(date=current_date, time=current_time)
write(start_time,1000) current_date(1:4), current_date(5:6), &
Expand Down
Loading