From 5b1a5d9209d2c929e439f547c7cf61bb7a1d2d74 Mon Sep 17 00:00:00 2001 From: "Morten W. Hansen" Date: Wed, 10 Jul 2019 22:47:04 +0200 Subject: [PATCH] #30: catch ObjectDoesNotExist errors - it could happen that Arome does not overlap a SAR image.. --- geospaas_wind/managers.py | 3 +- notebooks/Sentinel-1 wind.ipynb | 83 +++++++++++++++++++++++++++++++-- 2 files changed, 82 insertions(+), 4 deletions(-) diff --git a/geospaas_wind/managers.py b/geospaas_wind/managers.py index ff55cb9..ad7e8cc 100644 --- a/geospaas_wind/managers.py +++ b/geospaas_wind/managers.py @@ -12,6 +12,7 @@ from django.db import models from django.conf import settings from django.utils import timezone +from django.core.exceptions import ObjectDoesNotExist from geospaas.catalog.models import DatasetURI, Dataset from geospaas.nansat_ingestor.managers import DatasetManager @@ -32,7 +33,7 @@ def process(self, uri, force=False, *args, **kwargs): try: w = wind_from_sar_and_arome_forecast(uri) - except (TooHighResolutionError, PolarizationError) as e: + except (TooHighResolutionError, PolarizationError, ObjectDoesNotExist) as e: warnings.warn(e.file + ': ' + e.msg) return None, False diff --git a/notebooks/Sentinel-1 wind.ipynb b/notebooks/Sentinel-1 wind.ipynb index a210400..11b2f79 100644 --- a/notebooks/Sentinel-1 wind.ipynb +++ b/notebooks/Sentinel-1 wind.ipynb @@ -2,9 +2,38 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "KeyError", + "evalue": "'PROJ_LIB'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mdjango\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0mdjango\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msetup\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mdjango\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconf\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0msettings\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/Miniconda3-4.5.1-Linux-x86_64/envs/py3openwind/lib/python3.6/site-packages/django/__init__.py\u001b[0m in \u001b[0;36msetup\u001b[0;34m(set_prefix)\u001b[0m\n\u001b[1;32m 22\u001b[0m \u001b[0;34m'/'\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0msettings\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mFORCE_SCRIPT_NAME\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0msettings\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mFORCE_SCRIPT_NAME\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 23\u001b[0m )\n\u001b[0;32m---> 24\u001b[0;31m \u001b[0mapps\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpopulate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msettings\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mINSTALLED_APPS\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m~/Miniconda3-4.5.1-Linux-x86_64/envs/py3openwind/lib/python3.6/site-packages/django/apps/registry.py\u001b[0m in \u001b[0;36mpopulate\u001b[0;34m(self, installed_apps)\u001b[0m\n\u001b[1;32m 112\u001b[0m \u001b[0;31m# Phase 2: import models modules.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 113\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mapp_config\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapp_configs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalues\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 114\u001b[0;31m \u001b[0mapp_config\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimport_models\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 115\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 116\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclear_cache\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/Miniconda3-4.5.1-Linux-x86_64/envs/py3openwind/lib/python3.6/site-packages/django/apps/config.py\u001b[0m in \u001b[0;36mimport_models\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 209\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mmodule_has_submodule\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmodule\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mMODELS_MODULE_NAME\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 210\u001b[0m \u001b[0mmodels_module_name\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'%s.%s'\u001b[0m \u001b[0;34m%\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mMODELS_MODULE_NAME\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 211\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmodels_module\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mimport_module\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmodels_module_name\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 212\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mready\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/Miniconda3-4.5.1-Linux-x86_64/envs/py3openwind/lib/python3.6/importlib/__init__.py\u001b[0m in \u001b[0;36mimport_module\u001b[0;34m(name, package)\u001b[0m\n\u001b[1;32m 124\u001b[0m \u001b[0;32mbreak\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 125\u001b[0m \u001b[0mlevel\u001b[0m \u001b[0;34m+=\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 126\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0m_bootstrap\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_gcd_import\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mlevel\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpackage\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlevel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 127\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 128\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/Miniconda3-4.5.1-Linux-x86_64/envs/py3openwind/lib/python3.6/importlib/_bootstrap.py\u001b[0m in \u001b[0;36m_gcd_import\u001b[0;34m(name, package, level)\u001b[0m\n", + "\u001b[0;32m~/Miniconda3-4.5.1-Linux-x86_64/envs/py3openwind/lib/python3.6/importlib/_bootstrap.py\u001b[0m in \u001b[0;36m_find_and_load\u001b[0;34m(name, import_)\u001b[0m\n", + "\u001b[0;32m~/Miniconda3-4.5.1-Linux-x86_64/envs/py3openwind/lib/python3.6/importlib/_bootstrap.py\u001b[0m in \u001b[0;36m_find_and_load_unlocked\u001b[0;34m(name, import_)\u001b[0m\n", + "\u001b[0;32m~/Miniconda3-4.5.1-Linux-x86_64/envs/py3openwind/lib/python3.6/importlib/_bootstrap.py\u001b[0m in \u001b[0;36m_load_unlocked\u001b[0;34m(spec)\u001b[0m\n", + "\u001b[0;32m~/Miniconda3-4.5.1-Linux-x86_64/envs/py3openwind/lib/python3.6/importlib/_bootstrap_external.py\u001b[0m in \u001b[0;36mexec_module\u001b[0;34m(self, module)\u001b[0m\n", + "\u001b[0;32m~/Miniconda3-4.5.1-Linux-x86_64/envs/py3openwind/lib/python3.6/importlib/_bootstrap.py\u001b[0m in \u001b[0;36m_call_with_frames_removed\u001b[0;34m(f, *args, **kwds)\u001b[0m\n", + "\u001b[0;32m/vagrant/geospaas_wind/models.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mgeospaas\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcatalog\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmodels\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mDataset\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mCatalogDataset\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mgeospaas_wind\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmanagers\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mWindManager\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0mDataset\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mCatalogDataset\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/vagrant/geospaas_wind/managers.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mpythesint\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mpti\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 8\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mnansat\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnansat\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mNansat\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 9\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mnansat\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdomain\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mDomain\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mnansat\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtools\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mhaversine\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/Miniconda3-4.5.1-Linux-x86_64/envs/py3openwind/lib/python3.6/site-packages/nansat/__init__.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 35\u001b[0m ''')\n\u001b[1;32m 36\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mnansat\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnsr\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mNSR\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 37\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mnansat\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdomain\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mDomain\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 38\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mnansat\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnansat\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mNansat\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 39\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mnansat\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfigure\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mFigure\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/Miniconda3-4.5.1-Linux-x86_64/envs/py3openwind/lib/python3.6/site-packages/nansat/domain.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 24\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 25\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mnansat\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtools\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0madd_logger\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minitial_bearing\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhaversine\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mgdal\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mosr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mogr\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 26\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mnansat\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnsr\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mNSR\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 27\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mnansat\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvrt\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mVRT\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/Miniconda3-4.5.1-Linux-x86_64/envs/py3openwind/lib/python3.6/site-packages/nansat/tools.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 36\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 37\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 38\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mmpl_toolkits\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbasemap\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mBasemap\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 39\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mImportError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 40\u001b[0m \u001b[0mBASEMAP_LIB_IS_INSTALLED\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/Miniconda3-4.5.1-Linux-x86_64/envs/py3openwind/lib/python3.6/site-packages/mpl_toolkits/basemap/__init__.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 153\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 154\u001b[0m \u001b[0;31m# create dictionary that maps epsg codes to Basemap kwargs.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 155\u001b[0;31m \u001b[0mpyproj_datadir\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0menviron\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'PROJ_LIB'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 156\u001b[0m \u001b[0mepsgf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpyproj_datadir\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m'epsg'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 157\u001b[0m \u001b[0mepsg_dict\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/Miniconda3-4.5.1-Linux-x86_64/envs/py3openwind/lib/python3.6/os.py\u001b[0m in \u001b[0;36m__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 667\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 668\u001b[0m \u001b[0;31m# raise KeyError with the original key value\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 669\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 670\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdecodevalue\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 671\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mKeyError\u001b[0m: 'PROJ_LIB'" + ] + } + ], "source": [ "import os\n", "os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'\n", @@ -33,11 +62,59 @@ "cell_type": "code", "execution_count": 3, "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "environ{'XDG_SESSION_ID': '27',\n", + " 'SHELL': '/bin/bash',\n", + " 'TERM': 'xterm-color',\n", + " 'SSH_CLIENT': '10.0.2.2 41490 22',\n", + " 'PYTHONUNBUFFERED': '1',\n", + " 'USER': 'vagrant',\n", + " 'SSH_AUTH_SOCK': '/tmp/ssh-CweZNnqgdO/agent.2820',\n", + " 'PATH': '/home/vagrant/anaconda/envs/py3openwind/bin:/home/vagrant/bin:/home/vagrant/.local/bin:/home/vagrant/anaconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin',\n", + " 'MAIL': '/var/mail/vagrant',\n", + " 'PWD': '/vagrant/provisioning',\n", + " 'LANG': 'en_US.UTF-8',\n", + " 'MINICONDA_DIR': '/home/vagrant/anaconda',\n", + " 'HOME': '/home/vagrant',\n", + " 'SHLVL': '3',\n", + " 'PYTHONPATH': '/vagrant:/vagrant/lib:/vagrant/lib/project',\n", + " 'LOGNAME': 'vagrant',\n", + " 'SSH_CONNECTION': '10.0.2.2 41490 10.0.2.15 22',\n", + " 'XDG_DATA_DIRS': '/usr/local/share:/usr/share:/var/lib/snapd/desktop',\n", + " 'ANSIBLE_FORCE_COLOR': 'true',\n", + " 'XDG_RUNTIME_DIR': '/run/user/1000',\n", + " '_': '/home/vagrant/anaconda/envs/py3openwind/bin/jupyter-notebook',\n", + " 'JPY_PARENT_PID': '4741',\n", + " 'CLICOLOR': '1',\n", + " 'PAGER': 'cat',\n", + " 'GIT_PAGER': 'cat',\n", + " 'MPLBACKEND': 'module://ipykernel.pylab.backend_inline',\n", + " 'DJANGO_SETTINGS_MODULE': 'project.settings',\n", + " 'TZ': 'UTC'}" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "os.environ" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, "outputs": [], "source": [ "#fn = 'http://nbstds.met.no/thredds/dodsC/NBS/S1B/2019/06/30/IW/S1B_IW_GRDM_1SDV_20190630T051108_20190630T051141_016921_01FD7F_21CF.nc'\n", "#fn = '/home/vagrant/project/S1A_EW_GRDM_1SDH_20190704T070553_20190704T070654_027964_032853_C95D.nc'\n", - "fn = '/vagrant/lib/project/products/WIND_WIND_UNPROJECTED_S1A_IW_GRDM_1SDV_20190704T052723_20190704T052755_027963_03284A_AF7D.nc'" + "#fn = '/vagrant/lib/project/products/WIND_WIND_UNPROJECTED_S1A_IW_GRDM_1SDV_20190704T052723_20190704T052755_027963_03284A_AF7D.nc'\n", + "fn = '/home/vagrant/project/products/WIND_S1A_IW_GRDM_1SDV_20190709T165618_20190709T165650_028043_032AC4_6010.nc'" ] }, {