gee-community / geemap

A Python package for interactive geospatial analysis and visualization with Google Earth Engine.
https://geemap.org
MIT License
3.49k stars 1.09k forks source link

Add type: majority to zonal statistics (categorical raster analysis) #960

Closed csampselle closed 2 years ago

csampselle commented 2 years ago

Feature Request to add allowed statistics type: MAJORITY to zonal statistics to facilitate summarizing categorical/discrete raster time series (especially land cover).

(Minimum and Variety would also be useful.)

Very much appreciate the Zonal Statistics by Group option and all the capabilities of geemap.

giswqs commented 2 years ago

GEE does not have a majority reducer. PR is welcome if you know how to implement it.

csampselle commented 2 years ago

I think the mode reducer would work ee.Reducer.mode Returns the most common value

giswqs commented 2 years ago

The mode reducer has been added.

statistics_type="MODE"
csampselle commented 2 years ago

Hello,

In Jupyter I tried geemap.update_package(), restarting Kernel, and running geemap.zonal_statistics(crop, habDel, out_crop_stats, statistics_type='MODE', scale=30)

and received the following error The statistics type must be one of the following: MEAN, MAXIMUM, MEDIAN, MINIMUM, STD, MIN_MAX, SUM, VARIANCE, HIST, FIXED_HIST

From: Qiusheng Wu @.> Sent: Thursday, March 3, 2022 4:30 PM To: giswqs/geemap @.> Cc: Cathleen Sampselle @.>; Author @.> Subject: Re: [giswqs/geemap] Add type: majority to zonal statistics (categorical raster analysis) (Issue #960)

The mode reducer has been added.

statistics_type="MODE"

- Reply to this email directly, view it on GitHubhttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgiswqs%2Fgeemap%2Fissues%2F960%23issuecomment-1058512160&data=04%7C01%7Ccsampselle%40ducks.org%7C32370ef5658248b11d0d08d9fd5cf08a%7C2430c44f94924e6fa57d32257ab4c515%7C0%7C0%7C637819397891973963%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=TW%2Fz1r%2Bi63R10xeGuP8jPsFAmZ2ZfWY7AGwj4p0%2FaeA%3D&reserved=0, or unsubscribehttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAW2FIUAUKVJBXKW5HJTGBHLU6EVMTANCNFSM5P3M752Q&data=04%7C01%7Ccsampselle%40ducks.org%7C32370ef5658248b11d0d08d9fd5cf08a%7C2430c44f94924e6fa57d32257ab4c515%7C0%7C0%7C637819397891973963%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=gu0dwQekkzUEqWwgEghnZFuZB8Z%2Fgx01ktP2rPyOJ4I%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Ccsampselle%40ducks.org%7C32370ef5658248b11d0d08d9fd5cf08a%7C2430c44f94924e6fa57d32257ab4c515%7C0%7C0%7C637819397891973963%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=FNerHPleEW37jwiKUdCVFzG21ciNgz3%2BPYGFBIFSyII%3D&reserved=0 or Androidhttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Ccsampselle%40ducks.org%7C32370ef5658248b11d0d08d9fd5cf08a%7C2430c44f94924e6fa57d32257ab4c515%7C0%7C0%7C637819397891973963%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=G68zBbOmuKdfhUdAJ9BzQ6jH6%2Bmvwf0xrYaUDmJRXA0%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

giswqs commented 2 years ago

I just updated it. Please try again.