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


D:\github\ekostat_calculator

In [2]:
import pandas as pd
import numpy as np
import json
import timeit

import core
import importlib
importlib.reload(core)
import logging
importlib.reload(core) 
try:
    logging.shutdown()
    importlib.reload(logging)
except:
    pass
from event_handler import EventHandler
print(core.__file__)
pd.__version__


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

In [3]:
def print_workspaces():
    request = {'user_id': user_id} 
    respons = ekos.request_workspace_list(request)
    print('')
    print('='*100)
    print('Workspaces for user: {}'.format(user_id)) 
    print('')
    for item in respons['workspaces']:
        print('-'*100)
        for key in sorted(item.keys()):
            print('{}:\t{}'.format(key, item[key]))
        print('')
    print('='*100)
    
    
def print_json(data): 
    json_string = json.dumps(data, indent=2, sort_keys=True)
    print(json_string)

Load directories


In [4]:
root_directory = "../" #os.getcwd()
workspace_directory = root_directory + '/workspaces' 
resource_directory = root_directory + '/resources'
alias = 'lena'
user_id = 'test_user' #kanske ska vara off_line user?
workspace_alias = 'lena_indicator'

Initiate EventHandler


In [144]:
ekos = EventHandler(root_directory)


2018-04-20 16:51:31,444	event_handler.py	64	__init__	DEBUG	Start EventHandler: event_handler
2018-04-20 16:51:31,449	event_handler.py	65	__init__	DEBUG	
2018-04-20 16:51:31,458	event_handler.py	66	__init__	INFO	TEST info logger
2018-04-20 16:51:31,462	event_handler.py	67	__init__	WARNING	TEST warning logger
2018-04-20 16:51:31,472	event_handler.py	68	__init__	ERROR	TEST error logger
2018-04-20 16:51:31,476	event_handler.py	69	__init__	DEBUG	TEST debug logger
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
dict_keys(['main_event_handler', 'subset_30062c90-2a60-4ee1-9944-f00329db1174', 'subset_default_subset', 'workspace_147f5d47-773c-43f0-b337-57208718d0cf'])
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
event_handler _ main_event_handler

Load existing workspace


In [145]:
ekos.load_workspace(user_id, alias = workspace_alias)
# Här får jag ofta felmeddelande:
# AttributeError: module 'core' has no attribute 'ParameterMapping'


2018-04-20 16:51:34,559	event_handler.py	1483	load_workspace	DEBUG	Trying to load workspace "147f5d47-773c-43f0-b337-57208718d0cf" with alias "lena_indicator"
====================================================================================================
Initiating WorkSpace: ..//workspaces/147f5d47-773c-43f0-b337-57208718d0cf
Parent directory is: ..//workspaces
Resource directory is: ..//resources
=== 30062c90-2a60-4ee1-9944-f00329db1174
status ['editable', 'readable', 'deleted']
!!! A
!!! 30062c90-2a60-4ee1-9944-f00329db1174
!!! ..//workspaces/147f5d47-773c-43f0-b337-57208718d0cf/subsets
----------------------------------------------------------------------------------------------------
Initiating Subset: ..//workspaces/147f5d47-773c-43f0-b337-57208718d0cf/subsets/30062c90-2a60-4ee1-9944-f00329db1174
===
..//workspaces/147f5d47-773c-43f0-b337-57208718d0cf/subsets/30062c90-2a60-4ee1-9944-f00329db1174
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/147f5d47-773c-43f0-b337-57208718d0cf/subsets/30062c90-2a60-4ee1-9944-f00329db1174/step_1
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/147f5d47-773c-43f0-b337-57208718d0cf/subsets/30062c90-2a60-4ee1-9944-f00329db1174/step_2
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/147f5d47-773c-43f0-b337-57208718d0cf/subsets/30062c90-2a60-4ee1-9944-f00329db1174/step_3
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
dict_keys(['main_event_handler', 'subset_30062c90-2a60-4ee1-9944-f00329db1174', 'subset_default_subset', 'workspace_147f5d47-773c-43f0-b337-57208718d0cf'])
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
30062c90-2a60-4ee1-9944-f00329db1174 _ main_event_handler
30062c90-2a60-4ee1-9944-f00329db1174 _ subset_30062c90-2a60-4ee1-9944-f00329db1174
=== default_subset
!!! default_subset
!!! default_subset
!!! ..//workspaces/147f5d47-773c-43f0-b337-57208718d0cf/subsets
----------------------------------------------------------------------------------------------------
Initiating Subset: ..//workspaces/147f5d47-773c-43f0-b337-57208718d0cf/subsets/default_subset
===
..//workspaces/147f5d47-773c-43f0-b337-57208718d0cf/subsets/default_subset
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/147f5d47-773c-43f0-b337-57208718d0cf/subsets/default_subset/step_1
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/147f5d47-773c-43f0-b337-57208718d0cf/subsets/default_subset/step_2
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/147f5d47-773c-43f0-b337-57208718d0cf/subsets/default_subset/step_3
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
dict_keys(['main_event_handler', 'subset_30062c90-2a60-4ee1-9944-f00329db1174', 'subset_default_subset', 'workspace_147f5d47-773c-43f0-b337-57208718d0cf'])
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
default_subset _ main_event_handler
default_subset _ subset_30062c90-2a60-4ee1-9944-f00329db1174
default_subset _ subset_default_subset
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/147f5d47-773c-43f0-b337-57208718d0cf/step_0
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
dict_keys(['main_event_handler', 'subset_30062c90-2a60-4ee1-9944-f00329db1174', 'subset_default_subset', 'workspace_147f5d47-773c-43f0-b337-57208718d0cf'])
¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
147f5d47-773c-43f0-b337-57208718d0cf _ main_event_handler
147f5d47-773c-43f0-b337-57208718d0cf _ subset_30062c90-2a60-4ee1-9944-f00329db1174
147f5d47-773c-43f0-b337-57208718d0cf _ subset_default_subset
147f5d47-773c-43f0-b337-57208718d0cf _ workspace_147f5d47-773c-43f0-b337-57208718d0cf
Out[145]:
True

In [146]:
workspace_uuid = ekos.get_unique_id_for_alias(user_id, workspace_alias)
print(workspace_uuid)


147f5d47-773c-43f0-b337-57208718d0cf

In [8]:
#ekos.import_default_data(user_id, workspace_alias = workspace_alias, force = True)

Load all data in workspace


In [9]:
#ekos.get_workspace(user_id, unique_id = workspace_uuid, alias = workspace_alias).delete_alldata_export()

In [147]:
#%%timeit
ekos.load_data(user_id = user_id, unique_id = workspace_uuid, force = True)
w = ekos.get_workspace(user_id, unique_id = workspace_uuid, alias = workspace_alias)
len(w.data_handler.get_all_column_data_df())


2018-04-20 16:51:40,438	workspaces.py	1417	load_all_data	DEBUG	data has been loaded from existing all_data.pickle file.
2018-04-20 16:51:40,438	event_handler.py	919	get_workspace	DEBUG	Getting workspace "147f5d47-773c-43f0-b337-57208718d0cf" with alias "lena_indicator"
Out[147]:
101465

Step 0

Apply first data filter


In [148]:
w.apply_data_filter(step = 0) # This sets the first level of data filter in the IndexHandler


add filter for step: step_0, type area: None, indicator: None, level: None
---------------------------------------------------------------------------
UserWarning                               Traceback (most recent call last)
<ipython-input-148-15c502314a78> in <module>()
----> 1 w.apply_data_filter(step = 0) # This sets the first level of data filter in the IndexHandler

D:\github\ekostat_calculator\core\workspaces.py in apply_data_filter(self, step, subset)
   1029             filter_object = step_object.get_data_filter_object()
   1030 
-> 1031         all_ok = self.index_handler.add_filter(filter_object=filter_object, step=step, subset=subset)
   1032         return all_ok
   1033 

D:\github\ekostat_calculator\core\index_handler.py in add_filter(self, filter_object, subset, step, type_area, indicator, level)
    299         self._add_boolean_to_dict(step_0, subset, step_1, step_2, type_area, indicator, level,
    300                                   filter_object=filter_object,
--> 301                                   df=df)
    302 
    303 

D:\github\ekostat_calculator\core\index_handler.py in _add_boolean_to_dict(self, step_0, subset, step_1, step_2, type_area, indicator, level, filter_object, df)
    122         for key in boolean_dict_keys:
    123             if not key in use_keys.get('keys_in_booleans'):
--> 124                 raise UserWarning(key,'should be included in IndexHandler, perhaps we are jumping to far ahead?')
    125 
    126             if key in use_keys.get('keys')[0]:

UserWarning: ('step_0', 'should be included in IndexHandler, perhaps we are jumping to far ahead?')

Step 1 Set subset filter


In [12]:
subset_uuid = ekos.get_unique_id_for_alias(user_id, workspace_alias = workspace_alias, subset_alias = 'A')
print(w.get_subset_list())

f1 = w.get_data_filter_object(subset = subset_uuid, step=1) 
print(f1.include_list_filter)

w.apply_data_filter(subset = subset_uuid, step = 1)

df_step1 = w.get_filtered_data(step = 1, subset = subset_uuid)
print(df_step1.columns)
df_step1[['SDATE', 'YEAR', 'MONTH', 'POSITION', 'VISS_EU_CD', 'WATER_TYPE_AREA', 'DEPH', 'MNDEP', 'MXDEP','BQIm']].dropna(subset = ['BQIm'])


2018-04-20 12:42:32,694	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_1
['30062c90-2a60-4ee1-9944-f00329db1174', 'default_subset']
{'MYEAR': ['2013', '2014', '2015', '2016', '2017', '2018', '2019'], 'STATN': [], 'WATER_BODY': []}
add filter for step: step_1, type area: None, indicator: None, level: None
Index(['Unnamed: 0', 'AMON', 'BIOV_CONC_ALL', 'BQIm', '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', 'MONTH', 'YEAR', 'POSITION'],
      dtype='object')
