[Thread Prev][Thread Next][Index]

Re: [ferret_users] Eddy tracking algorithm



Hello Vidya,
                            It may be possible to track eddies using Ferret, but I think that is going to be a
cumbersome process. I have extensive experience on this topic and this is one of the reason
why I switched from Ferret to Matlab for applications which involves serious programming.

      I agree that Ferret is a very user friendly tool and it makes excellent graphics. You could also do
many conventional data processing and analysis with Ferret. However, when it comes to a programming
environment many of Ferret's features make it suboptimal.
 
   There are different eddy tracking methods out there (based on physics, geometry, wavelets and Lagrangian coherent structures). In most of these
methods, including the most popular and comparatively simple method based on the the closed contours
of sea surface height (SSH) anomalies or Okubo-Weiss parameter(W), you have to extract the (x,y)
position of a contour. It is not possible with ferret to retrieve precise (x,y) locations of a contour
(you could use some ad-hoc method to approximate the contour position (please search in Ferret email
Archives) but that is useless for the eddy tracking application). This single limitation itself makes
Ferret a less ideal tool for eddy tracking. In Matlab, you could do it very easily. There are several
other potential problems with Ferret for a programming intensive application such as eddy tracking, few of
them are given below:


1. Delayed mode evaluation
     Ferret evaluates all expressions only when it meets an action command (Ch3 Sec2.  EXPRESSIONS).
     This means that you cannot use expressions like

           let var = var * something_else
    
     One may think this is not a serious problem and a new variable name can be used for such steps.
     But in experience, this is a serious problem. Another aspect is that you cannot use a variable
     name which is already there in any of the opened datasets.

2. Array manipulation
     For modifying values at specific parts of an array, the only option with Ferret is to use some
     IF.....THEN....ELSE statement. Again you cannot use the same variable name again due to 1 above.
     Here is an example. In Fortran:
 
        do I = 24,35
          var(I) = var(I) + var(I)*0.2
        end do
  
     In Ferret, this translates to something like
 
        let var_new = IF I[gx=var] GE 24 AND I[gx=var] LE 35 THEN var+var*0.2 ELSE var  

3. Subroutines vs Ferret external functions
     Did you ever tried to write a Ferret external Function? In my experience, this is one of the most
     difficult aspects of Ferret. A simple straight forward 15-line subroutine in Fortran (or function
     in Matlab) will easily transform to a cumbersome 150-plus lines in Ferret External Function .F
     file. In a Ferret external function, you have four subroutines in the following order: _init,
     _custom_axes, _result_limits, and _compute and it is very difficult to keep track of the array
     indices within the  _compute subroutine.

4. Ferret GO files
     You may be thinking about using a GO file instead of an external function. But expressions within
     a go file is evaluated according to the same rules as that for the main script (the action command
     dependency) and hence points 1 and 2 mentioned above is applicable for GO files too. GO files may
     reduce the number of lines in a Ferret script but it do not bring in any programming efficiency.
     For example, in Matlab, the expressions within a function is evaluated independent of main work
     space variables and expressions and hence you don't have to worry about the variable names used
     within a function. In Ferret, for any reason if you have a variable name within the GO file which
     is same as that used somewhere in the main script or opened datasets, your script will not work
     properly.

5. Structure/type variables
     In Matlab (Fortran90), it is possible to group variable to a "structure" ("type") respectively
     and is very convenient in programming. For example, a structure called grid in matlab can be
     defined as follows:

          grid.lon   = lon   ;
          grid.lat   = lat   ;
          grid.depth = depth ;
          grid.f     = f     ;

     For any function which needs all this variable, you just need to pass the structure "grid", as
         
          out = func_something(grid,..,...,..) ;

     No such grouping is available in Ferret. If you want to pass all these variables to a Ferret
     external function, you have to list all of them. This matlab/fortran90 feature is very helpful
     for applications like eddy tracking (for example, you can group all properties of anticyclones
     to a struct called "anti", like anti.radius, anti.center_x, anti.center_y, anti.area etc.).
    
 
So, my strong suggestion is to use either Fortran or Matlab for such applications (you could still
use Ferret for the graphics and any data processing and manipulation which is possible with Ferret).
I have used Matlab for my eddy tracking work and I am very comfortable with it. I don't know of any fortran
libraries/packages/subroutines to extract contour positions (believe me, this is not an easy task). You could
start from some eddy tracking publications out there to see the details of eddy detection and tracking
methods and then you will be in a better position to find a proper tool for your work. Few publications
are listed below:

http://www.agu.org/pubs/crossref/2007/2007GL030812.shtml
http://www.sciencedirect.com/science/article/pii/S0079661111000036
http://www.agu.org/pubs/crossref/2011/2010JC006895.shtml

If you have any questions, please let me know.

Thanks and Regards

Jaison


On Wed, Sep 28, 2011 at 6:23 AM, vidya pj <pjvidya@xxxxxxxxx> wrote:
Dear Ferreters,

Is it possible to track meso-scale eddies in the ocean using Ferret ??? or any method/algorithm is available????

Thanks in advance,
Vidya


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement