{"id":2568,"date":"2014-01-03T17:46:46","date_gmt":"2014-01-03T22:46:46","guid":{"rendered":"https:\/\/blogs.mathworks.com\/community\/?p=2568"},"modified":"2020-07-07T16:34:28","modified_gmt":"2020-07-07T20:34:28","slug":"crepuscular-isochrons-sunrise-here-and-there","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/community\/2014\/01\/03\/crepuscular-isochrons-sunrise-here-and-there\/","title":{"rendered":"Crepuscular Isochrons: Sunrise Here and There"},"content":{"rendered":"<p>Greetings from Natick, Massachusetts, where the outdoor temperature is currently a balmy 15 degrees Fahrenheit and the sun sets at 4:26 in the afternoon. The days are getting colder but at least they are getting longer now. Tomorrow the sun will set a minute later. Tomorrow&#8217;s sunrise, on the other hand, will be at more or less the same time as today&#8217;s. In fact, at this latitude, today is the latest sunrise of the year: 7:15 AM.<\/p>\n<p>These short days always make me think about the geometry of earth and sun that gives rise to seasons. And this relates to MATLAB because it gave me the opportunity to answer a question and write a little code. The question is this: for any given day, let&#8217;s say today, where are the people who will see the sun rise at exactly the same moment as me? Answering this question gave me the chance to learn a little <a href=\"https:\/\/www.mathworks.com\/help\/map\/index.html\">Mapping Toolbox<\/a> code.<\/p>\n<p>First some basic geometry. The earth is always half dark and half illuminated by the sun. So the sunset\/sunrise line (sometimes called the gray line) that separates day from night is a great circle, which is to say a circle that divides the earth evenly into two halves. This gray line is centered on the point on the earth that is precisely under the sun right now. Since we are near the winter solstice (for the northern hemisphere), the sun can be found hovering close to the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Tropic_of_Capricorn\">Tropic of Capricorn<\/a> at around 22.8 degrees south latitude. So now we have a goal: draw a great circle with its center positioned at -22.8 deg. latitude and a longitude such that the sunrise line passes through Natick.<\/p>\n<p>Now let&#8217;s learn some basic Mapping Toolbox skills. This was fun for me, because two hours ago I didn&#8217;t know anything about the Mapping Toolbox. After a quick search for great circles, I started with an example from a page on circles in the documentation. From there I quickly got a map like this.<\/p>\n<pre class=\"codeinput\">clf\r\naxesm(<span class=\"string\">'MapProjection'<\/span>,<span class=\"string\">'ortho'<\/span>)\r\ngridm <span class=\"string\">on<\/span>\r\nframem <span class=\"string\">on<\/span>\r\nsetm(gca, <span class=\"keyword\">...<\/span>\r\n    <span class=\"string\">'Origin'<\/span>, [30 -50 20], <span class=\"keyword\">...<\/span>\r\n    <span class=\"string\">'MLineLimit'<\/span>, [75 -75], <span class=\"keyword\">...<\/span>\r\n    <span class=\"string\">'MLineException'<\/span>,[0 90 180 270])\r\n\r\nlandareas = shaperead(<span class=\"string\">'landareas.shp'<\/span>,<span class=\"string\">'UseGeoCoords'<\/span>,true);\r\ngeoshow(landareas,<span class=\"string\">'FaceColor'<\/span>,[1 1 .5],<span class=\"string\">'EdgeColor'<\/span>,[.6 .6 .6]);\r\n<\/pre>\n<p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/isochrons_01.png\" alt=\"\"> <\/p>\n<p>Let&#8217;s put Natick on the map. That&#8217;s me under the red dot.<\/p>\n<pre class=\"codeinput\">natick = [42.3 -71.4];\r\nplotm(natick(1),natick(2),<span class=\"string\">'ro'<\/span>,<span class=\"string\">'MarkerFaceColor'<\/span>,<span class=\"string\">'r'<\/span>)\r\n<\/pre>\n<p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/isochrons_02.png\" alt=\"\"> <\/p>\n<p>Here&#8217;s something really cool about the Mapping Toolbox: I can do a completely different map projection by changing one line in the above code. Here is the <a href=\"https:\/\/www.mathworks.com\/help\/map\/miller.html\">Miller Cylindrical projection<\/a>. Fun!<\/p>\n<pre class=\"codeinput\">clf\r\naxesm(<span class=\"string\">'MapProjection'<\/span>,<span class=\"string\">'miller'<\/span>)\r\ngridm <span class=\"string\">on<\/span>\r\nframem <span class=\"string\">on<\/span>\r\nsetm(gca, <span class=\"keyword\">...<\/span>\r\n    <span class=\"string\">'Origin'<\/span>, [30 -50 20], <span class=\"keyword\">...<\/span>\r\n    <span class=\"string\">'MLineLimit'<\/span>, [75 -75], <span class=\"keyword\">...<\/span>\r\n    <span class=\"string\">'MLineException'<\/span>,[0 90 180 270])\r\ngeoshow(landareas,<span class=\"string\">'FaceColor'<\/span>,[1 1 .5],<span class=\"string\">'EdgeColor'<\/span>,[.6 .6 .6]);\r\nplotm(natick(1),natick(2),<span class=\"string\">'ro'<\/span>,<span class=\"string\">'MarkerFaceColor'<\/span>,<span class=\"string\">'r'<\/span>)\r\n<\/pre>\n<p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/isochrons_03.png\" alt=\"\"> <\/p>\n<p>I could also do a <a href=\"https:\/\/www.mathworks.com\/help\/map\/murdoch3.html\">Murdoch III Minimum Error Conic Projection<\/a>, but that would just be showing off.<\/p>\n<p>Now down to business. Sunrise in Natick is at 7:15 Eastern Standard Time. At that moment, the sun is above the south Atlantic at 22.8 deg. south latitude and 4 deg. west longitude. We&#8217;ll use the function <a href=\"https:\/\/www.mathworks.com\/help\/map\/ref\/scircle1.html\">SCIRCLE1<\/a> to generate the great circle.<\/p>\n<pre class=\"codeinput\">clf\r\naxesm(<span class=\"string\">'MapProjection'<\/span>,<span class=\"string\">'ortho'<\/span>)\r\ngridm <span class=\"string\">on<\/span>\r\nframem <span class=\"string\">on<\/span>\r\nsetm(gca, <span class=\"keyword\">...<\/span>\r\n    <span class=\"string\">'Origin'<\/span>, [30 -50 20], <span class=\"keyword\">...<\/span>\r\n    <span class=\"string\">'MLineLimit'<\/span>, [75 -75], <span class=\"keyword\">...<\/span>\r\n    <span class=\"string\">'MLineException'<\/span>,[0 90 180 270])\r\nsunLocation = [-23 -4];\r\ngrayLine = scircle1(sunLocation(1), sunLocation(2), 90);\r\n\r\ngeoshow(landareas,<span class=\"string\">'FaceColor'<\/span>,[1 1 .5],<span class=\"string\">'EdgeColor'<\/span>,[.6 .6 .6]);\r\n\r\nplotm(sunLocation(1), sunLocation(2),<span class=\"string\">'ko'<\/span>,<span class=\"string\">'MarkerFaceColor'<\/span>,<span class=\"string\">'y'<\/span>)\r\nplotm(grayLine(:,1), grayLine(:,2),<span class=\"string\">'red'<\/span>)\r\nplotm(natick(1),natick(2),<span class=\"string\">'ro'<\/span>,<span class=\"string\">'MarkerFaceColor'<\/span>,<span class=\"string\">'r'<\/span>)\r\n<\/pre>\n<p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/isochrons_04.png\" alt=\"\"> <\/p>\n<p>Now we&#8217;re getting somewhere! Let&#8217;s switch back to the Miller projection and zoom in to the east coast of the U.S.<\/p>\n<pre class=\"codeinput\">clf\r\naxesm(<span class=\"string\">'MapProjection'<\/span>,<span class=\"string\">'Miller'<\/span>, <span class=\"keyword\">...<\/span>\r\n    <span class=\"string\">'MapLatLimit'<\/span>,[-11 60], <span class=\"keyword\">...<\/span>\r\n    <span class=\"string\">'MapLonLimit'<\/span>,[-50 40])\r\ngridm <span class=\"string\">on<\/span>\r\nframem <span class=\"string\">on<\/span>\r\nsetm(gca, <span class=\"keyword\">...<\/span>\r\n    <span class=\"string\">'Origin'<\/span>, [11 -59 8], <span class=\"keyword\">...<\/span>\r\n    <span class=\"string\">'MLineLimit'<\/span>, [75 -75], <span class=\"keyword\">...<\/span>\r\n    <span class=\"string\">'MLineException'<\/span>,[0 90 180 270])\r\nsunLocation = [-23 -4];\r\ngrayLine = scircle1(sunLocation(1), sunLocation(2), 90);\r\n\r\ngeoshow(landareas,<span class=\"string\">'FaceColor'<\/span>,[1 1 .5],<span class=\"string\">'EdgeColor'<\/span>,[.6 .6 .6]);\r\n\r\nplotm(sunLocation(1), sunLocation(2),<span class=\"string\">'ko'<\/span>,<span class=\"string\">'MarkerFaceColor'<\/span>,<span class=\"string\">'y'<\/span>)\r\nplotm(grayLine(:,1), grayLine(:,2),<span class=\"string\">'red'<\/span>)\r\nplotm(natick(1),natick(2),<span class=\"string\">'ro'<\/span>,<span class=\"string\">'MarkerFaceColor'<\/span>,<span class=\"string\">'r'<\/span>)\r\n<\/pre>\n<p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/isochrons_05.png\" alt=\"\"> <\/p>\n<p>And there&#8217;s the answer we&#8217;ve been after. Tomorrow, in the unlikely event I get up early enough to see the sun rise, I&#8217;ll be sharing that experience and that instant with people in Arroyos De Mantua, Cuba and &Iacute;safj&ouml;r&eth;ur, Iceland. There&#8217;s something comforting about that.<\/p>\n<p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\">\n<p>\nPublished with MATLAB&reg; R2013b<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/isochrons_01.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>Greetings from Natick, Massachusetts, where the outdoor temperature is currently a balmy 15 degrees Fahrenheit and the sun sets at 4:26 in the afternoon. The days are getting colder but at least they&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/community\/2014\/01\/03\/crepuscular-isochrons-sunrise-here-and-there\/\">read more >><\/a><\/p>\n","protected":false},"author":69,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/2568"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/users\/69"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/comments?post=2568"}],"version-history":[{"count":12,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/2568\/revisions"}],"predecessor-version":[{"id":7279,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/2568\/revisions\/7279"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/media?parent=2568"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/categories?post=2568"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/tags?post=2568"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}