Personal tools
You are here: Home Members azubrow's Home ioapiTools Converting an iovar object
Document Actions

Converting an iovar object


This tutorial describes how to convert an iovar object to a cdms object or a Numeric array and how to convert arrays to iovar objects. 



1. Converting from an iovar object

## Convert CO from iovar to Numeric
coArray = co.getValue()

## Convert CO from iovar to cdms variable
coCdms = co.IO2cdms()


  Table of Contents Contents

2. Converting to an iovar object

## Get the attributes metadata from another iovar variable
attributes = o3.attributes

## Get the temporal, vertical, and spatial axes
## First create a cdmsM object then extract the axes
cdmsM = ioT.cdmsmeta(o3, ioT.cdmsvarFlag)
axesLst = cdmsM.getAxes()

## Get an ioM - IOAPI metadata
ioM = o3.ioM.copy()

## Create a new CO variable using the
## original CO data array and the
## metadata from O3
co_new = ioT.createVariable(coArray, ioM, axesLst, "CO", attributes)

## Still have o3 as long name, change using IOmodVar
co_new.IOmodVar(desc="CO variable")

At times, you may have data in Numeric array or cdms format and want to convert into an iovar object.  The key idea is that you take an already existing iovar object of the same domain and projection and use the iovar's axes and metadata to create a new variable.

  Table of Contents Previous

Contents Previous
Next


Powered by Plone