From 491159e93b78164238288b655505cf20f6b61802 Mon Sep 17 00:00:00 2001 From: dshean Date: Tue, 19 Feb 2019 05:01:14 +0000 Subject: [PATCH] Better date handling with missing LS8 bands --- landsat8-cog-ndvi-hvplot.ipynb | 6 ++++-- landsat8-cog-ndvi.ipynb | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/landsat8-cog-ndvi-hvplot.ipynb b/landsat8-cog-ndvi-hvplot.ipynb index 2e6a7d2..d06e9b2 100644 --- a/landsat8-cog-ndvi-hvplot.ipynb +++ b/landsat8-cog-ndvi-hvplot.ipynb @@ -342,11 +342,13 @@ "source": [ "# Merge all acquisitions into a single large Dataset\n", "datasets = []\n", + "dates = []\n", "for i,row in df.iterrows():\n", " try:\n", " print('loading...', row.date)\n", " ds = create_multiband_dataset(row)\n", " datasets.append(ds)\n", + " dates.append(row.date)\n", " except Exception as e:\n", " print('ERROR loading, skipping acquistion!')\n", " print(e)" @@ -359,7 +361,7 @@ "outputs": [], "source": [ "%%time\n", - "DS = xr.concat(datasets, dim=pd.DatetimeIndex(df.date.tolist(), name='time'))\n", + "DS = xr.concat(datasets, dim=pd.DatetimeIndex(dates, name='time'))\n", "print('Dataset size (Gb): ', DS.nbytes/1e9)" ] }, @@ -658,7 +660,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.6" + "version": "3.6.7" }, "widgets": { "application/vnd.jupyter.widget-state+json": { diff --git a/landsat8-cog-ndvi.ipynb b/landsat8-cog-ndvi.ipynb index 0246573..1f3e23d 100644 --- a/landsat8-cog-ndvi.ipynb +++ b/landsat8-cog-ndvi.ipynb @@ -590,11 +590,13 @@ "source": [ "# Merge all acquisitions into a single large Dataset\n", "datasets = []\n", + "dates = []\n", "for i,row in df.iterrows():\n", " try:\n", " print('loading...', row.date)\n", " ds = create_multiband_dataset(row)\n", " datasets.append(ds)\n", + " dates.append(row.date)\n", " except Exception as e:\n", " print('ERROR loading, skipping acquistion!')\n", " print(e)" @@ -632,7 +634,7 @@ } ], "source": [ - "DS = xr.concat(datasets, dim=pd.DatetimeIndex(df.date.tolist(), name='time'))\n", + "DS = xr.concat(datasets, dim=pd.DatetimeIndex(dates, name='time'))\n", "print('Dataset size (Gb): ', DS.nbytes/1e9)\n", "DS" ] @@ -981,7 +983,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.6" + "version": "3.6.7" } }, "nbformat": 4,