Displaying 2 results from an estimated 2 matches for "data_temp2".
Did you mean:
data_temp
2017 Aug 14
0
ncdf4: Why are NAs converted to _FillValue when saving?
...a bug or intended? Below you find a minimal example (adapted from
> the code in the netcdf4 manual) of the ? in my eye ? strange behavior.
>
?HI Raphael,
I'm going to claim that this is more of an R question than a ncdf4 question
per se. For example, you will notice that if you multiply data_temp2 times
1.0 (leaving values unchanged) or add zero to data_temp2, then the behavior
is what you are expecting. Same holds if you multiply data_temp by 1.0 or
add zero to it. It would seem that R does the equivalent of assigning
another pointer to the data stored in data_temp rather than copying
data...
2017 Aug 14
2
ncdf4: Why are NAs converted to _FillValue when saving?
...ame, list(var_temp))
#-------------------------------
# Put some test data in the file
#-------------------------------
data_temp <- array(0.,dim=c(nx,ny,1))
for( j in 1:ny )
for( i in 1:nx )
data_temp[i,j,1] <- sin(i/10)*sin(j/10)
# add some NAs
data_temp[1:10, 1:5, 1] <- NA
# copy data
data_temp2 <- data_temp
# show what we have
data_temp[1:12, 1:7, 1]
data_temp2[1:12, 1:7, 1]
# write to netCDF connection
ncvar_put( ncid_new, var_temp, data_temp, start=c(1,1,1), count=c(nx,ny,1))
# show what we have now
data_temp[1:12, 1:7, 1]
data_temp2[1:12, 1:7, 1]
# Why are there no more NAs in d...