爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 1760|回复: 11

[作图] 安裝 Piggy_NCL 版本~畫 shp 出現錯誤

[复制链接]

新浪微博达人勋

发表于 2022-4-19 23:28:38 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
平台:WSL2 + Ubuntu 20.04

安裝 Piggy_NCL 版本畫  shp 出現錯誤
錯誤訊息:
warning:_NclOpenFile: Can not open file <./data/twn_shp/TWN_adm0.shp>; file format not supported or file is corrupted
warning:isfilevar: undefined file returning missing value
fatal:The result of the conditional expression yields a missing value. NCL can not determine branch, see ismissing function
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 4257 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 4478 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 86 in file ex_shapefile_1.ncl


測試:該版本安裝後
僅執行:
  f = addfile( "./data/twn_shp/TWN_adm2.shp" ,"r")
  print(f)

就會有出現上述問題,不知道大家是否有解決方法。







密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2022-4-20 10:22:34 | 显示全部楼层
ShpDir = "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/"                                
river                  = True                                                                  
river@gsLineThicknessF = 1.2     
river@gsLineColor      = "black"     
plotcn5    = gsn_add_shapefile_polylines(wks1,plot1(0),ShpDir+"cnmap.shp",river)  
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2022-4-20 14:12:43 | 显示全部楼层
謝謝 lleoiu 建議
找到資料來源:
https://cloud.tencent.com/developer/article/1936028

下載並使用,
執行
$ ncl plot_with_correct_Chinamap.ncl

問題仍存在。

訊息如下:
Copyright (C) 1995-2019 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 6.6.2
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.

warning:_NclOpenFile: Can not open file <./cnmap/cnhimap.shp>; file format not supported or file is corrupted
warning:isfilevar: undefined file returning missing value
fatal:The result of the conditional expression yields a missing value. NCL can not determine branch, see ismissing function
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 4257 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl

fatal:["Execute.c":8637]:Execute: Error occurred at or near line 4478 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl

fatal:["Execute.c":8637]:Execute: Error occurred at or near line 173 in file plot_with_correct_Chinamap.ncl

密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2022-4-20 14:49:40 | 显示全部楼层
cnmap包需要放在这个目录下$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2022-4-20 15:55:58 | 显示全部楼层
謝謝 lleoiu 再次建議

1.複製資料
將資料至於 $NCARG_ROOT/lib/ncarg/nclscripts/cnmap/

確認後如下:
ls $NCARG_ROOT/lib/ncarg/nclscripts/cnmap/*
/home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/cnhimap.dbf      /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/county_2004.prj       /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/river.prj
/home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/cnhimap.prj      /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/county_2004.sbn       /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/river.shp
/home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/cnhimap.shp      /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/county_2004.sbx       /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/river.shx
/home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/cnhimap.shx      /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/county_2004.shp       /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/rivers.dbf
/home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/cnmap.dbf        /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/county_2004.shx       /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/rivers.prj
/home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/cnmap.ncl        /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/diquJie_polyline.dbf  /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/rivers.shp
/home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/cnmap.prj        /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/diquJie_polyline.prj  /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/rivers.shx
/home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/cnmap.shp        /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/diquJie_polyline.shp  /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/shp_Function.ncl
/home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/cnmap.shx        /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/diquJie_polyline.shx
/home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/county_2004.dbf  /home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/river.dbf

2.再次執行
$ ncl plot_with_correct_Chinamap.ncl

在執行這個區間時

;--- add shp file boundaries ---
;  ShpDir = "./cnmap/" ;"$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/"
  ShpDir = "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/"
  cnres                       = True
  cnres@gsLineThicknessF      = 2.0
  cnres@gsLineColor           = "red"

  getvalues map4
    "mpMinLatF" : cnres@minlat
    "mpMaxLatF" : cnres@maxlat
    "mpMinLonF" : cnres@minlon
    "mpMaxLonF" : cnres@maxlon
  end getvalues

  plotshp = gsn_add_shapefile_polylines(wks,map4,ShpDir+"cnhimap.shp",cnres)

;---------------------------------------------------------------


仍有

warning:_NclOpenFile: Can not open file </home/bean/.Piggy_NCL/lib/ncarg/nclscripts/cnmap/cnhimap.shp>; file format not supported or file is corrupted
warning:isfilevar: undefined file returning missing value
fatal:The result of the conditional expression yields a missing value. NCL can not determine branch, see ismissing function
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 4257 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl

fatal:["Execute.c":8637]:Execute: Error occurred at or near line 4478 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl

fatal:["Execute.c":8637]:Execute: Error occurred at or near line 174 in file plot_with_correct_Chinamap.ncl


不知道是否大家有這樣的情形








密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2022-4-26 11:26:22 | 显示全部楼层
本帖最后由 lleoiu 于 2022-4-26 11:28 编辑

没碰到过。就是你上面这些步骤设置之后,就可以正常出图。
官网下载的NCL 6.4.0 和 6.6.2都可以正常使用。
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2022-4-26 15:07:24 | 显示全部楼层
謝謝,不知道是不是我是 win10 +WSL2 環境安裝下才會有問題
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2022-4-26 15:09:40 | 显示全部楼层
应该不会。我在WIN10+WSL下安装的NCL6.6.2,是可以用的。
我是用这个帖子上的方法安装https://bbs.06climate.com/forum. ... B%BC%FC%B0%B2%D7%B0
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2022-4-26 21:28:53 | 显示全部楼层
   那我試著,在一次重新安裝看看~~謝謝
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2022-4-26 22:28:05 | 显示全部楼层
本帖最后由 lin54157 于 2022-4-26 23:15 编辑


最後出現了以下訊息
Finished making and Installing <Everything>.
由于GDAL未能成功安装,NCL将无法读取SHP文件。
Piggy_NCL安装完成

~~~ 那應該是我安裝時出現了問題,嘗試解決中



密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表