{"id":630,"date":"2018-05-03T16:10:04","date_gmt":"2018-05-03T16:10:04","guid":{"rendered":"http:\/\/ipn.paleofire.org\/?p=630"},"modified":"2018-08-11T21:10:36","modified_gmt":"2018-08-11T21:10:36","slug":"gcd-4-0-2-and-paleofire-1-2-2","status":"publish","type":"post","link":"https:\/\/ipn.paleofire.org\/?p=630","title":{"rendered":"GCD 4.0.2 and paleofire 1.2.2"},"content":{"rendered":"<p><a href=\"http:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/map_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-632 size-full\" src=\"http:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/map_1.png\" alt=\"\" width=\"3070\" height=\"1594\" srcset=\"https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/map_1.png 3070w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/map_1-300x156.png 300w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/map_1-768x399.png 768w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/map_1-1024x532.png 1024w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/map_1-100x52.png 100w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/map_1-150x78.png 150w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/map_1-200x104.png 200w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/map_1-450x234.png 450w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/map_1-600x312.png 600w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/map_1-900x467.png 900w\" sizes=\"auto, (max-width: 3070px) 100vw, 3070px\" \/><\/a><\/p>\n<p>We are please to announce that the GCD and paleofire R packages have been updated to their 4.0.2 and 1.2.2 versions, respectively. GCD major update from 3.X.X to 4.X.X version number is associated to extensive changes in the way data is added into the package. GCD 4.X.X is now mirroring the online GCD SQL database on a monthly basis or whenever a significant number of new charcoal sites are added to the database.<\/p>\n<p>Three new fields in the <em>paleofiresites<\/em> table (see <em>?paleofiresites<\/em> for details) enable to perform analyses with specific database versions or enable to select sites according to the date at which they have been added into the database. See the quick example below for explanations:<\/p>\n<p>[code language=&#8221;R&#8221;]<br \/>\npar(mfrow=c(2,2))<br \/>\nplot( pfSiteSel(num_version &amp;amp;lt; 400 ) ) # All sites in GCD version before 4.0.0<br \/>\nplot( pfSiteSel(gcd_version == &quot;GCD1&quot; ) ) # All sites in GCDv1<br \/>\nplot( pfSiteSel(update_date &amp;amp;lt; &quot;2016-01-01&quot; ) ) # Sites included before 2016-01-01<br \/>\nplot( pfSiteSel(update_date &amp;amp;gt; &quot;2018-01-01&quot; ) ) # Sites included since 2018-01-01&amp;lt;\/code&amp;gt;<br \/>\n[\/code]<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-631 size-large\" src=\"http:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-03-at-11.47.22-AM-1024x602.png\" alt=\"\" width=\"605\" height=\"356\" srcset=\"https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-03-at-11.47.22-AM-1024x602.png 1024w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-03-at-11.47.22-AM-300x176.png 300w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-03-at-11.47.22-AM-768x452.png 768w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-03-at-11.47.22-AM-100x59.png 100w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-03-at-11.47.22-AM-150x88.png 150w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-03-at-11.47.22-AM-200x118.png 200w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-03-at-11.47.22-AM-450x265.png 450w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-03-at-11.47.22-AM-600x353.png 600w, https:\/\/ipn.paleofire.org\/wp-content\/uploads\/2018\/05\/Screen-Shot-2018-05-03-at-11.47.22-AM-900x529.png 900w\" sizes=\"auto, (max-width: 605px) 100vw, 605px\" \/><\/p>\n<p>The map above that is used to display all GCD charcoal sites has been produced by adapting the code available at\u00a0<a href=\"https:\/\/seethedatablog.wordpress.com\/2016\/12\/23\/r-simple-world-map-robinson-ggplot\/\">https:\/\/seethedatablog.wordpress.com\/2016\/12\/23\/r-simple-world-map-robinson-ggplot\/<\/a>\u00a0please follow that link for additional references and explanations. The modified code is copied below:<\/p>\n<p>[code language=&#8221;R&#8221;]&lt;\/pre&gt;<br \/>\n# ======================================================================================<br \/>\n# Create a simple world map in Robinson projection with labeled graticules using ggplot<br \/>\n# ======================================================================================<\/p>\n<p># Set a working directory with setwd() or work with an RStudio project<\/p>\n<p># __________ Set libraries<br \/>\nlibrary(rgdal) # for spTransform() &amp; project()<br \/>\nlibrary(ggplot2) # for ggplot()<br \/>\nlibrary(paleofire) #<\/p>\n<p>setwd(&quot;\/Users\/OlivierB\/Documents\/R_in_progress\/MAP_GCD\/&quot;)<\/p>\n<p># __________ Load ready to use data from GitHub<br \/>\nload(url(&quot;https:\/\/github.com\/valentinitnelav\/RandomScripts\/blob\/master\/NaturalEarth.RData?raw=true&quot;))<br \/>\n# This will load 6 objects:<br \/>\n# xbl.X &amp; lbl.Y are two data.frames that contain labels for graticule lines<br \/>\n# They can be created with the code at this link:<br \/>\n# https:\/\/gist.github.com\/valentinitnelav\/8992f09b4c7e206d39d00e813d2bddb1<br \/>\n# NE_box is a SpatialPolygonsDataFrame object and represents a bounding box for Earth<br \/>\n# NE_countries is a SpatialPolygonsDataFrame object representing countries<br \/>\n# NE_graticules is a SpatialLinesDataFrame object that represents 10 dg latitude lines and 20 dg longitude lines<br \/>\n# (for creating graticules check also the graticule package or gridlines fun. from sp package)<br \/>\n# (or check this gist: https:\/\/gist.github.com\/valentinitnelav\/a7871128d58097e9d227f7a04e00134f)<br \/>\n# NE_places &#8211; SpatialPointsDataFrame with city and town points<br \/>\n# NOTE: data downloaded from http:\/\/www.naturalearthdata.com\/<br \/>\n# here is a sample script how to download, unzip and read such shapefiles:<br \/>\n# https:\/\/gist.github.com\/valentinitnelav\/a415f3fbfd90f72ea06b5411fb16df16<\/p>\n<p># __________ Project from long-lat (unprojected data) to Robinson projection<br \/>\n# spTransform() is used for shapefiles and project() in the case of data frames<br \/>\n# for more PROJ.4 strings check the followings<br \/>\n# http:\/\/proj4.org\/projections\/index.html<br \/>\n# https:\/\/epsg.io\/<\/p>\n<p>PROJ &lt;- &quot;+proj=robin +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs&quot;<br \/>\n# or use the short form &quot;+proj=robin&quot;<br \/>\nNE_countries_rob &lt;- spTransform(NE_countries, CRSobj = PROJ)<br \/>\nNE_graticules_rob &lt;- spTransform(NE_graticules, CRSobj = PROJ)<br \/>\nNE_box_rob &lt;- spTransform(NE_box, CRSobj = PROJ)<\/p>\n<p># Add lakes http:\/\/www.naturalearthdata.com\/http\/\/www.naturalearthdata.com\/download\/10m\/physical\/ne_10m_lakes.zip<\/p>\n<p>download.file(&quot;http:\/\/www.naturalearthdata.com\/http\/\/www.naturalearthdata.com\/download\/10m\/physical\/ne_10m_lakes.zip&quot;, destfile=&quot;ne_10m_lakes.zip&quot;)<br \/>\nunzip(&quot;ne_10m_lakes.zip&quot;)<br \/>\nNE_lakes &lt;- readOGR(&#8216;ne_10m_lakes.shp&#8217;,<br \/>\n&#8216;ne_10m_lakes&#8217;)<br \/>\nNE_lakes &lt;- spTransform(NE_lakes, CRSobj = PROJ)<br \/>\nNE_lakes &lt;- NE_lakes[NE_lakes@data$scalerank==0,]<\/p>\n<p># project long-lat coordinates for graticule label data frames<br \/>\n# (two extra columns with projected XY are created)<br \/>\nprj.coord &lt;- project(cbind(lbl.Y$lon, lbl.Y$lat), proj=PROJ)<br \/>\nlbl.Y.prj &lt;- cbind(prj.coord, lbl.Y)<br \/>\nnames(lbl.Y.prj)[1:2] &lt;- c(&quot;X.prj&quot;,&quot;Y.prj&quot;)<\/p>\n<p>prj.coord &lt;- project(cbind(lbl.X$lon, lbl.X$lat), proj=PROJ)<br \/>\nlbl.X.prj &lt;- cbind(prj.coord, lbl.X)<br \/>\nnames(lbl.X.prj)[1:2] &lt;- c(&quot;X.prj&quot;,&quot;Y.prj&quot;)<br \/>\ndata(&quot;paleofiresites&quot;)<br \/>\n# Project GCD sites<\/p>\n<p>gcd_rob=project(cbind(paleofiresites$long,paleofiresites$lat),PROJ)<br \/>\ngcd=data.frame(long=gcd_rob[,1],lat=gcd_rob[,2],GCD_version=paleofiresites$gcd_version)<\/p>\n<p># __________ Plot layers<br \/>\nggplot() +<br \/>\n# add Natural Earth countries projected to Robinson, give black border and fill with gray<br \/>\ngeom_polygon(data=NE_box_rob, aes(x=long, y=lat), colour=&quot;black&quot;, fill=&quot;grey90&quot;, size = 0.25) +<br \/>\ngeom_polygon(data=NE_countries_rob, aes(long,lat, group=group), colour=&quot;black&quot;, fill=&quot;white&quot;, size = 0.25) +<br \/>\ngeom_polygon(data=NE_lakes, aes(long,lat, group=group), colour=&quot;black&quot;, fill=&quot;white&quot;, size = 0.25) +<br \/>\n# Note: &quot;Regions defined for each Polygons&quot; warning has to do with fortify transformation. Might get deprecated in future!<br \/>\n# alternatively, use use map_data(NE_countries) to transform to data frame and then use project() to change to desired projection.<br \/>\n# add Natural Earth box projected to Robinson<br \/>\ngeom_polygon(data=NE_box_rob, aes(x=long, y=lat), colour=&quot;black&quot;, fill=&quot;transparent&quot;, size = 0.25) +<br \/>\n# add graticules projected to Robinson<br \/>\ngeom_path(data=NE_graticules_rob, aes(long, lat, group=group), linetype=&quot;dotted&quot;, color=&quot;grey50&quot;, size = 0.25) +<br \/>\n# add graticule labels &#8211; latitude and longitude<br \/>\ngeom_text(data = lbl.Y.prj, aes(x = X.prj, y = Y.prj, label = lbl), color=&quot;grey50&quot;, size=2) +<br \/>\ngeom_text(data = lbl.X.prj, aes(x = X.prj, y = Y.prj, label = lbl), color=&quot;grey50&quot;, size=2) +<br \/>\n# the default, ratio = 1 in coord_fixed ensures that one unit on the x-axis is the same length as one unit on the y-axis<br \/>\ngeom_point(data=gcd, aes(long,lat, col= GCD_version),pch=2)+<br \/>\ncoord_fixed(ratio = 1) +<br \/>\n# remove the background and default gridlines<br \/>\ntheme_void()+<br \/>\ntheme(legend.title = element_text(colour=&quot;black&quot;, size=8, face=&quot;bold&quot;), # adjust legend title<br \/>\nlegend.position = c(0.1, 0.2), # relative position of legend<br \/>\nplot.margin = unit(c(t=0, r=0, b=0, l=0), unit=&quot;cm&quot;),<br \/>\nlegend.background = element_rect(fill=&quot;white&quot;,<br \/>\nsize=0.5, linetype=&quot;solid&quot;,<br \/>\ncolour =&quot;black&quot;)) # adjust margins<\/p>\n<p># save to pdf and png file<br \/>\nggsave(&quot;map_draft_1.pdf&quot;, width=28, height=13.5, units=&quot;cm&quot;)<br \/>\nggsave(&quot;map_1.png&quot;, width=26, height=13.5, units=&quot;cm&quot;, dpi=300)<\/p>\n<p># REFERENCES:<br \/>\n# This link was useful for graticule idea<br \/>\n# http:\/\/stackoverflow.com\/questions\/38532070\/how-to-add-lines-of-longitude-and-latitude-on-a-map-using-ggplot2<br \/>\n# Working with shapefiles, projections and world maps in ggplot<br \/>\n# http:\/\/rpsychologist.com\/working-with-shapefiles-projections-and-world-maps-in-ggplot<br \/>\n&lt;pre&gt;[\/code]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are please to announce that the GCD and paleofire R packages have been updated to their 4.0.2 and 1.2.2 versions, respectively. GCD major update from 3.X.X to 4.X.X version&hellip;<\/p>\n","protected":false},"author":1,"featured_media":632,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-630","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analyses"],"_links":{"self":[{"href":"https:\/\/ipn.paleofire.org\/index.php?rest_route=\/wp\/v2\/posts\/630","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ipn.paleofire.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ipn.paleofire.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ipn.paleofire.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ipn.paleofire.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=630"}],"version-history":[{"count":10,"href":"https:\/\/ipn.paleofire.org\/index.php?rest_route=\/wp\/v2\/posts\/630\/revisions"}],"predecessor-version":[{"id":677,"href":"https:\/\/ipn.paleofire.org\/index.php?rest_route=\/wp\/v2\/posts\/630\/revisions\/677"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ipn.paleofire.org\/index.php?rest_route=\/wp\/v2\/media\/632"}],"wp:attachment":[{"href":"https:\/\/ipn.paleofire.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ipn.paleofire.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ipn.paleofire.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}