mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
add makemarkers function
This commit is contained in:
parent
b2605f4f08
commit
1774654fdd
@ -52,43 +52,46 @@
|
|||||||
<groupId>edu.ucar</groupId>
|
<groupId>edu.ucar</groupId>
|
||||||
<artifactId>cdm-core</artifactId>
|
<artifactId>cdm-core</artifactId>
|
||||||
<version>${netcdf.version}</version>
|
<version>${netcdf.version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>edu.ucar</groupId>
|
<groupId>edu.ucar</groupId>
|
||||||
<artifactId>bufr</artifactId>
|
<artifactId>bufr</artifactId>
|
||||||
<version>${netcdf.version}</version>
|
<version>${netcdf.version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>edu.ucar</groupId>
|
<groupId>edu.ucar</groupId>
|
||||||
<artifactId>cdm-image</artifactId>
|
<artifactId>cdm-image</artifactId>
|
||||||
<version>${netcdf.version}</version>
|
<version>${netcdf.version}</version>
|
||||||
<scope>compile</scope>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>edu.ucar</groupId>
|
||||||
|
<artifactId>cdm-misc</artifactId>
|
||||||
|
<version>${netcdf.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>edu.ucar</groupId>
|
||||||
|
<artifactId>cdm-radial</artifactId>
|
||||||
|
<version>${netcdf.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>edu.ucar</groupId>
|
<groupId>edu.ucar</groupId>
|
||||||
<artifactId>grib</artifactId>
|
<artifactId>grib</artifactId>
|
||||||
<version>${netcdf.version}</version>
|
<version>${netcdf.version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>edu.ucar</groupId>
|
<groupId>edu.ucar</groupId>
|
||||||
<artifactId>netcdf4</artifactId>
|
<artifactId>netcdf4</artifactId>
|
||||||
<version>${netcdf.version}</version>
|
<version>${netcdf.version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>edu.ucar</groupId>
|
<groupId>edu.ucar</groupId>
|
||||||
<artifactId>opendap</artifactId>
|
<artifactId>opendap</artifactId>
|
||||||
<version>${netcdf.version}</version>
|
<version>${netcdf.version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>edu.ucar</groupId>
|
<groupId>edu.ucar</groupId>
|
||||||
<artifactId>cdm-mcidas</artifactId>
|
<artifactId>cdm-mcidas</artifactId>
|
||||||
<version>${netcdf.version}</version>
|
<version>${netcdf.version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.albfernandez</groupId>
|
<groupId>com.github.albfernandez</groupId>
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
||||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\gui">
|
<Path OpenPath="D:\Working\MIScript\Jython\mis\traj">
|
||||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\error"/>
|
|
||||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
|
<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\plot_types\contour"/>
|
||||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\plot"/>
|
|
||||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\geotiff"/>
|
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\geotiff"/>
|
||||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\grads"/>
|
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\grads"/>
|
||||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\burf"/>
|
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\burf"/>
|
||||||
@ -14,15 +12,21 @@
|
|||||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\radar"/>
|
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\radar"/>
|
||||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite\modis"/>
|
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite\modis"/>
|
||||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite"/>
|
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite"/>
|
||||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
|
||||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\gui"/>
|
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\gui"/>
|
||||||
|
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||||
|
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\plot"/>
|
||||||
|
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\traj"/>
|
||||||
</Path>
|
</Path>
|
||||||
<File>
|
<File>
|
||||||
<OpenedFiles>
|
<OpenedFiles>
|
||||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\plot\plot_cdata_3.py"/>
|
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\plot\plot_cdata_3.py"/>
|
||||||
|
<OpenedFile File="D:\Working\MIScript\Jython\mis\traj\plot_traj.py"/>
|
||||||
|
<OpenedFile File="D:\Working\MIScript\Jython\mis\traj\plot_traj_bd.py"/>
|
||||||
</OpenedFiles>
|
</OpenedFiles>
|
||||||
<RecentFiles>
|
<RecentFiles>
|
||||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\plot\plot_cdata_3.py"/>
|
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\plot\plot_cdata_3.py"/>
|
||||||
|
<RecentFile File="D:\Working\MIScript\Jython\mis\traj\plot_traj.py"/>
|
||||||
|
<RecentFile File="D:\Working\MIScript\Jython\mis\traj\plot_traj_bd.py"/>
|
||||||
</RecentFiles>
|
</RecentFiles>
|
||||||
</File>
|
</File>
|
||||||
<Font>
|
<Font>
|
||||||
|
|||||||
Binary file not shown.
@ -44,7 +44,7 @@ __all__ = [
|
|||||||
'errorbar', 'figure', 'glfigure', 'figsize', 'patch', 'rectangle', 'fill', 'fill3', 'fill_between',
|
'errorbar', 'figure', 'glfigure', 'figsize', 'patch', 'rectangle', 'fill', 'fill3', 'fill_between',
|
||||||
'fill_betweenx', 'fimplicit3', 'webmap', 'gca', 'gcf', 'gc_collect', 'geoshow', 'get_figure',
|
'fill_betweenx', 'fimplicit3', 'webmap', 'gca', 'gcf', 'gc_collect', 'geoshow', 'get_figure',
|
||||||
'gifaddframe', 'gifanimation', 'giffinish', 'grid', 'gridshow', 'gridshowm', 'hist', 'imshow',
|
'gifaddframe', 'gifanimation', 'giffinish', 'grid', 'gridshow', 'gridshowm', 'hist', 'imshow',
|
||||||
'imshowm', 'isosurface', 'legend', 'left_title', 'lighting', 'loglog', 'makecolors', 'makelegend',
|
'imshowm', 'isosurface', 'legend', 'left_title', 'lighting', 'loglog', 'makecolors', 'makelegend','makemarkers',
|
||||||
'makesymbolspec', 'masklayer', 'material', 'mesh', 'meshc', 'model', 'particles', 'pcolor', 'pcolorm',
|
'makesymbolspec', 'masklayer', 'material', 'mesh', 'meshc', 'model', 'particles', 'pcolor', 'pcolorm',
|
||||||
'pie', 'plot', 'plot3', 'plotm', 'quiver', 'quiver3', 'quiverkey', 'quiverm', 'readlegend',
|
'pie', 'plot', 'plot3', 'plotm', 'quiver', 'quiver3', 'quiverkey', 'quiverm', 'readlegend',
|
||||||
'right_title', 'refresh', 'savefig', 'savefig_jpeg', 'scatter', 'scatter3', 'scatterm', 'semilogx',
|
'right_title', 'refresh', 'savefig', 'savefig_jpeg', 'scatter', 'scatter3', 'scatterm', 'semilogx',
|
||||||
@ -2215,6 +2215,11 @@ def makecolors(n, cmap='matlab_jet', reverse=False, alpha=None, start=None, stop
|
|||||||
return plotutil.makecolors(n, cmap, reverse, alpha, start, stop)
|
return plotutil.makecolors(n, cmap, reverse, alpha, start, stop)
|
||||||
|
|
||||||
|
|
||||||
|
@_copy_docstring_and_deprecators(plotutil.makemarkers)
|
||||||
|
def makemarkers(n):
|
||||||
|
return plotutil.makemarkers(n)
|
||||||
|
|
||||||
|
|
||||||
@_copy_docstring_and_deprecators(plotutil.makelegend)
|
@_copy_docstring_and_deprecators(plotutil.makelegend)
|
||||||
def makelegend(source, **kwargs):
|
def makelegend(source, **kwargs):
|
||||||
return plotutil.makelegend(source, **kwargs)
|
return plotutil.makelegend(source, **kwargs)
|
||||||
|
|||||||
Binary file not shown.
@ -283,6 +283,8 @@ def makecolors(n, cmap='matlab_jet', reverse=False, alpha=None, start=None, stop
|
|||||||
def getpointstyle(style):
|
def getpointstyle(style):
|
||||||
if style is None:
|
if style is None:
|
||||||
return None
|
return None
|
||||||
|
elif isinstance(style, PointStyle):
|
||||||
|
return style
|
||||||
|
|
||||||
pointStyle = None
|
pointStyle = None
|
||||||
if 'do' in style:
|
if 'do' in style:
|
||||||
@ -367,6 +369,24 @@ def gethatch(h):
|
|||||||
return HatchStyle.getStyle(h)
|
return HatchStyle.getStyle(h)
|
||||||
|
|
||||||
|
|
||||||
|
def makemarkers(n):
|
||||||
|
"""
|
||||||
|
Make markers.
|
||||||
|
|
||||||
|
:param n: (*int*) The number of markers.
|
||||||
|
|
||||||
|
:return: (*list of markers*) The markers.
|
||||||
|
"""
|
||||||
|
markers = []
|
||||||
|
i = 0
|
||||||
|
for _ in range(n):
|
||||||
|
if i == len(PointStyle.values()):
|
||||||
|
i = 0
|
||||||
|
markers.append(PointStyle.values()[i])
|
||||||
|
i += 1
|
||||||
|
return markers
|
||||||
|
|
||||||
|
|
||||||
def getmarkerplotstyle(style, caption, **kwargs):
|
def getmarkerplotstyle(style, caption, **kwargs):
|
||||||
c, style = getcolor_style(style)
|
c, style = getcolor_style(style)
|
||||||
if kwargs.has_key('color'):
|
if kwargs.has_key('color'):
|
||||||
@ -502,13 +522,35 @@ def getlegendbreaks(lb, **kwargs):
|
|||||||
if cmap is not None:
|
if cmap is not None:
|
||||||
colors = makecolors(ncolors, cmap=cmap)
|
colors = makecolors(ncolors, cmap=cmap)
|
||||||
|
|
||||||
if colors is not None:
|
if isinstance(lb, PolylineBreak):
|
||||||
n = len(colors)
|
if colors is not None:
|
||||||
colors = getcolors(colors)
|
n = len(colors)
|
||||||
for cc in colors:
|
colors = getcolors(colors)
|
||||||
nlb = lb.clone()
|
markers = kwargs.pop('markers', None)
|
||||||
nlb.setColor(cc)
|
if markers is None:
|
||||||
lbs.append(nlb)
|
for cc in colors:
|
||||||
|
nlb = lb.clone()
|
||||||
|
nlb.setColor(cc)
|
||||||
|
nlb.setSymbolColor(cc)
|
||||||
|
nlb.setSymbolFillColor(cc)
|
||||||
|
lbs.append(nlb)
|
||||||
|
else:
|
||||||
|
for cc, marker in zip(colors, markers):
|
||||||
|
nlb = lb.clone()
|
||||||
|
nlb.setColor(cc)
|
||||||
|
nlb.setDrawSymbol(True)
|
||||||
|
nlb.setSymbolStyle(getpointstyle(marker))
|
||||||
|
nlb.setSymbolColor(cc)
|
||||||
|
nlb.setSymbolFillColor(cc)
|
||||||
|
lbs.append(nlb)
|
||||||
|
else:
|
||||||
|
if colors is not None:
|
||||||
|
n = len(colors)
|
||||||
|
colors = getcolors(colors)
|
||||||
|
for cc in colors:
|
||||||
|
nlb = lb.clone()
|
||||||
|
nlb.setColor(cc)
|
||||||
|
lbs.append(nlb)
|
||||||
|
|
||||||
if len(lbs) == 0:
|
if len(lbs) == 0:
|
||||||
return lb
|
return lb
|
||||||
@ -587,20 +629,20 @@ def getlegendbreak(geometry, **kwargs):
|
|||||||
pstyle = getpointstyle(marker)
|
pstyle = getpointstyle(marker)
|
||||||
lb.setDrawSymbol(True)
|
lb.setDrawSymbol(True)
|
||||||
lb.setSymbolStyle(pstyle)
|
lb.setSymbolStyle(pstyle)
|
||||||
markersize = kwargs.pop('markersize', None)
|
markersize = kwargs.pop('markersize', None)
|
||||||
if not markersize is None:
|
if not markersize is None:
|
||||||
lb.setSymbolSize(markersize)
|
lb.setSymbolSize(markersize)
|
||||||
markercolor = kwargs.pop('markeredgecolor', lb.getColor())
|
markercolor = kwargs.pop('markeredgecolor', lb.getColor())
|
||||||
markercolor = getcolor(markercolor)
|
markercolor = getcolor(markercolor)
|
||||||
lb.setSymbolColor(markercolor)
|
lb.setSymbolColor(markercolor)
|
||||||
fillcolor = kwargs.pop('markerfacecolor', lb.getColor())
|
fillcolor = kwargs.pop('markerfacecolor', lb.getColor())
|
||||||
if not fillcolor is None:
|
if not fillcolor is None:
|
||||||
lb.setFillSymbol(True)
|
lb.setFillSymbol(True)
|
||||||
lb.setSymbolFillColor(getcolor(fillcolor))
|
lb.setSymbolFillColor(getcolor(fillcolor))
|
||||||
else:
|
else:
|
||||||
lb.setSymbolFillColor(markercolor)
|
lb.setSymbolFillColor(markercolor)
|
||||||
interval = kwargs.pop('markerinterval', 1)
|
interval = kwargs.pop('markerinterval', 1)
|
||||||
lb.setSymbolInterval(interval)
|
lb.setSymbolInterval(interval)
|
||||||
elif geometry == 'polygon':
|
elif geometry == 'polygon':
|
||||||
lb = PolygonBreak()
|
lb = PolygonBreak()
|
||||||
edge = True
|
edge = True
|
||||||
|
|||||||
@ -1954,9 +1954,9 @@ public class FrmMain extends JFrame implements IApplication {
|
|||||||
double projX = pXY[0];
|
double projX = pXY[0];
|
||||||
double projY = pXY[1];
|
double projY = pXY[1];
|
||||||
if (_mapDocument.getActiveMapFrame().getMapView().getProjection().isLonLatMap()) {
|
if (_mapDocument.getActiveMapFrame().getMapView().getProjection().isLonLatMap()) {
|
||||||
this.jLabel_Coordinate.setText("Lon: " + String.format("%1$.2f", projX) + "; Lat: " + String.format("%1$.2f", projY));
|
this.jLabel_Coordinate.setText("Lon: " + String.format("%.2f", projX) + "; Lat: " + String.format("%.2f", projY));
|
||||||
} else {
|
} else {
|
||||||
this.jLabel_Coordinate.setText("X: " + String.format("%1$.1f", projX) + "; Y: " + String.format("%1$.1f", projY));
|
this.jLabel_Coordinate.setText("X: " + String.format("%.1f", projX) + "; Y: " + String.format("%.1f", projY));
|
||||||
String theText = this.jLabel_Coordinate.getText();
|
String theText = this.jLabel_Coordinate.getText();
|
||||||
if (_mapDocument.getActiveMapFrame().getMapView().getProjection().getProjInfo().getProjectionName() == ProjectionNames.Robinson) {
|
if (_mapDocument.getActiveMapFrame().getMapView().getProjection().getProjInfo().getProjectionName() == ProjectionNames.Robinson) {
|
||||||
return;
|
return;
|
||||||
@ -1968,8 +1968,8 @@ public class FrmMain extends JFrame implements IApplication {
|
|||||||
points[0] = new double[]{projX, projY};
|
points[0] = new double[]{projX, projY};
|
||||||
try {
|
try {
|
||||||
Reproject.reprojectPoints(points, fromProj, toProj, 0, 1);
|
Reproject.reprojectPoints(points, fromProj, toProj, 0, 1);
|
||||||
this.jLabel_Coordinate.setText(theText + " (Lon: " + String.format("%1$.2f", points[0][0]) + "; Lat: "
|
this.jLabel_Coordinate.setText(theText + " (Lon: " + String.format("%.2f", points[0][0]) + "; Lat: "
|
||||||
+ String.format("%1$.2f", points[0][1]) + ")");
|
+ String.format("%.2f", points[0][1]) + ")");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user