mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
update contour imshow functions
This commit is contained in:
parent
9460a1ca77
commit
153476bb93
@ -3443,6 +3443,15 @@ public class GraphicFactory {
|
||||
xa = xa.copyIfView();
|
||||
ya = ya.copyIfView();
|
||||
|
||||
if (xa.getDouble(1) - xa.getDouble(0) < 0) {
|
||||
xa = xa.flip(0);
|
||||
data = data.flip(1);
|
||||
}
|
||||
if (ya.getDouble(1) - ya.getDouble(0) < 0) {
|
||||
ya = ya.flip(0);
|
||||
data = data.flip(0);
|
||||
}
|
||||
|
||||
int width, height, breakNum;
|
||||
width = (int) xa.getSize();
|
||||
height = (int) ya.getSize();
|
||||
@ -5356,7 +5365,7 @@ public class GraphicFactory {
|
||||
List<wcontour.global.Polygon> contourPolygons = ContourDraw.tracingPolygons(data, contourLines, borders, cValues);
|
||||
|
||||
double v, min, max;
|
||||
ColorBreak cbb = ls.findLegendBreak(0);
|
||||
ColorBreak cbb = ls.getLegendBreak(0);
|
||||
ExtendType extendType = ls.getExtendType();
|
||||
GraphicCollection graphics = new GraphicCollection();
|
||||
for (int i = 0; i < contourPolygons.size(); i++) {
|
||||
@ -5467,6 +5476,7 @@ public class GraphicFactory {
|
||||
}
|
||||
|
||||
v = aPolygonShape.lowValue;
|
||||
cbb = ls.getLegendBreak(0);
|
||||
switch (ls.getLegendType()) {
|
||||
case UNIQUE_VALUE:
|
||||
for (int j = 0; j < ls.getBreakNum(); j++) {
|
||||
@ -5482,10 +5492,10 @@ public class GraphicFactory {
|
||||
for (int j = 0; j < ls.getBreakNum(); j++) {
|
||||
ColorBreak cb = ls.getLegendBreaks().get(j);
|
||||
blNum += 1;
|
||||
if (MIMath.doubleEquals(v, Double.parseDouble(cb.getStartValue().toString()))
|
||||
|| (v > Double.parseDouble(cb.getStartValue().toString())
|
||||
&& v < Double.parseDouble(cb.getEndValue().toString()))
|
||||
|| (blNum == ls.getBreakNum() && v == Double.parseDouble(cb.getEndValue().toString()))) {
|
||||
if ((blNum == 1 && v <= cb.getStartDoubleValue())
|
||||
|| (v >= cb.getStartDoubleValue()
|
||||
&& v < cb.getEndDoubleValue())
|
||||
|| (blNum == ls.getBreakNum() && v >= cb.getEndDoubleValue())) {
|
||||
cbb = cb;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -36,7 +36,14 @@ public class MIMath {
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean doubleEquals(double a, double b) {
|
||||
return doubleEquals(a, b, 0.0000001);
|
||||
double epsilon = 1.0e-6;
|
||||
if (epsilon >= Math.abs(a)) {
|
||||
epsilon = Math.abs(a) * 1e-2;
|
||||
}
|
||||
if (epsilon >= Math.abs(b)) {
|
||||
epsilon = Math.abs(b) * 1e-2;
|
||||
}
|
||||
return doubleEquals(a, b, epsilon);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -69,7 +69,7 @@ import java.util.zip.ZipInputStream;
|
||||
public static String getVersion() {
|
||||
String version = GlobalUtil.class.getPackage().getImplementationVersion();
|
||||
if (version == null || version.equals("")) {
|
||||
version = "4.1.4";
|
||||
version = "4.1.5";
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
@ -83,6 +83,18 @@ package org.meteoinfo.geometry.legend;
|
||||
return startValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get start double value
|
||||
* @return Start double value
|
||||
*/
|
||||
public double getStartDoubleValue() {
|
||||
if (startValue instanceof Double) {
|
||||
return (double) startValue;
|
||||
} else {
|
||||
return Double.valueOf(startValue.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set start value
|
||||
*
|
||||
@ -101,6 +113,18 @@ package org.meteoinfo.geometry.legend;
|
||||
return endValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get end double value
|
||||
* @return end double value
|
||||
*/
|
||||
public double getEndDoubleValue() {
|
||||
if (endValue instanceof Double) {
|
||||
return (double) endValue;
|
||||
} else {
|
||||
return Double.valueOf(endValue.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set end value
|
||||
*
|
||||
|
||||
@ -1,30 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\io\burf">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\hdf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\json"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\matlab"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\micaps"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\radar"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\netcdf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\grads"/>
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\meteo">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\dataframe"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\traj"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\stats"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\test"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\burf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\stats"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\netcdf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite\himawari"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo\calc"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\contour"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo"/>
|
||||
</Path>
|
||||
<File>
|
||||
<OpenedFiles>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\netcdf\sht_coords.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\burf\bufr_cma_rsd.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\meteo\water_vapor_flux_digv_3.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\io\netcdf\sht_coords.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\io\burf\bufr_cma_rsd.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\meteo\water_vapor_flux_digv_3.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
|
||||
Binary file not shown.
@ -117,7 +117,7 @@ def where(condition, *args):
|
||||
y = asarray(y)
|
||||
x, y = broadcast_arrays(x, y)
|
||||
r = ArrayUtil.where(condition._array, x._array, y._array)
|
||||
return NDArray(r)
|
||||
return condition.array_wrap(r)
|
||||
|
||||
|
||||
def searchsorted(a, v, side='left', sorter=None):
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="config.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Temp\grads"/>
|
||||
<Path OpenPath="D:\Temp\nc"/>
|
||||
<Font>
|
||||
<TextFont FontName="YaHei Consolas Hybrid" FontSize="14"/>
|
||||
<LegendFont FontName="宋体" FontSize="12"/>
|
||||
|
||||
@ -3022,6 +3022,8 @@ public class ArrayUtil {
|
||||
if (!cType.isArray()) {
|
||||
if (cType == long.class) {
|
||||
copyTo1DJavaArray_Long(aaIter, jArray);
|
||||
} else if (cType == double.class) {
|
||||
copyTo1DJavaArray_Double(aaIter, jArray);
|
||||
} else {
|
||||
copyTo1DJavaArray(aaIter, jArray);
|
||||
}
|
||||
@ -3039,6 +3041,8 @@ public class ArrayUtil {
|
||||
if (!cType.isArray()) {
|
||||
if (cType == long.class) {
|
||||
copyTo1DJavaArray_Long(aaIter, jArray);
|
||||
} else if (cType == double.class){
|
||||
copyTo1DJavaArray_Double(aaIter, jArray, missingValue);
|
||||
} else {
|
||||
copyTo1DJavaArray(aaIter, jArray, missingValue);
|
||||
}
|
||||
@ -3073,6 +3077,25 @@ public class ArrayUtil {
|
||||
}
|
||||
}
|
||||
|
||||
protected static void copyTo1DJavaArray_Double(IndexIterator iter, Object javaArray) {
|
||||
double[] ja = (double[]) javaArray;
|
||||
for (int i = 0; i < ja.length; i++) {
|
||||
ja[i] = iter.getDoubleNext();
|
||||
}
|
||||
}
|
||||
|
||||
protected static void copyTo1DJavaArray_Double(IndexIterator iter, Object javaArray, double missingValue) {
|
||||
double[] ja = (double[]) javaArray;
|
||||
double v;
|
||||
for (int i = 0; i < ja.length; i++) {
|
||||
v = iter.getDoubleNext();
|
||||
if (Double.isNaN(v)) {
|
||||
v = missingValue;
|
||||
}
|
||||
ja[i] = v;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new array with sub-arrays along an axis deleted
|
||||
*
|
||||
|
||||
2
pom.xml
2
pom.xml
@ -39,7 +39,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<revision>4.1.4</revision>
|
||||
<revision>4.1.5</revision>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<maven.compiler.release>8</maven.compiler.release>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user