爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 15819|回复: 11

[其他] 请教大神:为什么我运行脚本会报ESMF_regridding.ncl的错

[复制链接]

新浪微博达人勋

发表于 2015-2-24 17:20:33 | 显示全部楼层 |阅读模式

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

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

x
$ ncl regrid01.ncl
Copyright (C) 1995-2013 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 6.1.2
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
fatal:Eq: Dimension size, for dimension number 0, of operands does not match, can't continue

fatal:["Execute.c":8128]:Execute: Error occurred at or near line 1341 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl

fatal:["Execute.c":8128]:Execute: Error occurred at or near line 3566 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl

fatal:["Execute.c":8128]:Execute: Error occurred at or near line 3674 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl

fatal:["Execute.c":8128]:Execute: Error occurred at or near line 55 in file regrid01.ncl

---------------------------------------------------------------------------
以上为报错内容,

以下是regrid01.ncl的脚本内容:


;======================================================================
; Concepts illustrated:
;   - Interpolating from one grid to another using ESMF_regrid
;   - Interpolating data from a CMIP5 grid to a 1X1 degree rectilinear grid
;======================================================================
; This example is identical to ESMF_all_6.ncl, except it does the
; regridding in one call to "ESMF_regrid".  See ESMF_wgts_6.ncl
; for a faster example of regridding using an existing weights file.
;======================================================================
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"

begin
;---Interpolation methods
    methods      = "bilinear"  ;"patch","conserve"


;---Input file
    srcFileName  = "tos_Omon_ACCESS1-0_rcp85_r1i1p1_200601-210012.nc"
;---Output file
    dstFileName  = "test.nc"

;---Get data and lat/lon grid from CMIP5 Grid
    sfile        = addfile(srcFileName,"c")
    wgtFile      = "CMIP5_2_World_" + methods + ".nc"
    tos       = sfile->tos(:,:,:)
    tos@lat2d = sfile->lat
    tos@lon2d = sfile->lon

    Opt                  = True
    Opt@SrcFileName      = "CMIP5_SCRIP.nc"       ; source file name
    Opt@DstFileName      = "World1deg_SCRIP.nc"   ; destination file name
    Opt@ForceOverwrite   = True

    Opt@SrcGridCornerLat = sfile->lat_vertices    ; corners are necessary
    Opt@SrcGridCornerLon = sfile->lon_vertices    ; for "conserve" method
    Opt@SrcMask2D        = where(.not.ismissing(tos),1,0)

    Opt@DstGridType      = "1x1"              ; Destination grid
    Opt@DstTitle         = "World Grid 1-degree Resolution"
    Opt@DstLLCorner      = (/-89.75d,   0.00d /)
    Opt@DstURCorner      = (/ 89.75d, 359.75d /)

    ;;Opt@PrintTimings   = True
    ;;Opt@Debug          = True
    Opt@WgtFileName  = wgtFile
    Opt@InterpMethod = methods

;----------------------------------------------------------------------
; Interpolate data from CMIP5 to World 1-degree grid.
;----------------------------------------------------------------------

    tos_regrid = ESMF_regrid(tos,Opt)
;    printVarSummary(tos_regrid)

;---------------------------------------------------------------------
;  write regrided netcdf
;---------------------------------------------------------------------
    system("/bin/rm -f "+dstFileName)
    out  = addfile(dstFileName,"c")
    fatt                 = True
    fatt@title          = srcFileName+" regrid data"
    fatt@source_file         = srcFileName
    fatt@Conventions        = "None"
    fatt@creation_data        = systemfunc("date")
    fileattdef(out,fatt)
    filedimdef(out,"time",-1,True)
    out->tos        = tos_regrid

end


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

新浪微博达人勋

发表于 2020-7-14 21:34:28 | 显示全部楼层
回复大家
因为opt@GridMask 这个attribute需要的是一个二维的数组
而楼主脚本中Opt@SrcMask2D        = where(.not.ismissing(tos),1,0)
这里的tos给的是一个三维的
改成tos(0,:,:)应该就可以了
密码修改失败请联系微信:mofangbao
回复 支持 3 反对 0

使用道具 举报

新浪微博达人勋

发表于 2016-1-14 20:39:22 | 显示全部楼层
楼主你好,请问这个问题解决了没有?我也遇到同样的问题了
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-6-9 20:30:08 | 显示全部楼层
我也遇到了。。。。。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-3-8 14:59:54 | 显示全部楼层
求赐教,我也是同样的问题,不知道是不是因为没有这个文件的原因
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2019-4-20 16:13:30 | 显示全部楼层
你好,请问你的问题解决了吗?我现在也是遇到了这个问题,在regrid时变量是只能有两个维度吗

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

使用道具 举报

新浪微博达人勋

发表于 2020-8-6 23:56:33 | 显示全部楼层
coliane 发表于 2020-7-14 21:34
回复大家
因为opt@GridMask 这个attribute需要的是一个二维的数组
而楼主脚本中Opt@SrcMask2D        = w ...

厉害!膜拜
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2020-12-22 09:31:12 | 显示全部楼层
请教一下

   Opt@SrcFileName      = "CMIP5_SCRIP.nc"       ; source file name
    Opt@DstFileName      = "World1deg_SCRIP.nc"   ; destination file name

这里的两个nc文件是自己生成嘛?还是去哪下载?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2021-12-10 21:42:24 | 显示全部楼层
何源 发表于 2020-12-22 09:31
请教一下

   Opt@SrcFileName      = "CMIP5_SCRIP.nc"       ; source file name

+1,我也想请教一下
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2021-12-14 12:12:33 | 显示全部楼层
LLLLLYH 发表于 2021-12-10 21:42
+1,我也想请教一下

这个我了解了,是自己生成
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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