Code Monkey home page Code Monkey logo

opendrift's Introduction

opendrift's People

Contributors

achrefao avatar andressepulveda avatar boorhin avatar calquigs avatar ej81 avatar gauteh avatar gilesfearon avatar johannesro avatar knutfrode avatar kthyng avatar loriscalgaro avatar magnesim avatar manuelaghito avatar mateuszmatu avatar nilsmkmet avatar nsoontie avatar olebaad avatar paulskeie avatar poplarshift avatar rsignell avatar simonweppe avatar trondkr avatar ugomartinez avatar vic1309 avatar vsoch avatar ways avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opendrift's Issues

Particles caught at the boundary between two models

We use two different ocean models (KINO + SVIM) to run particles along the Norwegian coast. This works nicely but there seems to be some particles that get caught in the intersection between the two model domains. Its like they get trapped and continue to follow the outline of the boundary between models. I attach two plots showing the model domain for the KINO model and the particle tracking.

torsk_28102016_wgs84_polygon_7_kino_opendrift_15022012_to_15052012

map_NS8KM_and_KINO1600M.pdf

Problem in Basemap

Sorry for Troubling you,
I just want to create a base map for Chennai Coast. but, I don't know how to create the basemap.
Please help me to create the map for Chennai Coast.

Thanks in Advance!!!

Sinking particles

In the following example, I can't make particles to sink below -120m.
Why ?

from opendrift.models.openoil3D import OpenOil3D
import logging
from datetime import datetime, timedelta

o = OpenOil3D(loglevel=logging.WARNING)

o.seed_elements(lon=-50, lat=40., z=-20, number=10, density=1300.,
    time=datetime.now(), diameter=0.001)

o.run(time_step=30, duration=timedelta(hours=.5))
o.animation_profile(markersize=10)

Seafloor condition in OceanDrift

Hi,

Some days ago I included in OceanDrift the seafloor condition (as it is implemented in openoil):


if hasattr(self.environment, 'sea_floor_depth_below_sea_level'):
self.elements.z[np.where(
self.elements.z <
-self.environment.sea_floor_depth_below_sea_level)] =
-self.environment.sea_floor_depth_below_sea_level


It was working well. But now the drifters again cross the seafloor boundary, and I don't understand why (I am working with a copy of the master branch and ROMS_native reader). Has anything changed that I am not aware of in the master branch?

If I directly check hasattr(o.environment, 'sea_floor_depth_below_sea_level') I get it false, but the
sea_floor_depth appears as a variable if I check o.readers (output below):


, 'roms native_0': ===========================
Reader: roms native_0
Projection:
None
Coverage: [pixels]
xmin: 0.000000 xmax: 1201.000000 step: 1 numx: 1202
ymin: 0.000000 ymax: 579.000000 step: 1 numy: 580
Corners (lon, lat):
(-28.67, 52.74) (132.13, 81.81)
( 0.58, 46.46) ( 75.76, 64.55)
Vertical levels [sigma]:
[-0.984375 -0.953125 -0.921875 -0.890625 -0.859375 -0.828125 -0.796875
-0.765625 -0.734375 -0.703125 -0.671875 -0.640625 -0.609375 -0.578125
-0.546875 -0.515625 -0.484375 -0.453125 -0.421875 -0.390625 -0.359375
-0.328125 -0.296875 -0.265625 -0.234375 -0.203125 -0.171875 -0.140625
-0.109375 -0.078125 -0.046875 -0.015625]
Available time range:
start: 2013-02-01 12:00:00 end: 2013-02-28 12:00:00 step: 1 day, 0:00:00
28 times (0 missing)
Variables:
sea_floor_depth_below_sea_level
land_binary_mask
x_sea_water_velocity
y_sea_water_velocity


Thanks in advance!

Marta.

Issue with interpolation method linearNDFast

