Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check Weather Method and RUNMODE for existing weather files (IPEXP subroutine) #215

Open
fabiooliveira72 opened this issue Mar 8, 2022 · 0 comments
Assignees

Comments

@fabiooliveira72
Copy link
Contributor

This issue happened when Sequence mode run without .CLI file, the model tried to open the .WTH file. The IPEXP subroutine has a section that build the weather file name based on the weather station on the FileX. However, there is a conflict that is causing error when running WGEN subroutines.

Another subroutine could be created to split each run mode and type of weather file to avoid conflict between different types of runs for the CSM.

The code below indicates what need to be checked:

!     Generated weather data files
      IF (MEWTH .EQ. 'G') THEN
         IF (WSTA1(4:4) .EQ. BLANK) THEN
            IF (YEAR .LT. 2000) THEN
              YR = YEAR - 1900
            ELSE IF (YEAR .LT. 3000) THEN
              YR = YEAR - 2000
            ENDIF
            WRITE (FILEWG(1:12),75) WSTA,YR,'01.WTG'
         ELSE
            WRITE (FILEWG(1:12),76) WSTA,WSTA1,'.WTG'
         ENDIF
         PROCODG = 'WGD'
      ENDIF
!     Interactively generated weather 
      IF (MEWTH .EQ. 'S' .OR. MEWTH .EQ. 'W') THEN
         WRITE (FILEWC(1:12),77) WSTA,'.CLI    '
         PROCODC = 'CLD'
      ENDIF
!     Measured weather data
      IF (MEWTH .EQ. 'M' .OR. RNMODE .EQ. 'Y') THEN
         IF (WSTA1(4:4) .EQ. BLANK) THEN
           IF (YEAR .LT. 2000) THEN
             YR = YEAR - 1900
           ELSE IF (YEAR .LT. 3000) THEN
             YR = YEAR - 2000
           ENDIF
           WRITE (FILEW(1:12),75) WSTA,YR,'01.WTH'
         ELSE
            WRITE(FILEW(1:12),76) WSTA,WSTA1,'.WTH'
         ENDIF
         PROCODW = 'WED'
      ENDIF
      IF (INDEX('GSWM',RNMODE) .LT. 0) THEN
         CALL ERROR (ERRKEY,22,FILEX,LINEXP)
      ENDIF

!     Check for existing FILEW, FILEWC, and FILEWG
      DO I = 1, 3
        SELECT CASE (I)
          CASE (1)
            IF (MEWTH .EQ. 'M' .OR. RNMODE .EQ. 'Y') THEN
              FILE_CHECK = FILEW
              PROCOD = PROCODW
            ELSE
              CYCLE
            ENDIF
          CASE (2)
            IF (MEWTH .EQ. 'G') THEN
              FILE_CHECK = FILEWG
              PROCOD = PROCODG
            ELSE
              CYCLE
            ENDIF
          CASE (3)
            IF (MEWTH .EQ. 'S' .OR. MEWTH .EQ. 'W') THEN
              FILE_CHECK = FILEWC
              PROCOD = PROCODC
            ELSE
              CYCLE
            ENDIF
          CASE DEFAULT; CYCLE
        END SELECT
@fabiooliveira72 fabiooliveira72 self-assigned this Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant