gmt icon indicating copy to clipboard operation
gmt copied to clipboard

Movie : -JG +w option

Open gd-a opened this issue 2 years ago • 6 comments

Hi,

I'm wrapping up the sea-ice concentration movie for @Esteban82 and I sometimes got an error. The script can't find a file (absolute path given)

projection="-JG0/0/10c+w25"
gmt grdimage ${DIR_wrk}/inset_illu.nc -Cinset_illu.cpt -t25 $projection -Rg
grdmath (gmtapi_export_grid): Could not find file [ <absolute_path> /inset_illu.nc]
[Session gmt (0)]: Error returned from GMT API: GMT_GRID_WRITE_ERROR (19)

But sometimes it works.

gd-a avatar Feb 28 '22 20:02 gd-a

That is pretty hard to debug or understand. Is it possible that the file actually is not there (yet) or have been removed when this script actually is looking? Or that the directory does not exist (yet)? The system library routines do not lie and if it says it cannot create that file it is usually right.

PaulWessel avatar Mar 30 '22 09:03 PaulWessel

Is it possible that the file actually is not there (yet)

In this specific case, inset_illu.cpt is created beforehand and stored in the working directory (during pre.sh). It is odd that several frames can access it while some other not.

Are modules allowed to access the same file at the same time?

gd-a avatar Mar 30 '22 22:03 gd-a

So .. it appears that inset_illu.nc is created in include.sh (-I in movie) using grdmath.

I moved the line at fault in pre.sh (-Sb in movie) and the problem is resolved.

Confusingly enough :

  1. Despite specifying the absolute path, gmt_api can't access the file (sometimes), so it just skip the plot layer.
  2. I create and use another file (txt) the same way (using math in include.sh) and this one as no problem whatsoever.

Is it a bug ? A feature ? A mystery ?

The script is still running but after several frames, still no error.

gd-a avatar Apr 08 '22 02:04 gd-a

The problem is this:

${DIR_wrk}/inset_illu.nc

DIR_wrk is not a unique file name. Remember you are running lots of jobs simultaneously and they all want to create that file. This means stepping on toes and sometimes there will be no file. I suggest you use one of the MOVIE_* variables when you create a file only to be used by one frame.

PaulWessel avatar Apr 08 '22 08:04 PaulWessel

DIR_wrk is not a unique file name

Isn't it though ? It used to be created in -Sb (now in -I) ... these steps are not parallelized right ?

gd-a avatar Apr 08 '22 11:04 gd-a

@PaulWessel : You can see how it makes the animation glitch (lower right corner : https://youtu.be/Uh9YyFryXD4 )

gd-a avatar Apr 08 '22 11:04 gd-a