Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Support datasets with 0,360 degree longitude ranges #620

Closed
Evadzi opened this issue Apr 20, 2018 · 3 comments
Closed

Support datasets with 0,360 degree longitude ranges #620

Evadzi opened this issue Apr 20, 2018 · 3 comments

Comments

@Evadzi
Copy link

Evadzi commented Apr 20, 2018

Expectation
I know the main goal of cate is to support the use of esa data.
However, climate scientist dedicate significant time to compare data sets from various sources.
Although Cate promises to provide this functionality as well, which is very important, it failed to read a netcdf file downloaded from CSIRO ( (https://research.csiro.au/slrwavescoast/sea-level/measurements-and-data/sea-level-data/) , an organization's data that has been widely worldwide by oceanographers..

**Results from read netcdf operation**
Job: Reading dropped file
Message: east and west are almost equal: 0.5, 0.5
Code: -32003
Method: set_workspace_resource
Exception: ValueError

Traceback (most recent call last):
  File "C:\Users\prosper\cate-2.0.0.dev8\lib\site-packages\cate\util\web\jsonrpchandler.py", line 209, in send_service_method_result
    result = future.result()
  File "C:\Users\prosper\cate-2.0.0.dev8\lib\concurrent\futures\_base.py", line 425, in result
    return self.__get_result()
  File "C:\Users\prosper\cate-2.0.0.dev8\lib\concurrent\futures\_base.py", line 384, in __get_result
    raise self._exception
  File "C:\Users\prosper\cate-2.0.0.dev8\lib\concurrent\futures\thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\prosper\cate-2.0.0.dev8\lib\site-packages\cate\util\web\jsonrpchandler.py", line 306, in call_service_method
    result = method(*method_params, monitor=monitor)
  File "C:\Users\prosper\cate-2.0.0.dev8\lib\site-packages\cate\webapi\websocket.py", line 286, in set_workspace_resource
    return [workspace.to_json_dict(), res_name]
  File "C:\Users\prosper\cate-2.0.0.dev8\lib\site-packages\cate\core\workspace.py", line 274, in to_json_dict
    ('resources', self._resources_to_json_list())
  File "C:\Users\prosper\cate-2.0.0.dev8\lib\site-packages\cate\core\workspace.py", line 286, in _resources_to_json_list
    resource_descriptor = self._get_resource_descriptor(res_id, res_update_count, res_name, resource)
  File "C:\Users\prosper\cate-2.0.0.dev8\lib\site-packages\cate\core\workspace.py", line 302, in _get_resource_descriptor
    cls._update_resource_json_from_dataset(resource_json, resource)
  File "C:\Users\prosper\cate-2.0.0.dev8\lib\site-packages\cate\core\workspace.py", line 319, in _update_resource_json_from_dataset
    variable_descriptors.append(cls._get_xarray_variable_descriptor(variable))
  File "C:\Users\prosper\cate-2.0.0.dev8\lib\site-packages\cate\core\workspace.py", line 391, in _get_xarray_variable_descriptor
    tiling_scheme = get_tiling_scheme(variable)
  File "C:\Users\prosper\cate-2.0.0.dev8\lib\site-packages\cate\core\cdm.py", line 358, in get_tiling_scheme
    geo_extent = GeoExtent.from_coord_arrays(lons, lats)
  File "C:\Users\prosper\cate-2.0.0.dev8\lib\site-packages\cate\util\im\geoextent.py", line 181, in from_coord_arrays
    return GeoExtent(west=x1, south=y1, east=x2, north=y2, inv_y=True, eps=eps)
  File "C:\Users\prosper\cate-2.0.0.dev8\lib\site-packages\cate\util\im\geoextent.py", line 58, in __init__
    raise ValueError('east and west are almost equal: %s, %s' % (east, west))
ValueError: east and west are almost equal: 0.5, 0.5
@forman forman self-assigned this Apr 22, 2018
@forman
Copy link
Member

forman commented Apr 30, 2018

These datasets have an unsupported geo-coding where longitudes and latitudes are integer numbers at 1-degree resolution. Longitude values range from 1 to 360 but Cate expects them to range from -180 to +180. More accurately, Cate expects CF conventions here which means, spatial coordinates should refer to grid cell centers, therefore longitude should range from -179.5 to +179.5.

We cannot easily fix that in Cate, it would require a regridding of the data so that the -179.5 to +179.5 applies correctly.

@forman forman changed the title Read_netcdf_Support_request Support datasets with 0,360 degree longitude ranges Apr 30, 2018
@forman forman closed this as completed in 1f086ff Apr 30, 2018
@forman
Copy link
Member

forman commented Apr 30, 2018

@Evadzi In latest dev10 there are two fixes

  1. you can now open the SeaLevel files now without errors (note, the filenames end with .nc.gz but they are actually not GZ compressed archived but usual NetCDF files). However, the geocoding is not correct.
  2. there is a new operation fix_lon_360() which fixes the longitude

See it in action here. The upper image is from read_nectdf(), the one below after applying fix_lon_360():

image

@Evadzi
Copy link
Author

Evadzi commented May 2, 2018

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants