Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

(RESOLVED) Failing to read custom Landuse from LANDUSE.TBL - ARM Compiler

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

RobWaters

Member
Trying out WRF on ARM based AWS instances - ran into some unexpected behaviour.

Firstly, compilation has been completed and scenarios run successfully and compared against other compiler (GCC). All looks good when using a standard landuse dataset, e.g. USGS

The scenario that fails uses a custom landuse dataset which can be used successfully with GCC compiled WRF.

Also, worth noting that I'm using the same wrfinput netcdf files in both cases, from previously run scenarios on a different compiler. Would not have expected this to be an issue, though I may be wrong.

What is mainly confusing me is that the code in subroutine landuse_init (module_physics_init.F) is not even matching the string which has really left me scratching my head. Any ideas at all?

ARM compiled WRF
```
INPUT LandUse = "ESA_Globcover"
INPUT FILE FOR LANDUSE REACHED END OF FILE
LANDUSE IN INPUT FILE DOES NOT MATCH LUTABLE: TABLE NOT USED
```

GCC compiled WRF
```
INPUT LandUse = "ESA_Globcover"
LANDUSE TYPE = "ESA_Globcover" FOUND 23 CATEGORIES 2 SEASONS WATER CATEGORY = 21 SNOW CATEGORY = 22
Climatological albedo is used instead of table values

```
 
to give a bit more clarity ive edited to SUBROUTINE landuse_init as fools:

