Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/DeDop/dedop-core
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-ep committed Feb 9, 2018
2 parents db9da6f + 6a0c8fe commit 27dcecc
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 33 deletions.
6 changes: 3 additions & 3 deletions dedop/ui/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ def compare_l1b_products(product_file_path_1: str,
:param output_path: The output path where plot figures are written to.
:param output_format: The output format. Supported formats are "pdf" and "dir".
"""
if bokeh.util.platform.is_notebook():
if output_path:
figure_writer = FigureWriter(output_path, output_format)
else:
bokeh.io.output_notebook(hide_banner=True)
figure_writer = None
else:
figure_writer = FigureWriter(output_path, output_format)
return L1bProductComparator(product_file_path_1, product_file_path_2, figure_writer)


Expand Down
6 changes: 3 additions & 3 deletions dedop/ui/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ def inspect_l1b_product(product_file_path, output_path=None, output_format=None)
:param output_path: The output path where plot figures are written to.
:param output_format: The output format. Supported formats are "pdf" and "dir".
"""
if bokeh.util.platform.is_notebook():
if output_path:
figure_writer = FigureWriter(output_path, output_format)
else:
bokeh.io.output_notebook(hide_banner=True)
figure_writer = None
else:
figure_writer = FigureWriter(output_path, output_format)
return L1bProductInspector(product_file_path, figure_writer)


Expand Down
6 changes: 4 additions & 2 deletions dedop/webapi/main.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import sys
import sys, os
from datetime import date

from cate.util.web import JsonRcpWebSocketHandler
from cate.util.web.webapi import run_main, url_pattern, WebAPIRequestHandler, WebAPIExitHandler
from tornado.web import Application

from dedop.conf.defaults import WEBAPI_PROGRESS_DEFER_PERIOD, WEBAPI_LOG_FILE_PREFIX
from dedop.conf.defaults import WEBAPI_PROGRESS_DEFER_PERIOD, WEBAPI_LOG_FILE_PREFIX, DEFAULT_VERSION_DATA_PATH
from dedop.ui.workspace_manager import WorkspaceManager
from dedop.version import __version__
from dedop.webapi.websocket import WebSocketService
Expand Down Expand Up @@ -46,6 +46,8 @@ def create_application():


def main(args=None) -> int:
if not os.path.exists(DEFAULT_VERSION_DATA_PATH):
os.makedirs(DEFAULT_VERSION_DATA_PATH, exist_ok=True)
return run_main(CLI_NAME, CLI_DESCRIPTION, __version__,
application_factory=create_application,
log_file_prefix=WEBAPI_LOG_FILE_PREFIX,
Expand Down
24 changes: 10 additions & 14 deletions docs/user_manual/um_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,23 @@ DeDop is programmed in Python so you first need to setup a suitable Python envir
We recommend using a `Miniconda <http://conda.pydata.org/miniconda.html>`_ Python3 environment, so
you don't need to install the DeDop library dependencies in your default Python.

After installing Miniconda open a terminal window and create an isolated Python environment and *activate* it. Type::
First, checkout the DeDop source code from GitHub::

conda create -n dedop python=3.5
source activate dedop


Then install the DeDop library requirements::

conda install numpy scipy netcdf4 numexpr pyproj
git clone https://github.com/DeDop/dedop-core.git

If you like to perform analysis tasks with DeDop, then also install::
Step into the newly created source directory::

conda install matplotlib bokeh jupyter ipywidgets
cd dedop-core

Then checkout the DeDop source code from GitHub::
After installing Miniconda, open a terminal window and create an isolated Python environment with all the required
dependencies as listed in `environment.yml` and *activate* it. Type::

git clone https://github.com/DeDop/dedop-core.git
conda env create --file environment.yml
source activate dedop # Linux, MacOS
activate dedop # Windows

Step into the newly created source directory and install DeDop in the Python environment `dedop`::
Install DeDop in the Python environment `dedop`::

cd dedop-core
python setup.py develop

After installing from source, you should be able to run the DeDop Shell, try::
Expand Down
17 changes: 10 additions & 7 deletions tests/ui/test_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@


class L1bComparatorTest(TestCase):
def test_it(self):
# Ok, not really a test yet, but at least we import L1bComparator
with self.assertRaises(ValueError) as e:
compare_l1b_products(None, 'y', False)
self.assertEquals(str(e.exception), 'output_path must be given')
# Ok, not really a test yet, but at least we import L1bInspector

def test_without_files(self):
with self.assertRaises(ValueError) as e:
compare_l1b_products('x', '', False)
self.assertEquals(str(e.exception), 'output_path must be given')
compare_l1b_products(None, None)
self.assertEquals(str(e.exception), 'file_path_1 must be given')

def test_with_files(self):
compare_l1b_products("test_data/data/test_l1b/temp/output.nc",
"test_data/data/test_l1b/temp/output.nc")

12 changes: 8 additions & 4 deletions tests/ui/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@


class L1bProductInspectorTest(TestCase):
def test_it(self):
# Ok, not really a test yet, but at least we import L1bInspector
# Ok, not really a test yet, but at least we import L1bInspector

def test_without_file(self):
with self.assertRaises(ValueError) as e:
inspect_l1b_product(None, False)
self.assertEquals(str(e.exception), 'output_path must be given')
inspect_l1b_product(None)
self.assertEquals(str(e.exception), 'product_file_path must be given')

def test_with_file(self):
inspect_l1b_product("test_data/data/test_l1b/temp/output.nc")

0 comments on commit 27dcecc

Please sign in to comment.