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

Add support for building coordinate system with from_cf/to_cf #536

Closed
snowman2 opened this issue Feb 12, 2020 · 6 comments · Fixed by #660
Closed

Add support for building coordinate system with from_cf/to_cf #536

snowman2 opened this issue Feb 12, 2020 · 6 comments · Fixed by #660
Labels
proposal Idea for a new feature.

Comments

@snowman2
Copy link
Member

Since WKT (or PROJ JSON) is the backend for the CF conversions, additional support for different units and axis order are now possible. Currently the x/y axis order and units of meters for projected degrees for geographic are assumed.

http://cfconventions.org/cf-conventions/cf-conventions.html#coordinate-system

Examples of input units can be accessed from the coordinates:
http://cfconventions.org/cf-conventions/cf-conventions.html#coordinate-types

  double y(y);
    y:units = "km";
    y:long_name = "y coordinate of projection";
    y:standard_name = "projection_y_coordinate";
  double x(x);
    x:units = "km";
    x:long_name = "x coordinate of projection";
    x:standard_name = "projection_x_coordinate";
  double lat(y, x);
    lat:units = "degrees_north";
    lat:long_name = "latitude coordinate";
    lat:standard_name = "latitude";
  double lon(y, x);
    lon:units = "degrees_east";
    lon:long_name = "longitude coordinate";
    lon:standard_name = "longitude";

Additionally, the vertical component can be supported:
http://cfconventions.org/cf-conventions/cf-conventions.html#vertical-coordinate

axis_name:units = "meters" ;
axis_name:positive = "down" ;
@snowman2 snowman2 added the proposal Idea for a new feature. label Feb 12, 2020
@snowman2
Copy link
Member Author

See also: cf-convention/cf-conventions#223

@snowman2
Copy link
Member Author

snowman2 commented Feb 14, 2020

Horizontal dimensions are those whose coordinate variables have an axis attribute of X or Y, or a units attribute indicating latitude and longitude.

Axis example:

{'units': 'rad',
 'axis': 'X',
 'long_name': 'GOES Projection x-Coordinate',
 'standard_name': 'projection_x_coordinate'}

@snowman2
Copy link
Member Author

snowman2 commented Mar 1, 2020

This looks useful: https://github.com/SciTools/cf-units

Using: m.convert(1, "m") on any unit should get the unit conversion factor.

Not going to include in pyproj as it adds unnecessary dependencies for a piece of functionality that is not really a main PROJ feature. Instead, I am leaning towards documentation for how to do it yourself if you so desire.

Also, here is the file/database for the unit name mappings:

More specifically:

@snowman2
Copy link
Member Author

snowman2 commented Mar 1, 2020

@snowman2
Copy link
Member Author

Can do fraction of unit - this can be used for unit conversion factor:

>>> from cf_units import Unit
>>> u = Unit("0.5 m")
>>> u.convert(1, "m")
0.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Idea for a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant