小编Ano*_*ode的帖子

在fortran中写入大型数组的最佳方法?文字与其他

我想知道将大型fortran数组(5000 x 5000实数单精度数字)写入文件的最佳方法.我试图保存数值计算的结果供以后使用,因此不需要重复.从计算5000 x 5000 x 4bytes每个数字是100 Mb,是否可以以100Mb的形式保存?有没有办法将fortran数组保存为二进制文件并将其读回以供以后使用?

我注意到将数字保存到文本文件会产生比保存的数据类型大得多的文件.这是因为数字被保存为字符吗?

我熟悉写入文件的唯一方法是

open (unit=41, file='outfile.txt')

do  i=1,len
    do j=1,len

        write(41,*) Array(i,j)
    end do
end do
Run Code Online (Sandbox Code Playgroud)

虽然我认为有更好的方法可以做到这一点.如果有人能指出我的一些资源或例子来批准我有效地(在内存方面)编写和阅读更大文件的能力,这将是很好的.谢谢!

io fortran fortran90

15
推荐指数
1
解决办法
8784
查看次数

如何在 matplotlib 轴中写入乳胶特殊字符 $\bar{T}$ ?

我想在用 matplotlib 绘制的图的轴标签中写入乳胶数学模式符号 $\bar{T}$ 。文档指出不支持数学模式,所以我尝试

plt.xlabel(r'$\displaystyle \={T}$',fontsize=12)
Run Code Online (Sandbox Code Playgroud)

plt.xlabel(r'$\={T}$',fontsize=12)
Run Code Online (Sandbox Code Playgroud)

这给出了错误

matplotlib.pyparsing.ParseFatalException: Expected end of math '$'
$\displaystyle \={T}$ (at char 0), (line:1, col:1)
Run Code Online (Sandbox Code Playgroud)

    raise ParseFatalException(msg + "\n" + s)
matplotlib.pyparsing.ParseFatalException: Expected end of math '$'
$\={T}$ (at char 0), (line:1, col:1)
>>> 
Run Code Online (Sandbox Code Playgroud)

有没有办法使用 matplotlib 在轴标签中写入此符号?我已经能够编写其他乳胶轴标签,但我从未使用过任何这些特殊字符。

python plot latex matplotlib

5
推荐指数
1
解决办法
8477
查看次数

标签 统计

fortran ×1

fortran90 ×1

io ×1

latex ×1

matplotlib ×1

plot ×1

python ×1