Opened 2 weeks ago

#238 new Defect

Inconsistency when shifting longitudes?

Reported by: ahilboll Owned by:
Priority: major Milestone:
Component: FP other Version: FLEXPART 10.3
Keywords: Cc:


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=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', &                                                                                               

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
  #### FILE OUTGRID IN DIRECTORY               ####

After changing all instances of to 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 2 weeks ago.

Download all attachments as: .zip

Change History (1)

Changed 2 weeks ago by ahilboll

Note: See TracTickets for help on using tickets.
hosted by ZAMG