I experience a problem using the new interpolation method linearNDFast which I cant explain. I am using two ROMS (Regional Ocean Modeling System) as forcing and I do linearNDFast interpolation for the particles. I have run this setup successfully using linearND and nearest as interpolation with success, but it fails with the error pasted below using linearNDFast. It seems x and y water velocities suddenly are inf in some grid cells (y_sea_water_velocity: -inf (min) 0.420177 (max)), probably caused by the interpolation. If you could solve this issue that would be great. Thanks.

DEBUG: Unstaggering y_sea_water_velocity
DEBUG: Fetched env-block (size 340x351x12) for time before (2016-05-07 01:00:00)
DEBUG: Interpolating before (2016-05-07 01:00:00) in space  (linearNDFast)
DEBUG: Initialising interpolator.
DEBUG: No time interpolation needed - right on time.
DEBUG: Rotating vectors between 0.0 and 0.0 degrees.
DEBUG: Masking 5 elements outside coverage
DEBUG: Data missing for 7 elements.
DEBUG: Calling reader roms native_0
DEBUG: ----------------------------------------
DEBUG: Data needed for 7 elements
DEBUG: Reader time:
		2016-05-06 12:00:00 (before)
		2016-05-07 12:00:00 (after)
DEBUG: Interpolating before (2016-05-06 12:00:00) in space  (linearNDFast)
DEBUG: Initialising interpolator.
DEBUG: Interpolating after (2016-05-07 12:00:00) in space  (linearNDFast)
DEBUG: Initialising interpolator.
DEBUG: Interpolating before (2016-05-06 12:00:00, weight 0.46) and
		      after (2016-05-07 12:00:00, weight 0.54) in time
DEBUG: Rotating vectors between 0.0 and 0.0 degrees.
DEBUG: Obtained data for all elements.
DEBUG: ---------------------------------------
DEBUG: Finished processing all variable groups
DEBUG: ------------ SUMMARY -------------
DEBUG:     x_sea_water_velocity: -inf (min) 0.305204 (max)
DEBUG:     y_sea_water_velocity: -inf (min) 0.420177 (max)
DEBUG: ---------------------------------
DEBUG: 		124 active elements
DEBUG: 		69.6269992313 <- latitude  -> 70.1287789924
DEBUG: 		17.1623669881 <- longitude -> 18.7455382663
DEBUG: 		-157.5   <- z ->   -0.5
DEBUG: ---------------------------------
INFO: ========================
INFO: End of simulation:
INFO: undefined inverse geodesic (may be an antipodal point)
INFO: Traceback (most recent call last):
  File "/work-common/shared/nn9297k/Kelp/opendrift/opendrift/models/basemodel.py", line 1641, in run
    self.update()
  File "/work-common/shared/nn9297k/Kelp/kelp/kelpClass.py", line 195, in update
    self.advect_ocean_current()
  File "/work-common/shared/nn9297k/Kelp/opendrift/opendrift/models/physics_methods.py", line 110, in advect_ocean_current
    mid_env['y_sea_water_velocity'])
  File "/work-common/shared/nn9297k/Kelp/opendrift/opendrift/models/basemodel.py", line 2626, in update_positions
    azimuth, velocity*self.time_step.total_seconds())
  File "/work/apps/python/2.7.9-dso-gnu/lib/python2.7/site-packages/pyproj/__init__.py", line 780, in fwd
    _proj.Geod._fwd(self, inx, iny, inz, ind, radians=radians)
  File "_proj.pyx", line 427, in _proj.Geod._fwd (_proj.c:4299)
ValueError: undefined inverse geodesic (may be an antipodal point)

leeway

How to add Pressure, waves, temperature in leeway

Running example codegg with Telemac 3D currents field

Hello,

I'm trying to run the example codegg using a NETCDF file created from Telemac 3d currents data. The simulation is running until the end, without show any error, but the currents field are not working.

I think it could be some wrong NETCDF parameter on my netcdf file, but I don't know how tho check this, because the model is running without error message.

I will be grateful if you can test my simulation files to help me find the solution

correntes.zip

example_codegg_TELEMAC.zip

With best regards,

Taoan

Deactivation of particles incompatible with use of environment_profiles

When using turbulent mixing with diffusivity profiles read from nc files, the model crashes when the first particles get stranded/evaporated/deactivated.

This is because self.elements delivers arrays of different shape than the second dimension of arrays delivered by self.environment_profiles.

for example,
self.elements.z.shape[0] is different from self.environment_profiles['sea_water_diffusivity'].shape[1]
after the first elements have been deactivated.

The crash occurs during
Kprofiles[upper, range(Kprofiles.shape[1])]

because upper is assigned from self.elements.z
and Kprofiles from self.environment_profiles.

There needs to be a check if some elements are inactive, or self.elements.z has to deliver the whole array including deactivated elements.

reader error

While running the code as a file it's working fine.
But implementing the code within the python function , it showing this error
Please provide Reader object

What I have to do for this kind of error.
Please help!!!
Thanks in Advance!!!

OpenOil Noaa

In Openoil3D:
Getting Error: 'OilProps' object has no attribute 'oil_water_surface_tension'
Why I am getting this issue.
Please Help to Resolve the error..
Thanks in Advance!!!

About miss NOAA database

Dear authors,
I have installed OilLibrary for my Oil model which I am using. However, when I ran oil model I got this error:
ValueError: Oil type "ARABIAN MEDIUM, API" not found in NOAA database

Would you please help me fix this error? Or If I want to reinstall OilLibrary what I should do that?
I install it on ubuntu 12.04 (64bit).

Thanks and best regards,

OpenDrift and GoogleMaps

I would like to put the trajectories produced by OpenDrift over GoogleMaps, and two ideas come to my mind:

  1. Make the plot's background transparent (and possibly remove the coastline)
  2. Export the trajectories as a matrix
    time lat1 lon1, lat2, lon2, ...., latn, lonn
    and use an external function to plot them on GoogleMaps

Do you have any other options, or suggestions on which file to modify for 1) or 2) ?

Thanks,

Andres

Inconsistency between wind- and wave driven mixing

There is a inconsistency between vertical mixing of oil droplets between using wind- and the respective wave parameterization. The test_physics module has a test for both.

Wave-driven mixing uses
o.fallback_values['sea_surface_wave_period_at_variance_spectral_density_maximum'] = 5.8
o.fallback_values['sea_surface_wave_significant_height'] = 2.5
and yields the following vertical profile:
wave

Using a wind-driven mixing with corresponding intensity
o.fallback_values['x_wind'] = 10
gives
wind

If fallback values for both are given, which is the methods that is most realistic to apply,
we get:
wind_and_wave

All three methods should give similar results if the parameterizations were correctly implemented. I'll be working on this now.
@knutfrode let me know if you have any ideas about this.

Oil droplet size distribution

This is how we can seed particles with a discrete log distribution of droplet radius:

dmax, dmin = 1.e-3, 1.e-6
logstep = 0.9
diameters=[dmax]
while diameters[-1] > dmin/logstep:
    diameters.append( logstep * diameters[-1])

for d in diameters:
    o.seed_elements(lon, lat, z=0., number=nparticles, time=time,
                density=865, radius=2500 , diameter=d, entrainment_length_scale=lw ) 

logstep caracterizes the slope of the particle size distribution.

Residence time?

I would like to use OpenDrift to study the residence time of a semi-enclosed area. I would need to

  1. Prevent particles from stranding
  2. Fill the area with as many particles as possible
  3. Discard those leaving a defined boundary

Any hinds on how (if possible) to define this here? Thanks

Problem when plotting with background field

Sometimes reader_x, reader_y contains NaN values, and basemodel.get_map_background() fails.
Could be fixed by something like:

reader_x[np.isnan(reader_x)] = <somevalue>
reader_y[np.isnan(reader_y)] = <somevalue>

No legend labels in examples

Hi all,

When running most of the examples (except those for OilSpil) I get the following warning:

