New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to add reader from a local file and import landmask #337
Comments
Hi, This seems to be a recent bug for Windows, related to file permissions for the landmask. If it does not work, I will have a closer look at the code in a few days. |
Hi,
|
Also need to inform that after deleting the landmask folder when i run the command "reader_landmask = reader_global_landmask.Reader(extent=[2, 8, 59, 63])", the landmask folder is created again and i can also see the file mask.dat file in the folder. |
Hi, the landmask is probably generated as it should. It is a message notifying that on windows it is not possible to lock the landmask generation. Normally this is only shown once. I think the permissions message is shown every time (on windows), but it does not stop the reader. |
Fixed the landmask error message in OpenDrift/opendrift-landmask-data@a7479b0, but have not made a new release yet. |
Hi, thanks for the reply. Can i somehow use the Opendrift version where this error is fixed but not release yet? |
When trying to run some examples, I'm getting the below error it says "FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\Users\2915803\AppData\Local\Temp\landmask\.mask.dat.lock'". Do you still think that landmark should be generated as usual? Please let me know about this so that i can ignore the error for future simulations. Thanks! 17:01:31 INFO: Adding a dynamical landmask with max. priority based on assumed maximum speed of 1.3 m/s. Adding a customised landmask may be faster... |
Yes, you can ignore it. The error will disapear in the next version. The
other error about the missing nc file you have to fix somehow. You can also
use the unreleased version, but it is not necessary. See the docs for an
example. You would have to do the same for the opendrift-landmask-data
package.
ons. 15. jul. 2020, 17:50 skrev mevo-creator <notifications@github.com>:
… When trying to run some examples, I'm getting the below error it says
"FileNotFoundError: [WinError 2] The system cannot find the file specified:
'C:\Users\2915803\AppData\Local\Temp\landmask\.mask.dat.lock'". Do you
still think that landmark should be generated as usual? Please let me know
about this so that i can ignore the error for future simulations. Thanks!
17:01:31 INFO: Adding a dynamical landmask with max. priority based on
assumed maximum speed of 1.3 m/s. Adding a customised landmask may be
faster...
ERROR:root:could not verify read permissions for group and others on
landmask.
Traceback (most recent call last):
File
"C:\Miniconda\envs\opendrift\lib\site-packages\opendrift_landmask_data-0.6-py3.8.egg\opendrift_landmask_data\mask.py",
line 77, in *check_permissions*
if not os.stat(self.lockf).st_mode & 0o777 == 0o777:
FileNotFoundError: [WinError 2] The system cannot find the file specified:
'C:\Users\2915803\AppData\Local\Temp\landmask\.mask.dat.lock'
17:01:36 INFO: Using existing reader for land_binary_mask
17:01:37 INFO: Moving 1 out of 2000 points from land to water
17:01:37 INFO: Oil-water surface tension is 0.022288 Nm
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#337 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAN366FA45POI3JMH26KJ3R3XF45ANCNFSM4O2PBTNQ>
.
|
Thanks so much...appreciate your help! |
Yes, this is all possible with PlastDrift module. But you will need a lot of input/forcing data for such a long term simulation. I believe the other problem with the missing netCDF-file is that the file is not in your work folder. This specific file may be accessed with absolute path as in several of the example scripts, e.g. https://opendrift.github.io/gallery/example_generic.html#sphx-glr-gallery-example-generic-py |
Hi,
Finally, I must say that I was inspired by your presentation with some of your colleagues on "Simulated pathways of microplastics into the Arctic Ocean" that I found online. I saw some results for the distribution of plastics after 1-3 years. So I believe it could be possible to do this :) Just would like to add that in case if it is not realistic to run the simulation for such a long time, it would also be helpful to run the simulation for a shorter time scale and in two dimensions. Thanks again! |
Hi, can someone from the team please share their thoughts regarding the possibility of using Opendrift for long time scale simulation in line with my above queries...thanks so much! |
Hi, Here is a template script in the direction of what you need:
NorKyst covers the time from Sep 2016 until now, but not the Barents Sea. I believe the best sources for your purpose (as in example above) are the SVIM ocean model (1960-2019) for currents, and the NCEP GFS atmoshperic model (6 May 2011 until present) for winds. The number of particles and duration is only limited by the memory available on your computer. OpenDrift flushes to disk every 100 time steps as default, and thus it is feasible to use ~million of particles over many years. The only challenge is that the output files are getting very large, and it may not be possible to re-import the output file into memory, in able to use the built-in plotting/analysis methods. You could play with the example script, and then increase the length and number of particles after confirming that output is as you like. The |
Hi @knutfrode , Thank you so much for detailed explanation of my query and providing me the example script to practise the simulations. I've tried running the script and it works well. I would like to learn more about in-built function and configurations for plastdrift model. |
The vertical diffusivity determines the degree to which elements are mixed upwards and downwards due to turbulence (random walk scheme as described in Nordam2019), partly counteracting buoyancy which is normally upwards/positive for plastics (but you may also specify negative buoyancy as is normal for e.g. sediment drift). The value of vertical diffusivity is ideally acquired from an ocean model, in which case you should specify However, this parameter is not always available in ocean model output files, and in this case it may be parameterized from wind (higher wind means more waves and thus vertical turbulence/mixing). E.g. it is included in the NorKyst model (with limited spatial and temporal coverage), but not in the SVIM model as in the example above.
This example script illustrates the vertical variation and wind speed dependence of diffusivity for the various parameterisations. The buoyancy is given by the |
Thank you for explaining different functions for vertical diffusivity and sharing the paper about this concept...I'll try out 'environment' using Norkyst model. I need to bring a couple of points into your notice about what we are trying to do and if it can be achieved by PlastDrift model.
Please share your thoughts about this as per your convenience....thanks so much. |
Hi @knutfrode |
If the polymers are dissolved in water, you should instead use the OceanDrift model, which is the parent class of the PlastDrift model. You should then perhaps also leverage on the restriction to only read the upper few meters of the ocean, as polymers may be found at any depth. However, this also means that the simulation will take quite a bit longer, as more ocean model data has to be read/ingested. On the other hand, you may in this case skip the windage and Stokes drift, which only applies to the upper meter or so. And also you may skip vertical mixing, which is here less relevant. So I might suggest something like this (not tested):
With these conditions (ie. flow is particle-independent), I would believe the outcome is already given: the water/polymers from anywhere in the Norwegian seas will generally drift nortwards, where much of it will enter the Barents/Arctic Seas, where it may reside for some years, before eventually flowing southwards again in the Fram Strait. But there will be temporal variations in the drift, so you should probably release particles during your whole simulation period. |
Hi @knutfrode , Appreciate your quick and detailed response. I'll run the script and come back to you for further doubts..!! |
Hi @knutfrode , Thanks again for your help. I ran the script provided by you and it worked well. However all the particles gets seeded at 20 m depth (I think because of z = -20 here o.seed_elements(lon=2, lat=60, number=3000, z=-20, time=seed_time)). The polymers will be randomly distributed along the depth and therefore based on this example, I changed the code as below and this also worked well. 1000 particles got seeded and drifted for 30 days. from datetime import datetime, timedelta # However, when I tried to seed 10000 particles with the same code as above, there was an error as below. There might be many polymer particles as the concentration will be in nanogram/litre. therefore would like to seed more particle than 1000. Also, randomly distributed throughout the depth. Can you please guide me if the above code is the right approach for randomly seeding particles across the depth and for the higher time period as well. Also, if it is a right approach how can we resolve the error below to seed more particle. 02:53:09 DEBUG: Parsing variable: wro 02:53:30 INFO: 'The simulation stopped before requested end time was reached.' Simulation aborted. 'The simulation stopped before requested end time was reached.' Traceback (most recent call last): (opendrift) C:\Users\mevo> |
There seem to be a Windows-issue(?) with the parallel processing. I will try to reproduce. |
Adressing parallelisation issue on Windows: #337
I could not reproduce this problem, so it seems to be a Windows issue. This page might explain why the parallell processing failed on your machine: I implemented the suggestion there (3be2199), so if you now update your OpenDrift ( Since there is a new dependency in the meantime, you also need to update your conda environment. Updating directly with conda often fails, so I recommend deleting and creating anew with:
|
Hi @knutfrode , Thanks so much for the solution. I did a git pull and updated environment as you suggested and I was able to run the script for 10000 particles for 30 days. After git pull, the parallel processing fails but it falls back to single processor Multiprocessing has previously failed, reverting to using single processor for lonlat -> xy. Now I wonder what could be the best alternative to simulate the same set of particles for a year or more than that. I remember your suggestion of storing output every 10 days (perhaps I can do it 30 days as well). But would it be possible to simulate same set of particles? for instance, now I have run this script for 30 days when I will run the script again for next 30 days, I need to seed the particles again and therefore previous particle trajectories will be lost somehow (even if it is stored in the output file). Please guide me how can we best approach longer time scale without disturbing particle trajectories from the previous simulation. I guess the comment you made previously (please see below), will also play some role in reaching to solution for longer time scale.
|
You need to do a single, long simulation in able to track the same particles over a longer time. You could e.g. seed particles over 2 years, and simulate for 3 years (i.e. the last year no more particles are released). It is not a big problem that the parallelisation does not work, as this is just a minor part of the simulation. The most time consuming part is to read the ocean model data, so a 3 year simulation probably takes several days. I recommend storing the log to a file, with
|
Hi @knutfrode , Thank you for your answer. I was able to run and plot the results for 1000 particles and 30 days. It takes some time for making .gif and mp4 file for animation (around 20-25 minutes). I think it might take a long time for more than 30 days to plot the results.
Please guide me about this as per your convenience. Thanks so much! |
The time to conduct a simulation is approximately proportional to the total simulation duration. The size of the output file is proportional to number of particles and number of output time steps. The time to make an animation is proportional to the number of output time steps, and might thus be faster for a long simulation with 10 days output: Seeding duration does not affect performance, only the number of particles. The mentioned warning can be ignored. |
Hi, Appreciate your quick response...thank you. |
Hi @knutfrode , I ran simulations for 1 and 2 years for 1000 particles, the simulation runs ok. My primary goal behind running these simulations over a longer time scale is to get some idea regarding "accumulation" of the particles in a particluar area for a long time. From one of your previous comment as quoted below,
I can reconcile the drift of particles. For instance, from simulation over 2 years, majority of the particles end up in the Barents sea and some stay along the coastline. However, the particles are scattered all around, as we can see from the results below and perhaps bit difficult to say something concrete about accumulation. The objective behind trying to see the "accumulation" of particles and/or "duration of accumulation" is to get some prediction about risk related to increase in concentration of polymers in a particular area when we have a continuous discharge. From the results below, we can say something about accumulation but perhaps not something precise. So I need to ask two things
I understand that the drift of particles will be quite random, but just wondering if there is some other function/configuration within the model that can help me to come close to what I'm trying to achieve in terms of accumulation. Can you please comment on this as per your convenience, thank you. |
Hi, Similar to the above 5 years simulation, now I am trying to run the simulation for 10 years. I check the log file daily and got this error Error.txt today. The model was running ok until step 15013, however, some error occurred at step 15014. After this error, there is no interpolation in log also the number of missing elements disappeared suddenly from the previous step. Also, this error now continues to appear in every step with no interpolation showing up. Is it advisable to continue the simulation with this error? |
Hi @knutfrode , can you please look into the error? |
The error should indicate that data is missing for the given times. The simulation can continue, but you will only get fallback values (0 wind, 0 currents). You could try again to start a simulation at that specific time, to see if the same happens again. If so, there seem to be a hole in the SVIM dataset. |
ok. I understand. Thank you for the suggestion, I'll try to start the simulation at that time and see how it goes. |
Hi, Assuming there is a hole in the dataset, I changed the timescale and shifted it from 2000 to 1990 in another simulation. For this simulation, the same error started appearing from step 19190 (26/July/1996), please see the file Can you please see what could be the error in this case, Thanks. |
Hi @knutfrode , can you please comment on what could be the issue in above case and if there is some solution for this, Thanks. |
When there are holes in the dataset, the simulation will stop, unless you have added other backup readers, or provided fallback value for the given parameter. For OceanDrift, default fallback values of 0 are given for current, so that the simulation will not stop, but elements will not be moved until you have passed the hole. |
Yes I understand this. However as you had suggested earlier to start simulation at the time where the log start showing hole in the data set, just to perhaps confirm if there is really a hole in the data set. I did this cross-check by running another small simulation at the time when it starts showing hole in the longer simulation and surprisingly shorter simulation worked quite well. Does it not prove that there is perhaps no hole (unless I am missing out on something) Please see the log that I have shared above. |
Yes, if you start the new simulation before/during the hole, and not afterwards, one would expect it to fail as well. |
I see...I think that is the exact issue. The thredds become unavailable for long time scale simulations. I noticed that for the simulation that i started for 10 years and 15 years. So actually there is no hole but unavailability of the thredds server for some time. It seems like there is no solution to this issue. I can confirm that when I plotted the 10 years simulation the particles were frozen (because of fall back velocity 0) for the duration server was not available. The purpose of running this long term simulation (10-15 years) is to see how long it takes for all water in the North/Norwegian sea to leave this area (volume flux, we can perhaps make some conclusion from the particles that are going out of coverage area (?)) and for freshwater to come from South. So that we can conclude that all the water in the North/Norwegian sea will be polymer-free after so and so years. do you have some suggestions to approach this? |
Hi @knutfrode , I am just sharing the result from the 10-year simulation through this link https://liveuis-my.sharepoint.com/:v:/g/personal/2915803_uis_no/EanqiCbZt4hIpCaFA-IoWjcB3T4vY2sC8podCfC1YcqqFA?e=pzzXQ4. Please see if it is possible to open it. The issue is that the model stops for about 3 years. It seems like a long time for the server to be unavailable. |
I can see the movie. Anyway, these results can of course only be used until the data are unavailable. So if you need a longer simulation, you would need to re-run it. However, a continuous uptime of the thredds-server can unfortunately not be guaranteed. |
ok..I used |
Hi @knutfrode , I am trying to run a new simulation with SVIM dataset, however below error is popping out when trying to read the dataset. Can you please see what is the issue? Thanks |
I cannot reproduce this problem, as the following works fine (though takes some time):
Can you try once more? If it does not work, you could try to update OpneDrift and dependencies with
|
I did try again after updating Opendrift and dependencies (in two computers) and the exact error appears in both the system. I just edited the error because the model showed few more steps before showing the same error again.
I was using the above command previously. But the command you suggested also doesn't work. Something is strange.
|
Hi @knutfrode , I tried again today but the same error persists, could this be a windows issue? This command doesn't work either and gives the error as mentioned in the above comment. was it possible to read the SVIM data set in windows in the latest Opendrift version (1.4.0), when you tried to reproduce the error? Could you please suggest the way forward? Thanks I just removed and re-installed the model but still getting the same error when trying to read the dataset, please help as per your convenience :) |
Hi @knutfrode , The code stops running at line 196 in reader_ROMS_native.py which is related to datetime. It seems like this is the windows issue, I found this discussion on Python webpage This and this. It seems like something similar is going on in the error that I'm getting. could you see some way to get around the error? ` |
Yes, it seems to be a Windows issue. But perhaps you can try in the meantime yourself to find a workaround (in reader_ROMS_native.py) according to discussions like the following? |
ok. I'll try to go through the discussion to find a way. I am a beginner in python so not sure how much I could achieve but I'll give it a try :) Thanks! |
Hi @knutfrode , The above issue related to windows got solved by itself in Opendrift version 1.4.2. I've another query if you could guide me with. From literature studies, we have found that the sunlight (weathering) is responsible for breaking down of polymers over a period of time. However, the impact of solar irradiation changes with latitude and depth in the water column. We are trying to use Opendrift for analysing how the number of particles are changing with depth. Basically, trying to see at what depth the majority of particles end up after each time step. Is there any plotting/analysis tool within Opendrift that can give us output in terms of statistics (numbers) of particles at different depths? For instance, if 200000 particles are seeded and tracked for a year, after each time step what percentage of particles are between 0 and 10m, 10 and 20m and so on. I did find an interesting plotting method |
There are no specific methods to provide such statistics, but this should be fairly straightforward to do as post-processing from the history-array.
|
ok. I would imagine so since the position of particles is stored in the output file at each time step. But how can we approach this post-processing from history-array. Do we need to import the position of particles from output file and make our own analysis method? it would be helpful if you could explain this briefly on how we could approach this? I'll wait for more time for plotting |
If you import the simulation to an object This is also stored the same way as variable From there you would need to make your own analysis method for what you want to achieve. |
Ok. I will try and implement this approach. Thank you for your guidance. |
Hi @knutfrode , I need to understand the resolution of the SVIM currents data set inorder to refer it in the publication ('https://thredds.met.no/thredds/dodsC/nansen-legacy-ocean/svim_daily_agg') that we are using as a reader in this simulation. I found this link SVIM that archives the data set. Also, this publication that explains how the SVIM data was generated. I need to know if this is the right link and publication corresponding to SVIM data set, please confirm this. Thanks |
I can confirm that this is the right link and reference. |
Thank you so much for quick response! |
Closing, re-open if needed. |
Hello Team,
First of all, Congratulations and thanks so much for developing easy to use open source trajectory modelling software. I'm new to python and hope i can use this software for my PhD research here at University of Stavanger in Norway. I've installed Opendrift and trying to run tutorials and examples. However, when running tutorials, I'm getting error when trying to add reader from a local file and also when trying to import landmask. Can someone please guide me about this issue. I'm pasting errors below.
Thanks in advance!
-------------Error while trying to add reader from a local file--------------
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\mevo.conda\envs\opendrift\lib\site-packages\opendrift\readers\reader_netCDF_CF_generic.py", line 144, in init
raise ValueError(e)
ValueError: [Errno 2] No such file or directory: b'norkyst800_16Nov2015.nc'
-------------------- Error when importing landmask--------------------
The text was updated successfully, but these errors were encountered: