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


The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload

In [239]:
import os 
import core
import importlib
importlib.reload(core) 
import pandas as pd
import numpy as np
print(core.__file__)
pd.__version__


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

Load directories


In [240]:
root_directory = "../" #os.getcwd()
workspace_directory = root_directory + '/workspaces' 
resource_directory = root_directory + '/resources'

LOAD WORKSPACE


In [241]:
workspaces = {} 
# Holds all loaded workspaces

Load default workspace


In [242]:
default_workspace = core.WorkSpace(name='default', 
                                   parent_directory=workspace_directory,
                                   resource_directory=resource_directory)
workspaces['default'] = default_workspace


====================================================================================================
Initiating WorkSpace: ..//workspaces/default
Parent directory is: ..//workspaces
Resource directory is: ..//resources
----------------------------------------------------------------------------------------------------
Initiating Subset: ..//workspaces/default/subsets/default_subset
step_list ['step_1', 'step_2']
Initiating WorkStep: ..//workspaces/default/subsets/default_subset/step_1
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/default/subsets/default_subset/step_2
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/default/step_0
load_water_body_station_filter

Make sure that it is NOT possible to change default workspace (import data or change filter)


In [243]:
# Import data
default_workspace.import_default_data()
print('DATA')

# Step 0 data filter
default_workspace.set_data_filter(step=0, filter_type='include_list', filter_name='STATN', data=['a', 'b', 'c'])
print(0)

# Step 1 data filter 
subset = 'default_subset'
default_workspace.set_data_filter(step=1, subset=subset, filter_type='include_list', filter_name='STATN', data=['a', 'b', 'c'])
print(1)
                    
# Check indicator data filter  
indicator = 'din_winter'
filter_settings = {'12s': {'DEPTH_INTERVAL':[20, 50], 
                           'DEPTH_TOLERANCE': 10}}

default_workspace.set_indicator_settings_data_filter(indicator=indicator, 
                                      filter_settings=filter_settings, 
                                      step=2, 
                                      subset=subset)
print(2)


Not allowed to change default workspace!
DATA
Not allowed to change default workspace!
0
Not allowed to change default workspace!
1
Not allowed to change default workspace!
2

In [ ]:


In [ ]:


In [ ]:

Create copy och default workspace


In [244]:
mw_workspace = default_workspace.make_copy_of_workspace('mw', overwrite=True)
workspaces['mw'] = mw_workspace
mww = mw_workspace


New workspace already excists!

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [245]:
mw_workspace = core.WorkSpace(name='mw', 
                                   parent_directory=workspace_directory,
                                   resource_directory=resource_directory)
workspaces['mw'] = default_workspace 
mww = mw_workspace 
mww.load_all_data()


====================================================================================================
Initiating WorkSpace: ..//workspaces/mw
Parent directory is: ..//workspaces
Resource directory is: ..//resources
----------------------------------------------------------------------------------------------------
Initiating Subset: ..//workspaces/mw/subsets/default_subset
step_list ['step_1', 'step_2']
Initiating WorkStep: ..//workspaces/mw/subsets/default_subset/step_1
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/mw/subsets/default_subset/step_2
load_water_body_station_filter
----------------------------------------------------------------------------------------------------
Initiating Subset: ..//workspaces/mw/subsets/test_subset_1
step_list ['step_1', 'step_2']
Initiating WorkStep: ..//workspaces/mw/subsets/test_subset_1/step_1
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/mw/subsets/test_subset_1/step_2
load_water_body_station_filter
Initiating WorkStep: ..//workspaces/mw/step_0
load_water_body_station_filter
Saving data to: ..//workspaces/mw/input_data/exports/Column_format_PhysicalChemical_data.txt
Saving data to: ..//workspaces/mw/input_data/exports/Raw_format_PhysicalChemical_data.txt
Sorting..
Resetting and Dropping INDEX
Saving data to: ..//workspaces/mw/input_data/exports/Column_format_PhysicalChemical_data.txt
could not read chlorophyll_integrated_2015_2016_row_format.txt from raw_data directory. Check data type
Saving data to: ..//workspaces/mw/input_data/exports/Column_format_PhysicalChemical_data.txt
Saving data to: ..//workspaces/mw/input_data/exports/Raw_format_Phytoplankton_data.txt
Saving data to: ..//workspaces/mw/input_data/exports/Column_format_Phytoplankton_data.txt
Saving data to: ..//workspaces/mw/input_data/exports/Raw_format_Zoobenthos_data.txt
Saving data to: ..//workspaces/mw/input_data/exports/Column_format_Zoobenthos_data.txt
Saving data to: ..//workspaces/mw/input_data/exports/all_data.txt
Out[245]:
True

