|
From: Isidora <is...@ju...> - 2011-09-28 20:21:44
|
Hi Filipe, I have just seen your answers. I am trying to plot on a background GIF map, lines like the ones you can see in http://www.spc.noaa.gov/products/outlook/day1probotlk_2000_wind.gif. I can plot the lines as you see them in this link without a problem. However, because those lines are not closed polygons, the filling extends only to a straight line between first and last point of the curve. I want the filling to extend all the way to the border of United States. Since drawcountries() return a Collection of paths without any metadata identifying the country/countries been separated by it, I cannot use it to mask the area outside ofthe borders out. I'd appreciate any link/documentation I could read to help me resolve this issue. Thank you |
|
From: Isidora <is...@ju...> - 2011-09-30 18:01:46
Attachments:
usborders_convexhull_polygon.png
|
Hi Jeff, I computed the convex hull for the points in paths returned by Basemap.drawcountries() and I got the attached map (convex hull algorithm: http://www.scipy.org/Cookbook/Finding_Convex_Hull). You can see the magenta convex hull polygon with U.S. border lines drawn in black as a reference. Unfortunately, adding the coastlines to the computation of the convex hull just hungs the program. I tried running the computation of the convex hull using the polygons retrieved from US Shapefile in http://www.geophysique.be/en/2011/01/27/matplotlib-basemap-tutorial-07-shapefiles-unleached/, but the program hungs due to the huge amount of points too. I am running out of time to complete this project, so I cannot implement a more efficient version of the convex hull computation to include the coastlines in the process right now. QUESTIONS: - if I plot an open path in the area next to U.S./ Mexico border and I'd like to have the filling of such path to go all the way to the border, I figured I could add extra points to close the path over Mexico in order to fill the area I need. What I do not understand is how can I mask the filled portion over Mexico without masking any portion of the filling over U.S.. i.e. the portion that is outside the polygon shown in the map attached. - if I have similar situation in Florida, for which I would like to mask all points that are not over land using is_land() method, how can I do this ? Thanks |
|
From: Jeff W. <js...@fa...> - 2011-09-28 21:39:38
|
On 9/28/11 2:19 PM, Isidora wrote: > Hi Filipe, > > I have just seen your answers. I am trying to plot on a background GIF map, lines like the ones you can see in http://www.spc.noaa.gov/products/outlook/day1probotlk_2000_wind.gif. I can plot the lines as you see them in this link without a problem. However, because those lines are not closed polygons, the filling extends only to a straight line between first and last point of the curve. > I want the filling to extend all the way to the border of United States. > > Since drawcountries() return a Collection of paths without any metadata identifying the country/countries been separated by it, I cannot use it to mask the area outside ofthe borders out. > > I'd appreciate any link/documentation I could read to help me resolve this issue. > > Thank you Isidora Nobody has tried to do this (that I know of), so I can't point you to anything specific. Did you see my message about creating a gridded field (say 1's for points inside and 0's for points outside the region), the calling contour to draw the line? You can use the is_land method to determine if a point is over land or not, but there is not way to determine whether a given point is inside a country. As you found out, there is no metadata associated with the coastlines or political boundary lines. The fillcontinents method returns a list matplotlib polygon instances that represent the land areas. One of them is North America, and could be used to clip your line segments - but there is no easy way to determine which one it is. If you can find a shapefile that just contains a CONUS polygon, you could use that I suppose. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
|
From: Filipe P. A. F. <oc...@gm...> - 2011-09-29 13:17:28
|
On Wed, Sep 28, 2011 at 16:39, Jeff Whitaker <js...@fa...> wrote: > On 9/28/11 2:19 PM, Isidora wrote: >> Hi Filipe, >> >> I have just seen your answers. I am trying to plot on a background GIF map, lines like the ones you can see in http://www.spc.noaa.gov/products/outlook/day1probotlk_2000_wind.gif. I can plot the lines as you see them in this link without a problem. However, because those lines are not closed polygons, the filling extends only to a straight line between first and last point of the curve. >> I want the filling to extend all the way to the border of United States. >> >> Since drawcountries() return a Collection of paths without any metadata identifying the country/countries been separated by it, I cannot use it to mask the area outside ofthe borders out. >> >> I'd appreciate any link/documentation I could read to help me resolve this issue. >> >> Thank you > Isidora > > Nobody has tried to do this (that I know of), so I can't point you to > anything specific. Did you see my message about creating a gridded > field (say 1's for points inside and 0's for points outside the region), > the calling contour to draw the line? You can use the is_land method to > determine if a point is over land or not, but there is not way to > determine whether a given point is inside a country. As you found out, > there is no metadata associated with the coastlines or political > boundary lines. > > The fillcontinents method returns a list matplotlib polygon instances > that represent the land areas. One of them is North America, and could > be used to clip your line segments - but there is no easy way to > determine which one it is. > > If you can find a shapefile that just contains a CONUS polygon, you > could use that I suppose. I guess that Jeff suggestion of manipulation a shapefile might be the easiest way to do this, here is an example that might help you. http://www.geophysique.be/en/2011/01/27/matplotlib-basemap-tutorial-07-shapefiles-unleached/ -Filipe > -Jeff > > -- > Jeffrey S. Whitaker Phone : (303)497-6313 > Meteorologist FAX : (303)497-6449 > NOAA/OAR/PSD R/PSD1 Email : Jef...@no... > 325 Broadway Office : Skaggs Research Cntr 1D-113 > Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |