Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image_count() did not work with sentinel-1 image collection #1209

Closed
singhamninder opened this issue Aug 12, 2022 · 4 comments
Closed

image_count() did not work with sentinel-1 image collection #1209

singhamninder opened this issue Aug 12, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@singhamninder
Copy link

Environment Information

  • geemap version: 0.16.4
  • Python version:3.9.10
  • Operating System: M1 pro Macbook

Description

I am trying to use the very handy geemap.image_count() function, which seems to work in other cases except for COPERNICUS/S1_GRD ImageCollection.

Here is the code that I used

image_count = geemap.image_count(ee.ImageCollection('COPERNICUS/S1_GRD'),
                    region = conUS, start_date='2019-01-01', end_date='2019-06-01', clip=True)

image

However, it does work if I use the Angle band for Sentinel-1 imagery as follows:

collection = ee.ImageCollection('COPERNICUS/S1_GRD') \
                .filterBounds(conUS)
image_count = collection.select([collection.first().bandNames().get(2)]) \
                .reduce(ee.Reducer.count()) \
                .clip(conUS)

I am not sure why that is. Perhaps some adjustments are needed to the image_count() to account for this :)

@singhamninder singhamninder added the bug Something isn't working label Aug 12, 2022
@giswqs
Copy link
Member

giswqs commented Aug 12, 2022

That probably means that not all images in the collection have the same bands. You should just select one single band that exists in all images.

@karelvancamp
Copy link
Contributor

Use 'VV' for land.

@karelvancamp
Copy link
Contributor

karelvancamp commented Aug 13, 2022

There is a function available that allows for filtering of bands on sentinel 1.

Created some time ago due to the unique nature of this specifc dataset (not all bands are available in every picture: based on band selection, one has first to apply specific filters on image properties before being able to select from subsets where band is always available).

from geemap import timelapse
import geemap

counts = image_count(timelapse.sentinel1_filtering(ee.ImageCollection('COPERNICUS/S1_GRD'), band='VV'),
                    region = None, start_date='2019-01-01', end_date='2022-06-01')

Map.addLayer(counts, {'min':100, 'max': 800, 'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']},
             'image count')

Map.centerObject(roi)

giswqs added a commit that referenced this issue Aug 14, 2022
@giswqs
Copy link
Member

giswqs commented Aug 14, 2022

I have added a band parameter for the image_count() function. Update the package using geemap.update_package() and restart the kernel to take effect.

import ee
import geemap

Map = geemap.Map()
region = ee.Geometry.BBox(-126.2988, 27.0591, -70.8398, 50.1769)
collection = ee.ImageCollection('COPERNICUS/S1_GRD')
image = geemap.image_count(collection, region=region, band='VV', clip=True)
vis = {'min':100, 'max': 800, 'palette': 'coolwarm'}
Map.addLayer(image, vis,'image count')
Map.add_colorbar(vis)
Map.centerObject(region)
Map

image

@giswqs giswqs closed this as completed Aug 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants