Cool. Thanks! I searched through the ncap2 documentation, but didn’t find the type() function. I knew that it had to be there somewhere.
From: firstname.lastname@example.org [mailto:email@example.com]
Sent: Wednesday, April 09, 2014 4:15 AM
To: Smit, Christine E. (GSFC-610.2)[TELOPHASE CORP]
Subject: Fwd: [nco:discussion] Feature request: direct type specification in ncap2
----- Forwarded message from "henry Butowsky" firstname.lastname@example.org<mailto:email@example.com> -----
Date: Mon, 07 Apr 2014 19:46:07 +0000
Subject: [nco:discussion] Feature request: direct type specification in ncap2
To: "[nco:discussion] " firstname.lastname@example.org<mailto:email@example.com>
some of the functionality you want is already present
the function type() returns an integer indicating the type
ncap2 -v -O -s 'four=4.0; mtype=four.type();print(mtype);' in.nc foo.nc
The values it returns are defined as defined as ram variables:
BYTE, CHAR, SHORT, INT FLOAT DOUBLE
UBYTE USHORT UINT INT64 UINT64
In addition there are the convert to types:
ushort(), uint(),uint64(), ubyte(),byte(),char()
ncap2 -v -O -s 'four=4.0;fouri=four.int(); print(fouri);' in.nc foo.nc
also there is the convert() function but at the moment it crashing out:
I shall look at this this week and get it fixed
ncap2 -v -O -s 'four=4.0;fourf=four.convert(__FLOAT); print(fourf);' in.nc foo.nc
You can use the constants in an if statement e.g:
if( four.type() == __DOUBLE )
print(" iam a double\n")
Ill text on the forum when I get convert() working
Feature request: direct type specification in ncap2https://sourceforge.net/p/nco/discussion/9829/thread/b2f023ca/?limit=25#e70b
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/nco/discussion/9829/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.