<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: arcpy AsciiToRaster cannot convert ascii files that contain a lot of 'nodata (-9999)' in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1038318#M60469</link>
    <description>&lt;P&gt;One more option which works with ArcGIS Pros arcgispro-py3 python environment&lt;/P&gt;&lt;P&gt;Save and run the fgddem.py script from&amp;nbsp;&lt;A href="https://gist.github.com/minorua/4993166" target="_blank" rel="noopener"&gt;https://gist.github.com/minorua/4993166&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;D:\Temp\jpgis&amp;gt; activate arcgispro-py3

(arcgispro-py3) D:\Temp\jpgis&amp;gt; python fgddem.py
No input files selected
=== Usage ===
python fgddem.py [-replace_nodata_by_zero] [-f format] [-out_dir output_directory] [-q] [-v] src_files*

src_files: The source file name(s). JPGIS(GML) DEM zip/xml files.

(arcgispro-py3) PS D:\Temp\jpgis&amp;gt; python fgddem.py -f GTIFF -out_dir . FG-GML-4930-01-20-DEM5A-20161001.xml
translating FG-GML-4930-01-20-DEM5A-20161001.xml
completed&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Luke_Pinner_0-1616102774348.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/8834iC67857BA3C1564FB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Luke_Pinner_0-1616102774348.png" alt="Luke_Pinner_0-1616102774348.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Mar 2021 21:34:13 GMT</pubDate>
    <dc:creator>Luke_Pinner</dc:creator>
    <dc:date>2021-03-18T21:34:13Z</dc:date>
    <item>
      <title>arcpy AsciiToRaster cannot convert ascii files that contain a lot of 'nodata (-9999)'</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1036293#M60399</link>
      <description>&lt;P&gt;I have 570 ascii files with headers (example shown below). About 400 of them opens as ascii or I can convert to raster using arcpy 'AsciiToRaster'. But I have problem with coastal cells containing relatively large fraction of 'Nodata_value' cells.&lt;BR /&gt;&lt;BR /&gt;I first thought it could be the format of nodata_values, but some files contain smaller number of nodata-values works, so this is probably not the case. The coastal cells I can open does not seem to have exact matching coastal line with the baseman. The coordinate system of the ascii data is JGD2011.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone could advise what the problem is and how I could fix?&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----&lt;/P&gt;&lt;P&gt;NCOLS 225&lt;BR /&gt;NROWS 150&lt;BR /&gt;XLLCORNER 130.3&lt;BR /&gt;YLLCORNER 32.675&lt;BR /&gt;CELLSIZE 5.555555333335368e-05&lt;BR /&gt;NODATA_VALUE -9999&lt;/P&gt;</description>
      <pubDate>Sat, 13 Mar 2021 21:56:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1036293#M60399</guid>
      <dc:creator>RYokochi</dc:creator>
      <dc:date>2021-03-13T21:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AsciiToRaster cannot convert ascii files that contain a lot of 'nodata (-9999)'</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1036296#M60400</link>
      <description>&lt;P&gt;Is there an error message?&lt;/P&gt;&lt;P&gt;How are you opening them?&lt;/P&gt;</description>
      <pubDate>Sat, 13 Mar 2021 23:20:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1036296#M60400</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-03-13T23:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AsciiToRaster cannot convert ascii files that contain a lot of 'nodata (-9999)'</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1036302#M60401</link>
      <description>&lt;P&gt;Thank you for asking!&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error message is: Error 010067: Error in executing grid expression&lt;/P&gt;&lt;P&gt;Failed to execute (ASCIIToRaster)&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I tried both ways (from python and from ArcGISPro Tool).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attach the file I cannot open. Ascii files are not supported so it was zipped.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Mar 2021 01:57:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1036302#M60401</guid>
      <dc:creator>RYokochi</dc:creator>
      <dc:date>2021-03-14T01:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AsciiToRaster cannot convert ascii files that contain a lot of 'nodata (-9999)'</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1036308#M60402</link>
      <description>&lt;P&gt;Sounds like you aren't specifying a *.tif as the output format and/or your destination workspace has spaces in it.&lt;/P&gt;&lt;P&gt;It you are doing this through a script ensure that you are using "raw" encoding for your path, make your path short and simple and use *tif files as the output raster type&lt;/P&gt;&lt;P&gt;Also, no matter how I try every line has a line break after every number so it doesn't comply with the header, so compare the "worked" vs the "didn't work"&lt;/P&gt;&lt;P&gt;NCOLS 225&lt;BR /&gt;NROWS 150&lt;BR /&gt;XLLCORNER 130.125&lt;BR /&gt;YLLCORNER 32.683333333&lt;BR /&gt;CELLSIZE 5.555555999999721e-05&lt;BR /&gt;NODATA_VALUE -9999&lt;BR /&gt;3.40&lt;BR /&gt;15.10&lt;BR /&gt;17.20&lt;BR /&gt;21.80&lt;BR /&gt;27.30&lt;BR /&gt;29.20&lt;BR /&gt;28.10&lt;BR /&gt;27.30&lt;BR /&gt;28.60&lt;BR /&gt;30.10&lt;BR /&gt;31.30&lt;BR /&gt;30.30&lt;BR /&gt;27.90&lt;BR /&gt;24.40&lt;BR /&gt;21.20&lt;BR /&gt;18.20&lt;BR /&gt;15.10&lt;BR /&gt;12.00&lt;/P&gt;</description>
      <pubDate>Sun, 14 Mar 2021 02:10:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1036308#M60402</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-03-14T02:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AsciiToRaster cannot convert ascii files that contain a lot of 'nodata (-9999)'</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1036313#M60403</link>
      <description>&lt;P&gt;Thank you for checking!!!&lt;BR /&gt;I processed the files that worked in the exact same way, and a large fraction of them get converted to rasters. The files that worked is attached this time. The ones that does NOT work are along the coast lines with a lot of -9999. But everything else is the same (or at least to me it seems).&lt;BR /&gt;&lt;BR /&gt;I also attach a screenshot of the map that contains all the patches that worked. As you see, the ones that did not work are all by the coast and have smaller file size (a lot of -9999). Some of the working files do have -9999 but only sparsely.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Mar 2021 04:59:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1036313#M60403</guid>
      <dc:creator>RYokochi</dc:creator>
      <dc:date>2021-03-14T04:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AsciiToRaster cannot convert ascii files that contain a lot of 'nodata (-9999)'</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1037520#M60436</link>
      <description>&lt;P&gt;Your&amp;nbsp;A01-20-DEM5A.asc is corrupt. The header specifies&amp;nbsp;&lt;SPAN&gt;NCOLS 225 and&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;NROWS 150 which means you should have exactly 33750 (225x150) values in your asc file, but there are only 16063 values.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I pad out the file so there are&amp;nbsp;33750 values, then the file will convert (but obviously is missing lots of actual data). &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;S&lt;/SPAN&gt;&lt;SPAN&gt;ee below (I've used black to represent -9999, blue for data values and green for the padding values that I added just to demonstrate).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Luke_Pinner_1-1616018736198.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/8734iB2A0A3646BC69851/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Luke_Pinner_1-1616018736198.png" alt="Luke_Pinner_1-1616018736198.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Luke_Pinner_4-1616018852802.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/8737i09875B8DB141C5E3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Luke_Pinner_4-1616018852802.png" alt="Luke_Pinner_4-1616018852802.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 22:09:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1037520#M60436</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2021-03-17T22:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AsciiToRaster cannot convert ascii files that contain a lot of 'nodata (-9999)'</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1037557#M60438</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, no matter how I try every line has a line break after every number so it doesn't comply with the header, so compare the "worked" vs the "didn't work"&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The use of space or newline separators doesn't matter as long as the number of values = NCOLS x NROWS.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 11:45:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1037557#M60438</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2021-03-17T11:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AsciiToRaster cannot convert ascii files that contain a lot of 'nodata (-9999)'</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1037909#M60456</link>
      <description>&lt;P&gt;Thank you so much for pointing this out. I converted the original file provided as xml (attached) and it does say 225x150, but you are correct, and the number of values is lower than anticipated in the original file, too.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;It seems that the file with more -9999 have smaller number of values. I was looking at wrong problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I tried more things, it turned out that some of the ascii files can open directly in ArcGISPro if I wait for a long time (like 30 min or 1 hour). I also noticed that the cells with its LLcorner in water seems to be the ones that are problematic, sometimes showing up as a strangely cut mosaic. &amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This problem turned out to be caused by the original file and not the ArcGIS, so I close this for now. But I will post if I ever find what to do with these files in case someone else works on Japanese DEM database:&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;A href="https://fgd.gsi.go.jp/download/mapGis.php?tab=dem" target="_blank" rel="noopener"&gt;https://fgd.gsi.go.jp/download/mapGis.php?tab=dem&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;P.S. I am new here. If anything missing, please let me know.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 04:44:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1037909#M60456</guid>
      <dc:creator>RYokochi</dc:creator>
      <dc:date>2021-03-18T04:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AsciiToRaster cannot convert ascii files that contain a lot of 'nodata (-9999)'</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1037915#M60457</link>
      <description>&lt;P&gt;Going back to the .xml file, I realized that there is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;gml:startPoint&amp;gt;16 78&amp;lt;/gml:startPoint&amp;gt;&lt;/P&gt;&lt;P&gt;I suspect that the data starts from there [col,row]=[16,78]&lt;/P&gt;&lt;P&gt;This will not make exactly 16063, but closer than 33750.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The files that work do not always have 33750, and I suspect that this was the reason.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 05:06:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1037915#M60457</guid>
      <dc:creator>RYokochi</dc:creator>
      <dc:date>2021-03-18T05:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AsciiToRaster cannot convert ascii files that contain a lot of 'nodata (-9999)'</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1037936#M60458</link>
      <description>&lt;P&gt;Have a look at "demtool" for converting Japanese GML DEMs:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://github.com/tmizu23/demtool" target="_blank"&gt;https://github.com/tmizu23/demtool&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://www.ecoris.co.jp/contents/demtool.html" target="_blank"&gt;https://www.ecoris.co.jp/contents/demtool.html&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Thu, 18 Mar 2021 08:57:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1037936#M60458</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2021-03-18T08:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AsciiToRaster cannot convert ascii files that contain a lot of 'nodata (-9999)'</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1038103#M60461</link>
      <description>&lt;P&gt;Here is a summary so people get consolidated answers from the question without following the exchanges:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why didn't arcpy convert my ascii file?: Because &lt;STRONG&gt;the number of data&lt;/STRONG&gt; was insufficient for the given column x row&lt;/P&gt;&lt;P&gt;Why was the number of data insufficient?: Because &lt;STRONG&gt;a fraction of the data over the ocean was omitted&lt;/STRONG&gt;. The original data in xml file did contain this information as 'start point' but I was not aware.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The ascii file was generated from an .xml file from Japanese database at&amp;nbsp;&lt;A href="https://fgd.gsi.go.jp/download/mapGis.php?tab=dem" target="_blank" rel="noopener nofollow noreferrer"&gt;https://fgd.gsi.go.jp/download/mapGis.php?tab=dem&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Rather than translating these oneself, there two programs freely available [both also informed by Luke_Pinner]: &amp;nbsp;&lt;/P&gt;&lt;P&gt;A software from:&amp;nbsp;&lt;A href="https://www.ecoris.co.jp/contents/demtool.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.ecoris.co.jp/contents/demtool.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;A Python script from:&amp;nbsp;&lt;A href="https://gist.github.com/minorua/4993166" target="_blank" rel="noopener nofollow noreferrer"&gt;https://gist.github.com/minorua/4993166&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I used the Python script to generate the map I wanted (attached).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you, Luke_Pinner!!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 04:02:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1038103#M60461</guid>
      <dc:creator>RYokochi</dc:creator>
      <dc:date>2021-03-22T04:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AsciiToRaster cannot convert ascii files that contain a lot of 'nodata (-9999)'</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1038318#M60469</link>
      <description>&lt;P&gt;One more option which works with ArcGIS Pros arcgispro-py3 python environment&lt;/P&gt;&lt;P&gt;Save and run the fgddem.py script from&amp;nbsp;&lt;A href="https://gist.github.com/minorua/4993166" target="_blank" rel="noopener"&gt;https://gist.github.com/minorua/4993166&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;D:\Temp\jpgis&amp;gt; activate arcgispro-py3

(arcgispro-py3) D:\Temp\jpgis&amp;gt; python fgddem.py
No input files selected
=== Usage ===
python fgddem.py [-replace_nodata_by_zero] [-f format] [-out_dir output_directory] [-q] [-v] src_files*

src_files: The source file name(s). JPGIS(GML) DEM zip/xml files.

(arcgispro-py3) PS D:\Temp\jpgis&amp;gt; python fgddem.py -f GTIFF -out_dir . FG-GML-4930-01-20-DEM5A-20161001.xml
translating FG-GML-4930-01-20-DEM5A-20161001.xml
completed&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Luke_Pinner_0-1616102774348.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/8834iC67857BA3C1564FB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Luke_Pinner_0-1616102774348.png" alt="Luke_Pinner_0-1616102774348.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 21:34:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1038318#M60469</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2021-03-18T21:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy AsciiToRaster cannot convert ascii files that contain a lot of 'nodata (-9999)'</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1039160#M60515</link>
      <description>&lt;P&gt;This is my favorite! Thank you again for the solution #3!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 02:05:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-asciitoraster-cannot-convert-ascii-files/m-p/1039160#M60515</guid>
      <dc:creator>RYokochi</dc:creator>
      <dc:date>2021-03-22T02:05:20Z</dc:date>
    </item>
  </channel>
</rss>

