Suppose that I want to calculate the transport across a certain transect (green line) from the outputs of an ocean numerical model. The model has the $u$ values at the center of the grids (crosses) and the $v$ values at the corners (circles), as it uses a C-grid.


Should I use the velocity values closest to the transect? Should I average the values at the corners? Interpolate?

Side question: does anyone know some Matlab toolbox to analyze numerical model outputs?

  • $\begingroup$ How does this question relate to Earth Science? $\endgroup$
    – Fred
    Jul 31, 2017 at 2:48
  • 1
    $\begingroup$ How does numerical modeling relate to Earth Science? $\endgroup$
    – shamalaia
    Jul 31, 2017 at 3:00
  • 6
    $\begingroup$ This question is about modelling of ocean flow (as per the edit to the question) - it seems perfectly on-topic to me. Voting to leave open. $\endgroup$ Jul 31, 2017 at 14:35
  • 3
    $\begingroup$ I do not think that it does boil down to mathematics. It depends on the specific problem. For some applications, it could be acceptable to interpolate, for others it couldn't. $\endgroup$
    – shamalaia
    Aug 1, 2017 at 0:35
  • 3
    $\begingroup$ We tried to start an ocean and atmospheric modeling stackexchange, but it never got enough interest. Too bad. That is the reason we ended here and that is why I feel this kind of question must be on topic. Otherwise, the poor modelers (like me, sort of) would cry $\endgroup$
    – arkaia
    Aug 1, 2017 at 12:57

2 Answers 2


I have been using the routines in nctoolbox (also check here) that do all the slicing (vertical, horizontal, following a track). The repository is in GitHub.

The one you should looking at is vsliceg.m.

You can follow the logic there or develop your own.

  • $\begingroup$ from a quick look, it seems that the script interpolates the values between the grid points? Do you think that it is appropriate? I do not think that we can extract information below the resolution of the model. Otherwise, we would not need to increase the resolution in the first place. I'd prefer to just take the value at the grid point closest to the section. $\endgroup$
    – shamalaia
    Aug 2, 2017 at 0:12
  • $\begingroup$ The issue is that a lot of model solutions use discretizations such as Arakawa-C (en.wikipedia.org/wiki/Arakawa_grids#Arakawa_C-grid) that calculate different fields at different locations and thus interpolation is necessary $\endgroup$
    – arkaia
    Aug 2, 2017 at 0:26

I would:

  1. Compute (U,V) transport on the model's C grid. This is easy if the model returns a batotropic velocity.

  2. Define a set of points S along the transect. The points should have spacing comparable to the model's horizontal resolution.

  3. Interpolate (U,V) transport to S.

  4. Find the component of (U,V) perpendicular to your transect.

  5. Iterate over model outputs.

I can't say much about general numerical processing toolboxes. It looks like there are several for ROMS and MATLAB; google "ROMS toolbox arango" (it has been a long time since I used ROMS).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.