This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
> > > > #def STPBWD(BWD): > > """compute STP ortion of BWD from speed875 and speed1000""" > > STPBWD= (make2D(BWD/20)) > > if STPBWD> 30: > > STPBWD= 1.5 > > #elif STPBWD< 12.5: > > #STPBWD= 0.0 > > else: > > STPBWD=STPBWD > > return STPBWD > Hi Michelle, I think I know what you were trying here. For the variable STPBWD, you want to replace everything larger than 30 with 1.5, and everything smaller than 12.5 with 0. In the Jython, you can not do the assignment like STPBWD= 1.5 But, we do have a formula call substitute(data, low, high, newValue), you can use this to do the job. substitute(STPBWD, -10000, 12.5, 0) and substitute(STPBWD, 30, 10000, 1.5) This should work. Yuan Ticket Details =================== Ticket ID: JUN-901571 Department: Support IDV Priority: Normal Status: Open =================== NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.