Import default data


In [246]:
mww.import_default_data(force=False)


raw_data directory is not empty. Will not copy default files from resource directory!
Out[246]:
False

Make sure that it is NOT possible to change default subset


In [247]:
# Step 0 data filter
mww.set_data_filter(step=0, filter_type='include_list', filter_name='STATN', data=['a', 'b', 'c'])
print(0)

# Step 1 data filter 
subset = 'default_subset'
mww.set_data_filter(step=1, subset=subset, filter_type='include_list', filter_name='STATN', data=['a', 'b', 'c'])
print(1)
                    
# Check indicator data filter  
indicator = 'din_winter'
filter_settings = {'12s': {'DEPTH_INTERVAL':[20, 50], 
                           'DEPTH_TOLERANCE': 10}}

mww.set_indicator_settings_data_filter(indicator=indicator, 
                                      filter_settings=filter_settings, 
                                      step=2, 
                                      subset=subset)
print(2)


filter_name
0
Not allowed to change default subset!
1
Not allowed to change default subset!
2

Make a copy of subset


In [248]:
mww.copy_subset('default_subset', 'test_subset_1')


Given subset is already present!
Out[248]:
False

Make sure that it is possible to change new subset


In [270]:
# Step 0 data filter
mww.set_data_filter(step=0, filter_type='include_list', filter_name='STATN', data=['FLADEN', 'SKALKORGARNA', 'VALÖ'])
mww.set_data_filter(step=0, filter_type='include_list', filter_name='MYEAR', data=['2016'])
print(0)

# Step 1 data filter 
subset = 'test_subset_1'
mww.set_data_filter(step=1, subset=subset, filter_type='include_list', filter_name='STATN', data=['FLADEN', 'SKALKORGARNA'])
mww.set_data_filter(step=1, subset=subset, filter_type='include_list', filter_name='MYEAR', data=['2016'])
print(1)

# Water body station filter
water_body = 'Yttre Brofjorden' 
add_stations = ['FLADEN']
mww.set_water_body_station_filter(station_list=add_stations, subset=subset, water_body=water_body, include=True)
print(2)

# Indicator data filter  
indicator = 'din_winter'
filter_settings = {'12s': {'DEPH_INTERVAL':[20, 50], 
                           'DEPH_TOLERANCE': 10}}

mww.set_indicator_settings_data_filter(indicator=indicator, 
                                      filter_settings=filter_settings, 
                                      step=2, 
                                      subset=subset)
print(3)


filter_name
filter_name
0
filter_name
filter_name
1
2
Interval column
Value to set for type_area "12s" and variable "DEPH_INTERVAL": 20-50
Not allowed to change variable "DEPH_TOLERANCE". Allowed variables to change are:
DEPH_INTERVAL
MONTH_LIST

3

In [ ]:

Apply filters


In [333]:
mww.apply_data_filter(step=0)
mww.apply_data_filter(step=1, subset=subset) 
mww.apply_water_body_station_filter(subset=subset, water_body=water_body) 
mww.apply_indicator_data_filter(step=2, subset=subset, indicator=indicator, water_body=water_body)


step step_0
step step_1
step step_2
['FLADEN']
[]
{'STRETUDDEN', 'FLADEN', 'BROFJ'}
step step_2

In [ ]:


In [ ]:

Extract data


In [363]:
# Step 0
data_step_0 = mww.get_filtered_data(step=0)
len(data_step_0)


STEP step_0
Out[363]:
581

In [364]:
# Step 1
data_step_1 = mww.get_filtered_data(step=1, subset=subset)
len(data_step_1)


STEP step_1
Out[364]:
329

In [365]:
# Step 2 water_body
data_step_2_water_body = mww.get_filtered_data(step=2, subset=subset, water_body=water_body)
len(data_step_2_water_body)


STEP step_2
Out[365]:
144

In [367]:
# Step 2 indicator
data_step_2_indicator = mww.get_filtered_data(step=2, subset=subset, water_body=water_body, indicator=indicator)
len(data_step_2_indicator)


STEP step_2
Out[367]:
12

In [368]:
data_step_2_indicator


Out[368]:
AMON BIOV_CONC_ALL BQIm DEPH DIN DOXY_BTL DOXY_CTD LATIT_DD LONGI_DD MNDEP ... SHARKID_MD5 SHIPC STATN STIME TEMP_BTL TEMP_CTD WATER_DISTRICT WATER_TYPE_AREA WLTYP MONTH
1438 0.20 NaN NaN 0 2.57 7.02 7.2 57.19250 11.65783 NaN ... NaN 34AR FLADEN 17:10 6.31 4 - Utsjövatten 12
1439 0.20 NaN NaN 5 2.59 7.10 6.9 57.19250 11.65783 NaN ... NaN 34AR FLADEN 17:10 6.90 6.31 4 - Utsjövatten 12
1440 0.20 NaN NaN 10 3.15 6.72 6.5 57.19250 11.65783 NaN ... NaN 34AR FLADEN 17:10 7.59 4 - Utsjövatten 12
2889 0.20 NaN NaN 0 0.3 8.82 8.8 57.19267 11.65783 NaN ... NaN 34AR FLADEN 16:50 4.51 4 - Utsjövatten 3
2890 0.20 NaN NaN 5 0.3 8.92 8.1 57.19267 11.65783 NaN ... NaN 34AR FLADEN 16:50 4.47 4.51 4 - Utsjövatten 3
2891 0.20 NaN NaN 10 6.27 7.03 7.0 57.19267 11.65783 NaN ... NaN 34AR FLADEN 16:50 4.51 4 - Utsjövatten 3
3011 0.20 NaN NaN 0 5.41 8.01 7.9 57.19267 11.65783 NaN ... NaN 34AR FLADEN 15:30 2.99 4 - Utsjövatten 2
3012 0.20 NaN NaN 5 5.53 7.97 7.9 57.19267 11.65783 NaN ... NaN 34AR FLADEN 15:30 3.05 3.03 4 - Utsjövatten 2
3013 0.20 NaN NaN 10 7.03 7.62 7.5 57.19267 11.65783 NaN ... NaN 34AR FLADEN 15:30 3.65 4 - Utsjövatten 2
3347 0.87 NaN NaN 0 6.58 7.95 7.9 57.19167 11.66667 NaN ... NaN 34AR FLADEN 04:10 3.22 3.18 4 - Utsjövatten 1
3348 0.81 NaN NaN 5 6.47 7.90 7.8 57.19167 11.66667 NaN ... NaN 34AR FLADEN 04:10 3.21 4 - Utsjövatten 1
3349 0.20 NaN NaN 10 5.62 7.78 7.7 57.19167 11.66667 NaN ... NaN 34AR FLADEN 04:10 3.29 3.01 4 - Utsjövatten 1

12 rows × 48 columns


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [340]:
b = mww.index_handler.booleans

In [341]:
print(len(np.where(b['step_0']['boolean'])[0]))


581

In [342]:
print(len(np.where(b['step_0'][subset]['boolean'])[0]))


329

