I have 2 high-resolution images in Google Earth Engine. I want to plot a scatter between these 2 images. But I am getting some error Missing required arguments to function seriesByRegion(): reducer. I don't know how to correct this (or if this is due to the images).

First I imported geometry and my Image:

var RZSC = ee.Image("users/chandrakant/Max_RZSC_Layer_Trail_3"),
    geometry = /* color: #d6cbbb */ee.Geometry.Polygon(
        [[[-81.375, -56.125],
          [-34.625, -56.125],
          [-34.625, 12.625],
          [-81.375, 12.625]]]);

Then I visulatized the Image

var vizParams = {
  bands: ['b1'],
  min: 0.0,
  max: 1500.0,
  palette: ['blue', 'green', 'red']
Map.setCenter(6.746, 46.529, 10);
Map.addLayer(RZSC.clip(geometry), vizParams, 'Rootzone Storage Capacity');
print('RZSC Projection, crs, and crs_transform:', RZSC.projection());

Visualized my MODIS image

var MODIStc = ee.ImageCollection('MODIS/051/MOD44B')
                  .filter(ee.Filter.date('2000-01-01', '2017-12-01')).mean();
var percentTreeCover = MODIStc.select('Percent_Tree_Cover');
var percentTreeCoverVis = {
  min: 0.0,
  max: 100.0,
  palette: ['bbe029', '0a9501', '074b03'],
Map.setCenter(6.746, 46.529, 2);
Map.addLayer(percentTreeCover.clip(geometry), percentTreeCoverVis, 'Percent Tree Cover');
print('MOD44B Projection, crs, and crs_transform:', percentTreeCover.projection());
\\Here I added Water Mask
var waterOcc = ee.Image("JRC/GSW1_0/GlobalSurfaceWater").select('occurrence'),
    jrc_data0 = ee.Image("JRC/GSW1_0/Metadata").select('total_obs').lte(0),
    waterOccFilled = waterOcc.unmask(0).max(jrc_data0),
    waterMask = waterOccFilled.lt(50);

Here I reprojected the image (RZSC) at 250 m

\\Here I tried to increase the resolution from 25km to 250m    
var RZSC_250m = RZSC.resample('bilinear').reproject({
  crs: RZSC.projection().crs(),
  scale: 250
Map.addLayer(RZSC_250m.clip(geometry).updateMask(waterMask), vizParams, 'RZSC_250m');
print('RZSC_250m Projection, crs, and crs_transform:', RZSC_250m.projection());

enter image description here

Tried a scatterplot here

\\Tried to plot scatterplot here (I want just the basic scatter plot between 2 variables)
var chart = ui.Chart.image.seriesByRegion(RZSC, MODIStc, 
                ee.Reducer.mean(),250, 'nd').setChartType('ScatterChart');

The error I get: Error generating chart: Collection.map, argument 'collection': Invalid type. Expected: FeatureCollection. Actual: Image<[Percent_Tree_Cover]>. and Collection.map, argument 'collection': Invalid type. Expected: FeatureCollection. Actual: Image<[Percent_Tree_Cover]>.

Additional information: Also, I don't know why, but the dimensions of MODIStc and RZSC_250m are different. For MODIStc:

bands: List (1 element)
0: "Percent_Tree_Cover", double ∈ [0, 255], EPSG:4326, 48x73 px
id: Percent_Tree_Cover
crs: EPSG:4326
crs_transform: [1,0,0,0,1,0]
data_type: double ∈ [0, 255]
dimensions: [48,73]
origin: [-82,-59]

For RZSC_250m:

bands: List (1 element)
0: "b1", float, EPSG:4326, 20818x28371 px
id: b1
crs: EPSG:4326
crs_transform: List (6 elements)
data_type: float
dimensions: [20818,28371]
origin: [-36235,-6107]

Also, when I try to use reproject on MODIStc, the data looks smoothed and weird (a lot of details are lost). enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.