Git Product home page Git Product logo

empirical_orthogonal_functions's Introduction

Empirical Orthogonal Functions in Matlab (now a jupyter notebook version)

Matlab functions to compute the empirical orthogonal function (EOF) and its complex version (CEOF).

Getting started eof.m:

clear all; close all; clc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% code to compute 15 first modes of EOF from monthly data %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

xi = ncread('input.nc','data');

lon = ncread('input.nc','longitude');

lat = ncread('input.nc','latitude');

[yy xx] = meshgrid(lat,lon);

time = double(datenum('2000-01-15')+ncread('input.nc','time')*30);

[eof pc expvar] = eof(xi,15);

figure;

subplot(5,1,[1 2 3 4]); pcolor(xx,yy,squeeze(eof(:,:,1))); shading interp; colormap jet; caxis([-1 1]*0.5);

title('1^{st} EOF of data')

subplot(5,1,5); plot(time,pc(1,:)); datetick('x','yyyy')

title('1^{st} PC of data')

alt text

Getting started ceof.m:

clear all; close all; clc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% code to compute 15 first modes of EOF from monthly data %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

xi = ncread('input.nc','data');

lon = ncread('input.nc','longitude');

lat = ncread('input.nc','latitude');

[yy xx] = meshgrid(lat,lon);

time = double(datenum('2000-01-15')+ncread('input.nc','time')*30);

[camp cpha tamp tpha expvar] = ceof(xi,15);


figure;
subplot(5,2,[1 3 5 7]); pcolor(xx,yy,squeeze(camp(:,:,1))); shading interp; colormap jet; caxis([-1 1]*0.5); colorbar
title('1^{st} amplitude of CEOF from data')
subplot(5,2,[2 4 6 8]); pcolor(xx,yy,squeeze(cpha(:,:,1))); shading interp; colormap jet; caxis([-1 1]*pi); colorbar
title('1^{st} phase of CEOF from data')

subplot(5,2,9); plot(time,tamp(1,:)); datetick('x','yyyy')
title('1^{st} amplitude of complex PC from data')
subplot(5,2,10); plot(time,tpha(1,:)); datetick('x','yyyy')
title('1^{st} phase of complex PC from data')

alt text

empirical_orthogonal_functions's People

Contributors

fecampos avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

mdtocean 0xlitf

empirical_orthogonal_functions's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.