GCEL / CARDAMOM

The CARbon DAta MOdel FraMework. Computer software that retrieves terrestrial carbon (C) cycle variables by combining C cycle observations with a mass balance model.
GNU General Public License v3.0
2 stars 0 forks source link

Assimilating leaf litter collection data #31

Closed DTMilodowski closed 1 year ago

DTMilodowski commented 1 year ago

Hi folks,

I'm about to code up a snippet to assimilate leaf litter data. Before I do so, it would be good to make a change that is easy to transfer across other models. In the past, I've just modified an existing unused data input stream, to read in the data, but this seems sub-optimal in terms of making the change more widely useful.

Is there currently a dedicated slot across any of the models for ingesting litter collection data into the observations constraints (amount, uncertainty, period over which litter collected)? If not, what is the next available slot?

Best wishes, David

DTMilodowski commented 1 year ago

A similar formulation based on the time-integrated flux and period of estimate will also eventually be coded up to deal with other fluxes, e.g. integrated inter-census fluxes driven by mortality and growth

lsmallma commented 1 year ago

Hi David,

The growth vs mortality already exists. This is something worked on by Ebuka.

There is an existing way to assimilate litter stocks but I agree with your suggestion that this should be replaced with one based on the growth/mortality flux constraints.

Luke

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: David Milodowski @.> Sent: Monday, May 1, 2023 3:29:34 PM To: GCEL/CARDAMOM @.> Cc: Luke Smallman @.>; Assign @.> Subject: Re: [GCEL/CARDAMOM] Assimilating leaf litter collection data (Issue #31)

This email was sent to you by someone outside the University. You should only click on links or attachments if you are certain that the email is genuine and the content is safe.

A similar formulation based on the time-integrated flux and period of estimate will also eventually be coded up to deal with other fluxes, e.g. integrated inter-census fluxes driven by mortality and growth

— Reply to this email directly, view it on GitHubhttps://github.com/GCEL/CARDAMOM/issues/31#issuecomment-1529776586, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGDTODLWVOQKD5D7KLBPQXLXD7CE5ANCNFSM6AAAAAAXR2GTBY. You are receiving this because you were assigned.Message ID: @.***>

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.

DTMilodowski commented 1 year ago

Ah, good @ebukanwobi has already got this sorted RE: mortality/growth.

ebukanwobi commented 1 year ago

@lsmallma wrote the initial codes for assimilating RAINFOR wood growth and mortality. Since then I have edited that code to work on biomass as well. I'll probably need to update main_dev_branch at some point. Happy to chat about it @DTMilodowski

DTMilodowski commented 1 year ago

@ebukanwobi and I discussing offline, but the data constraints are slightly different for mortality/growth fluxes in our two use cases, so we may end up with two ways of assimilating growth/mortality depending on how the data are collected/presented by data providers

DTMilodowski commented 1 year ago

on closer inspection of the code, I think the approaches for growth/mortality are more or less the same to the one in my head for litter, so I'll make the litter call similar. Currently litter flux is going into observation slots 43-45 (mean, uncertainty, lag).

DTMilodowski commented 1 year ago

In my own dev branch, I've added the following for leaf litter in the likelihood function, with the necessary edits elsewhere to make sure everything defined and read in ok.

    ! Leaf litter log-likelihood
     if (DATAin%nfoliage_to_litter > 0) then
        tot_exp = 0d0
        do n = 1, DATAin%nfoliage_to_litter
          dn = DATAin%foliage_to_litterpts(n)
          s = max(0,dn-nint(DATAin%foliage_to_litter_lag(dn)))+1
          ! Estimate the mean allocation to wood over the lag period
          tmp_var = sum(DATAin%M_FLUXES(s:dn,10)) / DATAin%foliage_to_litter_lag(dn)
          tot_exp = tot_exp+((tmp_var-DATAin%foliage_to_litter(dn)) / DATAin%foliage_to_litter_unc(dn))**2
        end do
        likelihood = likelihood-tot_exp
     endif

So, following the growth/mortality method directly - application of mean and uncertainty over a defined lag (i.e. the time period preceding the observation). This works nicely for dealing with foliage-to-litter fluxes estimated through litter trap collection, which are often taken at irregular intervals.

The observation slots in the R framework are items 43-45 (mean, uncertainty,lag-in-timesteps)

lsmallma commented 1 year ago

Looks good David!

On 03/05/2023 10:53, David Milodowski wrote: This email was sent to you by someone outside the University. You should only click on links or attachments if you are certain that the email is genuine and the content is safe.

In my own dev branch, I've added the following for leaf litter in the likelihood function, with the necessary edits elsewhere to make sure everything defined and read in ok.

! Leaf litter log-likelihood
 if (DATAin%nfoliage_to_litter > 0) then
    tot_exp = 0d0
    do n = 1, DATAin%nfoliage_to_litter
      dn = DATAin%foliage_to_litterpts(n)
      s = max(0,dn-nint(DATAin%foliage_to_litter_lag(dn)))+1
      ! Estimate the mean allocation to wood over the lag period
      tmp_var = sum(DATAin%M_FLUXES(s:dn,10)) / DATAin%foliage_to_litter_lag(dn)
      tot_exp = tot_exp+((tmp_var-DATAin%foliage_to_litter(dn)) / DATAin%foliage_to_litter_unc(dn))**2
    end do
    likelihood = likelihood-tot_exp
 endif

So, following the growth/mortality method directly - application of mean and uncertainty over a defined lag (i.e. the time period preceding the observation). This works nicely for dealing with foliage-to-litter fluxes estimated through litter trap collection, which are often taken at irregular intervals.

The observation slots in the R framework are items 43-45 (mean, uncertainty,lag-in-timesteps)

— Reply to this email directly, view it on GitHubhttps://github.com/GCEL/CARDAMOM/issues/31#issuecomment-1532748073, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGDTODLNKS6DJVF23QI5URTXEITKXANCNFSM6AAAAAAXR2GTBY. You are receiving this because you were mentioned.Message ID: @.***>

-- Dr T. Luke Smallman Research Fellow (NCEO - National Capability)

School of GeoSciences Crew Building University of Edinburgh EH9 3JN, UK Edinburgh

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.

DTMilodowski commented 1 year ago

Now just waiting for CARDAMOM to work it's magic...

lsmallma commented 1 year ago

If this is on the new branch I've found a couple bugs and corrected. The important one is in cardamom_io.f90 at the end of the cardamom_library function. There is an extra stop command you should remove / comment out.

On 03/05/2023 11:12, David Milodowski wrote: This email was sent to you by someone outside the University. You should only click on links or attachments if you are certain that the email is genuine and the content is safe.

Now just waiting for CARDAMOM to work it's magic...

— Reply to this email directly, view it on GitHubhttps://github.com/GCEL/CARDAMOM/issues/31#issuecomment-1532771344, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGDTODJNUYG7N4LDYXQZWGTXEIVQFANCNFSM6AAAAAAXR2GTBY. You are receiving this because you were mentioned.Message ID: @.***>

-- Dr T. Luke Smallman Research Fellow (NCEO - National Capability)

School of GeoSciences Crew Building University of Edinburgh EH9 3JN, UK Edinburgh

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.

DTMilodowski commented 1 year ago

Hi Luke,

Thanks - I'd also discovered this one in the cardamom_io.f90 file, but hadn't updated the online version. What was the other bug?

On Wed, May 3, 2023 at 11:44 AM Luke Smallman @.***> wrote:

If this is on the new branch I've found a couple bugs and corrected. The important one is in cardamom_io.f90 at the end of the cardamom_library function. There is an extra stop command you should remove / comment out.

On 03/05/2023 11:12, David Milodowski wrote: This email was sent to you by someone outside the University. You should only click on links or attachments if you are certain that the email is genuine and the content is safe.

Now just waiting for CARDAMOM to work it's magic...

— Reply to this email directly, view it on GitHub< https://github.com/GCEL/CARDAMOM/issues/31#issuecomment-1532771344>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AGDTODJNUYG7N4LDYXQZWGTXEIVQFANCNFSM6AAAAAAXR2GTBY

. You are receiving this because you were mentioned.Message ID: @.***>

-- Dr T. Luke Smallman Research Fellow (NCEO - National Capability)

School of GeoSciences Crew Building University of Edinburgh EH9 3JN, UK Edinburgh

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.

— Reply to this email directly, view it on GitHub https://github.com/GCEL/CARDAMOM/issues/31#issuecomment-1532813853, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2QASGI6YNSY6FTGYRZOQLXEIZKFANCNFSM6AAAAAAXR2GTBY . You are receiving this because you modified the open/close state.Message ID: @.***>

lsmallma commented 1 year ago

related to new datasets I've included so shouldn't be a stopper for your current analysis.

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: David Milodowski @.> Sent: Wednesday, May 3, 2023 12:20:57 PM To: GCEL/CARDAMOM @.> Cc: Luke Smallman @.>; Mention @.> Subject: Re: [GCEL/CARDAMOM] Assimilating leaf litter collection data (Issue #31)

This email was sent to you by someone outside the University. You should only click on links or attachments if you are certain that the email is genuine and the content is safe.

Hi Luke,

Thanks - I'd also discovered this one in the cardamom_io.f90 file, but hadn't updated the online version. What was the other bug?

On Wed, May 3, 2023 at 11:44 AM Luke Smallman @.***> wrote:

If this is on the new branch I've found a couple bugs and corrected. The important one is in cardamom_io.f90 at the end of the cardamom_library function. There is an extra stop command you should remove / comment out.

On 03/05/2023 11:12, David Milodowski wrote: This email was sent to you by someone outside the University. You should only click on links or attachments if you are certain that the email is genuine and the content is safe.

Now just waiting for CARDAMOM to work it's magic...

— Reply to this email directly, view it on GitHub< https://github.com/GCEL/CARDAMOM/issues/31#issuecomment-1532771344>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AGDTODJNUYG7N4LDYXQZWGTXEIVQFANCNFSM6AAAAAAXR2GTBY

. You are receiving this because you were mentioned.Message ID: @.***>

-- Dr T. Luke Smallman Research Fellow (NCEO - National Capability)

School of GeoSciences Crew Building University of Edinburgh EH9 3JN, UK Edinburgh

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.

— Reply to this email directly, view it on GitHub https://github.com/GCEL/CARDAMOM/issues/31#issuecomment-1532813853, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2QASGI6YNSY6FTGYRZOQLXEIZKFANCNFSM6AAAAAAXR2GTBY . You are receiving this because you modified the open/close state.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://github.com/GCEL/CARDAMOM/issues/31#issuecomment-1532858421, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGDTODLDOGYFFXCTEN2UMEDXEI5RTANCNFSM6AAAAAAXR2GTBY. You are receiving this because you were mentioned.Message ID: @.***>