[ncl-talk] Problems reading monthly files with systemfunc
Rick Brownrigg
brownrig at ucar.edu
Tue Apr 23 07:42:09 MDT 2019
Hi,
NCL is strongly typed in the sense that once a variable is defined with
certain dimensionality, that becomes part of its "type". The solution is to
use the "re-assign" operator:
file1 := systemfunc(....)
which is short-hand for
delete(file1)
file1 = systemfunc(...)
Rick
On Tue, Apr 23, 2019 at 7:39 AM <adriana.bossolasco at cnrs-orleans.fr> wrote:
> Hi Everyone
>
> I have a problem for read monthly files with systemfunc
> I know that the problem is because the first month that I read is JUN
> which have 30 days and the when I try to read JUL with 31 days my code
> says:
>
> fatal:Dimension sizes of left hand side and right hand side of
> assignment do not match
>
> How can I fix this? Maybe is very basic but I don't realize
>
> I copy my code here
>
> begin
> ;************************************************
> ; variable and file handling
> ;************************************************
>
>
> year1=2001
> year2=2002
> nyear=year2-year1
> print(nyear)
> month1=6
> month2=8
> nmonths=month2-month1
>
> do i = 1,nyear
> do j = 1,nmonths
> print(nmonths)
> print(nyear)
> if (month1+j-1 .ge. 10) then
> mois=10
> else
> mois="0"+(j-1+month1) ;
> end if
> print(mois)
>
> file1 = systemfunc(" ls
>
> /PROJETS/MOUSSON-NEW/MAM_GEOS_8y_rest/MAM_GEOS_8y_rest.cam.h0.200"+i+"-"+mois+"*-
> 43200.nc")
> print(file1)
>
> end do
> end do
>
> end
>
>
> --
> Adriana Bossolasco
> LPC2E UMR 7328 (CNRS, Université d'Orléans)
> 3A avenue de la Recherche Scientifique
> 45071 Orléans Cedex 2 - FRANCE
> Tel +33 (0)2 38 25 52 85
> e-mail: adriana.bossolasco at cnrs-orleans.fr
> _______________________________________________
> 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/20190423/5061b43c/attachment.html>
More information about the ncl-talk
mailing list