calculating a cube anomally - coords don't match

233 views
Skip to first unread message

John Siddorn

unread,
Jun 15, 2016, 4:52:41 AM6/15/16
to Iris


I am trying to calculate an anomally after regridding two fields from satellite SST products. The code I am using is attached. Despite every effort to make the cubes identical (asides from the data in them) the calculation of the anomally is complaining with the error:

"ValueError: This operation cannot be performed as there are differing coordinates (latitude, longitude) remaining which cannot be ignored."

Given I cannot see what the difference between the coords is I am slightly stumped.

Any help would be gratefully received.

Thanks
John
anomally_plot.py

Andrew Dawson

unread,
Jun 15, 2016, 5:32:34 AM6/15/16
to Iris
Can you print the latitude/longitude coordinates for each cube, there may be some differing coordinate metadata that is problematic (coordinates have their own metadata too):

print(odyinterp.coord('latitude'))
print(ostmean.coord('latitude'))

print(odyinterp.coord('longitude'))
print(ostmean.coord('longitude'))


On an unrelated note, you shouldn't use the function iris.sample_data_path to construct your own file paths. This function is solely for the purpose of getting the path to a file within iris' own sample data repository, and in the next release it will give you an error if you use it in the way you have. You just need:

fname = '/data/cr1/frsj/ODYSSEAvsOSTIA/OSTIA_AMJ.nc'

and

fname = '/data/cr1/frsj/ODYSSEAvsOSTIA/ODYSSEA_AMJ.nc'

John Siddorn

unread,
Jun 15, 2016, 6:57:56 AM6/15/16
to Iris
Hi Andrew,

Thanks for your reply. I have attached the coords output. There are differences between the meta-data, but I wouldn't know whether that would be an issue or not.

Thanks
John
Longitude.txt
Latitude.txt

Andrew Dawson

unread,
Jun 15, 2016, 7:12:53 AM6/15/16
to Iris
I'd be tempted to throw out the attributes dictionary for each coordinate. This is not ideal and is one of my least favourite aspects of iris. Try this before you perform the troublesome operation:

odyinterp.coord('latitude').attributes = {}
ostmean
.coord('latitude').attributes = {}
odyinterp
.coord('longitude').attributes = {}
ostmean
.coord('longitude').attributes = {}

John Siddorn

unread,
Jun 15, 2016, 8:14:40 AM6/15/16
to Iris
Brilliant, works a treat. 

Thanks
Reply all
Reply to author
Forward
0 new messages