[ncl-talk] Multiple_Timeser_annavg_O3CONOX
Rick Brownrigg
brownrig at ucar.edu
Thu Jun 9 08:33:50 MDT 2022
I don't really understand what you are trying to do conceptually, but a few
comments:
- In assigning one array to another, the size and shapes must be the same.
It looks like you are trying to take 3 slices of var_ann_flip at level 55
and assign it to the variable data. Those slices would each be a 2D
subarray of dimension lat x lon. In that case, data needs to be
dimensioned as I suggested:
data = new((/3,dimsizes(var_ann_flip&lat),dimsizes(var_ann_flip&lon)
/),float)
and then the assignments to data become:
data(0,:,:) = var_ann_flip(55,:,:)
data(1,:,:) = var_ann_flip(55,:,:)
data(2,:,:) = var_ann_flip(55,:,:)
- That takes care of the error message, but do you really mean for data
0..2 to contain the same slice (55) of var_ann_flip? Should they be
different slices?
- All of this is contained inside a do-loop of three iterations. Is this
correct? Were you trying to build up the data and plots iteratively?
- Further down in the script, there is this:
plot0 = gsn_csm_xy (wks,var_ann&lat,data(0,:,:),res)
plot1 = gsn_csm_xy (wks,var_ann&lat,data(0,:,:),res)
plot2 = gsn_csm_xy (wks,var_ann&lat,data(0,:,:),res)
Note that the three plots are of the same data(0,:,:) -- should that be
data(0,:,:) data(1,:,:) data(2,:,:)?
Rick
On Thu, Jun 9, 2022 at 7:55 AM Najib Yusuf <najibgal at yahoo.com> wrote:
> Hi Rick,
>
> Yes, data = new((/3,dimsizes(var_ann_flip&lat),dimsizes(var_ann_flip&lon)
> /),float)
>
> data(0,:) = var_ann_flip(55,:,:)
> data(1,:) = var_ann_flip(55,:,:)
> data(2,:) = var_ann_flip(55,:,:)
> left hand side is 2 dimension and right side is 3 dimension but the error
> is
> :Number of subscripts on left-hand-side do not match number of dimensions
> of variable: (2), Subscripts used: (3)
>
> It is not clear to me how I can make left hand side subscripting to 3
> because the dimension is 2. Kindly clear my confusion.
>
> Thank you sir
>
>
> *------------------------------------*
> *Najib Yusuf Galadanci PhD*
> *Assistant Director (R & D)*
>
> *Lower Atmospheric Dynamics(Aerosol radiative forcing, air quality
> observations and modeling)Centre for Atmospheric ResearchNational Space
> Research and Development Agency. Kogi StateUniversity Campus, Anyigba. Kogi
> State. Nigeria+234 80 3871 4158------------------------------------Know
> that Victory comes with Patience, Relief with Affliction, and Ease with
> Hardship.Prophet Muhammad Rasulullah (PBUH) *
>
>
>
> On Thursday, June 9, 2022, 02:41:44 PM GMT+1, Rick Brownrigg <
> brownrig at ucar.edu> wrote:
>
>
> Hi,
>
> The problem is just what the error message says; in these lines:
>
> data(0,:) = var_ann_flip(55,:,:)
> data(1,:) = var_ann_flip(55,:,:)
> data(2,:) = var_ann_flip(55,:,:)
>
> data is [3] x [192]
> whereas var_ann_flip is [lev | 56] x [lat | 192] x [lon | 288]
>
> I would speculate that the line that creates data should be something like:
>
> data = new((/3,dimsizes(var_ann_flip&lat),dimsizes(var_ann_flip&lon)
> /),float)
>
> Hope that helps...
> Rick
>
>
> On Thu, Jun 9, 2022 at 7:23 AM Najib Yusuf via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
> Dear NCL experts and colleagues,
>
> I am trying to plot multiple time series annual averages(monthly files) of
> three variables from same files using xy2 example, but I am getting error
> of dimension subscripting, when I tried using only One File it plotted.
> Kindly assist. See attached the script, and below is the VarSummaries. The
> error message is fatal:VarVarWrite: Number of dimensions on left hand
> side does not match right hand side.
>
> data(0,:) = var_ann_flip(55,:,:)
> data(1,:) = var_ann_flip(55,:,:)
> data(2,:) = var_ann_flip(55,:,:)
>
>
> Thank you for your support always
>
>
> Variable: f_all
> Type: string
> Total Size: 96 bytes
> 12 values
> Number of Dimensions: 1
> Dimensions and sizes: [12]
> Coordinates:
> (0) /glade/work/najiby/f.e20.FCSD/f.e20.FCSD/atm/hist/
> f.e20.FCSD.cam.h0.2013-01.nc
> (1) /glade/work/najiby/f.e20.FCSD/f.e20.FCSD/atm/hist/
> f.e20.FCSD.cam.h0.2013-02.nc
> (2) /glade/work/najiby/f.e20.FCSD/f.e20.FCSD/atm/hist/
> f.e20.FCSD.cam.h0.2013-03.nc
> (3) /glade/work/najiby/f.e20.FCSD/f.e20.FCSD/atm/hist/
> f.e20.FCSD.cam.h0.2013-04.nc
> (4) /glade/work/najiby/f.e20.FCSD/f.e20.FCSD/atm/hist/
> f.e20.FCSD.cam.h0.2013-05.nc
> (5) /glade/work/najiby/f.e20.FCSD/f.e20.FCSD/atm/hist/
> f.e20.FCSD.cam.h0.2013-06.nc
> (6) /glade/work/najiby/f.e20.FCSD/f.e20.FCSD/atm/hist/
> f.e20.FCSD.cam.h0.2013-07.nc
> (7) /glade/work/najiby/f.e20.FCSD/f.e20.FCSD/atm/hist/
> f.e20.FCSD.cam.h0.2013-08.nc
> (8) /glade/work/najiby/f.e20.FCSD/f.e20.FCSD/atm/hist/
> f.e20.FCSD.cam.h0.2013-09.nc
> (9) /glade/work/najiby/f.e20.FCSD/f.e20.FCSD/atm/hist/
> f.e20.FCSD.cam.h0.2013-10.nc
> (10) /glade/work/najiby/f.e20.FCSD/f.e20.FCSD/atm/hist/
> f.e20.FCSD.cam.h0.2013-11.nc
> (11) /glade/work/najiby/f.e20.FCSD/f.e20.FCSD/atm/hist/
> f.e20.FCSD.cam.h0.2013-12.nc
> (0) 1.016496e-05
> (0) 3.577813e-09
>
> Variable: var_ann
> Type: float
> Total Size: 12386304 bytes
> 3096576 values
> Number of Dimensions: 3
> Dimensions and sizes: [lev | 56] x [lat | 192] x [lon | 288]
> Coordinates:
> lev: [1.867879997007549..992.5000106104562]
> lat: [ -90.. 90]
> lon: [ 0..358.75]
> Number Of Attributes: 5
> cell_methods : time: mean
> long_name : O3 concentration
> units : mol/mol
> mdims : 1
> average_op_ncl : dim_avg_n over dimension(s): time
>
> Variable: var_ann_flip
> Type: float
> Total Size: 12386304 bytes
> 3096576 values
> Number of Dimensions: 3
> Dimensions and sizes: [lev | 56] x [lat | 192] x [lon | 288]
> Coordinates:
> lev: [1.867879997007549..992.5000106104562]
> lat: [ -90.. 90]
> lon: [-180..178.75]
> Number Of Attributes: 6
> cell_methods : time: mean
> long_name : O3 concentration
> units : mol/mol
> mdims : 1
> average_op_ncl : dim_avg_n over dimension(s): time
> lonFlip : longitude coordinate variable has been reordered via
> lonFlip
>
> Variable: data
> Type: float
> Total Size: 2304 bytes
> 576 values
> Number of Dimensions: 2
> Dimensions and sizes: [3] x [192]
> Coordinates:
> Number Of Attributes: 1
> _FillValue : 9.96921e+36
> fatal:VarVarWrite: Number of dimensions on left hand side does not match
> right hand side
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 50 in
> file Timeser_annavg_O3CONOX.ncl
>
>
>
> *------------------------------------*
> *Najib Yusuf Galadanci PhD*
> *Assistant Director (R & D)*
>
> Lower Atmospheric Dynamics
>
> (Aerosol radiative forcing, air quality observations and modeling)
>
> Centre for Atmospheric Research
>
> National Space Research and Development Agency. Kogi State
>
> University Campus, Anyigba. Kogi State. Nigeria
>
> +234 80 3871 4158
> ------------------------------------
> *Know that Victory comes with Patience, *
> *Relief with Affliction, and Ease with Hardship.*
> *Prophet Muhammad Rasulullah (PBUH)*
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220609/ab1b992c/attachment.htm>
More information about the ncl-talk
mailing list