dea-tools 0.3.7.dev3__tar.gz → 0.3.7.dev4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. {dea_tools-0.3.7.dev3/dea_tools.egg-info → dea_tools-0.3.7.dev4}/PKG-INFO +1 -1
  2. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/landcover.py +57 -32
  3. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4/dea_tools.egg-info}/PKG-INFO +1 -1
  4. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/.gitignore +0 -0
  5. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/LICENSE +0 -0
  6. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/MANIFEST.in +0 -0
  7. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/README.rst +0 -0
  8. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/__init__.py +0 -0
  9. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/__main__.py +0 -0
  10. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/app/__init__.py +0 -0
  11. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/app/animations.py +0 -0
  12. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/app/changefilmstrips.py +0 -0
  13. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/app/crophealth.py +0 -0
  14. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/app/deacoastlines.py +0 -0
  15. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/app/geomedian.py +0 -0
  16. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/app/imageexport.py +0 -0
  17. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/app/miningrehab.py +0 -0
  18. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/app/wetlandsinsighttool.py +0 -0
  19. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/app/widgetconstructors.py +0 -0
  20. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/bandindices.py +0 -0
  21. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/bom.py +0 -0
  22. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/classification.py +0 -0
  23. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/coastal.py +0 -0
  24. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/dask.py +0 -0
  25. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/datahandling.py +0 -0
  26. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/maps.py +0 -0
  27. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/plotting.py +0 -0
  28. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/pyfes_model.py +0 -0
  29. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/spatial.py +0 -0
  30. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/temporal.py +0 -0
  31. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/validation.py +0 -0
  32. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/waterbodies.py +0 -0
  33. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/wetlands.py +0 -0
  34. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools/wit_app.py +0 -0
  35. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools.egg-info/SOURCES.txt +0 -0
  36. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools.egg-info/dependency_links.txt +0 -0
  37. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools.egg-info/requires.txt +0 -0
  38. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/dea_tools.egg-info/top_level.txt +0 -0
  39. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/index.rst +0 -0
  40. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/mock_imports.txt +0 -0
  41. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/pyproject.toml +0 -0
  42. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/setup.cfg +0 -0
  43. {dea_tools-0.3.7.dev3 → dea_tools-0.3.7.dev4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dea-tools
3
- Version: 0.3.7.dev3
3
+ Version: 0.3.7.dev4
4
4
  Summary: Functions and algorithms for analysing Digital Earth Australia data.
5
5
  Home-page: https://github.com/GeoscienceAustralia/dea-notebooks
6
6
  Author: Geoscience Australia
@@ -17,13 +17,11 @@ here: https://gis.stackexchange.com/questions/tagged/open-data-cube).
17
17
  If you would like to report an issue with this script, you can file one
18
18
  on GitHub (https://github.com/GeoscienceAustralia/dea-notebooks/issues/new).
19
19
 
20
- Last modified: March 2025
20
+ Last modified: May 2025
21
21
  """
22
22
 
23
23
  import numpy as np
24
24
  import pandas as pd
25
- # import ast
26
- # import sys
27
25
 
28
26
  from IPython.display import Image
29
27
 
@@ -442,19 +440,21 @@ aliases = {
442
440
 
443
441
  def get_label(lc_value, level, lc_dictionary=lc_colours):
444
442
  """
445
- returns the name of the LC class given it's value
443
+ Returns the name of the Land Cover class given its value.
446
444
 
447
445
  Parameters
448
- -----------
446
+ ---------
449
447
  lc_value : int
450
- value of a landcover class
448
+ Value of a landcover class.
451
449
  level : str
452
- either 'level3' or 'level4'
453
- lc_dictionary : dict
454
- dictionary with colour scheme
455
-
450
+ Either 'level3' or 'level4'.
451
+ lc_dictionary : dict, optional
452
+ A dictionary specifying color schemes.
453
+ Defaults to a nested dictionary with keys `level3` and `level4`,
454
+ each mapping to their respective sub-dictionaries.
455
+
456
456
  Returns
457
- ----------
457
+ ---------
458
458
  a string indicating the name of the land cover class
459
459
  """
460
460
 
@@ -492,7 +492,7 @@ def _descriptors_colours(lc_colours, lc_colours_mapping, descriptor):
492
492
  and the values are the corresponding colours and labels from the descriptor mapping.
493
493
 
494
494
  Parameters
495
- ----------
495
+ ---------
496
496
  lc_colours : dict
497
497
  Dictionary containing colour schemes for all Land Cover classes,
498
498
  including Level 4 scheme (needed in this function).
@@ -504,7 +504,7 @@ def _descriptors_colours(lc_colours, lc_colours_mapping, descriptor):
504
504
  The descriptor to be used for mapping colours.
505
505
 
506
506
  Returns
507
- -------
507
+ ---------
508
508
  sorted_colours_dict : dict
509
509
  Sorted dictionary with class values as keys and colour tuples as values.
510
510
  """
@@ -545,7 +545,25 @@ def _descriptors_colours(lc_colours, lc_colours_mapping, descriptor):
545
545
 
546
546
  def get_colour_scheme(measurement):
547
547
  """
548
- Gets colour scheme dictionary given the measurement of interest
548
+ Retrieves a colour scheme dictionary for a specified measurement.
549
+
550
+ This function determines the appropriate colour scheme based on a given
551
+ measurement name. If the measurement refers to a descriptor,
552
+ the colour scheme is built from the descriptor definitions.
553
+ Otherwise, a standard predefined colour scheme is returned.
554
+
555
+ Parameters
556
+ ---------
557
+ measurement : str
558
+ The name of the measurement or descriptor for which the colour
559
+ scheme is requested. Must match a key in `lc_colours`,
560
+ `lc_colours_mapping`, or `aliases`.
561
+
562
+ Returns
563
+ ---------
564
+ colour_scheme : dict
565
+ Dictionary containing the colour scheme associated with the
566
+ specified measurement or descriptor.
549
567
  """
550
568
 
551
569
  # ensure a valid colour scheme was requested
@@ -599,7 +617,7 @@ def _reduce_colour_scheme(colour_scheme):
599
617
 
600
618
  def lc_colourmap(colour_scheme):
601
619
  """
602
- Takes a colour scheme dictionary and returns colormap for matplotlib
620
+ Takes a colour scheme dictionary and returns colormap for matplotlib.
603
621
 
604
622
  Returns
605
623
  ---------
@@ -635,7 +653,7 @@ def lc_colourmap(colour_scheme):
635
653
 
636
654
  def _legend_colourmap(colour_scheme):
637
655
  """
638
- Returns colour map and normalisation specifcially for the colourbar
656
+ Returns colour map and normalisation specifically for the colourbar
639
657
  of the provided DEA Land Cover measurement, for use in plotting with Matplotlib library
640
658
 
641
659
  Parameters
@@ -679,9 +697,9 @@ def make_colourbar(fig,
679
697
  labelsize=10,
680
698
  horizontal=False,
681
699
  animation=False
682
- ): # in practice, horizontal arg in never used, currently
700
+ ):
683
701
  """
684
- Adds a new colorbar with appropriate land cover colours and labels.
702
+ Adds a new colourbar with appropriate Land Cover colours and labels.
685
703
 
686
704
  For DEA Land Cover Level 4 data, this function must be used with a double plot.
687
705
  The 'ax' should be on the left side of the figure, and the colour bar will added
@@ -694,13 +712,17 @@ def make_colourbar(fig,
694
712
  ax : matplotlib ax
695
713
  Matplotlib figure ax to add colorbar to.
696
714
  measurement : string
697
- name of layer or descriptor of interest
698
- labelsize : int
699
- size of labels of colourbar
715
+ Name of the layer or descriptor of interest.
716
+ labelsize : int, optional
717
+ Size of labels in the colourbar.
718
+ horizontal : bool, optional
719
+ If True, displays the colourbar horizontally; otherwise, uses vertical orientation.
720
+ animation : bool, optional
721
+ If True, adjusts layout and axis size for animation display.
700
722
 
701
723
  Returns
702
724
  ----------
703
- matplotlib colorbar in its own colour axis
725
+ Matplotlib colorbar in its own colour axis
704
726
  """
705
727
 
706
728
  if measurement == 'level4':
@@ -765,9 +787,11 @@ def plot_land_cover(
765
787
  Plot a single land cover measurement with appropriate colour scheme.
766
788
 
767
789
  Parameters
768
- ----------
790
+ ---------
769
791
  data : xarray.DataArray
770
792
  A dataArray containing a DEA Land Cover classification.
793
+ labelsize : int, optional
794
+ Font size for the labels on the colourbar.
771
795
  year : int, optional
772
796
  Can be used to select to plot a specific year. If not provided,
773
797
  all time slices are plotted.
@@ -781,11 +805,11 @@ def plot_land_cover(
781
805
  automatically based on the dimensions/ratio of the input
782
806
  xarray dataset. Defaults to 500 pixels wide.
783
807
  cols: integer, optional
784
- Sets number of columns if multiple time steps are visualised
808
+ Sets number of columns if multiple time steps are visualised.
785
809
 
786
810
  Returns
787
811
  ---------
788
- Matplotlib image
812
+ Matplotlib image.
789
813
 
790
814
  """
791
815
 
@@ -854,12 +878,12 @@ def _calc_class_ratio(da, measurement):
854
878
  Creates a table listing year by year what percentage of the
855
879
  total area is taken up by each class.
856
880
  Parameters
857
- ----------
881
+ ---------
858
882
  da : xarray.DataArray with time dimension
859
883
  measurement: string with name of descriptor/measurement
860
884
 
861
885
  Returns
862
- -------
886
+ ---------
863
887
  Pandas Dataframe : containing class percentages per year
864
888
  """
865
889
 
@@ -924,7 +948,7 @@ def lc_animation(
924
948
  animation to a file and displays the animation in notebook.
925
949
 
926
950
  Parameters
927
- ----------
951
+ ---------
928
952
  da : xarray.DataArray
929
953
  An xarray.DataArray containing a multi-date stack of
930
954
  observations of a single landcover level.
@@ -939,7 +963,7 @@ def lc_animation(
939
963
  Determines if a stacked plot showing the percentage of area
940
964
  taken up by each class in each time slice is added to the
941
965
  animation. Default: False.
942
- colour_bar : boolean, Optional
966
+ colour_bar : boolean, optional
943
967
  Determines if a colour bar is generated for the stand alone
944
968
  animation. This is NOT recommended for use with level 4 data.
945
969
  Does not work with stacked plot. Default: False.
@@ -956,20 +980,21 @@ def lc_animation(
956
980
  animation and determines the resolution. A higher number will
957
981
  produce a higher resolution image but a larger file size and
958
982
  slower processing. Default: 150.
959
- font_size : int, optional.
983
+ font_size : int, optional
960
984
  Controls the size of the text on the axes and colour bar. Default: 15.
961
985
  label_size : int, optional.
962
986
  Controls the size of the text which indicates the year
963
987
  displayed. Default: 15.
964
988
  label_ax : boolean, optional
965
989
  Determines if animation plot should have tick marks and numbers
966
- on axes. Also removes white space around plot. default: True
990
+ on axes. Also removes white space around plot. Default: True
967
991
 
968
992
 
969
993
  Returns
970
- -------
994
+ ---------
971
995
  A GIF (.gif) animation file.
972
996
  """
997
+
973
998
  # Add gif to end of filename
974
999
  file_name = file_name + ".gif"
975
1000
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dea-tools
3
- Version: 0.3.7.dev3
3
+ Version: 0.3.7.dev4
4
4
  Summary: Functions and algorithms for analysing Digital Earth Australia data.
5
5
  Home-page: https://github.com/GeoscienceAustralia/dea-notebooks
6
6
  Author: Geoscience Australia
File without changes
File without changes
File without changes
File without changes