<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><span style="font-family:monospace,monospace">I think the refrain 'look at your data' applies here.<br><br>===<br>There are several<b> dimension related </b>issues with your data.<br><br></span></div><div><span style="font-family:monospace,monospace">[A]</span> Variable <b>xi<br><br></b></div><div><b>xi: </b><span style="font-family:monospace,monospace"><span style="color:rgb(0,0,255)">[time | <b>12</b>]</span> x [lev | 31] x <span style="color:rgb(255,0,0)"><b>[lon | 192] x [lat | 96]</b></span><br></span><b><span style="font-family:monospace,monospace"></span></b></div><div><span style="font-family:monospace,monospace"><br></span><span style="font-family:monospace,monospace"><span style="font-family:monospace,monospace"></span></span></div><div><span style="font-family:monospace,monospace">Note the two rightmost 'spatial' dimensions: names and sizes<br><br></span></div><div><span style="font-family:monospace,monospace">[B] Variable psfc<br></span><br><span style="font-family:monospace,monospace"><span style="font-family:monospace,monospace"><b>psfc</b>: <span style="color:rgb(0,0,255)">[time | <b>1</b>]</span> x <span style="color:rgb(255,0,0)"><b>[lat | 96] x [lon | 192]</b></span></span></span></div><div><span style="font-family:monospace,monospace"><br></span></div><span style="font-family:monospace,monospace">----------------------<br><br></span></div><div><span style="font-family:monospace,monospace">spatial dimensions:<br></span></div><span style="font-family:monospace,monospace">xi has order (...,lon,lat) ==> (...,192,96)<br></span></div><span style="font-family:monospace,monospace">psfc gas order (...,lat,lon) ==> (...,96,192)<br><br></span></div><span style="font-family:monospace,monospace">temporal dimension size<br></span></div><span style="font-family:monospace,monospace">xi has time=12, psfc=1<br><br>-----------------------<br><br></span></div><span style="font-family:monospace,monospace">You could expand psfc 12 size 12 but I am not sure that is wht you want to do.<br><br></span></div><span style="font-family:monospace,monospace">[C]<br><br></span></div><span style="font-family:monospace,monospace">P0 must have a units attribute<br><br></span></div><span style="font-family:monospace,monospace">[D]<br><br></span></div><span style="font-family:monospace,monospace">Did you want to remove the zonal means or the time mena???<br></span><div><div><span style="font-family:monospace,monospace"><br>++++++++++++++++++++++++++++++++++++++++++++<br><br> f = addfile("ham_oxi_aps_T63L31.nc","r")<br> hyai = f->hyam ; input A(k)<br> hybi = f->hybm ; input B(k)<br> xi = f->OX_VMR_avrg ; variable to be interpolated<br> printVarSummary(xi) ; (time,lev,lon,lat); (0,1,2,3)<br> print("---")<br><br> xi := xi(time|:,lev|:,lat|:,lon|:) ; (time,lev,lat,lon); REORDER<br> printVarSummary(xi) ; (time,lev,lat,lon); (0,1,2,3)<br> print("---")<br><br> xi = dim_rmvmean_Wrap(xi) ; <b>remove zonal means</b><br></span></div><div><span style="font-family:monospace,monospace"> ;xi = dim_rmvmean_n_Wrap(xi, 0) <b>; remove time mean</b><br></span></div><div><span style="font-family:monospace,monospace"> printVarSummary(xi) ; rmvmean_op_NCL: dim_rmvmean over dimension(s): lon<br> print("---")<br><br> fP = addfile("<a href="http://surf_pres_new_exp_echam_exp.nc">surf_pres_new_exp_echam_exp.nc</a>","r")<br> psfc = fP->aps ; surface pressure (Pa)<br> printVarSummary(psfc) ; (time,lat,lon)<br> print("---")<br><br> PSFC = conform( xi(:,0,:,:), psfc(0,:,:), (/1,2/) )<br> copy_VarMeta(psfc(0,:,:), PSFC(0,:,:))<br> printVarSummary(PSFC)<br><br> sigma = (/0.00657, 0.01386, 0.02309, 0.03469, 0.04920, 0.06723, 0.08945, 0.11654, 0.14916, \<br> 0.18783, 0.23286, 0.28421, 0.34137, 0.40334, 0.46860, 0.53529, 0.60135, 0.66482, \<br> 0.72401, 0.77773, 0.82527, 0.86642, 0.90135, 0.93054, 0.95459, 0.97418, 0.99000, \<br> 1.00000/)<br><br> hybo = sigma ; *your* B(k) [ sigma levels ]<br> nsig = dimsizes(hybo)<br> hyao = new(nsig,typeof(hybo))<br> hyao = 0.0 ; set output A(k) to 0.0<br><br> p0 = 101325 ; reference pressure (Pa)<br> p0@units = "Pa"<br><br> xo = hyi2hyo_Wrap(p0,hyai,hybi,PSFC,xi,hyao,hybo,0) ; contributed.ncl<br> printVarSummary(xo)<br></span><div><div><span style="font-family:monospace,monospace"><br><br></span></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 31, 2017 at 11:01 AM, Jayant <span dir="ltr"><<a href="mailto:jayantkp2979@gmail.com" target="_blank">jayantkp2979@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Dear,<br><br></div>I am following the steps given in thread (<a href="https://www.ncl.ucar.edu/Support/talk_archives/2006/0001.html" target="_blank">https://www.ncl.ucar.edu/Supp<wbr>ort/talk_archives/2006/0001.<wbr>html</a>)
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.</div><div>Thanks in advance,</div><div>Jayant<br></div><div><br><span style="font-family:monospace,monospace"> f=addfile("ham_oxi_aps_T63L31.<wbr>nc","r")<br> hyai = f->hyam ; input A(k)<br> hybi = f->hybm ; input B(k) <br> xi = f->OX_VMR_avrg ; (0,:,:,:) ; variable to be interpolated<br> dims = getvardims(xi)<br> xin = dim_rmvmean_Wrap(xi($dims(0)$|<wbr>:,$dims(1)$|:,$dims(3)$|:,$dim<wbr>s(2)$|:))<br> printVarSummary(xin)<br> p0 = 101325 ; reference pressure (Pa)<br><br> fP = addfile("<a href="http://surf_pres_new_exp_echam_exp.nc" target="_blank">surf_pres_new_exp_ech<wbr>am_exp.nc</a>","r")<br> psfc = fP->aps ; surface pressure (Pa)<br> printVarSummary(psfc)<br> ; dims = getvardims(psfc)<br> ; psfcr = dim_rmvmean_Wrap(psfc($dims(0)<wbr>$|:,$dims(2)$|:,$dims(1)$|:))<br> ; psfc2d = psfcr(0,:,:)<br><br> sigma = (/0.00657, 0.01386, 0.02309, 0.03469, 0.04920, 0.06723, 0.08945, 0.11654, 0.14916, \<br> 0.18783, 0.23286, 0.28421, 0.34137, 0.40334, 0.46860, 0.53529, 0.60135, 0.66482, \<br> 0.72401, 0.77773, 0.82527, 0.86642, 0.90135, 0.93054, 0.95459, 0.97418, 0.99000, \<br> 1.00000/)<br><br> hybo = sigma ; *your* B(k) [ sigma levels ] <br> nsig = dimsizes(hybo)<br> hyao = new(nsig,typeof(hybo))<br> hyao = 0.0 ; set output A(k) to 0.0 <br><br> ; xo = hyi2hyo_Wrap(p0,hyai,hybi,psfc<wbr>r,xi,hyao,hybo,0) ; contributed.ncl <br> xo = hyi2hyo_Wrap(p0,hyai,hybi,psfc<wbr>,xin,hyao,hybo,0) ; contributed.ncl <br> printVarSummary(xo)</span><br><br></div>On running, I am getting the following error:<br><br><span style="font-family:monospace,monospace">Variable: xin<br>Type: float<br>Total Size: 27426816 bytes<br> 6856704 values<br>Number of Dimensions: 4<br>Dimensions and sizes: [time | 12] x [lev | 31] x [lat | 96] x [lon | 192]<br>Coordinates: <br> time: [ 0.. 11]<br> lev: [ 1..31]<br> lat: [88.5721685140073..-88.5721685<wbr>140073]<br> lon: [ 0..358.125]<br>Number Of Attributes: 5<br> rmvmean_op_NCL : dim_rmvmean over dimension(s): lon<br> long_name : Deviation from mean<br> grid_type : gaussian<br> units : VMR<br> _FillValue : 9.96921e+36<br><br>Variable: psfc<br>Type: float<br>Total Size: 73728 bytes<br> 18432 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 1] x [lat | 96] x [lon | 192]<br>Coordinates: <br> time: [30.99166666666667..30.9916666<wbr>6666667]<br> lat: [88.57216851400727..-88.572168<wbr>51400727]<br> lon: [ 0..358.125]<br>Number Of Attributes: 5<br> grid_type : gaussian<br> table : 128<br> code : 134<br> units : Pa<br> long_name : surface pressure<br>fatal:hyi2hyo: The rightmost dimensions of 'ps' and 'xi' must be the same<br>fatal:["Execute.c":8575]:Execu<wbr>te: Error occurred at or near line 9139 in file $NCARG_ROOT/lib/ncarg/nclscrip<wbr>ts/csm/contributed.ncl<br></span></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>