In [1]:
# Reload when code changed:
%load_ext autoreload
%autoreload 2
%pwd
import sys
import os
path = "../"
sys.path.append(path)
#os.path.abspath("../")
print(os.path.abspath(path))


D:\Utveckling\git\ekostat_calculator

In [2]:
import os 
import core
import logging
import importlib
importlib.reload(core) 
try:
    logging.shutdown()
    importlib.reload(logging)
except:
    pass
import pandas as pd
import numpy as np
import json

from event_handler import EventHandler
print(core.__file__)
pd.__version__


..\core\__init__.py
Out[2]:
'0.19.2'

Load EvendHandler


In [3]:
user_id = 'user_1'
ws_1 = 'ws_1'
sub_1 = 'sub_1'
ekos = EventHandler(path)


2018-04-24 11:40:27,208	logger.py	85	add_log	DEBUG	
2018-04-24 11:40:27,208	logger.py	86	add_log	DEBUG	========================================================================================================================
2018-04-24 11:40:27,208	logger.py	87	add_log	DEBUG	### Log added for log_id "event_handler" at locaton: ..\log\main_event_handler.log
2018-04-24 11:40:27,208	logger.py	88	add_log	DEBUG	------------------------------------------------------------------------------------------------------------------------
2018-04-24 11:40:27,208	event_handler.py	64	__init__	DEBUG	Start EventHandler: event_handler
2018-04-24 11:40:27,209	event_handler.py	65	__init__	DEBUG	
2018-04-24 11:40:27,209	event_handler.py	66	__init__	INFO	TEST info logger
2018-04-24 11:40:27,211	event_handler.py	67	__init__	WARNING	TEST warning logger
2018-04-24 11:40:27,213	event_handler.py	68	__init__	ERROR	TEST error logger
2018-04-24 11:40:27,216	event_handler.py	69	__init__	DEBUG	TEST debug logger
====================================================================================================
event_handler
..//log
main
----------------------------------------------------------------------------------------------------
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
dict_keys(['main_event_handler'])
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
event_handler _ main_event_handler

Create new workspace


In [4]:
ekos.copy_workspace(user_id, 
                    source_alias='default_workspace', 
                    target_alias=ws_1, )


2018-04-24 11:40:30,274	event_handler.py	236	copy_workspace	DEBUG	Could not add workspace with alias "ws_1". Workspace already exists!
¤ ws_1
¤ user_1
Out[4]:
False

In [ ]:

Load workspaces for user


In [5]:
ekos.load_all_workspaces_for_user(user_id)


2018-04-24 11:40:32,398	event_handler.py	1397	load_all_workspaces_for_user	DEBUG	Trying to load all workspaces for user "user_1"
2018-04-24 11:40:32,408	event_handler.py	1491	load_workspace	DEBUG	Trying to load workspace "default_workspace" with alias "default_workspace"
2018-04-24 11:40:32,499	logger.py	85	add_log	DEBUG	
2018-04-24 11:40:32,499	logger.py	86	add_log	DEBUG	========================================================================================================================
2018-04-24 11:40:32,499	logger.py	87	add_log	DEBUG	### Log added for log_id "default_subset" at locaton: ..\workspaces\default_workspace\log\subset_default_subset.log
2018-04-24 11:40:32,499	logger.py	88	add_log	DEBUG	------------------------------------------------------------------------------------------------------------------------
====================================================================================================
Initiating WorkSpace: ..//workspaces/default_workspace
Parent directory is: ..//workspaces
Resource directory is: ..//resources
=== default_subset
!!! default_subset
!!! default_subset
!!! ..//workspaces/default_workspace/subsets
----------------------------------------------------------------------------------------------------
Initiating Subset: ..//workspaces/default_workspace/subsets/default_subset
===
..//workspaces/default_workspace/subsets/default_subset
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/default_workspace/subsets/default_subset/step_1
..//workspaces/default_workspace/subsets/default_subset/step_2/settings/indicator_settings/biov.set
..//workspaces/default_workspace/subsets/default_subset/step_2/settings/indicator_settings/BQI.set
..//workspaces/default_workspace/subsets/default_subset/step_2/settings/indicator_settings/chl.set
..//workspaces/default_workspace/subsets/default_subset/step_2/settings/indicator_settings/din_winter.set
..//workspaces/default_workspace/subsets/default_subset/step_2/settings/indicator_settings/dip_winter.set
..//workspaces/default_workspace/subsets/default_subset/step_2/settings/indicator_settings/ntot_summer.set
..//workspaces/default_workspace/subsets/default_subset/step_2/settings/indicator_settings/ntot_winter.set
..//workspaces/default_workspace/subsets/default_subset/step_2/settings/indicator_settings/ptot_summer.set
..//workspaces/default_workspace/subsets/default_subset/step_2/settings/indicator_settings/ptot_winter.set
..//workspaces/default_workspace/subsets/default_subset/step_2/settings/indicator_settings/secchi.set
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/default_workspace/subsets/default_subset/step_2
====================================================================================================
default_subset
..//workspaces/default_workspace/log
subset
----------------------------------------------------------------------------------------------------
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
dict_keys(['main_event_handler', 'subset_default_subset'])
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
default_subset _ main_event_handler
default_subset _ subset_default_subset
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/default_workspace/step_0
2018-04-24 11:40:32,690	logger.py	85	add_log	DEBUG	
2018-04-24 11:40:32,691	logger.py	86	add_log	DEBUG	========================================================================================================================
2018-04-24 11:40:32,693	logger.py	87	add_log	DEBUG	### Log added for log_id "default_workspace" at locaton: ..\workspaces\default_workspace\log\workspace_default_workspace.log
2018-04-24 11:40:32,696	logger.py	88	add_log	DEBUG	------------------------------------------------------------------------------------------------------------------------
2018-04-24 11:40:32,710	event_handler.py	1491	load_workspace	DEBUG	Trying to load workspace "a96fda30-386a-44bf-ac5c-48c36893fa10" with alias "ws_1"
2018-04-24 11:40:32,805	logger.py	85	add_log	DEBUG	
2018-04-24 11:40:32,805	logger.py	86	add_log	DEBUG	========================================================================================================================
2018-04-24 11:40:32,805	logger.py	87	add_log	DEBUG	### Log added for log_id "c49581cd-35db-4d2c-bb6d-d5eacbc608f6" at locaton: ..\workspaces\a96fda30-386a-44bf-ac5c-48c36893fa10\log\subset_c49581cd-35db-4d2c-bb6d-d5eacbc608f6.log
2018-04-24 11:40:32,805	logger.py	88	add_log	DEBUG	------------------------------------------------------------------------------------------------------------------------
====================================================================================================
default_workspace
..//workspaces/default_workspace/log
workspace
----------------------------------------------------------------------------------------------------
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
dict_keys(['main_event_handler', 'subset_default_subset', 'workspace_default_workspace'])
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
default_workspace _ main_event_handler
default_workspace _ subset_default_subset
default_workspace _ workspace_default_workspace
status ['editable', 'readable', 'deleted']