Out[12]:
SDATE YEAR MONTH POSITION VISS_EU_CD WATER_TYPE_AREA DEPH MNDEP MXDEP BQIm
94754 2017-06-28 2017 6 59.01_11.44 SE590020-114520 02 - Västkustens fjordar NaN 9.6 9.6 6.861810
94755 2017-06-28 2017 6 59.01_11.44 SE590020-114520 02 - Västkustens fjordar NaN 9.6 9.6 4.985970
94756 2017-06-28 2017 6 59.03_11.42 SE590860-113810 02 - Västkustens fjordar NaN 21.6 21.6 2.844030
94757 2017-06-28 2017 6 59.03_11.42 SE590860-113810 02 - Västkustens fjordar NaN 21.6 21.6 2.316120
94758 2017-06-28 2017 6 59.07_11.39 SE590860-113810 02 - Västkustens fjordar NaN 35.7 35.7 0.667618
94759 2017-06-28 2017 6 59.11_11.31 SE590860-113810 02 - Västkustens fjordar NaN 33.6 33.6 12.692900
94760 2017-06-28 2017 6 59.11_11.31 SE590860-113810 02 - Västkustens fjordar NaN 33.3 33.3 11.458700
94761 2017-06-28 2017 6 59.08_11.22 SE590900-112300 02 - Västkustens fjordar NaN 31.2 31.2 11.670900
94762 2017-06-28 2017 6 59.08_11.22 SE590900-112300 02 - Västkustens fjordar NaN 31.2 31.2 12.202500
94763 2017-06-28 2017 6 59.09_11.22 SE590900-112300 02 - Västkustens fjordar NaN 34 34 13.570800
94764 2017-06-28 2017 6 59.09_11.22 SE590900-112300 02 - Västkustens fjordar NaN 34 34 13.522100
94765 2017-06-28 2017 6 58.97_11.09 SE590670-111380 01n - Västkustens inre kustvatten NaN 61 61 12.179000
94766 2017-06-28 2017 6 58.97_11.09 SE590670-111380 01n - Västkustens inre kustvatten NaN 61 61 11.601800
94767 2017-06-02 2017 6 56.56_12.82 SE563330-124600 05 - Södra Hallands och norra Öresunds kustvatten NaN 16 16 4.857090
94768 2017-06-02 2017 6 56.56_12.82 SE563330-124600 05 - Södra Hallands och norra Öresunds kustvatten NaN 16 16 6.748780
94769 2017-06-02 2017 6 56.56_12.82 SE563330-124600 05 - Södra Hallands och norra Öresunds kustvatten NaN 16 16 5.344290
94770 2017-06-02 2017 6 56.56_12.82 SE563330-124600 05 - Södra Hallands och norra Öresunds kustvatten NaN 16 16 7.503390
94771 2017-06-02 2017 6 56.56_12.82 SE563330-124600 05 - Södra Hallands och norra Öresunds kustvatten NaN 16 16 4.536430
94772 2017-06-01 2017 6 59.60_18.94 SE593500-190000 12n - Östergötlands och Stockholms skärgård. M... NaN 24 24 11.270000
94773 2017-05-31 2017 5 59.54_18.96 SE593500-190000 12n - Östergötlands och Stockholms skärgård. M... NaN 21 21 7.381660
94774 2017-05-31 2017 5 59.51_19.00 SE593500-190000 12n - Östergötlands och Stockholms skärgård. M... NaN 59.5 59.5 9.612610
94775 2017-05-30 2017 5 56.57_12.61 SE563000-123351 05 - Södra Hallands och norra Öresunds kustvatten NaN 22 22 8.638710
94776 2017-05-30 2017 5 56.57_12.61 SE563000-123351 05 - Södra Hallands och norra Öresunds kustvatten NaN 22 22 8.557110
94777 2017-05-30 2017 5 56.57_12.61 SE563000-123351 05 - Södra Hallands och norra Öresunds kustvatten NaN 22 22 8.848160
94778 2017-05-30 2017 5 56.57_12.61 SE563000-123351 05 - Södra Hallands och norra Öresunds kustvatten NaN 22 22 8.042580
94779 2017-05-30 2017 5 56.57_12.61 SE563000-123351 05 - Södra Hallands och norra Öresunds kustvatten NaN 22 22 10.343300
94780 2017-05-30 2017 5 56.56_12.72 SE563330-124600 05 - Södra Hallands och norra Öresunds kustvatten NaN 20 20 9.926600
94781 2017-05-30 2017 5 56.56_12.72 SE563330-124600 05 - Södra Hallands och norra Öresunds kustvatten NaN 20 20 9.912360
94782 2017-05-30 2017 5 56.56_12.72 SE563330-124600 05 - Södra Hallands och norra Öresunds kustvatten NaN 20 20 9.426740
94783 2017-05-30 2017 5 56.56_12.72 SE563330-124600 05 - Södra Hallands och norra Öresunds kustvatten NaN 20 20 10.446600
... ... ... ... ... ... ... ... ... ... ...
96866 2013-05-06 2013 5 56.03_12.69 SE562290-124131 06 - Öresunds kustvatten NaN 29 29 12.613500
96867 2013-05-06 2013 5 56.03_12.69 SE562290-124131 06 - Öresunds kustvatten NaN 29 29 12.071600
96868 2013-05-06 2013 5 56.03_12.69 SE562290-124131 06 - Öresunds kustvatten NaN 29 29 12.137100
96869 2013-05-03 2013 5 58.93_11.14 SE585600-110880 01n - Västkustens inre kustvatten NaN 27 27 12.169300
96870 2013-05-03 2013 5 58.93_11.14 SE585600-110880 01n - Västkustens inre kustvatten NaN 27 27 13.209700
96871 2013-05-03 2013 5 58.93_11.14 SE585600-110880 01n - Västkustens inre kustvatten NaN 27 27 13.109400
96872 2013-05-02 2013 5 58.35_11.40 SE582000-112350 01n - Västkustens inre kustvatten NaN 32 32 11.794600
96873 2013-05-02 2013 5 58.35_11.40 SE582000-112350 01n - Västkustens inre kustvatten NaN 32 32 11.704300
96874 2013-05-02 2013 5 58.35_11.40 SE582000-112350 01n - Västkustens inre kustvatten NaN 32 32 11.474500
96875 2013-05-02 2013 5 58.97_11.09 SE590670-111380 01n - Västkustens inre kustvatten NaN 61 61 12.435400
96876 2013-05-02 2013 5 58.97_11.09 SE590670-111380 01n - Västkustens inre kustvatten NaN 61 61 11.012300
96877 2013-05-02 2013 5 58.97_11.09 SE590670-111380 01n - Västkustens inre kustvatten NaN 61 61 12.547400
96878 2013-05-02 2013 5 58.80_11.16 SE584725-111050 01n - Västkustens inre kustvatten NaN 46 46 11.486100
96879 2013-05-02 2013 5 58.80_11.16 SE584725-111050 01n - Västkustens inre kustvatten NaN 46 46 10.438500
96880 2013-05-02 2013 5 58.80_11.16 SE584725-111050 01n - Västkustens inre kustvatten NaN 46 46 11.613500
96881 2013-05-02 2013 5 58.70_11.18 SE584200-105901 03 - Västkustens yttre kustvatten. Skagerrak NaN 41 41 12.999100
96882 2013-05-02 2013 5 58.70_11.18 SE584200-105901 03 - Västkustens yttre kustvatten. Skagerrak NaN 41 41 13.338500
96883 2013-05-02 2013 5 58.70_11.18 SE584200-105901 03 - Västkustens yttre kustvatten. Skagerrak NaN 41 41 13.439500
96884 2013-05-02 2013 5 58.73_11.17 SE584400-116000 01n - Västkustens inre kustvatten NaN 31 31 12.741700
96885 2013-05-02 2013 5 58.73_11.17 SE584400-116000 01n - Västkustens inre kustvatten NaN 31 31 13.293900
96886 2013-05-02 2013 5 58.73_11.17 SE584400-116000 01n - Västkustens inre kustvatten NaN 31 31 13.076300
96887 2013-05-02 2013 5 58.38_11.15 SE582700-110451 03 - Västkustens yttre kustvatten. Skagerrak NaN 48 48 12.520100
96888 2013-05-02 2013 5 58.38_11.15 SE582700-110451 03 - Västkustens yttre kustvatten. Skagerrak NaN 48 48 12.158700
96889 2013-05-02 2013 5 58.38_11.15 SE582700-110451 03 - Västkustens yttre kustvatten. Skagerrak NaN 48 48 12.023600
96890 2013-05-02 2013 5 58.34_11.36 SE580500-111801 03 - Västkustens yttre kustvatten. Skagerrak NaN 28 28 10.701500
96891 2013-05-02 2013 5 58.34_11.36 SE580500-111801 03 - Västkustens yttre kustvatten. Skagerrak NaN 28 28 11.404400
96892 2013-05-02 2013 5 58.34_11.36 SE580500-111801 03 - Västkustens yttre kustvatten. Skagerrak NaN 28 28 10.524400
96893 2013-05-02 2013 5 58.61_11.14 SE584200-105901 03 - Västkustens yttre kustvatten. Skagerrak NaN 48 48 10.848100
96894 2013-05-02 2013 5 58.61_11.14 SE584200-105901 03 - Västkustens yttre kustvatten. Skagerrak NaN 48 48 7.732150
96895 2013-05-02 2013 5 58.61_11.14 SE584200-105901 03 - Västkustens yttre kustvatten. Skagerrak NaN 48 48 10.384400

2142 rows × 10 columns

Step 2


In [13]:
w.get_step_object(step = 2, subset = subset_uuid).load_indicator_settings_filters()

w.get_step_object(step = 2, subset = subset_uuid).indicator_data_filter_settings


Out[13]:
{'biov': <core.filters.SettingsDataFilter at 0x487dd68>,
 'bqi': <core.filters.SettingsDataFilter at 0x4885a58>,
 'chl': <core.filters.SettingsDataFilter at 0x4885b00>,
 'din_winter': <core.filters.SettingsDataFilter at 0x4885b38>,
 'dip_winter': <core.filters.SettingsDataFilter at 0x4885ba8>,
 'ntot_summer': <core.filters.SettingsDataFilter at 0x4885be0>,
 'ntot_winter': <core.filters.SettingsDataFilter at 0x4885c50>,
 'oxygen': <core.filters.SettingsDataFilter at 0x4885630>,
 'ptot_summer': <core.filters.SettingsDataFilter at 0x4885780>,
 'ptot_winter': <core.filters.SettingsDataFilter at 0x4885748>,
 'secchi': <core.filters.SettingsDataFilter at 0x48856a0>}

