[SciPy-User] Obtaining contour data

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[SciPy-User] Obtaining contour data

ashwinD12 .
Hello,
         I have height data on a two  dimensional equidistant latitude longitude grid and my ultimate goal is to calculate the curvature of the contours. Here is an illustration of what I want to do - http://www.indiana.edu/%7Egeog109/topics/10_Forces&Winds/sfc_trough.html. The data is plotted on a two dimensional latitude longitude grid and then the height contours are calculated. I am looking to obtain the coordinates of the contours(shown in red) in terms of latitude and longitude so that I can use that information  to calculate the curvature of the contour points using a least squares method. Is it possible to do this in Scipy ? The curvature of the earth is itself irrelevant in this case and it can be assumed to be flat.

Regards,
Ashwin.

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: Obtaining contour data

Nicolas Cellier

2017-10-16 15:31 GMT+02:00 ashwin .D <[hidden email]>:
Hello,
         I have height data on a two  dimensional equidistant latitude longitude grid and my ultimate goal is to calculate the curvature of the contours. Here is an illustration of what I want to do - http://www.indiana.edu/%7Egeog109/topics/10_Forces&Winds/sfc_trough.html. The data is plotted on a two dimensional latitude longitude grid and then the height contours are calculated. I am looking to obtain the coordinates of the contours(shown in red) in terms of latitude and longitude so that I can use that information  to calculate the curvature of the contour points using a least squares method. Is it possible to do this in Scipy ? The curvature of the earth is itself irrelevant in this case and it can be assumed to be flat.

Regards,
Ashwin.

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: Obtaining contour data

ashwinD12 .
Yes I looked at that. The thing is my data is in raster coordinates(latitude and longitude - equidistant grid). When I pull out the coordinates from collections are these polygons (vectors) or is the raster  entity still retained ?

On Mon, Oct 16, 2017 at 7:50 PM, Nicolas Cellier <[hidden email]> wrote:

2017-10-16 15:31 GMT+02:00 ashwin .D <[hidden email]>:
Hello,
         I have height data on a two  dimensional equidistant latitude longitude grid and my ultimate goal is to calculate the curvature of the contours. Here is an illustration of what I want to do - http://www.indiana.edu/%7Egeog109/topics/10_Forces&Winds/sfc_trough.html. The data is plotted on a two dimensional latitude longitude grid and then the height contours are calculated. I am looking to obtain the coordinates of the contours(shown in red) in terms of latitude and longitude so that I can use that information  to calculate the curvature of the contour points using a least squares method. Is it possible to do this in Scipy ? The curvature of the earth is itself irrelevant in this case and it can be assumed to be flat.

Regards,
Ashwin.

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: Obtaining contour data

Nicolas Cellier
If you fear that, you can easily map the raster coordinates to the real ones and convert this after extracting the contour. It's an extra step but should not be a real difficulty.

Envoyé par TypeApp
Le 16 oct. 2017, à 16:25, "ashwin .D" <[hidden email]> a écrit:
Yes I looked at that. The thing is my data is in raster coordinates(latitude and longitude - equidistant grid). When I pull out the coordinates from collections are these polygons (vectors) or is the raster  entity still retained ?

On Mon, Oct 16, 2017 at 7:50 PM, Nicolas Cellier <[hidden email]> wrote:

2017-10-16 15:31 GMT+02:00 ashwin .D <[hidden email]>:
Hello,
         I have height data on a two  dimensional equidistant latitude longitude grid and my ultimate goal is to calculate the curvature of the contours. Here is an illustration of what I want to do - http://www.indiana.edu/%7Egeog109/topics/10_Forces&Winds/sfc_trough.html. The data is plotted on a two dimensional latitude longitude grid and then the height contours are calculated. I am looking to obtain the coordinates of the contours(shown in red) in terms of latitude and longitude so that I can use that information  to calculate the curvature of the contour points using a least squares method. Is it possible to do this in Scipy ? The curvature of the earth is itself irrelevant in this case and it can be assumed to be flat.

Regards,
Ashwin.

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user




SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: Obtaining contour data

Slavin, Jonathan
In reply to this post by Nicolas Cellier
Ashwin,

I have found that the scikit image routine find_contours is easier to work with than extracting the data from the ContourSet object as in the cited stackoverflow example.  If you do something like

from skimage.measure import find_contours
cs = find_contours(array, values)

(where values are the levels you want for your contours and array is the grid of values) then you get back a list of contour lines.  For each contour you have a Nx2 array of effective indices into the array.  You can convert to your lat-long grid by multiplying by the appropriate scales.  skimage also has a nice routine called grid_points_in_poly which will return a boolean array that is True for all points of the input array that are inside the polygon to which you can use one of the contours as an input.

Regards,
Jon

On Mon, Oct 16, 2017 at 10:31 AM, <[hidden email]> wrote:

Date: Mon, 16 Oct 2017 19:01:27 +0530
From: "ashwin .D" <[hidden email]>
To: [hidden email]
Subject: [SciPy-User] Winds/sfc_trough.html.
> The data is plotted on a two dimensional latitude longitude grid and then
> the height contours are calculated. I am looking to obtain the coordinates
> of the contours(shown in red) in terms of latitude and longitude so that I
> can use that information  to calculate the curvature of the contour points
> using a least squares method. Is it possible to do this in Scipy ? The
> curvature of the earth is itself irrelevant in this case and it can be
> assumed to be flat.
>
> Regards,
> Ashwin.
>
> _______________________________________________
> SciPy-User mailing list
> [hidden email]
> https://mail.python.org/mailman/listinfo/scipy-user
--
________________________________________________________
Jonathan D. Slavin                 Harvard-Smithsonian CfA
[hidden email]       60 Garden Street, MS 83
phone: (617) 496-7981       Cambridge, MA 02138-1516
cell: (781) 363-0035             USA
________________________________________________________


_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user