geodesymiami / insarmaps

3 stars 0 forks source link

option to select reference point #69

Closed falkamelung closed 1 year ago

falkamelung commented 1 year ago

Another useful feature would be to have the ability to locally select a new reference point. For each data the value of the reference point needs to be removed so that the time series for the new reference point is zero at all dates.

The reference point should also be give on the URL is a different then the default reference point is used.

Here an example from Sara's paper The new reference point is the little square under P2.

image
stackTom commented 1 year ago

Correct me if I'm wrong. But is this what you mean: Reference point has data values of 1, 2, 3 at date x, y, z. For every other point, I will substract 1 from date x's value, 2 from date y's value, and 3 from date z's value?

falkamelung commented 1 year ago

Here is the time series of a reference point within a dataset:

http://129.213.120.104/start/19.5136/-155.5135/15.4252?flyToDatasetCenter=false&startDataset=S1_IW12_087_0527_0531_20141116_XXXXXXXX_N19391_N19549_W155679_W155506&pointLat=19.51850&pointLon=-155.51174&minScale=-3&maxScale=3&startDate=20141116&endDate=20220607

So we want an option to select the reference point with the mouse, and then we have to substract for each date a constant value from the whole array, so that the new reference point shows a zero timeseries

image
stackTom commented 1 year ago

How do we calculate this value to subtract?

Also, do we then subtract this value from every other point and re olor the dataset?

falkamelung commented 1 year ago

No need to calculate. If this point is selected as reference

image

then this timeseries is subtracted from all points. So, yes, the same time series is subtracted from every other (from all) points

stackTom commented 1 year ago

I just realized why I previously said this wasn't possible. It will fundamentally change how we get data from the database.

Currently, php sends back the re calculated velocity from the dates selected. In order to implement reference point, I think I'll have to send back all the displacements for all the points in question. This might be too slow. I'll have to test.

Conversely, it might not be too slow. We will send back more data to the browser, but the database won't have to calculate the new slopes as it currently does. So will have to test.

stackTom commented 1 year ago

I made the necessary changes. Please try to recolor many datasets and with many dates. I don't see any speed difference. However, I already see a disadvantage. PHP is allocating a lot more RAM than the previous method for on the fly coloring (i.e. when we'd send the pre-calculated velocities to the browser instead of sending over all the displacements for the browser to then calculate the velocity, as we are doing now).

I don't know how much RAM on the fly used to take on the server with the old method, but this new method necessitated me increasing php's memory limit of 128 Megabytes. It might not be much more, or it might be significant. I'll have to analyze more.