In [14]:
w.get_step_object(step = 2, subset = subset_uuid).indicator_ref_settings


Out[14]:
{'biov': <core.filters.SettingsRef at 0x48856d8>,
 'bqi': <core.filters.SettingsRef at 0x4885668>,
 'chl': <core.filters.SettingsRef at 0x48857b8>,
 'din_winter': <core.filters.SettingsRef at 0x4885828>,
 'dip_winter': <core.filters.SettingsRef at 0x4885860>,
 'ntot_summer': <core.filters.SettingsRef at 0x4885898>,
 'ntot_winter': <core.filters.SettingsRef at 0x48858d0>,
 'oxygen': <core.filters.SettingsRef at 0x4885940>,
 'ptot_summer': <core.filters.SettingsRef at 0x48859b0>,
 'ptot_winter': <core.filters.SettingsRef at 0x4885978>,
 'secchi': <core.filters.SettingsRef at 0x4885a20>}

In [15]:
w.get_step_object(step = 2, subset = subset_uuid)._indicator_setting_files['oxygen']


Out[15]:
<core.filters.SettingsFile at 0xa511ac8>

In [16]:
indicator_list = w.get_available_indicators(subset= 'A', step=2)


2018-04-20 12:42:37,728	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
2018-04-20 12:42:37,829	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
subset A
subset A
2018-04-20 12:42:37,934	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
2018-04-20 12:42:38,040	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
subset A
subset A
2018-04-20 12:42:38,194	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
2018-04-20 12:42:38,375	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
subset A
subset A
2018-04-20 12:42:38,462	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
2018-04-20 12:42:38,578	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
subset A
subset A
2018-04-20 12:42:38,675	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
2018-04-20 12:42:38,811	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
"['TOT_COVER_ALL' 'SALT'] not in index"
subset A
subset A
2018-04-20 12:42:38,944	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
2018-04-20 12:42:39,068	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
subset A
"['CPHL_INTEG_CALC'] not in index"
subset A

Apply indicator filter


In [17]:
wb_list = df_step1.VISS_EU_CD.unique()
print('number of waterbodies in step 1: {}'.format(len(wb_list)))
typeA_list = [row.split('-')[0].strip().lstrip('0') for row in df_step1.WATER_TYPE_AREA.unique()]
print('number of type areas in step 1: {}'.format(len(typeA_list)))

#list(zip(typeA_list, df_step1.WATER_TYPE_AREA.unique()))
indicator_list = ['oxygen','bqi','din_winter','ntot_summer', 'ntot_winter', 'dip_winter', 'ptot_summer', 'ptot_winter', 'biov', 'chl', 'secchi']
for indicator in indicator_list:
    for type_area in typeA_list:
        w.apply_indicator_data_filter(step = 2, 
                              subset = subset_uuid, 
                              indicator = indicator,
                              type_area = type_area)


number of waterbodies in step 1: 310
number of type areas in step 1: 27
add filter for step: step_2, type area: 14, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 2, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 9, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 22, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 20, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 18, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 12n, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 13, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 12s, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 1n, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 25, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 21, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 7, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 5, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 16, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 23, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 3, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 1s, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 4, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 6, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 8, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 10, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 24, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 17, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 15, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 19, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 11, indicator: oxygen, level: None
Water body None
add filter for step: step_2, type area: 14, indicator: bqi, level: None
Water body None
RESULT [5, 60]
add filter for step: step_2, type area: 2, indicator: bqi, level: None
Water body None
RESULT [[5, 20], [20, 500]]
add filter for step: step_2, type area: 9, indicator: bqi, level: None
Water body None
RESULT [5, 60]
add filter for step: step_2, type area: 22, indicator: bqi, level: None
Water body None
RESULT [5, 500]
add filter for step: step_2, type area: 20, indicator: bqi, level: None
Water body None
RESULT [5, 500]
add filter for step: step_2, type area: 18, indicator: bqi, level: None
Water body None
RESULT [5, 500]
add filter for step: step_2, type area: 12n, indicator: bqi, level: None
Water body None
RESULT []
add filter for step: step_2, type area: 13, indicator: bqi, level: None
Water body None
RESULT [5, 60]
add filter for step: step_2, type area: 12s, indicator: bqi, level: None
Water body None
RESULT []
add filter for step: step_2, type area: 1n, indicator: bqi, level: None
Water body None
RESULT []
add filter for step: step_2, type area: 25, indicator: bqi, level: None
Water body None
RESULT [[5, 20], [20, 500]]
add filter for step: step_2, type area: 21, indicator: bqi, level: None
Water body None
RESULT [5, 500]
add filter for step: step_2, type area: 7, indicator: bqi, level: None
Water body None
RESULT [5, 60]
add filter for step: step_2, type area: 5, indicator: bqi, level: None
Water body None
RESULT [[5, 20], [20, 500]]
add filter for step: step_2, type area: 16, indicator: bqi, level: None
Water body None
RESULT [5, 500]
add filter for step: step_2, type area: 23, indicator: bqi, level: None
Water body None
RESULT [5, 500]
add filter for step: step_2, type area: 3, indicator: bqi, level: None
Water body None
RESULT [[5, 20], [20, 500]]
add filter for step: step_2, type area: 1s, indicator: bqi, level: None
Water body None
RESULT []
add filter for step: step_2, type area: 4, indicator: bqi, level: None
Water body None
RESULT [[5, 20], [20, 500]]
add filter for step: step_2, type area: 6, indicator: bqi, level: None
Water body None
RESULT [[5, 20], [20, 500]]
add filter for step: step_2, type area: 8, indicator: bqi, level: None
Water body None
RESULT [5, 60]
add filter for step: step_2, type area: 10, indicator: bqi, level: None
Water body None
RESULT [5, 60]
add filter for step: step_2, type area: 24, indicator: bqi, level: None
Water body None
RESULT [5, 60]
add filter for step: step_2, type area: 17, indicator: bqi, level: None
Water body None
RESULT [5, 500]
add filter for step: step_2, type area: 15, indicator: bqi, level: None
Water body None
RESULT [5, 60]
add filter for step: step_2, type area: 19, indicator: bqi, level: None
Water body None
RESULT [5, 500]
add filter for step: step_2, type area: 11, indicator: bqi, level: None
Water body None
RESULT [5, 60]
add filter for step: step_2, type area: 14, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 2, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 9, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 22, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 20, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 18, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 12n, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 13, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 12s, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 1n, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 25, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 21, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 7, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 5, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 16, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 23, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 3, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 1s, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 4, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 6, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 8, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 10, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 24, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 17, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 15, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 19, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 11, indicator: din_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 14, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 2, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 9, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 22, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 20, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 18, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 12n, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 13, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 12s, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 1n, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 25, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 21, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 7, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 5, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 16, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 23, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 3, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 1s, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 4, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 6, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 8, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 10, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 24, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 17, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 15, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 19, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 11, indicator: ntot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 14, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 2, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 9, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 22, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 20, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 18, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 12n, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 13, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 12s, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 1n, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 25, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 21, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 7, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 5, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 16, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 23, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 3, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 1s, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 4, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 6, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 8, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 10, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 24, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 17, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 15, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 19, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 11, indicator: ntot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 14, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 2, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 9, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 22, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 20, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 18, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 12n, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 13, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 12s, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 1n, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 25, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 21, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 7, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 5, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 16, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 23, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 3, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 1s, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 4, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 6, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 8, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 10, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 24, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 17, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 15, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 19, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 11, indicator: dip_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 14, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 2, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 9, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 22, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 20, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 18, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 12n, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 13, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 12s, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 1n, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 25, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 21, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 7, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 5, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 16, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 23, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 3, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 1s, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 4, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 6, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 8, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 10, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 24, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 17, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 15, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 19, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 11, indicator: ptot_summer, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 14, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 2, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 9, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 22, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 20, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 18, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 12n, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 13, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 12s, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 1n, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 25, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 21, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 7, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 5, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 16, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 23, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 3, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 1s, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 4, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 6, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 8, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 10, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 24, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 17, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 15, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 19, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 11, indicator: ptot_winter, level: None
Water body None
RESULT [0, 10]
add filter for step: step_2, type area: 14, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 2, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 9, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 22, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 20, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 18, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 12n, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 13, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 12s, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 1n, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 25, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 21, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 7, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 5, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 16, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 23, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 3, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 1s, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 4, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 6, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 8, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 10, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 24, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 17, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 15, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 19, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 11, indicator: biov, level: None
Water body None
add filter for step: step_2, type area: 14, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 2, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 9, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 22, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 20, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 18, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 12n, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 13, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 12s, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 1n, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 25, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 21, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 7, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 5, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 16, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 23, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 3, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 1s, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 4, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 6, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 8, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 10, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 24, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 17, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 15, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 19, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 11, indicator: chl, level: None
Water body None
add filter for step: step_2, type area: 14, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 2, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 9, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 22, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 20, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 18, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 12n, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 13, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 12s, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 1n, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 25, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 21, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 7, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 5, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 16, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 23, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 3, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 1s, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 4, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 6, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 8, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 10, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 24, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 17, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 15, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 19, indicator: secchi, level: None
Water body None
add filter for step: step_2, type area: 11, indicator: secchi, level: None
Water body None

In [122]:
wb_list


Out[122]:
array(['SE584340-174401', 'SE581700-113000', 'SE561400-161201',
       'SE654470-222700', 'SE633000-195000', 'SE625180-181655',
       'SE654820-222660', 'SE625000-180075', 'SE628750-183300',
       'SE631346-184241', 'SE631646-185280', 'SE583730-164501',
       'SE582705-163350', 'SE582050-165820', 'SE582147-111771',
       'SE580688-114860', 'SE575500-113750', 'SE574050-114780',
       'SE625900-174360', 'SE630383-183500', 'SE633550-200700',
       'SE636570-203590', 'SE633043-193300', 'SE552170-130626',
       'SE562000-123800', 'SE591400-183200', 'SE591200-183600',
       'SE592040-184000', 'SE592245-184400', 'SE600740-183460',
       'SE601070-182870', 'SE631610-184500', 'SE625500-175153',
       'SE622126-172430', 'SE622339-172190', 'SE652920-222650',
       'SE656620-222480', 'SE656300-222750', 'SE655120-220380',
       'SE655180-218660', 'SE636150-199220', 'SE635040-204196',
       'SE637070-204260', 'SE636910-204040', 'SE602120-181610',
       'SE582000-115270', 'SE575700-114240', 'SE581740-114820',
       'SE563330-124600', 'SE654860-219880', 'SE647050-213980',
       'SE575340-113000', 'SE654500-232000', 'SE652400-223501',
       'SE653900-223280', 'SE582000-112350', 'SE581260-113220',
       'SE574000-114230', 'SE585100-110600', 'SE572540-114801',
       'SE555545-124332', 'SE561005-150250', 'SE580610-113615',
       'SE580325-113500', 'SE580500-114725', 'SE581120-112680',
       'SE581365-112910', 'SE584750-111185', 'SE584890-110950',
       'SE582630-113515', 'SE584450-111445', 'SE584670-111300',
       'SE582150-112530', 'SE585600-110880', 'SE585200-111140',
       'SE583710-111535', 'SE582665-111706', 'SE582850-111760',
       'SE584030-111400', 'SE581853-112736', 'SE582230-112255',
       'SE573500-115150', 'SE571000-184001', 'SE585990-111125',
       'SE570000-120701', 'SE582700-110451', 'SE584200-105901',
       'SE554040-125750', 'SE554500-125001', 'SE575150-162700',
       'SE575370-164220', 'SE573940-163560', 'SE565400-163600',
       'SE570080-163430', 'SE565800-163000', 'SE570340-163710',
       'SE570500-163750', 'SE573500-163500', 'SE563825-161810',
       'SE564250-162500', 'SE659024-162417', 'SE572205-163500',
       'SE571552-162848', 'SE572500-164500', 'SE583718-161687',
       'SE583926-161744', 'SE583000-165600', 'SE560940-151740',
       'SE560500-154880', 'SE560810-153980', 'SE560780-153500',
       'SE560795-154730', 'SE560775-153055', 'SE560700-155801',
       'SE582460-164500', 'SE581520-165000', 'SE560825-144215',
       'SE621688-144133', 'SE560900-145280', 'SE560205-143545',
       'SE581000-164020', 'SE580585-164720', 'SE580735-165296',
       'SE580000-164060', 'SE554800-142001', 'SE562450-122751',
       'SE602400-183190', 'SE603870-181301', 'SE601300-182880',
       'SE603190-174000', 'SE601660-183550', 'SE594100-185690',
       'SE593750-184900', 'SE593820-185500', 'SE593300-183600',
       'SE592420-182210', 'SE590400-174090', 'SE590990-174015',
       'SE658507-162696', 'SE585200-174000', 'SE585345-174950',
       'SE590550-174540', 'SE583970-170280', 'SE584430-170665',
       'SE584227-171600', 'SE584390-172085', 'SE584400-172270',
       'SE584600-173200', 'SE584820-172920', 'SE584905-172980',
       'SE585075-173130', 'SE585040-173535', 'SE584870-174310',
       'SE583875-170270', 'SE584085-171600', 'SE658352-163189',
       'SE591090-182300', 'SE591160-182400', 'SE590385-180890',
       'SE584960-175280', 'SE591050-182740', 'SE590000-183000',
       'SE591300-182800', 'SE594200-192000', 'SE592640-184500',
       'SE593000-190500', 'SE593180-191280', 'SE594845-191240',
       'SE594800-190655', 'SE591655-183200', 'SE591745-182250',
       'SE594670-185500', 'SE594800-190220', 'SE601310-183700',
       'SE601000-183510', 'SE600565-184600', 'SE601300-184180',
       'SE585797-181090', 'SE574931-113131', 'SE561030-122821',
       'SE554810-125240', 'SE552500-124461', 'SE572472-120302',
       'SE572135-120141', 'SE570900-164501', 'SE644150-211000',
       'SE594340-190448', 'SE592400-180800', 'SE593750-183962',
       'SE634110-201920', 'SE634210-202020', 'SE643700-211940',
       'SE645000-212100', 'SE651818-212790', 'SE651475-214300',
       'SE651800-214740', 'SE651500-213108', 'SE645500-212000',
       'SE653176-222000', 'SE728806-179329', 'SE623890-178030',
       'SE622500-172430', 'SE622860-173000', 'SE622000-172300',
       'SE624870-175500', 'SE624615-180500', 'SE624335-180000',
       'SE623810-180350', 'SE623340-175556', 'SE634950-202940',
       'SE590740-174135', 'SE631840-191130', 'SE614165-171500',
       'SE613760-171000', 'SE613500-172500', 'SE613591-171000',
       'SE613500-171000', 'SE613240-171000', 'SE635660-199490',
       'SE574160-113351', 'SE580240-112501', 'SE573300-113801',
       'SE657412-164249', 'SE657608-164193', 'SE595000-185600',
       'SE612303-171075', 'SE622795-174565', 'SE623300-176210',
       'SE630210-187470', 'SE592600-181600', 'SE592575-181770',
       'SE623980-175600', 'SE645000-213500', 'SE604200-174400',
       'SE592790-183000', 'SE637640-204160', 'SE652020-211930',
       'SE644730-210650', 'SE641840-211540', 'SE634230-201605',
       'SE563000-123351', 'SE604250-173000', 'SE611676-171000',
       'SE580000-164500', 'SE590020-114520', 'SE590860-113810',
       'SE590900-112300', 'SE590670-111380', 'SE593500-190000',
       'SE571720-120640', 'SE635300-205251', 'SE582500-113890',
       'SE637310-204860', 'SE634740-203020', 'SE646360-213700',
       'SE643920-211500', 'SE584725-111050', 'SE650280-213110',
       'SE654640-233190', 'SE654575-234250', 'SE562290-124131',
       'SE592000-190500', 'SE570900-121060', 'SE571240-121000',
       'SE564500-122601', 'SE601440-184000', 'SE612791-171130',
       'SE572072-115880', 'SE573322-115478', 'SE572227-115662',
       'SE573044-115355', 'SE572308-115550', 'SE580500-111801',
       'SE574170-190001', 'SE584400-116000', 'SE583625-111300',
       'SE572000-180001', 'SE572350-180930', 'SE583121-171401',
       'SE633400-195000', 'SE611000-171500', 'SE611213-171063',
       'SE611600-171500', 'SE581280-170070', 'SE581240-165220',
       'SE581820-165500', 'SE619690-175690', 'SE612520-172080',
       'SE605660-172380', 'SE622011-146303', 'SE561480-148220',
       'SE561150-147620', 'SE560740-144375', 'SE603000-181500',
       'SE561000-153320', 'SE561000-150390', 'SE560385-154500',
       'SE560200-143175', 'SE654200-222920', 'SE654000-222430',
       'SE650750-213500', 'SE650460-213400', 'SE625416-182696',
       'SE628480-183070', 'SE593500-191660', 'SE593330-192540',
       'SE593000-192000', 'SE611766-171305', 'SE575150-190400',
       'SE654291-224000'], dtype=object)

In [124]:
wb = 'SE572072-115880' 'SE654470-222700'
type_area = '2'#'01s - Västkustens inre kustvatten'
#w.index_handler.booleans['step_0'][subset_uuid]['step_1']['step_2'][type_area]['din_winter']['boolean']

In [125]:
print(w.get_filtered_data(step = 2, subset = subset_uuid, type_area = type_area, indicator = 'din_winter').MONTH.unique())
print(w.get_filtered_data(step = 2, subset = subset_uuid, type_area = type_area, indicator = 'din_winter').DEPH.min(),
        w.get_filtered_data(step = 2, subset = subset_uuid, type_area = type_area, indicator = 'din_winter').DEPH.max())
w.get_filtered_data(step = 2, subset = subset_uuid, type_area = type_area).WATER_TYPE_AREA.unique()


2018-04-20 15:09:56,452	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
2018-04-20 15:09:56,466	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
2018-04-20 15:09:56,503	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
2018-04-20 15:09:56,555	workspaces.py	1304	get_filtered_data	DEBUG	STEP: step_2
[12 11 10  9  8  7  6  5  4  3  2  1]
0.0 246.0
Out[125]:
array(['14 - Östergötlands yttre kustvatten', '02 - Västkustens fjordar',
       '09 - Blekinge skärgård och Kalmarsund. Yttre kustvatten',
       '22 - Norra Bottenviken. Inre kustvatten',
       '20 - Norra Kvarkens inre kustvatten',
       '18 - Norra Bottenhavet. Höga kusten. Inre kustvatten',
       '12n - Östergötlands och Stockholms skärgård. Mellankustvatten',
       '13 - Östergötlands inre kustvatten',
       '12s - Östergötlands och Stockholms skärgård. Mellankustvatten',
       '01n - Västkustens inre kustvatten',
       '25 - Göta älvs- och Nordre älvs estuarie',
       '21 - Norra Kvarkens yttre kustvatten', '07 - Skånes kustvatten',
       '05 - Södra Hallands och norra Öresunds kustvatten',
       '16 - Södra Bottenhavet. Inre kustvatten',
       '23 - Norra Bottenviken. Yttre kustvatten',
       '03 - Västkustens yttre kustvatten. Skagerrak',
       '01s - Västkustens inre kustvatten',
       '04 - Västkustens yttre kustvatten. Kattegatt',
       '06 - Öresunds kustvatten',
       '08 - Blekinge skärgård och Kalmarsund. Inre kustvatten',
       '10 - Ölands och Gotlands kustvatten',
       '24 - Stockholms inre skärgård och Hallsfjärden',
       '17 - Södra Bottenhavet. Yttre kustvatten',
       '15 - Stockholms skärgård. Yttre kustvatten',
       '19 - Norra Bottenhavet. Höga kusten. Yttre kustvatten',
       '11 - Gotlands nordvästra kustvatten'], dtype=object)

In [126]:
w.mapping_objects['quality_element'].cfg['indicators']
[item.strip() for item in w.mapping_objects['quality_element'].cfg['indicators'].loc[indicator][0].split(', ')]


Out[126]:
['BQIm']

