Plots - #3
Conversation
|
|
||
| :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). |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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
thomasarsouze
left a comment
There was a problem hiding this comment.
@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.
thomasarsouze
left a comment
There was a problem hiding this comment.
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).
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.