Page 2 of 3

Re: Error module 'acolite.aerlut' has no attribute 'interp2d' for WorldView

Posted: Tue May 19, 2020 10:04 am
by hnthang
Oh, I don't know this issue. Thank you for your update. The image is not regrading the lake but the mountainous forest.

We are happy with the current version of ACOLITE_MR which work well for PlanetScope (coastal area scene). We look forward to see your update to extend the processing of the acolite.

To the best,
Thang

Re: Error module 'acolite.aerlut' has no attribute 'interp2d' for WorldView

Posted: Tue May 19, 2020 10:54 am
by quinten
Hi Thang

I have made some edits to the GitHub code, you can now specify the elevation of the scene in meters using the --elevation argument. Please let me know if it works!

Quinten

Re: Error module 'acolite.aerlut' has no attribute 'interp2d' for WorldView

Posted: Tue May 19, 2020 11:32 am
by hnthang
Hi Quinten,

Thank you for the update. I added the argument --elevation 2330 in the syntax. It is, however still be in NAN values of rhos image. Please have a look at the attached image.

Thang

Re: Error module 'acolite.aerlut' has no attribute 'interp2d' for WorldView

Posted: Tue May 19, 2020 12:33 pm
by quinten
Hi Thang

Since you are processing for a forest, could you set --sky_correction False when processing?

Could you post the NetCDF header of the output file? (e.g. using ncdump -h) Perhaps some NaN value sneaked into the attributes.

Quinten

Re: Error module 'acolite.aerlut' has no attribute 'interp2d' for WorldView

Posted: Tue May 19, 2020 11:34 pm
by hnthang
Hi Quinten,

I tried with various options setting to True/False but still received a NAN rhos image.

Code: Select all

python acolite_mr.py --input /.../010217881010_01_P002_MUL/data --output /.../010217881010_01_P002_MUL/ac_wv 
--elevation 2330 
--sky_correction False 
--dark_spectrum_full_scene False 
--fixed_model 3
I looked at the acolite option but can not find the option to export NetCDF header. So here is some information regarding the metadata of the netCDF in SNAP.

Code: Select all

product_type	NetCDF	ascii			
metadata_version	0.5	ascii			
metadata_profile	beam	ascii			
generated_on	2020-05-20 11:14:57 NZST	ascii			
generated_by	ACOLITE	ascii			
contact	Quinten Vanhellemont	ascii			
auto_grouping	rhot:rhorc:rhos:rhow:Rrs:rhog:rhoe:rhose	ascii			
_NCProperties	version=2,netcdf=4.7.4,hdf5=1.10.6	ascii		

Code: Select all

rhot_428
Name/Value/Type 					
wavelength	428.43528418761036	float64			
tt_gas	0.9988934556240597	float64			
rsky	0	int64			
wave	428.43528418761053	float64			
tt_h2o	0.9999805023701356	float64			
tt_o3	0.9989196292047408	float64			
tt_o2	0.9999932058886708	float64			
romix	NaN	float64			
dtott	0.8795406291653105	float64			
utott	0.9017144680803726	float64			
astot	0.154597050798826	float64			
I see the value of romix is NAN. Does it mean anything?

Re: Error module 'acolite.aerlut' has no attribute 'interp2d' for WorldView

Posted: Wed May 20, 2020 6:34 am
by quinten
Hi Thang

That is indeed the problem, I assume something goes wrong with the interpolation of the LUT or resampling to the satellite bands. (Strange, as the other parameters are not affected!)

Could you add the following line in acolite/worldview/worldview_ac.py after line 193 (in the loop): print(par, press, ip, raa, vza, sza, res['taua'], ac_pars[par], ret), and post the output?

So you would get for lines 188-195:

Code: Select all

    for ip, par in enumerate(pars):
        ip = [i for i,value in enumerate(res['lut_meta']['par']) if value == par]
        if len(ip) == 1: ip = ip[0]
        else: continue
        ret = rgi((press, ip, res['lut_meta']['wave'], raa, vza, sza, res['taua']))
        ac_pars[par] = ac.shared.rsr_convolute_dict(res['lut_meta']['wave'], ret, rsr)
        print(par, press, ip, raa, vza, sza, res['taua'], ac_pars[par], ret)
        ret = None
Quinten

Re: Error module 'acolite.aerlut' has no attribute 'interp2d' for WorldView

Posted: Wed May 20, 2020 8:48 am
by hnthang
Hi Quinten,

Please have a look at the output after add the line of printing:

Code: Select all

Launching ACOLITE MR processing.
Processing worldview file
Computed 768.68 hPa pressure for 2330.00 m elevation
2020-05-20T20:41:05 - Started processing /.../010217881010_01_P002_MUL/data
2020-05-20T20:41:15 - Imported LUTs
PONDER-LUT-201704-MOD1 0.001 0.027813890279335927 0 4
PONDER-LUT-201704-MOD2 0.001 0.02782633687705268 0 4
2020-05-20T20:41:56 - Fitted model C, band pair COASTAL:RED, taua 550: 0.001
romix 768.6820247121411 18 23.5 14.799999999999997 39.9 0.001 {'COASTAL': nan, 'BLUE': nan, 'GREEN': nan, 'YELLOW': nan, 'RED': nan, 'REDEDGE': nan, 'NIR1': nan, 'NIR2': nan, 'PAN': nan} [0.13571584 0.1120612  0.08466015 0.06495665 0.04660494 0.03422517
 0.02238798 0.01524618 0.00962373 0.00539797 0.00258182 0.00127688
 0.00052677 0.00045362 0.00040202        nan        nan        nan]