Step 3 Load Indicator objects step 3....


In [127]:
w.get_step_object(step = 2, subset = subset_uuid).indicator_tolerance_settings['bqi']


Out[127]:
<core.filters.SettingsTolerance at 0x487df98>

In [128]:
w.get_step_object(step = 3, subset = subset_uuid).indicator_setup(subset_unique_id = subset_uuid) 
#, indicator_list = ['din_winter', 'dip_winter']


IndicatorNutrients
<class 'core.indicators.IndicatorNutrients'>
din_winter
IndicatorNutrients
<class 'core.indicators.IndicatorNutrients'>
ntot_summer
IndicatorNutrients
<class 'core.indicators.IndicatorNutrients'>
ntot_winter
IndicatorNutrients
<class 'core.indicators.IndicatorNutrients'>
dip_winter
IndicatorNutrients
<class 'core.indicators.IndicatorNutrients'>
ptot_summer
IndicatorNutrients
<class 'core.indicators.IndicatorNutrients'>
ptot_winter
IndicatorBQI
<class 'core.indicators.IndicatorBQI'>
bqi
IndicatorOxygen
<class 'core.indicators.IndicatorOxygen'>
oxygen
IndicatorPhytoplankton
<class 'core.indicators.IndicatorPhytoplankton'>
biov
IndicatorSecchi
<class 'core.indicators.IndicatorSecchi'>
secchi

In [129]:
w.get_step_object(step = 3, subset = subset_uuid).indicator_objects[indicator].get_ref_value(type_area = '1s', salinity = 25.0)


Out[129]:
False

In [130]:
indicator= 'bqi'
dw_obj = w.get_step_object(step = 3, subset = subset_uuid).indicator_objects[indicator]

In [131]:
dw_obj.get_water_body_indicator_df(wb)

In [132]:
dw_obj.column_list


Out[132]:
['SDATE',
 'YEAR',
 'MONTH',
 'POSITION',
 'VISS_EU_CD',
 'WATER_TYPE_AREA',
 'BQIm',
 'MNDEP',
 'MXDEP']

In [137]:
df = dw_obj.water_body_indicator_df[wb].dropna(subset = ['BQIm'])
df


Out[137]:
SDATE YEAR MONTH POSITION VISS_EU_CD WATER_TYPE_AREA BQIm MNDEP MXDEP
95125 2016-05-25 2016 5 57.36_11.98 SE572072-115880 01s - Västkustens inre kustvatten 7.54714 8.5 8.5
95126 2016-05-25 2016 5 57.36_11.98 SE572072-115880 01s - Västkustens inre kustvatten 4.31313 8.5 8.5
95127 2016-05-25 2016 5 57.36_11.98 SE572072-115880 01s - Västkustens inre kustvatten 5.53224 8.5 8.5
95128 2016-05-25 2016 5 57.36_11.98 SE572072-115880 01s - Västkustens inre kustvatten 5.15111 8.5 8.5
95129 2016-05-25 2016 5 57.36_11.98 SE572072-115880 01s - Västkustens inre kustvatten 5.14814 8.5 8.5
95150 2016-05-25 2016 5 57.36_11.99 SE572072-115880 01s - Västkustens inre kustvatten 3.11854 6 6
95151 2016-05-25 2016 5 57.34_11.98 SE572072-115880 01s - Västkustens inre kustvatten 10.05430 21 21
95152 2016-05-25 2016 5 57.34_11.98 SE572072-115880 01s - Västkustens inre kustvatten 10.04500 21 21
95153 2016-05-25 2016 5 57.35_11.96 SE572072-115880 01s - Västkustens inre kustvatten 5.57512 25 25
95154 2016-05-25 2016 5 57.35_11.97 SE572072-115880 01s - Västkustens inre kustvatten 8.28729 17.7 17.7
95155 2016-05-25 2016 5 57.36_11.98 SE572072-115880 01s - Västkustens inre kustvatten 3.64912 8.3 8.3
95156 2016-05-25 2016 5 57.36_11.98 SE572072-115880 01s - Västkustens inre kustvatten 4.67920 9.1 9.1
95157 2016-05-25 2016 5 57.35_11.97 SE572072-115880 01s - Västkustens inre kustvatten 9.31441 21.2 21.2
95158 2016-05-25 2016 5 57.34_11.97 SE572072-115880 01s - Västkustens inre kustvatten 6.72661 21.4 21.4

In [134]:
water_body = wb
type_area = dw_obj.mapping_objects['water_body'].get_type_area_for_water_body(water_body, include_suffix=True)
parameter = dw_obj.indicator_parameter        
by_year_pos = df.groupby(['YEAR', 'POSITION'])[dw_obj.indicator_parameter].agg(['count', 'min', 'max', 'mean']).reset_index()
by_year_pos.rename(columns={'mean':'position_mean', 'count': 'position_count', 'min': 'position_min', 'max': 'station_max'}, inplace=True)
by_year_pos.columns


Out[134]:
Index(['YEAR', 'POSITION', 'position_count', 'position_min', 'station_max',
       'position_mean'],
      dtype='object')

In [ ]:


In [138]:
year = 2016
by_year_pos.loc[by_year_pos.YEAR == year]['position_mean'].dropna().sample(frac = 1, replace = True).mean()


Out[138]:
7.386736666666668

In [139]:
by_year = by_year_pos.groupby(['YEAR']).position_mean.agg(['count', 'min', 'max', 'mean']).reset_index()
for ix, value in by_year.YEAR.items():
    print(value)


2016

In [140]:
# Random selection with replacement of as many values as there are station means (frac = 1)
n = 9999
BQIsim_year = []
for ix, year in by_year.YEAR.items():
    BQIsim = []
    print('number of stations in year ({}): {}'.format(year,len(by_year_pos['position_mean'])))
    for x in range(n):
        BQIsim.append(by_year_pos.loc[by_year_pos.YEAR == year]['position_mean'].sample(frac = 1, replace = True).mean())
    BQIsim_year.append(np.percentile(BQIsim, 0.2))


number of stations in year (2016): 6

In [141]:
periodmean = np.mean(BQIsim_year)
periodmean


Out[141]:
4.0655602971428566

In [32]:
%%timeit
BQIsim = []
for x in range(n):
        BQIsim.append(by_year_pos.loc[by_year_pos.YEAR == year]['position_mean'].sample(frac = 1, replace = True).mean())


1 loop, best of 3: 8.4 s per loop

In [33]:
%%timeit
BQIsim = []
[BQIsim.append(by_year_pos.loc[by_year_pos.YEAR == year]['position_mean'].sample(frac = 1, replace = True).mean()) for line in range(n)]


1 loop, best of 3: 7.99 s per loop

In [111]:
%%timeit
df_list = [by_year_pos.loc[by_year_pos.YEAR == year]['position_mean'].dropna()]*n
def bootstrap(df):
    return df.sample(frac = 1, replace = True).mean()


1000 loops, best of 3: 1.16 ms per loop

In [79]:
BQIsim = map(bootstrap, df_list)


1000 loops, best of 3: 703 µs per loop

In [117]:
%%timeit
BQIsim = (bootstrap(by_year_pos.loc[by_year_pos.YEAR == year]['position_mean'].dropna()) for x in range(n))
type(BQIsim)


1 loop, best of 3: 13.2 s per loop

In [119]:
%%timeit
BQIsim = (bootstrap(by_year_pos.loc[by_year_pos.YEAR == year]['position_mean'].dropna()) for x in range(n))
type(BQIsim)


The slowest run took 5.03 times longer than the fastest. This could mean that an intermediate result is being cached.
1000000 loops, best of 3: 928 ns per loop

In [83]:
%%timeit
BQIsim = map(bootstrap, df_list)


The slowest run took 8.93 times longer than the fastest. This could mean that an intermediate result is being cached.
1000000 loops, best of 3: 261 ns per loop

In [100]:
def tolist(mapobj):
    return [x for x in mapobj]

In [104]:
%%timeit   
BQIsim = tolist(map(bootstrap, df_list))
percentile = np.percentile(BQIsim, 0.2)


1 loop, best of 3: 1.62 s per loop

In [107]:
%%timeit   
BQIsim = np.fromiter(map(bootstrap, df_list), dtype = np.float)
percentile = np.percentile(BQIsim, 0.2)


1 loop, best of 3: 1.65 s per loop

In [84]:
%%timeit   
BQIsim = [*map(bootstrap, df_list)]
percentile = np.percentile(BQIsim, 0.2)


1 loop, best of 3: 1.64 s per loop

In [85]:
%%timeit
BQIsim = map(bootstrap, df_list)
BQIsim = list(BQIsim)
percentile = np.percentile(BQIsim, 0.2)


1 loop, best of 3: 1.64 s per loop

In [86]:
%%timeit
BQIsim = map(bootstrap, df_list)
BQIsim = [x for x in BQIsim]
percentile = np.percentile(BQIsim, 0.2)


1 loop, best of 3: 1.65 s per loop

In [157]:
#dw_obj.ref_settings.get_value(variable = 'HG_EQR_LIMIT', type_area = type_area)
#dw_obj.ref_settings.get_value(variable = 'PB_EQR_LIMIT', type_area = type_area)

In [158]:
#dw_obj.tolerance_settings.get_value(variable = 'MIN_NR_YEARS', type_area = '22')
#dw_obj.tolerance_settings.get_min_nr_years(type_area = '22')

In [142]:
#%%timeit
BQI_sim2 = dw_obj.calculate_status_value(wb)


number of stations in year (2016): 6
0     6.726610
1    10.049650
2     5.575120
3     8.800850
4     5.145726
5     3.118540
Name: position_mean, dtype: float64
SE572072-115880
4.12902873714
[4.129028737142856]

In [143]:
BQI_sim2


Out[143]:
4.129028737142856

In [118]:
dw_obj = w.get_step_object(step = 3, subset = subset_uuid).indicator_objects[indicator]

In [32]:
print(dw_obj.classification_results[wb].keys())
for key, value in dw_obj.classification_results[wb].items():
    if key == 'all_data' or key == 'mean_EQR_by_date' or key == 'number_of_values':
        pass
    else:
        print('**************************************')
        print(key)
        print(value)


