Using appliercontrols for more control over output in RIOS

For more control over writing files in RIOS, you can use the controls class, documented here. The basic usage is to create a ‘controls’ class and pass this to the ‘apply’ function:

from rios import applier
infiles = applier.FilenameAssociations()
infiles.inimage = 'in_image.kea'

outfiles = applier.FilenameAssociations()
outfiles.outimage = 'out_image.kea'

controls = applier.ApplierControls()
applier.apply(userFunc, infiles, outfiles, controls=controls)

Display progress

from rios import cuiprogress
controls.progress = cuiprogress.CUIProgressBar()

Set output driver and creation options

controls.setOutputDriverName("ENVI")
controls.setCreationOptions(["INTERLEAVE=BIL"])

For more information on this, see previous post. For supported creations options for each driver see http://www.gdal.org/formats_list.html.

Re-project data on-the-fly
If the data are different projections you can reproject them to a reference image using:

controls.setReferenceImage(infiles.inimage)
controls.setResampleMethod("near")

Where any of the resampling methods supported by GDAL can be used. A list is available in the gdalwarp documentation.

Set output layer as thematic

controls.setThematic(True)

Set output later names

controls.setLayerNames(['HH','VV','HV'])

Set no data value

controls.setStatsIgnore(0)

This sets the global default value to use as the null value when calculating stats.

Other
For a full list open an interactive Python session and type:

help(rios.applier.ApplierControls)

3 thoughts on “Using appliercontrols for more control over output in RIOS

  1. Cedric Lardeux

    Hi,
    Thanks for this details about RIOS.

    I am a new user of RIOS and even after reading your blog and the applier example from RIOS 1.4 documentation I have one question about how to use multiple Outputs.
    Indeed I tried to apply same things as Inputs for output based on “Arbitrary Numbers of Input (and Output) Files” using outfiles = applier.FilenameAssociations() and outfiles.imgs = MyOutputFileList but it does not work.
    I know that it’s probably not the best area to ask but I don’t find better than your post.

    Best regards

    Reply
      1. Cedric Lardeux

        Thanks for answer.
        I am working to apply temporal smoothing on time series. So I have one raster for one date and in output the same.

        Thanks for the google group.
        If not possible I will try to put one output with all date as bands but after I need to split it.

        Best

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s