diff --git a/examples/AAFC/AAFC_ACI.py b/examples/AAFC/AAFC_ACI.py new file mode 100644 index 000000000..610ef0fa9 --- /dev/null +++ b/examples/AAFC/AAFC_ACI.py @@ -0,0 +1,7 @@ +dataset = ee.ImageCollection('AAFC/ACI') +crop_2016 = dataset.filter(ee.Filter.date('2016-01-01', '2016-12-31')).first() + +m = geemap.Map() +m.set_center(-103.8881, 53.0372, 10) +m.add_layer(crop_2016, {}, '2016 Canada AAFC Annual Crop Inventory') +m diff --git a/examples/AHN/AHN_AHN2_05M_INT.py b/examples/AHN/AHN_AHN2_05M_INT.py new file mode 100644 index 000000000..3bebd12ec --- /dev/null +++ b/examples/AHN/AHN_AHN2_05M_INT.py @@ -0,0 +1,8 @@ +dataset = ee.Image('AHN/AHN2_05M_INT') +elevation = dataset.select('elevation') +elevation_vis = {'min': -5.0, 'max': 30.0} + +m = geemap.Map() +m.set_center(5.76583, 51.855276, 16) +m.add_layer(elevation, elevation_vis, 'Elevation') +m diff --git a/examples/ASTER/ASTER_AST_L1T_003.py b/examples/ASTER/ASTER_AST_L1T_003.py new file mode 100644 index 000000000..81a08b65e --- /dev/null +++ b/examples/ASTER/ASTER_AST_L1T_003.py @@ -0,0 +1,11 @@ +dataset = ee.ImageCollection('ASTER/AST_L1T_003').filter( + ee.Filter.date('2018-01-01', '2018-08-15') +) + +false_color = dataset.select(['B3N', 'B02', 'B01']) +false_color_vis = {'min': 0.0, 'max': 255.0} + +m = geemap.Map() +m.set_center(-122.0272, 39.6734, 11) +m.add_layer(false_color.median(), false_color_vis, 'False Color') +m diff --git a/examples/BIOPAMA/BIOPAMA_GlobalOilPalm_v1.py b/examples/BIOPAMA/BIOPAMA_GlobalOilPalm_v1.py new file mode 100644 index 000000000..62a3e8ef9 --- /dev/null +++ b/examples/BIOPAMA/BIOPAMA_GlobalOilPalm_v1.py @@ -0,0 +1,30 @@ +# Import the dataset a collection of composite granules from 2019. +dataset = ee.ImageCollection('BIOPAMA/GlobalOilPalm/v1') + +# Select the classification band. +op_class = dataset.select('classification') + +# Mosaic all of the granules into a single image. +mosaic = op_class.mosaic() + +# Define visualization parameters. +classification_vis = { + 'min': 1, + 'max': 3, + 'palette': ['ff0000', 'ef00ff', '696969'], +} + +# Create a mask to add transparency to non-oil palm plantation class pixels. +mask = mosaic.neq(3) +mask = mask.where(mask.eq(0), 0.6) + +# Display the data on the map. +m = geemap.Map() +m.add_layer( + mosaic.updateMask(mask), + classification_vis, + 'Oil palm plantation type', + True, +) +m.set_center(-3.0175, 5.2745, 12) +m diff --git a/examples/COPERNICUS/COPERNICUS_CORINE_V20_100m.py b/examples/COPERNICUS/COPERNICUS_CORINE_V20_100m.py new file mode 100644 index 000000000..12ad85ecd --- /dev/null +++ b/examples/COPERNICUS/COPERNICUS_CORINE_V20_100m.py @@ -0,0 +1,7 @@ +dataset = ee.Image('COPERNICUS/CORINE/V20/100m/2012') +land_cover = dataset.select('landcover') + +m = geemap.Map() +m.set_center(16.436, 39.825, 6) +m.add_layer(land_cover, {}, 'Land Cover') +m diff --git a/examples/COPERNICUS/COPERNICUS_DEM_GLO30.py b/examples/COPERNICUS/COPERNICUS_DEM_GLO30.py new file mode 100644 index 000000000..73b99db7e --- /dev/null +++ b/examples/COPERNICUS/COPERNICUS_DEM_GLO30.py @@ -0,0 +1,13 @@ +dataset = ee.ImageCollection('COPERNICUS/DEM/GLO30') +elevation = dataset.select('DEM') + +elevation_vis = { + 'min': 0.0, + 'max': 1000.0, + 'palette': ['0000ff', '00ffff', 'ffff00', 'ff0000', 'ffffff'], +} + +m = geemap.Map() +m.set_center(-6.746, 46.529, 4) +m.add_layer(elevation, elevation_vis, 'DEM') +m diff --git a/examples/COPERNICUS/COPERNICUS_S2.py b/examples/COPERNICUS/COPERNICUS_S2.py new file mode 100644 index 000000000..3412dcaa7 --- /dev/null +++ b/examples/COPERNICUS/COPERNICUS_S2.py @@ -0,0 +1,41 @@ +def mask_s2_clouds(image): + """Masks clouds using the Sentinel-2 QA band. + + Args: + image (ee.Image): Sentinel-2 image. + + Returns: + ee.Image: Cloud masked Sentinel-2 image. + """ + qa = image.select('QA60') + + # Bits 10 and 11 are clouds and cirrus, respectively. + cloud_bit_mask = 1 << 10 + cirrus_bit_mask = 1 << 11 + + # Both flags should be set to zero, indicating clear conditions. + mask = ( + qa.bitwiseAnd(cloud_bit_mask) + .eq(0) + .And(qa.bitwiseAnd(cirrus_bit_mask).eq(0)) + ) + + return image.updateMask(mask).divide(10000) + + +# Load Sentinel-2 TOA reflectance data. +dataset = ( + ee.ImageCollection('COPERNICUS/S2') + .filterDate('2018-01-01', '2018-01-31') + # Pre-filter to get less cloudy granules. + .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20)) + .map(mask_s2_clouds) +) + +rgb_vis = {'min': 0.0, 'max': 0.3, 'bands': ['B4', 'B3', 'B2']} + +# Create and display the map. +m = geemap.Map() +m.set_center(-9.1695, 38.6917, 12) +m.add_layer(dataset.median(), rgb_vis, 'RGB') +m diff --git a/examples/COPERNICUS/COPERNICUS_S2_CLOUD_PROBABILITY.py b/examples/COPERNICUS/COPERNICUS_S2_CLOUD_PROBABILITY.py new file mode 100644 index 000000000..848056f08 --- /dev/null +++ b/examples/COPERNICUS/COPERNICUS_S2_CLOUD_PROBABILITY.py @@ -0,0 +1,58 @@ +s2_sr = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED') +s2_clouds = ee.ImageCollection('COPERNICUS/S2_CLOUD_PROBABILITY') + +start_date = ee.Date('2019-01-01') +end_date = ee.Date('2019-03-01') +max_cloud_probability = 65 +region = ee.Geometry.Rectangle( + coords=[-76.5, 2.0, -74, 4.0], geodesic=False, proj='EPSG:4326' +) + + +def maskClouds(img): + clouds = ee.Image(img.get('cloud_mask')).select('probability') + is_not_cloud = clouds.lt(max_cloud_probability) + return img.updateMask(is_not_cloud) + + +# The masks for the 10m bands sometimes do not exclude bad data at +# scene edges, so we apply masks from the 20m and 60m bands as well. +# Example asset that needs this operation: +# COPERNICUS/S2_CLOUD_PROBABILITY/20190301T000239_20190301T000238_T55GDP +def maskEdges(s2_img): + return s2_img.updateMask( + s2_img.select('B8A').mask().updateMask(s2_img.select('B9').mask()) + ) + + +# Filter input collections by desired data range and region. +criteria = ee.Filter.And( + ee.Filter.bounds(region), ee.Filter.date(start_date, end_date) +) +s2_sr = s2_sr.filter(criteria).map(maskEdges) +s2_clouds = s2_clouds.filter(criteria) + +# Join S2 SR with cloud probability dataset to add cloud mask. +s2_sr_with_cloud_mask = ee.Join.saveFirst('cloud_mask').apply( + primary=s2_sr, + secondary=s2_clouds, + condition=ee.Filter.equals( + leftField='system:index', rightField='system:index' + ), +) + +s_2_cloud_masked = ( + ee.ImageCollection(s2_sr_with_cloud_mask).map(maskClouds).median() +) + +rgb_vis = {'min': 0, 'max': 3000, 'bands': ['B4', 'B3', 'B2']} + +m = geemap.Map() +m.set_center(-75, 3, 12) +m.add_layer( + s_2_cloud_masked, + rgb_vis, + 'S2 SR masked at ' + str(max_cloud_probability) + '%', + True, +) +m diff --git a/examples/COPERNICUS/COPERNICUS_S3_OLCI.py b/examples/COPERNICUS/COPERNICUS_S3_OLCI.py new file mode 100644 index 000000000..bdb6c015e --- /dev/null +++ b/examples/COPERNICUS/COPERNICUS_S3_OLCI.py @@ -0,0 +1,17 @@ +dataset = ee.ImageCollection('COPERNICUS/S3/OLCI').filterDate( + '2018-04-01', '2018-04-04' +) + +# Select bands for visualization and apply band-specific scale factors. +rgb = ( + dataset.select(['Oa08_radiance', 'Oa06_radiance', 'Oa04_radiance']) + .median() + .multiply(ee.Image([0.00876539, 0.0123538, 0.0115198])) +) # Convert to radiance units. + +vis_params = {'min': 0, 'max': 6, 'gamma': 1.5} + +m = geemap.Map() +m.set_center(46.043, 1.45, 5) +m.add_layer(rgb, vis_params, 'RGB') +m diff --git a/examples/COPERNICUS/COPERNICUS_S5P_NRTI_L3_NO2.py b/examples/COPERNICUS/COPERNICUS_S5P_NRTI_L3_NO2.py new file mode 100644 index 000000000..891a0e3a2 --- /dev/null +++ b/examples/COPERNICUS/COPERNICUS_S5P_NRTI_L3_NO2.py @@ -0,0 +1,16 @@ +collection = ( + ee.ImageCollection('COPERNICUS/S5P/NRTI/L3_NO2') + .select('NO2_column_number_density') + .filterDate('2019-06-01', '2019-06-06') +) + +band_viz = { + 'min': 0, + 'max': 0.0002, + 'palette': ['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red'], +} + +m = geemap.Map() +m.add_layer(collection.mean(), band_viz, 'S5P N02') +m.set_center(65.27, 24.11, 4) +m diff --git a/examples/COPERNICUS/COPERNICUS_S5P_OFFL_L3_AER_AI.py b/examples/COPERNICUS/COPERNICUS_S5P_OFFL_L3_AER_AI.py new file mode 100644 index 000000000..b893ccc31 --- /dev/null +++ b/examples/COPERNICUS/COPERNICUS_S5P_OFFL_L3_AER_AI.py @@ -0,0 +1,16 @@ +collection = ( + ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_AER_AI') + .select('absorbing_aerosol_index') + .filterDate('2019-06-01', '2019-06-06') +) + +band_viz = { + 'min': -1, + 'max': 2.0, + 'palette': ['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red'], +} + +m = geemap.Map() +m.add_layer(collection.mean(), band_viz, 'S5P Aerosol') +m.set_center(-118.82, 36.1, 5) +m diff --git a/examples/COPERNICUS/COPERNICUS_S5P_OFFL_L3_CH4.py b/examples/COPERNICUS/COPERNICUS_S5P_OFFL_L3_CH4.py new file mode 100644 index 000000000..fb2a422a0 --- /dev/null +++ b/examples/COPERNICUS/COPERNICUS_S5P_OFFL_L3_CH4.py @@ -0,0 +1,16 @@ +collection = ( + ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_CH4') + .select('CH4_column_volume_mixing_ratio_dry_air') + .filterDate('2019-06-01', '2019-07-16') +) + +band_viz = { + 'min': 1750, + 'max': 1900, + 'palette': ['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red'], +} + +m = geemap.Map() +m.add_layer(collection.mean(), band_viz, 'S5P CH4') +m.set_center(0.0, 0.0, 2) +m diff --git a/examples/COPERNICUS/COPERNICUS_S5P_OFFL_L3_CO.py b/examples/COPERNICUS/COPERNICUS_S5P_OFFL_L3_CO.py new file mode 100644 index 000000000..bfccb876b --- /dev/null +++ b/examples/COPERNICUS/COPERNICUS_S5P_OFFL_L3_CO.py @@ -0,0 +1,16 @@ +collection = ( + ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_CO') + .select('CO_column_number_density') + .filterDate('2019-06-01', '2019-06-11') +) + +band_viz = { + 'min': 0, + 'max': 0.05, + 'palette': ['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red'], +} + +m = geemap.Map() +m.add_layer(collection.mean(), band_viz, 'S5P CO') +m.set_center(-25.01, -4.28, 4) +m diff --git a/examples/COPERNICUS/COPERNICUS_S5P_OFFL_L3_NO2.py b/examples/COPERNICUS/COPERNICUS_S5P_OFFL_L3_NO2.py new file mode 100644 index 000000000..bda1a3e51 --- /dev/null +++ b/examples/COPERNICUS/COPERNICUS_S5P_OFFL_L3_NO2.py @@ -0,0 +1,16 @@ +collection = ( + ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_NO2') + .select('tropospheric_NO2_column_number_density') + .filterDate('2019-06-01', '2019-06-06') +) + +band_viz = { + 'min': 0, + 'max': 0.0002, + 'palette': ['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red'], +} + +m = geemap.Map() +m.add_layer(collection.mean(), band_viz, 'S5P N02') +m.set_center(65.27, 24.11, 4) +m diff --git a/examples/ECMWF/ECMWF_ERA5_LAND_HOURLY.py b/examples/ECMWF/ECMWF_ERA5_LAND_HOURLY.py new file mode 100644 index 000000000..f523342d2 --- /dev/null +++ b/examples/ECMWF/ECMWF_ERA5_LAND_HOURLY.py @@ -0,0 +1,19 @@ +dataset = ee.ImageCollection('ECMWF/ERA5_LAND/HOURLY').filter( + ee.Filter.date('2020-07-01', '2020-07-02') +) + +visualization = { + 'bands': ['temperature_2m'], + 'min': 250.0, + 'max': 320.0, + 'palette': [ + '000080', '0000d9', '4000ff', '8000ff', '0080ff', '00ffff', + '00ff80', '80ff00', 'daff00', 'ffff00', 'fff500', 'ffda00', + 'ffb000', 'ffa400', 'ff4f00', 'ff2500', 'ff0a00', 'ff00ff', + ], +} + +m = geemap.Map() +m.set_center(22.2, 21.2, 0) +m.add_layer(dataset, visualization, 'Air temperature [K] at 2m height') +m diff --git a/examples/ECMWF/ECMWF_ERA5_LAND_MONTHLY_AGGR.py b/examples/ECMWF/ECMWF_ERA5_LAND_MONTHLY_AGGR.py new file mode 100644 index 000000000..68a26812f --- /dev/null +++ b/examples/ECMWF/ECMWF_ERA5_LAND_MONTHLY_AGGR.py @@ -0,0 +1,19 @@ +dataset = ee.ImageCollection('ECMWF/ERA5_LAND/MONTHLY_AGGR').first() + +visualization = { + 'bands': ['temperature_2m'], + 'min': 250, + 'max': 320, + 'palette': [ + '000080', '0000d9', '4000ff', '8000ff', '0080ff', '00ffff', + '00ff80', '80ff00', 'daff00', 'ffff00', 'fff500', 'ffda00', + 'ffb000', 'ffa400', 'ff4f00', 'ff2500', 'ff0a00', 'ff00ff', + ], +} + +m = geemap.Map() +m.set_center(70, 45, 3) +m.add_layer( + dataset, visualization, 'Air temperature [K] at 2m height', True, 0.8 +) +m diff --git a/examples/ECMWF/ECMWF_ERA5_MONTHLY.py b/examples/ECMWF/ECMWF_ERA5_MONTHLY.py new file mode 100644 index 000000000..d3d48af5c --- /dev/null +++ b/examples/ECMWF/ECMWF_ERA5_MONTHLY.py @@ -0,0 +1,19 @@ +dataset = ee.ImageCollection('ECMWF/ERA5/MONTHLY') + +visualization = { + 'bands': ['mean_2m_air_temperature'], + 'min': 250.0, + 'max': 320.0, + 'palette': [ + '000080', '0000d9', '4000ff', '8000ff', '0080ff', '00ffff', + '00ff80', '80ff00', 'daff00', 'ffff00', 'fff500', 'ffda00', + 'ffb000', 'ffa400', 'ff4f00', 'ff2500', 'ff0a00', 'ff00ff', + ], +} + +m = geemap.Map() +m.set_center(22.2, 21.2, 0) +m.add_layer( + dataset, visualization, 'Monthly average air temperature [K] at 2m height' +) +m diff --git a/examples/EO1/EO1_HYPERION.py b/examples/EO1/EO1_HYPERION.py new file mode 100644 index 000000000..21bf28383 --- /dev/null +++ b/examples/EO1/EO1_HYPERION.py @@ -0,0 +1,11 @@ +dataset = ee.ImageCollection('EO1/HYPERION').filter( + ee.Filter.date('2016-01-01', '2017-03-01') +) + +rgb = dataset.select(['B050', 'B023', 'B015']) +rgb_vis = {'min': 1000.0, 'max': 14000.0, 'gamma': 2.5} + +m = geemap.Map() +m.set_center(162.0044, -77.3463, 9) +m.add_layer(rgb.median(), rgb_vis, 'RGB') +m diff --git a/examples/ESA/ESA_CCI_FireCCI_5_1.py b/examples/ESA/ESA_CCI_FireCCI_5_1.py new file mode 100644 index 000000000..9d0e34362 --- /dev/null +++ b/examples/ESA/ESA_CCI_FireCCI_5_1.py @@ -0,0 +1,24 @@ +# Visualize FireCCI51 for one year +dataset = ee.ImageCollection('ESA/CCI/FireCCI/5_1').filterDate( + '2020-01-01', '2020-12-31' +) + +burned_area = dataset.select('BurnDate') +max_ba = burned_area.max() + +# Use a circular palette to assign colors to date of first detection +ba_vis = { + 'min': 1, + 'max': 366, + 'palette': [ + 'ff0000', 'fd4100', 'fb8200', 'f9c400', 'f2ff00', 'b6ff05', + '7aff0a', '3eff0f', '02ff15', '00ff55', '00ff99', '00ffdd', + '00ddff', '0098ff', '0052ff', '0210ff', '3a0dfb', '7209f6', + 'a905f1', 'e102ed', 'ff00cc', 'ff0089', 'ff0047', 'ff0004' + ], +} + +m = geemap.Map() +m.set_center(0, 18, 2.1) +m.add_layer(max_ba, ba_vis, 'Burned Area') +m diff --git a/examples/ESA/ESA_GLOBCOVER_L4_200901_200912_V2_3.py b/examples/ESA/ESA_GLOBCOVER_L4_200901_200912_V2_3.py new file mode 100644 index 000000000..d8ae48d74 --- /dev/null +++ b/examples/ESA/ESA_GLOBCOVER_L4_200901_200912_V2_3.py @@ -0,0 +1,7 @@ +dataset = ee.Image('ESA/GLOBCOVER_L4_200901_200912_V2_3') +landcover = dataset.select('landcover') + +m = geemap.Map() +m.set_center(-88.6, 26.4, 3) +m.add_layer(landcover, {}, 'Landcover') +m diff --git a/examples/ESA/ESA_WorldCover_v200.py b/examples/ESA/ESA_WorldCover_v200.py new file mode 100644 index 000000000..31c05b453 --- /dev/null +++ b/examples/ESA/ESA_WorldCover_v200.py @@ -0,0 +1,8 @@ +dataset = ee.ImageCollection('ESA/WorldCover/v200').first() + +visualization = {'bands': ['Map']} + +m = geemap.Map() +m.center_object(dataset) +m.add_layer(dataset, visualization, 'Landcover') +m diff --git a/examples/FAO/FAO_GAUL_2015_level1.py b/examples/FAO/FAO_GAUL_2015_level1.py new file mode 100644 index 000000000..951f5b40c --- /dev/null +++ b/examples/FAO/FAO_GAUL_2015_level1.py @@ -0,0 +1,8 @@ +dataset = ee.FeatureCollection('FAO/GAUL/2015/level1') + +dataset = dataset.style(fillColor='b5ffb4', color='00909F', width=1.0) + +m = geemap.Map() +m.set_center(7.82, 49.1, 4) +m.add_layer(dataset, {}, 'First Level Administrative Units') +m diff --git a/examples/FIRMS/FIRMS.py b/examples/FIRMS/FIRMS.py new file mode 100644 index 000000000..919b1c3ca --- /dev/null +++ b/examples/FIRMS/FIRMS.py @@ -0,0 +1,12 @@ +dataset = ee.ImageCollection('FIRMS').filter( + ee.Filter.date('2018-08-01', '2018-08-10') +) + +fires = dataset.select('T21') + +fires_vis = {'min': 325.0, 'max': 400.0, 'palette': ['red', 'orange', 'yellow']} + +m = geemap.Map() +m.set_center(-119.086, 47.295, 6) +m.add_layer(fires, fires_vis, 'Fires') +m diff --git a/examples/GOOGLE/GOOGLE_Research_open-buildings_v2_polygons.py b/examples/GOOGLE/GOOGLE_Research_open-buildings_v2_polygons.py new file mode 100644 index 000000000..35a189919 --- /dev/null +++ b/examples/GOOGLE/GOOGLE_Research_open-buildings_v2_polygons.py @@ -0,0 +1,13 @@ +# Visualization of GOOGLE/Research/open-buildings/v2/polygons. +t = ee.FeatureCollection('GOOGLE/Research/open-buildings/v2/polygons') + +t_060_065 = t.filter('confidence >= 0.60 && confidence < 0.65') +t_065_070 = t.filter('confidence >= 0.65 && confidence < 0.70') +t_gte_070 = t.filter('confidence >= 0.70'); + +m = geemap.Map() +m.set_center(3.389, 6.492, 17) +m.add_layer(t_060_065, {'color': 'FF0000'}, 'Buildings confidence [0.60; 0.65)') +m.add_layer(t_065_070, {'color': 'FFFF00'}, 'Buildings confidence [0.65; 0.70)') +m.add_layer(t_gte_070, {'color': '00FF00'}, 'Buildings confidence >= 0.70') +m diff --git a/examples/GOOGLE/GOOGLE_Research_open-buildings_v3_polygons.py b/examples/GOOGLE/GOOGLE_Research_open-buildings_v3_polygons.py new file mode 100644 index 000000000..66ee00ad0 --- /dev/null +++ b/examples/GOOGLE/GOOGLE_Research_open-buildings_v3_polygons.py @@ -0,0 +1,13 @@ +# Visualization of GOOGLE/Research/open-buildings/v3/polygons. +t = ee.FeatureCollection('GOOGLE/Research/open-buildings/v3/polygons') + +t_065_070 = t.filter('confidence >= 0.65 && confidence < 0.7') +t_070_075 = t.filter('confidence >= 0.7 && confidence < 0.75') +t_gte_075 = t.filter('confidence >= 0.75'); + +m = geemap.Map() +m.set_center(3.389, 6.492, 17) +m.add_layer(t_065_070, {'color': 'FF0000'}, 'Buildings confidence [0.65; 0.7)') +m.add_layer(t_070_075, {'color': 'FFFF00'}, 'Buildings confidence [0.7; 0.75)') +m.add_layer(t_gte_075, {'color': '00FF00'}, 'Buildings confidence >= 0.75') +m diff --git a/examples/GRIDMET/GRIDMET_DROUGHT.py b/examples/GRIDMET/GRIDMET_DROUGHT.py new file mode 100644 index 000000000..f0a4fa905 --- /dev/null +++ b/examples/GRIDMET/GRIDMET_DROUGHT.py @@ -0,0 +1,63 @@ +collection = ee.ImageCollection('GRIDMET/DROUGHT') + +# Filter by date +d_s = '2020-03-30' +d_e = '2020-03-30' +d_s_utc = ee.Date(d_s, 'GMT') +d_e_utc = ee.Date(d_e, 'GMT') +filtered = collection.filterDate(d_s_utc, d_e_utc.advance(1, 'day')) + +# Select variables pdsi and z +pdsi = filtered.select('pdsi') +z = filtered.select('z') + +# Select variables for SPI/SPEI/EDDI +# Note that possible timescales for SPI/SPEI/EDDI are: +# 14d (14 day), 30d (30 day), 90d (90 day), 180d (180 day), +# 1y (1 year), 2y (2 year), 5y (5 year) +# Here we choose 2years = 48 months +spi_2_y = filtered.select('spi2y') +spei_2_y = filtered.select('spei2y') +eddi_2_y = filtered.select('spei2y') + +# Make a color palette that is similar to USDM drought classification +usdm_colors = [ + '#0000aa', + '#0000ff', + '#00aaff', + '#00ffff', + '#aaff55', + '#ffffff', + '#ffff00', + '#fcd37f', + '#ffaa00', + '#e60000', + '#730000', +] + +# Make color options for standardized variables spi/spei/eddi +min_colorbar = -2.5 +max_colorbar = 2.5 +colorbar_options_1 = { + 'min': min_colorbar, + 'max': max_colorbar, + 'palette': usdm_colors, +} + +# Make color options for Palmer variables psdi/z +min_colorbar = -6 +max_colorbar = 6 +colorbar_options_2 = { + 'min': min_colorbar, + 'max': max_colorbar, + 'palette': usdm_colors, +} + +# Add map layers to Google Map +m = geemap.Map() +m.add_layer(ee.Image(pdsi.first()), colorbar_options_2, 'pdsi') +m.add_layer(ee.Image(z.first()), colorbar_options_2, 'Palmer-z') +m.add_layer(ee.Image(spi_2_y.first()), colorbar_options_1, 'SPI-48months') +m.add_layer(ee.Image(spei_2_y.first()), colorbar_options_1, 'SPEI-48months') +m.add_layer(ee.Image(eddi_2_y.first()), colorbar_options_1, 'EDDI-48months') +m diff --git a/examples/IDAHO_EPSCOR/IDAHO_EPSCOR_GRIDMET.py b/examples/IDAHO_EPSCOR/IDAHO_EPSCOR_GRIDMET.py new file mode 100644 index 000000000..7b18b9919 --- /dev/null +++ b/examples/IDAHO_EPSCOR/IDAHO_EPSCOR_GRIDMET.py @@ -0,0 +1,16 @@ +dataset = ee.ImageCollection('IDAHO_EPSCOR/GRIDMET').filter( + ee.Filter.date('2018-08-01', '2018-08-15') +) + +maximum_temperature = dataset.select('tmmx') + +maximum_temperature_vis = { + 'min': 290.0, + 'max': 314.0, + 'palette': ['d8d8d8', '4addff', '5affa3', 'f2ff89', 'ff725c'], +} + +m = geemap.Map() +m.set_center(-115.356, 38.686, 5) +m.add_layer(maximum_temperature, maximum_temperature_vis, 'Maximum Temperature') +m diff --git a/examples/JAXA/JAXA_ALOS_AW3D30_V3_2.py b/examples/JAXA/JAXA_ALOS_AW3D30_V3_2.py new file mode 100644 index 000000000..b09184d44 --- /dev/null +++ b/examples/JAXA/JAXA_ALOS_AW3D30_V3_2.py @@ -0,0 +1,21 @@ +dataset = ee.ImageCollection('JAXA/ALOS/AW3D30/V3_2') +elevation = dataset.select('DSM') + +# Use a projection from one of the image tiles, +# rather than using the default projection returned by .mosaic(). +proj = elevation.first().select(0).projection() +slope_reprojected = ee.Terrain.slope( + elevation.mosaic().setDefaultProjection(proj) +) + +elevation_vis = { + 'min': 0, + 'max': 5000, + 'palette': ['0000ff', '00ffff', 'ffff00', 'ff0000', 'ffffff'], +} + +m = geemap.Map() +m.set_center(138.73, 35.36, 11) +m.add_layer(elevation, elevation_vis, 'Elevation') +m.add_layer(slope_reprojected, {'min': 0, 'max': 45}, 'Slope') +m diff --git a/examples/JAXA/JAXA_ALOS_PALSAR-2_Level2_2_ScanSAR.py b/examples/JAXA/JAXA_ALOS_PALSAR-2_Level2_2_ScanSAR.py new file mode 100644 index 000000000..5159cf787 --- /dev/null +++ b/examples/JAXA/JAXA_ALOS_PALSAR-2_Level2_2_ScanSAR.py @@ -0,0 +1,10 @@ +collection = ee.ImageCollection( + 'JAXA/ALOS/PALSAR-2/Level2_2/ScanSAR' +).filterBounds(ee.Geometry.Point(143, -5)) + +image = collection.first() + +m = geemap.Map() +m.add_layer(image.select(['HH']), {'min': 0, 'max': 8000}, 'HH polarization') +m.center_object(image) +m diff --git a/examples/JAXA/JAXA_ALOS_PALSAR_YEARLY_SAR.py b/examples/JAXA/JAXA_ALOS_PALSAR_YEARLY_SAR.py new file mode 100644 index 000000000..1a6afcbc5 --- /dev/null +++ b/examples/JAXA/JAXA_ALOS_PALSAR_YEARLY_SAR.py @@ -0,0 +1,11 @@ +dataset = ee.ImageCollection('JAXA/ALOS/PALSAR/YEARLY/SAR').filter( + ee.Filter.date('2017-01-01', '2018-01-01') +) + +sar_hh = dataset.select('HH') +sar_hh_vis = {'min': 0.0, 'max': 10000.0} + +m = geemap.Map() +m.set_center(136.85, 37.37, 4) +m.add_layer(sar_hh, sar_hh_vis, 'SAR HH') +m diff --git a/examples/JAXA/JAXA_GPM_L3_GSMaP_v6_operational.py b/examples/JAXA/JAXA_GPM_L3_GSMaP_v6_operational.py new file mode 100644 index 000000000..932987da3 --- /dev/null +++ b/examples/JAXA/JAXA_GPM_L3_GSMaP_v6_operational.py @@ -0,0 +1,22 @@ +dataset = ee.ImageCollection('JAXA/GPM_L3/GSMaP/v6/operational').filter( + ee.Filter.date('2018-08-06', '2018-08-07') +) +precipitation = dataset.select('hourlyPrecipRate') +precipitation_vis = { + 'min': 0.0, + 'max': 30.0, + 'palette': [ + '1621a2', + 'ffffff', + '03ffff', + '13ff03', + 'efff00', + 'ffb103', + 'ff2300', + ], +} + +m = geemap.Map() +m.set_center(-90.7, 26.12, 2) +m.add_layer(precipitation, precipitation_vis, 'Precipitation') +m diff --git a/examples/JRC/JRC_GSW1_4_GlobalSurfaceWater.py b/examples/JRC/JRC_GSW1_4_GlobalSurfaceWater.py new file mode 100644 index 000000000..08005ebb8 --- /dev/null +++ b/examples/JRC/JRC_GSW1_4_GlobalSurfaceWater.py @@ -0,0 +1,13 @@ +dataset = ee.Image('JRC/GSW1_4/GlobalSurfaceWater') + +visualization = { + 'bands': ['occurrence'], + 'min': 0.0, + 'max': 100.0, + 'palette': ['ffffff', 'ffbbbb', '0000ff'], +} + +m = geemap.Map() +m.set_center(59.414, 45.182, 6) +m.add_layer(dataset, visualization, 'Occurrence') +m diff --git a/examples/LANDSAT/LANDSAT_LC08_C02_T1.py b/examples/LANDSAT/LANDSAT_LC08_C02_T1.py new file mode 100644 index 000000000..f0615ba77 --- /dev/null +++ b/examples/LANDSAT/LANDSAT_LC08_C02_T1.py @@ -0,0 +1,12 @@ +dataset = ee.ImageCollection('LANDSAT/LC08/C02/T1').filterDate( + '2017-01-01', '2017-12-31' +) + +true_color_432 = dataset.select(['B4', 'B3', 'B2']) + +true_color_432_vis = {'min': 0.0, 'max': 30000.0} + +m = geemap.Map() +m.set_center(6.746, 46.529, 6) +m.add_layer(true_color_432, true_color_432_vis, 'True Color (432)') +m diff --git a/examples/LANDSAT/LANDSAT_LC08_C02_T2_L2.py b/examples/LANDSAT/LANDSAT_LC08_C02_T2_L2.py new file mode 100644 index 000000000..f96964a04 --- /dev/null +++ b/examples/LANDSAT/LANDSAT_LC08_C02_T2_L2.py @@ -0,0 +1,22 @@ +dataset = ee.ImageCollection('LANDSAT/LC08/C02/T2_L2').filterDate( + '2021-05-01', '2021-06-01' +) + + +# Applies scaling factors. +def apply_scale_factors(image): + optical_bands = image.select('SR_B.').multiply(0.0000275).add(-0.2) + thermal_bands = image.select('ST_B.*').multiply(0.00341802).add(149.0) + return image.addBands(optical_bands, None, True).addBands( + thermal_bands, None, True + ) + + +dataset = dataset.map(apply_scale_factors) + +visualization = {'bands': ['SR_B4', 'SR_B3', 'SR_B2'], 'min': 0.0, 'max': 0.3} + +m = geemap.Map() +m.set_center(-83, 24, 8) +m.add_layer(dataset, visualization, 'True Color (432)') +m diff --git a/examples/LANDSAT/LANDSAT_LC09_C02_T1.py b/examples/LANDSAT/LANDSAT_LC09_C02_T1.py new file mode 100644 index 000000000..d4b7649cf --- /dev/null +++ b/examples/LANDSAT/LANDSAT_LC09_C02_T1.py @@ -0,0 +1,12 @@ +dataset = ee.ImageCollection('LANDSAT/LC09/C02/T1').filterDate( + '2022-01-01', '2022-02-01' +) + +true_color_432 = dataset.select(['B4', 'B3', 'B2']) + +true_color_432_vis = {'min': 0.0, 'max': 30000.0} + +m = geemap.Map() +m.set_center(6.746, 46.529, 6) +m.add_layer(true_color_432, true_color_432_vis, 'True Color (432)') +m diff --git a/examples/LANDSAT/LANDSAT_LC09_C02_T1_TOA.py b/examples/LANDSAT/LANDSAT_LC09_C02_T1_TOA.py new file mode 100644 index 000000000..360840cd0 --- /dev/null +++ b/examples/LANDSAT/LANDSAT_LC09_C02_T1_TOA.py @@ -0,0 +1,12 @@ +dataset = ee.ImageCollection('LANDSAT/LC09/C02/T1_TOA').filterDate( + '2022-01-01', '2022-02-01' +) + +true_color_432 = dataset.select(['B4', 'B3', 'B2']) + +true_color_432_vis = {'min': 0.0, 'max': 0.4} + +m = geemap.Map() +m.set_center(6.746, 46.529, 6) +m.add_layer(true_color_432, true_color_432_vis, 'True Color (432)') +m diff --git a/examples/LANDSAT/LANDSAT_LE07_C02_T1.py b/examples/LANDSAT/LANDSAT_LE07_C02_T1.py new file mode 100644 index 000000000..20a544716 --- /dev/null +++ b/examples/LANDSAT/LANDSAT_LE07_C02_T1.py @@ -0,0 +1,12 @@ +dataset = ee.ImageCollection('LANDSAT/LE07/C02/T1').filterDate( + '1999-01-01', '2002-12-31' +) + +true_color_321 = dataset.select(['B3', 'B2', 'B1']) + +true_color_321_vis = {} + +m = geemap.Map() +m.set_center(6.746, 46.529, 6) +m.add_layer(true_color_321, true_color_321_vis, 'True Color (321)') +m diff --git a/examples/LANDSAT/LANDSAT_LE07_C02_T1_TOA.py b/examples/LANDSAT/LANDSAT_LE07_C02_T1_TOA.py new file mode 100644 index 000000000..e358448d5 --- /dev/null +++ b/examples/LANDSAT/LANDSAT_LE07_C02_T1_TOA.py @@ -0,0 +1,12 @@ +dataset = ee.ImageCollection('LANDSAT/LE07/C02/T1_TOA').filterDate( + '1999-01-01', '2002-12-31' +) + +true_color_321 = dataset.select(['B3', 'B2', 'B1']) + +true_color_321_vis = {'min': 0.0, 'max': 0.4, 'gamma': 1.2} + +m = geemap.Map() +m.set_center(6.746, 46.529, 6) +m.add_layer(true_color_321, true_color_321_vis, 'True Color (321)') +m diff --git a/examples/LANDSAT/LANDSAT_LT05_C02_T1_TOA.py b/examples/LANDSAT/LANDSAT_LT05_C02_T1_TOA.py new file mode 100644 index 000000000..6759e2ce8 --- /dev/null +++ b/examples/LANDSAT/LANDSAT_LT05_C02_T1_TOA.py @@ -0,0 +1,12 @@ +dataset = ee.ImageCollection('LANDSAT/LT05/C02/T1_TOA').filterDate( + '2011-01-01', '2011-12-31' +) + +true_color_321 = dataset.select(['B3', 'B2', 'B1']) + +true_color_321_vis = {'min': 0.0, 'max': 0.4, 'gamma': 1.2} + +m = geemap.Map() +m.set_center(6.746, 46.529, 6) +m.add_layer(true_color_321, true_color_321_vis, 'True Color (321)') +m diff --git a/examples/LARSE/LARSE_GEDI_GEDI02_A_002_MONTHLY.py b/examples/LARSE/LARSE_GEDI_GEDI02_A_002_MONTHLY.py new file mode 100644 index 000000000..e0767d89e --- /dev/null +++ b/examples/LARSE/LARSE_GEDI_GEDI02_A_002_MONTHLY.py @@ -0,0 +1,22 @@ +def quality_mask(im): + return im.updateMask(im.select('quality_flag').eq(1)).updateMask( + im.select('degrade_flag').eq(0) + ) + + +dataset = ( + ee.ImageCollection('LARSE/GEDI/GEDI02_A_002_MONTHLY') + .map(quality_mask) + .select('rh98') +) + +gedi_vis = { + 'min': 1, + 'max': 60, + 'palette': 'darkred,red,orange,green,darkgreen', +} + +m = geemap.Map() +m.set_center(-74.803466, -9.342209, 10) +m.add_layer(dataset, gedi_vis, 'rh98') +m diff --git a/examples/MODIS/MODIS_006_MCD12Q1.py b/examples/MODIS/MODIS_006_MCD12Q1.py new file mode 100644 index 000000000..13e2515ea --- /dev/null +++ b/examples/MODIS/MODIS_006_MCD12Q1.py @@ -0,0 +1,18 @@ +dataset = ee.ImageCollection('MODIS/006/MCD12Q1') + +igbp_land_cover = dataset.select('LC_Type1') + +igbp_land_cover_vis = { + 'min': 1.0, + 'max': 17.0, + 'palette': [ + '05450a', '086a10', '54a708', '78d203', '009900', 'c6b044', 'dcd159', + 'dade48', 'fbff13', 'b6ff05', '27ff87', 'c24f44', 'a5a5a5', 'ff6d4c', + '69fff8', 'f9ffa4', '1c0dff' + ], +} + +m = geemap.Map() +m.set_center(6.746, 46.529, 6) +m.add_layer(igbp_land_cover, igbp_land_cover_vis, 'IGBP Land Cover') +m diff --git a/examples/MODIS/MODIS_006_MCD43A4.py b/examples/MODIS/MODIS_006_MCD43A4.py new file mode 100644 index 000000000..51acb0ccb --- /dev/null +++ b/examples/MODIS/MODIS_006_MCD43A4.py @@ -0,0 +1,16 @@ +dataset = ee.ImageCollection('MODIS/006/MCD43A4').filter( + ee.Filter.date('2018-04-01', '2018-06-01') +) + +true_color = dataset.select([ + 'Nadir_Reflectance_Band1', + 'Nadir_Reflectance_Band4', + 'Nadir_Reflectance_Band3', +]) + +true_color_vis = {'min': 0, 'max': 4000, 'gamma': 1.4} + +m = geemap.Map() +m.set_center(-7.03, 31.06, 2) +m.add_layer(true_color, true_color_vis, 'True Color') +m diff --git a/examples/MODIS/MODIS_006_MCD64A1.py b/examples/MODIS/MODIS_006_MCD64A1.py new file mode 100644 index 000000000..509ce7181 --- /dev/null +++ b/examples/MODIS/MODIS_006_MCD64A1.py @@ -0,0 +1,16 @@ +dataset = ee.ImageCollection('MODIS/006/MCD64A1').filter( + ee.Filter.date('2017-01-01', '2018-05-01') +) + +burned_area = dataset.select('BurnDate') + +burned_area_vis = { + 'min': 30, + 'max': 341, + 'palette': ['4e0400', '951003', 'c61503', 'ff1901'], +} + +m = geemap.Map() +m.set_center(6.746, 46.529, 2) +m.add_layer(burned_area, burned_area_vis, 'Burned Area') +m diff --git a/examples/MODIS/MODIS_006_MOD09GQ.py b/examples/MODIS/MODIS_006_MOD09GQ.py new file mode 100644 index 000000000..e4d369081 --- /dev/null +++ b/examples/MODIS/MODIS_006_MOD09GQ.py @@ -0,0 +1,14 @@ +dataset = ee.ImageCollection('MODIS/006/MOD09GQ').filter( + ee.Filter.date('2018-01-01', '2018-05-01') +) + +false_color_vis = { + 'min': -100, + 'max': 8000, + 'bands': ['sur_refl_b02', 'sur_refl_b02', 'sur_refl_b01'], +} + +m = geemap.Map() +m.set_center(6.746, 46.529, 2) +m.add_layer(dataset, false_color_vis, 'False Color') +m diff --git a/examples/MODIS/MODIS_006_MOD11A1.py b/examples/MODIS/MODIS_006_MOD11A1.py new file mode 100644 index 000000000..1415b96c6 --- /dev/null +++ b/examples/MODIS/MODIS_006_MOD11A1.py @@ -0,0 +1,26 @@ +dataset = ee.ImageCollection('MODIS/006/MOD11A1').filter( + ee.Filter.date('2018-01-01', '2018-05-01') +) + +land_surface_temperature = dataset.select('LST_Day_1km') + +land_surface_temperature_vis = { + 'min': 13000, + 'max': 16500, + 'palette': [ + '040274', '040281', '0502a3', '0502b8', '0502ce', '0502e6', + '0602ff', '235cb1', '307ef3', '269db1', '30c8e2', '32d3ef', + '3be285', '3ff38f', '86e26f', '3ae237', 'b5e22e', 'd6e21f', + 'fff705', 'ffd611', 'ffb613', 'ff8b13', 'ff6e08', 'ff500d', + 'ff0000', 'de0101', 'c21301', 'a71001', '911003' + ], +} + +m = geemap.Map() +m.set_center(6.746, 46.529, 2) +m.add_layer( + land_surface_temperature, + land_surface_temperature_vis, + 'Land Surface Temperature', +) +m diff --git a/examples/MODIS/MODIS_006_MOD13Q1.py b/examples/MODIS/MODIS_006_MOD13Q1.py new file mode 100644 index 000000000..ca3da60b5 --- /dev/null +++ b/examples/MODIS/MODIS_006_MOD13Q1.py @@ -0,0 +1,20 @@ +dataset = ee.ImageCollection('MODIS/006/MOD13Q1').filter( + ee.Filter.date('2018-01-01', '2018-05-01') +) + +ndvi = dataset.select('NDVI') + +ndvi_vis = { + 'min': 0, + 'max': 8000, + 'palette': [ + 'ffffff', 'ce7e45', 'df923d', 'f1b555', 'fcd163', '99b718', '74a901', + '66a000', '529400', '3e8601', '207401', '056201', '004c00', '023b01', + '012e01', '011d01', '011301' + ], +} + +m = geemap.Map() +m.set_center(6.746, 46.529, 2) +m.add_layer(ndvi, ndvi_vis, 'NDVI') +m diff --git a/examples/MODIS/MODIS_006_MOD16A2.py b/examples/MODIS/MODIS_006_MOD16A2.py new file mode 100644 index 000000000..ad5992779 --- /dev/null +++ b/examples/MODIS/MODIS_006_MOD16A2.py @@ -0,0 +1,26 @@ +dataset = ee.ImageCollection('MODIS/006/MOD16A2').filter( + ee.Filter.date('2018-01-01', '2018-05-01') +) + +evapotranspiration = dataset.select('ET') + +evapotranspiration_vis = { + 'min': 0, + 'max': 300, + 'palette': [ + 'ffffff', + 'fcd163', + '99b718', + '66a000', + '3e8601', + '207401', + '056201', + '004c00', + '011301', + ], +} + +m = geemap.Map() +m.set_center(6.746, 46.529, 2) +m.add_layer(evapotranspiration, evapotranspiration_vis, 'Evapotranspiration') +m diff --git a/examples/MODIS/MODIS_006_MOD17A2H.py b/examples/MODIS/MODIS_006_MOD17A2H.py new file mode 100644 index 000000000..9cd467e7d --- /dev/null +++ b/examples/MODIS/MODIS_006_MOD17A2H.py @@ -0,0 +1,12 @@ +dataset = ee.ImageCollection('MODIS/006/MOD17A2H').filter( + ee.Filter.date('2018-01-01', '2018-05-01') +) + +gpp = dataset.select('Gpp') + +gpp_vis = {'min': 0, 'max': 600, 'palette': ['bbe029', '0a9501', '074b03']} + +m = geemap.Map() +m.set_center(6.746, 46.529, 2) +m.add_layer(gpp, gpp_vis, 'GPP') +m diff --git a/examples/MODIS/MODIS_061_MCD12Q1.py b/examples/MODIS/MODIS_061_MCD12Q1.py new file mode 100644 index 000000000..9c5cd181f --- /dev/null +++ b/examples/MODIS/MODIS_061_MCD12Q1.py @@ -0,0 +1,18 @@ +dataset = ee.ImageCollection('MODIS/061/MCD12Q1') + +igbp_land_cover = dataset.select('LC_Type1') + +igbp_land_cover_vis = { + 'min': 1.0, + 'max': 17.0, + 'palette': [ + '05450a', '086a10', '54a708', '78d203', '009900', 'c6b044', 'dcd159', + 'dade48', 'fbff13', 'b6ff05', '27ff87', 'c24f44', 'a5a5a5', 'ff6d4c', + '69fff8', 'f9ffa4', '1c0dff' + ], +} + +m = geemap.Map() +m.set_center(6.746, 46.529, 6) +m.add_layer(igbp_land_cover, igbp_land_cover_vis, 'IGBP Land Cover') +m diff --git a/examples/MODIS/MODIS_061_MCD15A3H.py b/examples/MODIS/MODIS_061_MCD15A3H.py new file mode 100644 index 000000000..a5a7bcebe --- /dev/null +++ b/examples/MODIS/MODIS_061_MCD15A3H.py @@ -0,0 +1,16 @@ +dataset = ee.ImageCollection('MODIS/061/MCD15A3H') + +default_visualization = dataset.first().select('Fpar') + +default_visualization_vis = { + 'min': 0.0, + 'max': 100.0, + 'palette': ['e1e4b4', '999d60', '2ec409', '0a4b06'], +} + +m = geemap.Map() +m.set_center(6.746, 46.529, 6) +m.add_layer( + default_visualization, default_visualization_vis, 'Default visualization' +) +m diff --git a/examples/MODIS/MODIS_061_MCD43A4.py b/examples/MODIS/MODIS_061_MCD43A4.py new file mode 100644 index 000000000..9bc8839cc --- /dev/null +++ b/examples/MODIS/MODIS_061_MCD43A4.py @@ -0,0 +1,16 @@ +dataset = ee.ImageCollection('MODIS/061/MCD43A4').filter( + ee.Filter.date('2018-04-01', '2018-06-01') +) + +true_color = dataset.select([ + 'Nadir_Reflectance_Band1', + 'Nadir_Reflectance_Band4', + 'Nadir_Reflectance_Band3', +]) + +true_color_vis = {'min': 0, 'max': 4000, 'gamma': 1.4} + +m = geemap.Map() +m.set_center(-7.03, 31.06, 2) +m.add_layer(true_color, true_color_vis, 'True Color') +m \ No newline at end of file diff --git a/examples/MODIS/MODIS_061_MCD64A1.py b/examples/MODIS/MODIS_061_MCD64A1.py new file mode 100644 index 000000000..0cc893d69 --- /dev/null +++ b/examples/MODIS/MODIS_061_MCD64A1.py @@ -0,0 +1,13 @@ +dataset = ee.ImageCollection('MODIS/061/MCD64A1').filter( + ee.Filter.date('2017-01-01', '2018-05-01') +) +burned_area = dataset.select('BurnDate') +burned_area_vis = { + 'min': 30, + 'max': 341, + 'palette': ['4e0400', '951003', 'c61503', 'ff1901'], +} +m = geemap.Map() +m.set_center(6.746, 46.529, 2) +m.add_layer(burned_area, burned_area_vis, 'Burned Area') +m diff --git a/examples/MODIS/MODIS_061_MOD09A1.py b/examples/MODIS/MODIS_061_MOD09A1.py new file mode 100644 index 000000000..37e4c0604 --- /dev/null +++ b/examples/MODIS/MODIS_061_MOD09A1.py @@ -0,0 +1,12 @@ +dataset = ee.ImageCollection('MODIS/061/MOD09A1').filter( + ee.Filter.date('2018-01-01', '2018-05-01') +) + +true_color = dataset.select(['sur_refl_b01', 'sur_refl_b04', 'sur_refl_b03']) + +true_color_vis = {'min': -100.0, 'max': 3000.0} + +m = geemap.Map() +m.set_center(6.746, 46.529, 6) +m.add_layer(true_color, true_color_vis, 'True Color') +m diff --git a/examples/MODIS/MODIS_061_MOD09GQ.py b/examples/MODIS/MODIS_061_MOD09GQ.py new file mode 100644 index 000000000..e1a7ec7ed --- /dev/null +++ b/examples/MODIS/MODIS_061_MOD09GQ.py @@ -0,0 +1,14 @@ +dataset = ee.ImageCollection('MODIS/061/MOD09GQ').filter( + ee.Filter.date('2018-01-01', '2018-05-01') +) + +false_color_vis = { + 'min': -100, + 'max': 8000, + 'bands': ['sur_refl_b02', 'sur_refl_b02', 'sur_refl_b01'], +} + +m = geemap.Map() +m.set_center(6.746, 46.529, 2) +m.add_layer(dataset, false_color_vis, 'False Color') +m diff --git a/examples/MODIS/MODIS_061_MOD11A1.py b/examples/MODIS/MODIS_061_MOD11A1.py new file mode 100644 index 000000000..3f6ba549e --- /dev/null +++ b/examples/MODIS/MODIS_061_MOD11A1.py @@ -0,0 +1,26 @@ +dataset = ee.ImageCollection('MODIS/061/MOD11A1').filter( + ee.Filter.date('2018-01-01', '2018-05-01') +) + +land_surface_temperature = dataset.select('LST_Day_1km') + +land_surface_temperature_vis = { + 'min': 13000.0, + 'max': 16500.0, + 'palette': [ + '040274', '040281', '0502a3', '0502b8', '0502ce', '0502e6', + '0602ff', '235cb1', '307ef3', '269db1', '30c8e2', '32d3ef', + '3be285', '3ff38f', '86e26f', '3ae237', 'b5e22e', 'd6e21f', + 'fff705', 'ffd611', 'ffb613', 'ff8b13', 'ff6e08', 'ff500d', + 'ff0000', 'de0101', 'c21301', 'a71001', '911003' + ], +} + +m = geemap.Map() +m.set_center(6.746, 46.529, 2) +m.add_layer( + land_surface_temperature, + land_surface_temperature_vis, + 'Land Surface Temperature', +) +m diff --git a/examples/MODIS/MODIS_061_MOD11A2.py b/examples/MODIS/MODIS_061_MOD11A2.py new file mode 100644 index 000000000..3d03103de --- /dev/null +++ b/examples/MODIS/MODIS_061_MOD11A2.py @@ -0,0 +1,26 @@ +dataset = ee.ImageCollection('MODIS/061/MOD11A2').filter( + ee.Filter.date('2018-01-01', '2018-05-01') +) + +land_surface_temperature = dataset.select('LST_Day_1km') + +land_surface_temperature_vis = { + 'min': 14000.0, + 'max': 16000.0, + 'palette': [ + '040274', '040281', '0502a3', '0502b8', '0502ce', '0502e6', + '0602ff', '235cb1', '307ef3', '269db1', '30c8e2', '32d3ef', + '3be285', '3ff38f', '86e26f', '3ae237', 'b5e22e', 'd6e21f', + 'fff705', 'ffd611', 'ffb613', 'ff8b13', 'ff6e08', 'ff500d', + 'ff0000', 'de0101', 'c21301', 'a71001', '911003' + ], +} + +m = geemap.Map() +m.set_center(6.746, 46.529, 2) +m.add_layer( + land_surface_temperature, + land_surface_temperature_vis, + 'Land Surface Temperature', +) +m diff --git a/examples/MODIS/MODIS_061_MOD13A2.py b/examples/MODIS/MODIS_061_MOD13A2.py new file mode 100644 index 000000000..09e9aa987 --- /dev/null +++ b/examples/MODIS/MODIS_061_MOD13A2.py @@ -0,0 +1,20 @@ +dataset = ee.ImageCollection('MODIS/061/MOD13A2').filter( + ee.Filter.date('2018-01-01', '2018-05-01') +) + +ndvi = dataset.select('NDVI') + +ndvi_vis = { + 'min': 0, + 'max': 9000, + 'palette': [ + 'ffffff', 'ce7e45', 'df923d', 'f1b555', 'fcd163', '99b718', '74a901', + '66a000', '529400', '3e8601', '207401', '056201', '004c00', '023b01', + '012e01', '011d01', '011301' + ], +} + +m = geemap.Map() +m.set_center(6.746, 46.529, 2) +m.add_layer(ndvi, ndvi_vis, 'NDVI') +m diff --git a/examples/MODIS/MODIS_061_MOD13Q1.py b/examples/MODIS/MODIS_061_MOD13Q1.py new file mode 100644 index 000000000..f318bcc48 --- /dev/null +++ b/examples/MODIS/MODIS_061_MOD13Q1.py @@ -0,0 +1,20 @@ +dataset = ee.ImageCollection('MODIS/061/MOD13Q1').filter( + ee.Filter.date('2018-01-01', '2018-05-01') +) + +ndvi = dataset.select('NDVI') + +ndvi_vis = { + 'min': 0, + 'max': 8000, + 'palette': [ + 'ffffff', 'ce7e45', 'df923d', 'f1b555', 'fcd163', '99b718', '74a901', + '66a000', '529400', '3e8601', '207401', '056201', '004c00', '023b01', + '012e01', '011d01', '011301' + ], +} + +m = geemap.Map() +m.set_center(6.746, 46.529, 2) +m.add_layer(ndvi, ndvi_vis, 'NDVI') +m diff --git a/examples/MODIS/MODIS_061_MOD16A2.py b/examples/MODIS/MODIS_061_MOD16A2.py new file mode 100644 index 000000000..d061546f6 --- /dev/null +++ b/examples/MODIS/MODIS_061_MOD16A2.py @@ -0,0 +1,26 @@ +dataset = ee.ImageCollection('MODIS/061/MOD16A2').filter( + ee.Filter.date('2022-01-01', '2022-05-01') +) + +evapotranspiration = dataset.select('ET') + +evapotranspiration_vis = { + 'min': 0, + 'max': 300, + 'palette': [ + 'ffffff', + 'fcd163', + '99b718', + '66a000', + '3e8601', + '207401', + '056201', + '004c00', + '011301', + ], +} + +m = geemap.Map() +m.set_center(0, 0, 2) +m.add_layer(evapotranspiration, evapotranspiration_vis, 'Evapotranspiration') +m diff --git a/examples/MODIS/MODIS_061_MOD17A2H.py b/examples/MODIS/MODIS_061_MOD17A2H.py new file mode 100644 index 000000000..8098d5741 --- /dev/null +++ b/examples/MODIS/MODIS_061_MOD17A2H.py @@ -0,0 +1,12 @@ +dataset = ee.ImageCollection('MODIS/061/MOD17A2H').filter( + ee.Filter.date('2021-01-01', '2021-05-01') +) + +gpp = dataset.select('Gpp') + +gpp_vis = {'min': 0, 'max': 600, 'palette': ['bbe029', '0a9501', '074b03']} + +m = geemap.Map() +m.set_center(6.746, 46.529, 2) +m.add_layer(gpp, gpp_vis, 'GPP') +m diff --git a/examples/MODIS/MODIS_MOD09GA_006_NDVI.py b/examples/MODIS/MODIS_MOD09GA_006_NDVI.py new file mode 100644 index 000000000..fbe8b75db --- /dev/null +++ b/examples/MODIS/MODIS_MOD09GA_006_NDVI.py @@ -0,0 +1,20 @@ +dataset = ee.ImageCollection('MODIS/MOD09GA_006_NDVI').filter( + ee.Filter.date('2018-04-01', '2018-06-01') +) + +colorized = dataset.select('NDVI') + +colorized_vis = { + 'min': 0, + 'max': 1, + 'palette': [ + 'ffffff', 'ce7e45', 'df923d', 'f1b555', 'fcd163', '99b718', '74a901', + '66a000', '529400', '3e8601', '207401', '056201', '004c00', '023b01', + '012e01', '011d01', '011301' + ], +} + +m = geemap.Map() +m.set_center(-7.03125, 31.0529339857, 2) +m.add_layer(colorized, colorized_vis, 'Colorized') +m diff --git a/examples/NASA/NASA_FLDAS_NOAH01_C_GL_M_V001.py b/examples/NASA/NASA_FLDAS_NOAH01_C_GL_M_V001.py new file mode 100644 index 000000000..d96480815 --- /dev/null +++ b/examples/NASA/NASA_FLDAS_NOAH01_C_GL_M_V001.py @@ -0,0 +1,17 @@ +dataset = ee.ImageCollection('NASA/FLDAS/NOAH01/C/GL/M/V001').filter( + ee.Filter.date('2018-11-01', '2018-12-01') +) + +layer = dataset.select('Evap_tavg') + +band_viz = { + 'min': 0.0, + 'max': 0.00005, + 'opacity': 1.0, + 'palette': ['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red'], +} + +m = geemap.Map() +m.set_center(30.0, 30.0, 2) +m.add_layer(layer, band_viz, 'Average Evapotranspiration') +m diff --git a/examples/NASA/NASA_GLDAS_V021_NOAH_G025_T3H.py b/examples/NASA/NASA_GLDAS_V021_NOAH_G025_T3H.py new file mode 100644 index 000000000..4c3363da5 --- /dev/null +++ b/examples/NASA/NASA_GLDAS_V021_NOAH_G025_T3H.py @@ -0,0 +1,20 @@ +dataset = ee.ImageCollection('NASA/GLDAS/V021/NOAH/G025/T3H').filter( + ee.Filter.date('2010-06-01', '2010-06-02') +) + +average_surface_skin_temperature_k = dataset.select('AvgSurfT_inst') + +average_surface_skin_temperature_k_vis = { + 'min': 250.0, + 'max': 300.0, + 'palette': ['1303ff', '42fff6', 'f3ff40', 'ff5d0f'], +} + +m = geemap.Map() +m.set_center(71.72, 52.48, 3.0) +m.add_layer( + average_surface_skin_temperature_k, + average_surface_skin_temperature_k_vis, + 'Average Surface Skin Temperature [K]', +) +m diff --git a/examples/NASA/NASA_GPM_L3_IMERG_MONTHLY_V06.py b/examples/NASA/NASA_GPM_L3_IMERG_MONTHLY_V06.py new file mode 100644 index 000000000..a12e594d5 --- /dev/null +++ b/examples/NASA/NASA_GPM_L3_IMERG_MONTHLY_V06.py @@ -0,0 +1,19 @@ +dataset = ee.ImageCollection('NASA/GPM_L3/IMERG_MONTHLY_V06').filterDate( + '2019-01-01', '2020-01-01' +) + +# Select the max precipitation and mask out low precipitation values. +precipitation = dataset.select('precipitation').max() +mask = precipitation.gt(0.25) +precipitation = precipitation.updateMask(mask) + +palette = [ + '000096','0064ff', '00b4ff', '33db80', '9beb4a', + 'ffeb00', 'ffb300', 'ff6400', 'eb1e00', 'af0000' +] +precipitation_vis = {'min': 0.0, 'max': 1.5, 'palette': palette} + +m = geemap.Map() +m.add_layer(precipitation, precipitation_vis, 'Precipitation (mm/hr)') +m.set_center(-76, 33, 3) +m diff --git a/examples/NASA/NASA_GPM_L3_IMERG_V06.py b/examples/NASA/NASA_GPM_L3_IMERG_V06.py new file mode 100644 index 000000000..9d95623a3 --- /dev/null +++ b/examples/NASA/NASA_GPM_L3_IMERG_V06.py @@ -0,0 +1,21 @@ +# GPM V6 30 minute data around hurricane Dorian for a single day. +range = ee.Date('2019-09-03').getRange('day') +dataset = ee.ImageCollection('NASA/GPM_L3/IMERG_V06').filter( + ee.Filter.date(range) +) + +# Select the max precipitation and mask out low precipitation values. +precipitation = dataset.select('precipitationCal').max() +mask = precipitation.gt(0.5) +precipitation = precipitation.updateMask(mask) + +palette = [ + '000096','0064ff', '00b4ff', '33db80', '9beb4a', + 'ffeb00', 'ffb300', 'ff6400', 'eb1e00', 'af0000' +] +precipitation_vis = {'min': 0, 'max': 15, 'palette': palette} + +m = geemap.Map() +m.add_layer(precipitation, precipitation_vis, 'Precipitation (mm/hr)') +m.set_center(-76, 33, 3) +m diff --git a/examples/NASA/NASA_GPM_L3_IMERG_V07.py b/examples/NASA/NASA_GPM_L3_IMERG_V07.py new file mode 100644 index 000000000..bcd221be7 --- /dev/null +++ b/examples/NASA/NASA_GPM_L3_IMERG_V07.py @@ -0,0 +1,21 @@ +# GPM V7 30 minute data for a single day. +range = ee.Date('2019-09-03').getRange('day') +dataset = ee.ImageCollection('NASA/GPM_L3/IMERG_V07').filter( + ee.Filter.date(range) +) + +# Select the max precipitation and mask out low precipitation values. +precipitation = dataset.select('precipitation').max() +mask = precipitation.gt(0.5) +precipitation = precipitation.updateMask(mask) + +palette = [ + '000096','0064ff', '00b4ff', '33db80', '9beb4a', + 'ffeb00', 'ffb300', 'ff6400', 'eb1e00', 'af0000' +] +precipitation_vis = {'min': 0, 'max': 15, 'palette': palette} + +m = geemap.Map() +m.add_layer(precipitation, precipitation_vis, 'Precipitation (mm/hr)') +m.set_center(-76, 33, 3) +m diff --git a/examples/NASA/NASA_NASADEM_HGT_001.py b/examples/NASA/NASA_NASADEM_HGT_001.py new file mode 100644 index 000000000..aa3f05cd0 --- /dev/null +++ b/examples/NASA/NASA_NASADEM_HGT_001.py @@ -0,0 +1,17 @@ +# Import the dataset and select the elevation band. +dataset = ee.Image('NASA/NASADEM_HGT/001') + +elevation = dataset.select('elevation') + +# Add a white background image to the map. +background = ee.Image(1) +m = geemap.Map() +m.set_center(17.93, 7.71, 2) +m.add_layer(background, {'min': 0, 'max': 1}) + +# Set elevation visualization properties. +elevation_vis = {'min': 0, 'max': 2000} + +# Set elevation <= 0 as transparent and add to the map. +m.add_layer(elevation.updateMask(elevation.gt(0)), elevation_vis, 'Elevation') +m diff --git a/examples/NASA/NASA_OCEANDATA_MODIS-Aqua_L3SMI.py b/examples/NASA/NASA_OCEANDATA_MODIS-Aqua_L3SMI.py new file mode 100644 index 000000000..ea8c0ca1f --- /dev/null +++ b/examples/NASA/NASA_OCEANDATA_MODIS-Aqua_L3SMI.py @@ -0,0 +1,16 @@ +dataset = ee.ImageCollection('NASA/OCEANDATA/MODIS-Aqua/L3SMI').filterDate( + '2016-01-01', '2016-01-31' +) + +remote_sensing_reflectance = dataset.select(['Rrs_645', 'Rrs_555', 'Rrs_443']) + +remote_sensing_reflectance_vis = {'min': 0.0, 'max': 0.011} + +m = geemap.Map() +m.set_center(-52.12, -46.13, 4) +m.add_layer( + remote_sensing_reflectance, + remote_sensing_reflectance_vis, + 'Remote Sensing Reflectance', +) +m diff --git a/examples/NASA/NASA_SMAP_SPL4SMGP_007.py b/examples/NASA/NASA_SMAP_SPL4SMGP_007.py new file mode 100644 index 000000000..e537b87f9 --- /dev/null +++ b/examples/NASA/NASA_SMAP_SPL4SMGP_007.py @@ -0,0 +1,16 @@ +dataset = ee.ImageCollection('NASA/SMAP/SPL4SMGP/007').filter( + ee.Filter.date('2017-04-01', '2017-04-30') +) + +sm_surface = dataset.select('sm_surface') + +sm_surface_vis = { + 'min': 0.0, + 'max': 0.9, + 'palette': ['0300ff', '418504', 'efff07', 'efff07', 'ff0303'], +} + +m = geemap.Map() +m.set_center(-6.746, 46.529, 2) +m.add_layer(sm_surface, sm_surface_vis, 'SM Surface') +m diff --git a/examples/NASA_USDA/NASA_USDA_HSL_SMAP10KM_soil_moisture.py b/examples/NASA_USDA/NASA_USDA_HSL_SMAP10KM_soil_moisture.py new file mode 100644 index 000000000..3e02583fa --- /dev/null +++ b/examples/NASA_USDA/NASA_USDA_HSL_SMAP10KM_soil_moisture.py @@ -0,0 +1,16 @@ +dataset = ee.ImageCollection('NASA_USDA/HSL/SMAP10KM_soil_moisture').filter( + ee.Filter.date('2017-04-01', '2017-04-30') +) + +soil_moisture = dataset.select('ssm') + +soil_moisture_vis = { + 'min': 0.0, + 'max': 28.0, + 'palette': ['0300ff', '418504', 'efff07', 'efff07', 'ff0303'], +} + +m = geemap.Map() +m.set_center(-6.746, 46.529, 2) +m.add_layer(soil_moisture, soil_moisture_vis, 'Soil Moisture') +m diff --git a/examples/NOAA/NOAA_CDR_AVHRR_NDVI_V5.py b/examples/NOAA/NOAA_CDR_AVHRR_NDVI_V5.py new file mode 100644 index 000000000..4035c447f --- /dev/null +++ b/examples/NOAA/NOAA_CDR_AVHRR_NDVI_V5.py @@ -0,0 +1,25 @@ +dataset = ee.ImageCollection('NOAA/CDR/AVHRR/NDVI/V5').filter( + ee.Filter.date('2018-05-01', '2018-06-01') +) + +ndvi = dataset.select('NDVI') + +ndvi_vis = { + 'min': -1000.0, + 'max': 5000.0, + 'palette': [ + 'ffffff', + 'ce7e45', + 'fcd163', + 'c6ca02', + '22cc04', + '99b718', + '207401', + '012e01', + ], +} + +m = geemap.Map() +m.set_center(7.71, 17.93, 2) +m.add_layer(ndvi, ndvi_vis, 'NDVI') +m diff --git a/examples/NOAA/NOAA_CFSV2_FOR6H.py b/examples/NOAA/NOAA_CFSV2_FOR6H.py new file mode 100644 index 000000000..b13b4a512 --- /dev/null +++ b/examples/NOAA/NOAA_CFSV2_FOR6H.py @@ -0,0 +1,16 @@ +dataset = ee.ImageCollection('NOAA/CFSV2/FOR6H').filter( + ee.Filter.date('2018-03-01', '2018-03-14') +) + +temperature_above_ground = dataset.select('Temperature_height_above_ground') + +vis_params = { + 'min': 220.0, + 'max': 310.0, + 'palette': ['blue', 'purple', 'cyan', 'green', 'yellow', 'red'], +} + +m = geemap.Map() +m.set_center(-88.6, 26.4, 1) +m.add_layer(temperature_above_ground, vis_params, 'Temperature Above Ground') +m diff --git a/examples/NOAA/NOAA_DMSP-OLS_NIGHTTIME_LIGHTS.py b/examples/NOAA/NOAA_DMSP-OLS_NIGHTTIME_LIGHTS.py new file mode 100644 index 000000000..e27213b78 --- /dev/null +++ b/examples/NOAA/NOAA_DMSP-OLS_NIGHTTIME_LIGHTS.py @@ -0,0 +1,12 @@ +dataset = ee.ImageCollection('NOAA/DMSP-OLS/NIGHTTIME_LIGHTS').filter( + ee.Filter.date('2010-01-01', '2010-12-31') +) + +nighttime_lights = dataset.select('avg_vis') + +nighttime_lights_vis = {'min': 3.0, 'max': 60.0} + +m = geemap.Map() +m.set_center(7.82, 49.1, 4) +m.add_layer(nighttime_lights, nighttime_lights_vis, 'Nighttime Lights') +m diff --git a/examples/NOAA/NOAA_GFS0P25.py b/examples/NOAA/NOAA_GFS0P25.py new file mode 100644 index 000000000..55e8d5fc8 --- /dev/null +++ b/examples/NOAA/NOAA_GFS0P25.py @@ -0,0 +1,16 @@ +dataset = ee.ImageCollection('NOAA/GFS0P25').filter( + ee.Filter.date('2018-03-01', '2018-03-02') +) + +temperature_above_ground = dataset.select('temperature_2m_above_ground') + +vis_params = { + 'min': -40.0, + 'max': 35.0, + 'palette': ['blue', 'purple', 'cyan', 'green', 'yellow', 'red'], +} + +m = geemap.Map() +m.set_center(71.72, 52.48, 3.0) +m.add_layer(temperature_above_ground, vis_params, 'Temperature Above Ground') +m diff --git a/examples/NOAA/NOAA_VIIRS_DNB_MONTHLY_V1_VCMCFG.py b/examples/NOAA/NOAA_VIIRS_DNB_MONTHLY_V1_VCMCFG.py new file mode 100644 index 000000000..8f3999c27 --- /dev/null +++ b/examples/NOAA/NOAA_VIIRS_DNB_MONTHLY_V1_VCMCFG.py @@ -0,0 +1,12 @@ +dataset = ee.ImageCollection('NOAA/VIIRS/DNB/MONTHLY_V1/VCMCFG').filter( + ee.Filter.date('2017-05-01', '2017-05-31') +) + +nighttime = dataset.select('avg_rad') + +nighttime_vis = {'min': 0.0, 'max': 60.0} + +m = geemap.Map() +m.set_center(-77.1056, 38.8904, 8) +m.add_layer(nighttime, nighttime_vis, 'Nighttime') +m diff --git a/examples/NOAA/NOAA_VIIRS_DNB_MONTHLY_V1_VCMSLCFG.py b/examples/NOAA/NOAA_VIIRS_DNB_MONTHLY_V1_VCMSLCFG.py new file mode 100644 index 000000000..79bed4701 --- /dev/null +++ b/examples/NOAA/NOAA_VIIRS_DNB_MONTHLY_V1_VCMSLCFG.py @@ -0,0 +1,12 @@ +dataset = ee.ImageCollection('NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG').filter( + ee.Filter.date('2017-05-01', '2017-05-31') +) + +nighttime = dataset.select('avg_rad') + +nighttime_vis = {'min': 0.0, 'max': 60.0} + +m = geemap.Map() +m.set_center(-77.1056, 38.8904, 8) +m.add_layer(nighttime, nighttime_vis, 'Nighttime') +m diff --git a/examples/RESOLVE/RESOLVE_ECOREGIONS_2017.py b/examples/RESOLVE/RESOLVE_ECOREGIONS_2017.py new file mode 100644 index 000000000..1573b08e1 --- /dev/null +++ b/examples/RESOLVE/RESOLVE_ECOREGIONS_2017.py @@ -0,0 +1,42 @@ +eco_regions = ee.FeatureCollection('RESOLVE/ECOREGIONS/2017') + +# patch updated colors +color_updates = [ + {'ECO_ID': 204, 'COLOR': '#B3493B'}, + {'ECO_ID': 245, 'COLOR': '#267400'}, + {'ECO_ID': 259, 'COLOR': '#004600'}, + {'ECO_ID': 286, 'COLOR': '#82F178'}, + {'ECO_ID': 316, 'COLOR': '#E600AA'}, + {'ECO_ID': 453, 'COLOR': '#5AA500'}, + {'ECO_ID': 317, 'COLOR': '#FDA87F'}, + {'ECO_ID': 763, 'COLOR': '#A93800'}, +] + +# loop over all other features and create a new style property for styling +# later on +eco_regions = eco_regions.map( + lambda f: f.set({'style': {'color': f.get('COLOR'), 'width': 0}}) +) + +# make styled features for the regions we need to update colors for, +# then strip them from the main asset and merge in the new feature +for i in range(len(color_updates)): + color_updates[i]['layer'] = eco_regions.filterMetadata( + 'ECO_ID', 'equals', color_updates[i]['ECO_ID'] + ).map( + lambda f: f.set( + {'style': {'color': color_updates[i]['COLOR'], 'width': 0}} + ) + ) + + eco_regions = eco_regions.filterMetadata( + 'ECO_ID', 'not_equals', color_updates[i]['ECO_ID'] + ).merge(color_updates[i]['layer']) + +# use style property to color shapes +image_rgb = eco_regions.style(styleProperty='style') + +m = geemap.Map() +m.set_center(16, 49, 4) +m.add_layer(image_rgb, {}, 'RESOLVE/ECOREGIONS/2017') +m diff --git a/examples/SKYSAT/SKYSAT_GEN-A_PUBLIC_ORTHO_MULTISPECTRAL.py b/examples/SKYSAT/SKYSAT_GEN-A_PUBLIC_ORTHO_MULTISPECTRAL.py new file mode 100644 index 000000000..23ff9ae16 --- /dev/null +++ b/examples/SKYSAT/SKYSAT_GEN-A_PUBLIC_ORTHO_MULTISPECTRAL.py @@ -0,0 +1,10 @@ +dataset = ee.ImageCollection('SKYSAT/GEN-A/PUBLIC/ORTHO/MULTISPECTRAL') + +false_color = dataset.select(['N', 'G', 'B']) + +false_color_vis = {'min': 200.0, 'max': 6000.0} + +m = geemap.Map() +m.set_center(-70.892, 41.6555, 15) +m.add_layer(false_color, false_color_vis, 'False Color') +m diff --git a/examples/SKYSAT/SKYSAT_GEN-A_PUBLIC_ORTHO_RGB.py b/examples/SKYSAT/SKYSAT_GEN-A_PUBLIC_ORTHO_RGB.py new file mode 100644 index 000000000..59cfec172 --- /dev/null +++ b/examples/SKYSAT/SKYSAT_GEN-A_PUBLIC_ORTHO_RGB.py @@ -0,0 +1,10 @@ +dataset = ee.ImageCollection('SKYSAT/GEN-A/PUBLIC/ORTHO/RGB') + +rgb = dataset.select(['R', 'G', 'B']) + +rgb_vis = {'min': 11.0, 'max': 190.0} + +m = geemap.Map() +m.set_center(-70.892, 41.6555, 15) +m.add_layer(rgb, rgb_vis, 'RGB') +m diff --git a/examples/UCSB-CHG/UCSB-CHG_CHIRPS_PENTAD.py b/examples/UCSB-CHG/UCSB-CHG_CHIRPS_PENTAD.py new file mode 100644 index 000000000..1c6fffbd8 --- /dev/null +++ b/examples/UCSB-CHG/UCSB-CHG_CHIRPS_PENTAD.py @@ -0,0 +1,16 @@ +dataset = ee.ImageCollection('UCSB-CHG/CHIRPS/PENTAD').filter( + ee.Filter.date('2018-05-01', '2018-05-05') +) + +precipitation = dataset.select('precipitation') + +precipitation_vis = { + 'min': 0, + 'max': 112, + 'palette': ['001137', '0aab1e', 'e7eb05', 'ff4a2d', 'e90000'], +} + +m = geemap.Map() +m.set_center(17.93, 7.71, 2) +m.add_layer(precipitation, precipitation_vis, 'Precipitation') +m diff --git a/examples/UMD/UMD_hansen_global_forest_change_2021_v1_9.py b/examples/UMD/UMD_hansen_global_forest_change_2021_v1_9.py new file mode 100644 index 000000000..6c6782741 --- /dev/null +++ b/examples/UMD/UMD_hansen_global_forest_change_2021_v1_9.py @@ -0,0 +1,20 @@ +dataset = ee.Image('UMD/hansen/global_forest_change_2021_v1_9') + +tree_cover_vis_param = { + 'bands': ['treecover2000'], + 'min': 0, + 'max': 100, + 'palette': ['black', 'green'], +} + +tree_loss_vis_param = { + 'bands': ['lossyear'], + 'min': 0, + 'max': 21, + 'palette': ['yellow', 'red'], +} + +m = geemap.Map() +m.add_layer(dataset, tree_cover_vis_param, 'tree cover') +m.add_layer(dataset, tree_loss_vis_param, 'tree loss year') +m diff --git a/examples/UMD/UMD_hansen_global_forest_change_2022_v1_10.py b/examples/UMD/UMD_hansen_global_forest_change_2022_v1_10.py new file mode 100644 index 000000000..0c6083613 --- /dev/null +++ b/examples/UMD/UMD_hansen_global_forest_change_2022_v1_10.py @@ -0,0 +1,20 @@ +dataset = ee.Image('UMD/hansen/global_forest_change_2022_v1_10') + +tree_cover_vis_param = { + 'bands': ['treecover2000'], + 'min': 0, + 'max': 100, + 'palette': ['black', 'green'], +} + +tree_loss_vis_param = { + 'bands': ['lossyear'], + 'min': 0, + 'max': 22, + 'palette': ['yellow', 'red'], +} + +m = geemap.Map() +m.add_layer(dataset, tree_cover_vis_param, 'tree cover') +m.add_layer(dataset, tree_loss_vis_param, 'tree loss year') +m diff --git a/examples/UMD/UMD_hansen_global_forest_change_2023_v1_11.py b/examples/UMD/UMD_hansen_global_forest_change_2023_v1_11.py new file mode 100644 index 000000000..db20878b7 --- /dev/null +++ b/examples/UMD/UMD_hansen_global_forest_change_2023_v1_11.py @@ -0,0 +1,20 @@ +dataset = ee.Image('UMD/hansen/global_forest_change_2023_v1_11') + +tree_cover_vis_param = { + 'bands': ['treecover2000'], + 'min': 0, + 'max': 100, + 'palette': ['black', 'green'], +} + +tree_loss_vis_param = { + 'bands': ['lossyear'], + 'min': 0, + 'max': 23, + 'palette': ['yellow', 'red'], +} + +m = geemap.Map() +m.add_layer(dataset, tree_cover_vis_param, 'tree cover') +m.add_layer(dataset, tree_loss_vis_param, 'tree loss year') +m diff --git a/examples/USDA/USDA_NAIP_DOQQ.py b/examples/USDA/USDA_NAIP_DOQQ.py new file mode 100644 index 000000000..4a7d75b61 --- /dev/null +++ b/examples/USDA/USDA_NAIP_DOQQ.py @@ -0,0 +1,12 @@ +dataset = ee.ImageCollection('USDA/NAIP/DOQQ').filter( + ee.Filter.date('2017-01-01', '2018-12-31') +) + +true_color = dataset.select(['R', 'G', 'B']) + +true_color_vis = {'min': 0, 'max': 255} + +m = geemap.Map() +m.set_center(-73.9958, 40.7278, 15) +m.add_layer(true_color, true_color_vis, 'True Color') +m diff --git a/examples/USDA/USDA_NASS_CDL.py b/examples/USDA/USDA_NASS_CDL.py new file mode 100644 index 000000000..731902db7 --- /dev/null +++ b/examples/USDA/USDA_NASS_CDL.py @@ -0,0 +1,12 @@ +dataset = ( + ee.ImageCollection('USDA/NASS/CDL') + .filter(ee.Filter.date('2018-01-01', '2019-12-31')) + .first() +) + +crop_landcover = dataset.select('cropland') + +m = geemap.Map() +m.set_center(-100.55, 40.71, 4) +m.add_layer(crop_landcover, {}, 'Crop Landcover') +m diff --git a/examples/USDOS/USDOS_LSIB_SIMPLE_2017.py b/examples/USDOS/USDOS_LSIB_SIMPLE_2017.py new file mode 100644 index 000000000..eab8daee9 --- /dev/null +++ b/examples/USDOS/USDOS_LSIB_SIMPLE_2017.py @@ -0,0 +1,8 @@ +dataset = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017') + +countries = dataset.style(fillColor='b5ffb4', color='00909F', width=3) + +m = geemap.Map() +m.set_center(16.35, 48.83, 4) +m.add_layer(countries, {}, 'USDOS/LSIB_SIMPLE/2017', True, 0.8) +m diff --git a/examples/USGS/USGS_GFSAD1000_V1.py b/examples/USGS/USGS_GFSAD1000_V1.py new file mode 100644 index 000000000..3e0a34011 --- /dev/null +++ b/examples/USGS/USGS_GFSAD1000_V1.py @@ -0,0 +1,14 @@ +dataset = ee.Image('USGS/GFSAD1000_V1') + +crop_mask = dataset.select('landcover') + +crop_mask_vis = { + 'min': 0.0, + 'max': 5.0, + 'palette': ['black', 'orange', 'brown', '02a50f', 'green', 'yellow'], +} + +m = geemap.Map() +m.set_center(-17.22, 13.72, 2) +m.add_layer(crop_mask, crop_mask_vis, 'Crop Mask') +m diff --git a/examples/USGS/USGS_NLCD_RELEASES_2019_REL_NLCD.py b/examples/USGS/USGS_NLCD_RELEASES_2019_REL_NLCD.py new file mode 100644 index 000000000..49b77bec2 --- /dev/null +++ b/examples/USGS/USGS_NLCD_RELEASES_2019_REL_NLCD.py @@ -0,0 +1,20 @@ +# Import the NLCD collection. +dataset = ee.ImageCollection('USGS/NLCD_RELEASES/2019_REL/NLCD') + +# The collection contains images for multiple years and regions in the USA. +display('Products:', dataset.aggregate_array('system:index')) + +# Filter the collection to the 2016 product. +nlcd_2016 = dataset.filter(ee.Filter.eq('system:index', '2016')).first() + +# Each product has multiple bands for describing aspects of land cover. +display('Bands:', nlcd_2016.bandNames()) + +# Select the land cover band. +landcover = nlcd_2016.select('landcover') + +# Display land cover on the map. +m = geemap.Map() +m.set_center(-95, 38, 5) +m.add_layer(landcover, None, 'Landcover') +m diff --git a/examples/USGS/USGS_SRTMGL1_003.py b/examples/USGS/USGS_SRTMGL1_003.py new file mode 100644 index 000000000..dd9d13ac8 --- /dev/null +++ b/examples/USGS/USGS_SRTMGL1_003.py @@ -0,0 +1,8 @@ +dataset = ee.Image('USGS/SRTMGL1_003') +elevation = dataset.select('elevation') +slope = ee.Terrain.slope(elevation) + +m = geemap.Map() +m.set_center(-112.8598, 36.2841, 10) +m.add_layer(slope, {'min': 0, 'max': 60}, 'slope') +m diff --git a/examples/WorldPop/WorldPop_GP_100m_pop.py b/examples/WorldPop/WorldPop_GP_100m_pop.py new file mode 100644 index 000000000..521f9f778 --- /dev/null +++ b/examples/WorldPop/WorldPop_GP_100m_pop.py @@ -0,0 +1,13 @@ +dataset = ee.ImageCollection('WorldPop/GP/100m/pop') + +visualization = { + 'bands': ['population'], + 'min': 0.0, + 'max': 50.0, + 'palette': ['24126c', '1fff4f', 'd4ff50'], +} + +m = geemap.Map() +m.set_center(113.643, 34.769, 7) +m.add_layer(dataset, visualization, 'Population') +m