Re: missing data

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Wed Oct 05 2011 - 11:02:29 MDT

Hi Xiaoyan,
There might be a few problems here. Are you getting any error messages?
I would guess that you are... If you are the next time you send a
question to ncl-talk please include any error messages that you are
getting...

Does your var array have latitude/longitude coordinate variables
assigned to it? From the snippet of code you sent I don't see them..
You are reading in your data from a binary file, but when you do that
there will not be any information associated associated with your data
array that describes it. So, you need to assign that information to your
var array:

var!0 = "lat"
var&lat = ispan(-90,90,4) ; I am guessing that your latitudes run from
                            ; -90:90 by 4.. You may need to change this.
var&lat@units = "degrees_north"

var!1 = "lon"
var&lon = ispan(0,355,5) ; I am guessing that your longitudes run from
                            ; 0:355 by 6.. You may need to change this.
var&lon@units = "degrees_east"

By default, NCL will color fill areas denoted by the _FillValue
attribute as white. So you need to make sure that var@_FillValue is set
appropriately:

var@_FillValue = ; set _FillValue, where data is missing, to the
                       ; appropriate value

Finally, and this might be most important, if your var array is mostly
composed of missing data, you are going to want to tell NCL to Raster
Fill, instead of Area Fill.. Going to Raster Fill will show each
individual grid box, while Area Fill may or may not.. So, add this:

res@cnFillMode = "RasterFill"

to your resource list.

If that advice doesn't solve your issue, please respond back to
ncl-talk.. Adam

On 10/05/2011 10:27 AM, Xiaoyan Ma wrote:
> Hi
>
> I want to create a contour plot from the observational data, i.e. for a
> 46*72 grid there are only ~ 100 points with observations, other points
> with missing data (I set a value as 0.0001). when I use ncl as below, I
> want to let those points with missing data as WHITE, but others as
> color. I do so in 2 ways:
>
> 1) set missing data as mask
> 2) set missing data as FillValue
>
> I do see there are values of non-0.0001 by using print, but the
> contour looks all white from 1) or 2). anybody tell me what is wrong?
>
> thanks a lot.
>
> Xiaoyan
>
> --------------------------------------------------------------------------
> var = fbindirread("1.dat",0, (/46,72/), "float")
>
> print(var)
> ; var = mask(var,var.le.0.001,False) ; create
> artificial areas of missing data
>
> var@_FillValue = 0.0001 ; sets _FillValue to
> 0.0001
>
> res = True ; plot mods desired
> res@cnFillOn = True ; turn on color
> res@cnLinesOn = False ; no contour lines
>
> plot= gsn_csm_contour_map_ce(wks,var,res)
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Oct 5 11:02:36 2011

This archive was generated by hypermail 2.1.8 : Sun Oct 09 2011 - 13:05:26 MDT