Skip to content

Check Geostrophic_Velocities_from_Sea_Level.ipynb#707

Open
julia-neme wants to merge 3 commits into
COSIMA:mainfrom
julia-neme:jn-geos-vels
Open

Check Geostrophic_Velocities_from_Sea_Level.ipynb#707
julia-neme wants to merge 3 commits into
COSIMA:mainfrom
julia-neme:jn-geos-vels

Conversation

@julia-neme

@julia-neme julia-neme commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

This one was comparing geostrophic surface velocities from sea level to those of the first cell instead of usurf vsurf, but otherwise OK. I've also updated intake loading.

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@julia-neme julia-neme mentioned this pull request Jul 6, 2026
37 tasks
@review-notebook-app

review-notebook-app Bot commented Jul 16, 2026

Copy link
Copy Markdown

View / edit / reply to this conversation on ReviewNB

anton-seaice commented on 2026-07-16T02:00:18Z
----------------------------------------------------------------

Have you tested this with MOM6 ?

I guess you also need to get the right combination of

      dxCu: # dxCu is delta x at u points [L ~> m]

      dyCu: # dyCu is delta y at u points [L ~> m]

      dxCv: # dxCv is delta x at v points [L ~> m]

      dyCv: # dyCv is delta y at v points [L ~> m]

instead of dxu and dyu

it looks like uo and vo are 3d fields as well ?


julia-neme commented on 2026-07-20T02:49:38Z
----------------------------------------------------------------

True! I can replace with SSU and SSV,but I don't think they're available for any run. I'll add the caveat.

And regarding the right combination, since discovering that I can use .derivative() you don't need to think about combining interp and diff, so I might change the script to use that.

(see comment below)

anton-seaice commented on 2026-07-20T03:27:41Z
----------------------------------------------------------------

I think using .derivative would calculate quanitites at the cell centre, so the model velocities need to be interpolated to cell centres then?

SSU and SSV are just the top layer in uo and vo right? So it's ok to use them, just note it in the table ?

@review-notebook-app

review-notebook-app Bot commented Jul 16, 2026

Copy link
Copy Markdown

View / edit / reply to this conversation on ReviewNB

anton-seaice commented on 2026-07-16T02:00:20Z
----------------------------------------------------------------

Why id boundary = 'extend' ?

I think boundary = None might work


@review-notebook-app

review-notebook-app Bot commented Jul 19, 2026

Copy link
Copy Markdown

View / edit / reply to this conversation on ReviewNB

anton-seaice commented on 2026-07-19T23:31:51Z
----------------------------------------------------------------

can these two lines be combined ?

variable=['dxu','dyu']

these are just merged below anyway ?


julia-neme commented on 2026-07-20T02:47:29Z
----------------------------------------------------------------

I wanted that yes! But intake only opened one of them. So I had to open 1by1 and merge.

@review-notebook-app

review-notebook-app Bot commented Jul 19, 2026

Copy link
Copy Markdown

View / edit / reply to this conversation on ReviewNB

anton-seaice commented on 2026-07-19T23:31:52Z
----------------------------------------------------------------

Line #2.    detadx = grid.interp(grid.diff(ds['sea_level'], 'X', boundary='extend'), 'Y', boundary='extend') / ds['dxu']

It's a bit hard to follow this, but it looks like this:

  1. takes the diff of the 'sea_level' field. This should interpolate to the middle of the top face.
  2. interpolates those to the middle of the cell
  3. then divides by the dxu - but surely dxu is the width of the top face?

shouldn't step 3 be either:

a. divide by dxt - the width across the middle of the cell, or

b. moved to between steps 1 and 2

(Assuming B-grid)

This calculation presumably would need changing for C-grid, to get rid of the .interp ?


anton-seaice commented on 2026-07-19T23:59:12Z
----------------------------------------------------------------

Hangon - i dont have that correct, ill revisit

anton-seaice commented on 2026-07-20T01:00:17Z
----------------------------------------------------------------

sea_level is a tracer/center point quantity, so this:

  1. takes a diff across two center points to get the quantity in the middle of a face,
  2. interpolates across two middle of face quantities to get the cell corner
  3. divides by the width/length of the corner cell

so that is correct for B-grid,

julia-neme commented on 2026-07-20T02:48:10Z
----------------------------------------------------------------

Maybe I should change this to use the .derivative() function instead!

Copy link
Copy Markdown
Collaborator

Hangon - i dont have that correct, ill revisit


View entire conversation on ReviewNB

@review-notebook-app

review-notebook-app Bot commented Jul 20, 2026

Copy link
Copy Markdown

View / edit / reply to this conversation on ReviewNB

anton-seaice commented on 2026-07-20T00:51:13Z
----------------------------------------------------------------

@charles-turner-1 - this only works on older intake-catalogs, the new ones gives this error:

ESMDataSourceError: Failed to load dataset with key='ocean.fx.xu_ocean:3600.yu_ocean:2700.point'
                 You can use cat['ocean.fx.xu_ocean:3600.yu_ocean:2700.point'].df to inspect the assets/files for this key.


anton-seaice commented on 2026-07-20T01:05:57Z
----------------------------------------------------------------

I think there is a workaround for this already ?

charles-turner-1 commented on 2026-07-20T02:49:58Z
----------------------------------------------------------------

Yeah, there should be - in fact, I think it should already be in the newest environments.

I’ll double check when I’m off the plane. The code needs a more sophisticated fix anyway which is already on the todo list

Copy link
Copy Markdown
Collaborator

sea_level is a tracer/center point quantity, so this:

  1. takes a diff across two center points to get the quantity in the middle of a face,
  2. interpolates across two middle of face quantities to get the cell corner
  3. divides by the width/length of the corner cell

so that is correct for B-grid,


View entire conversation on ReviewNB

Copy link
Copy Markdown
Collaborator

I am not sure what to do for C-grid / MOM6

This recipe calculates the geostrophic velocities at the cell corner (b-grid) point and compares to model speed at the cell corner.

So for C-grid, to calculate speed, should we also interpolate to the model velocities to the corner point to calculate speed?

Copy link
Copy Markdown
Collaborator

I think there is a workaround for this already ?


View entire conversation on ReviewNB

Copy link
Copy Markdown
Collaborator Author

I wanted that yes! But intake only opened one of them. So I had to open 1by1 and merge.


View entire conversation on ReviewNB

Copy link
Copy Markdown
Collaborator Author

So no change needed?


View entire conversation on ReviewNB

Copy link
Copy Markdown
Collaborator Author

True! I can replace with SSU and SSV,but I don't think they're available for any run. I'll add the caveat.

And regarding the right combination, since discovering that I can use .derivative() you don't need to think about combining interp and diff, so I might change the script to use that.

(see comment below)


View entire conversation on ReviewNB

Copy link
Copy Markdown
Collaborator

Yeah, there should be - in fact, I think it should already be in the newest environments.

I’ll double check when I’m off the plane. The code needs a more sophisticated fix anyway which is already on the todo list


View entire conversation on ReviewNB

Copy link
Copy Markdown
Collaborator

I think using .derivative would calculate quanitites at the cell centre, so the model velocities need to be interpolated to cell centres then?

SSU and SSV are just the top layer in uo and vo right? So it's ok to use them, just note it in the table ?


View entire conversation on ReviewNB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants