IMD Temperature Data Interpolation in Google Earth Engine

IMD Temperature Data Interpolation in Google Earth Engine

To perform spatial interpolation using kriging for temperature data in Google Earth Engine (GEE), let’s break down this script, step by step. This approach is powerful for environmental monitoring, as it allows estimation of values at unmeasured locations using data from known points.

Step 1: Importing Data and Calculating the Mean Temperature

We start with a Collection of temperature images, from which we want to extract temperature data (b1 band) over a specified roi (region of interest). The mean() function calculates the average temperature at each pixel location over the collection’s time period.

var temperature = Collection.select('b1').mean().clip(roi);        

This line:

  • Selects the temperature band (b1) from mergedCollection,
  • Computes the mean value per pixel across all images in the collection,
  • Clips the output to our roi.

Step 2: Visualizing the Mean Temperature

We define visualization parameters, specifying the color palette, data range, and coordinate reference system (CRS).

var palettes = require('users/gena/packages:palettes');
var visParam = {
  crs: 'EPSG:4326',
  min: 31,
  max: 34,
  palette: palettes.kovesi.rainbow_bgyr_35_85_c72[7]
};
Map.addLayer(temperature, visParam, 'Mean Temperature');        

Here:

  • The palette is chosen to visually distinguish between temperature ranges.
  • We set min and max temperature values to map colors accurately across the data.

Step 3: Defining a Grid of Points for Kriging

Kriging requires points with known values as input. We create a structured grid of points within our study area using a specified longitude and latitude range.

var x = ee.List.sequence(80, 90.0, 0.25);  // Longitude range and step
var y = ee.List.sequence(16, 25, 0.25);    // Latitude range and step
        
var gridPoints = ee.FeatureCollection(x.map(function(xcor) {
  return y.map(function(ycor) {
    return ee.Feature(ee.Geometry.Point([xcor, ycor]));
  });
}).flatten());
Map.addLayer(gridPoints, {color: 'black'}, 'Grid Points');        

This generates a grid covering the region with points spaced at 0.25 degrees and displays them on the map in black.

Step 4: Sampling Temperature at Each Grid Point

Using reduceRegions, we sample the mean temperature at each grid point from the temperature layer. This operation reduces data over regions (here, points) and assigns each point a mean temperature value.

var samples = temperature.reduceRegions({
  collection: gridPoints,
  reducer: ee.Reducer.mean(),
  scale: 1000,
  crs: 'EPSG:4674'
});        

  • scale specifies the spatial resolution for sampling.
  • crs ensures sampling occurs in a consistent coordinate system.

To finalize, we set the temperature value to a property called 'temp' and filter out points without valid temperature data.

samples = samples.map(function(feature) {
  var temp = feature.get('mean');
  return feature.set('temp', temp).setGeometry(feature.geometry());
}).filter(ee.Filter.notNull(['temp']));
Map.addLayer(samples, {color: 'blue'}, 'Sampled Grid Points with Temperature');        

Step 5: Applying Kriging Interpolation

Now that we have temperature data at each grid point, we apply kriging, a geostatistical method that predicts values for unsampled locations based on the spatial autocorrelation structure of the data.

var kriging = samples.kriging({
  propertyName: 'temp',
  shape: 'gaussian',       // Shape of the variogram model
  range: 100000,           // Maximum range of spatial correlation (in meters)
  sill: 1.0,               // Variogram sill (variance of the variable)
  nugget: 0.1,             // Variogram nugget (measurement error or small-scale variation)
  maxDistance: 100000,     // Maximum distance for neighborhood search
  reducer: 'mean'
});        

Key parameters in kriging:

  • propertyName: Specifies the property (temperature) used in interpolation.
  • shape: Chooses a Gaussian variogram model (alternatives include exponential or spherical).
  • range, sill, and nugget: Control the model’s spatial structure, with range being the distance over which points influence each other.
  • maxDistance: Limits search radius, optimizing computation.
  • reducer: Aggregates the interpolated values.

Step 6: Visualizing Kriged Temperature Data

The kriged output is clipped to roi and visualized using the same color palette as before for consistent interpretation.

Map.addLayer(kriging.clip(roi), visParam, 'Temperature - Kriging');        

Final Output

This script generates a continuous temperature surface over the study region, using kriging to predict temperature across areas where we don’t have direct measurements. This is especially useful for environmental applications where data is sparse, allowing for temperature pattern analysis and supporting climate-related studies.

Summary

  1. Mean Temperature Calculation: Aggregate temperature over a time period.
  2. Grid Definition: Set up a structured grid to systematically sample temperature data.
  3. Temperature Sampling: Collect temperature data at each grid point.
  4. Kriging Interpolation: Generate a continuous temperature surface.
  5. Visualization: Display both raw and interpolated data for easy comparison.

This approach is practical for any region with sparse measurement points and is applicable to other geospatial interpolation needs by simply adjusting parameters.


?? More insights & projects: pulakeshpradhan.github.io


要查看或添加评论,请登录

Pulakesh Pradhan的更多文章

社区洞察

其他会员也浏览了