Git Product home page Git Product logo

hycomtracker's Introduction

HycomTracker

Demonstration MATLAB code for particle tracking with HYCOM model output posted to THREDDS Data Servers (TDS). The default url is http://tds.hycom.org/thredds/dodsC/GLBa0.08/expt_91.1/2015.

nctoolbox

This code uses nctoolbox to access and extract variables from urls. You can get nctoolbox from https://github.com/nctoolbox/nctoolbox. Either download as a zip file or clone in Desktop. Then, add the path to MATLAB and run the setup code, something like:

addpath('/nctoolbox')
setup_nctoolbox; 

There are 3 main codes:

  • HycomTrackerPrep - Builds velocity arrays and fake HYCOM grid. Default subregion is Caribbean and Gulf of Mexico, surface velocities. The default HYCOM URL is http://tds.hycom.org/thredds/dodsC/GLBa0.08/expt_91.1/2015

  • HycomTrackerIC - Generates initial particle locations. Default is a square patch off the TX/MEX border. User can edit/enhance as needed.

  • HycomTracker - This converts lon/lat coords to cartesian, calls drog2ddt, and inverts the projected particle locations back to lon/lat.

There are other supporting codes that handle grid structures and coordinate projections.

Run in MATLAB.

% First step: generate the velocity arrays from HYCOM and fake HYCOM/finite element grid.  
% http://tds.hycom.org/thredds/dodsC/GLBa0.08/expt_91.1/2015
[V,G]=HycomTrackerPrep;

% Then, build initial condition/locations:

IC=HycomTrackerIC;

% Pass to drog2ddt, through HycomTracker handler:
R=HycomTracker(V,G,IC);

% Then, make plots of R.lon and R.lat, etc...
% Subtract 360 from longitude to get it in the range -180->180; note the transpose.
url='http://tds.hycom.org/thredds/dodsC/GLBa0.08/expt_91.1/2015';
plot(R.lon'-360,R.lat')       % plot the trajectories
axis('equal')
line(R.lon(:,1)-360,R.lat(:,1),'Marker','.','Color','k','LineStyle','none')    % plot the initial positions
% plot some coastline data, if you have it.  If you have the mapping toolbox, then:
c=load('coast');   % note that this data is already in the range -180->180
line(c.long,c.lat,'Color','k')
axis([-99 -75 16 34])
title({'Trajectories in HYCOM Surface Velocity',url,[datestr(V(1).time,2) ' thru ' datestr(V(end).time,2) ]},'Interpreter','none')

Here's an example plot:

TestImage1

hycomtracker's People

Contributors

brianoblanton avatar

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.