Skip to content

ee_extract_tidy/ee_extract handling of masked/NA values #33

@zackarno

Description

@zackarno

When a feature lands on a masked image value that feature is omitted from the extracted output data.frame/sf object. This is usually not a significant problem - say I have 10 points and 2 land in masked areas - my output data.frame will have 8 records. Not a big deal, I probably don't want to include these 2 masked points in most subsequent analysis anyways, but if I do I can always figure it out as long as the records had uids of some sort. However, it becomes a problem if all of your points fall in a masked area: ee_extract_tidy throws a cryptic error triggered by tidyr::pivot_longer because there is nothing to pivot on.

I've thought of 2 options so far:
1.) set up a way to return NA values for masked features rather than omitting them - i think this would be advantageous. Would allow you to quickly calculate % of locations covered by cloud and get rid of the pivot error. I started writing this, but then realized the path i was following would end up being more work than expected especially in the case of multiple band extractions.... perhaps a simpler, better solution will come soon.
2.) put in a more informative warning (i.e "all feature fall in masked/NULL area so no data was extracted") - this might be a nice interim solution

As we can see the problem was flagged in the issue below and was not immediately obvious due to the cryptic message - either of the above would be an improvement i think

impact-initiatives-geospatial/11_IRQ_BHA_Dashoard#2

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions