Cannot run acolite with Planetscope

Technical questions about ACOLITE
ioannism
Posts: 19
Joined: Mon Oct 23, 2017 9:36 am

Re: Cannot run acolite with Planetscope

Post by ioannism »

Thank you for your answer. I have donwloaded again the zip file from https://github.com/acolite/acolite_mr and now it works.

However the output file with the surface reflectances doesn t have any values.

Is the mentioned result because of using the default configurations in respect to the atmospheric correction?
If i want to change the input parameters in which file/part of the code should i do ?
Is there any documentation for the code so i can understand how the different functions work (beside the papers mentioned in the site of acolite) and what is the order they are performed ?

Thank you in advance.
quinten
Posts: 1001
Joined: Tue Mar 03, 2015 8:13 am

Re: Cannot run acolite with Planetscope

Post by quinten »

Strange! Could you send me by email the file you are trying to process?

*Edit: There seems to be another bug in the LUT interpolation - hold on!*

Quinten
quinten
Posts: 1001
Joined: Tue Mar 03, 2015 8:13 am

Re: Cannot run acolite with Planetscope

Post by quinten »

The pressure was set to "None" in the previous version, which made the LUT return NaN values - hence the empty outputs.

New commit should fix it.

Quinten
ioannism
Posts: 19
Joined: Mon Oct 23, 2017 9:36 am

Re: Cannot run acolite with Planetscope

Post by ioannism »

Now i get some values at the surface reflectances. Thank you Quinten.

If i want to change the input parameters in which file/part of the code should i do ?
Is there any documentation for the code so i can understand how the different functions work (beside the papers mentioned in the site of acolite) and what is the order they are performed ?

And one more question.

Should the netcdf files with the surface reflectances be georeferenced?

Thank you again for your help.
quinten
Posts: 1001
Joined: Tue Mar 03, 2015 8:13 am

Re: Cannot run acolite with Planetscope

Post by quinten »

The NetCDF outputs should contain lat and lon for each pixel, and also some projection information in the header.

As for the input parameters, there is not a whole lot that can be changed, and I would not recommend changing anything that is not available in the options given by

Code: Select all

python acolite_mr.py --help
You could import the acolite code (as is done in an example here) and directly run ac.planetscope.planetscope_ac with some other options. The DSF is however designed with good performance in mind with the default settings.

The steps followed in planetscope_ac.py (with some light commenting there):
  • find ancillary data (starting around line 181)
  • get darkest pixels in each band (line 258)
  • fit aerosol model to dark spectrum (line 298)
  • perform atmospheric correction and generate output product (line 380)
  • additionally the RGB images are generated (line 425)
Quinten
mariamabdel
Posts: 21
Joined: Tue Sep 17, 2019 6:48 pm

Re: Cannot run acolite with Planetscope

Post by mariamabdel »

Hi Quinten,

I am having a similar issue:

