Post
Hi,
I ran into this problem again with the current problem: unit looks to be changed from kelvin to celsius, but the values are not. I was wondering if this is fixed, or am I writing this code incorrectly. If it is still broken within McV, could it be fixed or temporarily issue a warning message to the user so that they are reminded that newUnit is not working correctly. Below are two pathways I tried, neither worked. In the end, I chose to convert the unit using irTemp - 273.15, and not change the unit officially. In that case, I also chose to leave the unit label off the color table.
Joleen
Code: Select all
panel=buildWindow(height=480, width=854)
panel[0].setUseProjectionFromData(True)
day='2017/09/08'
time1='17:00'
time2='17:00:30'
descriptor='M1'
listADDE=dict(
server='satbuf1.ssec.wisc.edu',
dataset='GOES16A',
descriptor=descriptor,
time=(time1,time2),
day=day,
band=14,
position='ALL'
)
imageList=listADDEImageTimes(**listADDE)
loadADDE=dict(
server=listADDE['server'],
dataset=listADDE['dataset'],
descriptor=listADDE['descriptor'],
size='ALL'
)
for i,dateTime in enumerate(imageList):
loadADDE['day']=dateTime['day']
loadADDE['time']=dateTime['time']
ir=loadADDEImage(band=14,unit='Temperature',**loadADDE)
thisField=getRangeType(ir)
newIR =newUnit(ir,thisField.toString(),'degC')
print whatType(ir)
print whatType(newIR)
irLayer1=panel[0].createLayer('Image Display', newIR)
irLayer2=panel[0].createLayer('Image Display', ir)
In fact, newUnit seems to adjust back to some kelvin values?
ir=loadADDEImage(band=14,unit='Temperature',**loadADDE)
thisField=getRangeType(ir)
newIR=ir.clone()
newIR = newIR - 273.15
newIR2 =newUnit(newIR,thisField.toString(),'degC')
l1=activeDisplay().createLayer('Image Display', ir)
l2=activeDisplay().createLayer('Image Display', newIR)
l3=activeDisplay().createLayer('Image Display', newIR2)
l1.setLegendLabel('IR')
l2.setLegendLabel('newIR')
l3.setLegendLabel('newIR2')
Thanks,
Joleen