<div dir="ltr"><div dir="ltr">Hi,<br></div><div dir="ltr"><br></div><div>I've attached the script I wrote to handle this. Just pass in the day of the month, month and year which are returned from the grib.</div><div><br></div><div>Use this script entirely at your own risk as I've not had chance to:</div><div><br></div><div>1) Formally test</div><div>2) Clean up and improve the naming convention</div><div><br></div><div>However, it seems to work without problems for me. </div><div><br></div><div>BWG</div><div><br></div><div><br></div><div><br></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 22 Dec 2020 at 17:45, <<a href="mailto:gradsusr-request@gradsusr.org">gradsusr-request@gradsusr.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Send gradsusr mailing list submissions to<br>
        <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:gradsusr-request@gradsusr.org" target="_blank">gradsusr-request@gradsusr.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:gradsusr-owner@gradsusr.org" target="_blank">gradsusr-owner@gradsusr.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of gradsusr digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Re: Date Issue for the DAY 2021 (L.B.)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Tue, 22 Dec 2020 12:41:20 -0500<br>
From: "L.B." <<a href="mailto:bcbass2989@gmail.com" target="_blank">bcbass2989@gmail.com</a>><br>
To: GrADS Users Forum <<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a>><br>
Subject: Re: [gradsusr] Date Issue for the DAY 2021<br>
Message-ID:<br>
        <CAM1sYav6Y_Sm_7YKW=<a href="mailto:qigme%2B7r7EwVKX0hVAtCG_MTaeHxqJWA@mail.gmail.com" target="_blank">qigme+7r7EwVKX0hVAtCG_MTaeHxqJWA@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Stuart,<br>
<br>
After breaking down the month into a numerical value as you did, use that<br>
along with the day and current year into a function as such:<br>
<br>
if (month < 3)<br>
  month = month + 12<br>
  year = year -1<br>
endif<br>
<br>
dow = math_mod(day + math_int((13*(month+1))/5) + year + math_int(year/4) -<br>
math_int(year/100) + math_int(year/400),7)<br>
<br>
from here, the value 0 is Saturday, 1 is Sunday...6 is Friday<br>
<br>
*-------*<br>
William (L.B.) LaForce IV<br>
Meteorologist<br>
<br>
<br>
On Tue, Dec 22, 2020 at 11:28 AM CW Weather <<a href="mailto:weatherstu@chorleyweather.com" target="_blank">weatherstu@chorleyweather.com</a>><br>
wrote:<br>
<br>
> Hi Miquel,<br>
><br>
><br>
> Using similar with substring but how would I integrate that<br>
> with this code. I've tried Ryan's function but it is throwing an error up<br>
> somewhere and i've yet to find it. Thanks in advance. And thanks to Ryan as<br>
> well.<br>
><br>
> regards,<br>
><br>
> Stuart.<br>
><br>
><br>
> 'query time'<br>
> time = subwrd(result,3)<br>
> day = subwrd(result,6)<br>
> datestr = subwrd (result, 3)<br>
> if (substr (datestr, 3, 1) = 'Z') ; zptr = 3 ; ;else ; zptr = 6 ; endif ;<br>
> timestr = substr (datestr, 1, 2)<br>
> date = substr (datestr, zptr+1, 99)<br>
> dd = substr (date, 1, 2)<br>
> mmm = substr (date, 3, 3)<br>
> yyyy = substr (date, 6, 4)<br>
><br>
> if (mmm = 'JAN') ; mm = 01 ; endif<br>
> if (mmm = 'FEB') ; mm = 02 ; endif<br>
> if (mmm = 'MAR') ; mm = 03 ; endif<br>
> if (mmm = 'APR') ; mm = 04 ; endif<br>
> if (mmm = 'MAY') ; mm = 05 ; endif<br>
> if (mmm = 'JUN') ; mm = 06 ; endif<br>
> if (mmm = 'JUL') ; mm = 07 ; endif<br>
> if (mmm = 'AUG') ; mm = 08 ; endif<br>
> if (mmm = 'SEP') ; mm = 09 ; endif<br>
> if (mmm = 'OCT') ; mm = 10 ; endif<br>
> if (mmm = 'NOV') ; mm = 11 ; endif<br>
> if (mmm = 'DEC') ; mm = 12 ; endif<br>
><br>
> date = day' 'dd'/'mm' 'timestr':00'<br>
><br>
><br>
><br>
><br>
><br>
> On 22-12-2020 16:01, Miquel Bernis wrote:<br>
><br>
> I'm dealing with the same problem. Using substr() you can split day (d),<br>
> month (m), and year (y), and after that this algorithm looks like works for<br>
> me. Returns 0 for a Sunday and up to 6 for a Saturday.<br>
><br>
> arrayDOW.0=0<br>
> arrayDOW.1=3<br>
> arrayDOW.2=2<br>
> arrayDOW.3=5<br>
> arrayDOW.4=0<br>
> arrayDOW.5=3<br>
> arrayDOW.6=5<br>
> arrayDOW.7=1<br>
> arrayDOW.8=4<br>
> arrayDOW.9=6<br>
> arrayDOW.10=2<br>
> arrayDOW.11=4<br>
><br>
> if (m<3)<br>
> y=y-1<br>
> endif<br>
><br>
> parm=m-1<br>
> dofweek = math_mod((y + math_int(y/4) - math_int(y/100) + math_int(y/400)<br>
> + arrayDOW.parm + d),7)<br>
><br>
> Missatge de CW Weather <<a href="mailto:weatherstu@chorleyweather.com" target="_blank">weatherstu@chorleyweather.com</a>> del dia dt., 22 de<br>
> des. 2020 a les 8:07:<br>
><br>
>> Hello Users,<br>
>><br>
>><br>
>> I know this subject has been covered recently with an issue with the date<br>
>> for 2021, with the DAY returning '???'. Is there a suitable work around on<br>
>> this for both grads and opengrads users? I know there is a work around with<br>
>> some of you implementing Zeller's congruence but alas I have no idea how<br>
>> to code or where to code it to.<br>
>><br>
>><br>
>> Any help on the matter would be greatly apricated.<br>
>> --<br>
>><br>
>> Kind regards,<br>
>><br>
>> *Stuart Markham*<br>
>><br>
>> *Founder of CW Weather*<br>
>><br>
>> *Website: <a href="http://chorleyweather.com" rel="noreferrer" target="_blank">chorleyweather.com</a> <<a href="https://www.chorleyweather.com/" rel="noreferrer" target="_blank">https://www.chorleyweather.com/</a>>*<br>
>> _______________________________________________<br>
>> gradsusr mailing list<br>
>> <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
>> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
><br>
><br>
> _______________________________________________<br>
> gradsusr mailing list<br>
> <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
><br>
><br>
> --<br>
><br>
> Kind regards,<br>
><br>
> *Stuart Markham*<br>
><br>
> *Founder of CW Weather*<br>
><br>
> *Website: <a href="http://chorleyweather.com" rel="noreferrer" target="_blank">chorleyweather.com</a> <<a href="https://www.chorleyweather.com/" rel="noreferrer" target="_blank">https://www.chorleyweather.com/</a>>*<br>
> _______________________________________________<br>
> gradsusr mailing list<br>
> <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://gradsusr.org/pipermail/gradsusr/attachments/20201222/547a9dc2/attachment.html" rel="noreferrer" target="_blank">http://gradsusr.org/pipermail/gradsusr/attachments/20201222/547a9dc2/attachment.html</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: 6b66f0ed.png<br>
Type: image/png<br>
Size: 11158 bytes<br>
Desc: not available<br>
URL: <<a href="http://gradsusr.org/pipermail/gradsusr/attachments/20201222/547a9dc2/attachment.png" rel="noreferrer" target="_blank">http://gradsusr.org/pipermail/gradsusr/attachments/20201222/547a9dc2/attachment.png</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: 6b66f0ed.png<br>
Type: image/png<br>
Size: 11158 bytes<br>
Desc: not available<br>
URL: <<a href="http://gradsusr.org/pipermail/gradsusr/attachments/20201222/547a9dc2/attachment-0001.png" rel="noreferrer" target="_blank">http://gradsusr.org/pipermail/gradsusr/attachments/20201222/547a9dc2/attachment-0001.png</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br>
<br>
------------------------------<br>
<br>
End of gradsusr Digest, Vol 130, Issue 19<br>
*****************************************<br>
</blockquote></div></div>