Export Sentinel 2 images after 6S correction in Google Drive

673 views
Skip to first unread message

ion sola

unread,
Aug 9, 2017, 10:20:25 AM8/9/17
to Py6S
Sorry I am new in Python and I am getting crazy now to export the Py6S corrected images in Google Drive. I was running the script of https://github.com/samsammurphy/gee-atmcorr-S2 in Jupyter Notebook, with no problems, but later I added new code to export images in Google Drive, now the notebook shows an error: 


ModuleNotFoundError: No module named 'sixs_emulator_ee_sentinel2_batch'

I have downloaded as a zip all the files of https://github.com/samsammurphy/gee-atmcorr-S2, including sixs_emulator_ee_sentinel2_batch.py, but no idea why the script is unable to find it. This is the code I entered in the command prompt:


pip install --upgrade https://github.com/ipython-contrib/IPython-notebook-extensions/archive/master.zip --user

git clone git://github.com/jupyter/jupyter-drive.git

pip install -e jupyter-drive

python -m jupyterdrive

ipython profile create nbserver

ipython notebook --profile=nbserver

¿Any idea or suggestion? I would like to correct a collection of Sentinel-2 images and export them in Google Drive. I think I am getting closer, but my programming skills are not so good. Thank you in advance!
error.JPG

Sam Murphy

unread,
Aug 10, 2017, 5:07:45 AM8/10/17
to Py6S
Hi Ion,

I would suggest going with Py6S, it is more accurate, more flexible and generally just the better option:

https://github.com/samsammurphy/gee-atmcorr-S2.git

The module that is missing is from a different repository:

https://github.com/samsammurphy/gee-atmcorr-S2-6SE

They have misleading similar names, my bad. If you want to use the emulator (e.g. for long time series analysis) I would suggest this repo:

https://github.com/samsammurphy/ee-atmcorr-timeseries

(This one does almost everything in the cloud but it does download surface reflectance to excel.. I will be adding the functionality to inspect images as soon as I can)

Best,
Sam




ion sola

unread,
Aug 11, 2017, 7:21:27 AM8/11/17
to Py6S
Hi Sam,

Thank you for your reply. I have solved the problems and I can run with no errors all your scripts. The main goal of my research work is to compare atmospheric correction of several Sentinel-2 images, but I would like to export the images with all the bands at native resolution, not only display RGB compositions. To the best of my knowledge the only option is to Export them to Google Drive (or Google Cloud, with fees), but Export is not recognized. I tried to install Jupyter Drive for that purpose and Jupyter Notebook didn't work anymore so I had to reinstall Anaconda again. ¿Any ideas? 

Thank you again

Sam Murphy

unread,
Aug 11, 2017, 4:08:25 PM8/11/17
to Py6S
Hi Ion,

There is an example of how to export at the end of the Jupyter notebook (will need to uncomment the code).

This will export to an earth engine asset. If you want to download the file then the last cell should look something like this..

# export
export = ee.batch.Export.image.toDrive(\
    image=ref,
    description='sentinel2_atmcorr_export',
    region = region,
    scale = 30)

# uncomment to run the export
export.start()

Yask Shelat

unread,
Feb 8, 2018, 6:21:21 PM2/8/18
to Py6S
Hi Sam
I am trying to run your py3 environment available here, 

I can load the Jupiter notebook, but I get an error while doing atmospheric correction of sentinel 2 data.
I have attached snapshot of that.
Can you please help me here?

What if I just want to correct a single image?

regards
Yask
Screenshot at Feb 08 18-17-45.png

Yask Shelat

unread,
Feb 8, 2018, 8:22:10 PM2/8/18
to Py6S
Hi Sam
I have used your another repo as follows

it works and corrects data

I have defined area as follows

geom = ee.Geometry.Point(-69.7247314453125,58.799961026925025)

In the end, I want to export my atmospherically correct dataset.

I put following code but get lots of error messages

# export
export = ee.batch.Export.image.toDrive(\
    image=DF,
    description='sentinel2_atmcorr_export',
    region = geom, scale =30)

# uncomment to run the export
export.start()

I get error message as attached in a snapshot
I have changed image = DF as I believe DF stores image output and region =geom as thats storing the point of my interest.

Thanks
Yask
Screenshot at Feb 08 20-20-36.png

Sam Murphy

unread,
Feb 11, 2018, 3:45:24 PM2/11/18
to Py6S
Hi Yask,

To atmospherically correct a small number of images it would probably be better to use Py6S directly, such as in this example which runs 6S FORTRAN code in the background using a docker container.

I would only recommend ee-atmcorr-timeseries if you want to correct a large number of images (e.g. 100s or more). It downloads then interpolates lookup tables, which takes a while. I have updated the instructions and usage in the readme to use Docker here also. Hopefully that fixes things.

(apologies about the mosaic repo, that was experimental)

Best,
Sam


Yask Shelat

unread,
Feb 12, 2018, 9:00:27 PM2/12/18
to Py6S
Hi Sam
Thanks for your reply.
I think I have a problem running Jupiter notebook

I am unable to run the notebook when I give the last command.

Can you please look at the attached snapshot.


I have installed Jupiter notebook in my MacBook outside of docker container. Do you think that is the reason for not opening a browser while running the last command as showed in the snapshot?


I am new to docker and Jupiter, can you please help me out here? 

Thanks

Yask

Reply all
Reply to author
Forward
0 new messages