You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the m2section routine, used to extract a section (defined in the sections.in file) from the model and export the data to netCDF, possible arguments include rotation options. Two are listed:
-rotll to rotate vectors to lat/lon (or northward/eastward) components; and
-rotnormal to rotate vectors to the section normal and tangential components.
However, the -rotnormal option is not implemented yet, see snippet below:
This means that users will currently need to rotate to normal using their code of choice in their analysis. This isn't a difficult task, but would be much easier if done in the m2section routine, especially if the bearing between the start and end points isn't known to the user.
A potential solution:
I am not yet confident in the mathematics of vectors and my knowledge thereof is limited, so my way of solving this might be rudimentary. In fact, this is how I would do it using the vector components if given in lat/lon rotation:
I would first calculate the vector magnitude using Pythagoras from the east/north components.
Then I would calculate direction relative to north (0 degrees) from the components using the arctan and some if-statements to determine its cartesian quadrant.
Add the relative degrees for the quadrant that the vector is in.
Then I would calculate the angle between my section start and end points (if I don't already know it).
Add or subtract this angle to the vector directions.
Decompose the vectors into components relative to the new direction.
There are probably much smoother ways to do this using vector mathematics which I am not familiar with.
@lbertino pointed out that this rotation must also be sensitive to the fact that connected subsections (also defined in the sections.in file) will likely consist of 'multiple normals', so to speak---each subsection could have a unique bearing between start and end points. So a unique rotation to normal is required for each subsection. This could require some work considering that the subsections are already joined using the sections_join subroutine when the section_intersect program is automatically called within m2section.
The text was updated successfully, but these errors were encountered:
Thanks for throwing the ball, @HarryLuyt. On second thought, the section plot was intended for qualitative validation against moorings, which are often providing Northwards/Eastwards current measurements. But then I also agree that looking at normal currents across the section makes sense intuitively, but it does not need to care for conservation of mass like the transports routine does, so you can take the vector joining the beginning and the end of the section and rotate the vector as in this formula https://www.mathworks.com/help/phased/ref/rotz.html
Test it out for easy values of the angle (zero, 90 deg).
Then I could not help noticing the question about the section001.dat and transport001.dat files. These were the output files in the old times before we used NetCDF. The output was ASCII files intended for Tecplot. I think it should be OK to remove all that.
In the
m2section
routine, used to extract a section (defined in the sections.in file) from the model and export the data to netCDF, possible arguments include rotation options. Two are listed:-rotll
to rotate vectors to lat/lon (or northward/eastward) components; and-rotnormal
to rotate vectors to the section normal and tangential components.However, the
-rotnormal
option is not implemented yet, see snippet below:NERSC-HYCOM-CICE/hycom/MSCPROGS/src/Section/p_section_plot.F90
Lines 152 to 168 in d0f744e
This means that users will currently need to rotate to normal using their code of choice in their analysis. This isn't a difficult task, but would be much easier if done in the
m2section
routine, especially if the bearing between the start and end points isn't known to the user.A potential solution:
I am not yet confident in the mathematics of vectors and my knowledge thereof is limited, so my way of solving this might be rudimentary. In fact, this is how I would do it using the vector components if given in lat/lon rotation:
There are probably much smoother ways to do this using vector mathematics which I am not familiar with.
@lbertino pointed out that this rotation must also be sensitive to the fact that connected subsections (also defined in the sections.in file) will likely consist of 'multiple normals', so to speak---each subsection could have a unique bearing between start and end points. So a unique rotation to normal is required for each subsection. This could require some work considering that the subsections are already joined using the
sections_join
subroutine when thesection_intersect
program is automatically called withinm2section
.The text was updated successfully, but these errors were encountered: