wgnuplot 5.4.8 中的警告消息未出现在 5.4.3 版本中

问题描述 投票:0回答:1

我有一个在 wgnuplot 5.4.3 下运行良好的脚本;当使用 wgnuplot 5.4.8 运行它时,它会给我一堆消息,例如“警告:数字表达式后的尾随字符”。问题来自于一个用户定义的函数,

fn(x) = gprintf("%.1f",timecolumn(1,"%d/%m/%Y %H:%M") +x)
;当我只是尝试对其进行简单测试(如
print fn(900)
)时,它给了我一条错误消息,这是我在 5.4.3 版本中没有收到的,即“从无效上下文调用 timecolumn()”。有人看到我在这个新版本的 wgnuplot 中做错了什么吗?

这是脚本:

reset session
set term win
set datafile missing NaN
   anno1 = 2024
   mese1 = 'Gennaio' #JANUARY
   giorno1 = 1
   ora1 = '00:00'
   anno2 = 2024
   mese2 = 'Gennaio'
   giorno2 = 2
   ora2 = '00:00'
   s1 = sprintf("%02.0f",giorno1) 
   s2 = sprintf("%02.0f",giorno2)

        FILE1 = "".anno1." ".mese1." 30 min.txt"
        set locale "italian"
        set decimalsign locale "Italian"   # set input decimalsign to comma
        set decimalsign "."   # set output decimalsign to point (only with gprintf() )

   set xdata time
   set timefmt "%d/%m/%Y %H:%M"
   set xrange[s1."/"."".int(tm_mon(strptime("%B",mese1))+1)."/"."".anno1.' '.ora1 : s2."/"."".int(tm_mon(strptime("%B",mese2))+1)."/"."".anno2.' '.ora2]
   set xdata

   vi = strptime("%d/%m/%Y %H:%M",s1."/"."".int(tm_mon(strptime("%B",mese1))+1)."/"."".anno1.' '.ora1)
   vf = strptime("%d/%m/%Y %H:%M",s2."/"."".int(tm_mon(strptime("%B",mese2))+1)."/"."".anno2.' '.ora2)

# get datafile into datablock with unix time and offset  /%m/%Y
set table $Temp1
  fn(x) = gprintf("%.1f",timecolumn(1,"%d/%m/%Y %H:%M") +x)
  plot FILE1 u (fn(-900+0+0.1)):(gprintf("%.1f",$3)):(gprintf("%.1f",$5)) skip 6 w table if (fn(-900+0)>= vi && fn(-900+0)<= vf)
unset table

我的输入文件的第一行名为“2024 Gennaio 30 min.txt”:

GENNAIO 2024                                            
                        VENTO           NOTE        
Giorno ed ora   Temperatura media   Pioggia Radiazione globale media    Tº infrarossa tetto Umidità relativa (RH)   Velocità media  Direzione media Raffica         
            [°C]  [ mm/m²] [ W/m²]   [°C]  [ % ]  [ m/s ]   gradi sessagesimali  (da nord in senso orario)  [ m/s ]         
                                            
01/01/2024 00:30    13,9    0,0 -0,5    -27,5   70  0,9 160,3   0,0 VALORI RAFFICHE ERRATI      
01/01/2024 01:00    13,9    0,0 -1,2    -27,5   72  2,5 160,4   0,0         
01/01/2024 01:30    13,4    0,0 -2,9    -27,2   76  2,0 160,4   0,0         
01/01/2024 02:00    13,0    0,4 -1,8    -27,3   77  1,3 160,4   0,0         
01/01/2024 02:30    12,9    4,2 -0,7    -21,9   78  2,8 160,7   0,2         
01/01/2024 03:00    13,1    0,0 2,3 -22,1   73  3,7 174,4   4,1         
01/01/2024 03:30    13,0    0,0 1,6 -22,5   72  2,9 179,4   0,9         
01/01/2024 04:00    13,0    0,0 1,7 -24,0   67  3,2 213,8   16,6            
01/01/2024 04:30    12,7    0,0 0,1 -24,3   66  2,5 229,8   6,8         
01/01/2024 05:00    12,3    0,0 -0,9    -24,4   68  3,1 234,9   11,3            
01/01/2024 05:30    12,3    0,0 -2,4    -24,6   67  1,3 236,1   14,6            
01/01/2024 06:00    12,1    0,0 -3,1    -25,0   67  1,8 238,9   15,2            
01/01/2024 06:30    12,1    0,0 -2,4    -25,5   67  1,6 227,5   12,2            
01/01/2024 07:00    12,0    0,0 -1,8    -26,1   67  1,8 217,4   14,6            
01/01/2024 07:30    12,1    0,0 -1,2    -26,6   66  1,2 215,4   13,2            
01/01/2024 08:00    11,7    0,0 -0,2    -26,9   68  1,4 230,0   12,8            
01/01/2024 08:30    11,4    0,0 13,0    -27,0   70  1,3 224,5   14,2            
01/01/2024 09:00    11,5    0,0 41,7    -27,1   69  0,0 192,2   0,0         
01/01/2024 09:30    11,1    0,0 78,4    -27,1   72  0,7 174,3   21,5            
01/01/2024 10:00    11,1    0,0 111,1   -27,3   71  1,4 187,3   0,4         
01/01/2024 10:30    11,3    0,0 133,6   -27,4   71  1,1 186,1   0,3         
01/01/2024 11:00    11,8    0,0 155,6   -27,5   69  0,0 186,0   0,0         
01/01/2024 11:30    12,2    0,0 206,9   -27,5   66  0,2 183,6   0,1         
01/01/2024 12:00    12,5    0,0 178,7   -27,6   65  0,3 184,9   2,1         
01/01/2024 12:30    12,9    0,0 139,1   -27,6   62  0,4 217,7   8,3         
01/01/2024 13:00    13,0    0,0 167,1   -27,6   60  0,5 232,7   10,2            
01/01/2024 13:30    13,1    0,0 141,2   -27,7   59  0,7 241,1   8,6         
01/01/2024 14:00    13,3    0,0 138,6   -27,7   59  0,3 236,9   12,4            
01/01/2024 14:30    13,1    0,0 104,5   -27,7   57  0,9 207,1   11,4            
01/01/2024 15:00    13,2    0,0 115,5   -27,6   57  0,2 225,7   6,0         
01/01/2024 15:30    13,1    0,0 80,0    -27,6   58  0,3 193,6   12,9            
01/01/2024 16:00    12,9    0,0 47,1    -27,7   59  0,5 174,2   2,7         
01/01/2024 16:30    13,0    0,0 18,4    -27,6   59  0,2 175,2   5,2         
01/01/2024 17:00    12,9    0,0 2,5 -27,9   59  0,0 0,0 0,0         
01/01/2024 17:30    12,5    0,0 -3,0    -27,7   62  0,0 171,8   0,0         
01/01/2024 18:00    12,0    0,0 -3,0    -27,6   68  0,4 170,8   0,1         
01/01/2024 18:30    11,7    0,0 -2,0    -27,6   70  0,3 170,2   1,2         
01/01/2024 19:00    11,4    0,0 -2,0    -27,5   71  0,6 169,8   0,1 VALORI RAFFICHE ERRATI      
01/01/2024 19:30    11,0    0,0 -2,7    -27,7   73  0,6 169,7   0,1         
01/01/2024 20:00    10,6    0,0 -2,8    -27,7   74  0,6 169,5   0,1         
01/01/2024 20:30    10,5    0,0 -2,7    -27,6   73  1,2 169,2   0,2         
01/01/2024 21:00    10,5    0,0 -3,7    -27,6   72  0,2 168,8   1,1         
01/01/2024 21:30    10,2    0,0 -4,1    -27,6   74  0,7 163,5   2,2         
01/01/2024 22:00    9,7 0,0 -3,3    -27,5   76  1,7 147,1   10,6            
01/01/2024 22:30    9,4 0,0 -1,6    -27,5   78  1,7 128,4   17,6            
01/01/2024 23:00    9,3 0,0 -0,8    -27,5   77  0,7 145,9   11,1            
01/01/2024 23:30    9,4 0,0 -1,7    -27,5   77  1,5 143,6   16,3            
02/01/2024 00:00    9,3 0,0 -1,2    -27,4   77  1,0 136,4   11,8            
02/01/2024 00:30    9,3 0,0 -1,7    -27,4   77  0,3 129,2   6,6         
02/01/2024 01:00    9,5 0,0 -1,9    -27,4   75  0,1 142,4   1,4         
02/01/2024 01:30    9,5 0,0 -3,2    -27,5   75  0,0 0,0 0,0         
02/01/2024 02:00    9,1 0,0 -1,5    -27,4   78  0,1 166,7   1,2         
02/01/2024 02:30    8,7 0,0 -2,1    -27,3   80  0,3 283,4   37,5            
02/01/2024 03:00    8,4 0,0 -1,5    -27,3   81  0,1 301,7   5,7         
02/01/2024 03:30    8,4 0,0 -1,7    -27,3   81  0,0 0,0 0,0         
02/01/2024 04:00    8,5 0,0 -2,0    -27,3   81  0,6 143,6   14,5
windows gnuplot warnings
1个回答
0
投票

命令

print fn(900)
确实从无效上下文中调用timecolumn(),因为如果程序不在读取数据文件的过程中,则没有“列1”可以从中读取时间字符串。

关于尾随字符的警告消息,这只是警告,不是错误。表 $Temp1 的内容应该仍然是正确的。

我怀疑生成警告消息是因为程序对正确的小数点是什么感到困惑,因为满足了两个条件(1)程序位于输入操作的

using
说明符内 - 因此输入区域设置是合适的(2) 该程序位于对 gprintf 的调用中 - 因此输出小数点是合适的。也许它会尝试两者,其中一个有效,而另一个生成此消息?我不完全确定解决这个问题的内部算法,但无论如何,在我看来,我的 Linux 机器上的输出是正确的。您应该自己检查一下,以确保您的机器也能正常工作。

© www.soinside.com 2019 - 2024. All rights reserved.