Allow user assigned CRS in open 您所在的位置:网站首页 rasterio Allow user assigned CRS in open

Allow user assigned CRS in open

#Allow user assigned CRS in open| 来源: 网络整理| 查看: 265

I am looking to open MODIS level 2 hdf data, sourced from here. I've also uploaded a sample file to s3://peterm790/MOD11_L2.A2023060.2040.061.2023061090549.hdf for convenience.

My understanding is after #62 it should be possible to open these files by simply calling:

rds = rioxarray.open_rasterio('/path/to/MOD11_L2.A2023060.2040.061.2023061090549.hdf')

This however returns the following error:

MissingCRS: CRS not found. Please set the CRS with 'rio.write_crs()'.

a gist with the full error message: https://gist.github.com/peterm790/6a3dd266def15b2a5bfa04a3c63825a6

My understanding is the present API does not allow for manually setting the CRS when opening a file. Is there a way around this? if not does it make sense to allow for this? Or should it be possible to open the file without setting the CRS?

I have set up a branch: master...peterm790:rioxarray:assign_crs which allows the CRS to be set manually with an assign_crs argument in open_rasteriosuch that:

rds = rioxarray.open_rasterio('/path/to/MOD11_L2.A2023060.2040.061.2023061090549.hdf', assign_crs = "+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs")

successfully opens the files. here's a gist of this https://gist.github.com/peterm790/f06d846e518c2ced7741afcda5365aed

Please do let me know if there is another method for opening these MODIS L2 files that I have missed? Or if a PR allowing the above change would make sense.



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有