爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 8028|回复: 6

[作图] 初学:如何用ncl code画calipso卫星数据

[复制链接]
发表于 2019-2-20 08:10:14 | 显示全部楼层 |阅读模式

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

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

x
我需要处理calipso卫星数据,目前我的ncl code只能画出纬度和高度的图。但是我期望是能同时能画出calipso的地面轨迹和气溶胶垂直分布

这是我写的code,谢谢大家的帮忙
load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

begin
  file_name = "CAL_LID_L2_VFM-ValStage1-V3-01.2011-05-20T19-29-59ZD.hdf"

; Read the file.
  hdf4_file = addfile(file_name, "r")

; Print information about the file to know what variables and attributes are
; available for plotting.
print(hdf4_file)


; Here, we'll subset -05km to 8.2km (e.g., 1165:5514)
; over latitude approx. 10N to 40N (e.g., 1700:2450)
; and plot altitude vs. latitude.
  fcf = hdf4_file->Feature_Classification_Flags

; Subset dataset that latitude value increases monotonically.
; Monotonicity is required by NCL.
  lat = hdf4_file->Latitude(1700:2450,0)

  profile = fcf(1700:2450,1165:5514) ; -0.5km to 8.2km

  size = dimsizes(profile)

; Select the first 3 bit for the feature type. See [2, 3] for dim_gbits.
  data2d = dim_gbits(profile, 4, 3, 13, size(1))

; Reshape 2-D data to 3-D for n profiles * y samples.
  data3d = reshape(data2d, (/size(0), 15, 290/))
  ;printVarSummary(data3d)


; Subset horizontally. Variation along longitude (i.e., profile) is very
; small. We'll just pick the first location from each profile.
  data_raw = data3d(:,0,:)              

  levels = (/0.5,1.5,2.5,3.5,4.5,5.5/)  

  xwks = gsn_open_wks("png", file_name + ".v.ncl") ; open workstation
  colormap= (/"white","blue","yellow","red","green","brown","black"/)
  gsn_define_colormap(xwks,colormap)
  cmap = gsn_retrieve_colormap(xwks)

  res = True ; plot mods desired
  res@cnFillOn = True ; enable contour fill
  res@gsnMaximize = True; make plot large
  res@cnLinesOn = False ; turn off contour lines
  res@cnLineLabelsOn =  False; turn off contour line labels
  res@gsnSpreadColors = True ; use the entire color spectrum
  res@cnFillMode = "RasterFill" ; faster
  res@cnMissingValFillPattern = 0 ; missing value pattern is set to "SolidFill"
  res@cnMissingValFillColor = 0; white color for missing values
  res@lbLabelAutoStride = True ; ensure no label overlap
  res@cnFillColors = cmap  
  res@tiMainString = "Level 2 CALIOP vertical feature mask aerosol subtype"
  res@cnLevelSelectionMode = "ExplicitLevels"
  res@cnLevels = levels; (/0.5,1.5,2.5,3.5,4.5,5.5/)
  res@lbLabelAlignment     = "BoxCenters"
  res@lbTitleString    = "Aerosol subtype"
  res@lbOrientation =   "vertical"          ; vertical label bar
  res@lbLabelStrings       = (/"no data","1 clean marine","2 dust","3 polluted continental","4 clean continental","5 polluted dust","6 smoke"/)  

; Create altitude dataset manually
  hgti = ispan(-500, 8170, 30)
  hgt = tofloat(hgti) / 1000.0
  hgt = hgt(::-1)
  hgt@long_name = "Altitude (km)"
  hgt@units     = "km"
  hgt!0 = "hgt"

  lat!0 = "lat"
  lat@long_name = "Latitude"
  lat@units = "degrees_north"

; Select "Cloud" feature type.
  data = todouble(data_raw)

  ;data@long_name = "Feature Type (Bits 10-12) in Feature Classification Flag"
  data!0   = "lat"
  data!1   = "hgt"
  data&lat =  lat
  data&hgt = hgt

; Transpose data so that x-axis becomes latitude and y-axis becomes altitude.
  plot = gsn_csm_contour(xwks, transpose(data(::-1,::-1)),res)

期望图

期望图

我自己的结果图

我自己的结果图
密码修改失败请联系微信:mofangbao
发表于 2019-2-21 20:11:13 | 显示全部楼层
做的很不错,感觉作者还是用心在作图。
密码修改失败请联系微信:mofangbao
发表于 2019-2-22 09:24:18 | 显示全部楼层
期望的图太高端了,期待楼主大功告成之日
密码修改失败请联系微信:mofangbao
发表于 2019-2-27 09:21:06 | 显示全部楼层
地面轨迹应该好画,就是把经纬度打点到地图上就行了。我画过其他卫星数据的轨迹图,另外论坛上也有很多类似的轨迹图
密码修改失败请联系微信:mofangbao
发表于 2019-6-19 17:05:50 | 显示全部楼层
请问您知道怎么画环青藏高原的气溶胶类型吗
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

 楼主| 发表于 2019-9-11 12:04:12 | 显示全部楼层
你好,你有具体的数据和信息吗?我也是新手不知道能不能帮忙,不过可以一起交流学习
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

发表于 2019-12-30 16:46:28 | 显示全部楼层
你好,你这里面好像没有判断bits1-3是为3时3 = tropospheric aerosol的时候吧,然后才可以取aerosol subtype吧?怎么处理的呢?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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