gnuplot

Error message: block definition line must end with << EODmarker


After having spent other 6 hours of work adapting the script (minimizing, fixing paste errors when minimizing, changing decimalsign, language & locale, some other error, computer slowness and even a stackoverflow crash due to datafile length) here is my script:

I've got an error message like this:

block definition line must end with << EODmarker

It seems to be due to a couple of do-loops since without it, it works well. This is a sample of my datafile "datos.txt":

 5.9     22  0.6     10/06/2022 15:45:00
 5.9     22.1    0.6     10/06/2022 14:15:00
 5.9     22.2    0.7     10/06/2022 13:45:00
 5.9     26  0   06/02/2023 13:45:00
 5.9     27  0.7     06/09/2023 12:45:00
 5.9     29  0.5     07/08/2022 13:45:00
 5.9     31  0.1     16/12/2023 04:45:00
 5.9     31.1    0.2     06/11/2023 13:15:00
 5.9     32  1.2     06/08/2023 15:15:00
 5.9     32.1    0.6     09/09/2022 11:15:00
 5.9     32.2    1.5     28/08/2023 14:45:00
 5.9     33  0   09/02/2023 15:15:00
 5.9     33.1    0.6     31/05/2023 14:15:00
 5.9     34  0   09/02/2023 15:45:00
 5.9     34.1    0.4     11/04/2024 16:15:00
 5.9     34.2    0.5     21/05/2023 13:45:00
 5.9     34.3    0.4     13/09/2024 13:45:00
 5.9     34.4    0.6     21/05/2023 13:15:00
 5.9     35  0.6     21/04/2023 14:45:00
 5.9     35.1    0.9     25/07/2023 13:15:00
 5.9     36  1.1     01/08/2023 14:45:00
 5.9     39  0.2     11/01/2024 14:15:00
 5.9     40  0.6     24/09/2024 13:45:00
 5.9     40.1    0.5     27/09/2022 13:45:00
 5.9     41  0.6     03/05/2023 15:45:00
 5.9     43  1   24/04/2023 14:15:00
 5.9     43.1    0.5     27/09/2022 15:15:00
 5.9     43.2    0.5     27/09/2022 14:45:00
 5.9     45  0.3     07/08/2022 07:15:00
 5.9     46  0.9     21/05/2024 16:15:00
 5.9     48  0.3     29/02/2024 11:15:00
 5.9     48.1    0.5     08/03/2023 13:15:00
 5.9     48.2    0.9     28/03/2024 15:45:00
 5.9     49  0.3     12/09/2024 14:15:00
 5.9     49.1    0.5     12/09/2024 11:15:00
 5.9     49.2    0.8     21/05/2024 14:15:00
 5.9     49.3    0.3     10/01/2024 13:15:00
 5.9     50  0   27/02/2023 16:15:00
 5.9     50.1    0.4     12/09/2024 11:45:00
 5.9     51  0.2     27/10/2023 14:45:00
 5.9     52  0.3     15/09/2022 16:45:00
 5.9     54  0.4     17/05/2023 12:15:00
 5.9     54.1    0.3     28/02/2024 15:15:00
 5.9     54.2    0   28/02/2023 09:45:00
 5.9     54.3    0.1     29/11/2022 14:15:00
 5.9     56  0.2     09/01/2023 11:45:00
 5.9     56.1    0.5     10/06/2024 19:45:00
 5.9     59  0.3     16/05/2023 13:15:00
 5.9     62  0.3     25/04/2023 13:45:00
 6   25  0.5     04/04/2023 10:45:00
 6   26  1   15/04/2024 15:15:00
 6   27  0.6     06/09/2023 14:15:00
 6   27.1    0.5     16/04/2023 12:45:00
 6   27.2    0.5     10/06/2022 10:15:00
 6   28  0.3     20/01/2024 14:15:00
 6   28.1    0   06/02/2023 13:15:00
 6   29  0.6     09/06/2022 13:45:00
 6   29.1    0.3     20/01/2024 11:15:00
 6   29.2    0.4     15/03/2023 15:45:00
 6   30  0.5     09/06/2022 14:15:00
 6   30.1    1.5     28/08/2023 13:45:00
 6   30.2    0.8     01/08/2023 17:15:00
 6   31  1   25/07/2023 15:15:00
 6   32  0   09/02/2023 13:45:00
 6   33  0   09/02/2023 14:45:00
 6   35  0.6     21/05/2023 14:15:00
 6   35.1    1   22/05/2024 16:15:00
 6   36  0.2     20/01/2024 09:45:00
 6   36.1    0.9     01/08/2023 15:15:00
 6   37  0.2     05/09/2023 22:15:00
 6   38  0   07/02/2023 10:45:00
 6   38.1    0   08/02/2023 13:15:00
 6   39  1.2     31/05/2024 16:45:00
 6   39.1    0.6     30/04/2023 11:15:00
 6   41  -0.5    24/03/2024 14:15:00
 6   41.1    0.3     07/08/2022 08:45:00
 6   43  0.5     03/05/2023 12:45:00
 6   43.1    0.3     07/08/2022 07:45:00
 6   44  0   27/02/2023 12:15:00
 6   44.1    0.2     19/01/2024 23:15:00
 6   45  0.2     16/12/2023 21:45:00
 6   47  0.1     19/01/2024 23:45:00
 6   47.1    0   02/12/2023 10:15:00
 6   47.2    0.1     20/01/2024 00:15:00
 6   48  0   27/02/2023 00:45:00
 6   48.1    0   27/02/2023 01:15:00
 6   48.2    0.4     17/09/2024 13:45:00
 6   49  0.2     10/01/2024 13:45:00
 6   50  0   27/02/2023 16:45:00
 6   50.1    0.3     17/06/2023 01:15:00
 6   52  0.6     03/05/2023 09:45:00
 6   52.1    0.1     30/11/2022 16:15:00
 6   53  0.2     28/02/2024 14:45:00
 6   62  -0.1    17/09/2022 12:45:00
 6   65  0   26/02/2023 10:15:00
 6   78  -0.5    02/12/2023 05:45:00
 6.1     22  0.6     07/09/2023 14:15:00
 6.1     23  0.6     05/09/2023 15:15:00
 6.1     24  0.5     07/09/2023 12:45:00
 6.1     27  0.6     06/09/2023 12:15:00
 6.1     30  0.1     21/01/2024 02:15:00
 6.1     30.1    0.5     09/06/2022 14:45:00
 6.1     30.2    0.3     20/01/2024 10:45:00
 6.1     30.3    1.2     10/08/2023 17:45:00
 6.1     31  0.6     16/09/2022 12:45:00
 6.1     32  0.6     16/09/2022 12:15:00
 6.1     33  0.6     09/05/2024 14:45:00
 6.1     33.1    0.3     28/10/2023 14:15:00
 6.1     33.2    0.9     22/05/2024 15:15:00
 6.1     33.3    0.6     16/09/2022 11:45:00
 6.1     34  0.5     26/09/2023 13:15:00
 6.1     35  0.2     04/04/2023 00:45:00
 6.1     37  0   08/02/2023 13:45:00
 6.1     39  1.1     06/08/2023 16:15:00
 6.1     41  0.5     03/05/2023 14:45:00
 6.1     45  0   27/02/2023 11:45:00
 6.1     46  0.1     22/11/2023 03:45:00
 6.1     46.1    0.4     08/03/2023 13:45:00
 6.1     48  0.3     27/10/2023 13:15:00
 6.1     49  0.7     28/03/2024 14:45:00
 6.1     50  0.2     10/01/2024 12:45:00
 6.1     51  0.4     24/03/2024 14:45:00
 6.1     52  0.2     29/02/2024 14:15:00
 6.1     55  0.1     28/02/2024 16:15:00
 6.1     55.1    -0.1    02/11/2023 19:45:00
 6.1     58  0.2     02/03/2023 18:15:00
 6.1     58.1    0.3     10/03/2023 14:45:00
 6.1     58.2    0.2     02/03/2023 18:45:00
 6.1     64  0.1     21/11/2023 16:15:00
 6.1     75  0.1     02/12/2023 07:15:00
 6.1     81  -0.3    02/12/2023 06:45:00
 6.2     20  0.5     05/04/2023 12:45:00
 6.2     22  0.5     07/09/2023 15:45:00
 6.2     23  0.6     07/09/2023 13:45:00
 6.2     24  0.7     05/09/2023 15:45:00
 6.2     24.1    0.4     03/04/2023 17:15:00
 6.2     26  0.5     05/09/2023 11:45:00
 6.2     28  0.6     06/09/2023 14:45:00
 6.2     29  0.6     09/06/2022 12:45:00
 6.2     30  0.2     20/01/2024 13:45:00
 6.2     32  0.1     16/12/2023 11:45:00
 6.2     35  0.5     09/05/2024 13:15:00
 6.2     35.1    0.2     06/11/2023 12:15:00
 6.2     36  1.2     06/08/2023 15:45:00
 6.2     37  0.4     03/08/2024 13:15:00
 6.2     38  0.8     15/08/2022 16:15:00
 6.2     38.1    0.7     25/07/2023 18:45:00
 6.2     40  0.5     05/03/2023 15:15:00
 6.2     41  0.4     18/05/2023 09:45:00
 6.2     42  0.6     13/04/2023 11:15:00
 6.2     42.1    0.4     26/09/2023 10:15:00
 6.2     43  0   27/02/2023 12:45:00
 6.2     44  0.4     05/03/2023 16:15:00
 6.2     47  0.2     31/10/2023 11:45:00
 6.2     47.1    0   27/02/2023 11:15:00
 6.2     48  0.3     02/03/2023 13:45:00
 6.2     51  0   03/03/2024 19:15:00
 6.2     52  0.4     02/05/2023 10:45:00
 6.2     53  0.1     02/11/2023 15:45:00
 6.2     55  0.2     02/11/2023 14:15:00
 6.2     55.1    0.8     21/05/2024 12:45:00
 6.2     58  0.3     10/03/2023 12:15:00
 6.2     64  0.2     21/11/2023 15:15:00
 6.3     18  0.2     25/11/2023 10:45:00
 6.3     22  0.5     03/04/2023 14:45:00
 6.3     23  0.5     03/04/2023 16:15:00
 6.3     23.1    0.5     05/09/2023 14:15:00
 6.3     25  0.5     03/04/2023 12:45:00
 6.3     28  0.5     08/08/2022 13:45:00
 6.3     28.1    0.5     16/04/2023 12:15:00
 6.3     29  0.6     09/06/2022 13:15:00
 6.3     30  0.2     23/11/2023 12:45:00
 6.3     30.1    0.5     16/09/2022 14:15:00
 6.3     33  0.1     20/01/2024 10:15:00
 6.3     36  0.5     09/05/2024 12:15:00
 6.3     39  0.4     30/04/2023 12:15:00
 6.3     41  0.6     16/09/2022 16:15:00
 6.3     43  0.5     03/05/2023 13:45:00
 6.3     45  0.5     20/10/2023 14:45:00
 6.3     45.1    0.3     27/10/2023 12:15:00
 6.3     47  0.8     21/05/2024 14:45:00
 6.3     50  0.4     17/09/2024 14:15:00
 6.3     50.1    0.3     27/10/2023 13:45:00
 6.3     51  0.2     07/07/2022 21:45:00
 6.3     54  0.8     21/05/2024 13:15:00
 6.3     54.1    0.5     17/05/2023 12:45:00
 6.3     55  0.3     10/03/2023 16:45:00
 6.3     56  0   26/02/2023 17:15:00
 6.3     60  -0.1    02/11/2023 20:15:00
 6.3     61  0.2     10/03/2023 13:15:00
 6.4     24  0.5     05/09/2023 16:15:00
 6.4     26  0.5     05/09/2023 10:45:00
 6.4     27  0.4     10/06/2022 11:15:00
 6.4     28  1   25/07/2023 14:15:00
 6.4     30  1   25/07/2023 16:45:00
 6.4     31  0.2     16/12/2023 11:15:00
 6.4     32  0   09/02/2023 12:45:00
 6.4     33  1.1     25/07/2023 15:45:00
 6.4     33.1    0.3     16/12/2023 12:15:00
 6.4     36  1.1     31/05/2024 16:15:00
 6.4     36.1    0.4     16/09/2022 11:15:00
 6.4     38  0.4     30/04/2023 12:45:00
 6.4     40  0.6     13/08/2024 20:15:00
 6.4     41  0.5     03/05/2023 15:15:00
 6.4     42  0.7     21/05/2024 17:45:00
 6.4     42.1    0.9     21/05/2024 15:15:00
 6.4     43  0.5     03/05/2023 13:15:00
 6.4     44  0   27/02/2023 13:15:00
 6.4     46  0.3     31/10/2023 12:15:00
 6.4     47  0   26/02/2023 21:45:00
 6.4     47.1    0.2     30/11/2022 13:45:00
 6.4     50  0.9     21/05/2024 13:45:00
 6.4     51  0.2     09/01/2023 13:15:00
 6.4     53  0.2     02/11/2023 14:45:00
 6.4     53.1    0.1     02/12/2023 12:15:00
 6.4     54  0.2     28/02/2024 15:45:00
 6.4     56  0.2     28/02/2024 16:45:00
 6.4     57  0.2     02/11/2023 13:15:00
 6.5     12  0.2     25/11/2023 13:15:00
 6.5     31  1.5     28/08/2023 14:15:00
 6.5     32  0.6     09/06/2022 15:15:00
 6.5     32.1    0   09/02/2023 13:15:00
 6.5     33  0.2     16/12/2023 13:15:00
 6.5     37  0.5     30/04/2023 13:15:00
 6.5     39  0.5     30/04/2023 14:45:00
 6.5     39.1    0.2     05/11/2023 15:15:00
 6.5     43  0.4     21/05/2024 18:45:00
 6.5     43.1    0.1     28/06/2022 14:15:00
 6.5     43.2    0.2     05/11/2023 11:15:00
 6.5     45  0.2     30/11/2022 11:15:00
 6.5     48  0   26/02/2023 20:45:00
 6.5     49  0   27/02/2023 10:45:00
 6.5     50  0.2     31/10/2023 14:15:00
 6.5     51  0   28/02/2023 17:45:00
 6.5     61  0.1     20/04/2024 18:15:00
 6.6     21  0.6     03/04/2023 15:15:00
 6.6     23  0.7     05/09/2023 13:45:00
 6.6     25  0.5     05/09/2023 11:15:00
 6.6     26  0.5     03/04/2023 12:15:00
 6.6     33  0   09/02/2023 12:15:00
 6.6     33.1    0.5     16/09/2022 14:45:00
 6.6     35  0.8     22/05/2024 15:45:00
 6.6     36  0.4     03/08/2024 12:45:00
 6.6     38  0.2     05/11/2023 14:45:00
 6.6     43  0.5     13/04/2023 12:15:00
 6.6     45  0.2     05/11/2023 12:45:00
 6.6     48  0   26/02/2023 21:15:00
 6.6     48.1    0.1     19/01/2024 19:15:00
 6.6     48.2    0.3     31/10/2023 11:15:00
 6.6     49  0.6     02/10/2024 12:45:00
 6.6     51  0   28/02/2023 18:15:00
 6.6     51.1    0.3     02/03/2023 12:45:00
 6.6     56  0.3     10/03/2023 15:15:00
 6.6     61  0.1     02/12/2023 13:45:00
 6.6     68  -0.1    18/08/2022 17:45:00
 6.6     70  0.2     02/05/2024 13:45:00
 6.6     76  0   15/08/2022 20:15:00
 6.7     25  0.5     16/04/2023 13:15:00
 6.7     30  0.6     28/07/2022 16:45:00
 6.7     36  0.5     09/05/2024 12:45:00
 6.7     37  0.2     16/12/2023 14:15:00
 6.7     38  0.4     30/04/2023 11:45:00
 6.7     41  0.6     21/05/2024 18:15:00
 6.7     42  0.1     22/11/2023 05:15:00
 6.7     43  0.2     05/11/2023 13:15:00
 6.7     51  0.3     27/08/2024 19:45:00
 6.7     54  0.1     30/11/2022 16:45:00
 6.7     58  0.4     16/05/2024 17:15:00
 6.7     58.1    0.4     16/05/2024 16:45:00
 6.7     61  -0.1    17/09/2022 11:45:00
 6.7     63  0.2     28/03/2024 09:45:00
 6.7     64  -0.2    02/11/2023 20:45:00
 6.8     33  0.2     16/12/2023 12:45:00
 6.8     41  0.9     21/05/2024 17:15:00
 6.8     43  0.1     22/11/2023 04:45:00
 6.8     46  0.2     05/11/2023 16:15:00
 6.8     51  0.8     28/03/2024 14:15:00
 6.8     52  0.2     09/01/2023 12:15:00
 6.8     52.1    0   28/02/2023 10:15:00
 6.8     53  0.1     20/10/2023 07:45:00
 6.8     53.1    0.3     29/02/2024 14:45:00
 6.8     54  0.3     10/03/2023 11:45:00
 6.8     56  0   19/01/2024 16:45:00
 6.8     69  0   26/02/2023 11:15:00
 6.9     43  0.2     05/11/2023 11:45:00
 6.9     44  0.3     27/10/2023 11:45:00
 6.9     46  0.7     02/10/2024 13:15:00
 6.9     46.1    0   27/02/2023 14:15:00
 6.9     47  0   27/02/2023 14:45:00
 6.9     52  0   28/02/2023 22:15:00
 6.9     52.1    0.4     02/03/2023 16:15:00
 6.9     55  0   26/02/2023 18:45:00
 6.9     55.1    0.4     10/03/2023 16:15:00
 6.9     61  0.1     04/01/2024 02:45:00
 7   16  0.3     25/11/2023 11:45:00
 7   33  0.2     03/11/2023 13:45:00
 7   36  0.2     28/03/2024 17:15:00
 7   44  0   27/02/2023 13:45:00
 7   48  0.3     27/10/2023 12:45:00
 7   48.1    0.3     02/03/2023 14:45:00
 7   50  0   28/02/2023 10:45:00
 7   50.1    0.3     02/03/2023 15:15:00
 7   53  1   28/03/2024 13:15:00
 7   55  0.4     10/03/2023 15:45:00
 7   56  0.1     02/03/2023 17:45:00
 7   61  0.5     28/03/2024 10:45:00
 7.1     48  0   28/02/2023 11:15:00
 7.1     48.1    0   26/02/2023 20:15:00
 7.1     50  0.4     02/03/2023 15:45:00
 7.1     52  0.8     28/03/2024 13:45:00
 7.1     59  0   20/10/2023 05:15:00
 7.2     16  0.3     25/11/2023 11:15:00
 7.2     23  0.5     07/09/2023 13:15:00
 7.2     39  0.2     28/03/2024 17:45:00
 7.2     40  0.7     24/07/2023 08:45:00
 7.2     44  0.1     19/01/2024 21:45:00
 7.2     44.1    0.2     05/11/2023 12:15:00
 7.2     52  0   02/11/2023 16:15:00
 7.2     52.1    0.3     02/03/2023 12:15:00
 7.3     22  0.6     05/09/2023 14:45:00
 7.3     23  0.6     05/09/2023 12:45:00
 7.3     37  0.3     05/11/2023 14:15:00
 7.3     43  0.1     19/01/2024 22:45:00
 7.3     45  0.3     31/10/2023 12:45:00
 7.3     47  0   28/02/2023 11:45:00
 7.3     48  0   27/02/2023 00:15:00
 7.3     49  0   26/02/2023 23:45:00
 7.3     53  0.3     02/03/2023 16:45:00
 7.3     59  1.1     28/03/2024 12:15:00
 7.3     62  0   26/02/2023 09:45:00
 7.4     23  0.6     03/04/2023 13:45:00
 7.4     30  0.3     20/01/2024 11:45:00
 7.4     48  0   26/02/2023 22:15:00
 7.4     49  0   26/02/2023 23:15:00
 7.4     55  1.2     28/03/2024 12:45:00
 7.4     63  0   26/02/2023 09:15:00
 7.5     23  0.5     03/04/2023 14:15:00
 7.5     33  0.4     06/07/2022 14:15:00
 7.5     41  0.2     05/11/2023 15:45:00
 7.5     49  0   28/02/2023 13:45:00
 7.5     49.1    0   26/02/2023 22:45:00
 7.5     52  0   02/11/2023 16:45:00
 7.5     82  -0.4    05/11/2023 04:15:00
 7.6     23  0.6     03/04/2023 13:15:00
 7.6     28  0.3     20/01/2024 12:15:00
 7.6     36  0.4     15/03/2023 16:15:00
 7.6     37  0.2     02/12/2023 11:15:00
 7.6     39  0.3     05/11/2023 13:45:00
 7.6     47  0.2     19/01/2024 20:45:00
 7.6     53  0.1     19/01/2024 18:15:00
 7.6     54  0.2     02/03/2023 17:15:00
 7.6     59  1   28/03/2024 11:45:00
 7.6     61  0.3     28/03/2024 10:15:00
 7.7     45  0.2     03/11/2023 09:15:00
 7.7     56  0   19/01/2024 17:15:00
 7.8     36  0.2     16/12/2023 13:45:00
 7.8     54  0.2     02/12/2023 13:15:00
 7.8     64  -0.1    17/09/2022 11:15:00
 7.9     47  0   28/02/2023 15:45:00
 7.9     48  0   28/02/2023 16:15:00
 7.9     70  -0.6    17/09/2022 10:15:00
 8   28  0.3     20/01/2024 13:15:00
 8   34  0.4     28/03/2024 16:45:00
 8   38  0.2     02/12/2023 11:45:00
 8   42  0.2     19/01/2024 22:15:00
 8   46  0.2     19/01/2024 21:15:00
 8   47  0.1     19/01/2024 19:45:00
 8   48  0.1     02/12/2023 12:45:00
 8   48.1    0.6     28/03/2024 15:15:00
 8   50  0.2     31/10/2023 13:45:00
 8   55  0.1     19/01/2024 17:45:00
 8.1     30  0.3     03/11/2023 12:45:00
 8.1     33  0.6     28/07/2022 17:15:00
 8.2     30  0.3     03/11/2023 13:15:00
 8.2     47  0   28/02/2023 14:15:00
 8.2     50  0   28/02/2023 17:15:00
 8.2     66  -0.4    17/09/2022 10:45:00
 8.3     52  0.1     02/11/2023 15:15:00
 8.3     74  -0.5    17/09/2022 09:45:00
 8.4     47  0   28/02/2023 15:15:00
 8.4     47.1    0.1     19/01/2024 20:15:00
 8.5     44  0.3     31/10/2023 13:15:00
 8.5     47  0   28/02/2023 14:45:00
 8.6     28  0.3     20/01/2024 12:45:00
 8.6     50  0   28/02/2023 16:45:00
 8.6     59  0.5     28/03/2024 11:15:00
 8.8     42  0.3     03/11/2023 09:45:00
 8.9     37  0.2     03/11/2023 10:15:00
 9   49  0   28/02/2023 12:15:00
 9.3     34  0.2     03/11/2023 10:45:00
 9.3     50  0   28/02/2023 13:15:00
 9.5     39  0.2     02/12/2023 10:45:00
 9.7     34  0.4     03/11/2023 11:15:00
 10  50  0   28/02/2023 12:45:00
 10.2    30  0.3     03/11/2023 11:45:00
 11.3    29  0.3     03/11/2023 12:15:00