====================================================================================================
Initiating WorkSpace: ..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10
Parent directory is: ..//workspaces
Resource directory is: ..//resources
=== c49581cd-35db-4d2c-bb6d-d5eacbc608f6
status ['editable', 'readable', 'deleted']
!!! sub_1
!!! c49581cd-35db-4d2c-bb6d-d5eacbc608f6
!!! ..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets
----------------------------------------------------------------------------------------------------
Initiating Subset: ..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/c49581cd-35db-4d2c-bb6d-d5eacbc608f6
===
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/c49581cd-35db-4d2c-bb6d-d5eacbc608f6
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/c49581cd-35db-4d2c-bb6d-d5eacbc608f6/step_1
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/c49581cd-35db-4d2c-bb6d-d5eacbc608f6/step_2/settings/indicator_settings/biov.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/c49581cd-35db-4d2c-bb6d-d5eacbc608f6/step_2/settings/indicator_settings/BQI.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/c49581cd-35db-4d2c-bb6d-d5eacbc608f6/step_2/settings/indicator_settings/chl.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/c49581cd-35db-4d2c-bb6d-d5eacbc608f6/step_2/settings/indicator_settings/din_winter.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/c49581cd-35db-4d2c-bb6d-d5eacbc608f6/step_2/settings/indicator_settings/dip_winter.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/c49581cd-35db-4d2c-bb6d-d5eacbc608f6/step_2/settings/indicator_settings/ntot_summer.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/c49581cd-35db-4d2c-bb6d-d5eacbc608f6/step_2/settings/indicator_settings/ntot_winter.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/c49581cd-35db-4d2c-bb6d-d5eacbc608f6/step_2/settings/indicator_settings/ptot_summer.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/c49581cd-35db-4d2c-bb6d-d5eacbc608f6/step_2/settings/indicator_settings/ptot_winter.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/c49581cd-35db-4d2c-bb6d-d5eacbc608f6/step_2/settings/indicator_settings/secchi.set
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/c49581cd-35db-4d2c-bb6d-d5eacbc608f6/step_2
====================================================================================================
c49581cd-35db-4d2c-bb6d-d5eacbc608f6
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/log
subset
----------------------------------------------------------------------------------------------------
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
dict_keys(['main_event_handler', 'subset_default_subset', 'workspace_default_workspace', 'subset_c49581cd-35db-4d2c-bb6d-d5eacbc608f6'])
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
c49581cd-35db-4d2c-bb6d-d5eacbc608f6 _ main_event_handler
c49581cd-35db-4d2c-bb6d-d5eacbc608f6 _ subset_default_subset
c49581cd-35db-4d2c-bb6d-d5eacbc608f6 _ workspace_default_workspace
c49581cd-35db-4d2c-bb6d-d5eacbc608f6 _ subset_c49581cd-35db-4d2c-bb6d-d5eacbc608f6
=== default_subset
!!! default_subset
!!! default_subset
!!! ..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets
----------------------------------------------------------------------------------------------------
Initiating Subset: ..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/default_subset
===
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/default_subset
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/default_subset/step_1
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/default_subset/step_2/settings/indicator_settings/biov.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/default_subset/step_2/settings/indicator_settings/BQI.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/default_subset/step_2/settings/indicator_settings/chl.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/default_subset/step_2/settings/indicator_settings/din_winter.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/default_subset/step_2/settings/indicator_settings/dip_winter.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/default_subset/step_2/settings/indicator_settings/ntot_summer.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/default_subset/step_2/settings/indicator_settings/ntot_winter.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/default_subset/step_2/settings/indicator_settings/ptot_summer.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/default_subset/step_2/settings/indicator_settings/ptot_winter.set
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/default_subset/step_2/settings/indicator_settings/secchi.set
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/subsets/default_subset/step_2
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
dict_keys(['main_event_handler', 'subset_default_subset', 'workspace_default_workspace', 'subset_c49581cd-35db-4d2c-bb6d-d5eacbc608f6'])
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
default_subset _ main_event_handler
default_subset _ subset_default_subset
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/step_0
2018-04-24 11:40:33,085	logger.py	85	add_log	DEBUG	
2018-04-24 11:40:33,086	logger.py	86	add_log	DEBUG	========================================================================================================================
2018-04-24 11:40:33,088	logger.py	87	add_log	DEBUG	### Log added for log_id "a96fda30-386a-44bf-ac5c-48c36893fa10" at locaton: ..\workspaces\a96fda30-386a-44bf-ac5c-48c36893fa10\log\workspace_a96fda30-386a-44bf-ac5c-48c36893fa10.log
2018-04-24 11:40:33,090	logger.py	88	add_log	DEBUG	------------------------------------------------------------------------------------------------------------------------
====================================================================================================
a96fda30-386a-44bf-ac5c-48c36893fa10
..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/log
workspace
----------------------------------------------------------------------------------------------------
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
dict_keys(['main_event_handler', 'subset_default_subset', 'workspace_default_workspace', 'subset_c49581cd-35db-4d2c-bb6d-d5eacbc608f6', 'workspace_a96fda30-386a-44bf-ac5c-48c36893fa10'])
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
a96fda30-386a-44bf-ac5c-48c36893fa10 _ main_event_handler
a96fda30-386a-44bf-ac5c-48c36893fa10 _ subset_default_subset
a96fda30-386a-44bf-ac5c-48c36893fa10 _ workspace_default_workspace
a96fda30-386a-44bf-ac5c-48c36893fa10 _ subset_c49581cd-35db-4d2c-bb6d-d5eacbc608f6
a96fda30-386a-44bf-ac5c-48c36893fa10 _ workspace_a96fda30-386a-44bf-ac5c-48c36893fa10

In [6]:
ws_uuid = ekos.get_workspaces_for_user(user_id)[0]
print('Workspace uuid for {} is: {}'.format(ws_1, ws_uuid))


Workspace uuid for ws_1 is: a96fda30-386a-44bf-ac5c-48c36893fa10

Create new subset


In [7]:
ekos.copy_subset(user_id, 
                 workspace_alias=ws_1,  
                 subset_source_alias='default_subset', 
                 subset_target_alias=sub_1)


2018-04-24 11:40:38,547	event_handler.py	208	copy_subset	DEBUG	Trying to copy subset "default_subset". Copy has alias "sub_1"
2018-04-24 11:40:38,557	workspaces.py	1149	copy_subset	DEBUG	Could not add subset with alias "sub_1". Subset already exists!
default_subset sub_1
self.user_id user_1
¤ sub_1
¤ user_1
target_uuid False
Out[7]:
False

In [8]:
# ekos.list_subsets(user_id=user_id, workspace_unique_id=ws_uuid)

In [9]:
sub_uuid = ekos.get_unique_id_for_alias(user_id, workspace_alias=ws_1, subset_alias=sub_1)
print('Subset uuid for {} is: {}'.format(sub_1, sub_uuid))


Subset uuid for sub_1 is: c49581cd-35db-4d2c-bb6d-d5eacbc608f6

In [10]:
ws_object = ekos.workspaces[ws_uuid]
ws_object.datatype_settings.load_and_check_dtype_settings()


Out[10]:
True

Import default data


In [12]:
ekos.import_default_data(user_id, workspace_alias=ws_1, force=False)


2018-04-24 11:40:49,359	event_handler.py	945	import_default_data	DEBUG	Trying to load default data in workspace "a96fda30-386a-44bf-ac5c-48c36893fa10" with alias "ws_1"
2018-04-24 11:40:49,370	workspaces.py	999	import_default_data	DEBUG	Default data file has been copied to workspace raw data folder: chlorophyll_integrated_2015_2016_row_format.txt
2018-04-24 11:40:49,403	workspaces.py	999	import_default_data	DEBUG	Default data file has been copied to workspace raw data folder: chlorophyll_sharkweb_data_chlorophyll_wb_2007-2017_20180320.txt
2018-04-24 11:40:49,420	workspaces.py	999	import_default_data	DEBUG	Default data file has been copied to workspace raw data folder: physicalchemicalmodel_110001_PROFILER_alldepths_SE652400-223501_toolbox.dat
2018-04-24 11:40:49,442	workspaces.py	999	import_default_data	DEBUG	Default data file has been copied to workspace raw data folder: physicalchemicalmodel_120004_PROFILER_alldepths_SE612520-172080_toolbox.dat
File already added
File already added
File already added
File already added
2018-04-24 11:40:49,607	workspaces.py	999	import_default_data	DEBUG	Default data file has been copied to workspace raw data folder: physicalchemical_sharkweb_data_fyskem_wb_2007-2017_20180320.txt
2018-04-24 11:40:49,777	workspaces.py	999	import_default_data	DEBUG	Default data file has been copied to workspace raw data folder: phytoplankton_2016_row_format.txt
File already added
File already added
2018-04-24 11:40:49,961	workspaces.py	999	import_default_data	DEBUG	Default data file has been copied to workspace raw data folder: phytoplankton_sharkweb_data_biovolume_wb_2007-2012_20180320.txt
2018-04-24 11:40:50,095	workspaces.py	999	import_default_data	DEBUG	Default data file has been copied to workspace raw data folder: phytoplankton_sharkweb_data_biovolume_wb_2013-2017_20180320.txt
File already added
File already added
File already added
2018-04-24 11:40:50,170	workspaces.py	999	import_default_data	DEBUG	Default data file has been copied to workspace raw data folder: zoobenthos_2016_row_format_2.txt
2018-04-24 11:40:50,189	workspaces.py	999	import_default_data	DEBUG	Default data file has been copied to workspace raw data folder: zoobenthos_sharkweb_data_BQIm_wb_2007-2017_20180320.txt
File already added

Load data


