I defined a polygon
var polygon = ee.Geometry.Polygon([114, 0.37, 114, 2.04, 112, 2.04, 112, 0.37]);
and a dataset that needs to be processed for the above polygon
var dataset = ee.ImageCollection('NASA/NEX-GDDP');
for a selected date
var startDate = ee.Date('1980-01-01');
var endDate = ee.Date('1980-01-02');
The dataset has 3 bands pr
, tasmax
and tasmin
and I am selecting the one that I need to process
var dataset = ee.ImageCollection('NASA/NEX-GDDP')
.filter(ee.Filter.date(startDate,endDate))
.filter(ee.Filter.bounds(polygon))
.select('tasmax');
Map.addLayer(dataset)
I want to export the data for all the grids falling under the polygon along with their respective lat long. Since there are 21 features (GCMs) for a single day, I am expecting the final data to have number rows equal to number of grids in polygon X 21 features (GCMs)
var dailyImg = dataset.toBands();
Export.table.toDrive({
collection: dailyImg,
description: 'hist_tx',
fileFormat: 'CSV',
});
When I try to do this, I get an error
Error: Invalid argument: 'collection' must be a FeatureCollection.
How can I solve this? In addition, even after restricting my spatial area to the polygon, the map still displays the data for the entire globe? Why is this happening?