<?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: Some files from temp directory being deleted while others not when using arcpy in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/some-files-from-temp-directory-being-deleted-while/m-p/1366004#M76915</link>
    <description>&lt;P&gt;The temp folder isn't on OneDrive, though. Either way, I also made a project on my local drive and ran the script on that project, and it is still giving me the same problem. But now everything is getting deleted/isn't being saved. When I look at the raster bands it gives me a path, ex:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;C:\Users\guilh\AppData\Local\Temp\ArcGISProTemp19664\x59a0fb9b_bca3_43a2_86cd_d5cf7e273e28y0.afr\wc2.1_30s_bioc_UKESM1-0-LL_ssp245_2021-2040_1&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;But there is no file named that in the temp folder, yet I can access the raster itself since I stored it in a list.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jan 2024 20:39:59 GMT</pubDate>
    <dc:creator>gsilva</dc:creator>
    <dc:date>2024-01-03T20:39:59Z</dc:date>
    <item>
      <title>Some files from temp directory being deleted while others not when using arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/some-files-from-temp-directory-being-deleted-while/m-p/1365946#M76909</link>
      <description>&lt;P&gt;I am working in a Python notebook within ArcGIS Pro. I am clipping rasters to the extent of a shapefile, then averaging the resulting rasters into one. From there I am trying to use zonal statistics on a set of bands from that processed raster to average out the values in the raster per census tract (so that the raster has the same value across the entire tract).&amp;nbsp; Whenever I run the zonal statistics tool, it gives me an error saying the files don't exist. I've checked the directory (temp directory because I don't want a ton of layers being added to the map for management reasons) and the files are indeed not there, but I stored them in a list and I can access and show them from the list, so they are being stored, but I guess are being deleted immediately from the directory. What is weird to me is that if I do the same thing, but use the preprocessed, clipped rasters instead of the averaged one, the files are saved in the temp directory and the tool runs fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works fine&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;clipped_rasters245 = []
for raster in rasters245:
    temp_clip = arcpy.ia.Clip(raster,aoi=r'C:\Users\guilh\Downloads\OneDrive_3_8-23-2023\SABR.shp')
    clipped_rasters245.append(temp_clip)

cur_band=clipped_rasters245[1].bands()[0]
new_raster245 = arcpy.sa.ZonalStatistics(tracts,'FIPS',cur_band,'MEAN')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While this does not work because the files (when calling the bands function) don't exist&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;mean_raster245= arcpy.ia.Mean(clipped_rasters245,extent_type='IntersectionOf',
              cellsize_type='MeanOf',
              ignore_nodata = True
)

cur_band= mean_raster245.bands()[0]
new_raster245 = arcpy.sa.ZonalStatistics(tracts,'FIPS',cur_band,'MEAN')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 18:47:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/some-files-from-temp-directory-being-deleted-while/m-p/1365946#M76909</guid>
      <dc:creator>gsilva</dc:creator>
      <dc:date>2024-01-03T18:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Some files from temp directory being deleted while others not when using arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/some-files-from-temp-directory-being-deleted-while/m-p/1365999#M76914</link>
      <description>&lt;P&gt;could be the use of one-drive&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.esri.com/en-us/knowledge-base/problem-arcgis-pro-and-cloud-storage-services-000025605" target="_blank"&gt;Problem: ArcGIS pro and Cloud Storage Services (esri.com)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 20:17:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/some-files-from-temp-directory-being-deleted-while/m-p/1365999#M76914</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-01-03T20:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Some files from temp directory being deleted while others not when using arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/some-files-from-temp-directory-being-deleted-while/m-p/1366004#M76915</link>
      <description>&lt;P&gt;The temp folder isn't on OneDrive, though. Either way, I also made a project on my local drive and ran the script on that project, and it is still giving me the same problem. But now everything is getting deleted/isn't being saved. When I look at the raster bands it gives me a path, ex:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;C:\Users\guilh\AppData\Local\Temp\ArcGISProTemp19664\x59a0fb9b_bca3_43a2_86cd_d5cf7e273e28y0.afr\wc2.1_30s_bioc_UKESM1-0-LL_ssp245_2021-2040_1&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;But there is no file named that in the temp folder, yet I can access the raster itself since I stored it in a list.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 20:39:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/some-files-from-temp-directory-being-deleted-while/m-p/1366004#M76915</guid>
      <dc:creator>gsilva</dc:creator>
      <dc:date>2024-01-03T20:39:59Z</dc:date>
    </item>
  </channel>
</rss>

