Geographic Information Systems Asked on December 13, 2020
I am writing a script to extract the time series soil moisture values from SMAP soil moisture data using point shapefile and plot it on a line graph in the google earth engine. As SMAP having the daily data coverage but I am getting the pixel values three days interval. Please can anyone tell me where is the wrong with my code and addition to that I want to extract the time information also along with date and export it as csv to drive,
Below code, i am working
#Point shape file i uploaded, if i can add manually coordinate, please tell me (Not from geomarty addition)
var shp=ee.FeatureCollection('users/SWAT/C01');
// which dataset + where + when
var imageCollection = ee.ImageCollection('NASA_USDA/HSL/SMAP_soil_moisture')
.filterBounds(shp)
.filterDate('2018-01-01','2020-08-30');
// select bands -> ssm = surface soil moisture (%)
var soilmoisture = imageCollection.select('smp');
// gget scale
var scale = imageCollection.first().projection().nominalScale();
// Take average
var imageCollection = imageCollection.map(function(image){
return ee.Image(image.setMulti(image.reduceRegion(ee.Reducer.mean(), shp, scale)));
});
// Get the mean from the dictionary and print it.
var means = imageCollection.aggregate_array('smp');
print('Soil Moisture (%)', means);
// put in a chart
print(ui.Chart.image.seriesByRegion(imageCollection, shp, ee.Reducer.mean(), 'smp', scale));
// Get the mean from the dictionary and print it.
var meanDict = soilmoisture.mean().reduceRegion(ee.Reducer.mean(), shp, scale);
print('Soil Moisture (%)', meanDict);
Map.centerObject(shp, 10);
Map.addLayer(soilmoisture, {min: 0, max: 1}, 'soilmoister imageCollection');
I would refer to this link and see if it helps get you started:
https://developers.google.com/earth-engine/guides/charts_image_series
Code from link:
// Load Landsat 8 top-of-atmosphere (TOA) input imagery.
var collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA').select('B[1-7]');
// Define a region of interest as a buffer around a point.
var geom = ee.Geometry.Point(-122.08384, 37.42503).buffer(500);
// Create and print the chart.
print(ui.Chart.image.series(collection, geom, ee.Reducer.mean(), 30));
You can export the time series from there.
Also some more in depth coverage here:
https://spatialthoughts.com/2020/04/13/extracting-time-series-ee/
Answered by eorland on December 13, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP