OpenDrift / opendrift

Open source framework for ocean trajectory modelling
https://opendrift.github.io
GNU General Public License v2.0
245 stars 120 forks source link

How to compare 3 simulations #699

Closed Nichsouz closed 1 year ago

Nichsouz commented 3 years ago

Hello!!

I am trying to create a plot comparison using 3 simulations, however, I still haven't had progress.

For example:

o.plot(compare=[o2,o3]) o, o2, and o3 are loaded and functional. I can plot them individually or compare every 2 of them. But when I try to include a third one it fails. I still believe the problem is the syntax I am using, but I couldn't manage to make it better.

Is there a way to compare the plot of 3 simulations within opendrift? Thanks in advance.

knutfrode commented 3 years ago

Your syntax seems correct. Can you post the error message?

knutfrode commented 3 years ago

And, btw, can you try the same with animation instead of plot?

Nichsouz commented 3 years ago

Your syntax seems correct. Can you post the error message?

image

I tried uploading a picture. Important remarks: I made the simulations and created a .nc file to make it easier. The simulation origin of all files has the same coordinate.

The error message is:

Traceback (most recent call last): file ", line 1, in file "...basemodel.py", line 3501, in plot legstr = legend[i+1] IndexError: list index out of range.

Regarding animation, it worked.

Nichsouz commented 3 years ago

I have just figured it out. Apparently, it is obligatory to have legends in the syntax. I created one legend and it worked. Now it is perfect. Thanks a bunch. Oh, last question:

I have been trying to use large files (long dates). Is there any way I can make simulations (plotting) faster? I have noticed that it drains all memory and takes forever to show the output.

knutfrode commented 3 years ago

Ok, it seems that it is necessary to provide a legend string for each run. Can you try the following:

o.plot(compare=[o2,o3], legend=['Run 1', 'Run 2', 'Run 3'])