Vizzuality / mangrove-atlas

Global Mangrove Watch
https://globalmangrovewatch.org
MIT License
10 stars 6 forks source link

Update Mangrove net change to GMW version 3.14 #421

Closed lhilarides closed 2 years ago

lhilarides commented 2 years ago
  1. Update the layer with GMW v3.14 change features between all the years
  2. From the widget: remove the gross gain/loss numbers so that only the net change remains (the black line in the graph)
dhakelila commented 2 years ago

@aagm , as Lammert was asking in his email, could you assess which is the best format for us to upload the new data?

Original message:

Hi Clara, Alicia,

We have a final version of the GMW version 3 (paper to be submitted this week). I wanted to check with you how best to deliver the data to you. We have geopackage (vector) and geotiff (raster) but can change this to any format. If it has to be a format an like xyz tiles directory, please let us know the exact color scheme and zoom levels to create.

I'll create two issues labeled "data" for this on GitHub (one for the extent and one for the net change layer)

All the best!

aagm commented 2 years ago

Hi Lammert, Currently these layers are being ingested in GEE as GeoTIFF from the cloud storage account, and after being reviewed and validated we are generating the tiles that are being stored in a specific cloud storage bucket. That generation is a GEE script that I can share with you. Let me know If this is enough info and if you require the GEE script we use

dhakelila commented 2 years ago

@lhilarides, follow the conversation so Alicia can provide the information asap.

I understand this task is only about the Net Change map layer, and therefore, it's complementary to the "widgets recalculation" task that I created.

lhilarides commented 2 years ago

It seems we were waiting for each other... Here's all the download links:

v3.14 vector (geopackage) https://www.dropbox.com/s/g8n05ll44cy2od1/gmw_v3_fnl_mjr_v314.gpkg.gz?dl=0

v3.14 rasters (geotiff) https://www.dropbox.com/sh/vm8498yhcqd7mt8/AABn_Lhlsjjcy1WBFSrjlyEBa/gmw_v3_extent/gtiff?dl=0&subfolder_nav_tracking=1

dhakelila commented 2 years ago

@aagm Please, let us know if this is ok for us to ingest the Extent data.

lhilarides commented 2 years ago

Hi @aagm @dhakelila , the GMW v3.14 geotiffs have been uploaded to the Google Cloud Bucket in this folder: mangrove_atlas/GMW v3.14 geotiffs

dhakelila commented 2 years ago

@lhilarides , @klongleywood I've been discussing with Alicia and there is no way to get this data up before Tuesday.

There are two ways to get it done.

If we can use the vector tiles, we can generate the layer relatively quickly. If everything goes fine and we get no errors, we could be done by next Thursday.

If we need to use the rasters, the process is much slower due to computation time and we don't think it will be done before the week of the 2nd of August.

Anyway, the data you sent, Lammert, is the data we'll use to generate the map layer but we still miss the statistics for the widgets. We do have the ones for the new WDPA but we miss the rest of the locations.

When can you provide those?

lhilarides commented 2 years ago

This file has the Mangrove extents (hectares) for the countries:

gmw_v314-CORR_FAO-regions_stats_220615.xlsx

I'm fine if you use the vector file if that's somehow faster, but the last time you tried using vectors Ed had to simplify the geometries and the resulting layers looked terrible. This was the reason for switching to rasters.

dhakelila commented 2 years ago

Thanks @lhilarides we’ll upload everything asap.

Alicia will consider what to do taking into account your comments. I’ll keep you posted.

aagm commented 2 years ago

So below you will find an example of how it will look like (data wise) in a global and a more local view using the vector tile generation Pipe.

DeepinScreenshot_select-area_20220726194651 DeepinScreenshot_select-area_20220726194417 DeepinScreenshot_select-area_20220726194345

If you gave us green light with this we will put it in staging tomorrow morning. I can also further tweak it based on different zoom levels

aagm commented 2 years ago

One little detail. Raster data is separated by year, but the vectorial one is not. This will also affect the visualization if we want to link the year with the visual on the map.

dhakelila commented 2 years ago

This is mostly completed. Widgets were updated with new data. We are now generating the new layers and calculating the Extend for Worldwide.

klongleywood commented 2 years ago

@dhakelila there is a bug with how the widget states the net change -- in many cases, it reports the change as a negative number. For example, the Worldwide statistic is "The extent of mangroves in the world has decreased by -524,524 ha between 1996 and 2020". The number should just be 524,524 (no negative). I noticed this for several countries as well.

I'm also noticing that the number reported as net change isn't aligning with what the graph is showing. For example, the net change is -524,524, but on the graph, it appears to be hitting the ya axis between 0 and -90,000. Why would that be?

dhakelila commented 2 years ago

@aagm ^^^

klongleywood commented 2 years ago

@lhilarides @dhakelila I know we had decided to remove the red/green bars from the Net Change widget's graph, but don't we still need to show that these colors represent gain/loss for so we have a legend for the map? In staging these are not present. Also, the gain/loss map is very fuzzy when zoomed in. Is there a reason for this?

Fuzzy gain and loss

klongleywood commented 2 years ago

@lhilarides @dhakelila noting we also need to update the info button text to reflect the insertion of 2020 data.

dhakelila commented 2 years ago

@klongleywood , @lhilarides numbers updated.

Please, track separately the widgets where we need info button updates.

lhilarides commented 2 years ago

@klongleywood : we decided to bring back the red/green colors in the widget to serve as a kind of legend. Let's stick with this for now and think about improvements for the future.

@dhakelila I don't see any map layer in the staging environment

image

dhakelila commented 2 years ago

🤔 I can see the layer on staging. Maybe you are too close? There is a bug that we are fixing that makes the layers disappear after zoom 12. ![Uploading Screenshot 2022-09-14 at 09.26.16.png…]()

dhakelila commented 2 years ago

Screenshot 2022-09-16 at 12 30 33

The layer should behave properly now. If you go beyond zoom level 12, it will become blurry as those zoom levels are not generated.

lhilarides commented 2 years ago

The map is no longer interactive when selecting different years. The layer always displays the exact same gain/loss irrespective of the years chosen in the widget

dhakelila commented 2 years ago

Let us review it. It might be an issue with the loading time. Alicia confirmed that the interactivity is there. We are requesting all the layers for all the years selected, so until it gets render, you might have the impression it's not working.

klongleywood commented 2 years ago

@dhakelila fyi @lhilarides

The net change widget is still behaving very strangely. In the habitat extent widget, for example, I can use the tool to see that in 2016 the habitat extent was 147,069 km2 and the in 2020, the habitat extent is 147,358. So the net change between those two years is 289. But if I go to the mangrove net change widget, and I put in the bounding years for 2016 and 2020, it shows a net change of 5,548. Similarly, if I use the extent, it shows a decrease in extent between 2010 and 2020, but the change widget reports an increase.

Why would that be?

klongleywood commented 2 years ago

@dhakelila @lhilarides

image

Adding on to that, if the net change is positive between 2010 and 2020, why would the graph show a lower value in 2020 than in 2010?

dhakelila commented 2 years ago

@klongleywood , Alicia is looking into this.

dhakelila commented 2 years ago

@klongleywood shall we hide this widget while we figure out what is going on?

And second question: What figure would you expect to see in the net change text if I select 2016-2020? 289 Km2?

klongleywood commented 2 years ago

@dhakelila Yes, I think we should hide it for now since it's not providing correct information. And that's correct, I would expect to see the difference in area between the 2016 and the 2020 extent, so 289.

dhakelila commented 2 years ago

Let's see if we can get a clear idea of what that chart should show. Because I think that line was always of, but only when we are looking at it separately we realise it doesn't explain what we want.

The number should show the difference between the years selected. So, for instance: 2010: 148,020.29 km² 2018: 147,554.26 km² Diff: 466.03 (loss) --> This is what we should show on the sentece.

On the chart:

For instance, between 2010 and 2018 2010: 0 2015: 2010 cumulative change + (2015 Extent - 2010 Extent) = 0 + 675.6 km² = -675.6 km² 2016: -675.6 km² + (147,069.64 km² - 147,344.69 km²) = -675.6 km² + (-275.05 km²) = -950.65 km² 2017: -950.65 km² + (147,260.30 km² - 147,069.64 km²) = -950.65 km² + 190.66km² = -759.99 km² 2018: -759.99 km² + (147,554.26 km² - 147,260.30 km²) = -759.99 km² + 293.96 km² = -466.03 km²

klongleywood commented 2 years ago

That sounds right to me – thanks Clara!

From: Clara Linos @.> Sent: Thursday, September 22, 2022 8:36 AM To: Vizzuality/mangrove-atlas @.> Cc: Kate Longley-Wood @.>; Mention @.> Subject: Re: [Vizzuality/mangrove-atlas] Update Mangrove net change to GMW version 3.14 (Issue #421)

Let's see if we can get a clear idea of what that chart should show. Because I think that line was always of, but only when we are looking at it separately we realise it doesn't explain what we want.

The number should show the difference between the years selected. So, for instance: 2010: 148,020.29 km² 2018: 147,554.26 km² Diff: 466.03 (loss) --> This is what we should show on the sentece.

On the chart:

For instance, between 2010 and 2018 2010: 0 2015: 2010 cumulative change + (2015 Extent - 2010 Extent) = 0 + 675.6 km² = -675.6 km² 2016: -675.6 km² + (147,069.64 km² - 147,344.69 km²) = -675.6 km² + (-275.05 km²) = -950.65 km² 2017: -950.65 km² + (147,260.30 km² - 147,069.64 km²) = -950.65 km² + 190.66km² = -759.99 km² 2018: -759.99 km² + (147,554.26 km² - 147,260.30 km²) = -759.99 km² + 293.96 km² = -466.03 km²

— Reply to this email directly, view it on GitHubhttps://github.com/Vizzuality/mangrove-atlas/issues/421#issuecomment-1254961529, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM42HCEA4QBKJ3AUPEOKAWTV7RHBXANCNFSM52XRSUBA. You are receiving this because you were mentioned.Message ID: @.**@.>>

klongleywood commented 2 years ago

That sounds right to me!

mluena commented 2 years ago

@klongleywood, @lhilarides net change widget has been brought back to staging with the new calculations. Let me know if you are happy with the result so I can push to production

klongleywood commented 2 years ago

thanks @dhakelila -- this is now behaving as expected! @lhilarides do you want to do a quick test before it's pushed to prod?

lhilarides commented 2 years ago

I can confirm the numbers in the widget are now correct, so let's push it to production @dhakelila

However, the layers that are shown are almost, but not entirely correct.

  1. The gains/loss layer on the map shown between different years don't always make sense. E.g. the changes shown from 2010 - 2015 should not also show up when selecting 2015 - 2020
  2. It is now possible to select the same start and end year (both 2019 for example), this should not be possible
dhakelila commented 2 years ago

Updated in production. Please, @lhilarides , check.