dict_keys(['parameter', 'salt_parameter', 'water_body', 'all_data', 'all_ok', 'water_body_status', 'mean_EQR_by_year_pos', 'mean_EQR_by_year', 'mean_EQR_by_period', 'number_of_years', 'numerical_class', 'status'])
**************************************
parameter
BIOV_CONC_ALL
**************************************
salt_parameter
SALT_CTD
**************************************
water_body
SE654470-222700
**************************************
all_ok
mean_ek_value    False
Name: all_ok, dtype: bool
**************************************
water_body_status
None
**************************************
mean_EQR_by_year_pos
    YEAR     POSITION  number_of_dates       min  max  mean_ek_value
0   2013  65.73_22.43                0       NaN  NaN            NaN
1   2013  65.73_22.45               10  0.040906  1.0       0.638793
2   2013  65.75_22.40                0       NaN  NaN            NaN
3   2013  65.76_22.48                0       NaN  NaN            NaN
4   2013  65.77_22.50                0       NaN  NaN            NaN
5   2013  65.77_22.53                0       NaN  NaN            NaN
6   2013  65.78_22.43                0       NaN  NaN            NaN
7   2014  65.73_22.43                0       NaN  NaN            NaN
8   2014  65.73_22.44                0       NaN  NaN            NaN
9   2014  65.73_22.45               10  0.060073  1.0       0.614813
10  2014  65.75_22.40                0       NaN  NaN            NaN
11  2014  65.78_22.43                0       NaN  NaN            NaN
12  2015  65.73_22.44                0       NaN  NaN            NaN
13  2015  65.73_22.45                9  0.043947  1.0       0.619119
14  2015  65.75_22.40                0       NaN  NaN            NaN
15  2015  65.76_22.48                0       NaN  NaN            NaN
16  2015  65.77_22.53                0       NaN  NaN            NaN
17  2015  65.78_22.43                0       NaN  NaN            NaN
18  2016  65.73_22.44                0       NaN  NaN            NaN
19  2016  65.73_22.45               10  0.056598  1.0       0.687118
20  2016  65.75_22.40                0       NaN  NaN            NaN
21  2016  65.76_22.48                0       NaN  NaN            NaN
22  2016  65.77_22.53                0       NaN  NaN            NaN
23  2016  65.78_22.43                0       NaN  NaN            NaN
**************************************
mean_EQR_by_year
      number_of_dates       min       max  mean_ek_value
YEAR                                                    
2013                1  0.638793  0.638793       0.638793
2014                1  0.614813  0.614813       0.614813
2015                1  0.619119  0.619119       0.619119
2016                1  0.687118  0.687118       0.687118
**************************************
mean_EQR_by_period
0.639960720229
**************************************
number_of_years
4.0
**************************************
numerical_class
3.99981295347
**************************************
status
GOOD

In [36]:
dw_obj.classification_results[wb]['mean_EQR_by_year_pos'].dropna(subset = ['mean_ek_value'])


Out[36]:
YEAR POSITION number_of_dates min max mean_ek_value
1 2013 65.73_22.45 10 0.040906 1.0 0.638793
9 2014 65.73_22.45 10 0.060073 1.0 0.614813
13 2015 65.73_22.45 9 0.043947 1.0 0.619119
19 2016 65.73_22.45 10 0.056598 1.0 0.687118

In [22]:
dw_obj.water_body_indicator_df[wb]


Out[22]:
SDATE YEAR MONTH VISS_EU_CD WATER_TYPE_AREA DEPH DIN SALT_CTD REFERENCE_VALUE
7057 2016-12-07 2016 12 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 1.0 6.35 2.000 6.334000
7058 2016-12-07 2016 12 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 5.0 6.41 2.000 6.334000
7059 2016-12-07 2016 12 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 10.0 6.81 2.000 6.334000
7349 2016-11-09 2016 11 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 1.0 7.56 2.000 6.334000
7350 2016-11-09 2016 11 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 5.0 5.40 2.000 6.334000
7351 2016-11-09 2016 11 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 10.0 5.67 2.000 6.334000
10343 2016-01-27 2016 1 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 1.0 11.37 2.000 6.334000
10344 2016-01-27 2016 1 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 5.0 7.53 2.279 5.962093
10345 2016-01-27 2016 1 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 10.0 7.26 2.345 5.874115
11065 2015-12-02 2015 12 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 1.0 5.86 1.945 6.407315
11066 2015-12-02 2015 12 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 5.0 6.01 1.941 6.412647
11067 2015-12-02 2015 12 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 10.0 5.84 1.943 6.409981
17831 2015-02-11 2015 2 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 1.0 9.05 0.660 8.120220
17832 2015-02-11 2015 2 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 5.0 6.98 1.730 6.693910
17833 2015-02-11 2015 2 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 10.0 7.29 2.020 6.307340
18397 2015-01-14 2015 1 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 1.0 6.09 NaN NaN
18398 2015-01-14 2015 1 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 5.0 6.22 NaN NaN
18399 2015-01-14 2015 1 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 10.0 6.74 NaN NaN
18916 2014-12-03 2014 12 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 1.0 5.07 2.285 5.954095
18917 2014-12-03 2014 12 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 5.0 5.05 2.273 5.970091
18918 2014-12-03 2014 12 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 10.0 5.18 2.310 5.920770
26382 2014-01-16 2014 1 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 1.0 9.76 0.679 8.094893
26383 2014-01-16 2014 1 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 5.0 7.35 1.542 6.944514
26384 2014-01-16 2014 1 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 10.0 9.37 1.958 6.389986
27000 2013-12-04 2013 12 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 1.0 5.57 2.373 5.836791
27001 2013-12-04 2013 12 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 5.0 5.66 2.373 5.836791
27002 2013-12-04 2013 12 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 10.0 5.75 2.373 5.836791
34344 2013-01-15 2013 1 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 1.0 6.49 1.384 7.155128
34345 2013-01-15 2013 1 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 5.0 7.81 2.207 6.058069
34346 2013-01-15 2013 1 SE654470-222700 22 - Norra Bottenviken. Inre kustvatten 10.0 7.96 2.721 5.372907

In [30]:
def get_EK(x):
    y = x.DIN/x.REFERENCE_VALUE
    if y > 1:
        return 1
    else:
        return y

df = dw_obj.water_body_indicator_df[wb]
df['ek_value'] = df.apply(get_EK, axis = 1)

In [31]:
df[dw_obj.indicator_parameter]/df.REFERENCE_VALUE


Out[31]:
7057     1.002526
7058     1.011999
7059     1.075150
7349     1.193559
7350     0.852542
7351     0.895169
10343    1.795074
10344    1.262979
10345    1.235931
11065    0.914580
11066    0.937210
11067    0.911079
17831    1.114502
17832    1.042739
17833    1.155796
18397         NaN
18398         NaN
18399         NaN
18916    0.851515
18917    0.845883
18918    0.874886
26382    1.205698
26383    1.058389
26384    1.466357
27000    0.954291
27001    0.969711
27002    0.985130
34344    0.907042
34345    1.289190
34346    1.481507
dtype: float64

In [32]:
by_date = df.groupby(['SDATE', 'YEAR'],).ek_value.agg(['count', 'min', 'max', 'mean']).reset_index()
# by_date.to_csv(self.paths['results'] +'/' + self.name + water_body +'by_occation.txt', sep='\t')
by_date.rename(columns={'mean':'mean_ek_value', 'count': 'number_of_values'}, inplace=True) # Cant use "mean" below
by_date


Out[32]:
SDATE YEAR number_of_values min max mean_ek_value
0 2013-01-15 2013 3 0.907042 1.000000 0.969014
1 2013-12-04 2013 3 0.954291 0.985130 0.969711
2 2014-01-16 2014 3 1.000000 1.000000 1.000000
3 2014-12-03 2014 3 0.845883 0.874886 0.857428
4 2015-01-14 2015 0 NaN NaN NaN
5 2015-02-11 2015 3 1.000000 1.000000 1.000000
6 2015-12-02 2015 3 0.911079 0.937210 0.920956
7 2016-01-27 2016 3 1.000000 1.000000 1.000000
8 2016-11-09 2016 3 0.852542 1.000000 0.915904
9 2016-12-07 2016 3 1.000000 1.000000 1.000000

In [34]:
# Remove occations with not enough samples
# Or use count as a flag for what to display for the user?
by_date['all_ok'] = True
ix = by_date.loc[by_date['number_of_values'] < 1, 'all_ok'].index
by_date.set_value(ix, 'all_ok', False)


Out[34]:
SDATE YEAR number_of_values min max mean_ek_value all_ok
0 2013-01-15 2013 3 0.907042 1.000000 0.969014 True
1 2013-12-04 2013 3 0.954291 0.985130 0.969711 True
2 2014-01-16 2014 3 1.000000 1.000000 1.000000 True
3 2014-12-03 2014 3 0.845883 0.874886 0.857428 True
4 2015-01-14 2015 0 NaN NaN NaN False
5 2015-02-11 2015 3 1.000000 1.000000 1.000000 True
6 2015-12-02 2015 3 0.911079 0.937210 0.920956 True
7 2016-01-27 2016 3 1.000000 1.000000 1.000000 True
8 2016-11-09 2016 3 0.852542 1.000000 0.915904 True
9 2016-12-07 2016 3 1.000000 1.000000 1.000000 True

In [35]:
"""
2) Medelvärdet av EK för varje parameter beräknas för varje år.
"""
by_year = by_date.groupby('YEAR').mean_ek_value.agg(['count', 'min', 'max', 'mean']).reset_index()
by_year.rename(columns={'mean':'mean_ek_value', 'count': 'number_of_dates'}, inplace=True)
by_year['all_ok'] = True
by_year.loc[by_year['number_of_dates'] < 1, 'all_ok'] = False
# by_year.to_csv(self.paths['results'] +'/' + self.name + water_body + 'by_year.txt', sep='\t')
by_year


Out[35]:
YEAR number_of_dates min max mean_ek_value all_ok
0 2013 2 0.969014 0.969711 0.969362 True
1 2014 2 0.857428 1.000000 0.928714 True
2 2015 2 0.920956 1.000000 0.960478 True
3 2016 3 0.915904 1.000000 0.971968 True

In [36]:
by_period = by_year[['mean_ek_value']].describe()
by_period


