Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Duplicate longitude using lon_orient #463

Open
pochedls opened this issue Apr 26, 2023 · 0 comments
Open

[Bug]: Duplicate longitude using lon_orient #463

pochedls opened this issue Apr 26, 2023 · 0 comments
Labels
type: bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@pochedls
Copy link
Collaborator

pochedls commented Apr 26, 2023

What happened?

I noticed that when using the lon_orient flag set to (0, 360) there is an extra longitude value when 0 exists in lon. This value is repeated as 0 and 360 (but only 0 exists in the original dataset).

Notice the length of lon in the example below (with and without lon_orient).

What did you expect to happen?

The value should not be repeated.

Minimal Complete Verifiable Example

fn = '/p/css03/esgf_publish/CMIP6/CMIP/CNRM-CERFACS/CNRM-CM6-1/historical/r3i1p1f2/Amon/ts/gr/v20190125/' 
ds = xc.open_mfdataset(fn)
print(ds.lon)
ds = xc.open_mfdataset(fn, lon_orient=(0, 360))
print()
print(ds.lon)

<xarray.DataArray 'lon' (lon: 256)>
array([ 0. , 1.40625, 2.8125 , ..., 355.78125, 357.1875 , 358.59375])
Coordinates:

  • lon (lon) float64 0.0 1.406 2.812 4.219 ... 354.4 355.8 357.2 358.6
    Attributes:
    axis: X
    standard_name: longitude
    long_name: Longitude
    units: degrees_east
    bounds: lon_bnds
    /home/pochedley1/bin/anaconda3/envs/xcdat/lib/python3.10/site-packages/cf_xarray/accessor.py:1638: UserWarning: Variables {'areacella', ''} not found in object but are referred to in the CF attributes.
    warnings.warn(

<xarray.DataArray 'lon' (lon: 257)>
array([ 0. , 1.40625, 2.8125 , ..., 357.1875 , 358.59375, 360. ])
Coordinates:

  • lon (lon) float64 0.0 1.406 2.812 4.219 ... 355.8 357.2 358.6 360.0
    Attributes:
    axis: X
    standard_name: longitude
    long_name: Longitude
    units: degrees_east
    bounds: lon_bnds

Relevant log output

No response

Anything else we need to know?

I think we could probably deal with this by filtering for transformed longitude values [0, 360).

Environment

xcdat 0.5.0

@pochedls pochedls added the type: bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Apr 26, 2023
@tomvothecoder tomvothecoder modified the milestone: FY24Q1 (v0.7.0) Sep 27, 2023
@tomvothecoder tomvothecoder removed this from the FY24Q1 (10/01/23 - 12/31/23) milestone Dec 6, 2023
@tomvothecoder tomvothecoder added this to the FY24 Items to Work On milestone Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
Status: Todo
Development

No branches or pull requests

2 participants