GPlates / gplates-web-service

Source code for GPlates Web Service(GWS)
https://gws.gplates.org
GNU General Public License v2.0
8 stars 2 forks source link

null points in PALEOMAP model #4

Open sebsteinig opened 1 year ago

sebsteinig commented 1 year ago

The web service is amazing, but I run into problems trying to reconstruct points with the PALEOMAP model. There seem to be multiple plates with valid times only defined for 0 Ma, resulting in null return values for any ages > 0 Ma.

Example: https://gws.gplates.org/reconstruct/reconstruct_points/?points=-70,35,110,-20,-12,-70,-2,38&time=1&model=PALEOMAP&return_null_points

returns: {"type": "MultiPoint", "coordinates": [null, null, null, [-2.0846, 38.0224]]}

Using the standard model with: https://gws.gplates.org/reconstruct/reconstruct_points/?points=-70,35,110,-20,-12,-70,-2,38&time=1&return_null_points

returns: {"type": "MultiPoint", "coordinates": [[-69.7916, 34.918], [109.6836, -20.4725], [-11.9045, -70.0443], [-2.1708, 37.9167]]}

I can use the PALEOMAP model in Desktop GPlates and pygplates to reconstruct reasonable results for these sites without a problem. Is there any way to force an output outside the valid time in GWS or is this a limitation of the PALEOMAP model?

Thanks for any help on this!

siwill22 commented 1 year ago

If I understand correctly, then:

It should be easy to add a flag to allow this. @michaelchin, do you want to do this?

[Also: Looking at the relevant section of code starting here: https://github.com/GPlates/gplates-web-service/blob/6e4329c50658750dbeb9c77f51ec5cf5ebb96dba/django/GWS/reconstruct/reconstruct_points.py#L188 it seems that the issue might be avoided if you passed the plateids as part of your request together with the points. That way, you skip the but which would impose the valid_time of the polygons onto the points? Depends on whether you're happy to pre-assign the plateids as part of your workflow]

I do think that the default setting in the web service is 'safer', in the sense that it is trying to stop the user from reconstructing points in a way that may not make sense. A common example would be points in the oceans. If the crust is 50 Myr old, then reconstructing the point to any time younger than 50 will be fine. Reconstructing that point to any time older than 50 would give a spurious result. The web service therefore prevents you from doing this (but also prevents the more meaningful operations). Therefore when using the flag you'd need to be careful to filter out any points which would not be valid at the time you're reconstructing to, since the web service won't be doing that for you.

Also worth pointing out that this issue is not limited to the PALEOMAP reconstruction model - just that the problem will be more extreme in the PALEOMAP model. In this model, the polygons for the oceans are not subdivided into different age bands, all the oceans are covered by polygons with a valid time limited to 0 Ma so can't reconstruct any points in the oceans. With some of the other models, the ocean polygons have a coarse subdivision of age ranges - you would lose far fewer points, but still some.

michaelchin commented 1 year ago

The web service is amazing, but I run into problems trying to reconstruct points with the PALEOMAP model. There seem to be multiple plates with valid times only defined for 0 Ma, resulting in null return values for any ages > 0 Ma.

Example: https://gws.gplates.org/reconstruct/reconstruct_points/?points=-70,35,110,-20,-12,-70,-2,38&time=1&model=PALEOMAP&return_null_points

returns: {"type": "MultiPoint", "coordinates": [null, null, null, [-2.0846, 38.0224]]}

Using the standard model with: https://gws.gplates.org/reconstruct/reconstruct_points/?points=-70,35,110,-20,-12,-70,-2,38&time=1&return_null_points

returns: {"type": "MultiPoint", "coordinates": [[-69.7916, 34.918], [109.6836, -20.4725], [-11.9045, -70.0443], [-2.1708, 37.9167]]}

I can use the PALEOMAP model in Desktop GPlates and pygplates to reconstruct reasonable results for these sites without a problem. Is there any way to force an output outside the valid time in GWS or is this a limitation of the PALEOMAP model?

Thanks for any help on this!

If you use this url

https://gws.gplates.org/reconstruct/reconstruct_points/?points=-70,35,110,-20,-12,-70,-2,38&time=1&model=PALEOMAP&return_null_points&fc

you can see more details

{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": null, "properties": {"valid_time": [0.0, 0.0], "pid": 101}}, {"type": "Feature", "geometry": null, "properties": {"valid_time": [0.0, 0.0], "pid": 876}}, {"type": "Feature", "geometry": null, "properties": {"valid_time": [0.0, 0.0], "pid": 802}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-2.0846, 38.0224]}, "properties": {"valid_time": [600.0, "distant future"], "pid": 304}}]}

The null points all have valid time range [0,0]. This is the reason they are null at 1Ma.

You can work around this problem with this url

https://gws.gplates.org/reconstruct/reconstruct_points/?points=-70,35,110,-20,-12,-70,-2,38&time=1&model=PALEOMAP&return_null_points&pids=101,876,802,304

However, the returned coordinates might make no sense because they are out of valid time range.

sebsteinig commented 1 year ago

Thank you very much for looking into this and your detailed explanations! This is very much appreciated.

I tried your workaround with manually assigning the plate ID and this does indeed work for me. But it also means that I currently use two API calls to first get the plate ID and then do the reconstruction afterwards.

So I still think adding a flag to ignore the valid times would be helpful for some cases, but I do understand if this is low priority for you.

Thanks again for providing this great service, I use it a lot!

michaelchin commented 1 year ago

Thank you very much for looking into this and your detailed explanations! This is very much appreciated.

I tried your workaround with manually assigning the plate ID and this does indeed work for me. But it also means that I currently use two API calls to first get the plate ID and then do the reconstruction afterwards.

So I still think adding a flag to ignore the valid times would be helpful for some cases, but I do understand if this is low priority for you.

Thanks again for providing this great service, I use it a lot!

Alternatively, you can use

https://gws.gplates.org/reconstruct/assign_points_plate_ids?points=-10,50,-130,-70,0,0&with_valid_time

to get the pid and valid time.

I will add the flag when I got time.

michaelchin commented 1 year ago

Now you can ignore the valid time. see the link below.

https://gws.gplates.org/reconstruct/reconstruct_points/?points=-70,35,110,-20,-12,-70,-2,38&time=1&model=PALEOMAP&return_null_points&ignore_valid_time