In [343]:
print(len(np.where(b['step_0'][subset]['step_1']['boolean'])[0]))


329

In [344]:
print(len(np.where(b['step_0'][subset]['step_1']['step_2']['boolean'])[0]))


329

In [345]:
print(len(np.where(b['step_0'][subset]['step_1']['step_2'][water_body]['boolean'])[0]))


144

In [346]:
print(len(np.where(b['step_0'][subset]['step_1']['step_2'][water_body][indicator]['boolean'])[0]))


12

In [ ]:


In [347]:
b['step_0']['test_subset_1']['step_1']['step_2']['Yttre Brofjorden']['din_winter'].keys()


Out[347]:
dict_keys(['boolean'])

In [348]:
df0 = mww.get_data_filter_object(step=0)
df1 = mww.get_data_filter_object(step=1, subset=subset) 
wbf = mww.get_water_body_station_filter(subset=subset)
if2 = mww.get_indicator_settings_data_filter_object(step=2, subset=subset, indicator=indicator)

In [349]:
print(df0.all_filters)
print(df0.get_include_list_filter('MYEAR'))
print(df0.get_include_list_filter('STATN'))


{'exclude_list': [], 'include_list': ['MYEAR', 'STATN']}
['2016']
['FLADEN', 'SKALKORGARNA', 'VALÖ']

In [350]:
print(df1.all_filters)
print(df1.get_include_list_filter('MYEAR'))
print(df1.get_include_list_filter('STATN'))


{'exclude_list': [], 'include_list': ['MYEAR', 'STATN']}
['2016']
['FLADEN', 'SKALKORGARNA']

In [351]:
print(water_body)
print('+')
print(wbf.get_list(water_body=water_body))


Yttre Brofjorden
+
['FLADEN']

In [352]:
df = mww.index_handler.data_handler_object.all_data
df1_bool = df1.get_filter_boolean_for_df(df=df)
wb_bool = wbf.get_filter_boolean_for_df(df=df, water_body=water_body)


['FLADEN']
[]
{'STRETUDDEN', 'FLADEN', 'BROFJ'}

In [353]:
np.where(df1_bool)


Out[353]:
(array([  1438,   1439,   1440,   1441,   1442,   1443,   1444,   1445,
          1446,   1447,   1448,   1449,   1454,   1455,   1456,   1457,
          1458,   1571,   1572,   1573,   1574,   1575,   1576,   1577,
          1578,   1579,   1580,   1581,   1582,   1594,   1595,   1596,
          1597,   1598,   1711,   1712,   1713,   1714,   1715,   1716,
          1717,   1718,   1719,   1720,   1721,   1722,   1723,   1735,
          1736,   1737,   1738,   1739,   1852,   1853,   1854,   1855,
          1856,   1857,   1858,   1859,   1860,   1861,   1862,   1863,
          1875,   1876,   1877,   1878,   1879,   2090,   2091,   2092,
          2093,   2094,   2095,   2096,   2097,   2098,   2099,   2100,
          2101,   2123,   2124,   2125,   2126,   2127,   2271,   2272,
          2273,   2274,   2275,   2276,   2277,   2278,   2279,   2280,
          2281,   2282,   2301,   2302,   2303,   2304,   2305,   2445,
          2446,   2447,   2448,   2449,   2450,   2451,   2452,   2453,
          2454,   2455,   2456,   2570,   2571,   2572,   2573,   2574,
          2602,   2603,   2604,   2605,   2606,   2607,   2608,   2609,
          2610,   2611,   2612,   2613,   2710,   2711,   2712,   2713,
          2714,   2749,   2750,   2751,   2752,   2753,   2754,   2755,
          2756,   2757,   2758,   2759,   2760,   2850,   2851,   2852,
          2853,   2854,   2889,   2890,   2891,   2892,   2893,   2894,
          2895,   2896,   2897,   2898,   2899,   2900,   2979,   2980,
          2981,   2982,   2983,   3011,   3012,   3013,   3014,   3015,
          3016,   3017,   3018,   3019,   3020,   3021,   3022,   3150,
          3151,   3152,   3153,   3154,   3347,   3348,   3349,   3350,
          3351,   3352,   3353,   3354,   3355,   3356,   3357,   3465,
          3466,   3467,   3468,   3469,   4804,   4805,   4806,   4807,
          4808,   4912,   4913,   4914,   4915,   4916,   5028,   5029,
          5030,   5031,   5032,   5117,   5118,   5119,   5120,   5121,
          5225,   5226,   5227,   5228,   5229,   5329,   5330,   5331,
          5332,   5333,   5529,   5530,   5531,   5532,   5533,   5637,
          5638,   5639,   5640,   5641,   5745,   5746,   5747,   5748,
          5749,   5853,   5854,   5855,   5856,   5857,   5961,   5962,
          5963,   5964,   5965,   6069,   6070,   6071,   6072,   6073,
          9670,   9671,   9672,   9673,   9674,  10239,  10240,  10241,
         10242,  10243,  10605,  10606,  10607,  10608,  10609,  10912,
         10913,  10914,  10915,  10916,  11616,  11617,  11618,  11619,
         11620,  12265,  12266,  12267,  12268,  12269,  12843,  12844,
         12845,  12846,  12847,  13152,  13153,  13154,  13155,  13156,
         13488,  13489,  13490,  13491,  13492,  13779,  13780,  13781,
         13782,  13783,  14473,  14474,  14475,  14476,  14477,  14956,
         14957,  14958,  14959,  14960, 104910, 104921, 104932, 104949,
        104960], dtype=int64),)