dtott 768.6820247121411 14 23.5 14.799999999999997 39.9 0.001 {'COASTAL': 0.8795406291653105, 'BLUE': 0.9200104527610543, 'GREEN': 0.9509455807491506, 'YELLOW': 0.9670119457650715, 'RED': 0.9757630173937518, 'REDEDGE': 0.9829027559319875, 'NIR1': 0.9894124768199418, 'NIR2': 0.9925178556248958, 'PAN': 0.9674351916529973} [0.83215996 0.8615518  0.89238089 0.91594497 0.93803709 0.95273828
 0.96785977 0.97775583 0.98541144 0.99147319 0.99463599 0.99766574
 0.99887654 0.9989908  0.99907507 0.99947498 0.99959002 0.99963142]
utott 768.6820247121411 13 23.5 14.799999999999997 39.9 0.001 {'COASTAL': 0.9017144680803726, 'BLUE': 0.9353510062292266, 'GREEN': 0.9606325739463969, 'YELLOW': 0.9736220009999974, 'RED': 0.9806578070547531, 'REDEDGE': 0.9863775518036727, 'NIR1': 0.9915763110656352, 'NIR2': 0.9940506322048424, 'PAN': 0.9738905613884904} [0.86155868 0.88667298 0.91252082 0.93204737 0.95015776 0.9620976
 0.97430953 0.98225977 0.98838472 0.99322028 0.99573724 0.9981465
 0.99910808 0.99919886 0.99926562 0.99958359 0.99967541 0.99970864]
astot 768.6820247121411 16 23.5 14.799999999999997 39.9 0.001 {'COASTAL': 0.154597050798826, 'BLUE': 0.10684723877568178, 'GREEN': 0.06667599435149271, 'YELLOW': 0.044953549877869634, 'RED': 0.03338471148932966, 'REDEDGE': 0.023530831395787866, 'NIR1': 0.014345833349977674, 'NIR2': 0.009500233260204367, 'PAN': 0.044274565578657596} [2.04727667e-01 1.75839560e-01 1.39920173e-01 1.12196867e-01
 8.45025949e-02 6.41049105e-02 4.37955526e-02 3.07956576e-02
 1.99906391e-02 1.14748847e-02 5.53346013e-03 2.75812292e-03
 1.13201897e-03 9.72575696e-04 8.60644737e-04 2.86069836e-04
 1.98281629e-04 1.55059846e-04]
2020-05-20T20:41:56 - Writing lat/lon
Processing tile R1C1 [0, 0]
Processing tile R2C1 [0, 4096]
Processing tile R3C1 [0, 8192]
2020-05-20T20:42:39 - Finished writing /.../010217881010_01_P002_MUL/ac_wv/WorldView2_2012_07_11_15_34_18_P002_L2R.nc

Re: Error module 'acolite.aerlut' has no attribute 'interp2d' for WorldView

Posted: Wed May 20, 2020 9:20 am
by quinten
Hi Thang

I think you can solve this by adding another line after the rgi call: ret = [r if np.isfinite(r) else 0.0 for r in ret]

Code: Select all

for ip, par in enumerate(pars):
        ip = [i for i,value in enumerate(res['lut_meta']['par']) if value == par]
        if len(ip) == 1: ip = ip[0]
        else: continue
        ret = rgi((press, ip, res['lut_meta']['wave'], raa, vza, sza, res['taua']))
        ret = [r if np.isfinite(r) else 0.0 for r in ret] ## set to zero if NaNs are retrieved
        ac_pars[par] = ac.shared.rsr_convolute_dict(res['lut_meta']['wave'], ret, rsr)
        print(par, press, ip, raa, vza, sza, res['taua'], ac_pars[par], ret)
        ret = None
I'm curious to see the results, as there still could be an issue with the determination of the aerosol optical depth (taua is set to 0.001 here). If you could also print out the rhod dictionary, I would be interested to see that as well!

Quinten

Re: Error module 'acolite.aerlut' has no attribute 'interp2d' for WorldView

Posted: Wed May 20, 2020 10:00 am
by hnthang
Hi Quinten,

Thank you very much for your debug. It worked now but remain some minus values of rhos bands (rhos_minus). Please attached images. I also consider that there is not much different between rhot and rhos corrected images (full and subset scenes) despite a change in histogram (histogram of band 428).

How can I print out the rhod dictionary?

Re: Error module 'acolite.aerlut' has no attribute 'interp2d' for WorldView

Posted: Wed May 20, 2020 10:01 am
by hnthang
Sorry, 2 images can not attached due to their size.