AntSimi / py-eddy-tracker

Eddy identification and tracking
https://py-eddy-tracker.readthedocs.io/en/latest/
GNU General Public License v3.0
123 stars 53 forks source link

Issue reading NEMO UnRegularGrid #231

Open jhlasheras opened 7 months ago

jhlasheras commented 7 months ago

Hi @AntSimi , sorry if I may have missed some documentation or previous issue, but I am struggling to use the tool with NEMO outputs without regridding them into a regular grid, as I did in previous occasions.

I have a NEMO model output file that looks like this with ncdump:

netcdf medfs_ssh_20220501 {
dimensions:
    time = 1 ;
    y = 380 ;
    x = 1307 ;
variables:
    float SSH(time, y, x) ;
        SSH:_FillValue = NaNf ;
        SSH:standard_name = "sea_surface_height_above_geoid" ;
        SSH:long_name = "sea_surface_height_above_geoid" ;
        SSH:units = "m" ;
        SSH:online_operation = "average" ;
        SSH:interval_operation = "180 s" ;
        SSH:interval_write = "1 d" ;
        SSH:cell_methods = "time: mean (interval: 180 s)" ;
        SSH:coordinates = "nav_lat nav_lon" ;
    float nav_lat(y, x) ;
        nav_lat:_FillValue = NaNf ;
        nav_lat:standard_name = "latitude" ;
        nav_lat:long_name = "Latitude" ;
        nav_lat:units = "degrees_north" ;
    float nav_lon(y, x) ;
        nav_lon:_FillValue = NaNf ;
        nav_lon:standard_name = "longitude" ;
        nav_lon:long_name = "Longitude" ;
        nav_lon:units = "degrees_east" ;
    double time(time) ;
        time:_FillValue = NaN ;
        time:axis = "T" ;
        time:standard_name = "time" ;
        time:long_name = "Time axis" ;
        time:time_origin = "1900-01-01 00:00:00" ;
        time:bounds = "time_counter_bounds" ;
        time:units = "seconds since 1900-01-01" ;
        time:calendar = "gregorian" ;

// global attributes:
        :name = "medfs-eas8_1d_20220501_ALL_grid_T" ;
        :description = "ocean T grid variables" ;
        :title = "ocean T grid variables" ;
        :Conventions = "CF-1.6" ;
        :timeStamp = "2023-Oct-08 07:31:55 GMT" ;
        :uuid = "8ae0c4bd-ca3a-45aa-a566-21588d957881" ;
}

When I try to load the grid with h = UnRegularGridDataset(filename=file_name, x_name='nav_lon', y_name='nav_lat' ) I get NumbaTypeError: Unsupported array type: numpy.ma.MaskedArray.

I tried to use another subclass from #6 but I got the same error. I also tried to fillna values with same result.

jhlasheras commented 7 months ago

I have been able to solve as in this comment

I now face the problem that add_uv or bessel_high_filter seem not to be implemented for UnRegularGrid. Is there any solution available?

thanks!

AntSimi commented 7 months ago

Sadly, filtering and compute current on UnRegularGrid could be tricky and different for each type of grid. So there is no code share in py eddy tracker to do that, if you have method/code to do this operation, it could be interessant to share or do a contribution on this project.