Long story short - please try on the fly coloring for many datasets, and see if it is slower (I don't think so). Please use insarmaps.miami.edu and not my local dev server, as the dev server is a weak computer and on the fly is always slower than on insarmaps.miami.edu

However, make sure to clear all your cache so you are re-coloring with all the latest code.

falkamelung commented 1 year ago

For a small data set I don't see any difference. For a big data set recoloring is slow but I can't tell whether it is slower than before. To be sure, we could try he same dataset on two different/similarservers

stackTom commented 1 year ago

I think the most logical thing is to keep using the same recoloring as we used to have in all cases.

And only apply the special recoloring if we are selecting a reference point.

falkamelung commented 1 year ago

That would be completely fine

stackTom commented 1 year ago

This is working (in an alpha state, so there will be bugs) on my development server. Please use it and let me know. There is a new button at top called "RF". Click it to select a new reference point.

falkamelung commented 1 year ago

If you select a new reference point both, the velocity and the displacement time-series should change. Did you see the happen? Me not yet. Or did I do something wrong?

http://129.213.120.104/start/25.8729/-80.1195/16.7969?flyToDatasetCenter=false&startDataset=S1_IW3_048_0081_0082_20191111_20220710_PS&pointLat=25.87227&pointLon=-80.12130&minScale=-0.4&maxScale=0.4&startDate=20191111&endDate=20220710

|image| image|

Also, it would be good to have the reference point in the URL. If you display with a different reference point it should look different compared to no reference point specified.

stackTom commented 1 year ago

For me, the color of the points changes.

Do you mean the time series values when you open a plot should also have their values adjusted by the reference point?

falkamelung commented 1 year ago

Whether the color changed, I am not sure. With the example I tried I could not see. But, Yes., all values should be adjusted and the velocity show should be different.

In practice, this is way to get rid of the tropospheric variability. If you have a reference point nearby you are not affected by clouds, except on a very short scale.

stackTom commented 1 year ago

It changes colors on mine, and the change is easily visible. Please refresh your cache (or open the site on a private tab).

I did not take into account the reference point when creating the plots. Will add this.

falkamelung commented 1 year ago

Yes. The colors are changing and it looks right. This part is certainly working.

stackTom commented 1 year ago

I fixed the plots. And added the reference point in the URL. Can you test?

falkamelung commented 1 year ago

Most of it works. Here are a few things that don't work (I just re-ingested this data set)

  1. When I display the time series of the reference point

http://129.213.120.104/start/19.5128/-155.5264/17.3014?flyToDatasetCenter=false&startDataset=CSK_SM_091_0000_20180916_XXXXXXXX_N19368_N19540_W155666_W155481&pointLat=19.51336&pointLon=-155.52771&minScale=-4&maxScale=4&startDate=20180916&endDate=20211229

and then select a nearby reference point the time series does not get updated (only the velocity)::

image
  1. I used to be able to zoom into the reference point area, deselect displaying the reference point, and then display the time series of this point (the reference point) to convince myself that this is the reference point (if it shows zero everything worked fine). This does not seen to be possible anymore. I mean, after selecting a new reference point I am not able to create a time series for this point. So I am not 100% sure that the the reference point selection worked.

  2. Shall we put the reference point selection button into the layer menu (where the "actual pixel size" currently is? The "Actual pixel size" could be moved to the right. The reference point selection will be used only by expert users.

  3. Instead of "Remove reference point" say "Reset reference point" as it goes back to the default reference point.

  4. The "Reference point" display button in the layer menu does not always work. It should go ON after a new reference point has been selected. And then you should have the ability to switch the reference point display off (with the reference point remaining unchanged). Currently, de-selecting reference point display results in resetting the reference point.

stackTom commented 1 year ago

I've fixed all these issues. Can you try again? I'll close this issue if everything is working correctly.

falkamelung commented 1 year ago

It works! Great. Thank you! There are a few minor issues: http://129.213.120.104/start/19.5107/-155.5235/15.2784?flyToDatasetCenter=false&startDataset=CSK_SM_091_0000_20180916_XXXXXXXX_N19368_N19540_W155666_W155481&pointLat=19.51135&pointLon=-155.52723&minScale=-16&maxScale=16&startDate=20180916&endDate=20211229&refPointLat=19.51273&refPointLon=-155.52728

  1. When Reference-point-display in ON and I select a new reference point, the display of the old one stays. It should only display the new reference point:

    image

    (related to this is a problem with Reference-point-display OFF. I need to do this twice to get the display off).

  2. For Reference-point-display ON, when I say "Reset reference point", it sets Reference-point-display OFF. But it should not. Instead, you should see the reference point going back to its original position.

  3. For Reference-point-display OFF, when I click "Select reference point" it sets Reference-point-display ON, but no reference point is displayed.

  4. Thinking about this, instead of one button we should have two buttons. One "Select reference point" and one "Reset reference point". Currently you have to reset the reference point before select a new one. This does not make much sense. If you don't like your reference point you should be able to straight select a new one.

stackTom commented 1 year ago

All 4 of these have been fixed. Can you check? If okay, we can close this issue.

falkamelung commented 1 year ago

The display of the reference point is still buggy. The first time I select a new reference point is works fine. But not the second time, though. It does not show the reference point (although ref point display is on). When I select a third time ithere are similar errors.

stackTom commented 1 year ago

Maybe we are doing something different? Seems to work for me (see below video):

https://user-images.githubusercontent.com/13559181/185143830-7c0d2af9-3620-4678-be97-6d39f8c87796.mov

falkamelung commented 1 year ago

OK. I see what I did differently. After selecting a new reference point, click on a point to display a time series (repeatedly). Then it happens. For some reason my movie recording did not work but I can do it if you still can't reproduce.

stackTom commented 1 year ago

I see the issue. It was a tiny bug with the X's that appear when a time series is displayed. Please check again, should be fixed and hopefully we can close this.

falkamelung commented 1 year ago

It works sometime, but is still buggy. See the movie. A reference point is selected and shows, but the time series does not show zero. I don't know when exactly it occurs. You just have to select and display a few points. If you don't see it I can try some more to exactly reproduce.

http://129.213.120.104/start/25.8723/-80.1210/19.0734?flyToDatasetCenter=false&startDataset=S1_IW3_048_0081_0082_20191111_20220710_PS&pointLat=25.87224&pointLon=-80.12133&refPointLat=25.87224&refPointLon=-80.12133&minScale=-3.2&maxScale=3.2&startDate=20191111&endDate=20220710

https://user-images.githubusercontent.com/11162588/185416721-973095c7-455a-46ac-9f93-2910ff796107.mov

stackTom commented 1 year ago

Yes please try some more. I'm busy now until later at night. Will try to fix then.

falkamelung commented 1 year ago

The reference point selection works fine once only. The second time it does not accept the selected reference point, although it is displayed:

https://user-images.githubusercontent.com/11162588/185435169-998ba20f-873f-4cad-8564-5e4ac3bbe327.mov

falkamelung commented 1 year ago

Another item is that we should get rid of the black little window saying "Select Reference Point". Lets do the same thing as for displaying InSAR, Seismicity at the top of windows, which slightly change grey scale when selected.

image
stackTom commented 1 year ago

Fixed the above bug, and made the above UI change. Please check. Hopefully that does it as this feature has been incredibly hard/tedious to implement since the site has gotten quite big.

falkamelung commented 1 year ago

Yes. It works great now. Thank you soo much! This offers many new possibilities to look at the data. I played with it and just brought the oracle server down....

I am closing it as it is done.

stackTom commented 1 year ago

Great. Crashes shouldn't happen on the Main server as it has more memory.

I'll look to see if the reference database request can be made more memory efficient, but I don't think it'll be possible.

stackTom commented 1 year ago

I pulled on the main server. Please play with it there. That way we can see if the main server needs more data (or I should prioritize on seeing whether these reference database requests can be made more memory efficient).