Package: ee-satellites
AboutThis library[1]provides aneasy-to-use,comprehensiveandflexibleway to work with satellites data (for now:S1_GRD,S2_SRandLANDSAT8_T1_TOA). Its key advantages include: awell-documentedAPI,supportfor the mainly used satellites,open-source codeandregular updates.In addition to the already mentioned advantages, the implemented coderelies on Google Earth Engine (GEE) APIs(used to access satellites data and perform some tasks such as cloud masking, image compositing and time series selection) andexploits multi-threading(designed to work efficiently, by making a lot of parallel I/O requests to GEE).These advantages make it an excellent tool for anyone working with satellites data, since it allows to generate datasets that can be both easily used for data analysis and efficiently integrated with well-known ML libraries, to deploy models.InstallationThe easiest way to installee-satellitesis by usingpip:$pipinstallee-satellites(Disclaimer: This library is under continous development.)FunctionsExpand the function you wish to grasp more details about.get_features()It allows to get from aninput pandas DataFramecomposed of fields information,an output DataFramethat contains for each time aselected satellite(sentinel-1, sentinel-2 or landsat-8) passed over the specified fields, within a given time period, all the mean values of some of the most used indexes (optical, radar or thermal).Thefilters_paramsparameter is a list (default:None) containing the values of the Earth Engine filters to be used for extracting Image Collections, with the specified sentinel satellites. For Sentinel-2 the first parameter in the list is the value of theCLOUDY_PIXEL_PERCENTAGEfilter (LESS OR EQUAL TO- values in range[0, 100]), whereas for Sentinel-1 the first parameter in the list is the value of theorbitProperties_passfilter (ASCENDINGorDESCENDING).Thefields_threadsparameter (default:4) is the number of threads to dedicate to parallelization of GEE API requests over the fields level, the remaining ones instead are used to apply parallelization over dates level. The value of this parameter should be high (with respect to the overall number of threads exploitable) if you have a lot of crop fields but a little time-span to consider, whereas if you have fewer fields but a bigger time-span you should decrease this parameter. Finally, if you have a lot of fields with a lot of dates to process it is optimal to consider half of the overall number of threads available on the device used to perform the I/O requests.A correct choice of this parameter can drastically reduce the features extraction time.See thecodefor a better understanding.Input DataFrameThe input DataFrame, lets suppose namedfields_df, should be structured as follows (just columns position matters):field_namepolygon_coordinatesP-BLD[(-4.202723286616649, 43.39683579015289), (-4...]P-BLLT1[(-4.085622203603083, 43.429605845026266), (-4...]P-BLLT2[(-4.084840437376829, 43.430826294936246), (-4...]P-CBRCS1[(-4.200826431306206, 43.39067464298489), (-4....]......P-VNS[(-4.151167740565273, 43.40535762666503), (-4....]How to execute it?First you have to initialize and authorize the Google Earth Engine APIs.importee,ee_satellitesee.Authenticate()ee.Initialize()Then, supposing that you have already loaded thefields_dfpandas DataFrame, you have just to run the following code. Change thesatelliteparameter value in case you wantsentinel-1, orlandasat-8, indexes extracted for the fields specified (within the time period selected - be careful that the given date format is consistent withISO 8601notation). See the above general function description, instead, to comprehend whatfilters_paramsandfields_threadsparameters are useful for.df=ee_satellites.get_features(fields_df,'2022-01-01','2022-12-31',satellite='sentinel-2',filters_params=['40'],fields_threads=3)Output DataFrameThe output generated DataFrame, namelydf, will be structured as follows:field_names2_acquisition_dateB1B2B3...MCARI2BSIGLIALTERATIONSDIP-BLD2022-01-062.260204119.981293550.044218...0.9229076282.9550140.5130692.1312553484.508503P-BLD2022-01-1613.785714111.540816528.481293...0.9213716545.2006020.5179492.1276143636.382653.................................P-VNS2022-11-171133.0573991364.9946191726.755157....0.59455311195.0202510.0708411.4410331939.695067P-VNS2022-12-17955.0403591208.7928251617.324664...0.68839410547.5927560.1077971.5055262913.218834ContributingTheee-satellitesproject is open to contributions. To discuss new ideas and applications, please, reach me via email (please, refer to theAuthor). To report a bug or request a new feature, please, open anissueto report a bug or to request a new feature.If you want to contribute, please proceed as follow:Fork the ProjectCreate your Feature Branch (git checkout -b ee-satellites/NewFeature)Commit your Changes (git commit -m 'Create NewFeature')Push the Branch (git push origin ee-satellites/NewFeature)Open a Pull RequestLicenseDistributed under the MIT License.References[1]: Amato. F, et al. "Revolutionize your Satellite Data Acquisition with ee-satellites: A Leap Forward in Remote Sensing", DEV Community (Aug 2023).