Extract Multi Values to Points on time enabled raster layers

2432
2
Jump to solution
06-28-2016 02:35 AM
BenjaminSimpson
New Contributor III


Hi,

I am trying to run the 'Extract Multi Value to Points' tool in ArcGIS 10.3. The purpose for running this tool is that I have four time enabled raster layers (rainfall measurements) and a point layer. The raster layers have a single value (daily average) per day for a whole yea. What I want to end up with is in the points layer a column for each of the daily values from all four raster layers. The 'Extract Multi Value to Point' tool does this perfectly for the currently visible time period of the raster layers. Now seeing as I do not want to run this tool 365 times manually, I was wondering if anyone new of a quicker way to go about this? If the answer is to create a python script to iterate through each of the time intervals then that is fine. If this is the case does anyone know how to set the selected/visible time interval (daily value) for a raster layer in python?

Thanks in advance for any help,

Ben.

1 Solution

Accepted Solutions
BenjaminSimpson
New Contributor III

Thanks Dan, that link was helpful. Your link didn't work for some reason so hopefully this one will LayerTime—Help | ArcGIS for Desktop

The method shown in that link did not completely work for me, mainly because I am working from raster layers so some of the code was not working. Instead I found this link using arcpy to export separate netcdf dimension values as a raster . The answer that Justin Koppa gave helped me solve my issue. I took a step back and batch imported the .nc files as raster layers (MakeNetCDFRasterLayer). I created a separate raster layer for each time interval (1 day), then used the 'Extract Multi Values to Point' tool to join the data to my points layer.

The code below is what I ended up using which so far has worked fine. The only thing I didn't include is a method to delete the unwanted raster layers after the Extract Multi Values To Points tool was used. Sorry I have forgotten how to format code in here

            # Year info

            years = range(2013,2015)

            for yrs in years:

                # Month info

                allMnths = range(1,12)

                for mnths in allMnths:

                    Lastday = calendar.monthrange(Yr, mnths)[1]

                    MRange = range(1,Lastday+1)

                    for dyy in MRange:

                        dyys =int(dyy)

                        mnthsss = int(mnths)

                        Yr = int(yrs)

                        a = str(Yr) + "-" + str(mnthsss)+ "-" + str(dyys)

                        inDate = "time " + a

                        rainfall_2013_nc = r"D:\rainfall_data\UK_data_2013_2015.nc"

                        layer_title = "rr_" + a

                        # Process: Make NetCDF Raster Layer

                        arcpy.MakeNetCDFRasterLayer_md(rainfall_2013_nc, "rainfall_amount", "x", "y", layer_title, "", inDate, "BY_VALUE")

                        # run the Extract Multi Values to Points tool on the newly created raster layer

                        ExtractMultiValuesToPoints("SR_Loc_All", layer_title, "NONE")

View solution in original post

2 Replies
DanPatterson_Retired
MVP Emeritus

There is this in the mapping module, but I haven't explored it

LayerTime—Help | ArcGIS for Desktop

BenjaminSimpson
New Contributor III

Thanks Dan, that link was helpful. Your link didn't work for some reason so hopefully this one will LayerTime—Help | ArcGIS for Desktop

The method shown in that link did not completely work for me, mainly because I am working from raster layers so some of the code was not working. Instead I found this link using arcpy to export separate netcdf dimension values as a raster . The answer that Justin Koppa gave helped me solve my issue. I took a step back and batch imported the .nc files as raster layers (MakeNetCDFRasterLayer). I created a separate raster layer for each time interval (1 day), then used the 'Extract Multi Values to Point' tool to join the data to my points layer.

The code below is what I ended up using which so far has worked fine. The only thing I didn't include is a method to delete the unwanted raster layers after the Extract Multi Values To Points tool was used. Sorry I have forgotten how to format code in here

            # Year info

            years = range(2013,2015)

            for yrs in years:

                # Month info

                allMnths = range(1,12)

                for mnths in allMnths:

                    Lastday = calendar.monthrange(Yr, mnths)[1]

                    MRange = range(1,Lastday+1)

                    for dyy in MRange:

                        dyys =int(dyy)

                        mnthsss = int(mnths)

                        Yr = int(yrs)

                        a = str(Yr) + "-" + str(mnthsss)+ "-" + str(dyys)

                        inDate = "time " + a

                        rainfall_2013_nc = r"D:\rainfall_data\UK_data_2013_2015.nc"

                        layer_title = "rr_" + a

                        # Process: Make NetCDF Raster Layer

                        arcpy.MakeNetCDFRasterLayer_md(rainfall_2013_nc, "rainfall_amount", "x", "y", layer_title, "", inDate, "BY_VALUE")

                        # run the Extract Multi Values to Points tool on the newly created raster layer

                        ExtractMultiValuesToPoints("SR_Loc_All", layer_title, "NONE")