And here is the script:

reset session
set term win
set datafile missing NaN
   w1= 24   
   year1 = 2023
   month1 = 'March'
   day1 = 1
   time1 = '00:00:00'
   year2 = 2024
   month2 = 'September'
   day2 = 1
   time2 = '00:00:00'
   v2 = 25   #  N° of tics X of middle 2D plot
   v3 = 27   #  N° of tics X of bottom 2D plot
s1 = sprintf("%02.0f",day1) 
s2 = sprintf("%02.0f",day2)
   vi = strptime("%Y-%m-%d %H:%M:%S","".year1.'-'."".int(tm_mon(strptime("%B",month1))+1).'-'.s1.time1)
   vf = strptime("%Y-%m-%d %H:%M:%S","".year2.'-'."".int(tm_mon(strptime("%B",month2))+1).'-'.s2.time2)
  
    set table $Temp9
    plot "datos.txt" u 1:2:3:(gprintf("%.f",timecolumn(4,"%d/%m/%Y %H/%M/%S"))) w table
    unset table

  array e[2]; e[1]='humid. %'; e[2]='wind m/s'

  set terminal gif size 1600,800 animate delay 15 loop 0 optimize
  set out '../../ContourVentoUmidStaz1-2.gif'

stats $Temp9 u 1:2
x0 = STATS_min_x; xf = STATS_max_x
y0 = STATS_min_y; yf = STATS_max_y
stats $Temp9 u 3
z00= STATS_min; zff= STATS_max
set table $Contour0
    splot $Temp9 u 1:2:3
