Hi - I'm just trying to work round this error in my script....
"To test if a Raster has all NoData run the IsNull tool. If the output is all 1 then it only has NoData"
How do you test whether the whole raster is 1?
Here is an example of getting the % of nulls in a raster.
# calculate % no data cells in a raster. import sys, os, arcpy from arcpy import env from arcpy.sa import * if arcpy.CheckExtension("Spatial"): arcpy.CheckOutExtension("Spatial") else: print "No SA licence" exit HomeDir = "c:/Data/Swala/BurkinaFaso/IPSurvey/" fgdb = "IPRasterData.gdb" InData = os.path.join(HomeDir, fgdb) env.workspace = InData env.overwriteOutput = True ListRast = arcpy.ListRasters() # ListTable = arcpy.ListTables() for r in ListRast: print "Processing", r Ras = arcpy.Raster(r) NullRas = IsNull(Ras) NCol = NullRas.width NRow = NullRas.height NCell = NCol * NRow Mean = NullRas.mean NNull = Mean * NCell print "{} % Null {}".format(r, NNull / NCell * 100)
or
look at the GetRasterProperties gp tool
-Steve
Although Neil's snippet allows for determining the percentage of NoData in a raster, Steve provides a solution that does exactly what you are looking for and does not require Spatial Analyst. To show a little what you can do with it, here's a litte sample:
import arcpy ras = r"D:\Xander\LineasTransmision\Modelo\fgdb\RastersModelo.gdb\cmp_totexl02a" props = ['MINIMUM', 'MAXIMUM', 'MEAN', 'STD', 'ALLNODATA', 'ANYNODATA', 'UNIQUEVALUECOUNT'] for prop in props: try: print "{0}: {1}".format(prop, arcpy.GetRasterProperties_management(ras, prop)) except Exception as e: print "{0}: {1}".format(prop, e)
Returns:
# MINIMUM: 22 # MAXIMUM: 396 # MEAN: 97,7094252332071 # STD: 51,5918279932734 # ALLNODATA: 0 # ANYNODATA: 1 # UNIQUEVALUECOUNT: 327
So you will just have to test for the property "ALLNODATA" and when the result is '1', skip that raster.
Kind regards, Xander
Useful script!
Is it possible however that a raster has the ALLNODATA = 1 but looks visually ok, has a nodata value defined and the statistics are ALSO provided from the Get Raster Properties parameters: MEAN, MAXIMUM, MINIMUM, STANDARD DEVIATION ??
I am trying to understand why this happens to be able to convert to points afterwards...
Any suggestions for a workaround?
Thanks
Not sure if I understand... You have a raster that returns ALLNODATA = 1 (so all pixels are NoData values) but does have values (hence the valid stats for MEAN, MAXIMUM, MINIMUM, STANDARD DEVIATION)? If that happens it should be a bug. Is it possible to share the raster? Did you contact support?
Yes, you understood correctly.
Strange as it comes from masking a source raster (like spliting it). The source raster also shows allnodata = 1, but looks ok, stats ok, values ok, nodata defined ok.
The split rasters some show the allnodata 1 and some allnodata =0. All of them looking ok, stats ok, nodata defined ok.
Sure. I can share. How do we exchange the file?
I only wrote here, as I saw the issue of the allnodata thread.
Thank you! Really surprised with this artifact.
Can't figure out what it is.
Enviado desde Yahoo Mail con Android
El jue., jul. 26, 2018 a 18:38, Xander Bakker<geonet@esri.com> escribió:
#yiv9856133252 * #yiv9856133252 a #yiv9856133252 body {font-family:Helvetica, Arial, sans-serif;}#yiv9856133252 #yiv9856133252 h1, #yiv9856133252 h2, #yiv9856133252 h3, #yiv9856133252 h4, #yiv9856133252 h5, #yiv9856133252 h6, #yiv9856133252 p, #yiv9856133252 hr {}#yiv9856133252 .yiv9856133252button td {}
|
GeoNet
Re: Raster to Polygon fails with empty input
reply from Xander Bakker in Spatial Analyst - View the full discussion
Reply to this message by replying to this email, or go to the message on GeoNet
Start a new discussion in Spatial Analyst by email or at GeoNet
Following Re: Raster to Polygon fails with empty input in these streams: Inbox
This email was sent by GeoNet because you are a registered user.
You may unsubscribe instantly from GeoNet, or adjust email frequency in your email preferences
When you reply to this thread you can use the advanced editor using the link in the upper right part of your reply:
In the advanced editor you will find in the lower left corner a link that enables you to attach your data (if it is smaller than 50MB):
It would be best to use the format you are using, since converting to another format might have a different result when we run the code on it.
Hi again,
I contacted the ESRI support.
Meanwhile, how can I share the tif file with you?
I share some screenshots and echo lines:
PRIOR TO EXTRACT BY MASK (SOURCE RASTER)
Get raster properties shows:
MINIMUM: -107dem_EU8.tifMAXIMUM: 5112dem_EU8.tifMEAN: 701.50966808932dem_EU8.tifSTD: 613.36991449625dem_EU8.tifALLNODATA: 1dem_EU8.tifANYNODATA: 0dem_EU8.tifUNIQUEVALUECOUNT: 5209dem_EU8.tif
AFTER PROCESSING, EXAMINING WITH GET RASTER PROPERTIES:
MINIMUM: 0slope_cr.tifMAXIMUM: 81.714889526367slope_cr.tifMEAN: 7.7882586697231slope_cr.tifSTD: 7.6317294646923slope_cr.tifALLNODATA: 1slope_cr.tifANYNODATA: 0slope_cr.tifUNIQUEVALUECOUNT: ERROR 000864: Property type: The input is not within the defined domain.
MINIMUM: 0slope_fr.tifMAXIMUM: 87.347358703613slope_fr.tifMEAN: 6.697570111711slope_fr.tifSTD: 8.029112308876slope_fr.tifALLNODATA: 1slope_fr.tifANYNODATA: 0slope_fr.tifUNIQUEVALUECOUNT: ERROR 000864: Property type: The input is not within the defined domain.
MINIMUM: 0slope_gr.tifMAXIMUM: 86.183372497559slope_gr.tifMEAN: 13.185961209459slope_gr.tifSTD: 10.142107658809slope_gr.tifALLNODATA: 1slope_gr.tifANYNODATA: 0slope_gr.tifUNIQUEVALUECOUNT: ERROR 000864: Property type: The input is not within the defined domain.
MINIMUM: 0slope_it.tifMAXIMUM: 88.314254760742slope_it.tifMEAN: 12.155243931512slope_it.tifSTD: 11.308642649386slope_it.tifALLNODATA: 1slope_it.tifANYNODATA: 0slope_it.tifUNIQUEVALUECOUNT: ERROR 000864: Property type: The input is not within the defined domain.
MINIMUM: 0slope_pt.tifMAXIMUM: 86.680160522461slope_pt.tifMEAN: 7.9297302374002slope_pt.tifSTD: 6.9735340036504slope_pt.tifALLNODATA: 1slope_pt.tifANYNODATA: 0slope_pt.tifUNIQUEVALUECOUNT: ERROR 000864: Property type: The input is not within the defined domain.ERROR 000800: The value is not a member of MAXIMUM | MINIMUM | MEAN | STD | TOP | LEFT | RIGHT | BOTTOM | CELLSIZEX | CELLSIZEY | VALUETYPE | COLUMNCOUNT | ROWCOUNT | BANDCOUNT | ALLNODATA | ANYNODATA | SENSORNAME | PRODUCTNAME | ACQUISITIONDATE | SOURCETYPE | CLOUDCOVER | SUNAZIMUTH | SUNELEVATION | SENSORAZIMUTH | SENSORELEVATION | OFFNADIR | WAVELENGTH.slope_pt.tif baaadMINIMUM: 0slope_sl.tifMAXIMUM: 83.555519104004slope_sl.tifMEAN: 13.833553877048slope_sl.tifSTD: 10.842502128808slope_sl.tifALLNODATA: 0slope_sl.tifANYNODATA: 1slope_sl.tifUNIQUEVALUECOUNT: ERROR 000864: Property type: The input is not within the defined domain.
Any insight?
Thank you
Eva
El jue., jul. 26, 2018 a 22:00, Xander Bakker<geonet@esri.com> escribió:
https://community.esri.com/servlet/JiveServlet/downloadImage/2-787828-415222/300-156/pastedImage_1.png
https://community.esri.com/servlet/JiveServlet/downloadImage/2-787828-415259/360-154/pastedImage_1.png
Hi Eva Sevillano ,
From the screenshot I notice that you have a Digital Elevation Model in TIF format which uncompressed is over 28GB. That might be a "little" big to attach to the thread, since 50MB is the limit. Due to the size there might be problems with the statistics not being calculated correctly. You could try and force calculating the statistics using Calculate Statistics—Help | ArcGIS Desktop and see if the results change. As an alternative you could extract a window of your data and send that instead of the entire raster (possibly after extracting due to the reduced size the problem may not occur).
I subset the raster into a 17Mb one.
Running the tool with this one it is ok:
MINIMUM: 0 MAXIMUM: 65.707992553711MEAN: 9.1686641569023STD: 6.9617968344174ALLNODATA: 0ANYNODATA: 1
In the big one(s), calculating statistics throws the same results: same statistics as the getrasterproperties.
So it's only the allnodata = 1 that wonders me.
Is there anything I can change in the big(s) ones before running other processes like spatial join or merge that throw empty feature error because I don't know exactly why (but was the reason of my checking on the allnodata property)?
Thanks a lot for your suggestions and support (waiting for the ESRI support feedback).
Keep on trying to figure out and processing!
Eva Sevillano Marco
C/Castillo sn 42108 Dévanos (Soria) Spain
Posdoutorado Engenharia Florestal FURBIFFSC Inventário Florístico Florestal de Santa CatarinaMonitoramento com Sensoriamento Remoto
Campus 2. Fundação Universidade Regional de BlumenauRua São Paulo, 3250 Itoupava Seca 89030-000 Blumenau SC Brasil
34 666 02 87 6755 47 9741 5794 https://es.linkedin.com/in/eva-sevillano-marco-0813872b
En viernes, 27 de julio de 2018 14:31:45 CEST, Xander Bakker <geonet@esri.com> escribió:
#yiv8715547539 * #yiv8715547539 a #yiv8715547539 body {font-family:Helvetica, Arial, sans-serif;}#yiv8715547539 #yiv8715547539 h1, #yiv8715547539 h2, #yiv8715547539 h3, #yiv8715547539 h4, #yiv8715547539 h5, #yiv8715547539 h6, #yiv8715547539 p, #yiv8715547539 hr {}#yiv8715547539 .yiv8715547539button td {}
From what you describe it looks like something is not being processed correctly and the resulting ALLNODATA value is incorrect. There are different alternatives you could follow:
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.