Re: [gdal-dev] gdal_translate shifted values

2024-02-01 Thread Laurențiu Nicola via gdal-dev
Indeed, good catch, I exported both of them to a new file and it's obvious now: Laurentiu On Thu, Feb 1, 2024, at 15:22, Even Rouault wrote: > Hi, > > I don't think there's any problem regarding GDAL vs xarray. It is just a > difference of convention on how GDAL and xarray choose the origin of

Re: [gdal-dev] gdal_translate shifted values

2024-02-01 Thread Even Rouault via gdal-dev
Hi, I don't think there's any problem regarding GDAL vs xarray. It is just a difference of convention on how GDAL and xarray choose the origin of rasters. GDAL selects the northern-west corner as the (0,0) image coordinate. The line in GDAL that contains values 13.75 14.25 14.75 which are at

Re: [gdal-dev] gdal_translate shifted values

2024-02-01 Thread Laurențiu Nicola via gdal-dev
It's actually pretty easy to test: import numpy as np import xarray as xr from osgeo import gdal xarray_ds = xr.load_dataset("st4_pr.2017092016.01h", engine="cfgrib") # GDAL uses as NODATA xarray_data = np.nan_to_num(xarray_ds.tp.data, nan=.0) gdal_ds = gdal.Open("st4_pr.2017092016.01h")

Re: [gdal-dev] gdal_translate shifted values

2024-02-01 Thread Roger Bivand via gdal-dev
>From the R code snippet I see: "Surprisingly, the value 9.75 is shifted to >106, 86 = 105,85 in Python indexing", but R is 1-base and Python 0-base. In R: > library(terra) terra 1.7.71 > gdal() [1] "3.8.3" > a <- rast("attachment.obj") > b <- rast("st4_pr.2017092016.01h.tif") > a class : S

Re: [gdal-dev] gdal_translate shifted values

2024-02-01 Thread Laurențiu Nicola via gdal-dev
les are identical. All I > can conclude is that gdal_compare and your R script are doing something in > different ways. > > -Jukka Rahkonen- > > *Lähettäjä:* gdal-dev *Puolesta *Furuya, > Takahiro via gdal-dev > *Lähetetty:* torstai 1. helmikuuta 2024 1.53 > *Vastaanottaja:*

Re: [gdal-dev] gdal_translate shifted values

2024-02-01 Thread Rahkonen Jukka via gdal-dev
s. -Jukka Rahkonen- Lähettäjä: gdal-dev Puolesta Furuya, Takahiro via gdal-dev Lähetetty: torstai 1. helmikuuta 2024 1.53 Vastaanottaja: gdal-dev@lists.osgeo.org Aihe: [gdal-dev] gdal_translate shifted values Hi gdal-dev, I am Takahiro, a student who is using gdal_translate. I have an issue with gdal

Re: [gdal-dev] gdal_translate shifted values

2024-01-31 Thread Scott via gdal-dev
I'd check both files *before* all the processing. Something like: gdallocationinfo -l_srs EPSG:4326 gribFile -110 40 gdallocationinfo -l_srs EPSG:4326 tiffFile -110 40 That will tell narrow it down. On 1/31/24 15:53, Furuya, Takahiro via gdal-dev wrote: Hi gdal-dev, I am Takahiro, a student

[gdal-dev] gdal_translate shifted values

2024-01-31 Thread Furuya, Takahiro via gdal-dev
Hi gdal-dev, I am Takahiro, a student who is using gdal_translate. I have an issue with gdal_translate and would like to ask a question. I used gdal_translate to transform a NCEP GRIB file (downloadable from https://data.eol.ucar.edu/cgi-bin/codiac/fgr_form/id=21.093, or attached to this email) t