>
> My requirement is very simple, but there's something fishy. I have a variable
> of the following summary
>
> ==========================================================================
> Variable: p_seas
> Type: float
> Total Size: 14400 bytes
> 3600 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 6] x [latitude | 20] x [longitude | 30]
> Coordinates:
> time: [ 0.. 151]
> latitude: [-20.93000030517578..32.09199905395508]
> longitude: [39.375..120.9375]
> Number Of Attributes: 8
> ==========================================================================
>
> I am trying to scale the variable by a factor (say multiply by 100). Can I
> simply multiply it at the time of plotting?
>
> plot = gsn_csm_contour_map_ce(wks,p_seas(0,:,:)*100,res)
> ------------------------------------------------^^^----
>
> I tried this, but somehow, I feel the coordinates are also getting scaled up.
> Is this normal? How can I get rid of this problem?
----------------------------------------------------
The gsn_csm* plot interfaces use the meta data associated with a variable
to plot the data correctly. Consider:
[1] printVarSummary(pseas)
print("min(pseas)="+min(pseas)+" max(pseas)="+max(pseas))
p_seas = pseas*100
;pseas_at_units = pseas_at_units + "*100"
printVarSummary(pseas)
print("min(pseas)="+min(pseas)+" max(pseas)="+max(pseas))
The original pseas had meta data. The multiplication by 100
just affects the values. The meta data ssociated with pseas
is retained unaltered. If pseas had a units attribute, then
it would be the users responsibility to change the meta data.
[2] y = pseas*100
printVarSummary(y)
print("min(y)="+min(y)+" max(y)="+max(y))
Note: *no* meta data.
Here "y" is being created but not meta data is transferred
to the new variable.
Basically, if the right hand side contains an *expression*
no meta data is transferred.
What is happening with
plot = gsn_csm_contour_map_ce(wks,p_seas(0,:,:)*100,res)
is that NCL creates a temporary variable that is a result of
an expression so no meta data is passed to the gsn_cm function.
Think:
plot = gsn_csm_contour_map_ce(wks, y ,res)
[3] simple solution
PSEAS = p_seas(0,:,:) ; This is *not* an expression
; It is a straight variable-to-variable transfer
printVarSummary(PSEAS) ; note carefully the meta data [info only]
PSEAS = PSEAS*100 ; PSEAS will retain its metadata
plot = gsn_csm_contour_map_ce(wks, PSEAS ,res)
good luck
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Nov 29 2005 - 07:28:13 MST
This archive was generated by hypermail 2.2.0 : Tue Nov 29 2005 - 07:37:38 MST