PyNGL Home > Functions > Array query

Ngl.get_MDinteger_array

Retrieves the value of a resource that uses a multi-dimensional integer array.

Prototype

iarr = Ngl.get_MDinteger_array(plotid, resource_name)

Arguments

plotid

The identifier returned from Ngl.open_wks, or any PyNGL function that returns a PlotId.

resource_name

The name of the resource whose value you want to retrieve.

Return value

iarr

A NumPy array having elements of type 'int'.

Description

This function retrieves a multi-dimensioned array that is the value of a specified resource associated with a plot.

The first argument is a PlotId and the second argument is the resource whose value you want to retrieve. The function returns a NumPy array of elements of type 'int' containing the current value of the specified resource.

See Also

Ngl.get_MDfloat_array, Ngl.get_float, Ngl.get_float_array, Ngl.get_integer, Ngl.get_integer_array, Ngl.get_string, Ngl.get_string_array

Examples

Currently no resource takes a multi-dimensional integer array. The following example is totally artificial in that you would never really want to specify elements of a color map using integers, since the only recognized integers would be zero and one. But, just to show how Ngl.get_MDinteger_array would be called, you can run the following:


import Ngl,numpy

cmap = numpy.array([[1,1,1],[0,0,0],[0,1,1]],'i')

rlist               = Ngl.Resources()
rlist.wkColorMap    = cmap

wks_type = "ps"
wks = Ngl.open_wks(wks_type,"iarr",rlist)

print Ngl.get_MDinteger_array(wks,"wkColorMap")

Ngl.end()