Out[36]:
mean_ek_value
count 4.000000
mean 0.957631
std 0.019895
min 0.928714
25% 0.952537
50% 0.964920
75% 0.970014
max 0.971968

In [37]:
"""
3) Medelvärdet av EK för varje parameter och vattenförekomst (beräknas för minst
en treårsperiod)
"""
by_period = by_year[['mean_ek_value']].describe()#.agg(['count', 'min', 'max', 'mean'])
by_period = by_period.transpose()
#by_period#.loc['mean', 'mean_ek_value']
#
#by_period['count'].get_value('mean_ek_value')
by_period['all_ok']  = True
if by_period['count'].get_value('mean_ek_value') < 3:
    by_period['all_ok'] = False

by_period


Out[37]:
count mean std min 25% 50% 75% max all_ok
mean_ek_value 4.0 0.957631 0.019895 0.928714 0.952537 0.96492 0.970014 0.971968 True

In [40]:
by_period['mean'].get_value('mean_ek_value')


Out[40]:
0.95763063655011882

In [29]:
temp_df = pd.DataFrame(np.random.randn(10, 3), columns=['A', 'B', 'C'],
...                   index=pd.date_range('1/1/2000', periods=10))
temp_df.iloc[3:7] = np.nan
temp_df.describe()


Out[29]:
A B C
count 6.000000 6.000000 6.000000
mean 0.206290 0.471121 -0.242431
std 0.586035 0.679945 1.721820
min -0.333494 -0.641210 -2.997678
25% -0.286442 0.214068 -1.103137
50% 0.056126 0.508677 0.315088
75% 0.657880 0.929940 0.644624
max 1.001151 1.264358 1.734323

In [30]:
def set_above_one_value(x):
    if x > 1:
        return 1
    else:
        return x
dw_obj.water_body_indicator_df[wb]['EK'] = dw_obj.water_body_indicator_df[wb]['DIN']/dw_obj.water_body_indicator_df[wb]['REFERENCE_VALUE']
dw_obj.water_body_indicator_df[wb]['EK'] = dw_obj.water_body_indicator_df[wb]['EK'].apply(set_above_one_value)
dw_obj.water_body_indicator_df[wb]['EK']


Out[30]:
7057     1.000000
7058     1.000000
7059     1.000000
7349     1.000000
7350     0.852542
7351     0.895169
10343    1.000000
10344    1.000000
10345    1.000000
11065    0.914580
11066    0.937210
11067    0.911079
17831    1.000000
17832    1.000000
17833    1.000000
18397         NaN
18398         NaN
18399         NaN
18916    0.851515
18917    0.845883
18918    0.874886
26382    1.000000
26383    1.000000
26384    1.000000
27000    0.954291
27001    0.969711
27002    0.985130
34344    0.907042
34345    1.000000
34346    1.000000
Name: EK, dtype: float64

In [31]:
dw_obj.get_filtered_data(subset = subset_uuid, step = 'step_2', type_area = 22, indicator = 'din_winter')[['DIN']].dropna()


Out[31]:
DIN
5199 4.68
5200 4.55
5201 4.54
5202 4.23
5203 4.42
5204 4.19
5205 5.59
5206 8.84
5207 6.77
5208 5.68
5209 4.39
5210 4.27
5211 4.63
5212 4.59
5213 4.59
5214 5.08
5215 5.34
5216 4.60
5217 4.31
5218 4.19
5219 4.60
5220 15.76
5221 8.59
5222 6.40
5223 6.46
5224 5.67
5225 5.34
5226 4.62
5227 5.18
5228 5.18
... ...
34530 11.72
34531 4.89
34532 4.85
34533 4.39
34534 4.22
34535 9.33
34536 10.92
34537 8.57
34538 5.36
34539 3.93
34540 5.71
34541 7.14
34542 35.71
34543 3.93
34544 4.14
34545 26.35
34546 11.60
34547 8.32
34548 8.46
34549 8.60
34550 5.55
34551 5.39
34552 5.42
34553 5.40
34554 6.17
34555 8.48
34556 11.34
34557 15.83
34558 11.80
34559 3.85

18009 rows × 1 columns


In [120]:
B2_NTOT_WINTER_SETTINGS = lv_workspace.get_subset_object('B').get_step_object('step_2').indicator_ref_settings['ntot_winter']
lv_workspace.get_subset_object('B').get_step_object('step_2').indicator_ref_settings['ntot_winter'].allowed_variables
# gör om till
# lv_workspace.get_indicator_ref_settings(step = , subset = , indicator = , waterbody/type)
# ger samma resultat som:
#lv_workspace.get_subset_object('B').get_step_object('step_2').indicator_ref_settings['ntot_winter'].settings.ref_columns

lv_workspace.get_subset_object('B').get_step_object('step_2').indicator_ref_settings['ntot_winter'].settings.get_value('EK G/M', 22)
#print(B2_NTOT_WINTER_SETTINGS)
#B2_NTOT_WINTER_SETTINGS.get_value('2', 'DEPTH_INTERVAL')


Out[120]:
'0.85'

In [124]:
av = lv_workspace.get_subset_object('B').get_step_object('step_2').indicator_data_filter_settings['ntot_winter'].allowed_variables
lv_workspace.get_subset_object('B').get_step_object('step_2').indicator_data_filter_settings['ntot_winter'].settings.df[av]


Out[124]:
DEPH_INTERVAL MONTH_LIST
0 0-10 1;2;3;12
1 0-10 1;2;3;12
2 0-10 1;2;3;12
3 0-10 1;2;3;12
4 0-10 1;2;3;12
5 0-10 1;2;3;12
6 0-10 1;2;3;12
7 0-10 1;2;12
8 0-10 1;2;12
9 0-10 1;2;12
10 0-10 1;2;12
11 0-10 1;2;12
12 0-10 1;2;12
13 0-10 1;2;12
14 0-10 1;2;12
15 0-10 1;2;12
16 0-10 1;2;12
17 0-10 1;2;11;12
18 0-10 1;2;11;12
19 0-10 1;2;11;12
20 0-10 1;2;11;12
21 0-10 1;2;11;12
22 0-10 1;2;11;12
23 0-10 1;2;11;12
24 0-10 1;2;11;12
25 0-10 1;2;12
26 0-10 1;2;3;12

In [119]:
lv_workspace.get_subset_object('B').get_step_object('step_2').indicator_data_filter_settings['ntot_winter'].settings.df


Out[119]:
TYPE_AREA_NUMBER TYPE_AREA_SUFFIX DEPH_INTERVAL MIN_NR_YEARS MIN_NR_VALUES TIME_DELTA_TOLERANCE POS_RADIUS_TOLERANCE DEPH_TOLERANCE MONTH_LIST EKV REF EKV H/G EKV G/M EKV M/O EKV O/D EK H/G EK G/M EK M/O EK O/D SALINITY MAX
0 1 n 0-10 3 3 3 0.1 5 1;2;3;12 -0.630*s+36 -0.715*s+40.86 -0.799*s+45.72 -1.0546*s+60.3 -1.480*s+84.6 0.88 0.79 0.6 0.43 27
1 1 s 0-10 3 3 3 0.1 5 1;2;3;12 -0.65*s+30 -0.738*s+34.05 -0.8255*s+38.1 -1.0888*s+50.25 -1.528*s+70.5 0.88 0.79 0.6 0.43 20
2 2 NaN 0-10 3 3 3 0.1 5 1;2;3;12 -0.630*s+36 -0.715*s+40.86 -0.799*s+45.72 -1.0546*s+60.3 -1.480*s+84.6 0.88 0.79 0.6 0.43 27
3 3 NaN 0-10 3 3 3 0.1 5 1;2;3;12 -0.630*s+36 -0.715*s+40.86 -0.799*s+45.72 -1.0546*s+60.3 -1.480*s+84.6 0.88 0.79 0.6 0.43 27
4 4 NaN 0-10 3 3 3 0.1 5 1;2;3;12 -0.65*s+30 -0.738*s+34.05 -0.8255*s+38.1 -1.0888*s+50.25 -1.528*s+70.5 0.88 0.79 0.6 0.43 20
5 5 NaN 0-10 3 3 3 0.1 5 1;2;3;12 0*s+17 0*s+19.295 0*s+21.59 0*s+28.475 0*s+39.95 0.89 0.77 0.61 0.43 20
6 6 NaN 0-10 3 3 3 0.1 5 1;2;3;12 0*s+17 0*s+19.295 0*s+21.59 0*s+28.475 0*s+39.95 0.89 0.77 0.61 0.43 20
7 7 NaN 0-10 3 3 3 0.1 5 1;2;12 -6*s+59 -6.6*s+64.9 -7.2*s+70.8 -9*s+88.5 -12*s+118 0.91 0.84 0.67 0.5 7
8 8 NaN 0-10 3 3 3 0.1 5 1;2;12 -6*s+59 -6.6*s+64.9 -7.2*s+70.8 -9*s+88.5 -12*s+118 0.91 0.84 0.67 0.5 7
9 9 NaN 0-10 3 3 3 0.1 5 1;2;12 -6*s+59 -6.6*s+64.9 -7.2*s+70.8 -9*s+88.5 -12*s+118 0.91 0.84 0.67 0.5 7
10 10 NaN 0-10 3 3 3 0.1 5 1;2;12 0*s+17 0*s+18.7 0*s+20.4 0*s+25.5 0*s+34 0.89 0.85 0.65 0.5 7
11 11 NaN 0-10 3 3 3 0.1 5 1;2;12 0*s+17 0*s+18.7 0*s+20.4 0*s+25.5 0*s+34 0.89 0.85 0.65 0.5 7
12 12 s 0-10 3 3 3 0.1 5 1;2;12 -2.833*s+34 -3.1167*s+37.4 -3.4*s+40.8 -4.25*s+51 -5.6667*s+68 0.91 0.83 0.66 0.5 6
13 12 n 0-10 3 3 3 0.1 5 1;2;12 -1*s+23 -1.1*s+25.3 -1.2*s+27.6 -1.5*s+34.5 -2*s+46 0.93 0.85 0.68 0.51 6
14 13 NaN 0-10 3 3 3 0.1 5 1;2;12 -2.833*s+34 -3.1167*s+37.4 -3.4*s+40.8 -4.25*s+51 -5.6667*s+68 0.91 0.83 0.66 0.5 6
15 14 NaN 0-10 3 3 3 0.1 5 1;2;12 -2.833*s+34 -3.1167*s+37.4 -3.4*s+40.8 -4.25*s+51 -5.6667*s+68 0.91 0.83 0.66 0.5 6
16 15 NaN 0-10 3 3 3 0.1 5 1;2;12 -1*s+23 -1.1*s+25.3 -1.2*s+27.6 -1.5*s+34.5 -2*s+46 0.93 0.85 0.68 0.51 6
17 16 NaN 0-10 3 3 3 0.1 5 1;2;11;12 -1*s+23 -1.1*s+25.3 -1.2*s+27.6 -1.5*s+34.5 -2*s+46 0.93 0.85 0.68 0.51 5
18 17 NaN 0-10 3 3 3 0.1 5 1;2;11;12 -1*s+23 -1.1*s+25.3 -1.2*s+27.6 -1.5*s+34.5 -2*s+46 0.93 0.85 0.68 0.51 5
19 18 NaN 0-10 3 3 3 0.1 5 1;2;11;12 -0.4*s+20 -0.44*s+22 -0.48*s+24 -0.6*s+30 -0.8*s+40 0.91 0.83 0.66 0.5 5
20 19 NaN 0-10 3 3 3 0.1 5 1;2;11;12 -0.4*s+20 -0.44*s+22 -0.48*s+24 -0.6*s+30 -0.8*s+40 0.91 0.83 0.66 0.5 5
21 20 NaN 0-10 3 3 3 0.1 5 1;2;11;12 -0.6*s+21 -0.66*s+23.1 -0.72*s+25.2 -0.9*s+31.5 -1.2*s+42 0.91 0.83 0.67 0.5 5
22 21 NaN 0-10 3 3 3 0.1 5 1;2;11;12 -0.6*s+21 -0.66*s+23.1 -0.72*s+25.2 -0.9*s+31.5 -1.2*s+42 0.91 0.83 0.67 0.5 5
23 22 NaN 0-10 3 3 3 0.1 5 1;2;11;12 -1*s+21 -1.09*s+22.89 -1.18*s+24.78 -1.45*s+30.45 -1.9*s+39.9 0.93 0.85 0.68 0.51 3
24 23 NaN 0-10 3 3 3 0.1 5 1;2;11;12 -1*s+21 -1.09*s+22.89 -1.18*s+24.78 -1.45*s+30.45 -1.9*s+39.9 0.93 0.85 0.68 0.51 3
25 24 NaN 0-10 3 3 3 0.1 5 1;2;12 -1*s+23 -1.1*s+25.3 -1.2*s+27.6 -1.5*s+34.5 -2*s+46 0.93 0.85 0.68 0.51 6
26 25 NaN 0-10 3 3 3 0.1 5 1;2;3;12 -0.65*s+30 -0.738*s+34.05 -0.8255*s+38.1 -1.0888*s+50.25 -1.528*s+70.5 0.88 0.79 0.6 0.43 20

