jfaghm / OceanEddies

A collection of algorithms to autonomously identify and track mesoscale ocean eddies in sea surface height (SSH) satellite data
93 stars 51 forks source link

Degrees to pixels and back again... #22

Open DanHolstein opened 5 years ago

DanHolstein commented 5 years ago

Hi there. We are trying to use EddyScan to simply draw hulls around eddies in the GOM HYCOM, from SSH. We can get the code to run just fine. Where we're running into trouble is how to visualize the hulls created by EddieScan, as the centroids are in degrees (Lon, Lat), but the other attributes of the hulls are in pixels, which we think are linked to the "area map" - however, it's not clear where the pixel IDs are, or how we could use the output in any way other than in the GUI visualizer. Any thoughts? Many thanks!

jfaghm commented 5 years ago

Dear Dan: Thanks for the note. Unfortunately, I stopped working on this project back in 2015 and have left academia. However, here are a few suggestions and I hope they are helpful. If you resolve the issue, I'd appreciate it if you commented on the GitHub issue so other can benefit:

  1. Forgive me if you already have, but you should check out our paper https://www.nature.com/articles/sdata201528 and associated data https://datadryad.org/resource/doi:10.5061/dryad.gp40h that give more details about what the algorithm returns (and I assume how to plot/view)
  2. From a quick glance, the easiest way to draw a circle or ellipse around the eddy centroid seems to use the lat/lon of each centroid and then draw a circle with the area in the SurfaceArea variable
  3. If I understand correctly, you want to plot the eddy bodies (or just the contours). To do that, you would use the PixelIdList field in the eddy object. This gives you the linear index of the pixels in your eddy (I believe MATLAB has a buil-in function to convert linear indices to 2D indices given the overall grid dimensions such as 700 x 1400). So to plot the eddies, all you have to do is to have a zeros matrix with the size of your entire grid and set the pixels in PixelIdList to 1
  4. Alternatively, depending on what you want to do, we have a mat_to_csv.m function https://github.com/jfaghm/OceanEddies/tree/master/db that takes the eddy tracks and saves them into a CSV for easier analyses.

I hope this helps. Warmly, James

On Tue, Feb 12, 2019 at 1:53 PM DanHolstein notifications@github.com wrote:

Hi there. We are trying to use EddieScan to simply draw hulls around eddies in the GOM HYCOM, from SSH. We can get the code to run just fine. Where we're running into trouble is how to visualize the hulls created by EddieScan, as the centroids are in degrees (Lon, Lat), but the other attributes of the hulls are in pixels, which we think are linked to the "area map" - however, it's not clear where the pixel IDs are, or how we could use the output in any way other than in the GUI visualizer. Any thoughts? Many thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jfaghm/OceanEddies/issues/22, or mute the thread https://github.com/notifications/unsubscribe-auth/ABtHp8hnG8cg2xI8BPoUxrxemu_KEKr8ks5vMzfbgaJpZM4a4IdF .

DanHolstein commented 5 years ago

Wow - thanks for the detailed help! Will happily update the comment on github once we fiddle a bit more.

Cheers! Dan Holstein

Sent from my iPhone

On Feb 12, 2019, at 9:43 PM, jfaghm notifications@github.com wrote:

Dear Dan: Thanks for the note. Unfortunately, I stopped working on this project back in 2015 and have left academia. However, here are a few suggestions and I hope they are helpful. If you resolve the issue, I'd appreciate it if you commented on the GitHub issue so other can benefit:

  1. Forgive me if you already have, but you should check out our paper https://www.nature.com/articles/sdata201528 and associated data https://datadryad.org/resource/doi:10.5061/dryad.gp40h that give more details about what the algorithm returns (and I assume how to plot/view)
  2. From a quick glance, the easiest way to draw a circle or ellipse around the eddy centroid seems to use the lat/lon of each centroid and then draw a circle with the area in the SurfaceArea variable
  3. If I understand correctly, you want to plot the eddy bodies (or just the contours). To do that, you would use the PixelIdList field in the eddy object. This gives you the linear index of the pixels in your eddy (I believe MATLAB has a buil-in function to convert linear indices to 2D indices given the overall grid dimensions such as 700 x 1400). So to plot the eddies, all you have to do is to have a zeros matrix with the size of your entire grid and set the pixels in PixelIdList to 1
  4. Alternatively, depending on what you want to do, we have a mat_to_csv.m function https://github.com/jfaghm/OceanEddies/tree/master/db that takes the eddy tracks and saves them into a CSV for easier analyses.

I hope this helps. Warmly, James

On Tue, Feb 12, 2019 at 1:53 PM DanHolstein notifications@github.com wrote:

Hi there. We are trying to use EddieScan to simply draw hulls around eddies in the GOM HYCOM, from SSH. We can get the code to run just fine. Where we're running into trouble is how to visualize the hulls created by EddieScan, as the centroids are in degrees (Lon, Lat), but the other attributes of the hulls are in pixels, which we think are linked to the "area map" - however, it's not clear where the pixel IDs are, or how we could use the output in any way other than in the GUI visualizer. Any thoughts? Many thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jfaghm/OceanEddies/issues/22, or mute the thread https://github.com/notifications/unsubscribe-auth/ABtHp8hnG8cg2xI8BPoUxrxemu_KEKr8ks5vMzfbgaJpZM4a4IdF .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.