Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plots #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Plots #3

wants to merge 3 commits into from

Conversation

thomasarsouze
Copy link
Collaborator

Add plots functions:

  • geefcc.plots.plot_fcc : plots fcc over 3 different time periods.
  • geefcc.plots.plot_fc_tmf_vs_gfc : plots forest cover differences between tmf and gfc for a given year.


:param input_fcc_raster: Path to fcc raster.
:param output_file: Name of the plot file.
:param source: Source of the forest cover data (tmf or gfc).
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 source information shouldn't be an argument of the function but rather read from the .tif file itself.

This has been added in the metadata of the .tif file at the creation of the tiles but this is somehow erased when creating the .vrt file that merges the tiles. I had a look at the documentation but couldn't find a way to keep to keep this information. Maybe you @ghislainv can find a solution, as you are much more experienced with gdal than me.

e.g. Réunion Island:

❯ gdalinfo out_tmf/forest_tiles/forest_1.tif
Driver: GTiff/GeoTIFF
Files: out_tmf/forest_tiles/forest_1.tif
Size is 1855, 1855
Coordinate System is:
...
Metadata:
  ForestCoverDataset=tmf
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=DEFLATE
  INTERLEAVE=PIXEL
...


❯ gdalinfo out_tmf/forest_tmf.tif
Driver: GTiff/GeoTIFF
Files: out_tmf/forest_tmf.tif
Size is 2305, 1923
Coordinate System is:
...
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=DEFLATE
  INTERLEAVE=PIXEL
...

:param output_file: Name of the plot file.
:param source: Source of the forest cover data (tmf or gfc).
:param maxpixels: Maximum number of pixels to plot.
:param years: List of years for the fcc in the raster.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same as for the source argument, the years argument should be read from the .tif file itself. However, although the time stamp is present in the metadata of the tiles .tif files, they are not in the .vrt or reconstructed .tif files.

❯ gdalinfo out_tmf/forest_tiles/forest_1.tif
Driver: GTiff/GeoTIFF
Files: out_tmf/forest_tiles/forest_1.tif
Size is 1855, 1855
Coordinate System is:
...
Band 1 Block=256x256 Type=Int8, ColorInterp=Gray
  Metadata:
    time=2000-01-01T00:00:00.000000000
    data_var=forest_cover
Band 2 Block=256x256 Type=Int8, ColorInterp=Undefined
  Metadata:
    time=2010-01-01T00:00:00.000000000
    data_var=forest_cover
Band 3 Block=256x256 Type=Int8, ColorInterp=Undefined
  Metadata:
    time=2020-01-01T00:00:00.000000000
    data_var=forest_cover


❯ gdalinfo out_tmf/forest_tmf.tif
Driver: GTiff/GeoTIFF
Files: out_tmf/forest_tmf.tif
Size is 2305, 1923
Coordinate System is:
...
Band 1 Block=2305x1 Type=Int8, ColorInterp=Gray
Band 2 Block=2305x1 Type=Int8, ColorInterp=Undefined
Band 3 Block=2305x1 Type=Int8, ColorInterp=Undefined

Copy link
Collaborator Author

@thomasarsouze thomasarsouze left a comment

Choose a reason for hiding this comment

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

@ghislainv : please test that branch : I have an issue I still can't explain with a shift from the dataset and shoreline / ocean / borders.

It definitely looks like a problem with projection, but I have not been able to solve it.

Copy link
Collaborator Author

@thomasarsouze thomasarsouze left a comment

Choose a reason for hiding this comment

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

I also included a notebook with dynamical plot : test_simple_dynamic_plot.ipynb at the source of the repo (this file isn't meant to last). It needs the hvplot to be install (via pip or conda) and it should also installed dependecies.

To me, this is promising : we can do a quick dynamic plot, including with rasterizing (i.e. adaptation of the data to the zoom layer). However, I spent (lost !) some time to try to figure out how to customize the colormap but hasn't been able to make it work.

Also, this needs to be tested on large datasets, idealy including larger that memory datasets (datashader should work transparently with dask).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant