Comments (7)
stars still considers the object to be in a curvilinear grid (which doesn't make sense imo because it isn't anymore)
yes, because it does not contain information about what the original CRS was, in which it was regular
it's plotted slightly different on mapview (surprising)
mapview will do some warping, which is lossy
from stars.
yes, because it does not contain information about what the original CRS was, in which it was regular
hmm, doesn't it? I thought I've passed it this information.
# transforming back
back = transf %>% st_transform(st_crs(temperature))
and, this is TRUE
:
identical(st_crs(temperature),st_crs(back))
maybe I misunderstand what you mean here.
mapview will do some warping, which is lossy
I would expect identical warping results of identical matrix data and CRS, which I indeed get, but just after using st_warp
.
from stars.
In transf %>% st_transform(st_crs(temperature))
, trans
doesn't know its grid can be represented by a regular grid in st_crs(temperature)
.
from stars.
So that means, transforming a raster to another CRS always comes with some sort of informational loss regarding the grid, which cannot be recovered without warping the data? or is there a way I can provide that information when re-transforming?
I have difficulties understanding the reasoning behind it.
At least, it seems somewhat inefficient that the second line in the example below takes overproportionally long to compute, given that in the end, the matrix data is exactly identical. I admit it may seem like an unrealistic special case to do that..
back = transf %>% st_transform(st_crs(temperature))
back_w = transf %>% st_transform(st_crs(temperature)) %>% st_warp(dest = temperature)
So I would suggest the following behavior: when (re-)transforming to the CRS that a raster had originally, assume a regular grid again, as no re-calculation / warping is required in fact. Possibly store the original CRS (I assume it would be stored somehow already).
Or alternatively, add a special case to st_warp that skips the re-computation of the matrix in that case.
from stars.
So I would suggest the following behavior: when (re-)transforming to the CRS that a raster had originally, assume a regular grid again, as no re-calculation / warping is required in fact. Possibly store the original CRS (I assume it would be stored somehow already).
Yes, of course one can do all that, the question is how large the benefit is compared to the cost, and how this can be made waterproof such that all kind of operations in between (cropping, downsampling) lead to the right regular grid again. In your case, going from CRS A to B to A and no messing, you can set back the dimension table by
st_dimensions(back) = st_dimensions(temperature)
but only because you know that this is OK: no cost, also no guarantee or checking from the software side.
from stars.
Ah, that was the missing piece of the puzzle, thank you very much, that solves my problem.
and how this can be made waterproof such that all kind of operations in between (cropping, downsampling) lead to the right regular grid again
I agree, that may be tricky. Thanks for explaining!
from stars.
(can be closed)
from stars.
Related Issues (20)
- Inconsistent treatment of units in st_as_sf() HOT 3
- Error with printing and plotting tif object in stars HOT 2
- collapse an x/y dimension to a single geometry dimension HOT 9
- released read_stars errors on standard dataset HOT 1
- How to add map scale and north arrow? HOT 5
- Cells counted only once when extracting into overlapping geometries HOT 3
- Unable to open Zarr files HOT 3
- read_mdim cannot find array but cli gdalmdiminfo finds array just fine? HOT 8
- read_ncdf: regular vs rectilinear grids? HOT 2
- Rotate around the centroid in st_geotransform
- Exporting s3 methods from namespace HOT 3
- Reading local Zarr files into stars HOT 14
- netcdf CF 1-8 conform data is missing meta data HOT 1
- Behaviour of `aggregate.stars` when multiple overlaps occur in the same raster pixel HOT 6
- Pixels in the border get weird values with `st_rasterize()` HOT 5
- Enhancement Request: Direct Access to Band Values Using Band Names in stars Object HOT 2
- Non `udunits` confirm units break the read in of netcdf files HOT 5
- st_rasterize Error in rep_len HOT 4
- Three different stars object descriptions from the same file HOT 4
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 stars.