[ncl-talk] plotting problem with JRA55
Mary Haley
haley at ucar.edu
Tue Mar 7 08:16:38 MST 2017
Mira,
In order to generate vectors over a map, you need to call
gsn_csm_vector_map, and not gsn_csm_vector map.
I think that's the only change you need to make to your script.
--Mary
On Mon, Mar 6, 2017 at 8:18 PM, MIRA BERDAHL <mlosic at scarletmail.rutgers.edu
> wrote:
> Hi,
> I'm trying to plot moisture transport from JRA55 output. I can generate
> figures, where the latitude looks correct, but my longitude is not
> correctly labelled. Also, there is no map generated, just the vector
> field.
> Can anyone see what the problem is with my code? I also get the following
> error:
> warning:VectorFieldSetValues: irregular coordinate array vfXArray
> non-monotonic: defaulting vfXArray
> I've copied my code and the variable information below. I've attached the
> figure I can generate.
> Thank you in advance,
> Mira
>
> ************************************************************
> ******************
>
> 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"
> ;************************************************
> begin
> ;************************************************
> ; read in netCDF files
> ;************************************************
> a = addfile("Uwv.mon.mean.nc","r") ; u moisture transport
> b = addfile("Vwv.mon.mean.nc","r") ; v moisture transport
>
> ;************************************************
> ; read in zonal [u] and meridional [v] moisture transport (water vapor)
> ;************************************************
>
> u_wv = a->UWV_GDS0_EATM_S123(1:648,:,:)
> v_wv = b->VWV_GDS0_EATM_S123(1:648,:,:) ;
>
> lat = a->g0_lat_1
> lon = a->g0_lon_2
>
> printVarSummary(lat)
> printVarSummary(lon)
>
> printVarSummary(u_wv)
> printVarSummary(v_wv)
>
>
> ; Calculate the seasonal averages.
> uwvDJF = month_to_season(u_wv, "DJF")
> vwvDJF = month_to_season(v_wv, "DJF")
>
>
> printVarSummary(uwvDJF)
> printVarSummary(vwvDJF)
>
>
> ; from the matlab script i wrote: findExtremeYrs, i pulled out the extreme
> years (> or < 1std) that i want to average and plot here.
>
>
> ;ans = 7 (longitude of IL)
> ;We find the years where the Icelandic low is in an “extreme east” (high
> Long) position to be: 1966, 1968, 1969, 1974, 1983, 1984, 1994, 1995, 1999
> and 2005.
> ;The years with “extreme west” (low long) position of the Icelandic Low
> are: 1963, 1964, 1980, 1985, 1987, 1991, 1992, 1996, 2003 and 2006.
>
>
> ; this data starts at 1958 (this is index 0), so 1963=5, 1973=15 etc.
>
>
> uDJF_lon_hi = uwvDJF((/8,10,11,16,25,26,36,37,41,47/),:,:)
> uDJF_lon_lo = uwvDJF((/5,6,22,27,29,33,34,38,45,48/),:,:)
>
> vDJF_lon_hi = vwvDJF((/8,10,11,16,25,26,36,37,41,47/),:,:)
> vDJF_lon_lo = vwvDJF((/5,6,22,27,29,33,34,38,45,48/),:,:)
>
> uAvgTime_hi = dim_avg_n_Wrap(uDJF_lon_hi,0)
> uAvgTime_lo = dim_avg_n_Wrap(uDJF_lon_lo,0)
>
> printVarSummary(uAvgTime_hi)
> printVarSummary(uAvgTime_lo)
>
> vAvgTime_hi = dim_avg_n_Wrap(vDJF_lon_hi,0)
> vAvgTime_lo = dim_avg_n_Wrap(vDJF_lon_lo,0)
>
> printVarSummary(vAvgTime_hi)
> printVarSummary(vAvgTime_lo)
>
>
> ; sneaky way to copy metadata over first.
> diff_u = uAvgTime_hi;
> diff_v = vAvgTime_hi;
>
> diff_u = uAvgTime_lo - uAvgTime_hi
> diff_v = vAvgTime_lo - vAvgTime_hi
>
> printVarSummary(diff_u)
> printVarSummary(diff_v)
>
> ;************************************************
> ; create plot
> ;************************************************
> wks = gsn_open_wks("ps","Panel_lon_WV") ; open a ps file
> gsn_define_colormap(wks,"temp1")
>
> plot = new(3,graphic) ; create a plot array
>
> ;---- set common resources for all plots
> res = True
> res at gsnDraw = False ; dont draw
> res at gsnFrame = False ; dont advance frame
> res at cnInfoLabelOn = False ; trn off cn info label
> res at gsnAddCyclic = False ; has to do with wrapping the lonitude at 0/360
> res at cnFillPalette = "matlab_jet"
>
> ;***********************************************
> ; ----wind vector plot
> ;***********************************************
> vcres = res
> vcres at vcRefAnnoOrthogonalPosF = -1.0 ; move ref vector up
> vcres at vcRefMagnitudeF = 10.0 ; define vector ref mag
> vcres at vcRefLengthF = 0.045 ; define length of vec ref
> vcres at vcGlyphStyle = "CurlyVector" ; turn on curly vectors
> vcres at vcMinDistanceF = 0.017
> vcres at mpFillOn = False ; turn off gray fill
> vcres at mpOutlineBoundarySets = "National" ; turn on country boundaries
> ;vcres at mpFillBoundarySets = AllBoundaries
> vcres at mpGeophysicalLineColor = "Navy" ; color of cont. outlines
> vcres at mpGeophysicalLineThicknessF = 1.5 ; thickness of outlines
> vcres at gsnRightString = "" ; turn off thue units string
>
> plot(0) = gsn_csm_vector(wks,uAvgTime_hi,vAvgTime_hi,vcres)
> plot(1) = gsn_csm_vector(wks,uAvgTime_lo,vAvgTime_lo,vcres)
> plot(2) = gsn_csm_vector(wks, diff_u, diff_v,vcres)
>
> ;************************************************
> ; create panel
> ;************************************************
> resP = False ; modify the panel plot
> resP at txString = "lon - water vapor transport"
> gsn_panel(wks,(/plot/),(/3,1/),resP) ; now draw as one plot;
>
>
> end
>
>
>
>
>
>
>
>
> ************************************************************
> *******************
> Variable: lat
> Type: float
> Total Size: 212 bytes
> 53 values
> Number of Dimensions: 1
> Dimensions and sizes: [g0_lat_1 | 53]
> Coordinates:
> g0_lat_1: [90..25]
> Number Of Attributes: 9
> La1 : 90
> Lo1 : 0
> La2 : -90
> Lo2 : -1.25
> Di : 1.25
> Dj : 1.25
> units : degrees_north
> GridType : Cylindrical Equidistant Projection Grid
> long_name : latitude
>
> Variable: lon
> Type: float
> Total Size: 452 bytes
> 113 values
> Number of Dimensions: 1
> Dimensions and sizes: [g0_lon_2 | 113]
> Coordinates:
> g0_lon_2: [250..30]
> Number Of Attributes: 9
> La1 : 90
> Lo1 : 0
> La2 : -90
> Lo2 : -1.25
> Di : 1.25
> Dj : 1.25
> units : degrees_east
> GridType : Cylindrical Equidistant Projection Grid
> long_name : longitude
>
> Variable: u_wv
> Type: float
> Total Size: 15523488 bytes
> 3880872 values
> Number of Dimensions: 3
> Dimensions and sizes: [initial_time0_hours | 648] x [g0_lat_1 | 53] x
> [g0_lon_2 | 113]
> Coordinates:
> initial_time0_hours: [1385736..1858344]
> g0_lat_1: [90..25]
> g0_lon_2: [250..30]
> Number Of Attributes: 15
> N : <ARRAY of 12 elements>
> statistical_process_duration : instantaneous (beginning at
> reference time at intervals of 6 hours)
> statistical_process_descriptor : average of N uninitialized analyses
> forecast_time_units : hours
> forecast_time : 0
> level : 0
> parameter_number : 157
> parameter_table_version : 200
> gds_grid_type : 0
> level_indicator : 200
> _FillValue : 1e+20
> units : kg/m/s
> long_name : Zonal water vapour flux
> center : Japanese Meteorological Agency - Tokyo (RSMC)
> sub_center : 241
>
> Variable: v_wv
> Type: float
> Total Size: 15523488 bytes
> 3880872 values
> Number of Dimensions: 3
> Dimensions and sizes: [initial_time0_hours | 648] x [g0_lat_1 | 53] x
> [g0_lon_2 | 113]
> Coordinates:
> initial_time0_hours: [1385736..1858344]
> g0_lat_1: [90..25]
> g0_lon_2: [250..30]
> Number Of Attributes: 15
> N : <ARRAY of 12 elements>
> statistical_process_duration : instantaneous (beginning at
> reference time at intervals of 6 hours)
> statistical_process_descriptor : average of N uninitialized analyses
> forecast_time_units : hours
> forecast_time : 0
> level : 0
> parameter_number : 152
> parameter_table_version : 200
> gds_grid_type : 0
> level_indicator : 200
> _FillValue : 1e+20
> units : Kg/m/s
> long_name : Meridional water vapour flux
> center : Japanese Meteorological Agency - Tokyo (RSMC)
> sub_center : 241
>
> Variable: uwvDJF
> Type: float
> Total Size: 1293624 bytes
> 323406 values
> Number of Dimensions: 3
> Dimensions and sizes: [initial_time0_hours | 54] x [g0_lat_1 | 53] x
> [g0_lon_2 | 113]
> Coordinates:
> initial_time0_hours: [1385736..1850328]
> g0_lat_1: [90..25]
> g0_lon_2: [250..30]
> Number Of Attributes: 16
> N : <ARRAY of 12 elements>
> statistical_process_duration : instantaneous (beginning at
> reference time at intervals of 6 hours)
> statistical_process_descriptor : average of N uninitialized analyses
> forecast_time_units : hours
> forecast_time : 0
> level : 0
> parameter_number : 157
> parameter_table_version : 200
> gds_grid_type : 0
> level_indicator : 200
> _FillValue : 1e+20
> units : kg/m/s
> long_name : DJF: Zonal water vapour flux
> center : Japanese Meteorological Agency - Tokyo (RSMC)
> sub_center : 241
> NMO : 0
>
> Variable: vwvDJF
> Type: float
> Total Size: 1293624 bytes
> 323406 values
> Number of Dimensions: 3
> Dimensions and sizes: [initial_time0_hours | 54] x [g0_lat_1 | 53] x
> [g0_lon_2 | 113]
> Coordinates:
> initial_time0_hours: [1385736..1850328]
> g0_lat_1: [90..25]
> g0_lon_2: [250..30]
> Number Of Attributes: 16
> N : <ARRAY of 12 elements>
> statistical_process_duration : instantaneous (beginning at
> reference time at intervals of 6 hours)
> statistical_process_descriptor : average of N uninitialized analyses
> forecast_time_units : hours
> forecast_time : 0
> level : 0
> parameter_number : 152
> parameter_table_version : 200
> gds_grid_type : 0
> level_indicator : 200
> _FillValue : 1e+20
> units : Kg/m/s
> long_name : DJF: Meridional water vapour flux
> center : Japanese Meteorological Agency - Tokyo (RSMC)
> sub_center : 241
> NMO : 0
>
> Variable: uAvgTime_hi
> Type: float
> Total Size: 23956 bytes
> 5989 values
> Number of Dimensions: 2
> Dimensions and sizes: [g0_lat_1 | 53] x [g0_lon_2 | 113]
> Coordinates:
> g0_lat_1: [90..25]
> g0_lon_2: [250..30]
> Number Of Attributes: 17
> NMO : 0
> sub_center : 241
> center : Japanese Meteorological Agency - Tokyo (RSMC)
> long_name : DJF: Zonal water vapour flux
> units : kg/m/s
> _FillValue : 1e+20
> level_indicator : 200
> gds_grid_type : 0
> parameter_table_version : 200
> parameter_number : 157
> level : 0
> forecast_time : 0
> forecast_time_units : hours
> statistical_process_descriptor : average of N uninitialized analyses
> statistical_process_duration : instantaneous (beginning at
> reference time at intervals of 6 hours)
> N : <ARRAY of 12 elements>
> average_op_ncl : dim_avg_n over dimension(s): initial_time0_hours
>
> Variable: uAvgTime_lo
> Type: float
> Total Size: 23956 bytes
> 5989 values
> Number of Dimensions: 2
> Dimensions and sizes: [g0_lat_1 | 53] x [g0_lon_2 | 113]
> Coordinates:
> g0_lat_1: [90..25]
> g0_lon_2: [250..30]
> Number Of Attributes: 17
> NMO : 0
> sub_center : 241
> center : Japanese Meteorological Agency - Tokyo (RSMC)
> long_name : DJF: Zonal water vapour flux
> units : kg/m/s
> _FillValue : 1e+20
> level_indicator : 200
> gds_grid_type : 0
> parameter_table_version : 200
> parameter_number : 157
> level : 0
> forecast_time : 0
> forecast_time_units : hours
> statistical_process_descriptor : average of N uninitialized analyses
> statistical_process_duration : instantaneous (beginning at
> reference time at intervals of 6 hours)
> N : <ARRAY of 12 elements>
> average_op_ncl : dim_avg_n over dimension(s): initial_time0_hours
>
> Variable: vAvgTime_hi
> Type: float
> Total Size: 23956 bytes
> 5989 values
> Number of Dimensions: 2
> Dimensions and sizes: [g0_lat_1 | 53] x [g0_lon_2 | 113]
> Coordinates:
> g0_lat_1: [90..25]
> g0_lon_2: [250..30]
> Number Of Attributes: 17
> NMO : 0
> sub_center : 241
> center : Japanese Meteorological Agency - Tokyo (RSMC)
> long_name : DJF: Meridional water vapour flux
> units : Kg/m/s
> _FillValue : 1e+20
> level_indicator : 200
> gds_grid_type : 0
> parameter_table_version : 200
> parameter_number : 152
> level : 0
> forecast_time : 0
> forecast_time_units : hours
> statistical_process_descriptor : average of N uninitialized analyses
> statistical_process_duration : instantaneous (beginning at
> reference time at intervals of 6 hours)
> N : <ARRAY of 12 elements>
> average_op_ncl : dim_avg_n over dimension(s): initial_time0_hours
>
> Variable: vAvgTime_lo
> Type: float
> Total Size: 23956 bytes
> 5989 values
> Number of Dimensions: 2
> Dimensions and sizes: [g0_lat_1 | 53] x [g0_lon_2 | 113]
> Coordinates:
> g0_lat_1: [90..25]
> g0_lon_2: [250..30]
> Number Of Attributes: 17
> NMO : 0
> sub_center : 241
> center : Japanese Meteorological Agency - Tokyo (RSMC)
> long_name : DJF: Meridional water vapour flux
> units : Kg/m/s
> _FillValue : 1e+20
> level_indicator : 200
> gds_grid_type : 0
> parameter_table_version : 200
> parameter_number : 152
> level : 0
> forecast_time : 0
> forecast_time_units : hours
> statistical_process_descriptor : average of N uninitialized analyses
> statistical_process_duration : instantaneous (beginning at
> reference time at intervals of 6 hours)
> N : <ARRAY of 12 elements>
> average_op_ncl : dim_avg_n over dimension(s): initial_time0_hours
>
> Variable: diff_u
> Type: float
> Total Size: 23956 bytes
> 5989 values
> Number of Dimensions: 2
> Dimensions and sizes: [g0_lat_1 | 53] x [g0_lon_2 | 113]
> Coordinates:
> g0_lat_1: [90..25]
> g0_lon_2: [250..30]
> Number Of Attributes: 17
> average_op_ncl : dim_avg_n over dimension(s): initial_time0_hours
> N : <ARRAY of 12 elements>
> statistical_process_duration : instantaneous (beginning at
> reference time at intervals of 6 hours)
> statistical_process_descriptor : average of N uninitialized analyses
> forecast_time_units : hours
> forecast_time : 0
> level : 0
> parameter_number : 157
> parameter_table_version : 200
> gds_grid_type : 0
> level_indicator : 200
> _FillValue : 1e+20
> units : kg/m/s
> long_name : DJF: Zonal water vapour flux
> center : Japanese Meteorological Agency - Tokyo (RSMC)
> sub_center : 241
> NMO : 0
>
> Variable: diff_v
> Type: float
> Total Size: 23956 bytes
> 5989 values
> Number of Dimensions: 2
> Dimensions and sizes: [g0_lat_1 | 53] x [g0_lon_2 | 113]
> Coordinates:
> g0_lat_1: [90..25]
> g0_lon_2: [250..30]
> Number Of Attributes: 17
> average_op_ncl : dim_avg_n over dimension(s): initial_time0_hours
> N : <ARRAY of 12 elements>
> statistical_process_duration : instantaneous (beginning at
> reference time at intervals of 6 hours)
> statistical_process_descriptor : average of N uninitialized analyses
> forecast_time_units : hours
> forecast_time : 0
> level : 0
> parameter_number : 152
> parameter_table_version : 200
> gds_grid_type : 0
> level_indicator : 200
> _FillValue : 1e+20
> units : Kg/m/s
> long_name : DJF: Meridional water vapour flux
> center : Japanese Meteorological Agency - Tokyo (RSMC)
> sub_center : 241
> NMO : 0
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170307/3f39ae44/attachment-0001.html
More information about the ncl-talk
mailing list