Save the Average file with numbers.

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
vivek
Posts: 27
Joined: Tue Oct 20, 2015 1:40 pm
Location: IISc (Indian Institute of Science)

Save the Average file with numbers.

#1 Unread post by vivek »

Dear All,

I have to save the average file daily,like " ocean_avg_ia_9997.nc " upto " ocean_avg_ia_9999.nc " its save fine. But when its " 10000 " number, its save like "ocean_avg_ia_****.nc ". please any body help me how can i save like ocean_avg_ia_100000.nc, ocean_avg_ia_10001.nc etc...

where should i have to change...

User avatar
kate
Posts: 4089
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Save the Average file with numbers.

#2 Unread post by kate »

Hah, I know this one because my branch already has it. In output.F:

Code: Select all

diff --git a/ROMS/Nonlinear/output.F b/ROMS/Nonlinear/output.F
index e4fb854..42ff7a8 100644
--- a/ROMS/Nonlinear/output.F
+++ b/ROMS/Nonlinear/output.F
@@ -1,4 +1,5 @@
 #include "cppdefs.h"
+#define LONG_NUMS
 #ifdef NONLINEAR
       SUBROUTINE output (ng)
 !
@@ -111,7 +119,11 @@
             ifile=(iic(ng)-1)/ndefHIS(ng)+1
             IF (Master) THEN
               WRITE (HIS(ng)%name,10) TRIM(HIS(ng)%base), ifile
+#ifdef LONG_NUMS
+  10          FORMAT (a,'_',i5.5,'.nc')
+#else
   10          FORMAT (a,'_',i4.4,'.nc')
+#endif
             END IF
 # ifdef DISTRIBUTE
             CALL mp_bcasts (ng, iNLM, HIS(ng)%name)
@@ -196,8 +209,13 @@
             QCK(ng)%Nrec(Fcount)=0
             ifile=(iic(ng)-1)/ndefQCK(ng)+1
             IF (Master) THEN
-              WRITE (QCK(ng)%name,10) TRIM(QCK(ng)%base), ifile
+              WRITE (QCK(ng)%name,12) TRIM(QCK(ng)%base), ifile
             END IF
+#ifdef LONG_NUMS
+  12          FORMAT (a,'_',i5.5,'.nc')
+#else
+  12          FORMAT (a,'_',i4.4,'.nc')
+#endif
 # ifdef DISTRIBUTE
             CALL mp_bcasts (ng, iNLM, QCK(ng)%name)
 # endif
@@ -290,7 +308,11 @@
             END IF
             IF (Master) THEN
               WRITE (AVG(ng)%name,20) TRIM(AVG(ng)%base), ifile
+#ifdef LONG_NUMS
+  20          FORMAT (a,'_',i5.5,'.nc')
+#else
   20          FORMAT (a,'_',i4.4,'.nc')
+#endif
             END IF
 #  ifdef DISTRIBUTE
             CALL mp_bcasts (ng, iNLM, AVG(ng)%name)
@@ -376,7 +483,11 @@
             END IF
             IF (Master) THEN
               WRITE (DIA(ng)%name,30) TRIM(DIA(ng)%base), ifile
+#ifdef LONG_NUMS
+  30          FORMAT (a,'_',i5.5,'.nc')
+#else
   30          FORMAT (a,'_',i4.4,'.nc')
+#endif
             END IF
 #  ifdef DISTRIBUTE
             CALL mp_bcasts (ng, iNLM, DIA(ng)%name)
Clear as mud?

Post Reply