Roxy Cdo Ferret Lecture Data Analysis

24
247.21 244.83 242.70 240.88 239.51 238.76 238.52 238.58 238.68 238.82 238.99 239.18 239.17 238.95 238.78 238.42 238.04 237.71 237.43 237.33 237.53 238.16 239.29 240.95 243.37 245.92 248.69 251.52 252.06 257.99 260.38 262.42 263.97 265.29 265.57 266.06 265.64 264.20 263.74 263.20 262.42 261.77 261.32 260.99 260.78 260.71 260.72 261.14 261.53 261.57 263.04 263.72 264.30 265.09 265.23 264.64 264.52 263.75 261.33 259.16 257.07 255.06 252.64 249.88 245.79 244.97 244.23 243.53 242.89 242.34 241.87 241.45 241.12 240.87 240.69 240.56 240.47 240.42 240.41 240.45 240.55 240.71 240.96 241.32 241.75 242.28 242.88 243.58 244.34 245.15 J> 243.53 242.89 242.34 241.87 241.45 J> 264.64 264.52 263.75 261.33 259.16 A> 264.20 263.74 263.20 262.42 261.77 S> 237.33 237.53 238.16 239.29 240.95 CDO Ferret ==== Analyze and Visualize ==== Data Analysis and Visualizing using CDO and Ferret IITM-CAT, Feb 2013 Roxy Mathew :: CCCR/IITM

Transcript of Roxy Cdo Ferret Lecture Data Analysis

Page 1: Roxy Cdo Ferret Lecture Data Analysis

2 4 7 . 2 1 2 4 4 . 8 3 2 4 2 . 7 0 2 4 0 . 8 8 2 3 9 . 5 1 2 3 8 . 7 62 3 8 . 5 2 2 3 8 . 5 8 2 3 8 . 6 8 2 3 8 . 8 2 2 3 8 . 9 9 2 3 9 . 1 82 3 9 . 1 7 2 3 8 . 9 5 2 3 8 . 7 8 2 3 8 . 4 2 2 3 8 . 0 4 2 3 7 . 7 12 3 7 . 4 3 2 3 7 . 3 3 2 3 7 . 5 3 2 3 8 . 1 6 2 3 9 . 2 9 2 4 0 . 9 52 4 3 . 3 7 2 4 5 . 9 2 2 4 8 . 6 9 2 5 1 . 5 2 2 5 2 . 0 6 2 5 7 . 9 92 6 0 . 3 8 2 6 2 . 4 2 2 6 3 . 9 7 2 6 5 . 2 9 2 6 5 . 5 7 2 6 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

J > 2 4 3 . 5 3 2 4 2 . 8 9 2 4 2 . 3 4 2 4 1 . 8 7 2 4 1 . 4 5

J > 2 6 4 . 6 4 2 6 4 . 5 2 2 6 3 . 7 5 2 6 1 . 3 3 2 5 9 . 1 6

A > 2 6 4 . 2 0 2 6 3 . 7 4 2 6 3 . 2 0 2 6 2 . 4 2 2 6 1 . 7 7

S > 2 3 7 . 3 3 2 3 7 . 5 3 2 3 8 . 1 6 2 3 9 . 2 9 2 4 0 . 9 5

CDO

Ferret

1. Data Analysis and Visualization in Scientific Research

2. Data Attributes, Formats and netCDF

3. Common Tools for Data Analysis and Visualization

4. Introduction to CDO and Ferret

5. Data Analysis using CDO

6. Graphic Visualization using Ferret

7. Reference and Assignments

IITM-CAT, Feb 2013Roxy Mathew :: CCCR/IITM

Page 3: Roxy Cdo Ferret Lecture Data Analysis

Dealing with Data

“If we can use and reuse scientific data better, the opportunities are myriad”.

www.sciencemag.org www.sciencemag.org

Lot of Data,What to do? How to do?

Who will do?!

Do you want to make it easy? faster?

Page 4: Roxy Cdo Ferret Lecture Data Analysis

Dealing with Data

Data in Scientific Research

Climatological Analysis

Time series Analysis

Extended Analysis:

Winter SST Summer SST

Page 5: Roxy Cdo Ferret Lecture Data Analysis

Attributes of the DataDefines attributes of the data sets used, e.g. resolution (x,y,t), coverage (spatial scale).

1. Where do the data come from? • direct sampling of atmos /ocean/ surface • derived from remote sensing • model

2. What geographic area does your data/model cover?• Eg: Indian Ocean? Monsoon region?

3. What time period does your data/model cover?• June-September? Which years?

4. What is the area your variable measured over (resolution of your grid boxes)?• Regional processes captured?

Page 6: Roxy Cdo Ferret Lecture Data Analysis

Attributes of the Data

netcdf file.nc {

dimensions:

lon = 192 ;

lat = 96 ;

lev = 1 ;

time = UNLIMITED ; // (10 currently)

variables:

double lon(lon) ;

lon:long_name = "longitude" ;

lon:units = "degrees_east" ;

double lat(lat) ;

lat:long_name = "latitude" ;

lat:units = "degrees_north" ;

double lev(lev) ;

lev:long_name = "pressure" ;

lev:units = "Pa" ;

double time(time) ;

time:units = "day as %Y%m%d.%f" ;

float q(time, lev, lat, lon) ;

q:long_name = "specific humidity" ;

q:units = "kg/kg" ;

q:code = 133 ;

q:table = 128 ;

q:grid_type = "gaussian" ;

// global attributes:

:CDO = "Climate Data Operators version 0.9.5 " ;

:source = "ECHAM5.2" ;

:institution = "Max-Planck-Institute for Meteorology" ;

}

Basic netcdf utility, ncdump:

ncdump –h file.nc

Page 7: Roxy Cdo Ferret Lecture Data Analysis

Attributes of the Data

Describes strengths / limitations of data sets or models used.

1. Why was data set or model selected? • "It was available at the data server" ??• "My professor told me to use it“ ??!

2. How accurate are the data? • Are they equally accurate in all parts of the world

under all conditions? • What factors may impact confidence in the data?

3. What kind of analysis/techniques are you going to do?

Page 8: Roxy Cdo Ferret Lecture Data Analysis

2 4 7 . 2 1 2 4 4 . 8 3 2 4 2 . 7 0 2 4 0 . 8 8 2 3 9 . 5 1 2 3 8 . 7 62 3 8 . 5 2 2 3 8 . 5 8 2 3 8 . 6 8 2 3 8 . 8 2 2 3 8 . 9 9 2 3 9 . 1 82 3 9 . 1 7 2 3 8 . 9 5 2 3 8 . 7 8 2 3 8 . 4 2 2 3 8 . 0 4 2 3 7 . 7 12 3 7 . 4 3 2 3 7 . 3 3 2 3 7 . 5 3 2 3 8 . 1 6 2 3 9 . 2 9 2 4 0 . 9 52 4 3 . 3 7 2 4 5 . 9 2 2 4 8 . 6 9 2 5 1 . 5 2 2 5 2 . 0 6 2 5 7 . 9 92 6 0 . 3 8 2 6 2 . 4 2 2 6 3 . 9 7 2 6 5 . 2 9 2 6 5 . 5 7 2 6 6 . 0 62 6 5 . 6 4 2 6 4 . 2 0 2 6 3 . 7 4 2 6 3 . 2 0 2 6 2 . 4 2 2 6 1 . 7 72 6 1 . 3 2 2 6 0 . 9 9 2 6 0 . 7 8 2 6 0 . 7 1 2 6 0 . 7 2 2 6 1 . 1 42 6 1 . 5 3 2 6 1 . 5 7 2 6 3 . 0 4 2 6 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2 3 9 . 2 9 2 4 0 . 9 5

CDO

Ferret

Page 10: Roxy Cdo Ferret Lecture Data Analysis

CDO – Climate Data Operators

CDO is a collection of operators to manipulate and analyze climate and forecast model data.- Max-Planck-Institute for Meteorology

Current officially released version is cdo 1.5.9https://code.zmaw.de/projects/cdo

Supported file formats: GRIB 1/2, netCDF 3/4, srv, ext, and ieg

Supported grid types: rectangular, curvilinear and unstructured

Page 11: Roxy Cdo Ferret Lecture Data Analysis

Installing CDO

bash$ tar -xvf cdo.tar

bash$ cd cdo

bash$ ./configure --with-netcdf=/usr/local/lib

bash$ make install

Page 12: Roxy Cdo Ferret Lecture Data Analysis

Magic Word*

* Usage: cdo , That’s all!

bash$ cdo <options> <operator> input.nc out.nc

This is all you need to know about CDO

Page 13: Roxy Cdo Ferret Lecture Data Analysis

OperatorsThere are more than 600 operators available.

Categories Description Example

File information Print information about datasets

cdo sinfo file.nc

File operations Copy, split and merge datasets cdo mergetime f1995.nc f1996.nc out.nc

Selection Select parts of a dataset cdo seldate,1996-06-15 f1996.nc out.nc

Comparison Compare datasets cdo eq

Modification Modify datasets

Arithmetic Arithmeticly process datasets cdo add f1995.nc f1996.nc out.nc

Statistical values

Ensemble, field, vertical and time statistic

cdo monmean input.nc out.nc

Regression Detrend of time series

Interpolation Field, vertical and time interpolation

Transformation Spectral transformationetc.

Page 14: Roxy Cdo Ferret Lecture Data Analysis

Global options for all operators:

-h Help information for the operatorsEg: cdo -h <operator>

