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

Are output dimensions name from argo.interp_std_levels invalid ? #155

Open
gmaze opened this issue Nov 26, 2021 · 6 comments
Open

Are output dimensions name from argo.interp_std_levels invalid ? #155

gmaze opened this issue Nov 26, 2021 · 6 comments
Labels
breaking-change Will break code if not updated with new API invalid This doesn't seem right question Further information is requested stale No activity over the last 90 days

Comments

@gmaze
Copy link
Member

gmaze commented Nov 26, 2021

MCVE Code Sample

from argopy import DataFetcher as ArgoDataFetcher
ds = ArgoDataFetcher().region([-75, -55, 30.0, 40.0, 0, 100.0, "2011-01-01", "2011-01-15"]).load().data
dsp = ds.argo.point2profile()
dsi = dsp.argo.interp_std_levels([20., 30, 40, 50])
dsi

returns:

<xarray.Dataset>
Dimensions:                (N_PROF: 18, PRES_INTERPOLATED: 4)
Coordinates:
  * N_PROF                 (N_PROF) int64 7 13 15 0 6 2 9 ... 12 10 17 3 8 14 16
    LATITUDE               (N_PROF) float64 37.28 33.98 32.88 ... 34.39 33.07
    LONGITUDE              (N_PROF) float64 -66.77 -71.17 ... -72.75 -64.59
    TIME                   (N_PROF) datetime64[ns] 2011-01-02T11:14:06 ... 20...
  * PRES_INTERPOLATED      (PRES_INTERPOLATED) float64 20 30 40 50
Data variables:
    CONFIG_MISSION_NUMBER  (N_PROF) int64 1 1 11 1 1 1 0 1 1 1 1 1 1 2 1 1 1 13
    CYCLE_NUMBER           (N_PROF) int64 150 3 11 100 180 ... 62 148 151 4 13
    DATA_MODE              (N_PROF) <U1 'D' 'D' 'D' 'D' 'D' ... 'D' 'D' 'D' 'D'
    DIRECTION              (N_PROF) <U1 'A' 'A' 'A' 'A' 'A' ... 'A' 'A' 'A' 'A'
    PLATFORM_NUMBER        (N_PROF) int64 4900803 4901218 ... 4901218 5903377
    PRES                   (N_PROF, PRES_INTERPOLATED) float64 20.0 ... 50.0
    PSAL                   (N_PROF, PRES_INTERPOLATED) float64 36.67 ... 36.68
    TEMP                   (N_PROF, PRES_INTERPOLATED) float64 19.47 ... 19.24
Attributes: (8)

Expected Output

<xarray.Dataset>
Dimensions:                (N_PROF: 18, N_LEVELS: 4)
Coordinates:
  * N_PROF                 (N_PROF) int64 7 13 15 0 6 2 9 ... 12 10 17 3 8 14 16
    LATITUDE               (N_PROF) float64 37.28 33.98 32.88 ... 34.39 33.07
    LONGITUDE              (N_PROF) float64 -66.77 -71.17 ... -72.75 -64.59
    TIME                   (N_PROF) datetime64[ns] 2011-01-02T11:14:06 ... 20...
  * N_LEVELS               (N_LEVELS) int64 0 1 2 3
Data variables:
    CONFIG_MISSION_NUMBER  (N_PROF) int64 1 1 11 1 1 1 0 1 1 1 1 1 1 2 1 1 1 13
    CYCLE_NUMBER           (N_PROF) int64 150 3 11 100 180 ... 62 148 151 4 13
    DATA_MODE              (N_PROF) <U1 'D' 'D' 'D' 'D' 'D' ... 'D' 'D' 'D' 'D'
    DIRECTION              (N_PROF) <U1 'A' 'A' 'A' 'A' 'A' ... 'A' 'A' 'A' 'A'
    PLATFORM_NUMBER        (N_PROF) int64 4900803 4901218 ... 4901218 5903377
    PRES                   (N_PROF, N_LEVELS) float64 20.0 ... 50.0
    PSAL                   (N_PROF, N_LEVELS) float64 36.67 ... 36.68
    TEMP                   (N_PROF, N_LEVELS) float64 19.47 ... 19.24
Attributes: (8)

Problem Description

In interpolated output does not respect the Argo convention of having 2-dimensional variables in (N_PROF, N_LEVELS) and pressure values in a data variables. In this case we would expect the following:

  • Vertical dimension to be N_LEVELS, not PRES_INTERPOLATED
  • Standard pressure levels to be in the data variable PRES where a comment attribute should be added to specify that they have been interpolated.
@gmaze gmaze added invalid This doesn't seem right argo-core About core variables (P, T, S) breaking-change Will break code if not updated with new API labels Nov 26, 2021
@gmaze
Copy link
Member Author

gmaze commented Nov 26, 2021

@quai20 you coded this method, what do you think ?

I found out about this when working on the groupy_pressure_bins method

The interp_std_levels could easily be updated to match the above expected behaviour, which is also the one implemented in groupy_pressure_bins, I can do it in #142

This would also be a breaking change with backward versions

@gmaze
Copy link
Member Author

gmaze commented Nov 26, 2021

One could indeed argue that to avoid confusion, making the output clearly not an Argo-like dataset is a good thing to do

On the other hand, the accessor keep track of the modifications, and this will help users to use all argopy functionalities, event after a transformation of the data

@gmaze gmaze changed the title invalid output dimensions name from argo.interp_std_levels Are output dimensions name from argo.interp_std_levels invalid ? Jan 19, 2022
@gmaze gmaze added question Further information is requested and removed argo-core About core variables (P, T, S) labels Jan 19, 2022
@github-actions
Copy link

This issue was marked as staled automatically because it has not seen any activity in 90 days

@github-actions github-actions bot added the stale No activity over the last 90 days label Apr 19, 2022
@gmaze gmaze removed the stale No activity over the last 90 days label Sep 23, 2022
@github-actions
Copy link

This issue was marked as staled automatically because it has not seen any activity in 90 days

@github-actions github-actions bot added the stale No activity over the last 90 days label Dec 24, 2022
Copy link

This issue was closed automatically because it has not seen any activity in 365 days

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 25, 2023
@gmaze gmaze reopened this Jan 8, 2024
@github-actions github-actions bot removed closed-as-stale stale No activity over the last 90 days labels Jan 8, 2024
Copy link

This issue was marked as staled automatically because it has not seen any activity in 90 days

@github-actions github-actions bot added the stale No activity over the last 90 days label Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Will break code if not updated with new API invalid This doesn't seem right question Further information is requested stale No activity over the last 90 days
Projects
None yet
Development

No branches or pull requests

1 participant