Around the World in 80 Ways: An Introduction to Working w/ Geodata & Cartopy | SciPy 2018 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
you've made it hopefully to the right room this is the Caterpie tutorial and the cheeto is entitled around the world in 80 ways and that's play on the excellent book the written by Jules Verne around the world in 80 days and your your hosts today are myself Phileas Elton and my useful assistant humble servant bill pass for too little we're both software engineers at the UK Met Office National Weather Service for the UK we work in the analysis visualization and data team and for our day job we do kind of lots of Carter pie and data type stuff so um this is right up our street so I've already highlighted the repository with the with the content it's in github.com slash titles slash catify - tutorial and I've just spotted honestly we weren't pushing things like four hours ago or anything so if you have been organized and actually cloned this repository before today you're going to need to pull and and get get the latest updates so that's basically just to get pull on that repository and it should bring in changes on master yeah maybe one o'clock in the morning or maybe five o'clock in the morning we're not sure so it's a bit of a blur if you're having any issues there is a slack channel titles so PI 2018 it's hash tag car to PI I think neither bill nor myself have access to that select channel while we're presenting but we've got a couple of helpers around the room he'll happily do that in fact I'm gonna point them out in the in this corner we've got one Nunez English yes I've asked Phillipe over here to sort of cow and I can already see that a couple of other ringers in the room like URIs in the background and if any of you want to just help out kind of contribute if there's any questions on this top channel that'd be really useful thank you great so that's a question from one of our slack helpers asking how to use slack I would say you know ask on slack but okay so let's get going without further ado so this tutorial really is about giving you some background on classify predominantly but we're not going to shy away from using kind of geospatial terms we're going to talk you through some of those those concepts and I guess Caterpie doesn't sit you know on its own in an island it is part of a bigger reef ecosystem and we want to give you an experience of using those tools and as I say carp and friends in a in a kind of cooperative way so that's basically what we're trying to get out of this yeah so as I say the repositories they're github.com slash site or slash cast by tutorial and and for those that have just walked in if you've been organized and pre clone this please pull because we've made some recent changes there'll be a couple of handouts coming around for some of the exercises that we do there's a requirement stop txt to kind of get all the dependencies installed can I get a quick show of hands who's already got a working Condor environment that ok that's pretty good so I'm it's super useful if you've already done that because it takes quite a while to download everything and install it if you haven't this there are some instructions on the readme of this repository and if you get stuck throughout and slack and hopefully someone can help you out yeah so that's that's the channel I should take Kath apply on-site site by 2018 that's like the calm if all goes terrible and you're not able to install on your machine there is also a my binder link on the repository I'll click on that in fact as I say wasn't recent or anything if if you don't have an environment working and it's taking too long worth fails for any reason there is a binder option that you can kind of click on this and get an interactive version of the networks online too okay so this is pretty much the outline of what we're going to try and do today we're going to start with some basics about what projections are and not shy away as I say from using geospatial type words we're then gonna actually that that whole section is pretty much not going to touch cosplay at all it's going to be a kind of a an interactive learning experience that hopefully will set us up for the next section which is about cosplaying them up for the interface and then we'll start looking at this is where really cosplay and friends come in will then start looking at how you interact with some of these tools that are part of the wider ecosystem to do quite powerful things I guess before we go too much further we should say that neither bill nor myself have particularly experts at geospatial stuff and in fact writing this tutorial has been quite an eye-opener even though we were able to kind of write codify so I'm take that to heart don't don't feel like this is some complex thing we can hopefully get through it and yeah we'll all be able to use consistent words and and understand what things like projections really are okay that is that so that's some background I'm gonna stop for a second and stop speaking is everything going okay in terms of installations and getting the materials do we need to okay so this really focuses on map projections more than anything else if I'm honest we'll use some of the geospatial terms and whilst going through that but I'm just give you a sense of what projections there are and why why there are different projections I guess so again purpose first for this really is to help you understand the terms used in Carter PI documentation and the wider J's special literature and just as importantly given that there are lots of map projections out there to help you give us an you get a sense of the when a projection might be appropriate for your particular application okay so I guess we should start with this statement and the world is not flat despite what some people seem to insist and there's lots of ways we can prove it whereas quite quite surprised when I looked up Flat Earth and they gave me this picture here which is and as a Mousel equidistant projection and this is the ice wall of Antarctica is what holds us in on this platter apparently yeah what can you say we'll get we'll get into some of the details of what this projection actually looks like in a bit but the reason we have to have map map projections is because the earth is not flat unfortunately most of our media is flat so paper screens they're all pretty two-dimensional there are exceptions like a 3d rendering engine or you can buy these Globe's I've got projectors in them that kind of stuff but they're pretty neat so we need projections an eye map projection is a systematic transformation of the last reason longitudes applications from the surface of a sphere or an ellipsoid onto the locations on a plane right but there's a problem with map projections all map projections and that is that in order to go from the sphere onto a plane you have to cut somewhere there is there is no way of not cutting and not only that no matter what you do you're going to distort the some some properties of the underlying representation so the kinds of distortions were talking about their area shape direction distance scale these are kind of fundamental things that we want to be able to represent in our visualizations and yet all projections mess some of these things up okay so the reason you have to understand what a map projection when to use a particular map projection is so that you can preserve the things that are important to you give you some examples of when you might want particular preservation properties in a minute so Phileas Elson the the host of this tutorial has has coined a quote which I think is going to be massive and that quote is all map projections are wrong that's some are useful by wrong this means you know they're gonna they're going to break some of your metrics so you have to understand that so as I say there are lots of map projections out there and there are a couple of approaches to classifying them so that you can actually talk about these things and they are essentially by by how you form your map projection or you classify based on what metrics they preserve let's let's start with the surface classification so there are three main types of surface classification that map the map from the sphere onto a plane you can use cylindrical type projections which the name kind of gives it away it's restrictor cylinder and you map the lots and Long's up onto your cylinder there's azimuthal which is plane that you on top of your sphere and project project out or there's the comic form and what you might you're going to try to describe the thing is this is this is a really nice kind of simple way of separating your types of projections but there's only a small number of projections out there that actually fit nicely into these categories after that you start having things like pseudo cylindrical pseudo azimuthal or you have all sorts of random things like and things that are basically bolted together that there were none of the above so this this approach is only kind of so good but cylindrical so as I say this is basically a cylinder mapping to the yum-blatz Millan's and one of the defining features of a cylindrical projection is that meridians and parallels are straight and perpendicular okay so as you can see on the map there your meridians and your parallels are perpendicular and straight thing and I've this image is really nice because it gives you some of the other words I'm not even going to use them but I'm yeah you can you can rotate the cylinder it doesn't have to be aligned with the poles and you end up with an oblique or if you you go entirely rotate 90 degrees you get a transverse azimuthal projections again there's some words there so polar azimuthal projections you've got equatorial which are planes touching the equator and then oblique azimuthal Zara where they're touching somewhere that's not the pole or the equator and some of the interesting properties of azimuthal projections is that the parallels are complete circles okay and what's kind of interesting about as a methyl two is that so there's normally one or two central points on an azimuthal projection and though from those central points all great circles are straight lines just to be clear what a great circle is a circle is the shortest it's the path of shortest distance on the sphere I have a handout in a minute with lots of these words written down so if I'm using too many words too quickly then hopefully that will help and finally the the conic projection again not going to talk too much about it but what's what's interesting about chronic projections or what's kind of iconic about chronic projections sorry meridians are straight lines so they're not parallel but they are straight okay and the parallels are circular arcs and they're not fully circular they're just the arcs so it's kind of a very obvious feature of conic projections and it kind of normally results in you having that that curve at the very top of the projection and at the very bottom obviously so at that I'm gonna hand over to my handsome assistant bill apostasy little he's going to talk about projections by reserving metric okay so see you so we're going we're going to mix things up just to keep a bit of different cadence so you don't like Paula sleeping you see countries of that but where we know that you're probably gonna be touchy you're not like right and called just now but we're leading up to connect interested in exercise the people exercise we're gonna force you to get up and chat and meet people but that's a good thing right but all this this nomenclature that's a difficult word just put me you see with some jetlag is that we try to build up a common language that we can use later on so things call me man all we're talking about yeah first time using the Mac I just found out it Scrolls the opposite way freaked me out okay so saying things are a bit clunky I'm just going to press buttons so you can just laugh at me find room okay so some of the things that fill the scene that gets distorted you've got your sphere you project on a plane you're going to lose some behavior whether it's said distance shapes scale all these types of things and there's names for if you want to you know your data and you have to think about running me kind of cool kind of my projection that looks looks nice and short but you you want to actually represent your data in some way you want to focus on it and certainly so you want to preserve some of those behaviors so with conformal it's all about conserving shape you might care about that lines of boundaries of countries or anything that you you care but there's some examples there of makyo transverse mercator that actually preserve that shape anywhere on the projection because you care about it but it might be at the compromise of other metrics or other like distance or area things like that so there's a compromise to be had you need be set of eyes to what protection you need and when to use it using the coaster of keys spacebar right so zooming in Ximena so when you zoom dents for large-scale maps its preserving shape so you you want to preserve the shape of that major drawback is that their lens and ears can be distorted and there is you put I know a famous example what Google cannot shot themselves in food somewhat where the use of projection that just didn't work so they addressed that sort of the chooser project and it wasn't suitable for all the areas so you have to be careful what you want to choose and it's gotta be representative for every good point to use that projection zoomed out so this could be something like Mercator and it's used for like nautical charts where you you you keep a ROM ROM line your distance and bearing that preserves that so you have to think about how you want to use that so your ship works equidistant so as it says it's preserving the distance if you care about measuring distance between points on your projection then you might pick equidistant there might be compromised as a set of something else so the projections preserving distance between standard points or lines and there's examples that will come across it was example later on boy we're gonna look at some projections you know the guess which is what what's preserved what's lost okay so equal area so talk about shape talk about distance and you actually care about area for for whatever reason so there there are projections that preserve this but and there are a lot of them but again you have to pick the ones that you want and hopefully minimize the distortion of the other kind of metrics that are there so it suit your needs you have to pick and choose really and of course nothing as Phil said Phileas said it doesn't fit neatly into into buckets like that life's just not like that so there are compromises that you can make and our projections out there that will the might not cover all the bases but they're good enough to show your data in a way that care about the most you just have to find them a bit so a lot of words and it's nice and quite visual like to to to see what we're talking about and we have the teasers in the tricks which is it's basically it's a way in which you can see for a projection what is what's happening what's going on how has it been distorted in terms of distance shape and area and basically your drawing point on protection on your chosen projection circles of circles that are there that can get distorted depending on the projection so here we we see that we've got this work yes it does so with this can example you seem that you've got nice circles here but as you going up and near the poles and latitudes there's some squashing and stretching of the of the circle so that that tells us a lot of information and how does how does that help us so go back to the tea-things conformal equal-area an equi distance so given that circles on the sphere will remain as circles because of being preserved to the shape so that's a hint that that projection can be conformal okay pretty obvious equal area so the circles of constant area in the sphere will be so it could be distorted but you could sort of guess that they might cover the same sort of area by looking so they might be stretched lose the shape distance might be lost but the area it was roughly the same you can kind of judge it by eye and another side heuristic that you might want to use is that when you look at Greenland it should be an original wonder 14 with Africa so if you see it really stressed then you know it's not equal area so these are all tents that you you're gonna have to use later on they're coming up to an equi distant so the distance these approaches they have belong the Monroe meridians so on your projection you'll see if you look at the makings and the parallels the distances will be the same they're not going to be stretched okay that's no hemp there okay so this the fun part or this might actually blow up in our faces or it might actually be fantastically good so Phil is gonna go round he's handing out some handouts obviously basically this is going to be have to be a club collaborative effort you're going to have to get up and chat to your neighbors because basically you've got the the sheet and on the sheet there is a table and on the table you'll see there's a there's a protection name we talked about things being formal preserved preserving shape this equal area of exact word destined and the type of classification that it was now there are eight there are eight actual projections labeled a to hitch okay you're probably either got three or me before them you've not got all of them okay so what you got to do is you've got to fill out this table so you probably got three images but your neighbor might have a different three and then the other neighbors got another different three okay so what you're going to do is you've got your figure out fill it the fill at the box in terms of is it conformal okay is it equal area it's an equal distance okay and once you've got that then you can work out for each plot abcdefgh if it matches up with this you should be only right and complete the table and see projection E is Mercator or whatever okay that clear any questions so you're gonna have to even up to chair he'll probably happen this but okay so in the interest of kind of giving you all the same information how about we talk through this number a and then we can we can build up from there how does that sound so as does anyone want to talk us through any of the particular properties of this projection so I guess we want to find out first about whether it's conformal then we'll talk about equal area equidistant and it's it's tight so is this projection conformal and why okay okay so someone said no because the circles aren't the same size okay yeah and and has corrected yes sir because they're not circles right so conformal is about whether these are circles or not so on the sphere these are circles but when projected onto this map they're clearly not we've got an awful lot of stretching going on if I can find a mouse down here okay so quite clearly this projection is not conformal okay everyone happy with that conclusion equal area this is slightly harder and because humans are kind of notoriously bad at determining area so this is why we got this exercise wrong when we were kind of doing it ourselves but this one hopefully is kind of visible are these spheres are these circles on the sphere represented in an equal area on this map projection okay no and again the the obvious ones are you know got the circle here and this great big thing over here okay so definitely this projection is not equal area okay equidistant okay and I'm gonna put a condition on ecwid isn't equidistant along the meridians and I've already had a yes so talk us through it why is it equi distant along the meridians what's what visual clues have you got there okay so the distance between the latitudes is the same along the Meridian so you're basically looking at the gap between these parallels and it looks roughly the same all the way along this meridian okay and another Meridian the the distance is roughly the same all the way along okay so that's a good good indicator are there any other visual indicators that we could be looking at right angles that's interesting but I think that's a property of conformal more than a equidistant so it's a similar similar trick you can look at the height of the of the projected circles okay along the meridian the the the height of this circle might not look it but is the same as this this height which is the same as this height it's the same as this height if you had a ruler you could verify that so I agree this projection is equidistant along the meridians so let's try and classify the developer developable surface the the type of projection that this is any guesses so I've heard cylindrical that sounds sensible what what evidence do you have for that okay the good word there is rectangle definitely and right meridians and parallels are straight across at right angles this is without a doubt a cylindrical projection and hopefully if I bring up that tab if I can actually escape from here maybe I can hopefully if we cross-reference this table we should be able to see that we said no to conformal no to equal area yes to equi distant and that it's a cylindrical okay and the no no yes cylindrical turns out to be an equi distant plat carry projection okay so you've got now one-eighth of the the exercise complete I might talk you through one of the projections before we go too much further no I won't I'll let you I'll let you go too much further and then the her sorry I uncool if there are any questions just just pretty hand up and we'll keep coming around but keep going on this exercise and there's still quite a lots of feet got out of this okay so there is a natural lull in in volume there and I think that's a signal that probably we've kind of done this one enough so let's let's talk through what you found hopefully you'll have made the same mistakes that we made because you know we're all human we make mistakes and we'll learn from that that's kind of the idea okay so we've looked at a so I I just wanted to say thank you as well for engaging in that that's exercise it was great fun to see everyone kind of talking and not using computers no no this is a tech conference and everything but this is about people as much as anything in this conference so um be does anyone want to talk us through some of the properties of B there's a suite for anyone who does candy candy okay so the suggestions is conformal excellent I would say it's not equal area given as you say that circle and that circle don't really look that equal area good great there's a good hint excellent well spotted Greenland and Africa are definitely not the same size but they look it on this map okay okay and not equi distant because this length and this length are definitely not same great okay and what type of projection do you think this is okay and what clues do you have to say that it's cylindrical okay yeah yep so the case of projection and that's a very good guess I would say not guess well well in India so where are we conformal not equal area not equidistant cylindrical it's a Mercator great and you know true to my word candy I can't run up all the stairs for everyone so you'll have to come down and get it if you if you want some candy so next plot if I can not get lost right so slightly different and anyone want to talk us through some of the metrics you don't have to talk us through all of them if you don't want to so it's conformal because circles or circles on this map yeah great yeah it's a not equal area that circles some definitely smaller than that one okay not equi distant because these lengths are getting bigger and bigger okay what evidence you have to say that it's conic yeah it's not full circle a rectangle that's a good way of kind of getting there and the other clue is the parallels are arcs not complete circles but they're arcs and you get that kind of very obvious our key baseline here right it's very our key so great so you said equal area but nothing else and it's connect what projection did you determine that to be okay so sorry yes I didn't catch what you said I think okay right but you said it wasn't a criticism so it's definitely not like a distant conic okay so okay let's let's talk to the less than so you said it was conformal because the circles were circles you said it wasn't equal area because we were getting bigger circles you said it was an equi distant so we're looking for a tick here and crosses elsewhere and the conic well the first one here is the conformal not equal to equal area and not equal distant and it's a conic I think that's a good way it's the Lambert conformal projection great thank you please come and treat yourself to some the finest candy that AT&T conference center can offer okay again very different projection anyone want to help us through this one the circles aren't circles okay so it's not informal okay okay so they're getting thinner so it could very well be equal area and as we said before humans are terrible at guessing whether it is equal area or not so okay yep so this is this is definitely longer than that length there so not equidistant soon a cylindrical parallels are parallel but meridians become curved yep okay good so not conformal equal area not equi distant pseudo cylindrical sinusoidal projection great what more candy okay II any volunteers okay yes oh so definitely not conformal that circle is not it's not a circle yeah sorry okay it doesn't look to be equal area I think yeah that's fair yeah so along the meridians you see any equidistant so this came up a few times in conversations so we're following a single Meridian and along that single Meridian were looking for the distances to be the same okay so the size of this the that distance there is definitely not the same as that distance there you can see my cursor or not but along this meridian they're all about the same so equidistant is a good good shout I'd say yeah azimuthal because we've got complete circles for the merging yep the the naming the the more obscure we get the the easier the naming gets right so as a beautiful equi distant is the name of the projection it's also an azimuthal equidistant projection which is great did anyone spot that red line okay so this red line we didn't really talk you through it is a great circle from last year zero longitude zero to New York okay and in every other projection we've seen so far there's been a slight curve to that red line okay it's slightly curved here it's definitely curved they're curved here okay but that's this as a mouthfull projection that we've just seen is the first one where it's actually been pretty straight okay and this azimuthal projection is centered at zero zero and all great circles out of zero zero on this map projection are actually straight lines which is a really nice property in some situations okay okay any yet the circles are definitely circles and yet formal no Larry that the suggestion is that it sacra distant but I'm going to zoom in a little bit and try and take a little look at that so yeah I think that circle there he's the little hand cursor kind of yeah definitely that circle there is significantly taller than that circle there and it's on the same route so I think it's not distant okay and the classification of that projection as a move of projection yet again that same property that we saw last time that red line is a straight line the great circles straight and as you say they're the complete circles so the distance of the greates the great circle is not preserved the dirt the direction of the great circle yeah okay you sound you sound very confident so I mean I'm I'm gonna take you out on your word for that because it always blows my mind okay that's good good fact right right okay it's good not you said yes to conformal because the circles were still circles so the name of the projection very graphic yeah okay um let's try and get through these last few so G okay see you work backwards on this one seat you knew the name of the projection then yeah all right yeah see you know it's a Robinson yes so it's not conformal and you can definitely see that that's not a circle okay so you said about equidistant there and did anyone get that wrong because I did when I did this one because that looks quite equi distant to me it's everyone else get this right yeah they kind of looked like it to me so the one near the pole here is okay okay yeah this fit um I didn't haven't have a good eye for that I get this wrong so but no one else did so that's excellent we should come to these guys yeah yeah and you were about to tell us um the classification of the surface okay yep that's bet did anyone get more specific than other in the end pseudo cylindrical so what properties did you pick out that suggests that this is pseudo cylindrical okay so parallels are actually parallel and the meridians are curved yeah okay great he did the same for figuring out this is a Robinson and then he was like okay so what what properties is a Robinson so the cush can come and get candies right last one someone who's not already been offered candy anyone oh yeah you should come and get candy we're putting your hand up as off yes please okay yet clearly not default yep roughly equal area so that your say stating the equi distant along the meridians so let's just take a look at that would everyone agree with that yeah so my little hand cursor thing thing here is roughly the height there and then it's nowhere near the height there so I'm pretty sure that's not a crow distant and you can also see that the distance between here and the distance between here are definitely not the same not equi distant okay conic because we've got lines and arcs yeah yep so a conic projection that's equal area the Albert equal area conic projection is it's right excellent um that's that's exercise as I say thank you for engaging and kind of making that a fun exercise and communicating that was really enjoyable and could have been less enjoyable definitely so I'm gonna yeah hand back to you it's all right okay so that was that was fun Phil says he said thanks very much when engaging and they're so we've got no kind of be sister cycle forward I understand a little bit about the language of projections and there's different features there's different metrics so what we're going to do now is we would like to start dipping into pine-sol and [Music] specifically so the good thing about carpi is it indicates really well with my port lips have used muffled lip hopefully you do the it's not a bulb on top of it or a wrapper around it so this should been all sorts of prizes when you're using pi and that pot lid so we're gonna look at some of the documentation that's we've got there for pikers matured over the time there's lots of gallery examples and tutorials and information they've been talking about so as well normally it's the air the projection list you can have a look at things like that and also get familiar with toecutter pi and my pull the pleat together really okay hot sauce that we every time I'll get used to dry there so the documentation because it's I tools like I said there's a ton of stuff there this worthwhile Gordon organy so will dip into bits here and there as I see there's an old introduction there's a definitions list there's some installation guys but wrong in Konya using that we talked a little bit about my pot lid home structured class hierarchy some of the key words that we use to form a pot lid to integrate them up what live using the transform in the projection keys and we'll touch on that later on and there's rich features earn their readers touching that later on and how you can get involved so um you can take the time and probably cut out will definitely some of the bits Iran but Qatar by itself it's more trade ooh is that the lot projects we really engage with open source and they're all projects out there that do things really really well and crane has joined the dots and some of those things that are stands on the shoulders of giants somewhat because we're building top of approach so using projections we projecting things like that you can approach for numpy of course cheaply for which is Geo's to control your geometries and of course if what you get with matplotlib you get your publication quality maps you kind of get that for free with cut pine it just works so it's additive to it so it might have some specialist specialization is an extra behavior that plugs in quite nicely more point that as we go along and it's this object object going to more point that we are on but basically what it comes down to we understand projections a little bit more now so what we care about in this world is there well we've got rips I represent our data on our projections so what we're thinking about here are five things which is a points lines vectors which are like your specialties of lines with Direction magnitude polygons and then raster images and cut I can handle all of these it's got some smarts under the hood that can I meet your life easier particularly when dealing with some interest in projections so we have a remote crack we've probably projections there's a class that represents projections and we specialize that we've got subclasses of that that represent each of the projections these and we've got certain different behavior and we've tried to can I make it easier to interface human eyes or make a rather than using approach for primers up we've tried to make it easy to use with the keyword arguments it's obvious what we do and we sometimes you have to get science on defaults if you try to make sensible defaults but you can change them obviously and couldn't start with something simple they care plat carry so we looked at that before so I guess you guys have you can either watch or you can run along as I'm going through the notebook but you've got your evidence set up so we're going to talk about projections what we tend to do is everything lives in the CRS package so anyway just call it CC RS so we're going to import that and there's a whole bunch of projections we just drop the documentation these are the kind of things that we just we saw in that exercise quite information about each one keyword icons to commence or carry we've got I can change the central longitude the globe this year they're determinants underneath there's lots there you've got each of the representation and then you can see how you can control that projection for keyword Islands you can pass them to control it manipulate it in the way that you want to visualize your data so that's all there we're not going to go through them all but it's what well we keep going back to that again again is developers so it's useful can I resource to have so okay so we've been poured imported a CCR s and no Ghanians didn't instantiate a class or is simply we're just quick clear prediction and sure enough scope eyes come back is create a projection so what can we do with that we're in the mode of projection so you want to see what God so yes but these were we hadn't agreed with with matplotlib matplotlib and needless to say just doesn't say you don't meet to use my plot live with Caterpie can you just use it for projecting your data if you want to Virge eyes it and use my pot lid but it stands on its own in that book I named some exercises later on it sure that because you might not wanna actually plot your deal you just want to change the numbers and we project it so put on the book my pot lid the currency there is axes but an axes it doesn't understand any geospatial information so this is the canal the cool thing about carrot pie is that understand the language of map what live and it gives you back an axis like thing but it's got the smarts in it that understand how you want to Portland it for maps and its RG waxes so you can we kind of documentation but there's more information about that and there's methods let's let's go there why not so we've got a class at you access and there's a whole bunch we've added extra methods in there which some of them will dip into you'll see throughout the tutorial and there's other ones you can go off and connect scorn your own time and raster images all sorts so these are gonna inherit eight for each axis and you can use them because they're because they're so we can find about those later they're wrong right so okay tops enough let's let's see a projection okay so we're gonna use them up ahead notebook and put my pot lid so the key thing here really and this is what's kind of nice the way this interacts with my pot lid is that there's nothing new here you can create a normal axis and my pot lid as you would normally do like this but we've used the projection keyword which was already existing and you pass in your cartr pie projection so this is telling you this is the this is how you walk this is what you project you want to see when you do the plot so we're saying we can access and the target projection is plot carrying and there we are that's the chiller finished thanks so much for coming I hope you've enjoyed yourself hey guys there's not a lot there a system axis you can can't actually see anything but what we'll do this can I go back no it's not scrolling oh that is right parson Mac panic modes there okay so we turn our plot that happens so there's nothing really there it's just an axis nothing different but it is actually a dual axis that we've got back and you know pots and you can do subplots as well so it just works but we want to see something make life a little bit better so there we go so there's some stock things that I said some of the methods throw an axis that kind of useful so here again create an access bog-standard thing in my plot live you've seen what I want to see is a peri projection that you all know and love by now and we're saying well actually no but the axis just draw some course lines and we borrowed we lean heavily on natural earth provides some rural solution coastlines you can change the resolution so here we are Kerry got some coastlines fantastic you can you can change that projection to anything that you want this in a projection list okay and of course they said it can there should be no surprises that's what we've tried to aim for with this integration of Caterpie and my poor lib saw it should just work for subplots same deal I'm going to use my pot lip vanilla subplot we just create a passing a projection again subplot keyword arguing how do you know our coastlines again so it's all good no surprises so that's what we've been kind of aiming for so for you guys hopefully that you've got an environment that's running we've got a little exercise for you so no yeah give it a try okay so what wouldn't you do is too good the documentation there's low ink there you see information about black eye projection use that information to help you to create a global plaque a map with coastlines but the differences we've just done man there's two but the difference is I want you to Center it on the D the D plane which is a hundred need to be longitude rather than Greenwich prime meridian okay so use this sail in here to write your answer if you clicked on that you'll get you'll get the answer so you can click on it have a look if you want but just try it's not moon miles away from example that we're using here but you have to do something Devon different to tell the projection where the central long to cheat is so we give that try there is enough people got em their environment up and running hands up if you've got your environment I've been running well you what you got that crack see five minutes good time for that yet okay let's not leave this one too much and so hopefully you manage to get to the documentation so that's five dots that's good there there is a projection list document which bill point pointed out and the plat carry projections the first one because it's kind of a pretty common map projection and there's this keyword on the map on the plat carry class central longitude and it's that that we want to change completely lost now yeah so we've already imported classify CRS as see CRS just kind of a common person I'm just going to put it into a variable see CRS top black array and that's central longitude there we can just set it okay before I get too much further I it was suggested that I point out that you can look at the documentation for this class in the notebook directly if you want to so you just put a question mark after the object that you want documentation on and Jupiter will pop up a little bit of information and yeah you can also see their central longitude can be set okay so that's simply can be set like that axes projection so this is that that Duns that builders the projection keyword argument when you're making in axes you just pass it projection object and it capture that and finally I'm gonna make use of that super useful method coastlines okay and you show and there right so one of the issues is reusing them the notebook back-end and you need to remember to make it bigger each time you want to make anything kind of sensible but easy to forget yeah and the results if you not a zoomed in as me is a map centered on the anti meridian approximately the date line and in fact carry and at the same issues growing out of there good any questions on that have I done what this solution told me to do yeah so it captured a plat carry object 180 and used it in exactly the same way any questions observations right no but the key is that the the axes that you're getting back here is a catified geo axes it's not an apple they're backsies so this this function here this plot two axes is is basically yeah is basically a map pot Lib factory function it constructs an axes for you and it's the keyword arguments that you pass which determine what type of axes you get back just going on there so the result is a Carter PI geo axis and I'm gonna actually just talk about the the useful methods of that geo axis in a bit so we'll actually get a bit more experience of what you can do with one of these things beyond just calling the coastlines method any other questions okay so let's let's do that let's find out more about those that geo AXYZ object I guess maybe I'm maybe before I do I should just do a type on that axe just to really prove to you that this isn't a map live axes this is a cart PI MATLAB geo axes okay this is the thing that Caterpie defines and that's documented in the cart by documentation you make that a little bit bigger it's the geo axes and it's a subclass of an axis so you get all of that behavior plus a bunch of other behavior on top of that I'm gonna start tidying up a little bit too much [Music] that's a really good suggestion yes so that instance we can also get some docs on using the same trick with question mark at the end and it kind of gives us some information there about what's available yeah I earned about that the other day that's a good trick if you really want to see how this has been implemented you can do a double pressure mark and it kind of gives you this source never done it before didn't work maybe that's in we found a bug maybe scrapped what I just said one question mark will give you the help on that object okay so we've already seen one of those methods on the geo axis which definitely doesn't live in the map below backsies and that's the coastlines method right it doesn't make sense for there to be a generic coastlines on an axis in MATLAB but it completely makes sense for it Carter PI geo axes in addition to that there's a couple of other really useful Geographic type methods the the gridlines method allows you to kind of draw graticule x' so parallels and meridians and there's also a really low resolution natural image that you can just throw on to the axes using stock underscore image and that will give you a bit basically a bit of blue and a bit of green and just that it doesn't look quite so white yes so the questions how low is that and it's really low so at a global scale it'll look fine not great but fine but at at any kind of zoom you're gonna want a different image okay and the main reason for that is that we ship worship some very basic coastlines and we ship over this very basic image with the package and we don't want the package to get too big so there are a bunch of other interfaces which I'm actually going to show you to get higher resolution coastlines and high resolution images as all I guess on that front you would normally add an image to a map of the axes using the in show method or the in shot in show pipe what function right the same is true with catify you can just use that image show method but with Caterpie we've had it and then at some extra behavior which we will look at shortly but there are a couple of other new methods that that don't exist so there's ad geometries and for those familiar with Shapley basically you can directly add a shape the geometry onto the axes and it will project it for you and then finally a little note about these two so set global basically we'll zoom out the map as much as the projection allows so global is kind of a questionable word but that's what it's trying to do it's just zooming out as much as possible and set exempt extent allows you to kind of set a bounding box for how how zoomed in you want or the extents of your map you want so again all of these except M show are new to the geo axis and even in show with kind of overridden in the geo axes question so there's a question about Jia pandas and it would be remiss of me to answer that when we have your assisting in the room he's the resident Jia pandas expert so you're s okay fine okay thank you great so let's let's take a look at some of those things so there's a little example here we make another plaque carry projection because it's so easy to see things in plaque carry and that AXYZ object that we make we use the set extent method and we pass a bounding box through okay and I always get them mixed up it really upsets me that I always get them mixed up this is X min x max y min Y max I hope and now that I've said this publicly yeah on top of that we're also using this new gridlines method which you can basically pass Matt put a live type keyword arguments through and so these are fairly standard kind of interfaces for MATLAB you can change the Alpha except the line style and stuff and there's also a magic draw labels keyword on on here which will basically give you the words and we're also going to see that lowish resolution background image okay let's run that and then I can show you a picture and let's do something about that bigger size I'm gonna zoom out just a little right so I was right after all so it's from minus hundred and seventy longitude to minus fifty longitude yeah minus 10 to plus 80 latitude good and you see the labels have been drawn we've got a grid line going over the top and we've got fairly well you can see how poor the resolution is there one no it's it's not a particularly high resolution but it gives you a nice splash of blue and green I think is probably all you can expect from stock image okay right so there are a bunch of kind of tools on top of what cosplay tools that cut by provider guess and better ways of getting more data but let's kind of start fairly manually so natural Earth is a basically a collection of really amazing datasets that they have and I have free downloaded an image in the resources folder which is a slightly higher resolution image as it happens and there's nothing stopping us using standard matte lip stuff to load in an image or you could use stuff like psycho image pill pillow anything basically that's going to give you a numpy array to represent this image and it's a thousand by two thousand by three colour channels and in addition to that excuse me I'm also going to load in a state shapefile okay so this this is a shape file which contains the outlines of the I think it's just US states okay and we can use Fiona for this geo pandas would work just as well if you're familiar with that or you can do the really manual approach and use pie shape in this case I've just used Fiona so basically I now have a an array up here which represents an image and I have a list of shapely geometries okay there's a pretty fundamental geospatial data types that I've got nothing to do with Caterpie really and you just add them to a car to PI geo axis by using fairly standard methods so I'm sure will do the trick you had an image that's the array this is a map of libitum to tell you that the pixels start at the top rather than starting at the bottom again with Madlib you can control the location of where this image should be plotted so we do precisely that but there's this really big important thing that you have to also know about when it comes to Caterpie and it's this keyword here the transform keyword okay and this is basically these are the this is kind of one of the major points with cosplayers you can specify the map projection that you want and the transform of the data that you're adding when you add it okay and we'll see this time and time again so keep coming back um I'll point it out again I'm sure but we're specifying the transform of the image and then this geometries method add geometries method basically we passed that list of geometries the coordinate reference system with those geometries are in and very standard map live keyword arguments when you're making any type of patch or yeah not for the Apache I guess okay I'll stop talking let's look at picture so we have now definitely I can see it I hope you can see it from back there a higher resolution image here which is much more pleasant and I've overlaid US states on top of that image so all of this is basically additive on top of map that lives standard AXYZ methods we're just adding geospatial aware data yes so the question is these geometries other is it assuming they're in lot salons and the answer to the question is definitely not so you're telling it that the geometries are lots of Mom's by providing that coordinate system okay and they could be in anything else that you can represent in a cart that's my corner for the system okay No so the question the question is are we specifying here the target coordinate system and the answer is completely not this is the coordinate system of these geometries okay and if you want to change the target coordinate system you do it in your map projection when you're setting up your axes okay so the map that you're producing is defined in the axis the axis knows what map is making and when you're adding data you're telling it what coordinate system your data is not what it should go to okay thank you that's a very useful thing to get clarified we'll talk about this again more but does that make sense with what's going on there okay so this the question basically is if I have a satellite image what map projection is that in and I'm there maybe satellite experts in the room and I'm sure they will all wish you good luck if I'm honest because it's really hard to find out what projections and things are in often you will you will be able to get satellite products that are projected for you and that's always a healthy place to go from there is a good example in the gallery and that segues nicely let's do that so the catified documentation has a gallery you could always have more pictures definitely but there is an example of that and I'm gonna actually think I'm gonna be brave and show you the code here because as I recall we've got an image that the image projection is actually a geostationary a stationary object it's not plaque Harry these aren't lats and lungs and these are crazy extents they're not lats and lungs in extents either and we end up just simply using em show and you're setting that the transform is geostationary it's not Barry and yet the map that we're looking at is a carrot okay so a bit more scrolling sorry no there we are got myself in a puddle it's not like her it's a Miller projection but the key is the projection of the image is not the same as the projection of the map okay great so then right so the question is the three examples of put forward now have made three separate instances of plat carry is that does it make sense to consolidate that in some way is is that is that representative of your question actually there is a bit of a cost to creating a plat carry object it's not particularly high but if you were in a for loop and you're making thousands of these things then yeah you would definitely be considering bring that out putting it into a variable and reusing it the only reason I'm not done that here is it just makes things much more readable so let's see exactly what's going on and it also means I can do crazy things I think and this is never a good idea but I'm gonna do it anyway hello okay that was a terrible idea let's not go there oh yeah i'ma cater right okay right this is interesting right so that image that I added if you remember was plot carry the data I added was plot carry but the map were looking at is definitely not that correct right so something's happened here and the reason that took a little while is that the image has to be reproductive so classify is not the fastest it's quite general in its kind of ability to reject images but it does it eventually and so that's what's actually happened here but it's also reap rejected a bunch of other things like the states outlines okay because they were in like area but now they're clearly not good don't go off piste right right so some interesting notes from here so we're doing more work than we need to so cusp I already has already knows how to draw states and it's actually quite simple you just add add the states feature and it'll just do the right thing what are the one of the really nice things this bill was pointing out earlier is that we're building on top of MATLAB we're not kind of reinventing our own interface so if you want to change the color of the face that MATLAB is drawing you use the map with a keyword argument face color and if you know map but live then you know what keywords you need for cosplay nice and consistent and all that kind of stuff and yeah this this key thing which I'm going to keep laboring throughout this section I think is the transform keyword argument that we used is what specifies the coordinate system of the data that you're adding so when we added geometries we're specifying the key the corner system of the geometries not of the map that we're making okay this is when we use that projection key to make the axes that's when with saying saying what projection this map should be and they're two independent things right again keep laboring this so why it's important specify the corner system of the data as well as the projection of the map so these things are independent and I guess one of the really most most important things that I'd like you to take out this really is that Caterpie is designed to reproject your data for you on the whole classifier will do the right thing when it comes to polls and some yridians interpolation and map boundaries okay which if you've ever tried to kind of project a line that crosses the Dateline or something like that you realize that it's very easy to get it wrong and mess up Caterpie tries to do a better job okay it's a nice feature okay so I guess a little bit more about that transform keyword argument is is in order sorry question okay so why the question really is why would any image not be plucked just like Harry why why is there any other projection out there I guess or how's it encoded in some way so plaque Harry is the simplest of simple projections because one degree of longitude is the same as one degree of latitude and in an image that's the really kind of convenient property and you'll find an awful lot of images are handed out like that fundamentally if you're just yeah I guess fundamentally they're laid out differently in a in an image for different projections and just different properties I'm not sure that's a great answer but hopefully that right so let's dig a little deeper on this transform side of things and let's start drawing a line between two points okay now on the sphere there are several ways of drawing a line between two points and in a projected space there are several ways of drawing a line between two points let's pick two of the most common so between two points on the sphere you probably or often I guess we'll pick the shortest distance on the sphere which as you saw with that red line in the projection exercise I did earlier doesn't always result in a straight line in a map projection okay on the other hand and sometimes you might actually want a straight line in the map projection perhaps because the map projection has a particular property and you want to preserve that in your line okay so there's a little example here we've got picked out some coordinates of two cities where we've got the lungs and the lats picking them out and we're just using matpat lib here maxi's dot plot I should say that could equally be PLT dot plot it doesn't really matter just let's use the axis object method pass the XS and the Y's and again pointing out Long's and lats not lots and ones you'll find that ubiquitously in car spy that pretty much lumps come before that's X's and Y's it's a standard plot with the transform keyword argument and I'm saying plot carry these are lats and lons okay the default character a instance represents like someone's nicely and yeah I guess I bet it a label and we'll see what that looks like in a second let's plot this and go from there right so we've got something to talk about now at least so we've got two lines between two points and they're not the same line okay one is clearly a straight line between the two points in this projection and the other is clearly not a straight line in this projection okay but it turns out that this not straight line thing is the shortest line on the sphere okay it's a great circle for as this thing is not okay so let's talk a bit more about that so the the line that the accurate extra equirectangular straight line is pluck carry that carries a projected coordinate system it's Cartesian and a line between two points in a Cartesian coordinate system makes an awful lot of sense to draw a straight line in that coordinate system okay so which is why we're seeing straight line impact correct on the other hand there's this other object in catified with geodetic coordinates system it's not a projection you can't make a map of it but it tells carpi that when you're drawing a line between two points it wants them to be a straight line on the shortest straight line on the sphere great circle so this geodetic thing is quite magic in that it's kind of telling Carter PI how to draw the light it just so happens both geodetic and plat Kaare understand lots and Long's it's just how the line is interpreted that which is different the only other thing that's worth noting here I guess is you know that work we did earlier to add the states using odd geometries you can actually just import cut by feature States and add it the axes and it'll just work useful any questions on that okay yeah okay so you're pointing out that the great circle is pretty ugly it's not particularly smooth okay which is great and I'm gonna move on to that right now so let's let's fix that in a second any other questions for that one's right actually I'm not going to go straight on to that I'm gonna go on to that in a second after this section if that's all right and remind me the question if it's not said let's do something slightly different with this with this map okay let's pick a projection where the great circle is a straight line okay and that that naturally will mean that this straight line here will refloat it won't be a straight line in the projected space okay bit Mindwarp II but can anyone put forth a suggestion for a projection that would preserve the direction of a great circle a great circle circles straight from a particular point Makeda is a suggestion that's interesting it's not quite right but I can see why someone might have said that who was it that said it right a stereographic would do the trick and what kind of projection is stereographic what's the developable surface of a stereographic projection yeah as a missile someone said Yeah right and all azimuthal projections have this property where from the central point the great circle is a straight line okay so we could pick any azimuthal projection stereographic it's a great example we do precisely that in fact so let's construct one of these stereo graphics and I'm actually going to pull up the documentation because it's worth going there so that projection list is the second one down in the getting star and eventually you can see down a list there is a stereographic and there's a bunch of keyword arguments you can change including a central latitude and the central longitude okay and all I'm going to do is set up a map projection which has the central longitude at one of the points that I care about I think I've picked New York okay and that means that any great circle out at that point is going to be a straight line so we should see some interesting properties coming out of this so set of percent stereographic centered on New York set the extent in lats and Long's add some grid lines at the struck image at the states and draw draw the great circle and the straight line in plat Kerry space okay let's take a look okay taking some time because it's rejecting that image in stereographic but it came came out again and this time that great circle as we hoped is a is a straight line okay but that equirectangular straight line that we drew before which used to be a straight line isn't a straight line in this coordinate system okay if we cross-reference it though we'll find that it actually goes through the same points as as it did before I'm not going to jump around too much but if you're following this on your own machines then you'd see that kind of like definitely goes through here and it definitely goes through here okay this is just this the same data being presented in a different projection okay and I guess this is the key point about Cal Fire's you tell it what projection you want and you tell it when you're adding data what coordinate system that data's in and the rest classifier will deal with yeah so core principle cats bite gives you map projection possibility and carpi enough context to project your data for you key take-home message from this section really but in answer to your question the big downside of automatic read projection is in reality you don't have an awful lot of control it's not easily easily controlled and there is a performative costume we were seeing that one we re projecting that image okay so for example the lines in the previous botanist we were low resolution so this is demonstrating the cosplay whilst it looks like it's producing curves is actually making straight line segments it's just having to kind of approximate and interpolate it's been an appropriate resolution and it turns out actually that resolution is probably not appropriate for the plot that we've produced so right now there's a there's a little bit of a workaround to improve that there's this threshold property on a projection object and basically i'm subclassing the stereographic projection and I am giving that threshold I'm just making it yeah getting the threshold lower and I guess this is this is interesting because it shows us that we can also create map projection casts by projection objects ourselves don't actually need this to kind of be built into Carter PI this is something you can actually extend yourself if you need to so I make a higher resolution resolution stereo I'm doing exactly the same things I was doing before not changing any of the code that that function which draws the line is exactly the same and the result is working a much much smoother curve on there on that line okay so to be clear just to continue answering that question fully we've in Riis that the tolerance the threshold on the target projection not on the source of projection so when we're converting our lines and there's an iterative process that's going on and it figures out for this map that I'm making how many times do I need to refine this line so that it looks nice and smooth and that's precisely what we're controlling with like threshold Q it all right that's the geo axis and some of its methods so we saw em show we sure we thought had geometries we saw that useful cosines method we saw C set extent and set global and basically we can throw data onto a map in pretty much the same ways that we can with MATLAB plus a couple of useful ones for common geospatial type stuff including shaky geometries so I'm going to rest my voice a little bit and let bill talk about the main theme of this tutorial and that is around the world in 80 days okay so I run the D or in the world in 80 days or 80 weeks that was our spin out so Phil's can I set it up quite nicely so we have been building up in layers about understanding rejections what they are there's different types and toe and cut a pie suddenly surprises there the way we control the source projection and the target projections choose the transform and the projection keyword so so we're going to pull this back to our whole kind of abstract which was around the world in 80 days so anybody read the book a long time ago seen the cartoon or something like that yeah so Jules Verne so we offer mr. Fogg here who is he's taken our wager and he's gonna go around the world and it's quite nice it's just that means - for us to connive special kids Carter pie because we want to eat chosen his route that he took and his AEDs around the world different projections hope you control that how that works so we're gonna start tug on that theme a little bit and explored different parts of it so for you guys who have got an environment we're going to do a little exercise here so Philly's fog that's handsome chap here on the run with his carpetbag and 20,000 pounds to go around the world punched trouble in the world me titties Slough he set off in October and then he got back in December he plans to depart from London and his main stops I mean routes 8 to 20 series Bombay Calcutta on Kong Yokohama something Cisco would thank you are spelling of San Francisco's a bit flaky some places but we're British okay New York City and then back to London okay so knowing what we know want to really draw a map to show this this this route okay so we'll set you up with here are the places and here are the Long's and lats to give you just as long as it takes yeah so drawing on what village has shown you to do a plot can you draw I think we've got it in cut carry perhaps yeah that's the one with one Sean can you sure the roots of Phileas Fogg when you went around in the world so this this is going to help you too so you know the places and you know the Long's and lats give you about the time to think about it essentially you want to use creating the right projection for pluck carry and then you're gonna plot these points draw the line so if just you just realized with the big we thought the Greek was at half half but snacks or save until half past so that I slightly long so I'll do so quickly zips it through this this answer name and it's all not get too hung up on this it simply we're thinking about drawing a line on a map so you use plot basically of month I plot let the difference says is that we kind of pushing of the space or thinking about projections so you know that you want it off you use cut PI you but geo waxes so we know we want to say it carries you think so you should be thinking these two things that projection and the transforms all they want is to create an axis that it's plot carry you know then we get a bunch of flats and Long's although X's and Y's you should use my pot lid pot to plot it and you can tell it that it's in plat carry sort of look at the solution step through it come backwards okay so here we go and there's there's a little bit of mangling of the deer to get in the formulate the one so we do a create a figure they want to do and then here's the bit of magic which is we create our normal map flop their axes given up the projection keyword to see I want this to be in flat flat carrots who here's a ricotta pie comes in you create your answers of your clock re and you'll get back your geo waxes here we are your access so we white see some coastlines so you cannot use the the method coastlines on it and now what we know is that we've told you the route from London to New York no background and you've got your lats and your long so we just there are several ways to skin this so we've decided to unpack things with zip essentially for each destination you get the place and then we take out the can op the dictionary for this place we get the long okay laughs we've created this tuple so you have a list of tuples lots and long Zamir using leverage and unpacking and zip to get the list of all the longs novel ask you could have quite have easily just cut and paste them put them in if you want you to okay so now we've got long as we've got laughs we've set up our axis which we've created so let's add our stock image which it will resolution we've added a title and this is with the screen align now we've done all the hard work so we've got Long's got laughs we're using plot on our geo axis so it cuts on a geo axis understands but lots and long quick plot you line in the right place we're adding some styling which is just vanilla my pot lid will make orange Lane word and here we're saying it is geodetic so this is come back to what Phil saying it was in flat kind watch straight lines then you put black pairing but here we're seeing its geodetic so the great circles who expect them to see if you've got two points and joined the line and so on plaque I would expect to see some kind of carving there here we go as Mac yes I copied something yes I'm proud so come on v-net well done thank you thank you thank very much right so oh and it should be working hard where's the lines wrong something yep cover done places uh-oh idiot right we're done wrong I'll run this out that does help thank goodness for that so I didn't create the please whip didn't know birthplaces place we've run that again just getting too excited okay so there we go we've got something there's what we want me but there's something bit odd going on there right what's going on anyway what's kind of obviously one from nothing in grinning in the back yeah something weirds going on there our member has gone through this sounds like Bill what's going on so basically deploy two routes we've got a plat carry we've got some kind of carving going on there which is what we're expecting but you'll see just as it went round and t-midi we're doing this one up here it's wrong yeah down there what's going on so this is this is something this is yeah some things work some things thought so what we've actually done is there's a bit cleverness and cocked pipe and it's it's basically seen in a route we've started at London went to sewers went all the way around which is fine but if you start an end point exactly the same oh this is kinda what it's done sister thank you that's for free so that's clearly wrong so we're going to fix that so you could either just at the moment yeah yeah so we can fix so if you would say ignore that part that would be what we're kind of looking for so yeah so we're the heuristic in there it's not doing the right thing and it's it's kind of healthy thing when you actually become a user of your own software you actually discover some things not quite work that we expected yeah that's good so we can fix that that's fine and there's other examples we use that much later on but we still fix that so that's the example conscious of time you guys need to get some stacks up some comfort break and then more crack on okay yeah so to add to that let's take ten minutes hopefully that's enough and so there's tea and coffee and things and cold drinks out here and I did a little recce a second ago because I can tell I can just get the sense that you've got a sweet tooth as a group you know with like eye candy there is some snacks but you have to go on a bit of a labyrinth mission to define them as far as I can see the only snacks that I could find are down the stairs and then as you come down the stairs you turn left and then there's another left and they're there there's some some goodies so if you have two snacks okay there's food in breakfast room - that's a good knowledge thank you yeah okay so I think um when when you start back another few people missing but will will crack on so of them eventually yeah a lot material to do that's okay just about to start so quite a lot material in there we were actually fearful that we had we didn't have enough hope I've got loads so winning start pick and choose some things so rather what we'll do is we'll them well and do some of the exercises in here we came to get to some of it juicier bit later on so what we do is I'm I'm going to go through them top through the solutions that are already there she got questions ask try and answer them and then we'll catch up with ourselves yeah sounds like a plan so previously poured the break we discovered that the world was indeed flat and it went around the back no so this was a estimate of folks roof the wind went round but we've done a bit of digging and we found that if you if you read the book what you realize is that here's London and even fog went down to Suez but you went down the Suez Canal to the ball went across Bombay and here from Kolkata to Hong Kong who took another books he went knowing this kind of peninsula here so and that's not quite representative of what's going on here we've just sticking the degree so-called shortest path between the points so we didn't go down here and it's not good around there so be nice so this is this an interesting map you sort it from from Wikipedia so let's say well the aim of this is really to to use this image to the roster into your reference image so we can display our route over the top but we've got a question so given the work we've done this morning a little bit knowledge there about projections wall projection I could this image BN and why given you know a little bit about some of metrics and some of the classifications this is the better better guess work maybe you've seen our projection that was on the Shiva this looks familiar similar to what what are you thinking yes yeah Robinson right okay that's things so close yet scissors but I can i curvature yeah yeah so okay so there's so there's a bet pair guesswork theory you can almost if your pond into that quite quick quickly and we've done a bit of digging fill them a bit and it turns out there is actually a Robson projection but you'll notice that it's a slightly weird it's got this boring but things are a little bit compressed at the top and it's a bit odd because the continent missing here in fact to cut he goes there anyway but so it's not quite right there's something bit strange going on but it was better compression there and it was centered on the married you know 11 degrees in 15 minutes so we were gonna give you an exercise but we'll walk through it just and ask questions so the the exercise given given that that that image kind of looks like a Robinson is to go to the documentation which you know love no there's the list of projections we're focusing on Robinson so to the task was to draw a Robson with the map of the course Lang's which we know how to do because that'd be a message just on our geo axis Center it on this on this Meridian 1125 degrees and plot that so none will be no there's not a lot so we create a create a figure as before and we know we were interested in Robinson's so the projection the target what we want to see for the floor taxes is the Robson and how we control where the meridian goes there's a keyword argument you look at the documentation they allows you to set that this is quite intuitive so we know that now we're adding our stock coming to a decimated resolution splash of color in there i'ma run some grid lines we've seen this before remember this is edgy waxes so it's got this extra geospatial loveliness so you can just add in your grid lines and then you say Taiyo but a little tile there and that just works so let's see what that looks like command yeah there we go so it's clean Cana similar we've got this boring effect going round which I think want to think to a winner here so we've done that but you know unfortunately that map that we were looking at is no quite the same as I said before there's continent missing and we know that however this is being drawn this lines been slightly extended longer and this one's slightly shorter we'll see that when we report it so it's kind of course but this it's a little bit fruity so okay so there's something weird going on it you can get that with some projections it's it's when slightly off peaceless done some customization so there's a fun exercise Shane McInerney I rush past aware we won't take that I made you want to try and Jill get to work out what the extents are and we've got a little script that allows you to run it which will take the image Robinson we're going to trying we're going to try and correct it and line it up to work it with the extents our guess what the gets mistakes I never even use that to make the plot so I can do this right so here we are so I'm going to run this image Jill okay turn that one there we go so here we are so we have got our map they've got from Wikipedia it's got the correct route that was down and round and under it we've got our Robinson so what you can do is you can drag and drop this is where you get to that for me I'm really rubbish at this Oh where's it gone yeah you do with the Mac Mouse quick easier yeah that's defeated by the Mac again let's start yeah there we go I will just go wrong again so we kind of this could take me forever the trick is we're trying to put a factory to blame these up the green lines coming down it's kind of close touch to the right there's I'm having fun I don't know you get anyway so that was a excite you kind of doing that and as it's running along its print at the extents see we do that so it's kind of course enough we're just we're just cleaning around here to get full finger for fingers I'm going for it right so we do that we got the extents so that was the magic that we needed to take the take that image and then get the extent right so we whatever the extents using isn't the program though example there and the coordinate systems of these extents so what do you think the coordinate system these extents would be in loving how can you do this right okay so they're kind of not lat/longs kind of weird number something so suggest miss it'll be like our plans to me what do you think so what kind of projection or en Robinson exactly so we were in Robinson these extents are in Robinson's we just need appreciate the dip that we're using and we're passing the extents that mean good setting the extent on the Robinson projection so let's go back so with what types of Co extents who think they're in Robinson and looking at the chords when we add it was any image ad that we're using so let's am let's look at the cause we use if we worked out the extents I'm doing our geolocation you create a figure we know it's all about Robinson we're thinking of the problem since the target projection that is so we have created there and an instance of the Robinson projection remember there was a shift in the central Meridian I am to reason 15 minutes so we've got a target our target projection that we want to show our map and so create our axis we get back og or access this new axis will be in a Robinson projection we've set that up nicely we've added some grid lines we can add our coastlines again cuz the geo axis and this is the magic so this file that we saw you can use em each read so phil was talking about that so we can use plot imagery which we reload to get the image the world image so it's just a bunch of numbers right and then we've seen well actually we want to take this image I want to plot it on to our target projection which is Robinson which is conservative so you use them sure on our geo axis which have set all up tick oh dear we add it that's the raster our extent that's the extents that which is calculated by fudging around try to get things to line up this is our transformation so transformation the numbers were getting now for Robinson we who didn't think they were lakhs and long yeah and this is my pot left you see the origins on top said it was global okay so let's have a look at that see what that can would be okay so that looks kind of similar so if I scroll up a little bit the original looks like there is we think we've done the best endeavors you see there's a weirdness grant here this line as I said before is it went past outside the boundary so that's like someone's hand drawn that other than something a bit strange in this one it sounds like that's it's not quite right but us that's like that's the way is it's done the right thing okay any questions on that we're kind of happy gonna zip through that but the fact that you can tick animes you know the target Jackson you want to be any locator look at the extents the extents will be in that target projection and then you're just using the things that work or building uh familiar to use and Matt plot live using your friends that you know about image read tweeting the image and them ashore or new geo access with your extents and you make sure that you've these magic words transform projection if you set them right this is your data and that's the target yeah okay yeah oh sorry yeah yeah so we talk about these numbers here these are the numbers when I was questioning the image so yeah so that that was so this this protein up we'd read image Geo locator that was working out for you how she moved it because you were it was in that I was the Robinson projection it was as you moved the image it was recalculating the extents in Robinson's as it was going along so as you moved it these numbers were coming out and once all lined up that was the extent of of the image in Robinson so yeah and you and they were just cutting and pasting those extents into the notebook yeah see it cancer so that like drawing right okay so the question is filling in regions and different colors yes yes you can and we're great examples of that later on so it's it's the same as my problem you can just change the face color of a polygon that you can change the properties of a line or a point this is a it's the same kind of things same controls there's examples of that later on so okay yeah okay so that was well that was fun for me so I got to play with that what was particularly is there any further questions on that so quite happy with that yep yes sir this or questions about the extent what they actually are so that was just the the bounding box of that image and it was in it was the x-men xmax why men why max in that order and the units were in the units of that projection which promises meters I don't know you know we could find that yep okay so so that is that section here so over to Phil now okay so we've now seen the what's going on here live at this one we've now seen the how projections work and what projections are we've seen how you add some data with Caterpie - your what - your axes and we want to now talk about kind of treatment of that those classes of data that we're adding and kind of look at interoperability between those data types effectively so I guess maybe I'll iterate what some of these well what the purpose of this section is mostly to train your some clarity on you know the types of data that we are dealing with and once you know what kind of data we have we know what hopefully can know what kind of tools that are our disposal and also knowing what kind of data you have kind of gives you knowledge about what types of methods on the geo axes you can make use of so we've I don't want to take too long over this but maybe we could do this interactively in fact so what I'd really like to start thinking about is the two classes of data that we've already been looking at so vector data and raster data so rather than working in small groups let's work in one big group what examples of vector and raster days that have we already seen and perhaps also maybe you want to kind of give examples that we haven't already seen yet well what kind of vector and raster data have we seen so far okay you said two words you said lines and points and I'm gonna take both of those words because I think they're both valid and what class rates is kind of well and truly vector data in geospatial term the pencil vector right the cosines yep so what kind of data were looking at that right yeah polygons yeah Specter data yep yeah we had that stock image and we had the Wikipedia image and that's the example raster data yep seen anything else any other kind of examples of rasa and or vector data now States yeah it's kind of like the cosines yet vector data any other sources of raster data that you can think of yep yeah that not natural that image was definitely so thinking about stuff that we're not already seen is there any kind of sources of these kinds of P yeah sorry television right okay yeah okay so big right yeah I've never put it on the cottage cut by geo axes but you could it's as an example of rust the data right I've had a hand right where the maps okay so this is interesting so weather maps themselves are typically what right maybe you could get like an SVG which stands for scalar vector graphics which literally is vector data I guess maybe yeah that's a good example oh so where the map is gonna be raster typically you're right yep okay so could continuous type model type things so what where might you get that kind of data from what how am I sitting still so is it do you get it there's an image or do you get it as some of the format right Tiff's right cool okay so there's there's clearly a separation here between kind of a vector and a raster data and we kind of have already seen that you can add vector data with that add geometries and PI plot plot function and you can add images within show you can actually do stuff like P column aciem applet lib there's a bunch of tools for working with these types of data sometimes you want to in interoperate and sometimes you want to convert from one to the other and even sometimes you want to convert within that class so you might want to say if you've got two points draw a line between the two things so two subtypes of vector data and that's what the purpose of this I guess the main remaining section of this tutorial is about is that interoperability so yeah as I say that's what this is about we're gonna now look at Caterpie plus and this is where we're going to change our focus a little bit and start looking at some of the kind of a wider ecosystem and bring in some of the tools that that are at our disposal so we're gonna start by figuring out how we can do raster to Resta conversions and various ways vector to vector we're gonna look at some interesting application turning wrestlers into vectors and we could obviously be complete and do the final bullet point but which don't have the time for this tutorial so we just ruled out of scope so with that I'm gonna hand out with the bill to talk about roster roster all right okay thanks oh so okay so understand what Westar is so we're just gonna tenuously pull on this Phileas Fogg theme again good know in the world so we you've done a better work and we we found some some data from it was hardly hardly Center the climate climate Research Unit okay so we might just find some data that was representative of kiddo means surface temperatures during that period when folkway students joining just that fun so got some deer it reminds the crew we had to drill up but what to do that use an iris and there's a note big fear of how we can got the climatology anomalies together using areas you know cool that just now you can do that in your own time if you want to have a look at that but what's like do is we have a quick peek inside the data see what's there understand where it is and then generate some plots and it should come as no surprise that's all said is that we are kind of standing shoulders of giants with my pot lips or my plot things just kind of work with a little bit of cutter pipe how did to it for the geospatial understanding so we've got a file which are now gonna be so we're gonna use their NT dump just have a peek inside the file just to see what's there you guys familiar with netcdf okay it's just that so what we've got it describes things in terms of dimensions variables see saying I've got some dimensions here that's their extent or sometime some watches long shoots and some bearings okay some variables okay we've got meeting surface temperature is three-dimensional and these the dimensions here there's some may idea there as well it's describing some fill values got a long name which is a description mean surface temperature it's got some units it's like units with some Kelvin that makes because of his temperature and there's some extra sale methods but sometimes some Processing's happened on the deer and I make sense because we noticed the kiddo once the means and it's also giving some connective tissue to see I've got this data that's my payload but there is other information that describes that it describes the dimensionality and it's saying decade and month number and also time so this describes the time it's since an epoch the calendars got a calendar and there's some bounds of the time you've got a parent a point in the bones you've got point bounded time and here's a variable here that describes for the latitude dimension of the latitudes it's in degrees north units okay the information they're seen with longitude so there's a bunch of information in there and that we can pull out it's got surface temperatures and there's a little bit of extra information that next CDF keeps cool attributes it's like a dictionary just of comments history things that happens sources in the data things that happened to it so there's various ways that we can read this end we do explore a bunch of other things using netcdf Python back to basics used X sorry we studied too much it's too much so there is an appendix there's not book there where we explored and done the same exercise here we were decide we're going to use iris because iris is so it goes hand in hand with Carpi and allows you to logically analyze it and you just cut by itself to do this visualizations so let's pulling that theme and we'll use iris and cut apply together IRS in a nutshell you get to see it deals with multi-dimensional data so just think of a number re and a wrapped around that is the metadata that you hear about so there's just data but what gives it meanings the metadata saw Times latitude longitude information like that the describes where it is and that's information that we need if you want to do it plot okay so we have surface temperatures we have units information like this so iris can read Messier owls grab these other formats and we can ingest it examine it and a movie plot it so that said we're going to import iris and then we're just going to load our file which should we just add a peek inside it's a bit noisy and there are three months in there because if we looked at time time was three we process it to cover the three months October November December to cover the duration of folks journey and but it's me de kado means for the 1870s so read this end we get back a cube it's an Irish cube so think again like this numpy re with metadata wrapped around it you do various things so let's sort of peek inside the cube and it's saying okay this can I maps on to what we saw inside the net CDF are it's saying there's three dimensions and it's kind of pulled together some of the met idea to make it a bit more readable mean surface temperature as the units are in Kelvin that's the extents and you seen I've got some coordinates that describe those dimensions we've got time we've got latitude longitude so there are coordinates that describe those dimensions and there's some axillary coordinates one on time that's saying I know what the decade is and one on time saying I know the month number was okay and then there's these extra enormous sort of attributes that it collects as here all I know about them and here are the values okay so let's just make sure knowing what we know yeah that's right so we've got three decades and local 1870s that's what I expected and we're hoping that these are the three months of October November December the numbers that make sense that's good I'm time you can have a look it's points bones it's bit noisy here so you've got three points you can simplify view can actually ignore that ignore them because the way it's been actually means and aggregated but what we're interested in is one of the bones here that's the first one that's the beginning at the end of this firm lead point and it's from toolbar this is November and that's December and also because it's time coordinate it was what calendar it's in that's use so I've got a bunch of information here that's great so we want to see it okay so let's send cherry-pick oh let's focus on just October and see okay so this data is gonna be rusted here so let's do some inputs first some Norbert carpi coordinate reference systems we're going to leverage some benefits of virus cuz we've read on a cube and we give some convenience functions that just wrappers around my portlet that do think my plot let things which we'll see I mean put math with itself okay so what we're going to do here we're gonna create a figure and here we're gonna see well given my cube just give me back the tenth month we could easily have done this same or get me back there easily if you wanted to do toolbar don't go off piste right he calls cube no use something like that okay it's all the same so once we now got our October cube of got that month the decade or mean surface temperatures October so happy with that they would want to see it so here we're focusing on good raster data to raster data so is this gonna work we know I'm gonna have a couple subplot but we're gonna do is when you show a pea color mesh that data and we're gonna show a contour s so these are just map what led things there's nothing nothing nothing different going on here but what is different is that we've added this projection word again keep on seeing this again and again but this is just saying okay this is standard map pot lid but the projection is in Robinson I get back i G waxes and here we're just we're using hires to see because Irish speaks and cubes okay and they'll say well here's my data I'll give you my cute give you a peak color match and essentially it's going to call carpi in my portlet to do that but it does a little bit work for you cuz understands all the metadata the last belongs the time all that kind of stuff that's fine nothing new there we get the title we add a coastlines because this is a geo axis it's in Robinson and we're setting a global so we've got to extend so that should get Pico a match across the plot let's do the same again same deal put another subplot projection is Robinson contour F we're using the IRS because it's easy in one line we pass in our cue from the data that we care about and we add the closed lines your tape we hear from your running saw no there we go so we've got some data it's Robin since I've got like as we expect it's kind of looking similar to that Wikipedia roster that we had the here we've got a block plot of our data and here we've got our contour plot already so that's kind of useful that's kinda handy but you know you have said several times that you can take data and reproject it into a different different projection from this new projection you can do that that's quite easy but we know that come back to the example we had with the wiki image that was in Robinson okay so let's let's change that so here we calculate their extents we create a figure and with that wiki image remember was it was off the meridian was posted by target projection is Robinson and some so we've got back og waxes we're gonna add our grid lines because we can do that quite a few whacks square coastlines no precipitation up it's in the format that we had for the wiki some things when you read our image we had the core and we're using which is just a map solid image read through court Cordia that's a raster data and now which is gonna see achieve access and when he put that with their expense that we've done before it's seamless because he's not you who got a transformer saying this data is in Robinson we had a global okay if I run this there might be absolutely helpful coz with ya yeah so this been copied twice yeah is it dr. Pearson yeah all right okay so we've now created our plot but before we knew the extents we have used our robinsons and I've got the the wiki image as we wait before to cut by we can reproject this raster image is said to a non-native target projection so idea was all in robinson's but we can easily see well actually let's see that image but we can put it in black re and the way to do that you see you set the projection to be what you want it to be which is Peri our data which we've loaded previously in the previous cell that's that's in robinson's that still stands you can't apply will reproject it into your target projection which should be black and there we go okay so there's a lot about what there cuz it was it was working hard to who's rejecting that whole image so there are a lot of things that can do that raster oh you guys help us the Royal no it's kind of built on GDL so it's got all the smarts off em gee darling there it can do that kind of thing that cut a pie that's a good option to use do we want to ensue these can exercise these I I don't see great value in art and talking about those pictures taking the image and you're just doing the same thing you know that it works for images for rosters right oh the exercises were just over plotting the temperature they on top of it so this should come as no surprise that your contour so on this image here that'd be quite easy to then change your projection if you want to the temperature dakedo temperature surface temperature there bad we can just do contour f2p color mesh on top of it you can mix and match so that's power of being able to reap a jecht create the projections that you want master do was that too fast okay but it was well gone through some of these examples what do you think yeah okay so we know about how we do reporting with our image so what was the exercise the exercise IRS is doing a lot of the heavy lifting for you okay because we blow today is a cube so what you plot the decadal mean surface temperatures for October which we done before use neither use either a block clock or contour plot over a wiki pimp or a wiki image and a plaque a projection here we go so what we're interested in what's the target projection is flat carry so first thinking let's create an axis we're interested in black eye and reset the projection keywords so we've got the right to access back run some grid lines I've seen this before and we can add some coarse lines this is this is reading our raster image which is the wiki image we read the end done seen this before you then used on yugioh access the image sure we've worked our extents which was in Robinson you said to be global to full image and this this was all the difference really this exercise was looking for you to use was to want you to set all this up which would seem previously was to over plot with the temperature they ask for that for that decade of 1817 use and iris to do that so was bringing together those two examples so we've got our cube data we do a pea color mesh and we plot it okay so I did a little work there so here we go so we've got as we expected we wanted to be in a plat carry projection done that and we've got her which was Robinson Deere is reprojected into plat carry and we've used iris because with it's theater to do color match of the temperature there is that what you were expecting we just kind of started to join these little bits of the jigsaw together in terms of what you want getting your data being able to get a jewel axis set your projection to be the target projection that you're interested in understanding what projection your source of the ozone and then setting these up correctly any questions it's at too fast okay she look at the extension other thing is really worthwhile the main point here is that you've done plots before you've done contour contour F and with Cara PI it's you're telling you to do the same thing there's a little bit of minimal effort we did lean on iris to get the data but there's nothing really radically different there under the hood it's using that pot lid and cut a pie itself okay so we're talking about this interoperability can appreciate no come from raster to raster the next section that was do some tidying up so we're happy with going from roster to roster so we're going to depend a little bit to vector the vector mean can I appreciate know what vectors are the focal points flying's we're talking about geometries what app all might be involved in those kind of operations what can we do what can cut a pie offer that makes our life easier so [Music] let's first talk about points I start there move forward so get to geometries and wings so if we wanted to take am the cutaway has a coordinate reference system and on the other some methods that help us that does that the hard work and it uses Podge for to do these transformations so it's easy for us to these methods transform point and transport points so let's see how easy is to transform transform one point from one coordinate system to another so we're gonna again import corner after system from octopi and as an example something slightly different OS GB have you heard of HTV it's like the Ordnance Survey feel great but it's like projections just around brain because we can write so that's one is used generally for some of our weather will go geodetic so that was the spherical a spherical coordinate system so we're going from one to other so I convert from Ordnance Survey GB which is thinkers in meters it's a bit weird to lat/long so we've got a point which are in eastings and northings we have our GI so we're introducing this transform point so that's maybe it's worthwhile jump into the catified documentation so we've got a whole bunch of methods that are on our coordinate reference system one of those is transform point and the cooler always transform points so here you simply pass in your X in your white point in your source coordinate system or those points that's almost akin to when you're do that contour f you passed in your lats and your lungs and use the transform word that was a week to see that's what the the corner system of the source D is n so that's the same as transform we can jump back so we have transform point for X now why point you they are eastings and northings and it's same actually these are osg be what's osg be that's our OS to be projection so same transform these X&Y points in OS g gb and the method has been called on geoid so that is the target that you're gonna go to to this is project the domain from and the domain to you can run that so that's the lights and Long's of that point from boise be to geodetic and now it connects tens you can do that for a multiple points so that's a point the next thing up from there is lines that's connecting two points to make a line so it's subtly different you can project a geometry we used the word project instead of transform because what's actually happening under the hood is that if you imagine having two points and align and throw about angry you see that the lane was gonna cross the empty meridian Caterpie has it's not precise but uses america and numerical tolerance to work out where that cup might happen remember the orange that we cannot flattened out so i've had a line that was going to cross in the northern hemisphere pi works like where the bricks are and it's not precise if it was precise transformation reduce the transfer but the cleverness going on and that's why we've hinted at that by using the project keyword let's have a concrete example so we're going to lean on like I said cut PI uses chioce and uses Shaklee so we're going to import check the geometry and then what we're going to do is we've got New York Honolulu Honolulu and we're gonna creep from there Elaine string so we've got our Long's and lats we put them in will create a shapely line which is a line string and we have got our plaque hairy projection and okay we want to convert this from Paree pull this line flat caring no yeah it's that exciting thanks fine so yeah it wasn't too exciting so let's let's put in some context yeah just this this line here it's it's a so the question is what is that things of that purchase that we ylang-ylang shrink no no we should clear a definition of that that might feel answered one question it's a yeah it's not a string string yep you know so it's like a cheaply things like a primitive it understands that's a line so we're going to use that understand Caterpie understands that so here yeah place let's put that into context so okay you've seen a pattern here it's almost like a factory of a we that we bought these things together we keep a figure we create our axis we're interested in Platte Kerry we get back OG o axis and what we can do is we can add geometries to this by using the add geometries method on the G waxes here's our line it's in Platte Kerry and these are just standard chocolate keyword arguments they're going to describe that Gretchen page color face colors this probably goes back to your question the gentleman to the back of it if you want if you have a geometry he always changed the color this is kind of the way you would do it let's had some coastlines and let's be a plot slightly more exciting okay so it done as we expected and that was not just a length but John Schilling so stop your voice rips that line is a great circle okay so you might start thinking what could we actually do well in a straight line we're going to take our line in C's remember at the beginning we create the geodetic projection to have seen this line is a geodetic line but project it to a plaque re line and plot it in a target projection that is plot carry we're using that geometry start that Lane again let's see that looks like this was before it was a straight line but never seen it's actually a great circle which we know is gonna be a curved line on carry so it's kind of behaving as we might expect them have sort of seen that behavior before so there is and exercise how do you want it just walks through it let's do it yeah okay so I've done a lot of talking and use them all it's kind of sitting and listening which will come out you don't want that too because it's a tutorial so let's kind of try and consolidate some of that all together we'll give you some time to do this exercise Google walking around so it can help you so what we've got to do Quint construct a line string so those line strings is a shapely object between Yokohama and San Francisco you've got the lots and Long's their project this Lang using our project geometry using both plat carry and geodetic as the sort of coordinate systems pot the lines using car pipe and of zero the deficit Oh probably guess what they might look like but let's find out what they do do and if you've got time when you nail that you understand it you're happy with it the extension is to devise a way to constructing the Lang Springs such a crosses the anti meridian when using the project geometry so there's a little bit of thinking about there's a bit sneaky so have a think just when it's out if it's not clear and the weddings pretty terrible and we're asking you to call that projection tree in multiple times basically predict it for your first line string and then projector again the geodetic and we'll get two results and what we want to know is in what way of those results different yes that's the point of this exercise okay so I'm gonna crack on let's let's have a peek at what we got and see if it's kind of close to what you had mmm so we know that we're going from Yokohama to San Francisco provided with those those lots and Long's so we create our Shipley plain string plug in those coordinates clean out black hairy projection and I'm agree create code to projective lines so we're projecting their geometry so we create their geometry which is our line we're saying okay this guy here this line here is actually a priori line and this one here actually this is a geodetic line we're using the project geometry for this line using this projection and we're moving we're projecting from Park area to puckery geodetic to plat carry we create these two projective lines okay so now we've done the hard work hopefully that was close to seem that was the part of the exercise and then we're going to again do the same thing we create a figure and we're going to have our target projection for this axes to be plucked out and then we're gonna add our or our lines to that to the axis remember this is our geo axis I want our geometries there's the ad geometries method they use on it okay it's you did pass in a miserable well in a single thing so that's why we pass in a list so you've got your plat Caroline put your geodetic lines so we pass in or a plaque Caroline and we're saying okay this is a plat Caroline that's the projection we're gonna add some color to it so we can discriminate between the two blue line I carry face color none plain wood then we do the same for the geodetic line same deal we've done the hard work up here crater geodetic line we say okay add it to the same geo axis and then we means that red are some coastlines here we are so what's interesting here is that you've got San Francisco Yokohama here so Caroline the blue line as you'll see it's understand straight lines that this is joining as a straight line from between these two points the red line is the geodetic lying geodetic lines always its thickness were thinking this vehicle so we're thinking we join two points a great circle always takes the shortest distance the shortest distance between these two points is not the route that the plaque airlines taken has actually gone round the back but again car PI's cleverest and all where the boundaries of the mappers the disk on use our phantom meridian and it's clipped it properly it's brought it back so that is the shortest distance that's the geodetic line you might have thought that the geodetic language of bent and gone across here do some people think that might happen no go around the back is anybody to get that far to be what you do the extension you sit okay possession jump she's yet okay so we've seen projectile matauri and they'll show does it projecting lines the same method works for polygons shape of the polygons so we're just gonna construct this is pure shapely no Caterpie here we just make a polygon and sine and cos of some number between not and 2 pi you end up getting a circle so cool it's a circle in shapely and shape the renders it for you which is quite kind of neat okay we're gonna project that okay so I'm gonna say that these coordinates are spherical coordinates the lines between those coordinates are great circles and I'm gonna project it to plot carry and okay not that exciting we get a circle projects to the circle when it's good right however if we change the projection of our target slightly so instead of us having central Meridian in the middle of the map we switch around by a hundred eighty degrees and that circle that's this centered at 0 0 actually because that's what our implementation does and if we project that to some different projection we'll see a different result ok and what's happening here is that polygons now covers you know one half of the map and the other half of the map and caspere's realize that and filled it in for us okay so let's just follow that same old pattern add geometries that projected geometry in the target coordinate system and have a look okay so there's that circle centered on 0 0 and and it's cut around okay the one really important kind of subtlety detail that you need to know about geometries on the sphere is that you need an extra piece of information to in what which bit you should fill in so on the on the sphere and just imagine you had a polygon that was defined that tracked all the way around the equator okay which side of the hemisphere should an algorithm color in okay and we need to figure out or have some convention to determine that think about that in those terms and Caterpie follows fairly standard convention of using counterclockwise winding order and I guess we can demonstrate that quite nicely by simply reversing those coordinates on that circle that rule manufacturing I'm going to call it inverse circles so hopefully this has given you a sense of where this is going okay and you use the same same call I did before to project the geometry to that projection that requires a cut and we don't get two halves of circles okay we end up getting the whole thing - those two halves of circles okay so hope that makes sense as to what's going on and polygons on the sphere the winding order is really really important and and when you project it Caterpie is honoring that okay there were shape these great for dealing with this stuff you can change the the order really easily you can check or order your polygons as in so and yeah these tools are out there and super useful any questions on project geometry basically what you're seeing here is what's happening when you're adding data to map live geo axis what we're demonstrating is that this isn't doesn't need MATLAB in order to project those jumper sheets this is actually a really general purpose algorithm that that can project geometries for you okay so we're running low on time and I'm thinking there's a nice section here about distance and distance on the sphere but I think we're just going to move over it basically catify has the functionality to do distances this material here for you to have a look at and I think we've not got the time to go into that into much detail honest I will touch on geometry predicts though because that's kind of useful so one depends on the other doesn't it of course it does No I could just execute the sails and walk through it yeah I don't want to kind of go crazy with them output that will make you dizzy or anything but I'll follow you guys right so basically let's construct a line string with lots of lots and lots okay this is just pulling it out there and this is using the same pattern as just seen project that that line is geodetic and give me back a geometry which represents the geodetic line in plat carry between those points that's basically what was happening here okay the other thing that I want to show you is that kind of interplay within Shapley really or you know gio pandas diffuse and gio pandas or some other tool and so what I've got hold of here is some natural earth land data the shapefile here containing the polygons of all the land and there's there's some functionality in Caterpie that will do that for you this shape reader module but geo pandas work just as well Fiona would work just as well hi Shay you know there's a bunch of different options here the important thing is we end up with a list of shape the geometries however we end up there it doesn't really matter right and let's fix them up a little bit okay so that is shapely representation of the kind of the geometry that is land and what we can do is kind of do a shapely intersection to figure out of that tract that great circle track that we just produced pick out only the bits that cover land okay and you know now our now our geometry starts to get a bit of speckle T because this is I think North America and this is the Atlantic perhaps so we end up breaking up the path a great circle path and this is where I kind of there's tendrils into the previous section because now I can compute the distance of that track don't go off piste is the moral of the story yeah yeah let's let's move on from that so so I guess what this was hoping to get get at was that there's a really nice interplay between shapely and cats by here Caterpie will give you an awful lot of functionality in terms of spherical work it will give you distances Shapley will give you really powerful predicates including intersections kind of join you know mash together vector datasets in a really intuitive and powerful way and they've come together and from some really nice behavior so I encourage you to take a look at this exercise offline it all kind of hopefully be self explanatory yeah but we're running low on time we're running low on time to show you anything about for Liam and I PI leaflet so maybe this should just be a little run it and see what happens type activity I won't even talk about the code if you have any questions about folium and Philippe could you put your hand up please the person who's looking the other way so some really cool functionality web based and in the browser type visualization check it out and there's also similar tools like ipython leaflet and geo views both awesome tools as well for visualizing this interactively in the notebook you might like to check those up that is all we have time for vector to vector okay there are two more sections less than ten minutes yeah yeah so I'm one of the things that we're gonna do with this tutorial is bring in a guest speaker one in the corner and I think we should bring him down in a second or even now maybe come on down so high noon is inglesias there's hopefully these notebooks are useful to you and if you're into this space take a read over them we're here all week we'll be here for instance that suit check him out but basically that that Wikipedia image that we've got there would be really great for us to pick out that track okay and we asked one who's psychic image fame good good guy and to do this for us any last night and yeah so if you want to talk us through yeah all right so hopefully I'll remember what it is that I did okay and this is weird inverted calling okay so the first thing that you need to know which we haven't this is not my coat okay all right can i okay we have a weird European keyboard - okay so I can skip all this that's interesting what is all this like you friend me in ahead of time I'm fine all right okay so Phil did something here that I don't understand see CRS is not your type did I know oh you haven't run all this okay right right great okay we're in business awesome alright so here's what happens so if we look at the image that we got from Wikipedia which is here it looks like there's actually five colors white grey black yellow and blue but if you zoom way in on these pixels there's a bit of anti-aliasing going on so you've actually got some blue and then some light blue on the edge and here you've got some light grey on the edges and so on so we can't just go and look for blue black and yellow pixels to get the check which is what we would want to do so but there's a cool Syfy function called vector quantization and what that does is where am I here so this is Syfy the cluster W if you give it an array of colors and then you quantize you give it an array of pixels which are sort of three values so it's an array of number of pixels by three values the vector quantization function will tell you what which of those colors is closest to each of those values and then we can transform back and just say all right make that pixel that color and then we end up with an image of only 5 pixel colors which are white gray black cannula so that's what all this code is doing and I can't don't have time to go through in more detail than what I just did but let's just see that it worked so you can see that we've got the two images and they look the same of thanks to this fancy that live notebook mode I can scroll zoom to rectangle if i zoom in here let's zoom in even a bit more so do you see that here this pixel here this is the original image is some weird intermediate gray or is over here it's gone back to the background gray and so on so you've got you've also got some light blue colors here they're gone so now that's good because we can say our to get the track I'm just gonna get the black pixels the blue pixel than the yellow pixels and the other thing is you've got names of the cities and we're gonna get rid of those in a second okay so if you look back at my colors let's see all of the colors that I'm interested in which are black yellow and blue have zeros in the values whereas the colors that I'm not interested in which are gray and white they don't have zeros so I'm just gonna find all the places in the images where some channel is equal to zero then I am going to use MD image dot label to find the connected sets of pixels and then we're just gonna discard all of the pixels that are all of the pixel groups that are not part of the largest pixel group so if we do that or be nice to actually just show the track so I'll just do it check files and the reason I call it that why did that not do something our figure all right thanks so I'm just gonna do subplots cool okay so the read this is our track it looks perfect except if you look at it it's a little bit fat in places here you can see that it's thicker than one pixel and we want to have like a track of single pixels so psyche dementia has a skeletonized function and that's what we're gonna do so probably I would do this in two steps for this one so we take the track using skeletonize and then what we're going to do and I definitely don't have time to get to this in detail is for every pixel we're going to look at all the neighboring pixels and then first of all we find the leftmost pixel and then from there we look at the neighbors find the point in the track and then we add that to this list of under colored paths to his list of point coordinates and that ends up giving us our point to point path around the world okay and now we can plot it so point to point now we have latitudes and longitudes and we can use so that this is now longitudes and latitudes we can use all of this Caterpie niceness to what this as actual matplotlib lines and you can see that these are lines now and not pixels so it's a nice yeah now it's vector data and now Phil can take so um I guess the there's more work we do that right so this gap is very clearly there you know I see what wasn't there it but it's an artifact of the actual image that is a gap in what's represented in the underlying image so I kind of hack away at that and basically compute the the missing gap using a bunch of really powerful shape the functionality not really iris from Carter perfection ality itself how many end up with the roof and I guess really the point of this section is about showing you that we've got access as a community to a really diverse and powerful set of functionality psychic images is a good example of that but there are so many others as well and we can kind of bolt these things together and build some really powerful tools so it's all that we built here is using some image processing to pick out the track from an image it's kind of cool do we need to do a roundup basically so the final thing really that we wanted to get to is the rabbit obviously we have kind of needed to rush through this at the end which is a bit of a shame but hopefully you've got a sense of the kind of broader scientific Python geospatial community kind of what's there and what's available to you ironically even though we've run out of time would not even touch the sides really in terms of what's available in cart by like bigger catify does kind of web mapped with map service web map and yeah tile ingestion it's got some interesting kind of digital elevation model access in yeah even like wind vectors and transfer transforming wind vectors is kind of an interesting thing so a bunch of bunch of tools that Caterpie has that we've not even had a chance to talk about if any of those are of interest to you then as so bill and I are here all week and took any time there's a final exercise here which obviously we don't have the time to do which basically tries to recreate this image you may enjoy having a go at that if you find the time and be happy I'd be happy to help out if you get stuck but yeah that really wraps up mostly what I wanted to say there's a there's a huge huge kind of collection of people and tools that have come together to form a really powerful ecosystem and we can just exploit that and it's fabulous I love it Cotter Pyke's just bolts some of those things together gives you the a bit more geospatial richness project geometries for instance and imagery projections to put that a big thanks to Kelsey jor-el who's not here but he gave a really great geospatial tutorial back in 2015 you might like to check that out and jules verne who who wrote the x excellent around the world in 80 days book and it's free after copyright so you know go and get it it's a good read it's a good fun and as bill says we will be sprinting this Saturday Sunday on Caterpie and catch by friends probably there's a few bugs that we want to fix as a few features that we want to add and if you're interested then come and join us a lot of fun yeah any more bill okay I just like to say thank you to one for coming down and giving us a lightning tour of how he did those image processing and thanks to Bill but them great have a great [Applause]
Info
Channel: Enthought
Views: 2,485
Rating: undefined out of 5
Keywords: python, Geodata, SciPy 2018, Cartopy
Id: AmidIx6Jmn8
Channel Id: undefined
Length: 186min 5sec (11165 seconds)
Published: Thu Jul 12 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.