Loading data with -9999 as NaN
izishaw
I am loading csv data files into a matrix. The csv files use the value -9999 as NaN or Error code. Is there a LoadWave flag that would instruct Igor to read -9999 as NaN? Igor currently loads it as number and this makes graphing right away impractical.
If there is no switch for LoadWave is the alternative to go through the wave once it is loaded and replace -9999 with NaNs using conditional operators?
Thanks
MatrixOP/O wave1=Replace(wave1,-9999,NaN)
I hope this helps,
A.G.
WaveMetrics, Inc.
September 6, 2013 at 01:19 pm - Permalink
If your file is Fortran format (each column of numbers in a fixed field of characters), you can load it as "Fixed Field" which does have the option of treating 9999 as NaN. This is the last parameter of the LoadWave /F field. For details execute:
I'm not sure if it works with -9999.
Another approach is to convert -9999 to NaN after loading the data. Here is an example:
Edit test
test = test==-9999 ? NaN : test // You need the space around the colon
For documentation on the ?: operator execute:
September 6, 2013 at 01:23 pm - Permalink
hrodstein the 9999 is indeed from a Fortran piece of software however the data is further formatted into CSV with varying column lengths (due to column labels) after the initial computation in Fortran therefore I cannot use the fixed file format loading.
I think I will go with A.G. suggestion to use the Replace operation on the matrix.
Thanks again and enjoy your weekends.
September 6, 2013 at 02:08 pm - Permalink