0

I have not been able to figure out why the dataset I load does not appear in the chart I created in Google Earth Engine. I am new to GEE and JavaScript in general, so I may be missing something obvious. I created a buffer that I want the data pulled from and show up in the chart. I also have two charts created for different time periods in the dataset. A few data points show up for the "winter chart" but none in the "summer chart".

   var dataset = ee.ImageCollection("OSU/GIMP/ICE_VELOCITY_OPT");
   var midgard = ee.Geometry.Polygon(
    [[[-37.32658582874774, 66.895336960199],
      [-37.32658582874774, 66.37689364195774],
      [-35.69511610218524, 66.37689364195774],
      [-35.69511610218524, 66.895336960199]]], null, false);
    var red = ee.Geometry.Point([-36.838012316827125, 
    66.40520627951635])
    
    //Winter speed
    var wMagnitude = dataset.filter(ee.Filter.date('1985-10-01', '2016-05-31'))
    .filter(ee.Filter.calendarRange(10, 5, 'month'))
    .filterBounds(midgard);
    function clip (image){
    return image.clip(midgard);}
   var clipped = wMagnitude.map(clip);
   var wSpeed = clipped.map (function(image){
   var winterIceSpeed = image.expression(
   'sqrt (x**2+y**2)',{
   'x': image.select('velocity_x'),
   'y': image.select('velocity_y')
   }).rename('winterSpeed')
   .log10();
   var time = image.get('system:time_start');
  return winterIceSpeed.set ('system:time_start', time);});
  var vizParamsMag = {transparency: '0.5',
  min: 1,
  max: 3.7,
  palette:['FFFFFF','f98686','FCD163','0dca00','08c6ff','5600ff','f904f1','803034']
  };
 Map.setCenter(-36.63,66.49, 8); 
 print(wSpeed,'Winter speed');
 Map.addLayer(wSpeed, vizParamsMag,'winterSpeed');
 
 //Summer Speed
 var sMagnitude =dataset
 .filter(ee.Filter.date('1985-06-01', '2016-09-30'))
 .filter(ee.Filter.calendarRange(6,9,'month'))
 .filterBounds(midgard);
 function clip (image){
 return image.clip(midgard);}
 var clipped2 = sMagnitude.map(clip);
 var sSpeed = clipped2.map (function(image){
 var summerIceSpeed = image.expression(
 'sqrt (x**2+y**2)',{
  'x': image.select('velocity_x'),
  'y': image.select('velocity_y')
  }).rename('summerSpeed')
 .log10();
 var time2 = image.get('system:time_start');
 return summerIceSpeed.set ('system:time_start', time2);});
 var vizParamsMag2 = {transparency: '0.5',
 min: 1,
 max: 3.7,
 palette:['FFFFFF','f98686','FCD163','0dca00','08c6ff','5600ff','f904f1','803034']
 };
 print (sSpeed,'summer speed');
 Map.addLayer(sSpeed, vizParamsMag2, 'Summer speed');
 
 // red Buffer
 var redBuffer = [ee.Feature(red)]; print (redBuffer,'redbuffer');
 var redBuffered = ee.FeatureCollection(redBuffer);
 var rBuffered = redBuffered.map(function(f) {
 return f.buffer(1500);  
 });
 Map.addLayer(rBuffered, {color: 'red'}, 'redbuffer');
 
//red buffer charts
//clipping to collection for winter and summer
var wRedClipCollection = wSpeed.map(function(img){return img.clipToCollection(rBuffered)});
var sRedClipCollection = sSpeed.map(function(img){return img.clipToCollection(rBuffered)});
print (wRedClipCollection,'winterRedBufferClipped'); 
print(sRedClipCollection,'summerRedBufferClipped');

//creating the chart for winter of red buffer
var wRedBufferChart =
 ui.Chart.image
     .seriesByRegion({
       imageCollection: wRedClipCollection,
       band: 'winterSpeed',
       regions: midgard,
      reducer: ee.Reducer.mean(),
      scale: 30,
      seriesProperty: 'label',
      xProperty: 'system:time_start'
    })
    .setOptions({
      title: 'Winter Ice Speed at Red Buffer',
      hAxis: {title: 'Date', titleTextStyle: {italic: false, bold: true}},
      vAxis: {
        title: 'Winter Ice Speed',
        titleTextStyle: {italic: false, bold: true}
      },
      lineWidth: 5,
      colors: ['f0af07', '0f8755', '76b349'],
    });
  print(wRedBufferChart);
//creating the chart for summer of red buffer
var sRedBufferChart =
ui.Chart.image
    .seriesByRegion({
      imageCollection: sRedClipCollection,
      band: 'summerSpeed',
      regions: midgard,
      reducer: ee.Reducer.mean(),
      scale: 30,
      seriesProperty: 'label',
      xProperty: 'system:time_start'
    })
    .setOptions({
      title: 'Summer Ice Speed at Red Buffer',
      hAxis: {title: 'Date', titleTextStyle: {italic: false, bold: true}},
      vAxis: {
        title: 'Summer Ice Speed',
        titleTextStyle: {italic: false, bold: true}
      },
      lineWidth: 5,
      colors: ['f0af07', '0f8755', '76b349'],
    });
   print(sRedBufferChart);
   
  

1 Answer 1

0

Not sure but don't you want to plot the timeseries for the redPointBuffer? I assume that is a point on your glacier so I manually placed a point. Then you have a full time series: https://code.earthengine.google.com/19aaa0c685ed580fcf81bace61334761

Else you probably have to provide the location for your feature Red (it isn't defined in your example)

1
  • My bad, I forgot to include that in my example, but I did have a point for the red buffer. I edited the example
    – Leah
    Commented Nov 19, 2021 at 3:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.