UserWarning: No labelled objects found. Use label='...' kwarg on individual plots.
warnings.warn("No labelled objects found. "

I'm relatively new to python, so maybe there is a simple solution to this but I haven't found it so far.

Thanks for any help!

Using a land mask from shapefile

Hello,

I would like to know if there is some method to use a land mask from a shapefile or another file type in opendrift simulations.

I have a shapefile with better resolution to my study area than that from Base Map data, and I would like to use it.
If you have some idea, please share with me.

With best regards,

Taoan

sequential seeding of particles (example_grid_time.py)

Hi,
It seems to be a problem with the output-writing routine when doing sequential deployments of particles. I have checked that one gets it also when using the example_grid_time.py from the examples folder.
The run goes well and one can see very nice trajectories of the particles with o.animation().
However, when trying to write the output into a file the writing routine seems to have a problem:


start_time = reader_norkyst.start_time
time_step = timedelta(hours=6)
num_steps = 10
for i in range(num_steps+1):
o.seed_elements(lons, lats, radius=0, number=100,
time=start_time + i_time_step)
o.run(steps=66_4, time_step=900,outfile='test.nc')


Only the trajectories of particles deployed at the initial time are properly saved. Starting from particle 100, the output I got (ie, for the records lon,lat,z,age,..in the file test.nc ) has nonsense (at least at first glance!).
Any idea?
Thanks in advance!

Marta.

Implement modular mechanism for export and import

In practice, a main "writer" of NetCDF-format will be used.
However, export should be generic, so that it will be possible to add other writers (e.g. ASCII, Diana...)

Also, it is desirable to start a simulation from a state (particles at certain instant) imported from any exported file.

An internal "Common Data Model" is needed.

Translation ?

Is there an easy way to change the language of the labels ("initial","stranded","active"). I could help with the terms in spanish!

Problem With Animation

Dear Knut

I'm new in OpenDrift and python and I have a problem with animation of examples, when I run the models no show the animation only the plot and display following:

INFO: Saving animation to openoil_time_seed.gif...

Could not save animation:INFO: save() got an unexpected keyword argument 'clear_temp'
DEBUG: Traceback (most recent call last):
File "models\opendrift.py", line 1006, in animation
anim.save(filename, fps=20, clear_temp=False)
TypeError: save() got an unexpected keyword argument 'clear_temp'

I'm Using python(x,y) and the file that I ran was "example.py"

regards
Ricardo

High resolution Coastline configuration

Hi,

I tried to use my own coastline with a very high resolution. However OpenDrift still using default Basemap instead. I don't know what's the problem. I tried to configure (o.set_config('general:use_basemap_landmask', False) as you said in #62 , but still doesn't work. I need to do something else?

I attach my program. Can you tell what I am doing wrong?

example.zip

Thanks in advance,
Gino

variable T,S in mixing inner loop

At present, temperature and salinity is not updated within each inner loop time step as the particle moves up and down in the water column. This is critical for near-neutral buoyant particles that move through density gradients.

T,S have to be updated each time step using environment_profiles.

Generic rotation of vectors from any coordinate system to another

In general one obtain and combine vectors (e.g. wind, current) from files of different coordinate systems (map projections). Thus a rotation of coordinate systems (vectors) is needed.

Must be accurate, fast for large datasets, and handle map projection singularities (e.g. North Pole).

This task has been on hold due to an apparent bug in Pyproj:
pyproj4/pyproj#5

openoil

I am changing viscosity and density in the model, but there are no changes taking place (Evaporation remains same)
how to change those values ....
please help!!

Thanks in Advance!!!

Problem with animation after saving an animation

After one animation has been saved to file (gif or mp4), preceding animations from the same simulation always show final element positions along with current positions.
This might be a bug in matplotlib.

module not found

Hi, I have the following problem. If I do

mosa@parti-mosa:~/opendrift/tests$ python test_netcdf.py
Traceback (most recent call last):
File "test_netcdf.py", line 22, in
from opendrift.readers import reader_ROMS_native
ImportError: No module named opendrift.readers

the module is not found.

However, from the command line, in python itself, it works

mosa@parti-mosa:~/opendrift$ python
Python 2.7.14 |Anaconda, Inc.| (default, Oct 16 2017, 17:29:19)
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import unittest

from opendrift.readers import reader_ROMS_native

Seems there is some configuration missing.

[UPDATE] The previous case work from the opendrift directory, but not while in opendrift/eamples or other places

The testall script seems to work, ends like this:

Ran 68 tests in 30.658s

OK (skipped=5)

Problem with multi-seed where one of the seeds varies with time

The following example fails with message

TypeError: Input arrays must have same length. Lengths given: [2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2080, 2040]
from datetime import timedelta

from opendrift.readers import reader_basemap_landmask
from opendrift.readers import reader_netCDF_CF_generic
from opendrift.models.openoil3D import OpenOil3D

o = OpenOil3D(loglevel=0, weathering_model='noaa')  # Set loglevel to 0 for debug information

reader_arome = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc')
reader_norkyst = reader_netCDF_CF_generic.Reader('http://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be')

o.add_reader([reader_norkyst, reader_arome])

# Seeding some particles
lon = 4.9; lat = 62.1; # Stad
time = reader_arome.start_time
# Seed oil elements at defined position and time
oiltype='AVALDSNES'
o.seed_elements(lon, lat, z=0, radius=1000, number=2000, time=time, oiltype=oiltype)
o.seed_elements(lon+.2, lat-.3, z=-100, radius=100, number=100, time=[time, time+timedelta(hours=5)], oiltype=oiltype)
o.seed_elements([lon, lon+.2], [lat, lat-.3], z=-100, radius=[100, 500], number=100, time=[time, time+timedelta(hours=5)], oiltype=oiltype)
# Running model
o.run(steps=8, time_step=900, time_step_output=1800, outfile='ex_json.nc')

Animation of part of the domain?

Hi,
I am running OpenDrift (using OceanDrift) for a large domain, but I would like to save the animation for a smaller area of it. How can define this window? (o.animation)

Would it apply for the final plot also? (o.plot)

Added radius to Proj

Hi. I had to add a few parameters to the Proj command in opendrift.py in line 727 for backward compatibility with older libraries:

proj = pyproj.Proj('+proj=aea +lat_1=%f +lat_2=%f +lat_0=%f +lon_0=%f'
% (lats.min(), lats.max(),
(lats.min()+lats.max())/2,
(lons.min()+lons.max())/2))
Changed to:
proj = pyproj.Proj('+proj=aea +lat_1=%f +lat_2=%f +lat_0=%f +lon_0=%f +R=6370997.0 +units=m'
% (lats.min(), lats.max(),
(lats.min()+lats.max())/2,
(lons.min()+lons.max())/2))
'

Can not save movie

Dear all,
I get this error when I have saved a movie:
## RuntimeError: Error creating movie, return code: 1 Try setting mpl.verbose.set_level("helpful")

Please show me how to solve it?

Thanks you!

Interpolation in space and time

Horizontally: bilinear interpolation (alternatives are possible, but probably not needed)
Time: Linear
Vertical: more complex.

A core "interpolator" function is implemented. Possible to override (overload) by modules (subclasses).

Readers not added for the some variables

On GUI I got the announcement:
Readers not added for the following variables:
ocean_vertical_diffusivity
sea_surface_wave_period_at_variance_spectral_density_maximum
upward_sea_water_velocity
I guess I have problem with the database from these links:
'http://data.ncof.co.uk/thredds/dodsC/METOFFICE-GLO-AF-PHYS-HOURLY-CUR', 'http://oos.soest.hawaii.edu/thredds/dodsC/hioos/model/atm/ncep_global/NCEP_Global_Atmospheric_Model_best.ncd'])
Hope the authors can help. Thanks in advance.

Shipdrift grb files not working

how to make shipdrift work with grb files.
I Having grb files related to wind and current.
Please Help!!
Thanks in Advance!!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.