爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 1171|回复: 2

[作图] 如何使用ncl画分辨率为25km的NSIDC海冰密集度数据

[复制链接]

新浪微博达人勋

发表于 2023-9-19 12:32:51 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 豆得儿 于 2023-9-19 12:32 编辑

请教一下大家,NSIDC数据格式为y*x,有对应的经纬度数据,参考了ncl官网的例子进行画图,但是画出来不对,请问是哪里有问题呢?另外想请教一下大家用什么方法对NSIDC数据进行插值比较合适

作图脚本如下:
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/csm/shea_util.ncl"

begin
;----------------------get coordinate----------------------------
  f1 = addfile("/data/NSIDC_0079/NSIDC0771_LatLon_PS_S25km_v1.0.nc","r")  ;读取数据对应经纬度

  lat2d       = f1->latitude
  lon2d      = f1->longitude
  nlat         = 316
  nlon        = 332

  minlon      = min(lon2d)
  maxlon     = max(lon2d)
  minlat       = min(lat2d)
  maxlat      = max(lat2d)

;---------------------read data----------------------------------
  file1  = "/data/NSIDC_0079/NSIDC-0079_nc/bt_198909_f08_v3.1_s.nc"  ;读取海冰数据
  fName1 = addfile(file1, "r")

  ice = fName1->ice_conc
  sic = tofloat(ice)

  if (any(isnan_ieee(sic))) then
       value = -999.
       replace_ieeenan (sic, value, 0)
       sic@_FillValue = value
  end if

  sic!0 = "y"
  sic!1 = "x"
  sic&y = f1->y
  sic&x = f1->x

  sic@lat2d = lat2d
  sic@lon2d = lon2d
  printVarSummary(sic)

  ;===========作图
    wksName          = "check_siconc"
    wks                    = gsn_open_wks("png",wksName)
    gsn_define_colormap(wks,"WhBlGrYeRe")

    res                                 = True               ; Plot mods desired.
    res@gsnDraw               = False
    res@gsnFrame             = False
    res@gsnAddCyclic       = False
    res@mpDataBaseVersion     = "MediumRes"
    res@mpFillOn                       = False
    res@mpPerimDrawOrder     = "PostDraw"
    res@mpProjection                = "Stereographic"
    res@mpCenterLonF              = f1->crs@straight_vertical_longitude_from_pole
    res@mpCenterLatF               = f1->crs@standard_parallel
    res@mpLimitMode               = "Corners"  
    res@mpLeftCornerLatF         = lat2d(0,0)
    res@mpLeftCornerLonF        = lon2d(0,0)
    res@mpRightCornerLatF      = lat2d(nlat-1,nlon-1)
    res@mpRightCornerLonF     = lon2d(nlat-1,nlon-1)
    res@mpRelativeCenterLon   = True                 ; set a center lon
    res@mpCenterLonF              = 0.                   ; center lon
    res@mpRelativeCenterLat    = True           ; set a center lat
    res@mpCenterLatF               = -90.
    res@mpMinLatF                   = minlat
    res@mpMaxLatF                  = maxlat
    res@mpMinLonF                  = minlon
    res@mpMaxLonF                 = maxlon
    res@cnFillMode                   = "RasterFill"
    res@cnLineLabelsOn           = False
    res@cnFillOn                       = True
    res@cnLinesOn                    = False
    res@cnLineLabelsOn           = False
    res@gsnAddCyclic               = False   ; don't add cyclic longitude point
    res@tiMainFontHeightF       = 0.02
    res@lbLabelBarOn                = True
    res@gsnCenterString           = "NSIDC"
    res@trGridType                    = "TriangularMesh"
    res@tfDoNDCOverlay          = True

    res@cnExplicitLabelBarLabelsOn = True
    res@cnLevelSelectionMode       = "ManualLevels"
    res@cnMaxLevelValF             = 100.
    res@cnMinLevelValF             = 0.
    res@cnLevelSpacingF            = 5.

    plot = gsn_csm_contour_map(wks,sic,res)
    draw(plot)
    frame(wks)

end


海冰数据: 屏幕截图 2023-09-19 122839.png

作图结果如下:
check_siconc.000001.png



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

新浪微博达人勋

发表于 2023-9-20 00:59:04 | 显示全部楼层
    res@sfXArray       = lon2d      ;-- longitude grid cell center
    res@sfYArray       = lat2d      ;-- latitude grid cell center

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

使用道具 举报

新浪微博达人勋

发表于 2023-10-31 19:52:58 | 显示全部楼层
请问解决了吗
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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