In [67]:
B2_NTOT_WINTER_SETTINGS.settings.mapping_water_body['N m Bottenvikens kustvatten']


Out[67]:
{'BASIN_NUMBER': '110002.0',
 'CENTER_LAT': '64° 42\' 35,349"',
 'CENTER_LON': '21° 24\' 5,383"',
 'EU_CD': 'SE648760-213140',
 'HID': '649640-214530',
 'TYPE_AREA_NUMBER': '23',
 'TYPE_AREA_SUFFIX': '',
 'URL_VISS': 'http://www.viss.lansstyrelsen.se/waters.aspx?waterEUID=SE648760-213140'}

Set subset time and area filter


In [35]:
f1_A = lv_workspace.get_data_filter_object(step=1, subset='A') 
f1_A.include_list_filter


Out[35]:
{'MYEAR': ['2016', '2017'],
 'SEA_AREA_NAME': ['Gullmarn centralbassäng', 'Rivö fjord'],
 'STATN': ['BJÖRKHOLMEN']}

In [136]:
lv_workspace.get_data_filter_info(step=1, subset='A')


Out[136]:
{'exclude_list': ['MYEAR', 'SEA_AREA_NAME', 'STATN'],
 'include_list': ['MYEAR', 'SEA_AREA_NAME', 'STATN']}

In [36]:
f1_A.exclude_list_filter


Out[36]:
{'MYEAR': ['2015', '2016'], 'SEA_AREA_NAME': [], 'STATN': ['SLÄGGÖ']}

In [21]:
f0.include_list_filter


Out[21]:
{'MYEAR': ['2016', '2017'],
 'SEA_AREA_NAME': ['Byfjorden',
  'Gullmarn centralbassäng',
  'Havstensfjorden',
  'Rivö fjord'],
 'STATN': []}

Apply subset filter


In [22]:
lv_workspace.apply_subset_filter(subset='A') # Not handled properly by the IndexHandler


Out[22]:
True

Extract filtered data


In [23]:
data_after_subset_filter = lv_workspace.get_filtered_data(level=1, subset='A') # level=0 means first filter 
print('{} rows mathing the filter criteria'.format(len(data_after_subset_filter)))
data_after_subset_filter.head()


198 rows mathing the filter criteria
Out[23]:
AMON BQIm CPHL DEPH DOXY_BTL DOXY_CTD LATIT_DD LONGI_DD MNDEP MXDEP ... SERNO SHARKID_MD5 SHIPC STATN STIME TEMP_BTL TEMP_CTD WATER_DISTRICT WATER_TYPE_AREA WLTYP
2628 0.76 NaN 0.6 0.0 7.05 58.38767 11.62667 NaN NaN ... 8.0 NaN 77SN BJÖRKHOLMEN 17:30 4.96 4.84 Västerhavets vattendistrikt 02 - Västkustens fjordar 2 - Havsområde innanför 1 NM
2629 0.72 NaN 0.5 2.0 7.12 58.38767 11.62667 NaN NaN ... 8.0 NaN 77SN BJÖRKHOLMEN 17:30 4.93 4.84 Västerhavets vattendistrikt 02 - Västkustens fjordar 2 - Havsområde innanför 1 NM
2630 0.74 NaN 0.6 5.0 7.16 58.38767 11.62667 NaN NaN ... 8.0 NaN 77SN BJÖRKHOLMEN 17:30 4.88 4.84 Västerhavets vattendistrikt 02 - Västkustens fjordar 2 - Havsområde innanför 1 NM
2631 0.65 NaN 0.5 10.0 7.11 58.38767 11.62667 NaN NaN ... 8.0 NaN 77SN BJÖRKHOLMEN 17:30 5.12 4.86 Västerhavets vattendistrikt 02 - Västkustens fjordar 2 - Havsområde innanför 1 NM
2632 0.46 NaN 0.3 15.0 6.86 58.38767 11.62667 NaN NaN ... 8.0 NaN 77SN BJÖRKHOLMEN 17:30 5.52 5.10 Västerhavets vattendistrikt 02 - Västkustens fjordar 2 - Havsområde innanför 1 NM

5 rows × 46 columns


In [24]:
# show available waterbodies
lst = data_after_subset_filter.SEA_AREA_NAME.unique()
print('Waterbodies in subset:\n{}'.format('\n'.join(lst)))


Waterbodies in subset:
Gullmarn centralbassäng

In [24]:
import numpy as np
np.where(lv_workspace.index_handler.subset_filter)


Out[24]:
(array([2629, 2630, 2631, 2632, 2633, 2634, 2635, 2636, 2637, 2638, 2639,
        2754, 2755, 2756, 2757, 2758, 2759, 2760, 2761, 2762, 2763, 2764,
        2870, 2871, 2872, 2873, 2874, 2875, 2876, 2877, 2878, 2879, 2880,
        2952, 2953, 2954, 2955, 2956, 2957, 2958, 2959, 2960, 2961, 2962,
        3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087,
        3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193, 3194, 3195,
        3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292,
        3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419,
        3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503,
        3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634,
        3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727,
        3859, 3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869,
        3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 3988, 3989,
        4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120,
        4265, 4266, 4267, 4268, 4269, 4270, 4271, 4272, 4273, 4274, 4275,
        4354, 4355, 4356, 4357, 4358, 4359, 4360, 4361, 4362, 4363, 4364,
        4502, 4503, 4504, 4505, 4506, 4507, 4508, 4509, 4510, 4511, 4512,
        4806, 4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815, 4816], dtype=int64),)

In [25]:
f = lv_workspace.get_data_filter_object(step=1, subset='A')

In [26]:
f.all_filters


Out[26]:
{'exclude_list': ['MYEAR', 'SEA_AREA_NAME', 'STATN'],
 'include_list': ['MYEAR', 'SEA_AREA_NAME', 'STATN']}

In [27]:
f.exclude_list_filter


Out[27]:
{'MYEAR': ['2015', '2016'], 'SEA_AREA_NAME': [], 'STATN': ['SLÄGGÖ']}

In [28]:
f.include_list_filter


Out[28]:
{'MYEAR': ['2016', '2017'],
 'SEA_AREA_NAME': ['Gullmarn centralbassäng', 'Rivö fjord'],
 'STATN': ['BJÖRKHOLMEN']}

In [29]:
s = lv_workspace.get_step_1_object('A')

In [30]:
s.data_filter.all_filters


Out[30]:
{'exclude_list': ['MYEAR', 'SEA_AREA_NAME', 'STATN'],
 'include_list': ['MYEAR', 'SEA_AREA_NAME', 'STATN']}

In [31]:
f0 = lv_workspace.get_data_filter_object(step=0)

In [32]:
f0.exclude_list_filter


Out[32]:
{'MYEAR': ['2015', '2016'], 'SEA_AREA_NAME': [], 'STATN': []}

In [33]:
f0.include_list_filter


Out[33]:
{'MYEAR': ['2016', '2017'],
 'SEA_AREA_NAME': ['Byfjorden',
  'Gullmarn centralbassäng',
  'Havstensfjorden',
  'Rivö fjord'],
 'STATN': []}

In [ ]:

Quality factor Nutrients


In [ ]:
lv_workspace.initiate_quality_factors()

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: