# [ncl-talk] Calculating Weekly Totals at the End of Months

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Tue Aug 27 20:10:27 MDT 2019

```I suggest defining your own time intervals that are not coupled with the
artificial and badly behaved standard weeks in the civil calendar.  For
example, if you want to use 7 days or "weeks" as your standard grouping
interval, choose a standard day of year for start of season, such as
November 1.  Then step forward and make 7-day intervals for the desired
length of season.  These intervals will have better consistency for
meteorological analysis.

8-14, 15-21, etc.  Cross New Year at December 27 - January 2, then January
3-9, etc.  End with March 21-27 in normal years, and March 20-26 in leap
years.  Include the next interval into April if you think it is appropriate
for your application.  You can define the exact season start and end any
way you like.

But do not hard code all these dates.  Just hard code the starting fixed
day of year, then use an NCL date function to get the numeric time
coordinate for that date, for each year.  Then step forward along the
numeric time coordinates, in 7-day (or other length) intervals.

If your input data are daily and in regular fixed arrays for each season,
starting say with November 1, then you can skip the time coordinates and
step through by directly indexing positions 1-7, 8-14, etc. through end of
season, to get the equivalent of the above method of dividing up the time
line into 7-day intervals.

On Tue, Aug 27, 2019 at 6:32 PM Zach Rieck via ncl-talk <ncl-talk at ucar.edu>
wrote:

> To Whom it May Concern-
>
> I'm still really stuck, but have thought of a simpler way to (hopefully)
> address my issue. I have been pulling in data from the WRF and organizing
> it into winter seasons (Nov 1- Mar 31). I have then needed to convert that
> data into weekly totals and put that in a correlation plot with surface
> data.
>
> The problem with that is dealing with partial weeks both at the beginning
> of November and the end of March. I'm not sure if this is skewing my data
> (I would think it is at least partially). So my question is, what is the
> simplest, most correct way to deal with these partial weeks bookending the
> seasons so I can have a a weekly total? As of now, my code is just
> continuing on and adding every 7 points into a week for both the surface
> data and WRF.
>
> I'll attach my code here for your reference. I'll also attach my plot to
> show what it's doing to my scatter plot just in case you find anything else
> I can address to try to solve this issue.
>