In [354]:
np.where(wb_bool)


Out[354]:
(array([     7,      8,      9,     10,     11,     12,     13,     14,
            15,     16,     17,     18,     39,     40,     41,     42,
            43,     44,     45,     46,     47,    132,    133,    134,
           135,    136,    137,    138,    139,    140,    141,    142,
           143,    170,    171,    172,    173,    174,    175,    176,
           177,    178,    254,    255,    256,    257,    258,    259,
           260,    261,    262,    356,    357,    358,    359,    360,
           361,    362,    363,    364,    365,    366,    367,    394,
           395,    396,    397,    398,    399,    400,    401,    402,
           504,    505,    506,    507,    508,    509,    510,    511,
           512,    513,    514,    515,    525,    526,    527,    528,
           529,    530,    531,    532,    533,    618,    619,    620,
           621,    622,    623,    624,    625,    626,    627,    628,
           629,    656,    657,    658,    659,    660,    661,    662,
           663,    664,    740,    741,    742,    743,    744,    745,
           746,    747,    748,    749,    750,    751,    844,    845,
           846,    847,    848,    849,    850,    851,    852,    878,
           879,    880,    881,    882,    883,    884,    885,    886,
           887,    888,    889,    929,    930,    931,    932,    933,
           934,    935,    936,   1018,   1019,   1020,   1021,   1022,
          1023,   1024,   1025,   1026,   1027,   1028,   1029,   1048,
          1049,   1050,   1051,   1052,   1053,   1054,   1055,   1056,
          1274,   1275,   1276,   1277,   1278,   1279,   1280,   1281,
          1282,   1283,   1284,   1285,   1385,   1386,   1387,   1388,
          1389,   1390,   1391,   1392,   1393,   1438,   1439,   1440,
          1441,   1442,   1443,   1444,   1445,   1446,   1447,   1448,
          1449,   1468,   1469,   1470,   1471,   1472,   1473,   1474,
          1475,   1476,   1571,   1572,   1573,   1574,   1575,   1576,
          1577,   1578,   1579,   1580,   1581,   1582,   1608,   1609,
          1610,   1611,   1612,   1613,   1614,   1615,   1616,   1711,
          1712,   1713,   1714,   1715,   1716,   1717,   1718,   1719,
          1720,   1721,   1722,   1723,   1749,   1750,   1751,   1752,
          1753,   1754,   1755,   1756,   1757,   1852,   1853,   1854,
          1855,   1856,   1857,   1858,   1859,   1860,   1861,   1862,
          1863,   1889,   1890,   1891,   1892,   1893,   1894,   1895,
          1896,   1897,   2090,   2091,   2092,   2093,   2094,   2095,
          2096,   2097,   2098,   2099,   2100,   2101,   2143,   2144,
          2145,   2146,   2147,   2148,   2149,   2150,   2151,   2271,
          2272,   2273,   2274,   2275,   2276,   2277,   2278,   2279,
          2280,   2281,   2282,   2315,   2316,   2317,   2318,   2319,
          2320,   2321,   2322,   2323,   2445,   2446,   2447,   2448,
          2449,   2450,   2451,   2452,   2453,   2454,   2455,   2456,
          2504,   2505,   2506,   2507,   2508,   2509,   2510,   2511,
          2512,   2602,   2603,   2604,   2605,   2606,   2607,   2608,
          2609,   2610,   2611,   2612,   2613,   2651,   2652,   2653,
          2654,   2655,   2656,   2657,   2658,   2659,   2749,   2750,
          2751,   2752,   2753,   2754,   2755,   2756,   2757,   2758,
          2759,   2760,   2791,   2792,   2793,   2794,   2795,   2796,
          2797,   2798,   2799,   2889,   2890,   2891,   2892,   2893,
          2894,   2895,   2896,   2897,   2898,   2899,   2900,   2920,
          2921,   2922,   2923,   2924,   2925,   2926,   2927,   2928,
          3011,   3012,   3013,   3014,   3015,   3016,   3017,   3018,
          3019,   3020,   3021,   3022,   3068,   3069,   3070,   3071,
          3072,   3073,   3074,   3075,   3076,   3347,   3348,   3349,
          3350,   3351,   3352,   3353,   3354,   3355,   3356,   3357,
          3412,   3413,   3414,   3415,   3416,   3417,   3418,   3419,
          3420,   3528,   3529,   3530,   3531,   3532,   3533,   3534,
          3535,   3536,   3636,   3637,   3638,   3639,   3640,   3641,
          3642,   3643,   3644,   3744,   3745,   3746,   3747,   3748,
          3749,   3750,   3751,   3752,   3856,   3857,   3858,   3859,
          3860,   3861,   3862,   3863,   3864,   3953,   3954,   3955,
          3956,   3957,   3958,   3959,   3960,   3961,   4077,   4078,
          4079,   4080,   4081,   4082,   4083,   4084,   4085,   4237,
          4238,   4239,   4240,   4241,   4242,   4243,   4244,   4245,
          4352,   4353,   4354,   4355,   4356,   4357,   4358,   4359,
          4360,   4449,   4450,   4451,   4452,   4453,   4454,   4455,
          4456,   4457,   4557,   4558,   4559,   4560,   4561,   4562,
          4563,   4564,   4565,   4669,   4670,   4671,   4672,   4673,
          4674,   4675,   4676,   4677,   4692,   4693,   4694,   4695,
          4696,   4697,   4698,   4699,   4700,   4885,   4886,   4887,
          4888,   4889,   4890,   4891,   4892,   4893,   5000,   5001,
          5002,   5003,   5004,   5005,   5006,   5007,   5008,   5097,
          5098,   5099,   5100,   5101,   5102,   5103,   5104,   5105,
          5194,   5195,   5196,   5197,   5198,   5199,   5200,   5201,
          5202,   5302,   5303,   5304,   5305,   5306,   5307,   5308,
          5309,   5310,   5417,   5418,   5419,   5420,   5421,   5422,
          5423,   5424,   5425,   5509,   5510,   5511,   5512,   5513,
          5514,   5515,   5516,   5517,   5628,   5629,   5630,   5631,
          5632,   5633,   5634,   5635,   5636,   5736,   5737,   5738,
          5739,   5740,   5741,   5742,   5743,   5744,   5833,   5834,
          5835,   5836,   5837,   5838,   5839,   5840,   5841,   5941,
          5942,   5943,   5944,   5945,   5946,   5947,   5948,   5949,
          6049,   6050,   6051,   6052,   6053,   6054,   6055,   6056,
          6057,   6116,   6117,   6118,   6119,   6120,   6121,   6122,
          6123,   6124,   6268,   6269,   6270,   6271,   6272,   6273,
          6274,   6275,   6276,   6377,   6378,   6379,   6380,   6381,
          6382,   6383,   6384,   6439,   6440,   6441,   6442,   6443,
          6444,   6445,   6446,   6447,   6584,   6585,   6586,   6587,
          6588,   6589,   6590,   6591,   6592,   6707,   6708,   6709,
          6710,   6711,   6712,   6713,   6714,   6715,   6804,   6805,
          6806,   6807,   6808,   6809,   6810,   6811,   6812,   6932,
          6933,   6934,   6935,   6936,   6937,   6938,   6939,   6940,
        105381], dtype=int64),)

