[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[IDV #AXY-187868]: raw data on RAOB?
- Subject: [IDV #AXY-187868]: raw data on RAOB?
- Date: Tue, 26 Feb 2008 14:04:49 -0700
> Is there any quick way to get a formatted text output for RAOB data
> ingested within IDV? (columns of P , T, Td, Z, wind speed, wind dir)
>
> I can't seem to find a way to do this anywhere, within the users guide, or
> in the forums.
>
Hi Marcus,
Attached is a jython script. Add it to your jython library:
http://www.unidata.ucar.edu/software/idv/docs/userguide/tools/Jython.html
The routine is called printSoundings. It writes out each field (temp,td,winds)
as a separate 2 column listing with the pressure/height X value.
Bring up the jython shell:
http://www.unidata.ucar.edu/software/idv/docs/userguide/tools/JythonShell.html
set a variable to the sounding data:
sounding = selectData("Sounding Data")
print out the sounding:
printSoundings(sounding)
You could also create a formula that calls printSoundigs
-Jeff
Ticket Details
===================
Ticket ID: AXY-187868
Department: Support IDV
Priority: Normal
Status: Closed
def printSoundings(d):
numSoundings = d.getDimension();
for i in range(numSoundings):
sounding = d.getComponent(i);
printSounding(sounding);
return
def printSounding(sounding):
from ucar.unidata.util import StringUtil;
numFields = sounding.getDimension();
dateTime = sounding.getComponent(0);
location = sounding.getComponent(1);
print "date:" + str(dateTime);
print "location:" + str(location);
for fieldIdx in range(2,numFields):
rowBuffers = ArrayList();
sb = java.lang.StringBuffer();
rowBuffers.add(sb);
field = sounding.getComponent(fieldIdx);
rangeType= field.getType().getRange();
domainSamples = field.getDomainSet().getSamples();a
rows = field.getDomainSet().getLength();
fieldName= str(field.getType().getRange());
domainType = field.getDomainSet().getType().getDomain();
sb.append(str(domainType));
sb.append(", ");
fieldName = fieldName.replace("(","");
fieldName = fieldName.replace(")","");
sb.append(fieldName);
for row in range(rows):
sb = java.lang.StringBuffer();
rowBuffers.add(sb);
sb.append(str(domainSamples[0][row]));
sb.append(", ");
data = field.getSample(row);
dataString = str(data);
# a hack to deal with the spd/dir tuple
dataString = dataString.replace("(","");
dataString = dataString.replace(")","");
sb.append(dataString);
print StringUtil.join("\n",rowBuffers);
print "\n\n";