AntSimi / py-eddy-tracker

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

Detection, problem with high_filter function #203

Closed marimpacheco closed 1 year ago

marimpacheco commented 1 year ago

Hi, I have 10 yearly files with 5-day means (GFDL CM2.6 - curvilinear grid). I had no problem to do the detection with the year 1, but I am having problems for the other years. The dataset has some differences in their attributes, but I could not identify what was causing the problem. I gave the exact same treatment to the data beforehand, but the year 1 comes from a different file (nevertheless the physical variables should be the same). Thanks for your help :)

It's giving the error below:

g = UnRegularGridDataset(data_path, "geolon_t", "geolat_t", centered=True, indexs = dict(time=0))
g.high_filter('sea_level', 700)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/scratch/SlurmTMP/smomw541.8043853/ipykernel_1521928/2437079499.py in <module>
----> 1 g.high_filter('sea_level', 700)

~/miniconda3/envs/py3_eddy/lib/python3.10/site-packages/pyEddyTracker-3.6.1+3.g7fc19df-py3.10.egg/py_eddy_tracker/dataset/grid.py in high_filter(self, grid_name, w_cut, **kwargs)
    601         :param int, w_cut: the half-power wavelength cutoff (km)
    602         """
--> 603         result = self._low_filter(grid_name, w_cut, **kwargs)
    604         self.vars[grid_name] -= result
    605 

~/miniconda3/envs/py3_eddy/lib/python3.10/site-packages/pyEddyTracker-3.6.1+3.g7fc19df-py3.10.egg/py_eddy_tracker/dataset/grid.py in _low_filter(self, grid_name, w_cut, factor)
   1147         regrid_step = w_cut / 111.0 / factor
   1148         x_min, x_max, y_min, y_max = self.bounds
-> 1149         x_array = arange(x_min, x_max + regrid_step, regrid_step)
   1150         y_array = arange(y_min, min(y_max + regrid_step, 89), regrid_step)
   1151         bins = (x_array, y_array)

ValueError: arange: cannot compute length

The data that does not work:

netcdf data_detect_182_01 {
dimensions:
        xt_ocean = 3600 ;
        yt_ocean = 2108 ;
        time = 1 ;
variables:
        double xt_ocean(xt_ocean) ;
                xt_ocean:_FillValue = NaN ;
                xt_ocean:long_name = "Nominal Longitude of T-cell center" ;
                xt_ocean:units = "degree_east" ;
                xt_ocean:cartesian_axis = "X" ;
        double yt_ocean(yt_ocean) ;
                yt_ocean:_FillValue = NaN ;
                yt_ocean:long_name = "Nominal Latitude of T-cell center" ;
                yt_ocean:units = "degree_north" ;
                yt_ocean:cartesian_axis = "Y" ;
        int64 time(time) ;
                time:units = "days since 0182-01-03T00:00:00.000000" ;
                time:calendar = "julian" ;
        double geolat_t(yt_ocean, xt_ocean) ;
                geolat_t:_FillValue = NaN ;
                geolat_t:long_name = "Geographic latitude of T_cell centers" ;
                geolat_t:units = "degree_north" ;
        double geolon_t(yt_ocean, xt_ocean) ;
                geolon_t:_FillValue = NaN ;
                geolon_t:long_name = "Geographic longitude of T_cell centers" ;
                geolon_t:units = "degree_east" ;
        float sea_level(time, yt_ocean, xt_ocean) ;
                sea_level:_FillValue = NaNf ;
                sea_level:long_name = "sea surface height" ;
                sea_level:units = "meter" ;
                sea_level:cell_methods = "time: mean" ;
                sea_level:time_avg_info = "average_T1,average_T2,average_DT" ;
                sea_level:coordinates = "st_ocean geolat_t geolon_t" ;
        double st_ocean ;
                st_ocean:_FillValue = NaN ;
                st_ocean:long_name = "tcell zstar depth" ;
                st_ocean:units = "meters" ;
                st_ocean:cartesian_axis = "Z" ;
                st_ocean:positive = "down" ;
                st_ocean:edges = "st_edges_ocean" ;
        float u(time, yt_ocean, xt_ocean) ;
                u:_FillValue = NaNf ;
                u:units = "meter second^-1" ;
                u:coordinates = "st_ocean" ;
        float v(time, yt_ocean, xt_ocean) ;
                v:_FillValue = NaNf ;
                v:units = "meter second^-1" ;

The data that works:

netcdf data_detect_181_01_new {
dimensions:
        xt_ocean = 3600 ;
        yt_ocean = 2108 ;
variables:
        double xt_ocean(xt_ocean) ;
                xt_ocean:_FillValue = NaN ;
                xt_ocean:long_name = "Nominal Longitude of T-cell center" ;
                xt_ocean:units = "degree_east" ;
                xt_ocean:cartesian_axis = "X" ;
        double yt_ocean(yt_ocean) ;
                yt_ocean:_FillValue = NaN ;
                yt_ocean:long_name = "Nominal Latitude of T-cell center" ;
                yt_ocean:units = "degree_north" ;
                yt_ocean:cartesian_axis = "Y" ;
        int64 time ;
                time:units = "days since 0181-01-03T00:00:00.000000" ;
                time:calendar = "julian" ;
        double geolat_t(yt_ocean, xt_ocean) ;
                geolat_t:_FillValue = NaN ;
                geolat_t:long_name = "Geographic latitude of T_cell centers" ;
                geolat_t:units = "degree_north" ;
        double geolon_t(yt_ocean, xt_ocean) ;
                geolon_t:_FillValue = NaN ;
                geolon_t:long_name = "Geographic longitude of T_cell centers" ;
                geolon_t:units = "degree_east" ;
        float sea_level(yt_ocean, xt_ocean) ;
                sea_level:_FillValue = NaNf ;
                sea_level:long_name = "effective sea level (eta_t + patm/(rho0*g)) on T cells" ;
                sea_level:units = "meter" ;
                sea_level:valid_range = -1000.f, 1000.f ;
                sea_level:cell_methods = "time: mean" ;
                sea_level:time_avg_info = "average_T1,average_T2,average_DT" ;
                sea_level:standard_name = "sea_surface_height_above_geoid" ;
                sea_level:coordinates = "geolon_t geolat_t" ;
        double st_ocean ;
                st_ocean:_FillValue = NaN ;
                st_ocean:long_name = "tcell zstar depth" ;
                st_ocean:units = "meters" ;
                st_ocean:cartesian_axis = "Z" ;
                st_ocean:positive = "down" ;
                st_ocean:edges = "st_edges_ocean" ;
        float u(yt_ocean, xt_ocean) ;
                u:_FillValue = NaNf ;
                u:units = "meter second^-1" ;
                u:coordinates = "st_ocean" ;
        float v(yt_ocean, xt_ocean) ;
                v:_FillValue = NaNf ;
                v:units = "meter second^-1" ;
                v:coordinates = "st_ocean" ;

// global attributes:
                :coordinates = "time" ;
}
AntSimi commented 1 year ago

Could you share file which produce error?

marimpacheco commented 1 year ago

Yes, please let me know if you cannot access the file. Link here Thank you so much!

AntSimi commented 1 year ago

All coordinates (geolon_t, geolat_t) are masked!

marimpacheco commented 1 year ago

Ah that was a silly one, thanks for pointing that out!