ruby - 使用 Ruby 从 CDIP 数据创建光谱热图或强度图

标签 ruby dictionary heat spectral

背景

根据沿海信息数据计划 (CDIP),他们正在生成 http://cdip.ucsd.edu/?nav=recent&sub=observed&units=metric&tz=UTC&pub=public&map_stati=1,2,3&stn=100&stream=p1&xitem=dir_spectrum 处海浪涌浪的光谱热度/强度图。 .

这是通过包含能量密度、持续时间(以秒为单位)和方向(以度为单位,180 度代表南)的数据动态生成的。

数据样本

以下是数据的解释:http://cdip.ucsd.edu/data_access/MEM_2dspectra.cdip

这是浮标 100 的数据样本(与热度/强度/光谱图中显示的浮标相同:http://cdip.ucsd.edu/data_access/MEM_2dspectra.cdip?100

问题

如何获取此二维数据并创建热/强度图,确保其覆盖在极坐标图上(并且比例适当),就像每个 CDIP 站点的示例网址一样?

最终,我需要在 Ruby 中完成此操作,最好使用 ruby​​-gd 或 Rmagick,但我也非常感谢任何与语言无关的解决方案。

最佳答案

我真的很着急,所以现在无法完成,但由于还没有人回答,这是第一种方法:

Mathematica 中的代码(抱歉,我说过现在没有时间):

a = Import["http://cdip.ucsd.edu/data_access/MEM_2dspectra.cdip?100", 
   "Table"];

Graphics@Flatten[Table[

    (*colors, dont mind*)
    {ColorData["CMYKColors"][(a[[r, t]] - .000007)/(.0003 - 0.000007)], 

    (*point size, dont mind*)
    PointSize[1/Sqrt[r]/10], 

    (*Coordinates for your points "a" is your data matrix *)
       Point[
            {(rr =Log[.025 + (.58 - .25)/64 r]) Cos@(tt = t 5 Degree), 
              rr Sin@tt}]
            }

     (*values for the iteration*)
     , {r, 7, 64}, {t, 1, 72}], 1] 

     (*Rotation, dont mind*)
     /. gg : Graphics[___] :> Rotate[gg, Pi/2]  

我仍然无法获得正确的色标:

enter image description here

关于ruby - 使用 Ruby 从 CDIP 数据创建光谱热图或强度图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5161814/

相关文章:

维克斯 : error LGHT0204 : ICE80: This 32BitComponent xxx uses 64BitDirectory yyy

ruby C 扩展 : Is there a way to finalize?

ruby-on-rails - 我如何解析一个 Excel 文件,它会给我提供与视觉上完全一样的数据?

iphone - "WARNING: Input manager failed to load static dictionary for: nl_NL"是什么意思?

python - 遍历一组字典 - python - 基本搜索

visual-studio - 加快 WiX-Installer 的构建过程

python - 使用 Python 进行 2D 热传导

mysql - 错误命名迁移 - rake db :migrate rejected

ruby-on-rails - 如何从 Rails 内部动态发送回复邮件

java - 流 'map'可以用于这样的处理吗?