In [355]:
np.where(df1_bool & wb_bool)


Out[355]:
(array([1438, 1439, 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448,
        1449, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579, 1580,
        1581, 1582, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719,
        1720, 1721, 1722, 1723, 1852, 1853, 1854, 1855, 1856, 1857, 1858,
        1859, 1860, 1861, 1862, 1863, 2090, 2091, 2092, 2093, 2094, 2095,
        2096, 2097, 2098, 2099, 2100, 2101, 2271, 2272, 2273, 2274, 2275,
        2276, 2277, 2278, 2279, 2280, 2281, 2282, 2445, 2446, 2447, 2448,
        2449, 2450, 2451, 2452, 2453, 2454, 2455, 2456, 2602, 2603, 2604,
        2605, 2606, 2607, 2608, 2609, 2610, 2611, 2612, 2613, 2749, 2750,
        2751, 2752, 2753, 2754, 2755, 2756, 2757, 2758, 2759, 2760, 2889,
        2890, 2891, 2892, 2893, 2894, 2895, 2896, 2897, 2898, 2899, 2900,
        3011, 3012, 3013, 3014, 3015, 3016, 3017, 3018, 3019, 3020, 3021,
        3022, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356,
        3357], dtype=int64),)

In [356]:
set(df['STATN'][df1_bool])


