<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="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">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>
;--------------------------------AMOC Plots--------------------------------<br>
;--------------------------------------------------------------------------<br>
;##########################################################################<br>
;##########################################################################<br>
<br>
; Adapted from: http://www.ncl.ucar.edu/Applications/Scripts/moc_1.ncl<br>
<br>
;**************************************************************<br>
; read in data<br>
;**************************************************************<br>
<br>
in = addfile("sector_icon_lr_13_mpiom_data_3du_ym_0000-0099.nc","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 : -2147483647<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 : -2147483647<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 tabindex="-1">
<div style="direction: ltr;" id="divRpF884098"><font color="#000000" face="Tahoma" size="2"><b>From:</b> Mary Haley [haley@ucar.edu]<br>
<b>Sent:</b> 05 September 2014 19:59<br>
<b>To:</b> Hemming, Michael<br>
<b>Cc:</b> ncl-talk@ucar.edu Talk<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">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>
</body>
</html>