[ncl-talk] problem dimension size when reading in files - a bug in NCL6.5?
Dennis Shea
shea at ucar.edu
Fri Aug 2 08:27:00 MDT 2019
The code snipprt you posted:
4 do i=0,dimsizes(years)-1
5 dir_s ="/work/as10017/CESM/archive/Data_ICEFREE/Grid_all/"
6 dir_c ="/work/as10017/SPS_hindcast/Control_of_ICEFREE/Grid_all/"
7 fil_s1 = systemfunc("ls
"+dir_s+"/sps_"+years(i)+"11_0??_icef.cam.h0.6mth_grid.all.nc_"+Field+"_BK_avg")
; "+years(i)+"
8 fil_c1 = systemfunc("ls
"+dir_c+"/sps_"+years(i)+"11_0??.cam.h0.6mth_grid.all.nc_"+Field+"_BK_avg")
; "+years(i)+"
9 f_s1 = addfiles(fil_s1,"r")
10 f_c1 = addfiles(fil_c1, "r")
11
12 if (VAR.eq.1)
13 varS = f_s1[:]->ICEFRAC(:,0,0)
14 varC = f_c1[:]->ICEFRAC(:,0,0)
15
16 end if
and code you attached are different. Maybe:
4 do i=0,dimsizes(years)-1
5 dir_s ="/work/as10017/CESM/archive/Data_ICEFREE/Grid_all/"
6 dir_c ="/work/as10017/SPS_hindcast/Control_of_ICEFREE/Grid_all/"
7 fil_s1 = systemfunc("ls
"+dir_s+"/sps_"+years(i)+"11_0??_icef.cam.h0.6mth_grid.all.nc_"+Field+"_BK_avg")
; "+years(i)+"
8 fil_c1 = systemfunc("ls
"+dir_c+"/sps_"+years(i)+"11_0??.cam.h0.6mth_grid.all.nc_"+Field+"_BK_avg")
; "+years(i)+"
9 f_s1 = addfiles(fil_s1,"r")
10 f_c1 = addfiles(fil_c1, "r")
11
12 if (VAR.eq.1)
13 varS = f_s1[:]->ICEFRAC(:,0,0)
14 varC = f_c1[:]->ICEFRAC(:,0,0)
15 *end if*
16 *end do*
On Fri, Aug 2, 2019 at 4:11 AM Anne via ncl-talk <ncl-talk at ucar.edu> wrote:
> Hi,
>
> I want to read in and append multiple files using NCL's 'systemfunc'
> function, like so:
>
> 1 VAR = 1 ; 1-ICE 2-T2M 3-SHF 4-Z500 5-U250
> 2 Field = "ICE"
> 3
> 4 do i=0,dimsizes(years)-1
> 5 dir_s ="/work/as10017/CESM/archive/Data_ICEFREE/Grid_all/"
> 6 dir_c
> ="/work/as10017/SPS_hindcast/Control_of_ICEFREE/Grid_all/"
> 7 fil_s1 = systemfunc("ls
> "+dir_s+"/sps_"+years(i)+"11_0??_icef.cam.h0.6mth_grid.all.nc_"+Field+"_BK_avg")
> ; "+years(i)+"
> 8 fil_c1 = systemfunc("ls
> "+dir_c+"/sps_"+years(i)+"11_0??.cam.h0.6mth_grid.all.nc_"+Field+"_BK_avg")
> ; "+years(i)+"
> 9 f_s1 = addfiles(fil_s1,"r")
> 10 f_c1 = addfiles(fil_c1, "r")
> 11
> 12 if (VAR.eq.1)
> 13 varS = f_s1[:]->ICEFRAC(:,0,0)
> 14 varC = f_c1[:]->ICEFRAC(:,0,0)
> 15
> 16 end if
>
> I have run this script one million times before, all of a sudden NCL
> complains 'Dimension sizes of left hand side and right hand side of
> assignment do not match' in line 7 above (where fil_s1 is defined for the
> first time) but I have not defined this variable anywhere before as it's
> really the beginning of the script.. Interestingly, this error message
> disappears when I comment 'end' at the end of the script and also
> apparently it depends where I insert 'exit' for testing the script.. Could
> there be a bug in NCL 6.5 ? I attach the full script. I'm running NCL 6.5.
>
> Thanks
> Anne
>
> Nota automatica aggiunta dal sistema di posta.
> _______________________________________________
> 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/20190802/0fec53a4/attachment.html>
More information about the ncl-talk
mailing list