Gmt movie [grdview fail / no-matching postscript]

macOS BigSur / gmt 6.2.0_bcabc17_2021.02.26

I’m trying to convert the showcase to GMT6 modern mode but it fails and I don’t know what I’m doing wrong …

The script :

gmt movie main.sh -Sbpre.sh -Nevent_${i} -C15cx15cx100 -Tperiod.txt -Iinclude.sh -Pa -D33 -Agif -M0

pre.sh

gmt begin

    gmt math -o0 -T${index_start}/${index_stop}/1 T = index_period.txt
    gmt math -o0 -fit -foT -T${time_start}/${time_stop}/3 T --TIME_UNIT=h --TIME_EPOCH=$(gmt get TIME_EPOCH) = date_period.txt

    paste -d "," index_period.txt date_period.txt > period.txt

    gmt makecpt -Cgray -T0/5000 -I -H > relief.cpt
    gmt makecpt -Ccork -T${lim1}/${lim2}/${linc} -G0/1 -A50 -N -H > cold.cpt

    gmt grdimage $region $projection @earth_relief_03m -Crelief.cpt -I+d  # Topography
    gmt pscoast -Di -Wthinnest -Sdeepskyblue  $map_annot -t25    # Oceans

gmt end

main.sh

gmt begin
    gmt grdcontour -C+1 -Ncold.cpt -A- $NCfile"?var[${t1}]" -B+t$(echo ${MOVIE_COL1} | awk -F[T] '{printf "%s %s",$1,$2}')
gmt end

Debug prompt

grdimage [WARNING]: Changing to PostScript landscape orientation based on your plot and paper dimensions, but we cannot be 100% sure.
grdimage [WARNING]: Use PS_MEDIA and/or PS_PAGE_ORIENTATION to specify correct paper dimensions and/or orientation if our guesses are inadequate.
gmt [ERROR]: The call to grdview failed
end [WARNING]: Figure # 1 (event_1) was registered but no matching PostScript-|+ file found - skipping
mv: rename event_1.pdf to ./movie_session/event_1.pdf: No such file or directory
gmt [ERROR]: The call to grdview failed
end [WARNING]: Figure # 1 (../event_1_00) was registered but no matching PostScript-|+ file found - skipping

# ... and it freezes here

Any idea ?

(I also have the errors from issue995)

Your main script seems to be missing a projection so you are getting a default -JX15c I think which with margins will exceed your canvas. Also worry about what -X -Y you wish to use if not the 72p/72p.

I’ve added $region $projection (similar to pre.sh) in main.sh
I haven’t touch to -X nor -Y yet …

But I got the same prompt. :frowning:

Also the files movie_params_xx.sh start at xx=03 (nothing for the 00, 01 and 02 which I guess are supposed to be Figure # 1 (../event_1_00) etc.

movie_background.ps seems fine… same for movie_preflight, _init and _frame

and where are things like region, projection defined?

In the include file.
I checked and it’s correctly read in both pre and main

echo $region $projection

Perhaps you can try this. When I am stuck like you on an issue with movie, I run it with -Qs, then I manually go into the directory with all those scripts and parameters and try to run one frame manually, something like bash -xv movie_master.sh 05 (for frame 05) and examine the output for any errors (that hopefully are helpful) to try to see what is going on. Because movie makes system calls to run stuff it is hard to debug via a typical debugger like Xcode…

I think pscoast is the name in classic mode. Coast is modern.

@Esteban82 : I switch to coast but it doesn’t seem to matter much. The background frame was compiling fine.

@pwessel : I executed bash -xv movie_frame.sh 00 and obtained the following :

region="-R${lonW}/${lonE}/${latS}/${latN}"
++ region=-R-170/-70/8/52

projection="-JL${ll0}/${ll1}/${lt0}/${lt1}/${map_cm}c"
++ projection=-JL-120/35/30/40/15c

t1=${MOVIE_COL0}
+ t1=8
t2=$(echo ${MOVIE_COL1} | awk -F[T] '{print $1}')
++ echo 1980-01-02T00:00:00
++ awk '-F[T]' '{print $1}'
+ t2=1980-01-02
---

gmt begin
+ gmt begin
#       Set output PNG name and plot conversion parameters
        gmt figure ../${MOVIE_NAME} png,ps E${MOVIE_DPU},A+n+r${MOVIE_BACKGROUND} -I../movie_params_$1.sh
+ gmt figure ../event_1_00 png,ps E254,A+n+r,Mb../movie_background.ps -I../movie_params_00.sh
        gmt set PS_MEDIA 15cx15c DIR_DATA "<path>/GMT/movie_session,<path>/GMT/movie_session/event_1" GMT_MAX_CORES 1
+ gmt set PS_MEDIA 15cx15c DIR_DATA <path>/movie_session,<path>/GMT/movie_session/event_1 GMT_MAX_CORES 1
    gmt grdcontour ${region} ${projection} -C+1 -Ncold.cpt -A- $NCfile"?ar_binary_tag[${t1}]" -B+t$(echo ${MOVIE_COL1} | awk -F[T] '{printf "%s %s",$1,$2}')
++ echo 1980-01-02T00:00:00
++ awk '-F[T]' '{printf "%s %s",$1,$2}'
+ gmt grdcontour -R-170/-70/8/52 -JL-120/35/30/40/15c -C+1 -Ncold.cpt -A- '<path2file>.nc4?ar_binary_tag[8]' -B+t1980-01-02 00:00:00
gmt [ERROR]: The call to grdview failed
gmt end
+ gmt end
end [WARNING]: Figure # 1 (../event_1_00) was registered but no matching PostScript-|+ file found - skipping
end [WARNING]: Figure # 1 (../event_1_00) was registered but no matching PostScript-|+ file found - skipping

The structure is

  • root_dir (where the data are)
  • work_dir (where the scripts are)
    • dir : “movie_session” (master script changes directory to be executed here)
      • subdir : “event_1”
        • subsubdir : “event_1_00”
        • execution files : cpt, gmt.conf, period.txt movie_params_xx.sh, movie_frame.sh, movie_init.sh
      • files : include.sh, main.sh, pre.sh
    • dir : “gmt_backend” (master script copies include, pre and main from here)
    • file : master script

OK, so this command is failing. I do not understand what etc means, did you just replace a long actual path with that tag just for the purpose of posting here? WIth quotes and missing quotes it is hard to see as your -B seems to have a hanging 00:00:00 that is not part of the string and would be seen as a possible grid input file. But again, tough to understand that command line. Maybe you need a double-quote around that entire -B arg.

Alright : Here’s the result with double quote : -B+t"text"
I still got the warning

grdview [WARNING]: Changing to PostScript landscape orientation based on your plot and paper dimensions, but we cannot be 100% sure.
grdview [WARNING]: Use PS_MEDIA and/or PS_PAGE_ORIENTATION to specify correct paper dimensions and/or orientation if our guesses are inadequate.

Also the transparency doesn’t seem to work

cat gmt.conf 
#
# GMT 6.2.0 Defaults file
#
# COLOR Parameters
#
COLOR_BACKGROUND               = black@95
COLOR_FOREGROUND               = white@95
#
# FONT Parameters
#
FONT_ANNOT_PRIMARY             = 12p,Helvetica,black
FONT_LABEL                     = 16p,Helvetica,black
FONT_TAG                       = 16p,Helvetica,black
FONT_TITLE                     = 24p,Helvetica,black
#
# FORMAT Parameters
#
FORMAT_DATE_MAP                = o
FORMAT_GEO_OUT                 = DF
FORMAT_GEO_MAP                 = DF
FORMAT_TIME_PRIMARY_MAP        = abbreviated
#
# MAP Parameters
#
MAP_FRAME_TYPE                 = plain
MAP_GRID_PEN_PRIMARY           = thinner,gray69
MAP_GRID_PEN_SECONDARY         = thin,black
MAP_LABEL_OFFSET               = 0.3c
#
# Calendar/Time Parameters
#
TIME_EPOCH                     = 1980-01-01
TIME_UNIT                      = d

Sorry, it’s “et cetera” abbreviated. (“and so forth” or ...)
And yes, <path2file> and <path> are just absolute path on my laptop (/User/guillaume/Documents....)

Sorry bad formatting. I put your path in the angular bracket with formatting it and it disappeared, making it sound like I don’t understood what etc meant…

Selecting png and ps: png will crop to fit, ps requires a page size. Do you really want PS? WHo needs PS anymore? Do you mean eps?

Transparency: So I understand, you want to use cold.cpt which append @50 to all colors to set transparent colors in the filled view run by grdview, yes? I am pretty sure it is not using those settings. Perhaps -t50 is better here.

Transparency: Double checed this and in fact grdview does honor transparency in CPT provided -Qi is not used. So I am getting transparent plots.

I don’t want PS particularly, it’s just what I got without specifying anything

The file using cold.cpt is a logical dataset (1 = in , 0 = out).
I want the 1s to be green with 50% transparency :

# in pre.sh
gmt makecpt -Ccork -T${lim1}/${lim2}/${linc} -G0/1 -A50 -N -H > cold.cpt

And the 0s to be invisible :

gmtset  COLOR_BACKGROUND               = black@95
gmtset COLOR_FOREGROUND               = white@95

Is it incorrect (it worked in classic mode)? It took me a while though

Sorry, you are right the ps,png is automatic and done by movie since it needs to sandwich in the background PS…
I believe the PS complaints has to do with you setting a 15cm wide canvas but your projection will make a 15 cm wide plot (not included space needed by frame annotations) that is then shifted by 72 points for margins. So you are far exceeding your paper size and PS complaints. SOlution is to make the canwas wider until your plot fits inside the canvas.

Ok solved I think, and about the 1s semi-transparent and 0s fully-transparent?

Would it not be simpler to make a 2-line CPT this way:

gmt makecpt -T-0.5,0.5,1.5 -N -Cwhite@100,green@50

for the right kind of green value? When I tested grdview (well grdcontour -N) I got transparency.

Thanks @pwessel it appears to work :slight_smile:
So … done I guess :slight_smile: