Ruby/GrADS

GrADS script

Define method named as "name" with given definition by script text

GrADS#script :name, %{ GrADS scripts } ### scope of instance
GrADS.script :name, %{ GrADS scripts } ### scope of global

GrADS code

Execute grads command sequence

GrADS#exec filename
GrADS#exec_string text

CArray -> GrADS variable

Write block as GrADS::Gridded::Writer definition

GrADS#template2d(dataset, ca, cb, ...) { ... } => a, b, ...
GrADS#tempalte3d(dataset, ca, cb, ...) { ... } => a, b, ...

"grads/lib/save_image"

GrADS#save_image(filename, size="640", dpi=300)

parea, vpage

parea(x1, x2, y1, y2) { |area|

}

vpage(x1, x2, y1, y2) { |area|

}

plot

plot (expr, type) {
  ... CONFIG ...
}

axis

axis (dummy_expr) {
  ... CONFIG ...
}

axis_xtime

require "grads/lib/axis_xtime"
axis_xtime (dummy_expr, OPTIONS) {
  ... CONFIG__
}

  OPTIONS:
    offset: TIME OFFSET in seconds
    skip: TIME axis interval to skip labels

time_skip

Use with axis_xtime to calculate skip for x-time in vector plot.

skp = time_skip()
plot("skip(u,1,#{skp});v", :vector) {
  ...
}

axis label

draw_ylabel(text, area: area, color: 1, just: "bc", thickness: 3, rot 0, offset: STRING,  side: "l")
draw_xlabel(text, area: area, color: 1, just: "bc", thickness: 3, rot: 0, offset: STRING, side: "b")

COLOR NAMES

COLOR(COLOR_NAME)

"background" => 0,
"foregraound" => 1,
"red" => 2,
"green" => 3,
"dark blue" => 4,
"light blue" => 5,
"magenta" => 6,
"yellow" => 7,
"orange" => 8,
"purple" => 9,
"yellow green" => 10,
"medium blue" => 11,
"dark yellow" => 12,
"aqua" => 13,
"dark purple" => 14,
"gray" => 15,