本文介绍了计算netcdf文件中缺失值的数量-R的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种快速的方法来知道netcdf文件中有多少个缺失值?可能使用R.
Is there a quick way to know how many missing values are in a netcdf file? Possibly using R.
当前我必须
hum<-nc_open("rhum.sig995.2008.nc") rhum<-ncvar_get(hum, "rhum")然后通过键入'hum'手动查找缺失值并将其复制到此操作中
then manually look up the missing value by typing 'hum' and copy it into this operation
sum(abs(rhum - 9.96920996838687e+36) < -9.96920996838687e+36)是否有更直接的方法,尤其是当我必须处理数百个文件时?我想避免复制和粘贴缺失的值,而且我不确定应该以哪种精度处理数字.
Is there a more direct way, especially if I have to work with hundreds of files? I would like to avoid copying and pasting the missing value, and also I am not sure with what kind of precision the number should be handled.
推荐答案我的建议是使用出色的栅格数据包:
My suggestion is to use the excellent raster package:
install.packages(raster) library(raster) r <- raster("rhum.sig995.2008.nc", var="rhum") NAnum <- summary(r)[6]更多推荐
计算netcdf文件中缺失值的数量
发布评论