Issue #2262 create new wxmath plugin seeded by Java derivparam functions
Change-Id: If71c205a88ef17a2432267956bd05b9b10a56aa2 Former-commit-id:23fe237b7e
[formerly09872d6713
] [formerly23fe237b7e
[formerly09872d6713
] [formerly959b50d184
[formerly f3d233aeff8017c521288affd4b5be668c9a890a]]] Former-commit-id:959b50d184
Former-commit-id:aaee338f5c
[formerly44ef756627
] Former-commit-id:5a2c7fd36f
This commit is contained in:
parent
76773c9b82
commit
2bed514c66
20 changed files with 361 additions and 106 deletions
|
@ -159,4 +159,11 @@
|
||||||
version="0.0.0"
|
version="0.0.0"
|
||||||
unpack="false"/>
|
unpack="false"/>
|
||||||
|
|
||||||
|
<plugin
|
||||||
|
id="com.raytheon.uf.common.wxmath"
|
||||||
|
download-size="0"
|
||||||
|
install-size="0"
|
||||||
|
version="0.0.0"
|
||||||
|
unpack="false"/>
|
||||||
|
|
||||||
</feature>
|
</feature>
|
||||||
|
|
|
@ -17,6 +17,7 @@ Require-Bundle: com.raytheon.uf.common.status;bundle-version="1.12.1174",
|
||||||
org.eclipse.ui;bundle-version="3.6.1",
|
org.eclipse.ui;bundle-version="3.6.1",
|
||||||
org.eclipse.core.runtime;bundle-version="3.6.0",
|
org.eclipse.core.runtime;bundle-version="3.6.0",
|
||||||
com.raytheon.uf.common.util;bundle-version="1.12.1174",
|
com.raytheon.uf.common.util;bundle-version="1.12.1174",
|
||||||
com.raytheon.uf.common.python.concurrent;bundle-version="1.0.0"
|
com.raytheon.uf.common.python.concurrent;bundle-version="1.0.0",
|
||||||
|
com.raytheon.uf.common.wxmath
|
||||||
Export-Package: com.raytheon.uf.viz.derivparam.python,
|
Export-Package: com.raytheon.uf.viz.derivparam.python,
|
||||||
com.raytheon.uf.viz.derivparam.python.function
|
com.raytheon.uf.viz.derivparam.python.function
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
# further licensing information.
|
# further licensing information.
|
||||||
##
|
##
|
||||||
|
|
||||||
from com.raytheon.uf.viz.derivparam.python.function import CapeFunc
|
from com.raytheon.uf.viz.derivparam.python.function import CapeFuncPythonAdapter as CapeFunc
|
||||||
from numpy import zeros
|
from numpy import zeros
|
||||||
|
|
||||||
def execute(*args):
|
def execute(*args):
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
# Jun 05, 2013 2043 bsteffen Ported from meteolib C
|
# Jun 05, 2013 2043 bsteffen Ported from meteolib C
|
||||||
|
|
||||||
from numpy import zeros
|
from numpy import zeros
|
||||||
from com.raytheon.uf.viz.derivparam.python.function import DCapeFunc
|
from com.raytheon.uf.viz.derivparam.python.function import DCapeFuncPythonAdapter as DCapeFunc
|
||||||
|
|
||||||
|
|
||||||
def execute(threeDtemperature, threeDdewpoint, pressure, potentialTemperature, specificHumidity,maxEvaporation,maxRelativeHumidity,useVirtualTemp):
|
def execute(threeDtemperature, threeDdewpoint, pressure, potentialTemperature, specificHumidity,maxEvaporation,maxRelativeHumidity,useVirtualTemp):
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
from numpy import ndarray, float32, NaN
|
from numpy import ndarray, float32, NaN
|
||||||
from numpy import sin, isnan, invert
|
from numpy import sin, isnan, invert
|
||||||
from com.raytheon.uf.viz.derivparam.python.function import DistFilter
|
from com.raytheon.uf.viz.derivparam.python.function import DistFilterPythonAdapter as DistFilter
|
||||||
|
|
||||||
MAX_WAVE_NUMBER = 15
|
MAX_WAVE_NUMBER = 15
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.uf.viz.derivparam.python.function;
|
||||||
|
|
||||||
|
import jep.INumpyable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls {@link com.raytheon.uf.common.wxmath.CapeFunc} and transforms the
|
||||||
|
* output into an INumpyable.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Aug 13, 2013 njensen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author njensen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CapeFuncPythonAdapter {
|
||||||
|
|
||||||
|
public static class CapeCinPair implements INumpyable {
|
||||||
|
|
||||||
|
private final int nx;
|
||||||
|
|
||||||
|
private final int ny;
|
||||||
|
|
||||||
|
private final float[] cape;
|
||||||
|
|
||||||
|
private final float[] cin;
|
||||||
|
|
||||||
|
public CapeCinPair(int nx, int ny, float[] cape, float[] cin) {
|
||||||
|
this.nx = nx;
|
||||||
|
this.ny = ny;
|
||||||
|
this.cape = cape;
|
||||||
|
this.cin = cin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object[] getNumPy() {
|
||||||
|
return new Object[] { cape, cin };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getNumpyX() {
|
||||||
|
return nx;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getNumpyY() {
|
||||||
|
return ny;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static INumpyable capeFunc(float usetv, float[] p_dat,
|
||||||
|
float[] tve_dat, float[] p0, float[] th0, float[] sh0, int nx,
|
||||||
|
int ny, int nz) {
|
||||||
|
float[][] result = com.raytheon.uf.common.wxmath.CapeFunc.capeFunc(
|
||||||
|
usetv, p_dat, tve_dat, p0, th0, sh0, nx, ny, nz);
|
||||||
|
return new CapeCinPair(ny, nx, result[0], result[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static INumpyable capeFuncTop(float usetv, float[] p_dat,
|
||||||
|
float[] tve_dat, float[] p0, float[] th0, float[] sh0,
|
||||||
|
float[] ptop, int nx, int ny, int nz) {
|
||||||
|
float[][] result = com.raytheon.uf.common.wxmath.CapeFunc.capeFuncTop(
|
||||||
|
usetv, p_dat, tve_dat, p0, th0, sh0, ptop, nx, ny, nz);
|
||||||
|
return new CapeCinPair(ny, nx, result[0], result[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.uf.viz.derivparam.python.function;
|
||||||
|
|
||||||
|
import jep.INumpyable;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.python.PythonNumpyFloatArray;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls {@link com.raytheon.uf.common.wxmath.DCapeFunc} and transforms the
|
||||||
|
* output into an INumpyable for python.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Aug 13, 2013 njensen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author njensen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DCapeFuncPythonAdapter {
|
||||||
|
|
||||||
|
public static INumpyable dcapeFunc(float usetv, float[] p_dat,
|
||||||
|
float[] t_dat, float[] td_dat, float[] p0, float[] th0,
|
||||||
|
float[] sh0, int nx, int ny, int nz, float max_evap, float max_rh) {
|
||||||
|
float[] result = com.raytheon.uf.common.wxmath.DCapeFunc.dcapeFunc(
|
||||||
|
usetv, p_dat, t_dat, td_dat, p0, th0, sh0, nx, ny, nz,
|
||||||
|
max_evap, max_rh);
|
||||||
|
return new PythonNumpyFloatArray(result, ny, nx);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.uf.viz.derivparam.python.function;
|
||||||
|
|
||||||
|
import jep.INumpyable;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.python.PythonNumpyFloatArray;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls {@link com.raytheon.uf.common.wxmath.DistFilter} and transforms the
|
||||||
|
* output into an INumpyable.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Aug 13, 2013 njensen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author njensen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DistFilterPythonAdapter {
|
||||||
|
|
||||||
|
public static INumpyable filter(float[] input, float npts, int nx, int ny,
|
||||||
|
int times) {
|
||||||
|
float[] result = com.raytheon.uf.common.wxmath.DistFilter.filter(input,
|
||||||
|
npts, nx, ny, times);
|
||||||
|
return new PythonNumpyFloatArray(result, nx, ny);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
7
edexOsgi/com.raytheon.uf.common.wxmath/.classpath
Normal file
7
edexOsgi/com.raytheon.uf.common.wxmath/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
28
edexOsgi/com.raytheon.uf.common.wxmath/.project
Normal file
28
edexOsgi/com.raytheon.uf.common.wxmath/.project
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>com.raytheon.uf.common.wxmath</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,7 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -0,0 +1,8 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Bundle-ManifestVersion: 2
|
||||||
|
Bundle-Name: Wxmath
|
||||||
|
Bundle-SymbolicName: com.raytheon.uf.common.wxmath
|
||||||
|
Bundle-Version: 1.0.0.qualifier
|
||||||
|
Bundle-Vendor: RAYTHEON
|
||||||
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||||
|
Export-Package: com.raytheon.uf.common.wxmath
|
4
edexOsgi/com.raytheon.uf.common.wxmath/build.properties
Normal file
4
edexOsgi/com.raytheon.uf.common.wxmath/build.properties
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
source.. = src/
|
||||||
|
output.. = bin/
|
||||||
|
bin.includes = META-INF/,\
|
||||||
|
.
|
|
@ -17,11 +17,11 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.derivparam.python.function;
|
package com.raytheon.uf.common.wxmath;
|
||||||
|
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c0;
|
import static com.raytheon.uf.common.wxmath.Constants.c0;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c1;
|
import static com.raytheon.uf.common.wxmath.Constants.c1;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c2;
|
import static com.raytheon.uf.common.wxmath.Constants.c2;
|
||||||
import static java.lang.Math.exp;
|
import static java.lang.Math.exp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +36,8 @@ import static java.lang.Math.exp;
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jun 3, 2013 2043 bsteffen Ported from meteolib C
|
* Jun 03, 2013 2043 bsteffen Ported from meteolib C
|
||||||
|
* Aug 13, 2013 2262 njensen Moved from deriv params
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
|
@ -17,14 +17,14 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.derivparam.python.function;
|
package com.raytheon.uf.common.wxmath;
|
||||||
|
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c0;
|
import static com.raytheon.uf.common.wxmath.Constants.c0;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c1;
|
import static com.raytheon.uf.common.wxmath.Constants.c1;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c2;
|
import static com.raytheon.uf.common.wxmath.Constants.c2;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c_1;
|
import static com.raytheon.uf.common.wxmath.Constants.c_1;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c_2;
|
import static com.raytheon.uf.common.wxmath.Constants.c_2;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.f;
|
import static com.raytheon.uf.common.wxmath.Constants.f;
|
||||||
import static java.lang.Math.abs;
|
import static java.lang.Math.abs;
|
||||||
import static java.lang.Math.exp;
|
import static java.lang.Math.exp;
|
||||||
import static java.lang.Math.log;
|
import static java.lang.Math.log;
|
||||||
|
@ -57,7 +57,8 @@ import static java.lang.Math.sqrt;
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jun 06, 2013 2043 bsteffen Ported from meteolib fortran
|
* Jun 06, 2013 2043 bsteffen Ported from meteolib fortran
|
||||||
|
* Aug 13, 2013 2262 njensen Moved from deriv params
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
|
@ -17,22 +17,21 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.derivparam.python.function;
|
package com.raytheon.uf.common.wxmath;
|
||||||
|
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.AdiabeticTemperature.adiabatic_te;
|
import static com.raytheon.uf.common.wxmath.AdiabeticTemperature.adiabatic_te;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c0;
|
import static com.raytheon.uf.common.wxmath.Constants.c0;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c1;
|
import static com.raytheon.uf.common.wxmath.Constants.c1;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c2;
|
import static com.raytheon.uf.common.wxmath.Constants.c2;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c_1;
|
import static com.raytheon.uf.common.wxmath.Constants.c_1;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c_2;
|
import static com.raytheon.uf.common.wxmath.Constants.c_2;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.kapa;
|
import static com.raytheon.uf.common.wxmath.Constants.kapa;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.kapa_1;
|
import static com.raytheon.uf.common.wxmath.Constants.kapa_1;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.TempOfTe.temp_of_te;
|
import static com.raytheon.uf.common.wxmath.TempOfTe.temp_of_te;
|
||||||
import static java.lang.Math.exp;
|
import static java.lang.Math.exp;
|
||||||
import static java.lang.Math.log;
|
import static java.lang.Math.log;
|
||||||
import static java.lang.Math.pow;
|
import static java.lang.Math.pow;
|
||||||
import static java.lang.Math.sqrt;
|
import static java.lang.Math.sqrt;
|
||||||
import jep.INumpyable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We input theta and specific humidity for initial parcel because these are
|
* We input theta and specific humidity for initial parcel because these are
|
||||||
|
@ -55,7 +54,8 @@ import jep.INumpyable;
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jun 3, 2013 2043 bsteffen Ported from meteolib C
|
* Jun 03, 2013 2043 bsteffen Ported from meteolib C
|
||||||
|
* Aug 13, 2013 2262 njensen Moved from deriv params
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -65,7 +65,21 @@ import jep.INumpyable;
|
||||||
|
|
||||||
public class CapeFunc {
|
public class CapeFunc {
|
||||||
|
|
||||||
public static CapeCinPair capeFunc(float usetv, float[] p_dat,
|
/**
|
||||||
|
* Cape function
|
||||||
|
*
|
||||||
|
* @param usetv
|
||||||
|
* @param p_dat
|
||||||
|
* @param tve_dat
|
||||||
|
* @param p0
|
||||||
|
* @param th0
|
||||||
|
* @param sh0
|
||||||
|
* @param nx
|
||||||
|
* @param ny
|
||||||
|
* @param nz
|
||||||
|
* @return two float arrays, i.e. { cap, cin }
|
||||||
|
*/
|
||||||
|
public static float[][] capeFunc(float usetv, float[] p_dat,
|
||||||
float[] tve_dat, float[] p0, float[] th0, float[] sh0, int nx,
|
float[] tve_dat, float[] p0, float[] th0, float[] sh0, int nx,
|
||||||
int ny, int nz) {
|
int ny, int nz) {
|
||||||
int n2 = nx * ny;
|
int n2 = nx * ny;
|
||||||
|
@ -83,8 +97,7 @@ public class CapeFunc {
|
||||||
double pp0 = p0[i];
|
double pp0 = p0[i];
|
||||||
double pp1 = pp0;
|
double pp1 = pp0;
|
||||||
if (Double.isNaN(pp0) || Double.isNaN(th0[i])
|
if (Double.isNaN(pp0) || Double.isNaN(th0[i])
|
||||||
|| Double.isNaN(sh0[i])
|
|| Double.isNaN(sh0[i]) || sh0[i] < 0.0005) {
|
||||||
|| sh0[i] < 0.0005) {
|
|
||||||
tec = tvc = pc = Double.NaN;
|
tec = tvc = pc = Double.NaN;
|
||||||
} else {
|
} else {
|
||||||
double t0 = th0[i] * pow(pp0 / 1000, kapa);
|
double t0 = th0[i] * pow(pp0 / 1000, kapa);
|
||||||
|
@ -312,12 +325,26 @@ public class CapeFunc {
|
||||||
pp1 = pp;
|
pp1 = pp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new CapeCinPair(ny, nx, cap, cin);
|
return new float[][] { cap, cin };
|
||||||
}
|
}
|
||||||
|
|
||||||
// In this version we stop the computation at some arbitrary upper level,
|
/**
|
||||||
// ptop.
|
* capeFuncTop. In this version we stop the computation at some arbitrary
|
||||||
public static CapeCinPair capeFuncTop(float usetv, float[] p_dat,
|
* upper level, ptop.
|
||||||
|
*
|
||||||
|
* @param usetv
|
||||||
|
* @param p_dat
|
||||||
|
* @param tve_dat
|
||||||
|
* @param p0
|
||||||
|
* @param th0
|
||||||
|
* @param sh0
|
||||||
|
* @param ptop
|
||||||
|
* @param nx
|
||||||
|
* @param ny
|
||||||
|
* @param nz
|
||||||
|
* @return two float arrays, i.e. { cap, cin }
|
||||||
|
*/
|
||||||
|
public static float[][] capeFuncTop(float usetv, float[] p_dat,
|
||||||
float[] tve_dat, float[] p0, float[] th0, float[] sh0,
|
float[] tve_dat, float[] p0, float[] th0, float[] sh0,
|
||||||
float[] ptop, int nx, int ny, int nz) {
|
float[] ptop, int nx, int ny, int nz) {
|
||||||
int n2 = nx * ny;
|
int n2 = nx * ny;
|
||||||
|
@ -336,8 +363,7 @@ public class CapeFunc {
|
||||||
double pp1 = pp0;
|
double pp1 = pp0;
|
||||||
double pfin = ptop[i];
|
double pfin = ptop[i];
|
||||||
if (Double.isNaN(pp0) || Double.isNaN(th0[i])
|
if (Double.isNaN(pp0) || Double.isNaN(th0[i])
|
||||||
|| Double.isNaN(sh0[i]) || sh0[i] < 0.0005
|
|| Double.isNaN(sh0[i]) || sh0[i] < 0.0005 || pp0 < pfin) {
|
||||||
|| pp0 < pfin) {
|
|
||||||
tec = tvc = pc = Double.NaN;
|
tec = tvc = pc = Double.NaN;
|
||||||
} else {
|
} else {
|
||||||
double t0 = th0[i] * pow(pp0 / 1000, kapa);
|
double t0 = th0[i] * pow(pp0 / 1000, kapa);
|
||||||
|
@ -580,41 +606,7 @@ public class CapeFunc {
|
||||||
pp1 = pp;
|
pp1 = pp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new CapeCinPair(ny, nx, cap, cin);
|
return new float[][] { cap, cin };
|
||||||
}
|
|
||||||
|
|
||||||
public static class CapeCinPair implements INumpyable {
|
|
||||||
|
|
||||||
private final int nx;
|
|
||||||
|
|
||||||
private final int ny;
|
|
||||||
|
|
||||||
private final float[] cape;
|
|
||||||
|
|
||||||
private final float[] cin;
|
|
||||||
|
|
||||||
public CapeCinPair(int nx, int ny, float[] cape, float[] cin) {
|
|
||||||
this.nx = nx;
|
|
||||||
this.ny = ny;
|
|
||||||
this.cape = cape;
|
|
||||||
this.cin = cin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object[] getNumPy() {
|
|
||||||
return new Object[] { cape, cin };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getNumpyX() {
|
|
||||||
return nx;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getNumpyY() {
|
|
||||||
return ny;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -17,7 +17,7 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.derivparam.python.function;
|
package com.raytheon.uf.common.wxmath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Consolidated constants from various meteolib functions.
|
* Consolidated constants from various meteolib functions.
|
||||||
|
@ -28,7 +28,8 @@ package com.raytheon.uf.viz.derivparam.python.function;
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jun 06, 2013 2043 bsteffen Ported from meteolib C
|
* Jun 06, 2013 2043 bsteffen Ported from meteolib C
|
||||||
|
* Aug 13, 2013 2262 njensen Moved from deriv params
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
|
@ -17,25 +17,23 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.derivparam.python.function;
|
package com.raytheon.uf.common.wxmath;
|
||||||
|
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.AdiabeticTemperature.adiabatic_te;
|
import static com.raytheon.uf.common.wxmath.AdiabeticTemperature.adiabatic_te;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.CalcTw.mytw;
|
import static com.raytheon.uf.common.wxmath.CalcTw.mytw;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c0;
|
import static com.raytheon.uf.common.wxmath.Constants.c0;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c1;
|
import static com.raytheon.uf.common.wxmath.Constants.c1;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c2;
|
import static com.raytheon.uf.common.wxmath.Constants.c2;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c_1;
|
import static com.raytheon.uf.common.wxmath.Constants.c_1;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.c_2;
|
import static com.raytheon.uf.common.wxmath.Constants.c_2;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.kapa;
|
import static com.raytheon.uf.common.wxmath.Constants.kapa;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.Constants.kapa_1;
|
import static com.raytheon.uf.common.wxmath.Constants.kapa_1;
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.TempOfTe.temp_of_te;
|
import static com.raytheon.uf.common.wxmath.TempOfTe.temp_of_te;
|
||||||
import static java.lang.Math.exp;
|
import static java.lang.Math.exp;
|
||||||
import static java.lang.Math.log;
|
import static java.lang.Math.log;
|
||||||
import static java.lang.Math.pow;
|
import static java.lang.Math.pow;
|
||||||
import static java.lang.Math.sqrt;
|
import static java.lang.Math.sqrt;
|
||||||
|
|
||||||
import com.raytheon.uf.common.python.PythonNumpyFloatArray;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We input theta and specific humidity for surface conditions because these are
|
* We input theta and specific humidity for surface conditions because these are
|
||||||
* things that can be arithemitically averaged for a mixed layer. In order for a
|
* things that can be arithemitically averaged for a mixed layer. In order for a
|
||||||
|
@ -65,7 +63,8 @@ import com.raytheon.uf.common.python.PythonNumpyFloatArray;
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jun 05, 2013 2043 bsteffen Ported from meteolib C
|
* Jun 05, 2013 2043 bsteffen Ported from meteolib C
|
||||||
|
* Aug 13, 2013 2262 njensen Moved from deriv params
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -75,9 +74,9 @@ import com.raytheon.uf.common.python.PythonNumpyFloatArray;
|
||||||
|
|
||||||
public class DCapeFunc {
|
public class DCapeFunc {
|
||||||
|
|
||||||
public static PythonNumpyFloatArray dcapeFunc(float usetv, float[] p_dat,
|
public static float[] dcapeFunc(float usetv, float[] p_dat, float[] t_dat,
|
||||||
float[] t_dat, float[] td_dat, float[] p0, float[] th0,
|
float[] td_dat, float[] p0, float[] th0, float[] sh0, int nx,
|
||||||
float[] sh0, int nx, int ny, int nz, float max_evap, float max_rh) {
|
int ny, int nz, float max_evap, float max_rh) {
|
||||||
int n2 = nx * ny;
|
int n2 = nx * ny;
|
||||||
int nzm = nz - 1;
|
int nzm = nz - 1;
|
||||||
|
|
||||||
|
@ -327,8 +326,7 @@ public class DCapeFunc {
|
||||||
pp1 = pp;
|
pp1 = pp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new PythonNumpyFloatArray(dcape, ny, nx);
|
return dcape;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -17,16 +17,12 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.derivparam.python.function;
|
package com.raytheon.uf.common.wxmath;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import jep.INumpyable;
|
|
||||||
|
|
||||||
import com.raytheon.uf.common.python.PythonNumpyFloatArray;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* Ported from dist_filter.c
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
|
@ -35,6 +31,7 @@ import com.raytheon.uf.common.python.PythonNumpyFloatArray;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Aug 10, 2011 rjpeter Initial creation
|
* Aug 10, 2011 rjpeter Initial creation
|
||||||
|
* Aug 13, 2013 2262 njensen Moved from deriv params
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -60,14 +57,14 @@ public class DistFilter {
|
||||||
* @param times
|
* @param times
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static INumpyable filter(float[] input, float npts, int nx, int ny,
|
public static float[] filter(float[] input, float npts, int nx, int ny,
|
||||||
int times) {
|
int times) {
|
||||||
float[] output = new float[input.length];
|
float[] output = new float[input.length];
|
||||||
|
|
||||||
// copy the data if needed
|
// copy the data if needed
|
||||||
if (npts <= 1.0) {
|
if (npts <= 1.0) {
|
||||||
System.arraycopy(input, 0, output, 0, input.length);
|
System.arraycopy(input, 0, output, 0, input.length);
|
||||||
return new PythonNumpyFloatArray(output, nx, ny);
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i, j, ii, jj;
|
int i, j, ii, jj;
|
||||||
|
@ -225,6 +222,6 @@ public class DistFilter {
|
||||||
input = output;
|
input = output;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PythonNumpyFloatArray(output, nx, ny);
|
return output;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,9 +17,9 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.derivparam.python.function;
|
package com.raytheon.uf.common.wxmath;
|
||||||
|
|
||||||
import static com.raytheon.uf.viz.derivparam.python.function.AdiabeticTemperature.adiabatic_te;
|
import static com.raytheon.uf.common.wxmath.AdiabeticTemperature.adiabatic_te;
|
||||||
import static java.lang.Math.sqrt;
|
import static java.lang.Math.sqrt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +32,8 @@ import static java.lang.Math.sqrt;
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jun 3, 2013 2043 bsteffen Ported from meteolib C
|
* Jun 03, 2013 2043 bsteffen Ported from meteolib C
|
||||||
|
* Aug 13, 2013 2262 njensen Moved from deriv params
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
Loading…
Add table
Reference in a new issue