Personal tools
You are here: Home CDAT Tutorials Advanced CDAT Scripting Regridding, Masking, Calculating Anomaly
Document Actions

Regridding, Masking, Calculating Anomaly

by Renata McCoy last modified 2008-01-09 14:35
  Table of Contents Previous Next
Contents Previous Next
Goal: The goal for this tutorial is to show how to regrid data from one grid onto another grid, create sea/land mask and mask the data, merge sea and land data, and calculate annual cycle anomaly.

Note:  To run the code you need to have access to the data in the direcory '/pcmdi/PCMDI1/obs/'.

You can download and run the python script  regrid_mask_anomaly.py  or follow the tutorial and type commands at the cdat or python prompt.

We will work with the data from the Climate Research Unit (CRU), University of East Anglia available at http://www.cru.uea.ac.uk/cru/data/   and from ECMWF Re-Analysis ERA40 data.


The objective of this tutorial is to make a similar dataset to the CRU archived annual cycle anomaly dataset.   These data are Sea Surface Temperature (SSTs) over the ocean and 2m temperature (tas) over land and is generally considered to be a very good dataset.  The idea herein is to extract all the separate components (from the ERA40 reanalyses, SSTs and 2m temperatures) and merge these in such a way as to make a very comparable (though from a differing original source) dataset.

The CRU dataset is on a  5-degree grid,  and ERA40 data is on 2m grid (~1.1 deg), hence we will regrid the EAR40 data to the 5 deg grid extracted from CRU dataset, then we will merge the two EAR40 data (sst and tas) masked with ocen/land masks and finally calculate annual cycle anomalies. 

We will save the data in the NetCDF output file that will be written in the current directory (~11MB).


The flowchart of the program is given below, and then the detailed description follows.

 


The detailed strategy:

PART I:

1) read the CRU data temperature anomaly data calles 'temanom'. This is 5 deg gridded data. Get the grid definition from it and also the lat, lon, time and mask definitions that we will use to create the merged data

2) extract ERA40 data: 2-meter surface air temperature ('tas') and sea surface temperature ('sst').  Regrid the data to the 5 degree grid using the grid from 1). 

PART II:

3) read the data with fraction land caverage from which the land/sea mask will be created. Regrid the fraction to the 5-deg grid, create land and sea masks.

4) create sst/tas variables masked with ocean/land maskes .

PART III:

5) merge masked sst  with masked  tas  and create the cdms variable with the lat, lon, time definitions from 1)

6) using  cdutil  create  the annualcyle.climatology  variable and calculate the anomalies

7) create the cdms variable with the anomalies field and lat, lon, time definitions from 1) , apply same as in 1) spatial missing mask , and write the
resulting data to an output NetCDF file.


This tutorial was provided by  Jay Hnilo


  Table of Contents Previous Next
Contents Previous Next

Powered by Plone