Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
spatialthoughts committed Aug 6, 2024
1 parent 9af5649 commit 9fa6a2f
Show file tree
Hide file tree
Showing 23 changed files with 289 additions and 234 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ var now = ee.Date(now);
// from the past 1-month whenever you run the script
// Hint: Use ee.Date.advance() function
// to compute the date 1 month before now
var filtered = s2.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 30))
var filtered = s2
.filter(ee.Filter.bounds(geometry))
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
var admin2 = ee.FeatureCollection("FAO/GAUL_SIMPLIFIED_500m/2015/level2"),
s2 = ee.ImageCollection("COPERNICUS/S2_HARMONIZED");
/***** End of imports. If edited, may not auto-convert in the playground. *****/
var filteredAdmin2 = admin2.filter(ee.Filter.eq('ADM2_NAME', 'Bangalore Urban'));
var filteredAdmin2 = admin2
.filter(ee.Filter.eq('ADM2_NAME', 'Bangalore Urban'))
.filter(ee.Filter.eq('ADM1_NAME', 'Karnataka'));

var geometry = filteredAdmin2.geometry();
Map.centerObject(geometry);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
var s2 = ee.ImageCollection('COPERNICUS/S2_HARMONIZED');
var admin2 = ee.FeatureCollection('FAO/GAUL_SIMPLIFIED_500m/2015/level2');

var filteredAdmin2 = admin2.filter(ee.Filter.eq('ADM2_NAME', 'Bangalore Urban'));
var filteredAdmin2 = admin2
.filter(ee.Filter.eq('ADM2_NAME', 'Bangalore Urban'))
.filter(ee.Filter.eq('ADM1_NAME', 'Karnataka'));
var geometry = filteredAdmin2.geometry();
Map.centerObject(geometry);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
var s2 = ee.ImageCollection('COPERNICUS/S2_HARMONIZED');
var admin2 = ee.FeatureCollection('FAO/GAUL_SIMPLIFIED_500m/2015/level2');

var filteredAdmin2 = admin2.filter(ee.Filter.eq('ADM2_NAME', 'Bangalore Urban'));
var filteredAdmin2 = admin2
.filter(ee.Filter.eq('ADM2_NAME', 'Bangalore Urban'))
.filter(ee.Filter.eq('ADM1_NAME', 'Karnataka'));
var geometry = filteredAdmin2.geometry();
Map.centerObject(geometry);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var filteredS2 = s2.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 30))
.filter(ee.Filter.bounds(geometry));

var composite = filteredS2.median();
Map.addLayer(composite, rgbVis, 'Admin1 Composite');
Map.addLayer(composite.clip(geometry), rgbVis, 'Admin1 Composite');

// This function calculates both NDVI and NDWI indices
// and returns an image with 2 new bands added to the original image.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ Map.addLayer(classified.clip(geometry), {min: 0, max: 3, palette: palette}, '201
// bands is to use {'.default': 'mode'}

// assetId should be specified as a string
// Lookup your asset root name from the 'Assets' tab
// If it is 'users/username', you can specify the id as
// 'users/username/classified_image'
// It can be just the asset name 'classified_image'
// or a full path such as 'projects/ee-<yourusername>/classified_image'

11 changes: 8 additions & 3 deletions code/end_to_end_gee/Assignments/Assignment2
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ var geometry = ee.Geometry.Point([77.54849920033682, 12.91215102400037]);
// to obtain the actual temparature value

// map() a function and multiply each image

var tmax = terraclimate.select('tmmx');

// Function that applies the scaling factor to the each image

// Multiplying creates a new image that doesn't have the same properties
// Use copyProperties() function to copy timestamp to new image
var tmax = terraclimate.select('tmmx')
var tmaxScaled = tmax.map(function(image) {
var scaleImage = function(image) {
return image.multiply(0.1)
.copyProperties(image,['system:time_start']);
})
};
var tmaxScaled = tmax.map(scaleImage);

