ArgoCanada / argoFloats

Tools for analyzing collections of oceanographic Argo floats
https://argocanada.github.io/argoFloats/index.html
17 stars 7 forks source link

mapApp should be able to subset by polygon #545

Closed j-harbin closed 2 years ago

j-harbin commented 2 years ago

Currently mapApp() can only subset by rectangle. It shouldn't be too hard for me to add in a subset by polygon which would simply have the user click around the area of interest (similar to the locator function). What are your thoughts on this @dankelley (after the workshop, of course)

dankelley commented 2 years ago

I do select-by-polygon in my own work. I don't imagine wanting to use mapApp for it, though, because I am very "picky" about the polygon. I compute the polygon by very carefully clicking on a big plot. Then I save the polygon for later use. For example, I might make a polygon that goes between two depth contours, and I might use it later to select for downloading profile data.

There are some technical issues in doing this in mapApp but you might want to try it, I suppose. Some things that come to mind are

  1. How does the user indicate the end of the polygon? Double-clicking, maybe?

  2. Can the user undo a mistake? (I usually make mistakes, and what I do is to follow a bad click by a click that is very far from the data. Then I write a program to go through the polygon, removing those far-away data and also the point before.)

  3. How does the user save the polygon? And how do they load it back in later?

Basically, though, the question is why to do this. The point of the select-by-rectangle is to zoom the plot. If they select a polygon, it would be easy to find the lon and lat limits and then use that for the zoom. I think it all comes down to what mapApp is used for.

As you know, I have an alternative to mapApp, which I use in my own work. It is more inclined to science than to making pretty things. For example, I don't have (and am not planning to create) the ability for the user to change symbols or do anything like that. My code is very much in flux, but might be ready in a month or two to be seen by others. Whether it should go into argoFloats is a question. The problem with putting something in a package that is open-source is that people will start using it ... and then it is very hard to change things. But I want this as a research tool, so I can change anything about it, anytime I want. This is the kind of thing we could maybe discuss in a Z, perhaps when you start working on argo more fulltime, in a few weeks.

j-harbin commented 2 years ago

These are all good points. Basically this came about in the work shop because the "Code" button we created is quite useful. You and I are very familiar with the steps for how to look at plots and subset for geographical regions, but Clark has expressed to me in the past that sometimes he simply opens mapApp(), and highlights the area he's interested with and copy's and pastes the code from the "Code" button. It might also be a good feature for those who are new to coding when first getting familiar with argoFloats code.

To answer some of your points:

  1. I imagine the user would simply click the starting point as their "end" point to indicate they are finished with the polygon. This is the similar approach done with argovis (screen shot below where the white dots, although hard to see, are my polygon locations)
  2. If a mistake was created, we have already created the "U" or "Undo" keystroke, which could undo the last action
  3. Good point on saving the polygon. I would have to think about this a little more. We could of course have it show up in the "Code" button, where they could simply copy and paste their code, but you're right that there may be a nicer way to do this.

Ps- I'm not completely set on this idea, but you're right that it may be a good idea to have a Z about it. Maybe some time early next week. I'm officially full time Argo now!

Screen Shot 2022-04-01 at 9 31 33 AM

dankelley commented 2 years ago

This all sounds good. I'm open to a Z today, if you like, or next week. (I wouldn't mind today, if you have time, because I never like to leave for tomorrow what I can do today.)

Just shoot me an email, on a proposed time (today or next week).

github-actions[bot] commented 2 years ago

The Stale-bot has marked this issue as Stale, because no new comments have been added in the past 30 days. Unless a comment is added within the next 7 days, the Stale-bot will close the issue. The purpose of these automated actions is to prevent the developers from forgetting about unattended tasks. Note that adding a "pinned" label will turn this action off for a given issue.

j-harbin commented 2 years ago

I'm currently working on this. Just adding a comment so the stale bot doesn't close it.

j-harbin commented 2 years ago

To do:

j-harbin commented 2 years ago

Done in commit 5bbf3f3b3ae676b7639616649d835183a1751809 of develop.