Comments (10)
@atedstone FYI #13
from geoxarray.
A couple questions/clarifications if you could:
-
Is there any reason that
geo.crs
has to be set or shouldcrs_from_cf
allow users to provide the CF grid mapping information to create the CRS with the default (no arguments) being to look at the current Dataset/DataArray for expected attributes? -
This could only be done for Datasets right?
My understanding was that geoxarray would be providing utilities for creating the crs
coordinate and adding additional "standard" attributes (CF, etc) from an existing crs
coordinate. Let me know if this isn't what you were thinking.
from geoxarray.
Is there any reason that geo.crs has to be set or should crs_from_cf allow users to provide the CF grid mapping information to create the CRS with the default (no arguments) being to look at the current Dataset/DataArray for expected attributes?
Ideally, it would be best for the CRS to be pulled from the current Dataset/DataArray expected attributes. However, there are so many different ways that this data is stored that it is likely going to fail if it is on a non-standard location or format. With this line of thinking, it would be nice to have multiple methods for setting the CRS as a backup. For example, if you already have a pyproj.CRS
or rasterio.CRS
generated using an alternate method, it would be nice to be able to:
geo.crs = CRS("epsg:4326")
I guess you could do:
geo.crs_from_cf(crs_wkt=CRS("epsg:4326").to_wkt())
But, it is not as clean IMO.
This could only be done for Datasets right?
This can work for both data arrays and datasets. If it is a data array, then it is much simpler as you only have one location to search for the CRS. Whereas if it is a dataset, then some logic needs to be added to determine which CRS is used by which variable if there are more then one (or just assume that there is only one CRS for the entire dataset).
My understanding was that geoxarray would be providing utilities for creating the crs coordinate and adding additional "standard" attributes (CF, etc) from an existing crs coordinate. Let me know if this isn't what you were thinking.
Yes, this is what I am thinking is the end goal. But, until it is ready in geoxarray
, I was thinking about adding it in to rioxarray
as a temporary addition that can be replaced at a later date.
from geoxarray.
So is data_arr.geo.crs = CRS(...)
kind of a magic "take this CRS information and add it to my Dataarray whether it be a dictionary (of CF attributes), a rasterio CRS object, or a pyproj CRS object, or something else?
Looking at the spatial_ref
stuff I think I get it a little better now. It is being added as a coordinate variable and not as another variable in a Dataset.
from geoxarray.
So is data_arr.geo.crs = CRS(...) kind of a magic "take this CRS information and add it to my Dataarray whether it be a dictionary (of CF attributes), a rasterio CRS object, or a pyproj CRS object, or something else?
That is the general idea. I am not sure about the CF dict as there can also be PROJ dicts. So, you would need a way to differentiate. Maybe look for proj
or init
for PROJ string versus grid_mapping_name
, crs_wkt
or spatial_ref
for CF dict.
from geoxarray.
I'd say that wouldn't be a bad idea if the property is already magic-ish.
from geoxarray.
Okay, sounds good to me 👍
from geoxarray.
Hi. I'd been poised a couple of days ago to generalise some of my existing code from a couple of years ago for writing CF-compliant netcdfs using xarray, but some searching revealed this project. I can give some time to helping with getting and setting CRS info on xarray Datasets, especially in creating functionality to write CF-compliant netCDFs. Before I start anything though, is there any local development of the CRS extension happening at the moment that hasn't made it to Github?
from geoxarray.
Yes! I was just about to push the changes even though I wasn't happy with everything. I'd also check out @snowman2's progress on rioxarray.
from geoxarray.
Closing this as the initial support in #26 is merged and mimics rioxarray's support. That is, .geo.crs
gives you a pyproj CRS object. .geo.write_crs
writes a CF-compatible grid_mapping
variable to the .coords
of the current xarray object. Due to difficulties persisting information in an xarray accessor there is no way to provide the geoxarray accessor CRS information without persisting it with .geo.write_crs
. Put another way, it is too easily to accidentally lose the temporary/internal CRS information if it isn't persisted in the xarray object itself.
from geoxarray.
Related Issues (18)
- Plans for geoxarray? HOT 1
- Add `sel` and `loc` methods for selection by standard names HOT 8
- cf-xarray
- MNT: Stop using ci-helpers in appveyor.yml HOT 1
- Dask re-projection support HOT 2
- Renaming 'master' to 'main'
- Design: active versus passive coordinate assignment HOT 8
- custom `numpy` dtypes HOT 5
- Ideas for crs accessor to xarray HOT 5
- Design differences with rioxarray HOT 30
- Collaboration with salem package HOT 19
- Use new proj.4 to manage projections
- Consider any lessons learned by CF group for defining swaths
- State of this package HOT 3
- Project Status HOT 2
- rioxarray HOT 6
- Handling of CRS objects in coordinates HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geoxarray.