In [13]:
# %%timeit
import time
t0 = time.time()
ws_object = ekos.workspaces[ws_uuid]
# ws_object.delete_alldata_export()
ekos.load_data(user_id, ws_uuid, force=False)
print(time.time()-t0)


2018-04-24 11:40:51,380	workspaces.py	1566	load_all_data	DEBUG	No data to load.
2018-04-24 11:40:51,381	workspaces.py	1237	delete_all_export_data	DEBUG	All files in export directory are deleted and all "loaded" in datatype_settings is 0.
2018-04-24 11:40:51,424	workspaces.py	1638	load_datatype_data	DEBUG	New data files has been loaded for datatype: physicalchemical
2018-04-24 11:40:51,462	workspaces.py	1638	load_datatype_data	DEBUG	New data files has been loaded for datatype: physicalchemicalmodel
2018-04-24 11:40:51,501	workspaces.py	1638	load_datatype_data	DEBUG	New data files has been loaded for datatype: chlorophyll
2018-04-24 11:40:51,545	workspaces.py	1638	load_datatype_data	DEBUG	New data files has been loaded for datatype: phytoplankton
No data selected to be loaded!
2018-04-24 11:40:51,594	workspaces.py	1638	load_datatype_data	DEBUG	New data files has been loaded for datatype: zoobenthos
No data available after "merge_all_data"!
0.22799968719482422

Activate files (set status = 1)


In [28]:
files_to_activate = ['physicalchemical_sharkweb_data_fyskem_wb_2007-2017_20180320.txt']
# ws_object.activate_files(files_to_activate, only_this_list=False)
for file_name in files_to_activate:
    ws_object.set_status_for_file(file_name, 1)
print(ws_object.datatype_settings.df[['status', 'loaded', 'filename']])


   status  loaded                                           filename
0       0       0    chlorophyll_integrated_2015_2016_row_format.txt
1       0       0  chlorophyll_sharkweb_data_chlorophyll_wb_2007-...
2       0       0  physicalchemicalmodel_110001_PROFILER_alldepth...
3       0       0  physicalchemicalmodel_120004_PROFILER_alldepth...
4       1       0  physicalchemical_sharkweb_data_fyskem_wb_2007-...
5       0       0                  phytoplankton_2016_row_format.txt
6       0       0  phytoplankton_sharkweb_data_biovolume_wb_2007-...
7       0       0  phytoplankton_sharkweb_data_biovolume_wb_2013-...
8       0       0                   zoobenthos_2016_row_format_2.txt
9       0       0  zoobenthos_sharkweb_data_BQIm_wb_2007-2017_201...

In [29]:
t0 = time.time()
ws_object = ekos.workspaces[ws_uuid]
# ws_object.delete_alldata_export()
ekos.load_data(user_id, ws_uuid, force=False)
print(time.time()-t0)
print(ws_object.datatype_settings.df[['status', 'loaded', 'filename']])


2018-04-24 11:45:17,844	workspaces.py	1570	load_all_data	DEBUG	All selected data in (status 1 in datatype_settings.txt) is not loaded.
2018-04-24 11:45:17,847	workspaces.py	1277	delete_datatype_export	DEBUG	column_format_physicalchemical_data.pickle deleted
2018-04-24 11:45:23,159	workspaces.py	1638	load_datatype_data	DEBUG	New data files has been loaded for datatype: physicalchemical
2018-04-24 11:45:23,160	workspaces.py	1622	load_datatype_data	DEBUG	Data has been loaded from existing file: column_format_physicalchemicalmodel_data.pickle
2018-04-24 11:45:23,207	workspaces.py	1622	load_datatype_data	DEBUG	Data has been loaded from existing file: column_format_chlorophyll_data.pickle
2018-04-24 11:45:23,224	workspaces.py	1622	load_datatype_data	DEBUG	Data has been loaded from existing file: column_format_phytoplankton_data.pickle
2018-04-24 11:45:23,253	workspaces.py	1622	load_datatype_data	DEBUG	Data has been loaded from existing file: column_format_zoobenthos_data.pickle
time for _add_prioritized_parameter SALT is: 0.1419997215270996
time for _add_prioritized_parameter TEMP is: 0.12200021743774414
time for _add_prioritized_parameter DOXY is: 0.13699984550476074
--------------------------------------------------
Total time: 5.987985610961914
time_preparations              0.019999980926513672
time_list_group_data:          0.054000139236450195
time_list_calc_integ:          0.09900188446044922
time_list_add_row:             2.508995532989502
time_all_calculations:         5.664985656738281
time_iterator:                 0.0
time_add_data:                 0.24899983406066895
Done adding integrated_calc "CPHL_INTEG_CALC" using parameter "CPHL_BTL"
time for integrated_calc "CPHL_INTEG_CALC" using parameter "CPHL_BTL is: 5.987985610961914
Saving data to: ..//workspaces/a96fda30-386a-44bf-ac5c-48c36893fa10/input_data/exports/all_data.txt
   status  loaded                                           filename
