{"id":686,"date":"2016-01-15T05:50:42","date_gmt":"2016-01-15T05:50:42","guid":{"rendered":"http:\/\/www.jamesrising.net\/blog\/?p=686"},"modified":"2016-01-15T05:50:42","modified_gmt":"2016-01-15T05:50:42","slug":"tropict-a-clearer-depiction-of-the-tropics","status":"publish","type":"post","link":"http:\/\/www.jamesrising.net\/blog\/?p=686","title":{"rendered":"Tropict: A clearer depiction of the tropics"},"content":{"rendered":"<p>Tropict is a set of python and R scripts that adjust the globe to make land masses in the tropics fill up more visual real estate.  It does this by exploiting the ways continents naturally &#8220;fit into&#8221; each other, splicing out wide areas of empty ocean and nestling the continents closer together.<\/p>\n<p>All Tropict scripts are designed to show the region between 30&deg;S and 30&deg;N.  In an equirectangular projection, that looks like this:<\/p>\n<p><a href=\"http:\/\/ift.tt\/1Rp2uV9\" rel=\"attachment wp-att-244\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/ift.tt\/1OusKYk\" alt=\"original\" width=\"512\" height=\"85\" class=\"aligncenter size-large wp-image-244\" srcset=\"http:\/\/ift.tt\/1Rp2uVb 300w, http:\/\/ift.tt\/1OusKYm 768w, http:\/\/ift.tt\/1OusKYk 1024w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/p>\n<p>It is almost impossible to see what is happening on land: the oceans dominate.  By removing open ocean and applying the Gall-Peters projection, we get a clearer picture:<\/p>\n<p><a href=\"http:\/\/ift.tt\/1Rp2sMZ\" rel=\"attachment wp-att-245\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/ift.tt\/1OusJns\" alt=\"version4\" width=\"512\" height=\"221\" class=\"aligncenter size-large wp-image-245\" srcset=\"http:\/\/ift.tt\/1Rp2sN3 300w, http:\/\/ift.tt\/1OusJDG 768w, http:\/\/ift.tt\/1OusJns 1024w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/p>\n<p>There&#8217;s even a nice spot for a legend in the lower-left!  Whether for convenience or lack of time, the tools I&#8217;ve made to allow you to make these maps are divided between R and Python.  Here&#8217;s a handy guide for which tool to use:<\/p>\n<p><a href=\"http:\/\/ift.tt\/1Rp2sN5\" rel=\"attachment wp-att-243\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/ift.tt\/1OusKYo\" alt=\"decisions\" width=\"512\" height=\"310\" class=\"aligncenter size-large wp-image-243\" srcset=\"http:\/\/ift.tt\/1Rp2sN7 768w, http:\/\/ift.tt\/1OusKYo 1024w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><br \/>\n<font size=\"-1\"><br \/>\n<i>(1)<\/i> Supported image formats are listed in the <a href=\"http:\/\/ift.tt\/1OusJDI\">Pillow<\/a> documentation.<br \/>\n<i>(2)<\/i> A TSR file is a Tropict Shapefile Reinterpretation file, and includes the longitudinal shifts for each hemisphere.<br \/>\n<\/font><\/p>\n<p>Let&#8217;s say you find yourself with a NetCDF file in need of Tropiction, called <tt>bio-2.nc4<\/tt>.  It&#8217;s already clipped to between 30&deg;S and 30&deg;N.  The first step is to call <tt>splice_grid.py<\/tt> to create a Tropicted NetCDF:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\">\npython ..\/splice_grid.py subjects\/bio-2.nc4 ..\/bio-2b.nc4\n<\/pre>\n<p>But that NetCDF doesn&#8217;t show country boundaries.  To show country boundaries, you can follow the <a href=\"http:\/\/ift.tt\/1Rp2uVf\">example<\/a> for using <tt>draw_map.R<\/tt>:<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\">\nlibrary(ncdf4)\nlibrary(RColorBrewer)\n\n## Open the Tropicted NetCDF\ndatabase &lt;- nc_open(&quot;bio-2b.nc4&quot;)\n## Extract one variable\nmap &lt;- ncvar_get(database, &quot;change&quot;)\n\n## Identify the range of values there\nmaxmap &lt;- max(abs(map), na.rm=T)\n\n## Set up colors centered on 0\ncolors &lt;- rev(brewer.pal(11,&quot;RdYlBu&quot;))\nbreaks &lt;- seq(-maxmap, maxmap, length.out=12)\n\n## Draw the NetCDF image as a background\nsplicerImage(map, colors, breaks=breaks)\n## Add country boundaries\naddMap(border=&quot;#00000060&quot;)\n## Add seams where Tropict knits the map together\naddSeams(col=&quot;#00000040&quot;)\n<\/pre>\n<p>Here&#8217;s an example of the final result, for a bit of my coffee work:<\/p>\n<p><a href=\"http:\/\/ift.tt\/1OusJDK\" rel=\"attachment wp-att-242\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/ift.tt\/1Rp2uVh\" alt=\"arabica-futureb\" width=\"512\" height=\"221\" class=\"aligncenter size-large wp-image-242\" srcset=\"http:\/\/ift.tt\/1OusKYq 300w, http:\/\/ift.tt\/1Rp2sNd 768w, http:\/\/ift.tt\/1Rp2uVh 1024w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/p>\n<p>For more details, check out the documentation at the <a href=\"http:\/\/ift.tt\/1OusKYs\">GitHub page<\/a>!<\/p>\n<p>And just for fun, here were two previous attempts of re-hashing the globe:<\/p>\n<p><a href=\"http:\/\/ift.tt\/1Rp2uVl\" rel=\"attachment wp-att-246\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/ift.tt\/1OusKYu\" alt=\"version1\" width=\"512\" height=\"134\" class=\"aligncenter size-large wp-image-246\" srcset=\"http:\/\/ift.tt\/1Rp2t3v 300w, http:\/\/ift.tt\/1OusKYw 768w, http:\/\/ift.tt\/1OusKYu 1024w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/p>\n<p>I admit that moving Australia and Hawaii into the India Ocean was over-zealous, but they fill up the space so well!<\/p>\n<p><a href=\"http:\/\/ift.tt\/1Rp2t3x\" rel=\"attachment wp-att-247\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/ift.tt\/1OusJDO\" alt=\"version3\" width=\"512\" height=\"134\" class=\"aligncenter size-large wp-image-247\" srcset=\"http:\/\/ift.tt\/1Rp2vbB 300w, http:\/\/ift.tt\/1OusKYy 768w, http:\/\/ift.tt\/1OusJDO 1024w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/p>\n<p>Here I can still use the slick division between Indonesian and Papua New Guinea and Hawaii fits right on the edge, but Australia gets split in two.<\/p>\n<p>Enjoy the tropics!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tropict is a set of python and R scripts that adjust the globe to make land masses in the tropics fill up more visual real estate. It does this by exploiting the ways continents naturally &#8220;fit into&#8221; each other, splicing out wide areas of empty ocean and nestling the continents closer together. All Tropict scripts &hellip; <a href=\"http:\/\/www.jamesrising.net\/blog\/?p=686\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Tropict: A clearer depiction of the tropics<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[10,14,15],"class_list":["post-686","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-ifttt","tag-james-rising","tag-pro"],"_links":{"self":[{"href":"http:\/\/www.jamesrising.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/686","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.jamesrising.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jamesrising.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jamesrising.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jamesrising.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=686"}],"version-history":[{"count":1,"href":"http:\/\/www.jamesrising.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/686\/revisions"}],"predecessor-version":[{"id":687,"href":"http:\/\/www.jamesrising.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/686\/revisions\/687"}],"wp:attachment":[{"href":"http:\/\/www.jamesrising.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jamesrising.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=686"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jamesrising.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}