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: Jeffrey Buler <address@hidden> >Organization: University of Southern Mississippi >Keywords: 200401271540.i0RFehp2015930 IDV printout of radar data Hi Jeff- I apologize for the delay in responding. > >I hope you enjoyed your time away from the office. I could use some time >myself. I'm ready again already! >I was wondering if you've had a chance to work on my request for a >Jython method to output Level II NEXRAD data (range azimuth, elevation, dBZ, >radial velocity) to ascii. I realize the data files will be large, but I only > >need to do this for about 160 images. Again, I really appreciate any help you > >can provide. Well, I have a way that you could do this in a jython formula, but it's not elegant. Here's what you would do: 1)From the Edit->Formulas menu, open the Jython Library. 2)Paste in the following formula: 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 * file = open(filename,"w") print a.getType() mydu = du() tdom = a.getDomainSet() l = tdom.getLength() for j in range(0,l): print mydu.getSample(tdom, j) b = a[j] dom = b.getDomainSet() lldom = convertDomain(dom, rt.LatitudeLongitudeAltitude,None) c = dom.getLength() n = 0 for i in range(0,10): point = mydu.getSample(dom, i) llpoint = mydu.getSample(lldom,i) value = b[i].getValue() n = n + 1 line = str(point)+" "+str(llpoint)+" = "+str(value)+"\n" #print point,"(",llpoint,") = ",value file.write(line) file.close() return a 3) Click the Save button. Sometimes pasting code into the editor adds unprintable control characters. If that's the case, you'd have to type it in by hand. It depends on your mail client. 4) Create a forumula by selecting the Edit->Formulas->Create Formula method. - for the name, call it radarPrint - for the description, call it "Print out radar sweep values" - you can leave the display category blank - uncheck the "Use all displays" checkbox and check on the "Radar Sweep View in 3D". This will select the data as 3D. - For the Formula, type in "printField(a, user_file)" the a will be used to select the data you want. the user_file will allow you to prompt for a filename 5) Now load in a level II radar file. I would do this one at a time for starters. From the Data Sources panel of the Data Selector, select the Formulas Data Source. In the Fields panel, select the forumla you just created and in the Displays, select the display listed. Then press the "Create Display" button. 6) You'll be prompted for a filename. Type in the name you want and click the OK button. 7) You'll be prompted for a variable to use for "a". From the data tree, select the Reflectivity Elevation Angle 0.5 data choice an click the OK button. The Jython script above will be executed and write the values out to the file you specified. This will take a while. It will generate a 16 MB file as is. I don't have any suggestions for automating this. Right now, the IDV doesn't really support scripting of this procedure. Let me know if you have any questions about using the method above. Don Murray NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publically 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.