Saturday, 4 March 2017

Downloading NASA Earth Exchange Global Daily Downscaled Projections for single lat lon


I have a lat lon - 23.14, 83.14 and I need to download the NASA Earth Exchange Global Daily Downscaled Projections (NEX-GDDP) data from the below website only for this lat lon. I am looking to download the Tmax.



https://developers.google.com/earth-engine/datasets/catalog/NASA_NEX-DCP30_ENSEMBLE_STATS


I have not worked with Earth Engine before.


How do I go about extract and saving the daily time series of Tmax for this particular lat lon?



Answer



@jdbcode has a very nice implementation to extract the time series. However, there are 26 images per day for the different climate models that are used. The reduction is only giving you one climate model (and don't know which one). Here is an example to extract the tasmax data for all climate models over you area of interest.


// specify start and end date
var startDate = ee.Date('1990-01-01');
var endDate = ee.Date('1991-01-01');

// get the dataset between date range and extract band on interest

var dataset = ee.ImageCollection('NASA/NEX-GDDP')
.filter(ee.Filter.date(startDate,endDate));
var maximumAirTemperature = dataset.select('tasmax');

// get projection information
var proj = maximumAirTemperature.first().projection();

var point = ee.Geometry.Point([-23.14, 83.14]);

// calculate number of days to map and extract data for

var n = endDate.difference(startDate,'day').subtract(1);

// map over each date and extract all climate model values
var timeseries = ee.FeatureCollection(
ee.List.sequence(0,n).map(function(i){
var t1 = startDate.advance(i,'day');
var t2 = t1.advance(1,'day');
var feature = ee.Feature(point);
var dailyColl = maximumAirTemperature.filterDate(t1, t2);
var dailyImg = dailyColl.toBands();

// rename bands to handle different names by date
var bands = dailyImg.bandNames();
var renamed = bands.map(function(b){
var split = ee.String(b).split('_');
return ee.String(split.get(0)).cat('_').cat(ee.String(split.get(1)));
});
// extract the data for the day and add time information
var dict = dailyImg.rename(renamed).reduceRegion({
reducer: ee.Reducer.mean(),
geometry: point,

scale: proj.nominalScale()
}).combine(
ee.Dictionary({'system:time_start':t1.millis(),'isodate':t1.format('YYYY-MM-dd')})
);
return ee.Feature(point,dict);
})
);
print(timeseries);

// get properties to chart (all climate models)

var props = timeseries.first().propertyNames().removeAll(['system:time_start','system:index','isodate']);

// Make a chart of the results.
var chart = ui.Chart.feature.byFeature(timeseries, 'system:time_start', props.getInfo());
print(chart);

Map.addLayer(point);
Map.centerObject(point,6);

// export feature collection to CSV

Export.table.toDrive({
collection: timeseries,
description: 'NEX-GDDP-timeseries',
fileFormat: 'CSV',
});

Code link: https://code.earthengine.google.com/b0303657856fd0434385b3dfe298ed1b


Keep in mind that beginning of 2006 the NEX-GDDP data switches from historic data to climate forecasts with 42 bands per day (21 climate models with 2 scenarios). So, the bands name change which will affect the export columns. You will probably have to export up to 2006 for historic then export again after 2006....


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...