Esri / raster-functions

A curated set of lightweight but powerful tools for on-the-fly image processing and raster analysis in ArcGIS.
Apache License 2.0
195 stars 81 forks source link

Clearification regarding "resampling" in wiki needed #85

Open simjoh opened 5 months ago

simjoh commented 5 months ago

In the documentation on the wiki page of this repo in the section updateRasterInfo() there are some information about the keyword "resampling". I've been playing a little with this parameter while trying to to get a python raster function to behave as we want. I've a few questions regarding this parameter.

  1. Should the parameter name be "Resampling" instead of "resampling"? Using kwargs['output_info']['Resampling'] = False has some effect but not kwargs['output_info']['resampling'] = False
  2. The documentation says that the default value of resampling is False but I've the experience of the opposite. I'm aware of the 'inheritProperties' and 'invalidateProperties' parameters of get configuration. But I'm not able to configure those so that False becomes the default value of 'Resampling'.
  3. In getConfiguration() i've found that adding a keword of "Resampling" or "resampling" has effect on kwargs['output_info']['Resampling'] in updateRasterInfo() . What is the effect of setting this paramter to True/False? Is it the same as changing it in

On the wiki page I also founds some information regarding selectRasters(). But I can't trigger this to run. Is it possilbe to get it to run on a single raster dataset?

shenganzhan commented 5 months ago

@simjoh please see below:

  1. The keywork is “resampling” only. It's suggested to set this property in .getConfiguration() as well as .updateRasterInfo(). As per the code, it seems like if the property is set in .getConfiguration() you don’t need to set the property in .updateRasterInfo(). It should already have the correct value. Setting the property only in .updateRasterInfo() may not work as expected. If this doesn’t work, please share your py script with us and so we can take a look.
  2. The default value is False. Probably No.1 above is affecting your workflow.
  3. Please see 1 – the resampling flag is read from the properties returned by .getConfiguration() and then passed along to .updateRasterInfo().
simjoh commented 5 months ago

@shenganzhan Thanks for your input. I've changed the code by setting resampling in getConfiguration(). But If it is suggested to set the propery in .getConfiguration() and updateRasterInfo(), then I think 'Resampling' is needed in updateRasterInfo.

Regarding default property my exceprience with the current dataset is that the default is False. Maybe it is a property of the dataset but I try to ovverride inheritence of properties by

'inheritProperties': 1,# inherit just PixelType
'invalidateProperties': 1| 2 | 4 |8,      # invalidate histogram and statistics because we are modifying pixel values

In my first post I also mentioned the method -selectRasters() how do I use that. I don't get it to run in my prf.

shenganzhan commented 5 months ago

@simjoh selectRasters works on multiple raster inputs