Re: NCL API

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Aug 23 2010 - 11:13:45 MDT

Hi Oliver,

You should be able to plot it directly.

Using C code is going to be quite different than NCL code. The interface for creating graphics looks a
bit different.

You can see an example where dummy data is created directly in an HLU C program:

http://www.ncl.ucar.edu/Applications/BasicExamples/Contour/cn02.shtml

Scroll down and click on "cn02c.c" to see what it looks like.

The code that passes the dummy array to the plotting code is this:

    NhlRLClear(srlist);
    len_dims[0] = N;
    len_dims[1] = M;
    NhlRLSetMDFloatArray(srlist,NhlNsfDataArray,T,2,len_dims);

Resources are set with calls to NhlRLSetXXXXX where XXXXX is the data type (Integer, Float, String, etc).
If you are setting a resource that is a 1D array, then you need to use the NhlRLSetXXXXXArray one. If you
are setting resource that requires an nD array, use NhlRLSetMDXXXXXArray

Finally, you can compile your C program with:

    nhlcc -o yourprogram yourprogram.c

Hope this helps.

--Mary

On Aug 23, 2010, at 2:08 AM, <Oliver.Fuhrer@meteoswiss.ch> <Oliver.Fuhrer@meteoswiss.ch> wrote:

> Hi NCL Team,
>
> I was just looking over the NCL API documentation and have a question.
> Say I have a C program that generates a 2d field that I would like to
> plot. Is it possible to plot this field _directly_ using the NCL API
> from my C program or do I have to write a NetCDF (or any other) file and
> send a NCL script which opens the file, reads the data and plots the
> field over the NCL API (as in the example provided on the NCL API
> documentation)?
>
> Kind regards,
> Oli
>
> ________________________________________
>
> Oliver Fuhrer
> Numerical Models
>
> Federal Departement of Home Affairs FDHA
> Federal Office of Meteorology and Climatology MeteoSwiss
>
> Kraehbuehlstrasse 58, P.O. Box 514, CH-8044 Zurich, Switzerland
>
> Tel. +41 44 256 93 59
> Fax +41 44 256 92 78
> oliver.fuhrer@meteoswiss.ch
> www.meteoswiss.ch - First-hand information
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Aug 23 11:13:52 2010

This archive was generated by hypermail 2.1.8 : Wed Aug 25 2010 - 11:50:26 MDT