Displaying 2 results from an estimated 2 matches for "data_temp".
2017 Aug 14
2
ncdf4: Why are NAs converted to _FillValue when saving?
...#39;, list(xdim,ydim,tdim), mv )
#---------------------
# Make new output file
#---------------------
output_fname <-'test_real3d.nc'
ncid_new <- nc_create( output_fname, 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
nc...
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
dat...