0

I am interested in removing cloud in https://code.earthengine.google.com/d9aaa276f0fa1ab33e78230e8f348c6f. I try to export specific multiband to GDrive in GEE. I try to write the sintax :

Export.image.toDrive({
   image: s2_sr_median,
   description: 'image_export',
   folder: 'ee_demos',
   region: region,
   scale: 10,
   crs: 'EPSG:4326'
   });

But, the result all band will be exported. So, how to export specific multiband, for example band 2,3,4, and band 8. I have try this sintax, but not successfull. There is a message : Line 123: Unexpected arguments to function toDrive(): band.

Export.image.toDrive({
   image: s2_sr_median,
   description: 'image_export',
   folder: 'ee_demos',
   band: ['B2', 'B3', 'B4', 'B8'],
   region: region,
   scale: 10,
   crs: 'EPSG:4326'
   });

So, how is the solution ?

1 Answer 1

2

You can select() the bands after doing the median(). You can do it in two ways. Either you can use the index of the bands starting from 0.

var s2_sr_median = (s2_sr_cld_col.map(add_cld_shdw_mask)
                             .map(apply_cld_shdw_mask)
                             .median()).select([1,2,3,7])

Or, if you do not want to go with the index, you can use the expression with band names. When the sequence breaks, put | between the band names.

var s2_sr_median = (s2_sr_cld_col.map(add_cld_shdw_mask)
                             .map(apply_cld_shdw_mask)
                             .median()).select('B[2-4]|B8')
1
  • thank you. it is work Aug 7, 2023 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.