<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Mary,<div>&nbsp; &nbsp; &nbsp;Sorry to bother you with another question about masked array.</div><div>&nbsp;</div><div>&nbsp; &nbsp; 1) I am also looking at some other data in the globe (swath data on irregular grids). The original data was in netcdf format and I imported them by using netcdf4. They are masked array with filled value -32768. Then I do further selection by choosing only data over ocean. Then I &nbsp;plot out the 2D figure for ocean data. The python code ran without error, but I got nothing on my figure, except the map and grids !&nbsp;</div><div>&nbsp; &nbsp; &nbsp;If I type tbwater on python terminal, it shows:</div><div>Out[2]:</div><div>masked_array(data = [135.11 135.11 137.95 ..., 137.56 138.49 132.27],</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mask = [False False False ..., False False False],</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fill_value = -32768)</div><div><br></div><div><br></div><div>I do not understand. The part of code is shown below.</div><div><br></div><div>&nbsp; &nbsp; 2) Similarly , I can also get data over coasts by applying some selection. I have also downloaded a coastal database as suggested in your website. I export&nbsp;<span style="background-color: rgb(255, 255, 255); font-family: arial, helvetica, sans-serif; font-size: medium;">PYNGL_RANGS with the right path in .bashrc.&nbsp;</span>I also add&nbsp;mpDataBaseVersion = «&nbsp;HighRes &nbsp;in python code. But on my figure, I have results everywhere, not just on coast. &nbsp;Apparently, I met the same problem as I mentioned in the last email.&nbsp;</div><div><br></div><div><br></div><div>&nbsp; &nbsp; &nbsp;Many thanks again if you can give some clue !</div><div><br></div><div><br></div><div>Xiaoni</div><div><br></div><div><br></div><div><br></div><div><br></div><div>-----------------------------------------------------------------------------</div><div># select only ocean data from the whole data. a masked array.</div><div><div>tbwater = tb_lo_clean[(sft_lo_clean == 0 )]</div><div>latwater = lat_lo_clean[(sft_lo_clean == 0 )]</div><div>lonwater = lat_lo_clean[(sft_lo_clean == 0 )]</div></div><div><br></div><div># select only data over coasts</div><div><div>tbcoast = tb_lo_clean[(sft_lo_clean == 2 )]</div><div>latcoast = lat_lo_clean[(sft_lo_clean == 2 )]</div><div>loncoast = lon_lo_clean[(sft_lo_clean == 2 )]</div></div><div><br></div><div># preparing to plot</div><div>fill_value = -32768</div><div><br></div><div><div>wks_type = "png"</div><div>wks = Ngl.open_wks(wks_type,’data_on_ocean')</div><div>ws_id = Ngl.get_workspace_id()</div></div><div><br></div><div><div>resources = Ngl.Resources()</div><div><br></div><div>resources.sfXArray &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= lonwater</div><div>resources.sfYArray &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= latwater</div><div><br></div><div>resources.sfMissingValueV = fill_value</div><div>resources.nglSpreadColorStart = 176</div><div>resources.nglSpreadColorEnd &nbsp; = 2</div><div>resources.mpDataBaseVersion &nbsp; &nbsp; = "MediumRes"</div><div>#resources.mpGridMaskMode &nbsp; &nbsp; &nbsp; &nbsp;= "MaskLand"</div><div>resources.cnFillOn &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= True</div><div>resources.cnFillMode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= "RasterFill" &nbsp;</div><div>resources.cnFillPalette &nbsp; &nbsp; &nbsp; = "BlAqGrYeOrReVi200"</div><div>resources.cnLinesOn &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = False</div><div>resources.cnLineLabelsOn &nbsp; &nbsp; &nbsp;= False</div><div>resources.lbBoxLinesOn &nbsp; &nbsp; &nbsp; &nbsp;= False</div><div>resources.lbLabelFontHeightF &nbsp;= 0.005</div><div>resources.cnLevelSelectionMode = "ManualLevels"</div><div>resources.cnMinLevelValF &nbsp; &nbsp; &nbsp; = 120</div><div>resources.cnMaxLevelValF &nbsp; &nbsp; &nbsp; = 250</div><div>resources.cnLevelSpacingF &nbsp; &nbsp; &nbsp;= 10</div><div>resources.vpXF &nbsp; &nbsp; &nbsp;= 0.1 &nbsp; &nbsp;# Change the size and location of the</div><div>resources.vpYF &nbsp; &nbsp; &nbsp;= 0.9 &nbsp; &nbsp;# plot on the viewport.</div><div>resources.vpWidthF &nbsp;= 0.4</div><div>resources.vpHeightF = 0.8</div><div><br></div><div># create plot for data over ocean</div><div>resources.tiMainString &nbsp; &nbsp; &nbsp; &nbsp;= "data over ocean &nbsp;on 20030701"</div><div>map = Ngl.contour_map(wks,tbwater,resources)</div></div><div><br></div><div># plot data on coasts</div><div><div>resources.sfXArray &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= loncoast</div><div>resources.sfYArray &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= latcoast</div><div>resources.cnMinLevelValF &nbsp; &nbsp; &nbsp; = 200</div><div>resources.cnMaxLevelValF &nbsp; &nbsp; &nbsp; = 300</div><div>resources.cnLevelSpacingF &nbsp; &nbsp; &nbsp;= 10</div><div>mpDataBaseVersion = "HighRes"</div><div>resources.tiMainString &nbsp; &nbsp; &nbsp; &nbsp;= "data over coasts on 20030701"</div><div>map = Ngl.contour_map(wks,tbcoast,resources)</div></div><div><br></div></body></html>