Opened 5 years ago

Last modified 4 years ago

#238 new Defect

Inconsistency when shifting longitudes?

Reported by: ahilboll Owned by:
Priority: major Milestone:
Component: FP coding/compilation Version: FLEXPART 10.3
Keywords: Cc:

Description

I'm looking at how longitudes are being handled by FLEXPART, and I think I found a problem. In many places, the longitudes are being shifted left by 360 degrees, when the they are > 180°:

    if (xaux1.gt.180.) xaux1=xaux1-360.0

I believe that almost everywhere this should happen when the longitude is >= 180°: The logic seems to be that the longitudes have to be between -180..180 degrees. Therefore, any longitude except for the rightmost one should be < 180°.

How did I come across this? I'm trying to use hemispheric (i.e., with longitudes from -180..180°) ERA5 data, and for some strange reason which I don't understand,

    call grib_get_real8(igrib,'longitudeOfFirstGridPointInDegrees', &                                                                                               
         xaux1in,iret)                                                                                                                                              

in gridcheck_ecmwf.f90 returned 180.0 instead of -180.0 into xaux1in, which lead to the grid being shifted right by 360° because of the >180 check:

 Mother domain:
  Longitude range:  180.00000 to  540.00000   Grid distance:    0.25000
  Latitude range :    0.00000 to   90.00000   Grid distance:    0.25000

   0.00000000       0.00000000
   540.000000       90.0000000       180.000000       0.00000000       720.000000       180.000000      0.500000000      0.500000000
  #### FLEXPART MODEL ERROR! PART OF OUTPUT    ####
  #### GRID IS OUTSIDE MODEL DOMAIN. CHANGE    ####
  #### FILE OUTGRID IN DIRECTORY               ####

After changing all instances of ...gt.180.0 to ...ge.180.0 in the code (except for where it's explicitly being the right edge of the domain that is being checked), gridcheck correctly gives the longitude range as -180..180 degrees:

 Mother domain:   
  Longitude range: -180.00000 to  180.00000   Grid distance:    0.25000
  Latitude range :    0.00000 to   90.00000   Grid distance:    0.25000

and the model starts and seems to run fine.

I'm attaching the patch.

Attachments (1)

longshift.patch (6.6 KB) - added by ahilboll 5 years ago.

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by ahilboll

comment:1 Changed 4 years ago by pesei

  • Component changed from FP other to FP coding/compilation
Note: See TracTickets for help on using tickets.
hosted by ZAMG