"ExecuteError: Failed because no statistics are available"... Is there any posibility to ask python first, if there is a statistic available, or if there are values unequal to NoData?

480
4
12-09-2017 03:36 PM
RebeccaRicker
New Contributor II

Hey Folks,

(I work with ArgGIS Pro and Python)

I need help with a Problem. I have Crop-Raster-Data (relatet to different clima szenaries) and a Köppen-Geiger-Raster. I want to use the Köppen-Geiger-Raster as a mask to get the the crop-informations per climate class. But now there is my problem. I dont know where my crop exactely is and how it moves. I tryed to mask with every climate class and get its statistics. But when I have no crop in a climate class, my whole raster layer is a NoData Layer and my script dosn't work "ExecuteError: Failed because no statistics are available". So I wanted to know, if there is any posibility to ask python first, if there is a statistic available, or if there are values unequal to NoData.
Thank YOU!

0 Kudos
4 Replies
DanPatterson_Retired
MVP Esteemed Contributor

Best would be to get the raster properties and query whether for AllNoData

Get Raster Properties....

property_type
(Optional)
  • ANYNODATA —Returns whether there is NoData in the raster.
  • ALLNODATA —Returns whether all the pixels are NoData. This is the same as ISNULL.

ie  etRasterProperties_management (in_raster, {property_type}, {band_index})

RebeccaRicker
New Contributor II

Thank you again. I tried it once, but it seemed not to work. Maybe i was because of this strange issue my pc had....

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

seemed not to work???

did you get an error message?

If the whole raster is nodata, then you can skip what you were going to do if that was your intent since the statistics wouldn't be needed anyway.

maybe I have misread your question

0 Kudos
MiraAnand
New Contributor

Many years later, but did you ever figure out how to make ALLNODATA work?

0 Kudos