/[MITgcm]/MITgcm/pkg/cal/cal_addtime.F
ViewVC logotype

Diff of /MITgcm/pkg/cal/cal_addtime.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3 by dimitri, Mon Oct 20 06:25:16 2003 UTC revision 1.4 by heimbach, Mon Jul 26 23:24:11 2004 UTC
# Line 160  c             mi = mod(mi-1,nmonthyear)+ Line 160  c             mi = mod(mi-1,nmonthyear)+
160  c             if (switch .eq. 1) li = cal_IsLeap( yi, mythid )  c             if (switch .eq. 1) li = cal_IsLeap( yi, mythid )
161  c           enddo  c           enddo
162    
163  c     First take care of February 29  c     Set start value
164              ndays_left=ndays              ndays_left=ndays
165              if ( mi.eq.2 .and. di.eq.29 .and. ndays_left.gt.1 ) then  
166                 mi = 3  c     First take care of February 29
167                 di = 1              if ( usingGregorianCalendar ) then
168                 ndays_left = ndays_left - 1                 if ( mi.eq.2 .and. di.eq.29 .and. ndays_left.gt.1 ) then
169                      mi = 3
170                      di = 1
171                      ndays_left = ndays_left - 1
172                   endif
173              endif              endif
174    
175  c     Next compute year  c     Next compute year
176              days_in_year=365              days_in_year=ndaysnoleap
177              if ((mi.gt.2.and.cal_IsLeap(yi+1,mythid).eq.2).or.              if ((mi.gt.2.and.cal_IsLeap(yi+1,mythid).eq.2).or.
178       &           (mi.le.2.and.cal_IsLeap(yi,mythid).eq.2) )       &           (mi.le.2.and.cal_IsLeap(yi,mythid).eq.2) )
179       &           days_in_year=366       &           days_in_year=ndaysleap
180              do while (ndays_left .ge. days_in_year)              do while (ndays_left .ge. days_in_year)
181                 ndays_left = ndays_left - days_in_year                 ndays_left = ndays_left - days_in_year
182                 yi = yi + 1                 yi = yi + 1
183                 days_in_year=365                 days_in_year=ndaysnoleap
184                 if ((mi.gt.2.and.cal_IsLeap(yi+1,mythid).eq.2).or.                 if ((mi.gt.2.and.cal_IsLeap(yi+1,mythid).eq.2).or.
185       &              (mi.le.2.and.cal_IsLeap(yi,mythid).eq.2) )       &              (mi.le.2.and.cal_IsLeap(yi,mythid).eq.2) )
186       &              days_in_year=366       &              days_in_year=ndaysleap
187              enddo              enddo
188              li = cal_IsLeap( yi, mythid )              li = cal_IsLeap( yi, mythid )
189    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.22