使用Ruby从CDIP数据创建光谱热图或强度图 [英] Creating Spectral Heat maps or Intensity maps from CDIP data using Ruby

查看:211
本文介绍了使用Ruby从CDIP数据创建光谱热图或强度图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景



根据沿海信息数据程序(CDIP),他们正在生成波浪膨胀的光谱热/强度图, a href =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_spectrumrel =nofollow> 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



QUESTION



如何采取这种二维数据并创建热/强度图,确保它覆盖在极地协调地图(并且是适当的比例),就像每个CDIP网站的示例URL一样?



最终,我需要这样做在Ruby中,最好使用ruby-gd或者Rmagick,但是我也会非常感谢任何与语言无关的解决方案。

解决方案

我真的很忙,所以现在不能完成,但是没人回答,这是第一种方法:


$ b $在数学中的代码(对不起,我现在说没有时间):

  a =导入[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)],

(*点大小,不介意*)
PointSize [1 / Sqrt [r] / 10],

(*为您的点坐标a是您的数据矩阵*)
点[
{(rr = Log [.025 +(.58 - .25)/ 64 r] )cos @(tt = t 5 Degree),
rr Sin @ tt}]
}

(*迭代值)
,{r, 7,64},{t,1,72}],1]

(*旋转,不介意*)
/。 gg:Graphics [___]:>旋转[gg,Pi / 2]

我仍然无法获得正确的颜色比例: p>


BACKGROUND

Per the Coastal Information Data Program (CDIP), they are generating a spectral heat/intensity map for wave swell at 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.

This is dynamically generated with data containing energy density, duration (in seconds) & direction (in degrees with 180 degrees representing south).

DATA SAMPLE

Here's an explanation of the data: http://cdip.ucsd.edu/data_access/MEM_2dspectra.cdip

Here's a data sample for buoy 100 (same buoy as shown in the heat/intensity/spectral map: http://cdip.ucsd.edu/data_access/MEM_2dspectra.cdip?100

QUESTION

How do I take this 2-dimensional data and create a heat/intensity map ensuring that it is overlaid on Polar Coordinate map (and is the appropriate scale), just like the example url per CDIP's site?

Ultimately, I need this to be done in Ruby, preferably using ruby-gd or Rmagick, but I would greatly appreciate any language-agnostic solutions, too.

解决方案

I am really in a rush, so can't finish right now, but as nobody answered yet, here is a first approach:

Code in Mathematica (sorry, as I said no time right now):

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]  

I still can't get the right color scale:

这篇关于使用Ruby从CDIP数据创建光谱热图或强度图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