// Hint2
// You will need to specify pixel resolution as the scale parameter
Expand Down
6 changes: 5 additions & 1 deletion code/end_to_end_gee/Assignments/Assignment3
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
// 1. Add relevant indicies
// 2. Add cloud masking
// 3. Add elevation and slope
// 4. Normalize the data
// 4. Normalize the data

// [Optional]
// Accuracy Assessment
// Post-processing Classification
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ var L7 = L7
.select(l7Bands,l7names);

var L8 = L8
.filterDate(ee.Filter.date('2013-05-01', '2099-01-01')) // Images before May 1 had some pointing issues.
.filter(ee.Filter.date('2013-05-01', '2099-01-01')) // Images before May 1 had some pointing issues.
.filter(ee.Filter.neq('NADIR_OFFNADIR', 'OFFNADIR'))
.filter(ee.Filter.lt('WRS_ROW', 122)) // Remove night-time images.
.map(maskL8sr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
// 2. Animation: Create a video with a frame for each band

var s2 = ee.ImageCollection('COPERNICUS/S2_HARMONIZED');

// You may delete and draw a polygon at any region
// in the world
var geometry = ee.Geometry.Polygon([[
[77.57018, 12.96010],
[77.57018, 12.93953],
Expand All @@ -27,7 +30,7 @@ var bandsToUse = bands.remove('B10');

// Tip: change the bandsToUse variable to a smaller list
// such as ['B1', 'B2', 'B3', 'B4] to create shorter
// filmstrips and repeat for other bands
// filmstrips and repeat for other set of bands

// map() a function on the list of bands
var bandCol = ee.ImageCollection(bandsToUse.map(function(band) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ var now = ee.Date(now);
// from the past 1-month whenever you run the script
// Hint: Use ee.Date.advance() function
// to compute the date 1 month before now
var filtered = s2.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 30))
var filtered = s2
.filter(ee.Filter.bounds(geometry))
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
var admin2 = ee.FeatureCollection("FAO/GAUL_SIMPLIFIED_500m/2015/level2"),
s2 = ee.ImageCollection("COPERNICUS/S2_HARMONIZED");
/***** End of imports. If edited, may not auto-convert in the playground. *****/
var filteredAdmin2 = admin2.filter(ee.Filter.eq('ADM2_NAME', 'Bangalore Urban'));
var filteredAdmin2 = admin2
.filter(ee.Filter.eq('ADM2_NAME', 'Bangalore Urban'))
.filter(ee.Filter.eq('ADM1_NAME', 'Karnataka'));

var geometry = filteredAdmin2.geometry();
Map.centerObject(geometry);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
var s2 = ee.ImageCollection('COPERNICUS/S2_HARMONIZED');
var admin2 = ee.FeatureCollection('FAO/GAUL_SIMPLIFIED_500m/2015/level2');

var filteredAdmin2 = admin2.filter(ee.Filter.eq('ADM2_NAME', 'Bangalore Urban'));
var filteredAdmin2 = admin2
.filter(ee.Filter.eq('ADM2_NAME', 'Bangalore Urban'))
.filter(ee.Filter.eq('ADM1_NAME', 'Karnataka'));
var geometry = filteredAdmin2.geometry();
Map.centerObject(geometry);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
var s2 = ee.ImageCollection('COPERNICUS/S2_HARMONIZED');
var admin2 = ee.FeatureCollection('FAO/GAUL_SIMPLIFIED_500m/2015/level2');

var filteredAdmin2 = admin2.filter(ee.Filter.eq('ADM2_NAME', 'Bangalore Urban'));
var filteredAdmin2 = admin2
.filter(ee.Filter.eq('ADM2_NAME', 'Bangalore Urban'))
.filter(ee.Filter.eq('ADM1_NAME', 'Karnataka'));
var geometry = filteredAdmin2.geometry();
Map.centerObject(geometry);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var filteredS2 = s2.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 30))
.filter(ee.Filter.bounds(geometry));

var composite = filteredS2.median();
Map.addLayer(composite, rgbVis, 'Admin1 Composite');
Map.addLayer(composite.clip(geometry), rgbVis, 'Admin1 Composite');

// This function calculates both NDVI and NDWI indices
// and returns an image with 2 new bands added to the original image.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ Map.addLayer(classified.clip(geometry), {min: 0, max: 3, palette: palette}, '201
// bands is to use {'.default': 'mode'}

// assetId should be specified as a string
// Lookup your asset root name from the 'Assets' tab
// If it is 'users/username', you can specify the id as
// 'users/username/classified_image'
// It can be just the asset name 'classified_image'
// or a full path such as 'projects/ee-<yourusername>/classified_image'

11 changes: 8 additions & 3 deletions docs/code/end_to_end_gee/Assignments/Assignment2
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ var geometry = ee.Geometry.Point([77.54849920033682, 12.91215102400037]);
// to obtain the actual temparature value

// map() a function and multiply each image

var tmax = terraclimate.select('tmmx');

// Function that applies the scaling factor to the each image

// Multiplying creates a new image that doesn't have the same properties
// Use copyProperties() function to copy timestamp to new image
var tmax = terraclimate.select('tmmx')
var tmaxScaled = tmax.map(function(image) {
var scaleImage = function(image) {
return image.multiply(0.1)
.copyProperties(image,['system:time_start']);
})
};
var tmaxScaled = tmax.map(scaleImage);

// Hint2
// You will need to specify pixel resolution as the scale parameter
Expand Down
6 changes: 5 additions & 1 deletion docs/code/end_to_end_gee/Assignments/Assignment3
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
// 1. Add relevant indicies
// 2. Add cloud masking
// 3. Add elevation and slope
// 4. Normalize the data
// 4. Normalize the data

// [Optional]
// Accuracy Assessment
// Post-processing Classification
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ var L7 = L7
.select(l7Bands,l7names);

var L8 = L8
.filterDate(ee.Filter.date('2013-05-01', '2099-01-01')) // Images before May 1 had some pointing issues.
.filter(ee.Filter.date('2013-05-01', '2099-01-01')) // Images before May 1 had some pointing issues.
.filter(ee.Filter.neq('NADIR_OFFNADIR', 'OFFNADIR'))
.filter(ee.Filter.lt('WRS_ROW', 122)) // Remove night-time images.
.map(maskL8sr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
// 2. Animation: Create a video with a frame for each band

var s2 = ee.ImageCollection('COPERNICUS/S2_HARMONIZED');

// You may delete and draw a polygon at any region
// in the world
var geometry = ee.Geometry.Polygon([[
[77.57018, 12.96010],
[77.57018, 12.93953],
Expand All @@ -27,7 +30,7 @@ var bandsToUse = bands.remove('B10');

// Tip: change the bandsToUse variable to a smaller list
// such as ['B1', 'B2', 'B3', 'B4] to create shorter
// filmstrips and repeat for other bands
// filmstrips and repeat for other set of bands

// map() a function on the list of bands
var bandCol = ee.ImageCollection(bandsToUse.map(function(band) {
Expand Down
4 changes: 2 additions & 2 deletions docs/code/gdal/mastering_gdal_tools.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyOKwMiSI7qkVGWyFyAy/ezy"
"authorship_tag": "ABX9TyMtS4+8gZQGSOsydHQ7mqm7"
},
"kernelspec": {
"name": "python3",
Expand Down Expand Up @@ -152,7 +152,7 @@
"\n",
"\n",
"data_pkg_zip = 'gdal-tools.zip'\n",
"data_url = 'https://github.com/spatialthoughts/courses/releases/download/gdal/'\n",
"data_url = 'https://github.com/spatialthoughts/courses/releases/download/data/'\n",
"\n",
"\n",
"download(data_url + data_pkg_zip)"
Expand Down
Loading

0 comments on commit 9fa6a2f

Please sign in to comment.