I am new to Google Earth Engine (GEE). Recently I hope to show the ocean bathymetry contour lines by using the ETOPO1 dataset.
Here is my code:
// Import ETOPO1 bathymetry dataset and choose a band.
// ETOPO1 bathymetry dataset details at https://developers.google.com/earth-engine/datasets/catalog/NOAA_NGDC_ETOPO1
var bathy_dataset = ee.Image('NOAA/NGDC/ETOPO1');
var dataset_band = bathy_dataset.select('bedrock');
// Set min, max and interval elevation parameters.
var min_elevation = -2000;
var max_elevation = 2000;
var interval_elevation = 50;
// Generate the contour lines
var lines = ee.List.sequence(min_elevation, max_elevation, interval_elevation)
var contourlines = lines.map(function(line) {
var mycontour = dataset_band
.resample('bicubic')
.convolve(ee.Kernel.gaussian(5, 3))
.subtract(ee.Image.constant(line)).zeroCrossing()
.multiply(ee.Image.constant(line)).toFloat();
return mycontour.mask(mycontour);
})
contourlines = ee.ImageCollection(contourlines).mosaic()
// Add a layer to show the contour lines
Map.addLayer(contourlines, {min: min_elevation, max: max_elevation, palette:['00ff00', 'ff0000']}, 'contours')
However, after running the code, I can only see the contour lines of land, not ocean bathymetry.
I don't know where goes the error. Could you point it out?
Code link here: https://code.earthengine.google.com/437bb62bac2814b8a605d18b140a2a86