# -*- coding: utf-8 -*- """ Created on Fri Dec 6 19:53:24 2013 @author: heijer """ from jarkus.transects import Transects import numpy as np Jk = Transects(url='http://dtvirt5.deltares.nl:8080/thredds/dodsC/opendap/rijkswaterstaat/jarkus/profiles/transect_r2013_filled.nc') ids = Jk.get_data('id') idxs = np.floor(ids/1e6) == 8 for idx in np.nonzero(idxs)[0]: Jk.set_filter(alongshore=idx) with open('transect_%i.jrk'%ids[idx], 'w') as f: f.write(Jk.get_jrk())
with open("C:/Users/cijzendoornvan/Documents/GitHub/jarkus/jarkus/Settings.txt" ) as file: settings = json.load(file) Dir_per_transect = settings['Dir_C3'] Dir_per_variable = settings['Dir_D1'] Dir_variable_plots = settings['Dir_D4'] years_requested = list(range(1965, 2020)) labels_y = [str(yr) for yr in years_requested][0::5] ################################## #### INITIALISATION #### ################################## # Collect the JARKUS data from the server Jk = Transects(url=settings['url']) ids = Jk.get_data('id') # ids of all available transects remove1 = list(range(2000303, 2000304)) remove2 = list(range(2000720, 2000721)) remove3 = list(range(2002019, 2002020)) remove4 = list(range(4002001, 4005917, 1)) remove5 = list(range(5003300, 5004000, 1)) remove6 = list(range(6000416, 6000900, 1)) remove7 = list(range(6003070, 6003453, 1)) remove8 = list(range(8000000, 8005626, 1)) remove9 = list(range(9010193, 9010194, 1)) remove10 = list(range(10000000, 10001411, 1)) remove11 = list(range(11000660, 11000661, 1)) remove12 = list(range(11000680, 11000681, 1)) remove13 = list(range(11000700, 11000841, 1))
def setUp(self): from jarkus.transects import Transects self.tr = Transects()
from pybeach.beach import Profile get_ipython().run_line_magic('matplotlib', 'auto') #%% ################################## #### RETRIEVE DATA #### ################################## # load basic settings from .txt file with open("C:/Users/cijzendoornvan/Documents/GitHub/jarkus/jarkus/Settings.txt" ) as file: settings = json.load(file) # Collect the JARKUS data from the server Jk = Transects(url=settings['url']) ids = Jk.get_data('id') # ids of all available transects #%% ################################## #### USER-DEFINED REQUEST #### ################################## # Select whether this is a new run, or whether a dimension is recalculated or added to the dataframe new_run = False # Select which dimensions should be calculated from the transects dune_height_and_location = False mean_sea_level = False mean_low_water = False mean_high_water = False intertidal_width = False
class UnitTests(unittest.TestCase): def setUp(self): from jarkus.transects import Transects self.tr = Transects() def test_initurl(self): from jarkus.transects import Transects url = 'http://opendap.deltares.nl/thredds/dodsC/opendap/rijkswaterstaat/jarkus/profiles/transect.nc' self.assertEqual(Transects(url=url).url, url) def test_set_filter_bool(self): shape = self.tr.ds.variables['id'].shape B = np.ones(shape) == 0 # all false idx = -1 B[-1] = True self.tr.set_filter(alongshore=B) self.assertEqual(self.tr.get_data('id'), self.tr.ds.variables['id'][idx]) def test_set_filter_id(self): id = 7e6 self.tr.set_filter(id=id) self.assertEqual(self.tr.get_data('id'), id) def test_set_filter_idx(self): idx = -10 self.tr.set_filter(alongshore=idx) self.assertEqual(self.tr.get_data('id'), self.tr.ds.variables['id'][idx]) def test_set_filter_year(self): self.tr.set_filter(year=2006) def test_get_jrk(self): idx = 100 self.tr.reset_filter() self.tr.set_filter(time=-1) ids = self.tr.get_data('id') idx = np.nonzero(ids==8006000)[0] self.tr.set_filter(alongshore=idx[0]) self.tr.get_jrk()