コード例 #1
0
ファイル: jythonrc.py プロジェクト: suvarchal/JyIDV
def showImgWithFullWindow(width=None,height=None):
    """ This function shows the image from current IDV window while in GUI mode. optional arguments are width and height in pixels, they
    currently default to 600 and 400"""
    from java.util import Base64 ##only in java8
    from javax.imageio import ImageIO
    from java.io import ByteArrayOutputStream
    from ucar.unidata.ui.ImageUtils import resize,toBufferedImage
    import java
    import java.awt.Robot as Robot
    import java.awt.Rectangle as Rectangle
    import java.awt.Toolkit as Toolkit
    from ucar.unidata.util import Misc
    VM=idv.getViewManager()
    myframe=VM.getDisplayWindow().getComponent()
    robotx = Robot(myframe.getGraphicsConfiguration().getDevice())
    VM.toFront();
    #robotx.delay(250)
    Misc.sleep(350)
    pause()
    img=robotx.createScreenCapture(Rectangle( myframe.getX(),myframe.getY(),myframe.getWidth(),myframe.getHeight()))
    if width != None and height != None:
        img=toBufferedImage(resize(img,width,height));
    bos=ByteArrayOutputStream();
    ImageIO.write(img, "png", Base64.getEncoder().wrap(bos));
    data = bos.toString("UTF-8");
    return {"display":"image","data":data}
コード例 #2
0
def showImgWithFullWindow(width=None, height=None):
    """ This function shows the image from current IDV window while in GUI mode. optional arguments are width and height in pixels, they
    currently default to 600 and 400"""
    from java.util import Base64  ##only in java8
    from javax.imageio import ImageIO
    from java.io import ByteArrayOutputStream
    from ucar.unidata.ui.ImageUtils import resize, toBufferedImage
    import java
    import java.awt.Robot as Robot
    import java.awt.Rectangle as Rectangle
    import java.awt.Toolkit as Toolkit
    from ucar.unidata.util import Misc
    VM = idv.getViewManager()
    myframe = VM.getDisplayWindow().getComponent()
    robotx = Robot(myframe.getGraphicsConfiguration().getDevice())
    VM.toFront()
    #robotx.delay(250)
    Misc.sleep(350)
    pause()
    img = robotx.createScreenCapture(
        Rectangle(myframe.getX(), myframe.getY(), myframe.getWidth(),
                  myframe.getHeight()))
    if width != None and height != None:
        img = toBufferedImage(resize(img, width, height))
    bos = ByteArrayOutputStream()
    ImageIO.write(img, "png",
                  Base64.getEncoder().wrap(bos))
    data = bos.toString("UTF-8")
    return {"display": "image", "data": data}
コード例 #3
0
ファイル: jythonrc.py プロジェクト: suvarchal/JyIDV
def showImgWithLegend(width=None,height=None):
    """ This function shows the image and legend from current IDV window while in GUI mode. Optional arguments are width and height in pixels, they currently default to 600 and 400"""
    from java.util import Base64 ##only in java8
    from javax.imageio import ImageIO
    from java.io import ByteArrayOutputStream
    from ucar.unidata.ui.ImageUtils import resize,toBufferedImage
    import java
    import java.awt.Robot as Robot
    import java.awt.Rectangle as Rectangle
    import java.awt.Toolkit as Toolkit
    from ucar.unidata.util import Misc
    VM=idv.getViewManager()
    VMC=VM.getContents()
    VMCC=VMC.getComponent(1) # the view and legend ; 0 is left most part of view window with controls for perspective views
    siz=VMCC.getSize()
    loc= VMCC.getLocationOnScreen()
    gc= VMCC.getGraphicsConfiguration()
    loc.x -= gc.getBounds().x
    loc.y -= gc.getBounds().y
    robotx=Robot(gc.getDevice())
    VM.toFront()
    Misc.sleep(250)
    img = robotx.createScreenCapture(Rectangle(loc.x, loc.y,siz.width, siz.height))
    if width != None and height != None:
        img=toBufferedImage(resize(img,width,height));
    bos=ByteArrayOutputStream();
    ImageIO.write(img, "png", Base64.getEncoder().wrap(bos));
    data = bos.toString("UTF-8");
    return {"display":"image","data":data}
