<div dir="ltr"><div class="gmail_default" style="font-size:small">Beata,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">When going from a 'higher' type to a 'lower' type (double to float, for example), you need to use the reassignment operator (':=') to force the conversion:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><p class="gmail-m_7531163896496914688MsoNoSpacing" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> p8@missing_value := <wbr>doubletofloat(p8@missing_value<wbr>)<u></u><u></u></p><p class="gmail-m_7531163896496914688MsoNoSpacing" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"> p8@_FillValue := p8@missing_value</p><p class="gmail-m_7531163896496914688MsoNoSpacing" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><br></p><p class="gmail-m_7531163896496914688MsoNoSpacing" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">It might be better to use the "totype" function:</p><p class="gmail-m_7531163896496914688MsoNoSpacing" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><br></p><p class="gmail-m_7531163896496914688MsoNoSpacing" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:14.6667px"> p8@_FillValue := </span><wbr style="font-size:14.6667px"><span style="font-size:14.6667px">totype(p8@_FillValue,typeof(p8)</span><wbr style="font-size:14.6667px"><span style="font-size:14.6667px">)</span></p><p class="gmail-m_7531163896496914688MsoNoSpacing" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:14.6667px"> p8@missing_value := </span><wbr style="font-size:14.6667px"><span style="font-size:14.6667px">totype(p8@missing_value,typeof(p8)</span><wbr style="font-size:14.6667px"><span style="font-size:14.6667px">)</span><br></p><p class="gmail-m_7531163896496914688MsoNoSpacing" style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><br></p></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 19, 2017 at 1:04 AM, Beáta Szabó-Takács <span dir="ltr"><<a href="mailto:szabo.b@czechglobe.cz" target="_blank">szabo.b@czechglobe.cz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="HU" link="#0563C1" vlink="#954F72">
<div class="m_7531163896496914688WordSection1">
<p class="m_7531163896496914688MsoNoSpacing">Dear NCL Users,<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">I would like to create a taylor_metrics_table where the missing values are denoted by -999. This part of script is:<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> season = (/ "DJF","JJA" /)<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> nSeason = dimsizes(season)<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> table = new ( (/nCase,nSeason,nSource/), typeof(ratio) )<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> table(0,:,:) = (/CA_bias, CA_biasn/)<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> table(1,:,:) = (/CB_bias, CB_biasn/)<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> table(2,:,:) = (/CC_bias, CC_biasn/)<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> table(3,:,:) = (/CD_bias, CD_biasn/)<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> tt_opt = True<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> tt_opt@tableTitle = "Bias(%)"<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> tt_opt@pltType= "png" ; "eps" [default], "pdf", "ps"<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> <wbr> ; "png", "gif" [if you have ImageMajik 'convert']<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">; tt_opt@color0 = "palegreen2"<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">; tt_opt@color1 = "tomato2"<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> tt_opt@color0 = "white"<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> tt_opt@color1 = "white"<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> taylor_metrics_table("taylor_<wbr>bias_dry", source, case ,season, table, tt_opt)<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">I have some netcdf files where the precipitation (pr) values are float data type, but the _FillValue and missing_value are double. I tried convert these data to float with:<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">ncap2 -s 'pr=float(pr)' CM5A-MR_RCA4_dry_power_sm.nc CM5A-MR_RCA4_dry_power_sm2.nc<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">It converted the _FillValue to float but the missing_value are still double:<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">netcdf CM5A-MR_RCA4_dry_power_sm2 {<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">dimensions:<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> time = UNLIMITED ; // (4 currently)<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> latitude = 201 ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> longitude = 464 ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">variables:<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> float pr(time, latitude, longitude) ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> pr:_FillValue = -999.f ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> pr:cell_methods = "time: mean" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> pr:long_name = "precipitation" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> pr:missing_value = -999. ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> pr:standard_name = "precipitation_flux" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> pr:units = "mm" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> float longitude(longitude) ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> longitude:standard_name = "longitude" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> longitude:long_name = "longitude" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> longitude:units = "degrees_east" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> longitude:axis = "X" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> float latitude(latitude) ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> latitude:standard_name = "latitude" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> latitude:long_name = "latitude" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> latitude:units = "degrees_north" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> latitude:axis = "Y" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> double time(time) ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> time:standard_name = "time" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> time:long_name = "time" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> time:units = "days since 1949-12-1 00:00:00" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> time:calendar = "standard" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> time:axis = "T" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">The resulted table is attached. In the table the missing values are denoted by double values in CD_biasn despite the fact that the printed CD_biasn contains _FillValues:<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">Variable: CD_biasn<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">Type: float<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">Total Size: 20 bytes<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> 5 values<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">Number of Dimensions: 1<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">Dimensions and sizes: [5]<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">Coordinates:<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">Number Of Attributes: 1<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> _FillValue : -999<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">(0) -999<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">(1) -4.541727<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">(2) 12.45617<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">(3) 10.47692<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">(4) -999<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">I also tried to convert the missing values to float type by ncl doubletofloat function but it does not work:<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">p8@missing_value=<wbr>doubletofloat(p8@missing_value<wbr>)<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> p8@_FillValue = p8@missing_value<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> delete(p8@missing_value)<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">fatal:Type Mismatch: The type of missing value could not be converted to type of variable (p8)<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> p8_out = addfile("<a href="http://p8.nc" target="_blank">p8.nc</a>","c")<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> p8_out ->p8 = p8<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">ncdump -h <a href="http://p8.nc" target="_blank">p8.nc</a><u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">netcdf p8 {<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">dimensions:<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> time = 4 ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> latitude = 201 ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> longitude = 464 ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">variables:<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> float p8(time, latitude, longitude) ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> p8:_FillValue = -999.f ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> p8:cell_methods = "time: mean" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> p8:long_name = "precipitation" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> p8:missing_value = -999. ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> p8:standard_name = "precipitation_flux" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> p8:units = "mm" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> double time(time) ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> time:standard_name = "time" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> time:long_name = "time" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> time:units = "days since 1949-12-1 00:00:00" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> time:calendar = "standard" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> time:axis = "T" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> float latitude(latitude) ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> latitude:standard_name = "latitude" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> latitude:long_name = "latitude" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> latitude:units = "degrees_north" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> latitude:axis = "Y" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> float longitude(longitude) ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> longitude:standard_name = "longitude" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> longitude:long_name = "longitude" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> longitude:units = "degrees_east" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"> longitude:axis = "X" ;<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">}<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing"><u></u> <u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">Can someone suggest me a solution?<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">Thank you for your help in advance!<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">Kind regards,<u></u><u></u></p>
<p class="m_7531163896496914688MsoNoSpacing">Beata<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</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>