Re: facing problem in making xy plot

From: Karin Meier-Fleischer <meier-fleischer_at_nyahnyahspammersnyahnyah>
Date: Mon Jul 14 2014 - 05:18:38 MDT

Hi Ruksana,

the error message tells you that the function wgt_areaavg_Wrap is
undefined in this case it is
the wrong name of the function. It has to be

      wgt_areaav*e*_Wrap

see also
http://ncl.ucar.edu/Document/Functions/Contributed/wgt_areaave_Wrap.shtml

Bye,
Karin

Am 14.07.14 11:49, schrieb Ruksana Abedin:
> Hi,
>
> I am trying to make a simple XY plot using a netcdf file; but getting
> this error:
>
> fatal:Undefined identifier: (wgt_areaavg_Wrap) is undefined, can't
> continue
> fatal:Execute: Error occurred at or near line 20 in file test2.ncl
>
> Please help me to solve this.
>
>
> the script I tried:
> ;
> ;**********************************
> 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/contrib/time_axis_labels.ncl"
> ;************************************************
>
> begin
>
> ; read in data
>
> f=addfile ("/ouce-home/students/rege1218/West_Asia/annual.nc
> <http://annual.nc>", "r");
>
> Temp = f->field16 ; get Temp data
>
> time =Temp&time0
>
> ;-- compute the area mean without weigthing
> fldmean = wgt_areaavg_Wrap (Temp,1.0,1.0,1)
>
> wks = gsn_open_wks("eps","time_series") ; open workstation
>
>
>
> res = True
> res@tiMainString = "Basic XY Plot" ; add title
>
> restime = True ; set time tickmark resouces
> restime@ttmFormat = "%d %c %y" ; time tickmark format
>
> time_axis_labels(time, res, restime) ; sets the correct time labels
>
> res@tmXBLabelFontHeight = 0.01
> res@tmXBLabelJust = "CentreRight"
> res@tmXBLabelDeltaF = 1.0
> res@tmXBLabelAngleF = 50.
> res@tmXBLabelAutoStride = True
>
> plot = gsn_csm_xy(wks, time, fldmean, res)
>
>
> end
>
>
>
> the ncdump -h of the input file:
>
> ncdump -h annual.nc <http://annual.nc>
> netcdf annual {
> dimensions:
> x = 209 ;
> y = 146 ;
> x_2 = 209 ;
> y_2 = 145 ;
> z0 = 1 ;
> z1 = 1 ;
> z2 = 1 ;
> z3 = 1 ;
> z4 = 2 ;
> z5 = 1 ;
> z6 = 3 ;
> z7 = 1 ;
> time0 = UNLIMITED ; // (12 currently)
> variables:
> float global_longitude0(y, x) ;
> global_longitude0:standard_name = "longitude" ;
> global_longitude0:long_name = "longitude" ;
> global_longitude0:units = "degrees_east" ;
> global_longitude0:_CoordinateAxisType = "Lon" ;
> float global_latitude0(y, x) ;
> global_latitude0:standard_name = "latitude" ;
> global_latitude0:long_name = "latitude" ;
> global_latitude0:units = "degrees_north" ;
> global_latitude0:_CoordinateAxisType = "Lat" ;
> float global_longitude1(y_2, x_2) ;
> global_longitude1:standard_name = "longitude" ;
> global_longitude1:long_name = "longitude" ;
> global_longitude1:units = "degrees_east" ;
> global_longitude1:_CoordinateAxisType = "Lon" ;
> float global_latitude1(y_2, x_2) ;
> global_latitude1:standard_name = "latitude" ;
> global_latitude1:long_name = "latitude" ;
> global_latitude1:units = "degrees_north" ;
> global_latitude1:_CoordinateAxisType = "Lat" ;
> float z0(z0) ;
> z0:standard_name = "height" ;
> z0:units = "m" ;
> z0:positive = "up" ;
> z0:axis = "Z" ;
> float z1(z1) ;
> z1:axis = "Z" ;
> float z2(z2) ;
> z2:standard_name = "height" ;
> z2:units = "m" ;
> z2:positive = "up" ;
> z2:axis = "Z" ;
> float z3(z3) ;
> z3:standard_name = "height" ;
> z3:units = "m" ;
> z3:positive = "up" ;
> z3:axis = "Z" ;
> float z4(z4) ;
> z4:standard_name = "air_pressure" ;
> z4:units = "hPa" ;
> z4:positive = "down" ;
> z4:axis = "Z" ;
> float z5(z5) ;
> z5:standard_name = "air_pressure" ;
> z5:units = "hPa" ;
> z5:positive = "down" ;
> z5:axis = "Z" ;
> float z6(z6) ;
> z6:standard_name = "air_pressure" ;
> z6:units = "hPa" ;
> z6:positive = "down" ;
> z6:axis = "Z" ;
> float z7(z7) ;
> z7:standard_name = "height" ;
> z7:units = "m" ;
> z7:positive = "up" ;
> z7:axis = "Z" ;
> double time0(time0) ;
> time0:standard_name = "time" ;
> time0:units = "days since 1959-12-01 00:00:00" ;
> time0:calendar = "360_day" ;
> float field186(time0, z0, y, x) ;
> field186:standard_name = "net_down_surface_sw_flux" ;
> field186:units = "W m-2" ;
> field186:coordinates = "global_longitude0
> global_latitude0" ;
> field186:_FillValue = -1.073742e+09f ;
> field186:stash_item = "201" ;
> field186:stash_section = "1" ;
> field186:description = "NET DOWN SURFACE SW FLUX: SW
> TS ONLY" ;
> field186:cell_method = "time: mean " ;
> field186:sampling_frequency = "3 hours" ;
> float field200(time0, z1, y, x) ;
> field200:standard_name = "incoming_sw_rad_flux" ;
> field200:units = "W m-2" ;
> field200:coordinates = "global_longitude0
> global_latitude0" ;
> field200:_FillValue = -1.073742e+09f ;
> field200:stash_item = "207" ;
> field200:stash_section = "1" ;
> field200:description = "INCOMING SW RAD FLUX (TOA):
> ALL TSS" ;
> field200:cell_method = "time: mean " ;
> field200:sampling_frequency = "1 hours" ;
> float field201(time0, z1, y, x) ;
> field201:standard_name = "outgoing_sw_rad_flux" ;
> field201:units = "W m-2" ;
> field201:coordinates = "global_longitude0
> global_latitude0" ;
> field201:_FillValue = -1.073742e+09f ;
> field201:stash_item = "208" ;
> field201:stash_section = "1" ;
> field201:description = "OUTGOING SW RAD FLUX (TOA)" ;
> field201:cell_method = "time: mean " ;
> field201:sampling_frequency = "3 hours" ;
> float field203(time0, z0, y, x) ;
> field203:standard_name = "total_down_surface_sw_flux" ;
> field203:units = "W m-2" ;
> field203:coordinates = "global_longitude0
> global_latitude0" ;
> field203:_FillValue = -1.073742e+09f ;
> field203:stash_item = "235" ;
> field203:stash_section = "1" ;
> field203:description = "TOTAL DOWNWARD SURFACE SW FLUX" ;
> field203:cell_method = "time: mean " ;
> field203:sampling_frequency = "3 hours" ;
> float field30(time0, z2, y, x) ;
> field30:standard_name = "total_cloud_fraction" ;
> field30:units = "***" ;
> field30:coordinates = "global_longitude0
> global_latitude0" ;
> field30:_FillValue = -1.073742e+09f ;
> field30:stash_item = "204" ;
> field30:stash_section = "2" ;
> field30:description = "TOTAL CLOUD AMOUNT IN LW
> RADIATION" ;
> field30:cell_method = "time: mean " ;
> field30:sampling_frequency = "3 hours" ;
> float field206(time0, z1, y, x) ;
> field206:standard_name = "outgoing_lw_rad_flux" ;
> field206:units = "W m-2" ;
> field206:coordinates = "global_longitude0
> global_latitude0" ;
> field206:_FillValue = -1.073742e+09f ;
> field206:stash_item = "205" ;
> field206:stash_section = "2" ;
> field206:description = "OUTGOING LW RAD FLUX (TOA)" ;
> field206:cell_method = "time: mean " ;
> field206:sampling_frequency = "3 hours" ;
> float field205(time0, z0, y, x) ;
> field205:standard_name =
> "total_downward_surface_lw_flux" ;
> field205:units = "W m-2" ;
> field205:coordinates = "global_longitude0
> global_latitude0" ;
> field205:_FillValue = -1.073742e+09f ;
> field205:stash_item = "207" ;
> field205:stash_section = "2" ;
> field205:description = "DOWNWARD LW RAD FLUX: SURFACE" ;
> field205:cell_method = "time: mean " ;
> field205:sampling_frequency = "3 hours" ;
> float field48(time0, z3, y_2, x_2) ;
> field48:standard_name = "10m_wind_u-comp" ;
> field48:units = "m s-1" ;
> field48:coordinates = "global_longitude1
> global_latitude1" ;
> field48:_FillValue = -1.073742e+09f ;
> field48:stash_item = "225" ;
> field48:stash_section = "3" ;
> field48:description = "10 METRE WIND U-COMP B GRID" ;
> field48:cell_method = "time: mean " ;
> field48:sampling_frequency = "1 hours" ;
> float field49(time0, z3, y_2, x_2) ;
> field49:standard_name = "10m_wind_v-comp" ;
> field49:units = "m s-1" ;
> field49:coordinates = "global_longitude1
> global_latitude1" ;
> field49:_FillValue = -1.073742e+09f ;
> field49:stash_item = "226" ;
> field49:stash_section = "3" ;
> field49:description = "10 METRE WIND V-COMP B GRID" ;
> field49:cell_method = "time: mean " ;
> field49:sampling_frequency = "1 hours" ;
> float field115(time0, z0, y, x) ;
> field115:standard_name = "evaporation_from_soil_surface" ;
> field115:units = "kg m-2 ts-1" ;
> field115:coordinates = "global_longitude0
> global_latitude0" ;
> field115:_FillValue = -1.073742e+09f ;
> field115:stash_item = "229" ;
> field115:stash_section = "3" ;
> field115:description = "EVAP FROM SOIL SURF -AMOUNT
> KG/M2/TS" ;
> field115:cell_method = "time: mean " ;
> field115:sampling_frequency = "1 hours" ;
> float field180(time0, z0, y, x) ;
> field180:standard_name = "surface_latent_heat_flux" ;
> field180:units = "W m-2" ;
> field180:coordinates = "global_longitude0
> global_latitude0" ;
> field180:_FillValue = -1.073742e+09f ;
> field180:stash_item = "234" ;
> field180:stash_section = "3" ;
> field180:description = "SURFACE LATENT HEAT FLUX W/M2" ;
> field180:cell_method = "time: mean " ;
> field180:sampling_frequency = "1 hours" ;
> float field16(time0, z3, y, x) ;
> field16:standard_name = "temperature_at_1-5m" ;
> field16:units = "K" ;
> field16:coordinates = "global_longitude0
> global_latitude0" ;
> field16:_FillValue = -1.073742e+09f ;
> field16:stash_item = "236" ;
> field16:stash_section = "3" ;
> field16:description = "TEMPERATURE AT 1.5M" ;
> field16:cell_method = "time: mean " ;
> field16:sampling_frequency = "1 hours" ;
> float field16_1(time0, z3, y, x) ;
> field16_1:standard_name = "temperature_at_1-5m" ;
> field16_1:units = "K" ;
> field16_1:coordinates = "global_longitude0
> global_latitude0" ;
> field16_1:_FillValue = -1.073742e+09f ;
> field16_1:stash_item = "236" ;
> field16_1:stash_section = "3" ;
> field16_1:description = "TEMPERATURE AT 1.5M" ;
> field16_1:cell_method = "time: maximum " ;
> field16_1:sampling_frequency = "1 hours" ;
> float field16_2(time0, z3, y, x) ;
> field16_2:standard_name = "temperature_at_1-5m" ;
> field16_2:units = "K" ;
> field16_2:coordinates = "global_longitude0
> global_latitude0" ;
> field16_2:_FillValue = -1.073742e+09f ;
> field16_2:stash_item = "236" ;
> field16_2:stash_section = "3" ;
> field16_2:description = "TEMPERATURE AT 1.5M" ;
> field16_2:cell_method = "time: minimum " ;
> field16_2:sampling_frequency = "1 hours" ;
> float field95(time0, z3, y, x) ;
> field95:standard_name = "specific_humidity_at_1-5m" ;
> field95:units = "1" ;
> field95:coordinates = "global_longitude0
> global_latitude0" ;
> field95:_FillValue = -1.073742e+09f ;
> field95:stash_item = "237" ;
> field95:stash_section = "3" ;
> field95:description = "SPECIFIC HUMIDITY AT 1.5M" ;
> field95:cell_method = "time: mean " ;
> field95:sampling_frequency = "1 hours" ;
> float field50(time0, z3, y_2, x_2) ;
> field50:standard_name = "wind_speed_at_10m" ;
> field50:units = "m s-1" ;
> field50:coordinates = "global_longitude1
> global_latitude1" ;
> field50:_FillValue = -1.073742e+09f ;
> field50:stash_item = "249" ;
> field50:stash_section = "3" ;
> field50:description = "WIND SPEED AT 10 METRES (WIND
> GRID)" ;
> field50:cell_method = "time: mean " ;
> field50:sampling_frequency = "1 hours" ;
> float field50_1(time0, z3, y_2, x_2) ;
> field50_1:standard_name = "wind_speed_at_10m" ;
> field50_1:units = "m s-1" ;
> field50_1:coordinates = "global_longitude1
> global_latitude1" ;
> field50_1:_FillValue = -1.073742e+09f ;
> field50_1:stash_item = "249" ;
> field50_1:stash_section = "3" ;
> field50_1:description = "WIND SPEED AT 10 METRES (WIND
> GRID)" ;
> field50_1:cell_method = "time: maximum " ;
> field50_1:sampling_frequency = "1 hours" ;
> float field90(time0, z0, y, x) ;
> field90:standard_name = "total_precipitation_rate" ;
> field90:units = "kg m-2 s-1" ;
> field90:coordinates = "global_longitude0
> global_latitude0" ;
> field90:_FillValue = -1.073742e+09f ;
> field90:stash_item = "216" ;
> field90:stash_section = "5" ;
> field90:description = "TOTAL PRECIPITATION RATE KG/M2/S" ;
> field90:cell_method = "time: mean " ;
> field90:sampling_frequency = "1 hours" ;
> float field106(time0, z0, y, x) ;
> field106:standard_name = "total_soil_moisture_content" ;
> field106:units = "kg m-2" ;
> field106:coordinates = "global_longitude0
> global_latitude0" ;
> field106:_FillValue = -1.073742e+09f ;
> field106:stash_item = "208" ;
> field106:stash_section = "8" ;
> field106:description = "SOIL MOISTURE CONTENT" ;
> field106:cell_method = "time: mean " ;
> field106:sampling_frequency = "1 hours" ;
> float field1530(time0, z0, y, x) ;
> field1530:standard_name = "snow_melt_rate_land" ;
> field1530:units = "kg m-2 s-1" ;
> field1530:coordinates = "global_longitude0
> global_latitude0" ;
> field1530:_FillValue = -1.073742e+09f ;
> field1530:stash_item = "231" ;
> field1530:stash_section = "8" ;
> field1530:description = "SNOW MELT RATE (LAND)" ;
> field1530:cell_method = "time: mean " ;
> field1530:sampling_frequency = "1 hours" ;
> float field1532(time0, z0, y, x) ;
> field1532:standard_name = "surface_runoff_rate" ;
> field1532:units = "kg m-2 s-1" ;
> field1532:coordinates = "global_longitude0
> global_latitude0" ;
> field1532:_FillValue = -1.073742e+09f ;
> field1532:stash_item = "234" ;
> field1532:stash_section = "8" ;
> field1532:description = "SURFACE RUNOFF RATE KG/M2/S" ;
> field1532:cell_method = "time: mean " ;
> field1532:sampling_frequency = "1 hours" ;
> float field1533(time0, z0, y, x) ;
> field1533:standard_name = "subsurface_runoff_rate" ;
> field1533:units = "kg m-2 s-1" ;
> field1533:coordinates = "global_longitude0
> global_latitude0" ;
> field1533:_FillValue = -1.073742e+09f ;
> field1533:stash_item = "235" ;
> field1533:stash_section = "8" ;
> field1533:description = "SUB-SURFACE RUNOFF RATE
> KG/M2/S" ;
> field1533:cell_method = "time: mean " ;
> field1533:sampling_frequency = "1 hours" ;
> float field56(time0, z4, y_2, x_2) ;
> field56:standard_name = "wind_u-comp" ;
> field56:units = "m s-1" ;
> field56:coordinates = "global_longitude1
> global_latitude1" ;
> field56:_FillValue = -1.073742e+09f ;
> field56:stash_item = "201" ;
> field56:stash_section = "15" ;
> field56:description = "U WIND ON PRESSURE LEVELS B GRID" ;
> field56:cell_method = "time: mean " ;
> field56:sampling_frequency = "1 hours" ;
> float field57(time0, z4, y_2, x_2) ;
> field57:standard_name = "wind_v-comp" ;
> field57:units = "m s-1" ;
> field57:coordinates = "global_longitude1
> global_latitude1" ;
> field57:_FillValue = -1.073742e+09f ;
> field57:stash_item = "202" ;
> field57:stash_section = "15" ;
> field57:description = "V WIND ON PRESSURE LEVELS B GRID" ;
> field57:cell_method = "time: mean " ;
> field57:sampling_frequency = "1 hours" ;
> float field95_1(time0, z5, y_2, x_2) ;
> field95_1:standard_name = "specific_humidity_wind_grid" ;
> field95_1:units = "1" ;
> field95_1:coordinates = "global_longitude1
> global_latitude1" ;
> field95_1:_FillValue = -1.073742e+09f ;
> field95_1:stash_item = "226" ;
> field95_1:stash_section = "15" ;
> field95_1:description = "SPECIFIC HUMIDITY (=Q) (WIND
> GRID)" ;
> field95_1:cell_method = "time: mean " ;
> field95_1:sampling_frequency = "1 hours" ;
> float field1(time0, z4, y, x) ;
> field1:standard_name = "geopotential_height" ;
> field1:units = "m" ;
> field1:coordinates = "global_longitude0
> global_latitude0" ;
> field1:_FillValue = -1.073742e+09f ;
> field1:stash_item = "202" ;
> field1:stash_section = "16" ;
> field1:description = "GEOPOTENTIAL HEIGHT (=Z)" ;
> field1:cell_method = "time: mean " ;
> field1:sampling_frequency = "1 hours" ;
> float field16_3(time0, z6, y, x) ;
> field16_3:standard_name = "temperature" ;
> field16_3:units = "K" ;
> field16_3:coordinates = "global_longitude0
> global_latitude0" ;
> field16_3:_FillValue = -1.073742e+09f ;
> field16_3:stash_item = "203" ;
> field16_3:stash_section = "16" ;
> field16_3:description = "TEMPERATURE (=T)" ;
> field16_3:cell_method = "time: mean " ;
> field16_3:sampling_frequency = "1 hours" ;
> float field8(time0, z7, y, x) ;
> field8:standard_name = "pmsl" ;
> field8:units = "Pa" ;
> field8:coordinates = "global_longitude0
> global_latitude0" ;
> field8:_FillValue = -1.073742e+09f ;
> field8:stash_item = "222" ;
> field8:stash_section = "16" ;
> field8:description = "PRESSURE AT MEAN SEA LEVEL" ;
> field8:cell_method = "time: mean " ;
> field8:sampling_frequency = "1 hours" ;
> float field93(time0, z0, y, x) ;
> field93:standard_name = "snowfall_amount" ;
> field93:units = "kg/m2" ;
> field93:coordinates = "global_longitude0
> global_latitude0" ;
> field93:_FillValue = -1.073742e+09f ;
> field93:stash_item = "23" ;
> field93:stash_section = "0" ;
> field93:description = "SNOW AMOUNT AFTER TIMESTEP KG/M2" ;
> field93:cell_method = "time: mean " ;
> field93:sampling_frequency = "1 hours" ;
> float field37(time0, z0, y, x) ;
> field37:standard_name = "sea_ice_fraction" ;
> field37:units = "***" ;
> field37:coordinates = "global_longitude0
> global_latitude0" ;
> field37:_FillValue = -1.073742e+09f ;
> field37:stash_item = "31" ;
> field37:stash_section = "0" ;
> field37:description = "SEA ICE FRACTION AFTER TIMESTEP" ;
> field37:cell_method = "time: mean " ;
> field37:sampling_frequency = "1 hours" ;
>
> // global attributes:
> :CDI = "Climate Data Interface version 1.6.0
> (http://code.zmaw.de/projects/cdi)" ;
> :Conventions = "CF-1.3" ;
> :history = "Fri Jul 11 16:11:03 2014: cdo cat
> nhqhga.pcg6dec.nc <http://nhqhga.pcg6dec.nc> nhqhga.pcg7jan.nc
> <http://nhqhga.pcg7jan.nc> nhqhga.pcg7feb.nc
> <http://nhqhga.pcg7feb.nc> nhqhga.pcg7mar.nc
> <http://nhqhga.pcg7mar.nc> nhqhga.pcg7apr.nc
> <http://nhqhga.pcg7apr.nc> nhqhga.pcg7may.nc
> <http://nhqhga.pcg7may.nc> nhqhga.pcg7jun.nc
> <http://nhqhga.pcg7jun.nc> nhqhga.pcg7jul.nc
> <http://nhqhga.pcg7jul.nc> nhqhga.pcg7aug.nc
> <http://nhqhga.pcg7aug.nc> nhqhga.pcg7sep.nc
> <http://nhqhga.pcg7sep.nc> nhqhga.pcg7oct.nc
> <http://nhqhga.pcg7oct.nc> nhqhga.pcg7nov.nc
> <http://nhqhga.pcg7nov.nc> annual.nc <http://annual.nc>" ;
> :CDO = "Climate Data Operators version 1.6.0
> (http://code.zmaw.de/projects/cdo)" ;
> }
>
>
>
> _______________________________________________
> 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 Mon Jul 14 11:18:59 2014

This archive was generated by hypermail 2.1.8 : Fri Aug 01 2014 - 15:10:55 MDT