id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc 238,Inconsistency when shifting longitudes?,ahilboll,,"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.",Defect,new,major,,FP coding/compilation,FLEXPART 10.3,,,