Post

2 followers Follow
0
Avatar

Batch Export PCI Files

Hello,

I would like to know how I can perform a batch file export in Geomatica using python. With recent projects, I found myself having to manually export one image at a time, and I find this to be quite time-consuming.

How can I batch export all my PCI files?

TIA,
Herb.

Herbert Bergmann

Please sign in to leave a comment.

1 comment

0
Avatar

Mr. Bergmann,

You can easily do a batch export using the following code.

import os
from pci.fexport import fexport

input_dir = r'<input path>'
output_dir = r'<output path>'

for pci_file in os.listdir(input_dir):
    fexport(fili = os.path.join(input_dir,pci_file),
                filo = os.path.join(output_dir,os.path.splitext(pci_file)[0]+'.tif'),
                dbiw = [],
                dbic = [2],
                dbib = [],
                dbvs = [],
                dblut = [], 
                dbpct = [],
                ftype = "TIF",
                foptions  = "")

The block of code starts by importing the required Python and PCI modules, and then sets the input folder containing the files to export and the output folder. Afterwards the fexport Geomatica function is iteratively called for each file in the input folder.Also, the file extension is changed for the output file (filo).

HTH,
Jean.

Jean Bouffard 0 votes