def noUnit(field): """ remove the units from a grid """ import visad from visad import CommonUnit newunit = CommonUnit.promiscuous rt = GridUtil.getParamType(field).getRealComponents()[0] newType = Util.makeRealType(rt.getName(), visad.CommonUnit.promiscuous) return GridUtil.setParamType(field, newType, 0)
def noUnit(field): """ remove the units from a grid """ import visad from visad import CommonUnit newunit = CommonUnit.promiscuous rt = GridUtil.getParamType(field).getRealComponents()[0] newType = Util.makeRealType(rt.getName(), visad.CommonUnit.promiscuous) return GridUtil.setParamType(field, newType,0)
def getAltitude(z): """ Change units from geopotential meters to meters """ import ucar.visad.quantities.GeopotentialAltitude as ga import ucar.visad.quantities.Gravity as gr zUnit = GridUtil.getParamType(z).getRealComponents()[0].getDefaultUnit() if zUnit.equals(ga.getGeopotentialMeter()): z = z.divide(gr.newReal()) return z