<?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 Extract NetCDF raster values to 'timestepped' shapefiles in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/extract-netcdf-raster-values-to-timestepped/m-p/608873#M20222</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a NetCDF raster for Sea Surface Temperature (SST), which has a time dimension that is monthly from 1950 - 2012.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a single NetCDF file with many 'time slices' - 744 i think (12 per year for 62 years)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have hurricane track data which is in point shape files, which I have also been able to time enable to this same monthly increments.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcMap understands this - and I can run animations which has the NetCDF raster and shapefiles changing correctly with time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I am trying to do is to now is produce a model (workflow) in model builder which extracts the SST value for each data point at the correct time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please provide assistance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Oct 2013 10:33:20 GMT</pubDate>
    <dc:creator>ChristopherVos1</dc:creator>
    <dc:date>2013-10-15T10:33:20Z</dc:date>
    <item>
      <title>Extract NetCDF raster values to 'timestepped' shapefiles</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/extract-netcdf-raster-values-to-timestepped/m-p/608873#M20222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a NetCDF raster for Sea Surface Temperature (SST), which has a time dimension that is monthly from 1950 - 2012.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a single NetCDF file with many 'time slices' - 744 i think (12 per year for 62 years)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have hurricane track data which is in point shape files, which I have also been able to time enable to this same monthly increments.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcMap understands this - and I can run animations which has the NetCDF raster and shapefiles changing correctly with time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I am trying to do is to now is produce a model (workflow) in model builder which extracts the SST value for each data point at the correct time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please provide assistance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 10:33:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/extract-netcdf-raster-values-to-timestepped/m-p/608873#M20222</guid>
      <dc:creator>ChristopherVos1</dc:creator>
      <dc:date>2013-10-15T10:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: Extract NetCDF raster values to 'timestepped' shapefiles</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/extract-netcdf-raster-values-to-timestepped/m-p/608874#M20223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;To accomplish this you are going to need to use python, which you could then create a script tool from and use in model builder. Below is a code sample. Basically we are opening the MXD, gettting some references to the data frame and layers and then stepping through time. At each step we perform our analysis and then move to the next time step.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
#Get a reference to the map document and first data frame
mxd = arcpy.mapping.MapDocument('Current') #If code is run in the app with the MXD open, otherwise pass the path to the MXD
df = arcpy.mapping.ListDataFrames(mxd)[0] #Assuming here there is only one data frame in the MXD

rasterLayerName = "SST" #replace with name of netCDF raster layer
rasterLayer = arcpy.mapping.ListLayers(mxd, rasterLayerName, df)[0]

hurricaneLayer = "Hurricanes" #replace with name of hurricane layer
hurricaneLayer = arcpy.mapping.ListLayers(mxd, hurricaneLayerName, df)[0]

#Loop through each time step within the full time extent
df.time.currentTime = df.time.startTime
while df.time.currentTime &amp;lt;= df.time.endTime:

&amp;nbsp;&amp;nbsp;&amp;nbsp; #Add your logic here, I assume you are using extract values to point
&amp;nbsp;&amp;nbsp;&amp;nbsp; #So we don't overwrite the output each time, we need a unique name, this will append the Year and Month value currently being processed.
&amp;nbsp;&amp;nbsp;&amp;nbsp; uniqueName = "Hurricanes_" + dt.time.currentTime.strftime("%Y_%m") 
&amp;nbsp;&amp;nbsp;&amp;nbsp; outPointFeatures = r"C:\OutputDate\" + uniqueName
&amp;nbsp;&amp;nbsp;&amp;nbsp; ExtractValuesToPoints(hurricaneLayer, rasterLayer, outPointFeatures,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "NONE", "VALUE_ONLY")

&amp;nbsp;&amp;nbsp;&amp;nbsp; #Set the current time of the data frame to the next time step
&amp;nbsp;&amp;nbsp;&amp;nbsp; df.time.currentTime += df.time.timeStepInterval
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:03:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/extract-netcdf-raster-values-to-timestepped/m-p/608874#M20223</guid>
      <dc:creator>ChrisFox3</dc:creator>
      <dc:date>2021-12-12T02:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: Extract NetCDF raster values to 'timestepped' shapefiles</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/extract-netcdf-raster-values-to-timestepped/m-p/608875#M20224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Chris, Thanks for your reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Everything was working in the Python environment until I typed in the line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;hurricaneLayer = arcpy.mapping.ListLayers(mxd, hurricaneLayerName, df)[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I received a Runtime Error saying: &amp;lt;type 'exceptions.NameError'&amp;gt; name 'hurricaneLayerName' is not defined&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried changing the code to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;hurricaneLayer = arcpy.mapping.ListLayers(mxd, hurr_data, df)[0] (hurr_data is the name of the shapefile feature class)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What do i need to do differently?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2013 10:25:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/extract-netcdf-raster-values-to-timestepped/m-p/608875#M20224</guid>
      <dc:creator>ChristopherVos1</dc:creator>
      <dc:date>2013-10-17T10:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extract NetCDF raster values to 'timestepped' shapefiles</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/extract-netcdf-raster-values-to-timestepped/m-p/608876#M20225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry there was a typo in the code. The variable above should be hurricaneLayerName.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
hurricaneLayerName = "Hurricanes" #replace with name of hurricane layer
hurricaneLayer = arcpy.mapping.ListLayers(mxd, hurricaneLayerName, df)[0]
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You were on the right track though. You can just pass in the name, but it needs to be the name of the layer in the map, not the shapefile name (They could be different). You would also need to surrond it in quotes, because it is a string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&lt;SPAN style="color: #3E3E3E; font-family: Arial;"&gt;hurricaneLayer = arcpy.mapping.ListLayers(mxd, "hurr_data", df)[0]&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:03:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/extract-netcdf-raster-values-to-timestepped/m-p/608876#M20225</guid>
      <dc:creator>ChrisFox3</dc:creator>
      <dc:date>2021-12-12T02:03:39Z</dc:date>
    </item>
  </channel>
</rss>

