Reducing PlanetScope resolution or running in parallel

Technical questions about ACOLITE
Post Reply
rmant
Posts: 11
Joined: Mon Aug 07, 2023 5:06 pm

Reducing PlanetScope resolution or running in parallel

Post by rmant »

Hi, I need to process a pretty big area (~1200 sqkm). I already cut out as much of the scene as I can, leaving only the polygon of water pixels, but it's still pretty big.

I've run into a couple of memory issues so I set the "slicing=True" parameter, which helped a little bit. But I'm curious if there's any way of reducing the Planetscope from 3m to 6m to improve memory usage and space. I know that for Sentinel-2 there's a "s2_target_res" parameter, but that doesn't seem to work for Planet data.

Other alternative would be to do some kind of parallel processing, where the scene is dividede in chunks and merged after atmospheric correction. I'm curious if ACOLITE currently supports a functionality like that.

Thank you!
rmant
Posts: 11
Joined: Mon Aug 07, 2023 5:06 pm

Re: Reducing PlanetScope resolution or running in parallel

Post by rmant »

As a follow-up question; is there any way of avoiding writing rhot_* values to the l2r file? This would save some storage space as well.
quinten
Posts: 1012
Joined: Tue Mar 03, 2015 8:13 am

Re: Reducing PlanetScope resolution or running in parallel

Post by quinten »

Hi Raimundo

At the moment there is no way of binning pixels for any sensor other than Sentinel-2 within ACOLITE. It may be possible to resample the TIF file before processing using an external script/program, and make a custom bundle replacing the TIF with the one generated at your chosen resolution. You could also use the reproject before atmospheric correction option within ACOLITE, but this may be difficult to configure to get your intended behaviour.

The copying of datasets from L1R to L2R is determined by the copy_datasets setting, which by default is set to:

Code: Select all

copy_datasets=lon,lat,rhot_*
Removing the rhot_* will exclude those datasets in the L2R file.

I hope this helps!

Quinten
rmant
Posts: 11
Joined: Mon Aug 07, 2023 5:06 pm

Re: Reducing PlanetScope resolution or running in parallel

Post by rmant »

Thank you for the answer. And is there any way to compute only the surface reflectance for some bands? In particular I'm interested only in RGB + NIR + Red-edge, and avoiding computing the other 3 bands could save some memory and storage as well.

If there's any other optimization tip or parameter I could tweak, happy to receive recommendations as well. Thanks Quinten!
quinten
Posts: 1012
Joined: Tue Mar 03, 2015 8:13 am

Re: Reducing PlanetScope resolution or running in parallel

Post by quinten »

Hi Raimundo

The removal of bands may influence the results, depending on which band is being used by the DSF. That being said, you could create a custom L1R file by copying over only the bands you want, and passing the new L1R file to ACOLITE.

This can be achieved with two runs of ACOLITE. A first run with atmospheric_correction=False will generate only the L1R file. You can then create a second L1R file, e.g. using Python and ACOLITE functions:

Code: Select all

## import acolite (add it to your path first)
import acolite as ac

## path to the original L1R file
l1r = '..._L1R.nc'

## make new L1R file name
l1r_out = l1r.replace('_L1R.nc', '_L1R_edit.nc')

## read l1r info
gatts = ac.shared.nc_gatts(l1r)
datasets = ac.shared.nc_datasets(l1r)
nc_projection = ac.shared.nc_read_projection(l1r)

## datasets to skip
datasets_skip = ['rhot_444', 'rhot_533', 'rhot_612']

## copy data
new = True
for ds in datasets:
    if ds in ['transverse_mercator', 'x', 'y']: continue
    if ds in datasets_skip: continue
    d, a = ac.shared.nc_data(l1r, ds, attributes=True)
    ac.output.nc_write(l1r_out, ds, d, attributes=gatts, new=new, dataset_attributes=a, nc_projection=nc_projection)
    new = False
The newly generated L1R_edit.nc file can then be set as inputfile for the second ACOLITE run, with atmospheric_correction=True.

I hope this helps!

Quinten
Post Reply