{"id":2978,"date":"2021-05-26T15:42:39","date_gmt":"2021-05-26T03:42:39","guid":{"rendered":"http:\/\/blogs.lincoln.ac.nz\/gis\/?p=2978"},"modified":"2023-05-07T03:00:34","modified_gmt":"2023-05-07T03:00:34","slug":"poor-lost-grid","status":"publish","type":"post","link":"https:\/\/blogs.lincoln.ac.nz\/gis\/poor-lost-grid\/","title":{"rendered":"Poor Lost Grid"},"content":{"rendered":"<p><em>This post covers importing a raster layer from a text file and tidying it up for analysis using Clip Raster and Con<\/em><\/p>\n<p>Data can take many different forms, some obvious and easy to work with, others less so.\u00a0 In this post we look at a special case of a raster layer in the guise of a text file.\u00a0 But first, a bit about file formats.<\/p>\n<p>Raster grids can come in a wide range of formats: <a href=\"https:\/\/en.wikipedia.org\/wiki\/JPEG\" target=\"_blank\" rel=\"noopener noreferrer\">jpgs<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/TIFF\" target=\"_blank\" rel=\"noopener noreferrer\">tifs<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/NetCDF\" target=\"_blank\" rel=\"noopener noreferrer\">NetCDF<\/a> layers and more than a few others.\u00a0 At their most basic level, rasters have a very simple structure &#8211; a set number of rows and columns, a place in the world, a cell size and values for\u00a0each cell.\u00a0 By comparison, vector layers are much more complex and hold a lot more data.\u00a0 Consider a polygon &#8211; the file is keeping track of all the points that make up the polygon&#8217;s corners, and how they&#8217;re all linked together with lines, and then all the attributes that go along with the polygon.\u00a0 Depending on the level of detail and extent, they can become quite large.\u00a0 Rasters are relatively &#8220;light&#8221; by comparison.<\/p>\n<p>One unexpected format for rasters is as a text file.\u00a0 We&#8217;ve started out a new project recently on finding the best locations for hops in Aotearoa, and one of the many factors to consider is the number of frost free days across the country.\u00a0 The good people at NIWA have done the work and have shared the data with us.\u00a0\u00a0Into the Inbox one day came a note with a 3 Mb text file attached:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/email.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2979\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/email.jpg\" alt=\"\" width=\"210\" height=\"53\" \/><\/a><\/p>\n<p>When downloaded and opened, it looked like this:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/textfile.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2980\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/textfile.jpg\" alt=\"\" width=\"635\" height=\"416\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/textfile.jpg 635w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/textfile-300x197.jpg 300w\" sizes=\"auto, (max-width: 635px) 100vw, 635px\" \/><\/a><\/p>\n<p>What on earth am I supposed to do with this?\u00a0 We&#8217;ve got a file with a header of sorts and then a whole bunch of values separated by a space.\u00a0 Let&#8217;s decode this thing:<\/p>\n<ul>\n<li>ncols = the number of columns in the raster grid<\/li>\n<li>nrows = the number of rows<\/li>\n<li>xllcorner = the x-coordinate of the lower left hand corner of the grid<\/li>\n<li>yllcorner = the y-coordinate<\/li>\n<li>cellsize = well, cell size, the resolution<\/li>\n<li>NODATA value = a value that denotes no data, or unknown<\/li>\n<\/ul>\n<p>A bit of experience tells me that the x- and y-coordinate values are in the <a href=\"http:\/\/blogs.lincoln.ac.nz\/gis\/how-to-be-in-two-or-more-places-at-once\/\" target=\"_blank\" rel=\"noopener noreferrer\">New Zealand Transverse Mercator<\/a> coordinate system, so it should play nicely with all our other data layers.\u00a0 Units of the cellsize for this coordinate system would then be metres.<\/p>\n<p>Piecing this all together we have a recipe to construct a grid.\u00a0 We know where to start, how big to make each cell, and how many rows and columns to use.\u00a0 Plus, the sequence of values after the header relates to the value for each cell (it&#8217;s a matrix, basically &#8211; each line is one row with 688 values).\u00a0 At this point it looks like we&#8217;ve got a layer full of no data values, but if we look further down, we start to see different values:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/textfile2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2981\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/textfile2.jpg\" alt=\"\" width=\"635\" height=\"419\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/textfile2.jpg 635w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/textfile2-300x198.jpg 300w\" sizes=\"auto, (max-width: 635px) 100vw, 635px\" \/><\/a><\/p>\n<p>While we&#8217;re here, notice that the non -9999 values are floating point &#8211; they have a decimal and a certain number of places past the decimal.<\/p>\n<p>To make sense of the -9999s, picture a raster grid with 909 rows and 688 columns, each 1,500 m on each side and covering the landmass of Aotearoa.\u00a0 Since the islands sit diagonally within that grid there are going to be\u00a0some cells that are covering the sea surface &#8211; those are the ones that get a -9999.\u00a0 Anywhere on land gets a floating point number that here represents the median number of frost free days per year.<\/p>\n<p>Enough of this&#8230;how do I get this on a map?\u00a0 It used to be that there was a tool called ASCII to Raster which would take a text file and convert it to a normal raster after reading the header lines.\u00a0 It even likes text files!<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ASCII2RAS.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2983\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ASCII2RAS.jpg\" alt=\"\" width=\"795\" height=\"414\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ASCII2RAS.jpg 795w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ASCII2RAS-300x156.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ASCII2RAS-768x400.jpg 768w\" sizes=\"auto, (max-width: 795px) 100vw, 795px\" \/><\/a><\/p>\n<p>That tool seems to have gone the way of the dinosaurs and is no longer available in Pro (though there is a <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/tool-reference\/conversion\/raster-to-ascii.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Raster to ASCII<\/a> tool).\u00a0 Why\u00a0is there a need for\u00a0these tools?\u00a0 Emailing a text file is often easier than zipping up a raster grid.<\/p>\n<p>So what&#8217;s my plan?\u00a0 I do recall that Pro recognises files that end in .ASC (file type 4 <a href=\"https:\/\/fileinfo.com\/extension\/asc\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>) so I sneakily make a copy of the text file and simply change its extension to .asc.<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ASC.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2984\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ASC.jpg\" alt=\"\" width=\"628\" height=\"81\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ASC.jpg 628w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ASC-300x39.jpg 300w\" sizes=\"auto, (max-width: 628px) 100vw, 628px\" \/><\/a><\/p>\n<p>When I add this to a map like an ordinary layer, voila!\u00a0 I get this:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/OnMap.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2985\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/OnMap.jpg\" alt=\"\" width=\"1634\" height=\"882\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/OnMap.jpg 1634w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/OnMap-300x162.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/OnMap-1024x553.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/OnMap-768x415.jpg 768w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/OnMap-1536x829.jpg 1536w\" sizes=\"auto, (max-width: 1634px) 100vw, 1634px\" \/><\/a><\/p>\n<p>Now we&#8217;re getting somewhere.\u00a0 The extent of this layer clearly goes beyond Aotearoa&#8217;s shoreline so I&#8217;ll tidy this by clipping the raster to the coastline:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ClipRaster.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2986\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ClipRaster.jpg\" alt=\"\" width=\"1912\" height=\"878\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ClipRaster.jpg 1912w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ClipRaster-300x138.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ClipRaster-1024x470.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ClipRaster-768x353.jpg 768w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ClipRaster-1536x705.jpg 1536w\" sizes=\"auto, (max-width: 1912px) 100vw, 1912px\" \/><\/a><\/p>\n<p>To get this:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/clip.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2987\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/clip.jpg\" alt=\"\" width=\"1641\" height=\"880\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/clip.jpg 1641w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/clip-300x161.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/clip-1024x549.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/clip-768x412.jpg 768w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/clip-1536x824.jpg 1536w\" sizes=\"auto, (max-width: 1641px) 100vw, 1641px\" \/><\/a><\/p>\n<p>Just about to feel like I&#8217;m done when I notice something odd in the Contents:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Legend.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2988\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Legend.jpg\" alt=\"\" width=\"207\" height=\"156\" \/><\/a><\/p>\n<p>If I understand these data properly, it&#8217;s telling us about how many frost free days an area gets annually.\u00a0 So why have I got negative values and values greater than 365?\u00a0 I&#8217;ll play around with the symbology a bit to see just where these places are:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/OutOfRange.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2989\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/OutOfRange.jpg\" alt=\"\" width=\"1401\" height=\"856\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/OutOfRange.jpg 1401w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/OutOfRange-300x183.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/OutOfRange-1024x626.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/OutOfRange-768x469.jpg 768w\" sizes=\"auto, (max-width: 1401px) 100vw, 1401px\" \/><\/a><\/p>\n<p>So all my negative values are clustered around the St Arnaud Range while the Sounds has the ones greater than 365, plus two hanging out around Kaikoura (not a bad choice) oh, and one at Cape Campbell, too.\u00a0 I suspect that there are some artefacts of the process of creating this layer (what we refer to as <a href=\"http:\/\/blogs.lincoln.ac.nz\/gis\/gis-and-precision-agriculture\/\" target=\"_blank\" rel=\"noopener noreferrer\">interpolation <\/a>in the trade).\u00a0 A quick email to NIWA confirms this and I should be safe to reclassify all the negative values to 0 and the &gt; 365 values to 365.<\/p>\n<p>All good, but how am I going to do this?\u00a0 If I use the <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/tool-reference\/spatial-analyst\/reclassify.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Reclassify <\/a>tool I can certainly take care of the lower and upper values, but I would have trouble leaving the others as they are, especially since they&#8217;re <a href=\"https:\/\/www.computerhope.com\/jargon\/f\/floapoin.htm\" target=\"_blank\" rel=\"noopener noreferrer\">floating point<\/a> values.\u00a0 (How do I know this?\u00a0 Two ways &#8211; looking at the text table above\u00a0we\u00a0saw floating point values but I can also click on one of the cells on the map and peer into its value:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Popup.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2990\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Popup.jpg\" alt=\"\" width=\"802\" height=\"646\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Popup.jpg 802w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Popup-300x242.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Popup-768x619.jpg 768w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" \/><\/a><\/p>\n<p>Clearly floating point with a ridiculous amount of precision.\u00a0 I need another option.\u00a0 The one that comes to mind is <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/tool-reference\/spatial-analyst\/con-.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Con<\/a>, which basically changes values in a cell if it meets certain conditions.\u00a0 So in this case I might use it change all the cells with a negative value to 0 (i.e. if cell value &lt; 0, change it to 0; if not, leave it alone).\u00a0 I&#8217;ve got two changes to make subject to different conditions:<\/p>\n<ul>\n<li>if Value &lt; 0, change it to 0, and<\/li>\n<li>if Value &gt; 365, change it to 365<\/li>\n<\/ul>\n<p>In general, I&#8217;ve got to be careful about the &lt; (less than) being an actual &lt; and not a &lt;= (less than or equal to) but it&#8217;s not critical here, really.\u00a0 Can I do them both at once?\u00a0 Let&#8217;s look at the tool &#8211; here I&#8217;ve set it up with both conditions linked by an OR:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ConTool3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2993\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ConTool3.jpg\" alt=\"\" width=\"535\" height=\"501\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ConTool3.jpg 535w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ConTool3-300x281.jpg 300w\" sizes=\"auto, (max-width: 535px) 100vw, 535px\" \/><\/a><\/p>\n<p>Set up this way, if a value is less than 0 <em>OR<\/em> greater than 365, the value will be reset to 0 (Input true raster or constant value).\u00a0 If it&#8217;s not, the original value from nz_ffp50_Clip at that cell will be used.<\/p>\n<p>This ain&#8217;t gonna work because I can only assign one true or false value, so I&#8217;ll have to do it in two steps.\u00a0 First I do the negative values (for not particular reason):<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Neg.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2994\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Neg.jpg\" alt=\"\" width=\"540\" height=\"456\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Neg.jpg 540w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Neg-300x253.jpg 300w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/a><\/p>\n<p>Then I do the &gt; 365 values, careful to reset the input conditional and false rasters to the output of the above Con:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Greater2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2996\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Greater2.jpg\" alt=\"\" width=\"419\" height=\"464\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Greater2.jpg 419w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Greater2-271x300.jpg 271w\" sizes=\"auto, (max-width: 419px) 100vw, 419px\" \/><\/a><\/p>\n<p>And I&#8217;ve now got my analysis ready output raster from\u00a0the original text file:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Output.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2997\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Output.jpg\" alt=\"\" width=\"1504\" height=\"843\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Output.jpg 1504w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Output-300x168.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Output-1024x574.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/Output-768x430.jpg 768w\" sizes=\"auto, (max-width: 1504px) 100vw, 1504px\" \/><\/a><\/p>\n<p>Notice that the range of values in this new layer runs from 0 to 365.\u00a0 Happy days.<\/p>\n<p>Last thing I&#8217;ll do here is to bend this layer to fit my analysis.\u00a0 My sources tell me that hops do best in areas with greater than 120 frost free days, so a quick reclass gets me those areas:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ForHops.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2998\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ForHops.jpg\" alt=\"\" width=\"1499\" height=\"853\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ForHops.jpg 1499w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ForHops-300x171.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ForHops-1024x583.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/05\/ForHops-768x437.jpg 768w\" sizes=\"auto, (max-width: 1499px) 100vw, 1499px\" \/><\/a><\/p>\n<p>Nice.\u00a0 So in this post we&#8217;ve seen how we can work with a text file version of a raster grid, plus we saw how to clip rasters and also how to use the Con tool to make conditional changes.\u00a0 I&#8217;m sad to admit that I&#8217;ve been keeping my eyes open for a good use of Con for quite a while now&#8230;sad testament to how I spend my time, but here it fit in very nicely and was the best tool for the job.<\/p>\n<p>All this talk of hops has made me thirsty.\u00a0 Now what icy cold beverage would possibly make use of hops in its production?\u00a0 Hmmmmm?<\/p>\n<p>C<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post covers importing a raster layer from a text file and tidying it up for analysis using Clip Raster and Con Data can take many different forms, some obvious and easy to work with, others less so.\u00a0 In this post we look at a special case of a raster layer in the guise of [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2978","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/2978","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/comments?post=2978"}],"version-history":[{"count":1,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/2978\/revisions"}],"predecessor-version":[{"id":4079,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/2978\/revisions\/4079"}],"wp:attachment":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/media?parent=2978"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/categories?post=2978"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/tags?post=2978"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}