This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>From: "Karen A. Kosiba" <address@hidden> >Organization: Purdue University >Keywords: 200412071442.iB7EgklI016347 IDV Jython output Hi Karen- >Thank you for your response! Sorry my email was so nebulous. No problem, just wanted to know where you were in the process. Looks like you've already done the hard part. ;-) >I have created >a Marshall-Palmer relationship in the Jython library and can display the >rainfall rate (in the display window). But, I would like to have a printout >of 3 columns: lat, lon, and rainfall rate (or something similiar) to compare >with rain gauge data. This is where I am stuck...I cannot figure out how to >print out these numbers (create a number output file that includes lat/lon >info). I don't have anything that gives 3 columns per se, but here's a Jython script that I put together for someone else on how to print out the reflectivity values from a Level II file. It seems like you understand Jython, so you could take this and adapt it as needed. import sys; sys.add_package('visad'); sys.add_package('visad.util'); sys.add_package('ucar.visad'); def printField(a,filename="foo"): from visad import RealTupleType as rt from visad.util import DataUtility as du from ucar.visad.Util import * # open a file for writing file = open(filename,"w") mydu = du() # data has format like: # (Time -> ((Range, Azimuth, Elevation_Angle) -> Reflectivity)) # get the outer time domain tdom = a.getDomainSet() l = tdom.getLength() # iterate over time domain for j in range(0,l): # write out the timestamp file.write(str(mydu.getSample(tdom, j))+"\n") #get first sweep b = a[j] # print out the datatype file.write(str(b.getType())+"\n") # dom will be (Range, Azimuth, Elevation_Angle) dom = b.getDomainSet() # convert to lat/lon/alt. This does not account for # refraction lldom = convertDomain(dom, rt.LatitudeLongitudeAltitude,None) c = dom.getLength() # now loop over each point n = 0 line = "" for i in range(0,c): # point in (Range, Azimuth, Elevation_Angle) space point = mydu.getSample(dom, i) # point in (Latitude, Longitude, Altitude) space llpoint = mydu.getSample(lldom,i) # value for data value = b[i].getValue() # format output if n < 10: line = line+str(point)+" "+str(llpoint)+" = "+str(value)+"\n" n = n + 1 else: # write it out to the file file.write(line) n = 0 line="" file.close() return a If you have questions about the above, let me know. Don Murray **************************************************************************** < Unidata User Support UCAR Unidata Program < (303)497-8643 P.O. Box 3000 < address@hidden Boulder, CO 80307 < ---------------------------------------------------------------------------- < Unidata WWW Service http://my.unidata.ucar.edu/content/support < ---------------------------------------------------------------------------- < NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.