robynsb / interactive-track-and-trace

BSD 2-Clause "Simplified" License
0 stars 3 forks source link

The Us and Vs might be flipped around - investigate #9

Closed robynsb closed 6 months ago

robynsb commented 6 months ago

There are some inconsistencies.

In the .h5 files

In hydrodynamic_V.h5 the header information says "zonal_velocity". In hydrodynamic_U.h5 the header information says "meridional_velocity".

Wikipedia

For what it's worth, wikipedia says

For vector fields (such as wind velocity), the zonal component (or x-coordinate) is denoted as u, while the meridional component (or y-coordinate) is denoted as v.

NetCDF files

The .nc files in the header information say that vo is "Northward Current Velocity in the Water Column" and uo is "Eastward Current Velocity in the Water Column".

Parcels

In advection.py in Parcels, us affect longitude and vs affect latitude.

Experimentally

For what it's worth, I'm currently using us to affect latitude and vs to affect longitude and the outputs look good.

Conclusion - What is the problem?

The original data uses u to mean Eastward Velocity (== affects latitude == x == zonal velocity) however parcels uses u to mean affects longitude (== Northward Velocity == y == meridional velocity).

I suspect that Christian mixed this up as a result when converting the NetCDF files because to me it seems that the us in the hdf5 data are actually indicating zonal velocity and this means that the hdf5 headers are named incorrectly.

CKehl commented 6 months ago

Comment 1: Latitude = North-South ( https://en.wikipedia.org/wiki/Latitude ) = y Longitude = East-West ( https://en.wikipedia.org/wiki/Longitude ) = x

Comment 2: "Zonal flow follows a pattern along latitudinal lines, latitudinal circles or in the west–east direction." -> Zonal flow occurs along a fixed latitude (i.e. a line at a given latitude), 'along' meaning here: "on that line". So, this should be U. (I need to correct the H5-description).

"Meridional flow follows a pattern from north to south, or from south to north, along the Earth's longitude lines, longitudinal circles (meridian) or in the north–south direction." -> Meridional flow occurs along a meridian (i.e. a fixed longitude - a line along a meridian, with a meridian always having the same x-coordinate; see the Greenich zero-meridian). So, this should be V. (I need to correct the H5-description).

Suggestion: Now, to check what is what, I suggest the following: a) post here please the coordinates of your test-cases. I'll quickly run them today or tomorrow through parcels, and give you the reference trajectory. b) Maybe please look again on the major-order of your loaded array and your looped indexing. Maybe you switched x- and y indices during your loop, or reading in a column-major order field [time][y][x] as row-major order field [x][y][time] ? This could easily happen sometimes with the memory map.

robynsb commented 6 months ago

Comment 1: Latitude = North-South ( https://en.wikipedia.org/wiki/Latitude ) = y Longitude = East-West ( https://en.wikipedia.org/wiki/Longitude ) = x

Ah!! This explains part of my confusion. I was looking at this image and the arrows totally confused me. image

A reference trajectory would be greatly appreciated. I tried some more values looking for a good trajectory and I found one that gives me quite strange results so there is definitely still something not right with my implementation.

Please can you send me trajectory for start latitude = 54.832040 and start longitude = 6.187572?

robynsb commented 6 months ago

b) Maybe please look again on the major-order of your loaded array and your looped indexing. Maybe you switched x- and y indices during your loop, or reading in a column-major order field [time][y][x] as row-major order field [x][y][time] ? This could easily happen sometimes with the memory map

I think I indeed found an error here that seems to have cleared up at least one problem. So thank you for this!