set dgrid3d 129,129 qnorm 9
set table $Contour1
    splot $Temp9 u 1:2:3
unset table
stats $Contour1 u 3
z0 = STATS_min; zf = STATS_max  # MAX & MIN of interpolated z values

do for [i=year1:year2] {
j0 = 1; if (i==year1) {j0 = 0+strftime ("%m",vi)}
jf =12; if (i==year2) {jf =-1+strftime ("%m",vf)}
do for [j=j0:jf] {
# i= year1; j = 0+strftime ("%m",vi)  # JUST FOR TESTING ONE (i,j) VALUE DISABLING THE TWO PREVIOUS do for (without them, everything goes well)
vii = strptime("%Y%m","".i."".j)
vff = strptime("%Y%m","".i."".(j+1))

set multiplot
  set lmargin at screen 0.025 
  set origin 0,-0.01
  set size 1,0.21
set xrange  [y0:yf]
set yrange [z00:zff]

set xtics format "{%.f}" font "Arial, 10"
set ytics format "{%.1f}" font "Arial, 10"
set xtics y0,(yf - y0)/(v3-1),yf
set xtics add (x0)

set pointsize 0.2
    plot $Temp9 u (int($2)):(($4-900)>vii && ($4-900)<=vff ? $3: NaN) w p pt 7 lc "blue" ti "{/:Bold Diff T°vs Um%}" at 0.12,0.162
unset mxtics

  set origin 0,0.16
  set size 1,0.21 
set xrange [x0:xf]
set xtics format "{%.1f}" font "Arial, 10"
set xtics offset 0,0.25
set xtics x0,(xf - x0)/(v2-1),xf
set xtics add (x0)

    plot $Temp9 u 1:(($4-900)>vii && ($4-900)<=vff ? $3: NaN) w p pt 7 lc "blue" ti sprintf("{/:Bold Diff T°vs V(m/s)}",e[1+(w1-14)/10]) at 0.12,0.334

set label strftime("%B",strptime("%m","".j))." ".i."   Diff. T° vs wind m/s & humid. %" right at screen 0.89,0.98 font "Times-New Roman, 13" textcolor rgb 177 front

  set lmargin
  set origin -0.0695,0.28
  set size 1.144,0.8
set ztics
set xtics format "{/:Bold %.1f}" font "Times-New Roman, 10" rotate by 20    offset 0,0
set ytics format "{/:Bold %.f}" font "Times-New Roman, 10" offset -1.5,0

set xyplane at 0.09
set xrange [*:*]
set yrange [*:*]
set zrange [*:*]
set format x
set format y
set ticslevel 0
set pointsize 0.1
set label "{/:Bold Max e Min of}" at graph 0.88,0.03 font "Times-New Roman, 10" textcolor rgb 199 front
set label "{/:Bold NON-INTERP. values }" at graph 0.88,0.01 font "Times-New Roman, 10" textcolor rgb 199 front; set label sprintf("{/:Bold %1.1f %5.1f}",z00,zff) at graph 0.9215,0.01 font "Times-New Roman, 10" textcolor "dark-magenta" front
set xrange [x0:xf]
set yrange [y0:yf]
set zrange [z0:zf]

set dgrid3d 257,257 qnorm 9    # gauss kdensity 0.5,5.0 or qnorm 9
        set palette rgbformulae 33,13,10
        set label "{/:Bold Diff T°}" at graph 0.92,0.98 font "Arial, 10" front
        set cbrange[z0:zf]
        set cbtics 0.2
        set colorbox vertical user origin 0.935,0.4 size .02,.585

set view 0,0,1.5
set xtics format "{/:Bold %.1f}" font "Times-New Roman, 10"  #   rotate by 20    offset 0,0
set ytics format "{/:Bold %.f}" font "Times-New Roman, 10" offset -1,0
set ztics

set cntrlabel format "{/:Bold %.1f}" font "Times-New Roman, 10" onecolor

# Apparently, HERE COMES THE PROBLEM: GNUPLOT doesn't bear a "here document" like 
# this *inside a do-loop* (once you remove either one, everything goes fine).
#-GRANTED, IT'S NOT NECESSARY FOR THE CURRENT SCRIPT, BUT I'LL NEED IT FOR A FURTHER DEVELOPMENT-:

# Use a coarser grid when generating labels  
# use a dummy definition g = $smallgrid() to force a single execution of a function that resets the grid parameters
function $smallgrid() << EOF
    set dgrid3d 65,65 qnorm 9
EOF

splot $Temp9 u 1:2:(($4-900)>vii && ($4-900)<=vff ? $3: NaN) with pm3d

  unset label
unset multiplot
}
}

