[ncl-talk] hyi2hyo: rightmost dimension of ps and xi must be the same

Jayant jayantkp2979 at gmail.com
Tue Oct 31 11:01:03 MDT 2017


Dear,

I am following the steps given in thread (https://www.ncl.ucar.edu/
Support/talk_archives/2006/0001.html) to convert a file from hybrid level
to sigma levels. I paste below my script and the outputs. I am not able to
understand where I am going wrong. Please advice. Also, let me know if I
need to send my netcdf files as well.
Thanks in advance,
Jayant

  f=addfile("ham_oxi_aps_T63L31.nc","r")
  hyai = f->hyam         ; input A(k)
  hybi = f->hybm         ; input B(k)
  xi   = f->OX_VMR_avrg        ; (0,:,:,:)     ; variable to be interpolated
  dims = getvardims(xi)
  xin  = dim_rmvmean_Wrap(xi($dims(0)$|:,$dims(1)$|:,$dims(3)$|:,$
dims(2)$|:))
  printVarSummary(xin)
  p0   = 101325            ; reference pressure (Pa)

  fP   = addfile("surf_pres_new_exp_echam_exp.nc","r")
  psfc = fP->aps            ; surface pressure (Pa)
  printVarSummary(psfc)
  ; dims = getvardims(psfc)
  ; psfcr = dim_rmvmean_Wrap(psfc($dims(0)$|:,$dims(2)$|:,$dims(1)$|:))
  ; psfc2d = psfcr(0,:,:)

  sigma = (/0.00657, 0.01386, 0.02309, 0.03469, 0.04920, 0.06723, 0.08945,
0.11654, 0.14916, \
         0.18783, 0.23286, 0.28421, 0.34137, 0.40334, 0.46860, 0.53529,
0.60135, 0.66482,    \
         0.72401, 0.77773, 0.82527, 0.86642, 0.90135, 0.93054, 0.95459,
0.97418, 0.99000,    \
         1.00000/)

  hybo = sigma            ; *your* B(k) [ sigma levels ]
  nsig = dimsizes(hybo)
  hyao = new(nsig,typeof(hybo))
  hyao = 0.0             ; set output A(k) to 0.0

  ; xo = hyi2hyo_Wrap(p0,hyai,hybi,psfcr,xi,hyao,hybo,0) ; contributed.ncl
  xo = hyi2hyo_Wrap(p0,hyai,hybi,psfc,xin,hyao,hybo,0) ; contributed.ncl
  printVarSummary(xo)

On running, I am getting the following error:

Variable: xin
Type: float
Total Size: 27426816 bytes
            6856704 values
Number of Dimensions: 4
Dimensions and sizes:    [time | 12] x [lev | 31] x [lat | 96] x [lon | 192]
Coordinates:
            time: [   0..  11]
            lev: [ 1..31]
            lat: [88.5721685140073..-88.5721685140073]
            lon: [   0..358.125]
Number Of Attributes: 5
  rmvmean_op_NCL :    dim_rmvmean over dimension(s): lon
  long_name :    Deviation from mean
  grid_type :    gaussian
  units :    VMR
  _FillValue :    9.96921e+36

Variable: psfc
Type: float
Total Size: 73728 bytes
            18432 values
Number of Dimensions: 3
Dimensions and sizes:    [time | 1] x [lat | 96] x [lon | 192]
Coordinates:
            time: [30.99166666666667..30.99166666666667]
            lat: [88.57216851400727..-88.57216851400727]
            lon: [   0..358.125]
Number Of Attributes: 5
  grid_type :    gaussian
  table :    128
  code :    134
  units :    Pa
  long_name :    surface pressure
fatal:hyi2hyo: The rightmost dimensions of 'ps' and 'xi' must be the same
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 9139 in
file $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171031/bcedfbab/attachment.html>


More information about the ncl-talk mailing list