Launching ACOLITE MR processing.
{'data_dir': './data', 'pp_data_dir': './data/PP', 'hgt_dir': '/Users/mariama/acolite_mr/data/SRTMGL3.003', 'met_dir': '/Users/mariama/acolite_mr/data/MET'}
Processing planet file
{'platform': 'PlanetScope', 'platform_id': '1067', 'orbit': 'DESCENDING', 'SATELLITE_ID': '0f', 'SATELLITE_SENSOR': 'PlanetScope_1067', 'LUT_SENSOR': 'PlanetScope_0f', 'SENSOR': 'PlanetScope', 'SATELLITE_PREFIX': 'ps', 'BANDS_REDNIR': ['Red', 'NIR'], 'BANDS_VIS': ['Blue', 'Green', 'Red'], 'BANDS_NIR': ['NIR'], 'BANDS_BESTFIT': ['Red', 'NIR'], 'BANDS_ALL': ['Blue', 'Green', 'Red', 'NIR'], 'ViewingIncidence': 5.414565, 'SunAzimuth': 82.39725, 'SunElevation': 77.8902, 'ViewingAzimuth': -11.10207, 'ViewZenith': 5.003297, 'isotime': '2019-05-14T17:00:18+00:00', 'THS': 12.109800000000007, 'PHIS': 82.39725, 'THV': 5.003297, 'PHIV': -11.10207, 'AZI': 93.49932, 'TIME': datetime.datetime(2019, 5, 14, 17, 0, 18, tzinfo=tzutc()), 'DOY': '134', 'SE_DISTANCE': 1.0105998718370781, 'isodate': '2019-05-14T17:00:18Z', 'Blue-band_idx': 1.0, 'Blue-to_radiance': 0.01, 'Blue-to_reflectance': 1.66348209481e-05, 'Blue-band_name': 'Blue', 'Blue-f0': 193.37914197888583, 'Blue-wave': 0.5060126205500656, 'Blue-wave_name': '506', 'Green-band_idx': 2.0, 'Green-to_radiance': 0.01, 'Green-to_reflectance': 1.81214874238e-05, 'Green-band_name': 'Green', 'Green-f0': 183.74534255600653, 'Green-wave': 0.545921284857042, 'Green-wave_name': '545', 'Red-band_idx': 3.0, 'Red-to_radiance': 0.01, 'Red-to_reflectance': 2.18290640117e-05, 'Red-band_name': 'Red', 'Red-f0': 164.49236602843527, 'Red-wave': 0.6245023746701848, 'Red-wave_name': '624', 'NIR-band_idx': 4.0, 'NIR-to_radiance': 0.01, 'NIR-to_reflectance': 3.43599683544e-05, 'NIR-band_name': 'NIR', 'NIR-f0': 109.98008200845207, 'NIR-wave': 0.8094659145463275, 'NIR-wave_name': '809', 'epsg': '32616', 'datum': 'WGS_1984', 'projection': 'WGS 84 / UTM zone 16N', 'zone': '16', 'nrow': '7312', 'ncol': '9673', 'nband': '4', 'resolution_row': '3.0', 'resolution_col': '3.0', 'resolution': (3.0, 3.0), 'dims': (9673, 7312), 'UL_LATITUDE': 17.6432737127, 'UL_LONGITUDE': -88.4008317195, 'UR_LATITUDE': 17.6432737127, 'UR_LONGITUDE': -88.1267525629, 'LR_LATITUDE': 17.4437201791, 'LR_LONGITUDE': -88.1267525629, 'LL_LATITUDE': 17.4437201791, 'LL_LONGITUDE': -88.4008317195, 'image_file': '/Users/mariama/Downloads/Belize_5_14_19_PSS4_analytic_PSScene4Band_Explorer/files/PSScene4Band/20190514_170018_92_1067/analytic_udm2/20190514_170018_92_1067_3B_AnalyticMS.tif'}
rhot_506
PlanetScope_1067
Failed to write attribute: TIME
rhot_545
PlanetScope_1067
rhot_624
PlanetScope_1067
rhot_809
PlanetScope_1067
{'Blue': {'rhod': 0.18479502232761816, 'wave': 506.01262055006555, 'tt_gas': 0.9777116993348577, 'raa': 93.49932, 'vza': 5.003297, 'sza': 12.109800000000007}, 'Green': {'rhod': 0.15672055020879685, 'wave': 545.9212848570421, 'tt_gas': 0.9513562728060387, 'raa': 93.49932, 'vza': 5.003297, 'sza': 12.109800000000007}, 'Red': {'rhod': 0.12360907629385795, 'wave': 624.5023746701847, 'tt_gas': 0.9380383533753959, 'raa': 93.49932, 'vza': 5.003297, 'sza': 12.109800000000007}, 'NIR': {'rhod': 0.10941992197495368, 'wave': 809.4659145463276, 'tt_gas': 0.9528886358182631, 'raa': 93.49932, 'vza': 5.003297, 'sza': 12.109800000000007}}
Traceback (most recent call last):
File "acolite_mr.py", line 114, in <module>
run_acolite_mr()
File "acolite_mr.py", line 110, in run_acolite_mr
dark_spectrum_full_scene=args.dark_spectrum_full_scene)
File "/Users/mariamayad/acolite_mr/acolite/acolite/acolite_mr_ac.py", line 87, in acolite_mr_ac
sky_correction=sky_correction)
File "/Users/mariama/acolite_mr/acolite/planetscope/planetscope_ac.py", line 299, in planetscope_ac
lutd = aco.aerlut.import_luts(base_luts=luts)
File "/Users/mariama/acolite_mr/acolite/aerlut/import_luts.py", line 16, in import_luts
lut_data, lut_meta = ac.aerlut.import_lut(lutid,lutdir, override=0)
File "/Users/mariama/acolite_mr/acolite/aerlut/import_lut.py", line 130, in import_lut
return lut, meta
UnboundLocalError: local variable 'lut' referenced before assignment

Any help is appreciated, thank you!

Mariam
quinten
Posts: 1001
Joined: Tue Mar 03, 2015 8:13 am

Re: Cannot run acolite with Planetscope

Post by quinten »

Hi Mariam

Do you have the Python NetCDF4 library installed?

Quinten
mariamabdel
Posts: 21
Joined: Tue Sep 17, 2019 6:48 pm

Re: Cannot run acolite with Planetscope

Post by mariamabdel »

Hi Quinten,

Yes, I also double-checked that I have all the packages installed. I am still getting the same error.

Mariam
mariamabdel
Posts: 21
Joined: Tue Sep 17, 2019 6:48 pm

Re: Cannot run acolite with Planetscope

Post by mariamabdel »

Nevermind, I just had to reinstall everything and now it works! Thank you.
quinten
Posts: 1001
Joined: Tue Mar 03, 2015 8:13 am

Re: Cannot run acolite with Planetscope

Post by quinten »

Thanks for the feedback Mariam!

I did change something in the code related to the LUTs earlier this week. I'm happy it works for you now!

Quinten
Post Reply