If I remove the do loop, it works perfectly (just for one loop value, of course). If I keep the do-for loop even for just one value, I've got that error message.


Solution

  • As you already mentioned, apparently, the (dummy)function definition within the loop is the problem.

    Just for completeness and future reference, since you already suspected the function definition to cause the error, the following would have been a minimized example to reproduce the error:

    reset session
    do for [i=1:2] {
     
        function $smallgrid() <<EOF
            set dgrid3d 65,65 qnorm 9
        EOF
    
        plot x
    }
    

    Apparently, you cannot redefine a function within a loop. And in your case there is actually no need to define it within the loop, because nothing in the definition is changed. However, unlike undef for datablocks, there seems to be no undef for function blocks.

    So, simply take it out of the loop, then at least I don't get the error message anymore. But from the strange output from your script and data, I cannot tell whether the output is really correct.

    Try something like:

    ### this requires gnuplot>=6.0.0, because of functions blocks
    reset session
    
    function $smallgrid() <<EOF
        set dgrid3d 65,65 qnorm 9
    EOF
    
    # many settings, etc. 
    
    # your loops
    do for [i=1:3] {
        do for [j=1:3]  {
    
            # some more settings
            
            A = $smallgrid()    # apply the settings in your function
    
            # plot whatever you need
       }
    }