Re: reading csv data with missing values

From: Will Hobbs <Will.Hobbs_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 26 2014 - 21:17:23 MST

Bin

The reason that NCL doesn't recognise the missing data is that those entries are completely blank; you need something in there or NCL won't be able to recognise those blank spaces as missing values.

Try putting a FillValue in the blank fields; this can be any value that is outside the physical range of you input data, although -999.9 is the NCL default.
Then, assign the FillValue as an attribute after you have read the csv

>data = asciiread("data/test.csv",(/16,2/),"float")
>data@_FillValue = -999.9 ;(or whatever number you have assigned in the input .csv file

Hope that helps

Will

From: zhangbinrc <zhangbinrc@163.com<mailto:zhangbinrc@163.com>>
Date: Thursday, 27 February 2014 2:59 PM
To: "ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>" <ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>>
Subject: [ncl-talk] reading csv data with missing values

Hi all,

I’m writing a script to read in a 16x2 csv file with 3 values missing. The main script lines are as following:

data = asciiread("data/test.csv",(/16,2/),"float")

print(data(:,1))

The problem is that the missing values are skipped. Is there any way that I can keep the missing values in the right location of the matrix ?

The file is attached here.

Thanks!

张斌 博士生/Bin Zhang Ph.D. Candidate
清华大学地球系统科学研究中心/ Center for Earth System Science, Tsinghua
Email:zhangbin06@mails.tsinghua.edu.cn<mailto:zhangbin06@mails.tsinghua.edu.cn>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Feb 26 21:17:36 2014

This archive was generated by hypermail 2.1.8 : Mon Mar 03 2014 - 14:26:18 MST