Here by this function I can download the monthly data for a particular month. What I need is getting a CSV file which will have monthly value for all pixels(377 in my case) in a single CSV.
If that's not possible a function to download monthly data CSV files for 31 years.
Currently I have to modify this line
var dataset = data.filter(ee.Filter.date('2001-12-01', '2001-12-30'));
to get the values for all pixels for a single month and manually edit the above line for the next month and so on and make file operation manually in my PC.
Sharing the entire code
var dataset = data.filter(ee.Filter.date('2001-12-01', '2001-12-30'));
var soilMoisture = dataset.select('pr');
var soilMoistureVis = {
//min: 0.0,
//max: 28.0,
min: 250,
max: 700,
palette: ['0300ff', '418504', 'efff07', 'efff07', 'ff0303'],
};
var rgbVis = {
bands: ['B11', 'B8', 'B3'],
min: 0,
max: 3000
};
var total = soilMoisture.reduce(ee.Reducer.sum());
var totalRanchi = total.clip(ranchi);
var stats = total.reduceRegion({
reducer: ee.Reducer.mean(),
geometry: ranchi,
scale: 5000,
})
var count_px = total.reduceRegion({
reducer: ee.Reducer.count(),
geometry: ranchi,
scale: 5000,
})
print("Total Pixel = ",count_px.get('pr_sum'));
print("Amount = ",stats.get('pr_sum'))
Map.centerObject(ranchi);
//Map.addLayer(total, soilMoistureVis, 'Soil Moisture');
var vectors = totalRanchi.sample({
region: ranchi,
geometries: true,
scale: 5000,// if you want points
});
print(vectors);
Map.addLayer(ranchi,rgbVis, "Ranchi")
Map.addLayer(vectors, soilMoistureVis, "Vectors");
//Map.addLayer(totalRanchi, soilMoistureVis, "Ranchi_Region");
Export.table.toDrive({
collection: vectors,
folder: 'earthengine_pr',
fileNamePrefix: 'vec_',
fileFormat: 'CSV'}) ```
A similar question was answered here: https://gis.stackexchange.com/questions/312547/make-a-loop-for-monthly-ndvi-in-google-earth-engine
Basically you want to map your calculation and export for every month in your date range. Your code doesn't have data so I can't give you a full example, but the answer in the link above should be enough to get you started. If you run into any errors, leave a comment and I can try and help you out.