Re: Global difference maps

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Mar 01 2011 - 08:41:10 MST

Madeleine,

The problem is that you are trying to plot "diff_tref_avgd" over a map, and this variable is dimensioned year x lat, according to the printVarSummary output. It needs to be dimensioned lat x lon. There may be a problem somewhere else in your script, but I can't tell just from looking at it.

I would suggest putting in some more printVarSummary statements to debug the variables as you do various calculations. Perhaps somewhere along the line the calculation is being done on the wrong variable, or the variable's dimensions are not in the correct order.

For example, after you read tref_mod1_all and tref_mod2_all off the files, add:

printVarSummary(tref_mod1_all)
printVarSummary(tref_mod2_all)

After you call month_to_annual, do the same for those variables:

printVarSummary(tref_mod1_annmean)
printVarSummary(tref_mod2_annmean)

and so on.

Please read the month_to_annual documentation:

http://www.ncl.ucar.edu/Document/Functions/Contributed/month_to_annual.shtml

and make sure your input variables meet the requirements for dimensionality.

--Mary

On Feb 28, 2011, at 10:29 PM, Madeleine Patterson wrote:

> Hi,
>
> Am having trouble with a script: I am trying to plot a global map of the difference between a variable from 2 model runs, and even though I try to copy the var coords from the annual mean variable to the final difference variable, what I'm doing (following advice from a previous exchange with an ncl expert at ucar) doesn't seem to be working for me. Could anyone suggest something I could try?
>
> Also, can anyone suggest a script that sets out how to make a pretty shaded contour plot with labelled color bar?
>
> Thanks,
>
> Maddy
>
> *********
>
>
> begin
>
> ; loading libraries
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>
>
> setfileoption("nc","SuppressClose",False)
>
> all_files1 = systemfunc("ls modelrun1_output.*")
>
> fall1 = addfiles(all_files1,"r") ;
>
> ListSetType(fall1,"cat")
>
> tref_mod1_all = fall1[:]->TREF
>
>
> all_files2 = systemfunc("ls modelrun2_output.*")
>
> fall2 = addfiles(all_files2,"r")
>
> ListSetType(fall2,"cat")
>
> tref_mod2_all = fall2[:]->TREF
>
>
> ; Get annual means for 20 yr period
>
> tref_mod1_annmean = month_to_annual(tref_mod1_all,1)
> tref_mod2_annmean = month_to_annual(tref_mod2_all,1)
>
>
> ; THE AVERAGE OF THE ANNUAL MEANS OF THE 20 YEARS!!!
>
> tref_mod1_avgd = dim_avg_Wrap(tref_mod1_annmean)
> tref_mod2_avgd = dim_avg_Wrap(tref_mod2_annmean)
>
>
>
> ; GET THE DIFFERENCE BETWEEN THE RUNS
>
> diff_tref_avgd=(/tref_mod1_avgd-tref_mod2_avgd/)
>
>
> copy_VarCoords(tref_mod1_annmean,diff_tref_avgd)
>
> diff_tref_avgd&lon@units = "degrees east"
> diff_tref_avgd&lat@units = "degrees north"
> printVarSummary(diff_tref_avgd)
>
> wks =gsn_open_wks("x11","diff_tref_avgd")
> res = True
> res@tiMainString = "Difference maps for tref"
> plot = gsn_csm_contour_map_ce(wks,diff_tref_avgd,res)
>
>
> end
>
>
> ****
>
> ERROR message I'm getting:
>
> Variable: diff_tref_avgd
> Type: float
> Total Size: 7280 bytes
> 1820 values
> Number of Dimensions: 2
> Dimensions and sizes: [year | 20] x [lat | 91]
> Coordinates:
> lat: [ -90.. 90]
> fatal:(lon) is not a named dimension in variable (diff_tref_avgd).
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Mar 1 08:41:15 2011

This archive was generated by hypermail 2.1.8 : Wed Mar 02 2011 - 09:18:13 MST