From d4d46e3863fc4f432d5c2bb94718566141f43f1b Mon Sep 17 00:00:00 2001 From: Ojaybee Date: Sat, 21 Mar 2020 14:16:43 +0000 Subject: [PATCH] adds author, comments, license --- GEE_collection_Gen.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/GEE_collection_Gen.py b/GEE_collection_Gen.py index 8d4a0e3..92426c3 100644 --- a/GEE_collection_Gen.py +++ b/GEE_collection_Gen.py @@ -1,15 +1,32 @@ +''' +Script to create collections for Google Earth Engine plugin +To be used in QGIS Python console +tutorial video available here: https://youtu.be/ODBCPmQBEqU + +''' + +# Authors: Oliver (http://www.burdgis.com) +# License: MIT + + import ee import calendar from datetime import datetime from dateutil.relativedelta import * from ee_plugin import Map +dataset = 'COPERNICUS/S5P/NRTI/L3_NO2' # change to required dataset +column = 'NO2_column_number_density' # change to required column + + +# Styling for the layers band_viz = { 'min': 0, 'max': 0.0002, 'palette': ['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red'] } +# accepts 2 str in numerical format YYYYmmdd e.g. 20190331 def getDates(startDate, endDate): startDate = datetime.strptime(startDate, '%Y%m%d') @@ -26,10 +43,11 @@ def getDates(startDate, endDate): print(layerName) yield[collName, collStart.strftime("%Y-%m-%d"), collEnd.strftime("%Y-%m-%d"), layerName] - -for n in getDates('20190101','20200320'): - n[0] = ee.ImageCollection('COPERNICUS/S5P/NRTI/L3_NO2')\ - .select('NO2_column_number_density')\ + +# change dates here +for n in getDates('YYYYmmdd','YYYYmmdd'): + n[0] = ee.ImageCollection(dataset)\ + .select(column)\ .filterDate(n[1], n[2]) Map.addLayer(n[0].mean(), band_viz, 'S5P N02 - ' + n[3] )