Code:
      call wrf_message ( 'INPUT LandUse = "' // TRIM(MMINLU) // '"' )
      FOUND_LU = .FALSE.
      end_of_file = .FALSE.
      CALL wrf_message( 'RW addition LandUse from input file = "' // MMINLU // '"' )
!!! BEGINNING OF 1999 LOOP
 1999 CONTINUE
      IF ( wrf_dm_on_monitor() ) THEN
        CALL wrf_message( 'RW addition - reading landuse message')
        READ (landuse_unit,*,END=2002)LUTYPE
        CALL wrf_message( 'RW addition - read LUTYPE = "' // LUTYPE // '"')
        GOTO 2003
 2002   CONTINUE
        CALL wrf_message( 'RW addition - read LUTYPE at eof = "' // LUTYPE // '"')
        CALL wrf_message( 'INPUT FILE FOR LANDUSE REACHED END OF FILE' )
        end_of_file = .TRUE.
 2003   CONTINUE
        IF ( .NOT. end_of_file ) READ (landuse_unit,*)LUCATS,LUSEAS
        WRITE ( lucats_str , * ) 'RW addition - read LUCATS = ',LUCATS
        CALL wrf_message( lucats_str )
        WRITE ( luseas_str , * ) 'RW addition - read LUSEAS = ',LUSEAS
        CALL wrf_message( luseas_str )
        FOUND_LU = LUTYPE.EQ.MMINLU
        WRITE ( found_lu_str , * ) 'RW addition - read FOUND_LU = ',FOUND_LU
        CALL wrf_message( found_lu_str )
      ENDIF

Results on the GCC compiled code

Code:
RW additions - test message to say inside landuse init
INPUT LandUse = "ESA_Globcover"
RW addition LandUse from input file = "ESA_Globcover"
RW addition - reading landuse message
RW addition - read LUTYPE = "OLD                                                                                                                                                                                 
 RW addition - read LUCATS =           13
 RW addition - read LUSEAS =            2
 RW addition - read FOUND_LU =  F
RW addition - reading landuse message
RW addition - read LUTYPE = "USGS                                                                                                                                                                                
 RW addition - read LUCATS =           33
 RW addition - read LUSEAS =            2
 RW addition - read FOUND_LU =  F
RW addition - reading landuse message
RW addition - read LUTYPE = "MODIFIED_IGBP_MODIS_NOAH                                                                                                                                                            
 RW addition - read LUCATS =           33
 RW addition - read LUSEAS =            2
 RW addition - read FOUND_LU =  F
RW addition - reading landuse message
RW addition - read LUTYPE = "SiB                                                                                                                                                                                 
 RW addition - read LUCATS =           16
 RW addition - read LUSEAS =            2
 RW addition - read FOUND_LU =  F
RW addition - reading landuse message
RW addition - read LUTYPE = "LW12                                                                                                                                                                                
 RW addition - read LUCATS =            3
 RW addition - read LUSEAS =            1
 RW addition - read FOUND_LU =  F
RW addition - reading landuse message
RW addition - read LUTYPE = "ESA_Globcover                                                                                                                                                                       
 RW addition - read LUCATS =           23
 RW addition - read LUSEAS =            2
 RW addition - read FOUND_LU =  T
 LANDUSE TYPE = "ESA_Globcover" FOUND          23  CATEGORIES           2  SEASONS WATER CATEGORY =           21  SNOW CATEGORY =           22
Climatological albedo is used instead of table values

Results on the ARM compiled code

Code:
RW additions - test message to say inside landuse init
INPUT LandUse = "ESA_Globcover"
RW addition LandUse from input file = "ESA_Globcover"
RW addition - reading landuse message
RW addition - read LUTYPE = "OLD^M                                                                                                                                                                               
 RW addition - read LUCATS =            13
 RW addition - read LUSEAS =             2
 RW addition - read FOUND_LU =   F
RW addition - reading landuse message
RW addition - read LUTYPE = "USGS^M                                                                                                                                                                              
 RW addition - read LUCATS =            33
 RW addition - read LUSEAS =             2
 RW addition - read FOUND_LU =   F
RW addition - reading landuse message
RW addition - read LUTYPE = "MODIFIED_IGBP_MODIS_NOAH^M                                                                                                                                                          
 RW addition - read LUCATS =            33
 RW addition - read LUSEAS =             2
 RW addition - read FOUND_LU =   F
RW addition - reading landuse message
RW addition - read LUTYPE = "SiB^M                                                                                                                                                                               
 RW addition - read LUCATS =            16
 RW addition - read LUSEAS =             2
 RW addition - read FOUND_LU =   F
RW addition - reading landuse message
RW addition - read LUTYPE = "LW12                                                                                                                                                                                
 RW addition - read LUCATS =             3
 RW addition - read LUSEAS =             1
 RW addition - read FOUND_LU =   F
RW addition - reading landuse message
RW addition - read LUTYPE = "ESA_Globcover^M                                                                                                                                                                     
 RW addition - read LUCATS =            23
 RW addition - read LUSEAS =             2
 RW addition - read FOUND_LU =   F
RW addition - reading landuse message
RW addition - read LUTYPE = "LCDB2^M                                                                                                                                                                             
 RW addition - read LUCATS =            42
 RW addition - read LUSEAS =             2
 RW addition - read FOUND_LU =   F
RW addition - reading landuse message
RW addition - read LUTYPE at eof = "LCDB2^M                                                                                                                                                                      
INPUT FILE FOR LANDUSE REACHED END OF FILE
 RW addition - read LUCATS =            42
 RW addition - read LUSEAS =             2
 RW addition - read FOUND_LU =   F
LANDUSE IN INPUT FILE DOES NOT MATCH LUTABLE: TABLE NOT USED
 
Had no idea about these issues with new line - learn something new everyday...

Looks like the LANDUSE.TBL i am using was either created on MAC or DOS.

Solution is to:
sed s/.$// LANDUSE.TBL >LANDUSE.TBL2

And then obv replace LANDUSE.TBL with the new one

Answer from here:
https://unix.stackexchange.com/questions/32001/what-is-m-and-how-do-i-get-rid-of-it
 
Hi,
I'm so glad to see that you were able to solve this issue before we were able to get to you! Thank you so much for updating the post so that this may help others in the future. It's certainly an interesting issue.
 
Top