コード例 #4
0
def showImgWithLegend(width=None, height=None):
    """ This function shows the image and legend from current IDV window while in GUI mode. Optional arguments are width and height in pixels, they currently default to 600 and 400"""
    from java.util import Base64  ##only in java8
    from javax.imageio import ImageIO
    from java.io import ByteArrayOutputStream
    from ucar.unidata.ui.ImageUtils import resize, toBufferedImage
    import java
    import java.awt.Robot as Robot
    import java.awt.Rectangle as Rectangle
    import java.awt.Toolkit as Toolkit
    from ucar.unidata.util import Misc
    VM = idv.getViewManager()
    VMC = VM.getContents()
    VMCC = VMC.getComponent(
        1
    )  # the view and legend ; 0 is left most part of view window with controls for perspective views
    siz = VMCC.getSize()
    loc = VMCC.getLocationOnScreen()
    gc = VMCC.getGraphicsConfiguration()
    loc.x -= gc.getBounds().x
    loc.y -= gc.getBounds().y
    robotx = Robot(gc.getDevice())
    VM.toFront()
    Misc.sleep(250)
    img = robotx.createScreenCapture(
        Rectangle(loc.x, loc.y, siz.width, siz.height))
    if width != None and height != None:
        img = toBufferedImage(resize(img, width, height))
    bos = ByteArrayOutputStream()
    ImageIO.write(img, "png",
                  Base64.getEncoder().wrap(bos))
    data = bos.toString("UTF-8")
    return {"display": "image", "data": data}
コード例 #5
0
def wgt_runave(grid, wgts, option=0):
    """generate a weighted running average:
    <div class=jython>
    Where:<br>
          grid = grid to average<br>
          wgts - comma separated list of weights<br>
          option - option for unsmoothed end points<br>
                   0 - set to missing<br>
                   1 - use symmetry<br>
                  -1 - assume cyclic <br>
    </div>
    """
    from ucar.unidata.util import Misc
    weights = Misc.parseFloats(wgts)
    opt = int(option)
    return GridMath.timeWeightedRunningAverage(grid, weights, opt)
コード例 #6
0
ファイル: grid.py プロジェクト: davep-ssec/mcidasv
def wgt_runave(grid, wgts, option=0):
    """generate a weighted running average:
    <div class=jython>
    Where:<br>
          grid = grid to average<br>
          wgts - comma separated list of weights<br>
          option - option for unsmoothed end points<br>
                   0 - set to missing<br>
                   1 - use symmetry<br>
                  -1 - assume cyclic <br>
    </div>
    """
    from ucar.unidata.util import Misc
    weights = Misc.parseFloats(wgts)
    opt = int(option)
    return GridMath.timeWeightedRunningAverage(grid,weights,opt)
コード例 #7
0
def pauseEvery(value):
    Misc.pauseEvery(60 * value)
コード例 #8
0
def pauseHours(value):
    Misc.sleep(60.0 * 60.0 * 1000.0 * value)
コード例 #9
0
def pauseMinutes(value):
    Misc.sleep(60.0 * 1000.0 * value)
コード例 #10
0
def pauseSeconds(value):
    Misc.sleep(1000.0 * value)
コード例 #11
0
ファイル: isl.py プロジェクト: TimO-CIMSS/mcidasv
def pauseEvery(value):
    Misc.pauseEvery(60 * value)
コード例 #12
0
ファイル: isl.py プロジェクト: TimO-CIMSS/mcidasv
def pauseHours(value):
    Misc.sleep(60.0 * 60.0 * 1000.0 * value)
コード例 #13
0
ファイル: isl.py プロジェクト: TimO-CIMSS/mcidasv
def pauseMinutes(value):
    Misc.sleep(60.0 * 1000.0 * value)
コード例 #14
0
ファイル: isl.py プロジェクト: TimO-CIMSS/mcidasv
def pauseSeconds(value):
    Misc.sleep(1000.0 * value)