Concatenating over 0 degree longitude line #5393
-
Dear All: I got a question about concatenation (using iris 3.2.1 - one of the defaults in JASMIN) betwen cubes with longitudes using 0-360. When I try to do that over the lon = 0 line, I will get longitudes like below (i.e. wrapping all the around the globe instead of having 0.125, 2.625... naturally following 357.625): [1.25000e-01 2.62500e+00 5.12500e+00 7.62500e+00 1.01250e+01 1.26250e+01 I presume one can "hack" cube.coord('longitude').points doiing a -360 to the lons that are greater than 180 before concatenating. However, is there a better way to do this? Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
@SciTools/peloton This looks valid to us, could you give a bit more context as to why this is an issue for you and what you'd like doing? |
Beta Was this translation helpful? Give feedback.
-
@SciTools/peloton We agree that this should just work and so something is going wrong. This will be added to our backlog and when we focus on these kind of issues it will be looked into. We are glad you have a workaround for now. Could you please provide us with the file for when we work on this? Thanks for raising this! |
Beta Was this translation helpful? Give feedback.
-
@SCChan21 Are you able to provide us with example data that allows us to investigate this issue further for you? |
Beta Was this translation helpful? Give feedback.
-
Let me know if the following DropBox links work. I have attached a zip file as well, which has alll three individual files. 0E to 10E file: DimCoord : longitude / (degrees) 10W to 0W file: DimCoord : longitude / (degrees) Consquence of concatenation using iris 3.2.1 (via module load jaspy/3.10 on JASMIN): This gives the following lons: |
Beta Was this translation helpful? Give feedback.
-
Thanks for the extra detail @SCChan21. This is expected behaviour - from the concatenate documentation:
The only way to form a monotonic sequence from the input coordinates is with the large gap in the middle. If you need a coordinate that spans the meridian then the only way is to use negative numbers; below is our recommended workflow for this: import iris
from iris.cube import CubeList
cubes = iris.load(["10W_0W.nc", "0E_10E.nc"])
cubes = CubeList([cube.intersection(longitude=(-180, 180)) for cube in cubes])
full_cube = cubes.concatenate_cube()
lon_coord = full_cube.coord("longitude")
print(lon_coord)
print(lon_coord.points)
(Monotonicity is an important part of a |
Beta Was this translation helpful? Give feedback.
Thanks for the extra detail @SCChan21. This is expected behaviour - from the concatenate documentation:
The only way to form a monotonic sequence from the input coordinates is with the large gap in the middle. If you need a coordinate that spans the meridian then the only way is to use negative numbers; below is our recommended workflow for this: