Skip to content

Commit

Permalink
adds author, comments, license
Browse files Browse the repository at this point in the history
  • Loading branch information
Ojaybee committed Mar 21, 2020
1 parent 3fd85ad commit d4d46e3
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions GEE_collection_Gen.py
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -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] )

Expand Down

0 comments on commit d4d46e3

Please sign in to comment.