geeViz.phEEnoViz¶
Visualize the spectral seasonality of an area to facilitate composting methods development
geeViz.phEEnoViz facilitates the creation of plots to show the seasonality of an area. This is a good tool for deciding what date ranges to use for compositing.
Functions
|
Plots time series histograms for each date in the given tables. |
|
Ensures that a directory exists, creating it if necessary. |
|
Converts a JSON GEE table into CSV files, one per band. |
|
Extracts a JSON table of zonal statistics from an image and exports it. |
|
Samples locations for a given area and exports time series data. |
|
Limits the number of active threads to a specified limit. |
- geeViz.phEEnoViz.check_dir(dir)[source]¶
Ensures that a directory exists, creating it if necessary.
- Parameters:
dir (str) – The directory path.
Example
>>> check_dir('/tmp/mydir')
- geeViz.phEEnoViz.limitThreads(limit)[source]¶
Limits the number of active threads to a specified limit.
- Parameters:
limit (int) – The maximum number of threads allowed.
Example
>>> limitThreads(2)
- geeViz.phEEnoViz.getTableWrapper(image, fc, outputName, reducer=<ee.reducer.Reducer object>, scale=30, crs='EPSG:4326', transform=None, tryNumber=1, maxTries=15)[source]¶
Extracts a JSON table of zonal statistics from an image and exports it.
- Parameters:
image (ee.Image) – The image to reduce.
fc (ee.FeatureCollection) – The feature collection for zonal stats.
outputName (str) – Output filename for the JSON table.
reducer (ee.Reducer, optional) – Reducer to use. Defaults to ee.Reducer.first().
scale (int, optional) – Scale in meters. Defaults to 30.
crs (str, optional) – Coordinate reference system. Defaults to “EPSG:4326”.
transform (optional) – Transform parameter. Defaults to None.
tryNumber (int, optional) – Current try number. Defaults to 1.
maxTries (int, optional) – Maximum number of tries. Defaults to 15.
Example
>>> getTableWrapper(image, fc, 'output.json')
- geeViz.phEEnoViz.getTimeSeriesSample(startYear, endYear, startJulian, endJulian, compositePeriod, exportBands, studyArea, nSamples, output_table_name, showGEEViz, maskSnow=False, programs=['Landsat', 'Sentinel2'])[source]¶
Samples locations for a given area and exports time series data.
- Parameters:
startYear (int) – Start year.
endYear (int) – End year.
startJulian (int) – Start Julian day.
endJulian (int) – End Julian day.
compositePeriod (int) – Composite period in days.
exportBands (list) – List of bands to export.
studyArea (ee.Geometry or ee.FeatureCollection) – Study area.
nSamples (int) – Number of samples.
output_table_name (str) – Output table name.
showGEEViz (bool) – Whether to show GEEViz visualization.
maskSnow (bool, optional) – Whether to mask snow. Defaults to False.
programs (list, optional) – List of programs. Defaults to [“Landsat”, “Sentinel2”].
Example
>>> getTimeSeriesSample(2019, 2020, 1, 365, 16, ['NDVI'], studyArea, 100, 'output.json', True)
- geeViz.phEEnoViz.convert_to_csv(output_table_name)[source]¶
Converts a JSON GEE table into CSV files, one per band.
- Parameters:
output_table_name (str) – Path to the JSON table.
Example
>>> convert_to_csv('output.json')
- geeViz.phEEnoViz.chartTimeSeriesDistributions(tables, output_dir, output_base_name, n_bins=40, min_pctl=0.05, max_pctl=99.95, background_color='#D6D1CA', font_color='#1B1716', overwrite=False, howManyHarmonics=3, showChart=False, annotate_harmonic_peaks=True)[source]¶
Plots time series histograms for each date in the given tables.
- Parameters:
tables (list) – List of CSV file paths.
output_dir (str) – Output directory for charts.
output_base_name (str) – Base name for output charts.
n_bins (int, optional) – Number of histogram bins. Defaults to 40.
min_pctl (float, optional) – Minimum percentile for value clipping. Defaults to 0.05.
max_pctl (float, optional) – Maximum percentile for value clipping. Defaults to 99.95.
background_color (str, optional) – Background color for plots. Defaults to “#D6D1CA”.
font_color (str, optional) – Font color for plots. Defaults to “#1B1716”.
overwrite (bool, optional) – Overwrite existing charts. Defaults to False.
howManyHarmonics (int, optional) – Number of harmonics for regression. Defaults to 3.
showChart (bool, optional) – Show chart interactively. Defaults to False.
annotate_harmonic_peaks (bool, optional) – Annotate harmonic peaks. Defaults to True.
Example
>>> chartTimeSeriesDistributions(['table_NDVI.csv'], './charts', 'study_NDVI')