def test_openberg(self): """Check if weighting array is set correctly and if model returns expected positions""" o = OpenBerg(loglevel=50) reader_current = reader_netCDF_CF_generic.Reader( o.test_data_folder() + '14Jan2016_NorKyst_z_3d/NorKyst-800m_ZDEPTHS_his_00_3Dsubset.nc') reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=3., llcrnrlat=60., urcrnrlon=5., urcrnrlat=63.5, resolution='c', projection='gall') # reader_basemap = reader_basemap_landmask.Reader(llcrnrlon=-1.5, llcrnrlat=59, urcrnrlon=7, urcrnrlat=64, resolution='c') o.add_reader([reader_current, reader_basemap]) o.seed_elements(4., 62., time=reader_current.start_time) o.run(steps=1) arr = [ 0.16072658, 0.16466097, 0.17384121, 0.17325179, 0.1715925, 0.15592695 ] for indx in range(len(arr)): self.assertAlmostEqual(o.uw_weighting[indx], arr[indx], 8) self.assertAlmostEqual(o.history['lon'].data[0][1], 3.9921231, 3) self.assertAlmostEqual(o.history['lat'].data[0][1], 62.0108299, 3)
def test_openberg(self): """Check if weighting array is set correctly and if model returns expected positions""" o = OpenBerg() o.set_config('drift:current_uncertainty', 0) o.set_config('drift:wind_uncertainty', 0) reader_current = reader_netCDF_CF_generic.Reader( o.test_data_folder() + '14Jan2016_NorKyst_z_3d/NorKyst-800m_ZDEPTHS_his_00_3Dsubset.nc') reader_landmask = reader_global_landmask.Reader() o.add_reader([reader_current, reader_landmask]) o.seed_elements(4., 62., time=reader_current.start_time) o.run(steps=1) arr = [ 0.16072658, 0.16466097, 0.17384121, 0.17325179, 0.1715925, 0.15592695 ] for indx in range(len(arr)): self.assertAlmostEqual(o.uw_weighting[indx], arr[indx], 8) self.assertAlmostEqual(o.history['lon'].data[0][1], 3.9921231, 3) self.assertAlmostEqual(o.history['lat'].data[0][1], 62.0108299, 3)
o.seed_elements(3.3, 60., radius=3000, time=reader_current.start_time, water_line_length=100, keel_depth=90, number=100) print('Starting free run .../n') print('Start time: ' + str(o.start_time)) ####################### # Running model ####################### o.run(time_step=3600, steps=steps) ######################### # Print and plot results ######################### o.plot() o.animation(filename='example_det.gif') #%% # .. image:: /gallery/animations/example_det.gif print('############## Latitudes:', o.history['lat']) print('############## Longitudes:', o.history['lon'])