[gradsusr] Q time in 2021 returns ??? for the day

Brian Gaze brianw.gaze at googlemail.com
Mon Sep 21 12:01:50 EDT 2020


Hi Jennifer,

Thanks for confirming the issue.

Will the update require a new build of GrADS or will it be possible to
overwrite one of the  libraries / scripts in an existing install of GrADS
and Open GrADS (I use both)?

As an interim I've written a function using Zeller's congruence to get the
day of the week when ??? is returned by q time.

I'm still testing and it is quite clunky so I won't post here. However, if
anyone gets stuck I'm happy to try and help.

Thanks

Brian


On Mon, 21 Sep 2020 at 14:34, <gradsusr-request at gradsusr.org> wrote:

> Send gradsusr mailing list submissions to
>         gradsusr at gradsusr.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://gradsusr.org/mailman/listinfo/gradsusr
> or, via email, send a message with subject or body 'help' to
>         gradsusr-request at gradsusr.org
>
> You can reach the person managing the list at
>         gradsusr-owner at gradsusr.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of gradsusr digest..."
>
>
> Today's Topics:
>
>    1. display values in a script (Frank Colby)
>    2. Re: display values in a script (James T. Potemra)
>    3. Re: [EXTERNAL]  Q time in 2021 returns ??? for the day
>       (Adams, Jennifer M. (GSFC-610.2)[ADNET SYSTEMS INC])
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 20 Sep 2020 13:10:03 -0400
> From: Frank Colby <Frank_Colby at uml.edu>
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Subject: [gradsusr] display values in a script
> Message-ID: <aaa52185-47c4-95f3-f918-e1d0b9e64c64 at uml.edu>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> Dear GradUsers,
>
> I can open a file, set latitude and longitude and time, and display a
> variable.? The value of the variable displays in the command window.
>
> If I try this in a script, it displays nothing.
>
> Does anyone know why this is?? The script is below.
>
> Thanks,
> Frank Colby
> UMass Lowell
>
> *********************Script
> 'set mpdset hires'
> filen = 20100219
>  ? latt = 42.361
>  ? lont = -071.010
> * All times in one file 'set t ' t1
> say 'ERA5-'filen'-s2.nc'
> 'sdfopen ERA5-'filen'-s2.nc'
> *
> 'set lat 'latt
> 'set lon 'lont
> *
> t1=1
> t2=24
> while (t1<=t2)
> 'set t ' t1
> 'd 'sp
> *
> say t1
> say '<enter>=next, q=quit, b=back, t<enter>n<enter>=n-th step'
> say 'i to create an image'
> pull ans
> *
> if (ans ="q"); break; endif;
> if (ans = "b")
>  ? t1 = t1 -2
> endif
> if (ans = "t"); say 'Time step =';pull num;
>  ? if (num > t2); say 'Timestep too high!'; num=t2-1; endif;
>  ? t1 = num - 1
> endif
> *
> t1 = t1 + 1
> 'c'
> endwhile
> 'reinit'
>
>
>
> ------------------------------
>
> Message: 2
> Date: Sun, 20 Sep 2020 16:06:40 -1000
> From: "James T. Potemra" <jimp at hawaii.edu>
> To: GrADS Users Forum <gradsusr at gradsusr.org>, Frank Colby
>         <Frank_Colby at uml.edu>
> Subject: Re: [gradsusr] display values in a script
> Message-ID: <66df65db-03f0-f173-fb80-04efd0161cf7 at hawaii.edu>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> Hi Frank,
>
> In a script you'll have to explicitly print the output, so right after
>
> 'd 'sp
>
> add
>
> say result
>
> Jim
>
> On 9/20/20 7:10 AM, Frank Colby wrote:
> > Dear GradUsers,
> >
> > I can open a file, set latitude and longitude and time, and display a
> > variable.? The value of the variable displays in the command window.
> >
> > If I try this in a script, it displays nothing.
> >
> > Does anyone know why this is?? The script is below.
> >
> > Thanks,
> > Frank Colby
> > UMass Lowell
> >
> > *********************Script
> > 'set mpdset hires'
> > filen = 20100219
> > ? latt = 42.361
> > ? lont = -071.010
> > * All times in one file 'set t ' t1
> > say 'ERA5-'filen'-s2.nc'
> > 'sdfopen ERA5-'filen'-s2.nc'
> > *
> > 'set lat 'latt
> > 'set lon 'lont
> > *
> > t1=1
> > t2=24
> > while (t1<=t2)
> > 'set t ' t1
> > 'd 'sp
> > *
> > say t1
> > say '<enter>=next, q=quit, b=back, t<enter>n<enter>=n-th step'
> > say 'i to create an image'
> > pull ans
> > *
> > if (ans ="q"); break; endif;
> > if (ans = "b")
> > ? t1 = t1 -2
> > endif
> > if (ans = "t"); say 'Time step =';pull num;
> > ? if (num > t2); say 'Timestep too high!'; num=t2-1; endif;
> > ? t1 = num - 1
> > endif
> > *
> > t1 = t1 + 1
> > 'c'
> > endwhile
> > 'reinit'
> >
> > _______________________________________________
> > gradsusr mailing list
> > gradsusr at gradsusr.org
> > http://gradsusr.org/mailman/listinfo/gradsusr
>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 21 Sep 2020 13:29:51 +0000
> From: "Adams, Jennifer M. (GSFC-610.2)[ADNET SYSTEMS INC]"
>         <jennifer.m.adams at nasa.gov>
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Subject: Re: [gradsusr] [EXTERNAL]  Q time in 2021 returns ??? for the
>         day
> Message-ID: <AEA487EE-C1BE-4F31-9A61-FEF262A799E2 at nasa.gov>
> Content-Type: text/plain; charset="utf-8"
>
> Hi, Brian ?
> Good catch! That routine to calculate the day of the week has hard-coded
> years in it:
>
> /* Return day of week for date/time  0=sunday, 6=saturday */
> gaint dayweek (struct dt *dtime) {
> struct dt anch;
> gaint i,j;
>   if (dtime->yr<1950 || dtime->yr>2020) return(7);
>   anch.yr = 1950;
>   anch.mo = 1;
>   anch.dy = 1;
>   anch.hr = 0;
>   anch.mn = 0;
>   i = timdif(&anch,dtime,0);
>   i = i/1440;
>   j = i/7;
>   i = i - j*7;
>   return(i);
> }
>
> When year is outside this arbitrary window, it returns ?7?, which is the
> array index for this set of strings for the day of the week:
>
> char *dweek[8] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat","???"};
>
> I will have to update this in the source code.
> --Jennifer
>
>
>
> --
> Jennifer Miletta Adams
> ADNET Systems, Inc.
> NASA/GSFC, Code 610.2
> Building 32, Room S159
> (301) 614-6070
>
>
> From: gradsusr <gradsusr-bounces at gradsusr.org> on behalf of Brian Gaze <
> brianw.gaze at googlemail.com>
> Reply-To: GrADS Users Forum <gradsusr at gradsusr.org>
> Date: Sunday, September 20, 2020 at 7:12 AM
> To: "gradsusr at gradsusr.org" <gradsusr at gradsusr.org>
> Subject: [EXTERNAL] [gradsusr] Q time in 2021 returns ??? for the day
>
> Hi,
>
> When doing a q time on a ctl file which contains the following line a
> string containing the DAY (e.g. SUN) is returned as expected:
>
> tdef 1 linear 18Z20dec2020 1mo
>
> However, when doing a q time on ctl files which are for a date in 2021 (as
> below) the DAY returned is ???
>
> tdef 1 linear 06Z04jan2021 1mo
>
> The month, year and time are returned correctly in both cases. It is only
> a problem with the DAY part of the string.
>
> I have experienced this behaviour with GrADS 2.2.0 on Ubuntu and Open
> GrADS v2.1.a2.oga.1 on Windows Server 2016.
>
> Does anyone know the reason for this?
>
> PS: If necessary I can post both ctl files in full.
>
> Thanks
>
> Brian
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://gradsusr.org/pipermail/gradsusr/attachments/20200921/125bf083/attachment.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
> ------------------------------
>
> End of gradsusr Digest, Vol 127, Issue 15
> *****************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20200921/a1093102/attachment.html>


More information about the gradsusr mailing list