<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;"><font size="3">I am using version ncl 6.1.2-precompiled, I tried to continue without using poisson_grid_fill. I removed the missing values (set = 0) from the data using CDO and
have managed to get closer to the solution, although now I get the following error:<br>
<br>
fatal:Number of dimensions on right hand side do not match number of dimension in left hand side<br>
fatal:["Execute.c":8128]:Execute: Error occurred at or near line 51 in file<br>
<br>
I am using the uv2sfvpg(barai,v,sf,vp) function, with the following dimensions:<br>
<br>
<br>
<font color="339966">Variable: barai<br>
Type: float<br>
Total Size: 1260000 bytes<br>
315000 values<br>
Number of Dimensions: 3<br>
Dimensions and sizes: [time | 100] x [lat | 90] x [lon | 35]<br>
Coordinates: <br>
time: [ 0..36130]<br>
lat: [-44.5..44.5]<br>
lon: [ -52.. -18]<br>
Number Of Attributes: 6<br>
standard_name : u_vint_acc<br>
long_name : barotropic zonal velocity<br>
units : m*m/s<br>
code : 255<br>
_FillValue : -9e+33<br>
missing_value : -9e+33<br>
<br>
<br>
<br>
<br>
Variable: v<br>
Type: float<br>
Total Size: 25200000 bytes<br>
6300000 values<br>
Number of Dimensions: 4<br>
Dimensions and sizes: [time | 100] x [depth | 20] x [lat | 90] x [lon | 35]<br>
Coordinates: <br>
time: [ 0..36130]<br>
depth: [ 7..2435]<br>
lat: [-44.5..44.5]<br>
lon: [ 308.. 342]<br>
Number Of Attributes: 6<br>
standard_name : v_acc<br>
long_name : meridional velocity component<br>
units : m/s<br>
code : 255<br>
_FillValue : -9e+33<br>
missing_value : -9e+33<br>
<br>
<br>
<br>
Variable: lon<br>
Type: double<br>
Total Size: 280 bytes<br>
35 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [35]<br>
Coordinates: <br>
<br>
<br>
<br>
Variable: lat<br>
Type: double<br>
Total Size: 720 bytes<br>
90 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [lat | 90]<br>
Coordinates: <br>
lat: [-44.5..44.5]<br>
Number Of Attributes: 4<br>
standard_name : latitude<br>
long_name : latitude<br>
units : degrees_north<br>
axis : Y</font><br>
<br>
<br>
<br>
<br>
and here is my code:<br>
<br>
<br>
<font color="FF0000"><span style="background-color: rgb(255, 255, 255);">dimUV= dimsizes(barai)<br>
<br>
klev = 20<br>
<br>
sf = v(:,{klev},:,:)<br>
vp = v(:,{klev},:,:)<br>
sf@long_name = "stream function"<br>
vp@long_name = "velocity potential"<br>
sf@units = "m^2/s"<br>
vp@units = "m^2/s"<br>
<br>
nlat = 90 ; dimensions<br>
mlon = 35<br>
<br>
<br>
<br>
uvmsg = 1e+36<br>
<br>
sf = new ( (/nlat,mlon /), float, uvmsg ) ; stream function<br>
vp = new ( (/nlat,mlon /), float, uvmsg ) ; velocity potential<br>
<br>
printVarSummary(sf)<br>
printVarSummary(vp) <br>
<br>
uv2sfvpg(barai,v,sf,vp)</span></font><br>
<br>
<br>
<br>
<br>
end<br>
</font><br>
<br>
<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF772893"><font color="#000000" face="Tahoma" size="2"><b>From:</b> Mary Haley [haley@ucar.edu]<br>
<b>Sent:</b> 18 September 2014 20:22<br>
<b>To:</b> Hemming, Michael<br>
<b>Cc:</b> ncl-talk@ucar.edu<br>
<b>Subject:</b> Re: [ncl-talk] Calculating Barotropic streamfunction and AMOC using data with missing values?<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">
<div class="gmail_default" style="font-size:small">Michael,</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">The error telling you exactly what the the problem is: the first argument must be a float or double. But, your "printVarSummary" output seems to indicate that your arrays are float, so I'm not sure why you
are getting this error.</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small"> poisson_grid_fill is working just fine for me using either float or double input, so maybe there's a different issue. What version of NCL do you have?</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">--Mary</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sat, Sep 6, 2014 at 4:57 AM, Hemming, Michael <span dir="ltr">
<<a href="mailto:michael.hemming@mpimet.mpg.de" target="_blank">michael.hemming@mpimet.mpg.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt"><font size="4">Hi Mary,<br>
<br>
Thanks for the suggestion. I have since been told that the data has been conservatively interpolated onto a regular grid from the original triangular grid, so this command may work. Although, I am having trouble understanding exactly what it does. I guess it
is a form of interpolation but I'm not sure what the following means and how I should change this to suit my data:<br>
<br>
</font>
<pre><font size="4"> guess = 1 ; use zonal means
is_cyclic = True ; cyclic [global]
nscan = 1500 ; usually much less than this
eps = 1.e-2 ; variable dependent
relc = 0.6 ; relaxation coefficient
opt = 0 ; not used</font></pre>
<font size="4">and I also have the problem of missing values for the following script, where it complains about missing values at the line including ' zone_int = new((/nlat........':</font><br>
<br>
<br>
<br>
<span style="background-color:rgb(255,255,255)"><font color="33CCCC"><font size="3"><span class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
<br>
begin<br>
<br>
;##########################################################################<br>
;##########################################################################<br>
</span>;--------------------------------AMOC Plots--------------------------------<br>
;--------------------------------------------------------------------------<br>
;##########################################################################<br>
;##########################################################################<br>
<br>
; Adapted from: <a href="http://www.ncl.ucar.edu/Applications/Scripts/moc_1.ncl" target="_blank">
http://www.ncl.ucar.edu/Applications/Scripts/moc_1.ncl</a><br>
<br>
;**************************************************************<br>
; read in data<br>
;**************************************************************<br>
<br>
in = addfile("<a href="http://sector_icon_lr_13_mpiom_data_3du_ym_0000-0099.nc" target="_blank">sector_icon_lr_13_mpiom_data_3du_ym_0000-0099.nc</a>","r")<br>
<br>
v = in->vke<br>
dz = in->depth<br>
dx = in->uko ;if doesn't work check this line!<br>
lat= in->lat<br>
<br>
poisson_grid_fill( v, True, 1, 1500, 1e-2, 0.6, 0)<br>
poisson_grid_fill( dx, True, 1, 1500, 1e-2, 0.6, 0)<br>
<br>
<br>
dxx = rm_single_dims(dx({depth|7},{lon|-45:-45},{lat|-30:-30},time|:))<br>
<br>
printVarSummary(v)<br>
printVarSummary(dz)<br>
printVarSummary(dx)<br>
printVarSummary(dxx)<br>
printVarSummary(lat)<br>
<br>
<br>
;**************************************************************<br>
; some parameters<br>
;**************************************************************<br>
<br>
<br>
nzt = getfilevardimsizes(in,"z_t") ; z_t grid (25)<br>
nzw = nzt+1 ; z_w grid (26)<br>
nlat = dimsizes(lat)<br>
<br>
d2rad = 0.017453 ; degrees to radians<br>
<br>
printVarSummary(nzt)<br>
printVarSummary(nzw)<br>
printVarSummary(nlat)<br>
<br>
<br>
;************************************************************** <br>
; calculate first intergral <br>
; int[lon1:lon2]v*cos(lat)*dx*dz<br>
; this calculation is done on the z_t grid<br>
;**************************************************************<br>
<br>
<br>
zone_int = new((/nlat,nzt/),typeof(v)) ; allocate space<br>
do k = 0, nzt-1<br>
do j = 0, nlat-1<br>
zone_int(j,k) = dim_sum(v(k,j,:)*cos(lat(j)*d2rad)*dxx*dz(k))<br>
end do<br>
end do<br>
printVarSummary(zone_int)</font><br>
</font></span><br>
<br>
<br>
<br>
<br>
<br>
<font size="4">The results from using PrintVarSummary:</font><br>
<br>
<br>
<br>
<br>
<font color="339966" size="3">Variable: v<br>
Type: float<br>
Total Size: 40992000 bytes<br>
10248000 values<br>
Number of Dimensions: 4<br>
Dimensions and sizes: [time | 100] x [depth | 20] x [lat | 122] x [lon | 42]<br>
Coordinates: <br>
time: [ 0..867240]<br>
depth: [ 7..2435]<br>
lat: [45.375..-45.375]<br>
lon: [-51.375..-20.625]<br>
Number Of Attributes: 6<br>
standard_name : sea_water_y_velocity<br>
long_name : Sea water y velocity<br>
units : m s-1<br>
code : 4<br>
_FillValue : -9e+33<br>
missing_value : -9e+33<br>
<br>
Variable: dz<br>
Type: double<br>
Total Size: 160 bytes<br>
20 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [depth | 20]<br>
Coordinates: <br>
depth: [ 7..2435]<br>
Number Of Attributes: 5<br>
standard_name : depth<br>
long_name : depth_below_sea<br>
units : m<br>
positive : down<br>
axis : Z<br>
<br>
Variable: dx<br>
Type: float<br>
Total Size: 40992000 bytes<br>
10248000 values<br>
Number of Dimensions: 4<br>
Dimensions and sizes: [time | 100] x [depth | 20] x [lat | 122] x [lon | 42]<br>
Coordinates: <br>
time: [ 0..867240]<br>
depth: [ 7..2435]<br>
lat: [45.375..-45.375]<br>
lon: [-51.375..-20.625]<br>
Number Of Attributes: 6<br>
standard_name : sea_water_x_velocity<br>
long_name : Sea water x velocity<br>
units : m s-1<br>
code : 3<br>
_FillValue : -9e+33<br>
missing_value : -9e+33<br>
<br>
Variable: dxx<br>
Type: float<br>
Total Size: 400 bytes<br>
100 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [time | 100]<br>
Coordinates: <br>
time: [ 0..867240]<br>
Number Of Attributes: 9<br>
lon : -45.375<br>
lat : -29.625<br>
depth : 7<br>
missing_value : -9e+33<br>
_FillValue : -9e+33<br>
code : 3<br>
units : m s-1<br>
long_name : Sea water x velocity<br>
standard_name : sea_water_x_velocity<br>
<br>
Variable: lat<br>
Type: double<br>
Total Size: 976 bytes<br>
122 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [lat | 122]<br>
Coordinates: <br>
lat: [45.375..-45.375]<br>
Number Of Attributes: 4<br>
standard_name : latitude<br>
long_name : latitude<br>
units : degrees_north<br>
axis : Y<br>
<br>
Variable: nzt<br>
Type: integer<br>
Total Size: 4 bytes<br>
1 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [1]<br>
Coordinates: <br>
Number Of Attributes: 1<br>
_FillValue : -<a href="tel:2147483647" value="+12147483647" target="_blank">2147483647</a><br>
<br>
Variable: nzw<br>
Type: integer<br>
Total Size: 4 bytes<br>
1 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [1]<br>
Coordinates: <br>
Number Of Attributes: 1<br>
_FillValue : -<a href="tel:2147483647" value="+12147483647" target="_blank">2147483647</a><br>
<br>
Variable: nlat<br>
Type: integer<br>
Total Size: 4 bytes<br>
1 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [1]<br>
Coordinates: </font><br>
<br>
<br>
<font size="4">The error:</font><br>
<br>
<font color="FF0000" size="3">fatal:poisson_grid_fill: The first input argument must be float or double<br>
fatal:["Execute.c":8128]:Execute: Error occurred at or near line 64 in file AMOC.ncl</font><br>
<br>
<br>
<br>
<br>
<font size="4"><br>
thanks,<br>
Michael</font><br>
<br>
<br>
<div style="font-family:Times New Roman; color:#000000; font-size:16px">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>From:</b> Mary Haley [<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>]<br>
<b>Sent:</b> 05 September 2014 19:59<br>
<b>To:</b> Hemming, Michael<br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> Talk<br>
<b>Subject:</b> Re: [ncl-talk] Calculating Barotropic streamfunction and AMOC using data with missing values?<br>
</font><br>
</div>
<div>
<div class="h5">
<div></div>
<div>
<div dir="ltr">
<div class="gmail_default" style="font-size:small">Hi Michael,</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">I'm hoping Dennis will weigh in here. </div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">You really don't want to use the spherical harmonic routines on missing data. Normally I would say you need to regrid the data or use poisson_grid_fill first so you can get rid of missing values, but given
that this is UV data, I don't think this is your best option. </div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">--Mary</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Tue, Sep 2, 2014 at 5:16 AM, Michael Hemming <span dir="ltr">
<<a href="mailto:michael.hemming@mpimet.mpg.de" target="_blank">michael.hemming@mpimet.mpg.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div bgcolor="#FFFFFF"><small><big>Hello,<br>
<br>
I have been struggling to calculate Barotropic streamfunction and AMOC using online examples and function but I have recently been told it is due to the fact that the data I use contains missing values, therefore all values are set to the missing value.
<br>
<br>
How can I somehow ignore the missing values during calculation?<br>
<br>
Here is my code for the bartropic streamfunction:</big><br>
<br>
----------------------------------------------------------------------------------------------------------------------------------------------------<br>
<br>
<small><font size="4"><small><small><font color="FF0000">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
<br>
begin<br>
<br>
;##########################################################################<br>
;##########################################################################<br>
;-------------------------Barotropic Plots---------------------------------<br>
;--------------------------------------------------------------------------<br>
;##########################################################################<br>
;##########################################################################<br>
<br>
;----------Load in data<br>
<br>
;ICON<br>
<br>
noshupw = addfile ("<a href="http://con.ym.atlbox.noshift.100y.nc" target="_blank">con.ym.atlbox.noshift.100y.nc</a>", "r")<br>
u = noshupw->u_vint_acc<br>
u&lon = u&lon-360 ; Fix the longitudes to be < 360<br>
lat = noshupw->lat<br>
<br>
<br>
v = noshupw->v_acc<br>
<br>
printVarSummary(u)<br>
printVarSummary(v)<br>
<br>
dimUV= dimsizes(barai)<br>
<br>
klev = 20 <font color="FF0000">; number of levels in total</font><br>
<br>
sf = v(:,{klev},:,:)<br>
vp = v(:,{klev},:,:)<br>
sf@long_name = "stream function"<br>
vp@long_name = "velocity potential"<br>
sf@units = "m^2/s"<br>
vp@units = "m^2/s"<br>
<br>
printVarSummary(sf)<br>
printVarSummary(vp) <br>
<br>
uv2sfvpg(u,v,sf,vp)</font></small></small></font></small><br>
</small><br>
<small><br>
----------------------------------------------------------------------------------------------------------------------------------------------------<br>
<br>
<big><big><small>and my AMOC code is largely based on the online example moc_1.ncl<br>
<br>
<br>
<br>
thanks,<br>
Michael</small><br>
</big></big><br>
</small><br>
</div>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</body>
</html>