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

Adams, Jennifer M. (GSFC-610.2)[ADNET SYSTEMS INC] jennifer.m.adams at nasa.gov
Mon Sep 21 09:29:51 EDT 2020


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-0001.html>


More information about the gradsusr mailing list