forc-db / IPCC-EFDB-integration

Creative Commons Attribution 4.0 International
4 stars 3 forks source link

figure out what's happening with past last use & land classification #29

Closed teixeirak closed 1 year ago

teixeirak commented 2 years ago

@ValentineHerr , I'm not sure if we're consistently getting the past land use & land classification right. This is based on these instructions.

Here's an example (Feldpausch_2004_cana) where the disturbance history for all was the following sequence:

image

All have distmrs.type = grazed in plots.

So, they should all be classified as pasture converted to forest (5-FL-2 and 3.B.1.b.ii), yet 3 get classified as forest remaining forest (F-FL-2 and 3.B.1.a):

image

This

teixeirak commented 2 years ago

This also relates to issue #7, and I'll post something there.

teixeirak commented 2 years ago

For Manlay_2002_cnap (2nd batch), land categories did not get classified:

image
teixeirak commented 2 years ago

These two examples are technically wrong-- higher priority to solve this issue.

teixeirak commented 2 years ago

For Manlay_2002_cnap (2nd batch), land categories did not get classified: image

Same goes for n_11_Manlay_2002_cnap (pending review)

ValentineHerr commented 2 years ago

I am noting here that my code is looking at this table so this is one entry point for fixing issue. I have not looked at the file yet. Still trying to grasp what you wrote in the different issues

ValentineHerr commented 2 years ago

recapping the steps in the code here:

### Define current_LU
ForC_simplified$current_LU <- ""
ForC_simplified$current_LU [ForC_simplified$dominant.life.form %in% "woody"] <- "Forest"
ForC_simplified$current_LU [ForC_simplified$dominant.life.form %in% "woody+grass"] <- "Forest, Grassland"
ForC_simplified$current_LU [ForC_simplified$dominant.life.form %in% "grass" & !my_is.na(ForC_simplified$stand.age) & ForC_simplified$stand.age > 0] <- "Forest" # ("Land Converted to Forest Land (LF)")'
ForC_simplified$current_LU [ForC_simplified$dominant.life.form %in% "grass" & !my_is.na(ForC_simplified$stand.age) & ForC_simplified$stand.age == 0] <- "Grassland"
ForC_simplified$current_LU [ForC_simplified$dominant.life.form %in% "crop"  & !my_is.na(ForC_simplified$stand.age) & ForC_simplified$stand.age == 0] <- "Cropland"

unique(ForC_simplified$dominant.life.form)
unique(ForC_simplified$current_LU) # should be no ""
unique(ForC_simplified[ForC_simplified$current_LU %in% "", c("dominant.life.form", "stand.age", "current_LU")]) # should be empty

already an issue here as I do have cases that did not map... I think because they are woody + grass instead of woody+grass --> inconsistancy in ForC --> fix in ForC

teixeirak commented 2 years ago

I am noting here that my code is looking at this table so this is one entry point for fixing issue. I have not looked at the file yet. Still trying to grasp what you wrote in the different issues

I don't think there's a problem in this table...

ValentineHerr commented 2 years ago

For past LU, I also have cases that don't map...

image Two last columns are min stand age and max stand age, for all sites for which it didn't map.

I'll have to return to this tomorrow

For info, here is the code.

### Define past_LU
ForC_simplified$past_LU <- ""

#### stand.age ≥ 20 or missing value for stand.ag --> past_LU = current_LU

ForC_simplified$past_LU[my_is.na(ForC_simplified$stand.age) | ForC_simplified$stand.age >=20] <- ForC_simplified$current_LU[my_is.na(ForC_simplified$stand.age) | ForC_simplified$stand.age >=20] 

#### stand.age < 20 --> PAST LAND-USE is dependent on distmrs.type
unique(ForC_simplified$distmrs.type)

ForC_simplified$past_LU[(!my_is.na(ForC_simplified$stand.age) & ForC_simplified$stand.age <20) & ForC_simplified$distmrs.type %in% "Grazed"] <- "Grassland"
ForC_simplified$past_LU[(!my_is.na(ForC_simplified$stand.age) & ForC_simplified$stand.age <20) & ForC_simplified$distmrs.type %in% c("Cultivation", "Shifting cultivation", "Tillage")] <- "Cropland"
ForC_simplified$past_LU[(!my_is.na(ForC_simplified$stand.age) & ForC_simplified$stand.age <20) & ForC_simplified$distmrs.type %in% c("Agriculture_generic")] <- "Cropland or Grassland"
ForC_simplified$past_LU[(!my_is.na(ForC_simplified$stand.age) & ForC_simplified$stand.age <20) & ForC_simplified$distmrs.type %in% c("No disturbance", "No severe disturbance", "Flood", "Forest dieback", "Landslide","Major Storm")] <- ForC_simplified$current_LU[(!my_is.na(ForC_simplified$stand.age) & ForC_simplified$stand.age <20) & ForC_simplified$distmrs.type %in% c("No disturbance", "No severe disturbance", "Flood", "Forest dieback", "Landslide","Major Storm")]
ForC_simplified$past_LU[(!my_is.na(ForC_simplified$stand.age) & ForC_simplified$stand.age <20) & ForC_simplified$distmrs.type %in% c("Cut", "Harvest")] <- ForC_simplified$current_LU[(!my_is.na(ForC_simplified$stand.age) & ForC_simplified$stand.age <20) & ForC_simplified$distmrs.type %in% c("Cut", "Harvest")]

ForC_simplified$past_LU[(!my_is.na(ForC_simplified$stand.age) & ForC_simplified$stand.age <20) & ForC_simplified$distmrs.type %in% c("Burned", "StandClearing") | my_is.na( ForC_simplified$distmrs.type)] <- ""

unique(ForC_simplified$past_LU)
sum(ForC_simplified$past_LU[(!my_is.na(ForC_simplified$stand.age) & ForC_simplified$stand.age <20)]%in%"")
unique(ForC_simplified[ForC_simplified$past_LU %in% "", c("distmrs.type", "stand.age", "past_LU")]) # should be empty
ValentineHerr commented 2 years ago

I think this should be fixed but I'll let you double check and close @teixeirak

teixeirak commented 2 years ago

Hmmm... For Manlay we now get this:

image

The one that did get classified is age 26; the rest are younger. So I think we're missing savanna < 20 yrs

ValentineHerr commented 1 year ago

This must have been fixed, right @teixeirak? I don't see the record, but Manley has been sent, and there was no NA in columns X2006.Source.Sink.Categories..CODE1..... and X2006.Source.Sink.Categories..CODE1.....

Unless the data with NA was dropped....

ValentineHerr commented 1 year ago

I also see that we "canceled" a Manlay that had 17 data points with NA. WE eventually sent 28 data points with no NA

teixeirak commented 1 year ago

Yes, I think this is fixed.