Out[356]:
{'FLADEN', 'SKALKORGARNA'}

In [357]:
set(df['STATN'][wb_bool])


Out[357]:
{'BROFJ', 'FLADEN', 'STRETUDDEN'}

In [358]:
include_stations = ['FLADEN']
exclude_stations = []
b_inc_wb = (df['SEA_AREA_NAME'] == water_body)
b_inc_statn = (df['STATN'].isin(include_stations))
b_exc_statn = ~(df['STATN'].isin(exclude_stations ))

boolean = ((df['SEA_AREA_NAME'] == water_body) | \
                  (df['STATN'].isin(include_stations))) & \
                  (~df['STATN'].isin(exclude_stations ))

In [359]:
print(set(df['STATN'][b_inc_wb]))
print(set(df['STATN'][b_inc_statn]))
# print(set(df['STATN'][b_exc_statn]))
print('-'*50)
print(set(df['STATN'][boolean]))


{'STRETUDDEN', 'BROFJ'}
{'FLADEN'}
--------------------------------------------------
{'STRETUDDEN', 'FLADEN', 'BROFJ'}

In [360]:
set(df['STATN'][boolean])


Out[360]:
{'BROFJ', 'FLADEN', 'STRETUDDEN'}

In [361]:
set(df['STATN'][boolean])


Out[361]:
{'BROFJ', 'FLADEN', 'STRETUDDEN'}

In [326]:
wbf


Out[326]:
<core.filters.WaterBodyStationFilter at 0x915de48>

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 [ ]:


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 [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: