| 1 |
C $Header: /u/gcmpack/MITgcm/pkg/profiles/profiles_ini_io.F,v 1.3 2017/01/10 15:40:59 gforget Exp $ |
| 2 |
C $Name: $ |
| 3 |
|
| 4 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 5 |
|
| 6 |
#include "PROFILES_OPTIONS.h" |
| 7 |
|
| 8 |
CBOP |
| 9 |
C !ROUTINE: PROFILES_INI_IO |
| 10 |
C !INTERFACE: |
| 11 |
SUBROUTINE PROFILES_INI_IO( myThid ) |
| 12 |
|
| 13 |
C !DESCRIPTION: \bv |
| 14 |
C *================================================================== |
| 15 |
C | S/R PROFILES_INI_IO |
| 16 |
C | o create directory for profiles output if needed |
| 17 |
C *================================================================== |
| 18 |
C \ev |
| 19 |
|
| 20 |
IMPLICIT NONE |
| 21 |
#include "SIZE.h" |
| 22 |
#include "EEPARAMS.h" |
| 23 |
#include "EESUPPORT.h" |
| 24 |
#include "PARAMS.h" |
| 25 |
#include "PROFILES_SIZE.h" |
| 26 |
#include "profiles.h" |
| 27 |
|
| 28 |
C !INPUT/OUTPUT PARAMETERS: |
| 29 |
C myThid - Number of this instances |
| 30 |
INTEGER myThid |
| 31 |
|
| 32 |
C !FUNCTIONS |
| 33 |
INTEGER ILNBLNK |
| 34 |
EXTERNAL ILNBLNK |
| 35 |
|
| 36 |
C !LOCAL VARIABLES: |
| 37 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
| 38 |
CHARACTER*(MAX_LEN_FNAM) namBuf |
| 39 |
INTEGER iL, pIL |
| 40 |
CEOP |
| 41 |
|
| 42 |
_BEGIN_MASTER( myThid ) |
| 43 |
|
| 44 |
IF ( profilesDir .NE. ' ' ) THEN |
| 45 |
iL = ILNBLNK( profilesDir ) |
| 46 |
C append "/", if necessary |
| 47 |
IF ( iL.LT.MAX_LEN_FNAM .AND. profilesDir(iL:iL).NE.'/' ) THEN |
| 48 |
namBuf(1:iL) = profilesDir(1:iL) |
| 49 |
WRITE(profilesDir(1:iL+1),'(2A)') namBuf(1:iL),'/' |
| 50 |
ENDIF |
| 51 |
#ifdef HAVE_SYSTEM |
| 52 |
C create directory |
| 53 |
iL = ILNBLNK( profilesDir ) -1 |
| 54 |
WRITE(namBuf,'(2A)') ' mkdir -p ', profilesDir(1:iL) |
| 55 |
pIL = 1 + ILNBLNK( namBuf ) |
| 56 |
WRITE(msgBuf,'(3A)') |
| 57 |
& '==> SYSTEM CALL (from PROFILES_INI_IO): >',namBuf(1:pIL),'<' |
| 58 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
| 59 |
& SQUEEZE_RIGHT, myThid ) |
| 60 |
CALL SYSTEM( namBuf(1:pIL) ) |
| 61 |
#else |
| 62 |
WRITE(msgBuf,'(2A)') '** WARNING ** PROFILES_INI_IO: cannot ', |
| 63 |
& 'call mkdir -> please create profilesDir manually' |
| 64 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
| 65 |
& SQUEEZE_RIGHT, myThid ) |
| 66 |
#endif |
| 67 |
ENDIF |
| 68 |
|
| 69 |
_END_MASTER( myThid ) |
| 70 |
|
| 71 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 72 |
|
| 73 |
RETURN |
| 74 |
END |