0       0       0    chlorophyll_integrated_2015_2016_row_format.txt
1       0       0  chlorophyll_sharkweb_data_chlorophyll_wb_2007-...
2       0       0  physicalchemicalmodel_110001_PROFILER_alldepth...
3       0       0  physicalchemicalmodel_120004_PROFILER_alldepth...
4       1       1  physicalchemical_sharkweb_data_fyskem_wb_2007-...
5       0       0                  phytoplankton_2016_row_format.txt
6       0       0  phytoplankton_sharkweb_data_biovolume_wb_2007-...
7       0       0  phytoplankton_sharkweb_data_biovolume_wb_2013-...
8       0       0                   zoobenthos_2016_row_format_2.txt
9       0       0  zoobenthos_sharkweb_data_BQIm_wb_2007-2017_201...

In [88]:
data_handler.physical_chemical.column_data.keys()


Out[88]:
dict_keys(['..//workspaces/1e4ae94f-b7b1-4617-8584-60db4b706938/input_data/raw_data/sharkweb_data_fyskem_wb_2007-2017_20180320.txt'])

In [218]:
visit_id = '58.9113311.187502017-08-0111:40'
par_boolean = ~all_data['CPHL_BTL'].isnull() 

depth_boolean = (all_data['DEPH'] >= 0) & \
                (all_data['DEPH'] <= 10)
    
df = all_data.loc[par_boolean & depth_boolean, :] 

group_df = df['CPHL_BTL'].groupby(df['visit_id_str'])

In [72]:



---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-72-fc4e5a765e55> in <module>()
----> 1 data_handler.physical_chemical

NameError: name 'data_handler' is not defined

In [ ]:


In [ ]:


In [ ]:


In [61]:
ws_object.dtype_settings.get_active_paths_with_data_type()


Out[61]:
[('..//workspaces/1e4ae94f-b7b1-4617-8584-60db4b706938/input_data/raw_data/sharkweb_data_BQIm_wb_2007-2017_20180320.txt',
  'zooben'),
 ('..//workspaces/1e4ae94f-b7b1-4617-8584-60db4b706938/input_data/raw_data/sharkweb_data_biovolume_wb_2007-2012_20180320.txt',
  'pp'),
 ('..//workspaces/1e4ae94f-b7b1-4617-8584-60db4b706938/input_data/raw_data/sharkweb_data_biovolume_wb_2013-2017_20180320.txt',
  'pp'),
 ('..//workspaces/1e4ae94f-b7b1-4617-8584-60db4b706938/input_data/raw_data/sharkweb_data_chlorophyll_wb_2007-2017_20180320.txt',
  'chlorophyll'),
 ('..//workspaces/1e4ae94f-b7b1-4617-8584-60db4b706938/input_data/raw_data/sharkweb_data_fyskem_wb_2007-2017_20180320.txt',
  'phyche')]

In [98]:



Out[98]:
AMON BIOV_CONC_ALL BQIm CPHL_BTL CPHL_INTEG DEPH DIN DOXY_BTL DOXY_CTD LATIT_DD ... source_SALT TEMP Q_TEMP source_TEMP DOXY Q_DOXY source_DOXY CPHL_INTEG_CALC CPHL_INTEG_CALC_depths CPHL_INTEG_CALC_values
index_column
5778 0.93 NaN NaN 2.1 NaN 0.5 1.16 NaN 5.72 58.91133 ... SALT_CTD 19.50 TEMP_BTL 5.72 DOXY_CTD NaN
5779 46.39 NaN NaN 22.7 NaN 7.5 46.59 NaN 5.17 58.91133 ... SALT_CTD 19.88 R TEMP_CTD 5.17 DOXY_CTD NaN

