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.
Hi Valentijn, > > i'm trying to use the JAVA apache commons math function in the IDV-jython. > You can find the jar containing these classes at: > > http://adde.itc.nl/IDV/commons-math-1.1.jar > > If you load the ITC-IDV from here you'll the nightly build with the common > math jar automatically through webstart: > > http://adde.itc.nl/IDV/IDV_ITC_R6.jnlp > > Here is my jython code: > > sys.add_package('org.apache.commons.math.analysis'); > sys.add_package('org.apache.commons.math'); > from org.apache.commons.math.analysis import UnivariateRealInterpolator, > UnivariateRealFunction > from org.apache.commons.math.analysis import SplineInterpolator, > PolynomialSplineFunction, PolynomialFunction > > from jarray import zeros > from java.lang import Float > > def getTestImageN52(d): > > arrayX = zeros(1,"d") > arrayY = zeros(1,"d") > > arrayX = [0,1,2,3,4] > arrayY = [3,4,5,6,7] > > UnivariateRealInterpolator = SplineInterpolator(); > UnivariateRealFunction = > UnivariateRealInterpolator.interpolate(arrayX,arrayY); > print UnivariateRealFunction.getN() > print UnivariateRealFunction.value(4) > > Up to here it work, but now i want to get the coefficients using the > getCoefficients(). > Can you send your full jython library along? the below error has a line number in your getTextImageN52 procedure. It looks like you are passing in a string value to a method that expects a double array. -Jeff > ****************** > Stack trace: > Traceback (innermost last): > File "<string>", line 1, in ? > File "<string>", line 365, in getTestImageN52 > TypeError: org.apache.commons.math.analysis.PolynomialSplineFunction(): 1st > arg can't be coerced to double[] > > > Ticket Details =================== Ticket ID: PVX-612998 Department: Support IDV Priority: Normal Status: Open