-f <format> Format of the output file (grb, nc, srv, ext, ieg)Eg: cdo -f nc copy input.grb out.nc

-m <missval> Set the default missing value (default: -9e+33)

-a Converts from relative to absolute time axisEg: cdo -a -f nc copy input.grb out.nc

-r Converts from absolute to relative time axisEg: cdo -r -f nc copy input.grb out.nc

Page 15: Roxy Cdo Ferret Lecture Data Analysis

Eg: Annual Cycle of precipitation

Step by Step:bash$ cdo sellonlatbox,75,85,10,15 input.nc out_box.nc

bash$ cdo fldmean out_box.nc out_box_fldmean.nc

bash$ cdo ymonmean out_box_fldmean.nc out_box_ymonmean.nc

Piping:bash$ cdo ymonmean –fldmean -sellonlatbox,75,85,10,15

input.nc out_box_ymonmean.nc

Page 16: Roxy Cdo Ferret Lecture Data Analysis

Piping Reduces unnecessary disk I/O Parallel processing

Eg: Standard deviation of JJAS precipitation anomalies

Step by Step:bash$ cdo selmon,6,7,8,9 input.nc out_jjas.nc

bash$ cdo timmean out_jjas.nc out_jjas_mean.nc

bash$ cdo sub out_jjas.nc out_jjas_mean.nc out_jjas_anom.nc

bash$ cdo timstd out_jjas_anom.nc out_jjas_std.nc

Piping:bash$ cdo –timstd -sub - selmon,6,7,8,9 input.nc

-timmean –selmon,6,7,8,9 input.nc out_jjas_std.nc

Page 17: Roxy Cdo Ferret Lecture Data Analysis

Arithmetic example: sqr, sqrt

wind speed = √(u2 + v2)

Step by Step:bash$ cdo sqr uwind.nc uwind_sqr.nc

bash$ cdo sqr vwind.nc vwind_sqr.nc

bash$ cdo add uwind_sqr.nc vwind_sqr.nc wind_add.nc

bash$ cdo sqrt wind_add.nc wind_spd.nc

Piping:bash$ cdo sqrt -add -sqr uwind.nc -sqr vwind.nc wind_spd.nc

Page 18: Roxy Cdo Ferret Lecture Data Analysis

Indexes

Eg:ECAR20MM

- Very heavy precipitation days index per time period

bash$ cdo eca_r20mm input.nc output.nc

Page 19: Roxy Cdo Ferret Lecture Data Analysis

Ferret

Ferret is an interactive visualization and analysis environment for gridded and non-gridded data- PMEL/NOAA

Current officially released version is Ferret 6.84http://www.ferret.noaa.gov

Supported file formats: netCDF, binary, ascii, etc.

Page 20: Roxy Cdo Ferret Lecture Data Analysis

Installing and running Ferret

Download tarfiles:fer_executables.tar.gz (Ferret and utilities)fer_environment.tar.gz (support files)fer_dsets.tar.gz (sample data sets)

Follow the procedures given at the Ferret website:untar the downloaded files and run installation file

bash$ ferretyes?

Page 21: Roxy Cdo Ferret Lecture Data Analysis

Visualizing your processed data in Ferret

Let’s use the data processed by CDO, for monsoon precip.: out_jjas_mean.nc

bash$ ferret

yes? set data out_jjas_mean.nc !open file

yes? show data !will show the details of the file.

yes? fill precip !plot variable

yes? go land !draw land bounds

yes? quit

Page 22: Roxy Cdo Ferret Lecture Data Analysis

Ferret Usage

Attributes Command Example

1D plot plot yes? plot sst_ann_cyc

2D plot shade/fillcontourvector

yes? fill sst_jjas

yes? contour/overlay precip_jjas

yes? vector/overlay u_jjas,v_jjas

Overlay /overlay

Land go landgo fland

yes? go land

Label label x,y,centre,angle,size text yes? label 50,85,0,0,12 “SST”

Others levelslimits:

x=40:120/y=-20:50hlimits=40:120/vlimits=-20:50time=01-jun-2000

color palettepalette=grey_scale

yes? fill/levels=(10,30,1) sst_jjas

yes? fill/x=40:120/y=-20:30 sst_jjas

yes? vector/overlay/k=1 u_jjas,v_jjas

yes? fill/pal=grey_scale sst_jjas

Page 23: Roxy Cdo Ferret Lecture Data Analysis

Saving your plots in Ferret

Let’s use the data processed by CDO, for monsoon precip.: out_jjas_mean.nc

yes? frame/file=filename.gif

Alternatively, you can save images as postscript file

using the metafile options in ferret.

Before plotting:

yes? set mode metafile

After plotting:

yes? cancel mode metafile

yes? sp Fprint –o filename.ps metafile.plt

Page 24: Roxy Cdo Ferret Lecture Data Analysis

Reference and Assignments