2 rows × 71 columns


In [101]:
all_data.columns


Out[101]:
Index(['AMON', 'BIOV_CONC_ALL', 'BQIm', 'CPHL_BTL', 'CPHL_INTEG', 'DEPH',
       'DIN', 'DOXY_BTL', 'DOXY_CTD', 'LATIT_DD', 'LONGI_DD', 'MNDEP', 'MXDEP',
       'MYEAR', 'NTOT', 'NTRA', 'NTRI', 'NTRZ', 'PHOS', 'PTOT', 'Q_AMON',
       'Q_BIOV_CONC_ALL', 'Q_BQIm', 'Q_CPHL_INTEG', 'Q_DOXY_BTL', 'Q_DOXY_CTD',
       'Q_NTOT', 'Q_NTRA', 'Q_NTRI', 'Q_NTRZ', 'Q_PHOS', 'Q_PTOT',
       'Q_SALT_BTL', 'Q_SALT_CTD', 'Q_SECCHI', 'Q_TEMP_BTL', 'Q_TEMP_CTD',
       'SALT_BTL', 'SALT_CTD', 'SDATE', 'SEA_BASIN', 'SECCHI', 'SERNO',
       'SHARKID_MD5', 'SHIPC', 'STATN', 'STIME', 'TEMP_BTL', 'TEMP_CTD',
       'VISS_EU_CD', 'WATER_BODY_NAME', 'WATER_DISTRICT', 'WATER_TYPE_AREA',
       'WLTYP', 'origin_dtype', 'origin_file_path', 'MONTH', 'YEAR',
       'visit_id_str', 'SALT', 'Q_SALT', 'source_SALT', 'TEMP', 'Q_TEMP',
       'source_TEMP', 'DOXY', 'Q_DOXY', 'source_DOXY', 'CPHL_INTEG_CALC',
       'CPHL_INTEG_CALC_depths', 'CPHL_INTEG_CALC_values'],
      dtype='object')

In [ ]:


In [59]:
m = core.ParameterMapping()

In [60]:
par = 'Chlorophyll-a bottle (ug/l)'
m.get_parameter_mapping([par])


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
D:\Utveckling\git\ekostat_calculator\core\mapping.py in get(self, key)
     97         try:
---> 98             return getattr(self, key.lower())
     99         except:

AttributeError: 'ParameterMapping' object has no attribute 'chlorophyll-a bottle (ug/l)'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
D:\Utveckling\git\ekostat_calculator\core\mapping.py in get(self, key)
    100             try:
--> 101                 return getattr(self, key)
    102             except:

AttributeError: 'ParameterMapping' object has no attribute 'Chlorophyll-a bottle (ug/l)'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
<ipython-input-60-bee034cf1970> in <module>()
      1 par = 'Chlorophyll-a bottle (ug/l)'
----> 2 m.get_parameter_mapping([par])

D:\Utveckling\git\ekostat_calculator\core\mapping.py in get_parameter_mapping(self, para_list, ext_list)
    232     #==========================================================================
    233     def get_parameter_mapping(self, para_list, ext_list=False):
--> 234         return self.get_mapping_dict(para_list)
    235 
    236     #==========================================================================

D:\Utveckling\git\ekostat_calculator\core\mapping.py in get_mapping_dict(self, key_list)
    116     #==========================================================================
    117     def get_mapping_dict(self, key_list):
--> 118         return dict(list((key, self.get(key)) for key in key_list))
    119 
    120     #==========================================================================

D:\Utveckling\git\ekostat_calculator\core\mapping.py in <genexpr>(.0)
    116     #==========================================================================
    117     def get_mapping_dict(self, key_list):
--> 118         return dict(list((key, self.get(key)) for key in key_list))
    119 
    120     #==========================================================================

D:\Utveckling\git\ekostat_calculator\core\mapping.py in get(self, key)
    101                 return getattr(self, key)
    102             except:
--> 103                 return getattr(self, 'SE' + key)
    104 
    105     #==========================================================================

AttributeError: 'ParameterMapping' object has no attribute 'SEChlorophyll-a bottle (ug/l)'

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: