Re: [idvusers] Jython To Read Catalog

Hi Kevin --

I won't comment on the radar-specific stuff...however...

Yes it is possible to use any/all of the Java classes from Jython.
There might some issues with certain overloaded methods as Jython
tries to decide which to call (booleans can cause an issue).

Jython is an implementation of Python (2.5 right now) that runs in the
Java Virtual Machine, so you can use any Python syntax.  However, the
only Python "library" routines you could use are those .py files that
do not depend on any native code....that is usually the problem...

If you're interested in NumPy, you can check out the JNumeric that is
included with the IDV -- it is based on the old Numeric package and so
includes quite a bit of the basic array stuff...

tom

On Thu, May 2, 2013 at 12:40 PM, Kevin Manross <manross@xxxxxxxx> wrote:
>
> Hello Yuan,
>
> Thanks for the reply.  I started tinkering with the TDSRadarChooser and
> TDSRadarDatasetCollection classes a bit before trying the IDV Jython
> approach.  I wasn't sure if I was reinventing the wheel, so I looked into
> Jython scripting.  If I understand you correctly, I should modify/extend the
> TDSRadarChooser and TDSRadarDatasetCollection classes to accept a lat/lon
> and return the nearest radar.  Then I should attempt to call these new
> methods via Jython script.  Is this correct?
>
> Do I also understand you correctly that I should be able to call many/most
> of the IDV Java classes and methods via Jython? If so, that's a really
> interesting opportunity I didn't know about.  I didn't see anything in the
> Jython library that would allow me to read/parse a server catalog, so if it
> is a matter of calling the appropriate Java classes/methods, this will be
> really intriguing and helpful.
>
> It is possible to blend IDV Jython statements with general python statements
> including using standard or third party python modules?
>
> -kevin.
>
>
>
> On 5/2/13 9:25 AM, Yuan Ho wrote:
>>
>> On 4/30/2013 9:19 PM, Kevin Manross wrote:
>>>
>>>
>>> Hello!
>>>
>>> I'm *just* now starting to explore the jython capabilities in the IDV. I
>>> would like to write a script that the user enters a lat/lon and a
>>> date/time and from that, have the IDV plot an image for a radar nearest
>>> to that point and nearest that time.  This would be run headless for web
>>> images.
>>>
>>> I'm working on a "nearest radar chooser", but the big hurdle I'm facing
>>> is: is there a way with IDV/Jython to read and parse the top level
>>> catalog
>>>
>>> http://motherlode.ucar.edu:8080/thredds/catalog/nexrad/level2/catalog.xml
>>>
>>> or even
>>>
>>>
>>> http://motherlode.ucar.edu:8080/thredds/catalog/nexrad/level2/Kxxx/catalog.xml
>>>
>>>
>>> to get the available dates and times so I could then build the url for
>>> makeDataSource?
>>>
>>> -kevin.
>>>
>>>
>> Kevin,
>>      This is a very interesting idea.
>>      In the IDV, we use a table (xml file) to store all radar stations
>> information. There are a few APIs in the TDSRadarDatasetCollection class you
>> can use to get a list of stations. You need to write an API to find the
>> nearest radar station with the input of lat/lon. This probably the big
>> hurdle for you. After that, there are APIs already that can be used to parse
>> the server catalog and communicate with the server. You can reference the
>> TDSRadarChooser and TDSRadarDatasetCollection classes.
>>
>>      The benefit of using Jython is that you can invoke many Java class
>> directly, so I think this project is very interesting. Let us know if you
>> need more help.
>>
>>
>>
>> Yuan
>>
>> _______________________________________________
>> idvusers mailing list
>> idvusers@xxxxxxxxxxxxxxxx
>> For list information, to unsubscribe, visit:
>> http://www.unidata.ucar.edu/mailing_lists/
>
>
> --
> Kevin Manross
> NCAR/CISL/Data Support Section
> Phone: (303)-497-1218
> Email:manross@xxxxxxxx <mailto:manross@xxxxxxxx>
> Web:http://rda.ucar.edu
> _______________________________________________
> idvusers mailing list
> idvusers@xxxxxxxxxxxxxxxx
> For list information, to unsubscribe, visit:
> http://www.unidata.ucar.edu/mailing_lists/



-- 
Tom Whittaker
University of Wisconsin-Madison
Space Science & Engineering Center (SSEC)
Cooperative Institute for Meteorological Satellite Studies (CIMSS)
1225 W. Dayton Street
Madison, WI  53706  USA
ph: +1 608 262 2759