Registry / data / xproj
library0.2.1pypypi✓ verified 83d ago

xproj is an extension for xarray that adds support for coordinate reference systems (CRS) and map projections. It provides CRS-aware indexes, accessors, and integration with pyproj. The current version is 0.2.1, with an active development cadence.

pip install xproj
INSTALL
IMPORT
SIG · XPROJ
X
xproj
datapythonv0.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

xproj
import xproj
from xproj import ...
Direct import of xproj registers the accessor; importing submodules is fine but not required for basic use.

Quick example: load a dataset and retrieve its CRS via the xproj accessor.

import xarray as xr import xproj ds = xr.tutorial.open_dataset('air_temperature') # assuming lat/lon coordinates with CF attributes crs = ds.xproj.get_crs() print(crs)
Debug
Known issues
breakingVersion 0.2.0 removed the abstract method `_proj_get_crs()` from the CRS-aware index base class. Third-party custom indexes must define a `crs` property instead.
fix
Replace `_proj_get_crs()` with a `crs` abstract property in your custom index class.
affects: >=0.2.0
gotchaThe CRS accessor `ds.xproj` is only available if xproj is imported. Forgetting to import xproj will result in an AttributeError.
fix
Always run `import xproj` before using the `.xproj` accessor.
affects: all
deprecatedThe `map_crs` method's `allow_override` parameter may be deprecated in future versions. Use explicit CRS assignment instead.
fix
Set CRS directly using `ds.xproj.set_crs(crs)` rather than relying on `allow_override`.
affects: <=0.2.1
Errors
Common errors & fixes
AttributeError: 'Dataset' object has no attribute 'xproj'
xproj module not imported before accessing the accessor.
fix
Add `import xproj` at the top of your script.
ImportError: cannot import name 'CRS' from 'xproj'
Incorrect import path; CRS class is from pyproj, not xproj.
fix
Use `from pyproj import CRS` instead.
Upgrade
Version history
0.2.1latest on PyPI · released Jul 7, 2025
Audit
Dependencies
xarrayrequiredCore dependency for xarray data structures
pyprojrequiredUsed for CRS operations and projections
Agent activity
33 hits · last 30 days
node
28
OpenAI (training)
1
Resources
xproj — pip install xproj · libregistry