我有一个多节文本文件,基本上是数千个数据集合,格式如下:
psxy -R -Jm -N -G0/19/255 -K -O <<eof>> image.ps
64.0100 28.0100
64.0400 28.0100
64.0700 28.0100
64.1000 28.0100
64.1400 28.0100
64.1700 28.0100
64.2000 28.0100
64.2300 28.0100
64.2600 28.0100
64.2600 28.0400
64.2600 28.0700
64.2600 28.1000
64.2600 28.1400
64.2600 28.1700
64.2600 28.2000
64.2600 28.2300
64.2600 28.2600
64.2300 28.2600
64.2000 28.2600
64.1700 28.2600
64.1400 28.2600
64.1000 28.2600
64.0700 28.2600
64.0400 28.2600
64.0100 28.2600
64.0100 28.2300
64.0100 28.2000
64.0100 28.1700
64.0100 28.1400
64.0100 28.1000
64.0100 28.0700
64.0100 28.0400
64.0100 28.0100
eof
# 1
第一行调用实用程序GMT(Generic Mapping Tools),其中每个部分在文件image.ps
中绘制为彩色多边形,颜色由-G
标记中的RGB值给定。每个部分以一个eof
和一个标签(# 1
)结束。你知道吗
基本上,我希望能够有两个独立的数组,一个用于从-G
标记分割的单个RGB值,另一个用于每个单独的多边形顶点集。最终目标是使用各种matplotlib/basemap工具绘制这些多边形(不使用GMT)。你知道吗
这可能吗?我在其他帖子中看到它是possible for simpler formatting,但我对Python有些陌生。你知道吗
谢谢你。你知道吗
我会这样做:
这是一个非常简单的例子,没有错误检查。 如果输入文件语法出现意外情况,它将中断。 它也可能有拼写错误和其他错误。 如果它坏了,你可以保留所有的碎片。:)
相关问题 更多 >
编程相关推荐