ry_dong

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

已經新建的一個環境,安裝好

 

 可以讀取 grib文件,但是操作和取值還有問題;

之前還出現過的報錯還有無法訪問到github.


現在嘗試通過xarray來讀取該文件。但是在安裝包的時候一直出錯。

import cfgrib
import xarray as xr
ds = xr.open_dataset('_mars-webmars-public-svc-green-000-6fe5cac1a363ec1525f54343b6cc9fd8-Bdpmv2.grib', engine='cfgrib')

報錯為:

Cannot find the ecCodes library

 

xarray尾声:TIFF与GRIB处理 - 云+社区 - 腾讯云 (tencent.com)

 該截圖中的,cfgrib安裝,在我電腦上無法通過上面的conda命令一鍵安裝

顯示報錯為

 

 

Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/conda-forge/win-64/current_repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
'https://conda.anaconda.org/conda-forge/win-64'

 

另外另一個cfgrib基本用法,輸入會得到關於無法鏈接到github的報錯,就如一開始所説的。

 

我試圖通過三分钟解决cfgrib的安装问题_lc_lcrystal的博客-CSDN博客_cfgrib安装

解決,上文中的spyder無法安裝在我的新環境中。在conda list后,發現在前幾折騰額時候,已經安裝了xarray,已安裝的包都可以在直接在navigator看到。

於是我直接進行這裏的第三步:

 

有報錯了。。。

 

但是正如該博客中的一樣

 

 於是我換命令

 

 得到的依然是報錯。。。

後來我點開大圖看發現這些消息前面都有個括號...也就是說是激活了環境的...

好吧那我激活環境去,

 

 正常了,和博客一樣。

 

 繼續conda install -c https://conda.anaconda.org/conda-forge/eccodes

再次報錯...淦CondaValueError: too few arguments, must supply command line package specs or --file 意思是參數輸入的太少了?

嘗試換一種 

(cfgrib_env) C:\Users\Administrator>conda install -c conda-forge/eccodes

報錯 CondaValueError: too few arguments, must supply command line package specs or --file

嘗試(cfgrib_env) C:\Users\Administrator>conda install eccodes -c conda-forge

成功!

測試 

(cfgrib_env) C:\Users\Administrator>python -m eccodes selfcheck
Found: ecCodes v2.24.2.
Library: F:\anaconda\envs\cfgrib_env\Library\bin\eccodes.dll
Definitions: /MEMFS/definitions
Samples: /MEMFS/samples
Your system is ready.

下面我還需要安裝cfgrib

故技重施

(cfgrib_env) C:\Users\Administrator>anaconda search -t conda cfgrib
Using Anaconda API: https://api.anaconda.org
Packages:
Name | Version | Package Types | Platforms | Builds
------------------------- | ------ | --------------- | --------------- | ----------
conda-forge/cfgrib | 0.9.9.0 | conda | noarch | py_0, pyhd8ed1ab_0, pyhd8ed1ab_1
: Maps GRIB files to the NetCDF Common Data Model with CF Convention using ecCodes
Found 1 packages

Run 'anaconda show <USER/PACKAGE>' to get installation details

然後按上面的格式 輸入

(cfgrib_env) C:\Users\Administrator>conda install cfgrib -c conda-forge

安裝完成

 

posted on 2022-01-23 12:26  ry_d  阅读(466)  评论(0编辑  收藏  举报