ajdawson / eofs

EOF analysis in Python
http://ajdawson.github.io/eofs/
GNU General Public License v3.0
199 stars 60 forks source link

Why EOF transforms dims in coordinates #110

Open oliviermarti opened 5 years ago

oliviermarti commented 5 years ago

Hi,

I have an xarray Dataset :

>>> inFile
<xarray.Dataset>
Dimensions:                               (time_counter: 6000, x: 182, y: 149)
Coordinates:
  * time_counter                          (time_counter) float64 3.02e+07 ... 1.892e+11
Dimensions without coordinates: x, y
Data variables:
     tos_yearmean                          (time_counter, y, x) float32 ...

I compute the EOFs on tos_yearmean and I get :

>>> solver.eofs()
<xarray.DataArray 'eofs' (mode: 6000, y: 149, x: 182)>
array([[[nan, nan, ..., nan, nan],
           [nan, nan, ..., nan, nan]]], dtype=float32)
Coordinates:
  * mode     (mode) int64 0 1 2 3 4 5 6 7 ... 5993 5994 5995 5996 5997 5998 5999
  * y        (y) int64 0 1 2 3 4 5 6 7 8 ... 140 141 142 143 144 145 146 147 148
  * x        (x) int64 0 1 2 3 4 5 6 7 8 ... 173 174 175 176 177 178 179 180 181
Attributes:
    long_name:  empirical_orthogonal_functions

Dimensions x and y have been transformed into coordinates, with index starting at 0. This is spurious information. When I use the input file in Ferret, Ferret assumes that x and y start at 1. When I write solver.eofs in a file and use it in Ferret, the indexing starts at 0, and there is mismatch between the two files that make Ferret to fail on some operations.

Can I prevent eofs to transform dimension in coordinates ?

Thanks,

Olivier