NCO:使用另一个NETCDF蒙版文件掩盖NetCDF文件,其中(0-1)值

发布于 2025-01-23 15:17:22 字数 289 浏览 5 评论 0原文

我有两个.nc文件data.ncmask.nc。 其中:data.nc包含一个称为temp未掩盖的变量,而bask.nc在一个称为tmask 带有(0-1)值。 使用nco,如何应用data.nc文件的掩码,以便将零掩码值设置为丢失,而Unity掩码值则保持不变?

I have two .nc files data.nc and mask.nc.
Where: data.nc contain a variable called temp unmasked, while mask.nc contain the mask within a variable called tmask with (0 - 1) values.
Using NCO, how can I apply the masking for the data.nc file, such that zero mask values are set to missing, and unity mask values are retained unchanged?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

月下凄凉 2025-01-30 15:17:22

目前尚不清楚您想对面具做什么。这是一个常见的过程,请使用掩码将实际值替换为缺少的值:

ncks -A -v tmask mask.nc data.nc
ncap2 -s 'where(tmask == 0) temp=temp.get_miss()' data.nc out.nc

and and get_miss

如果temptmask有更多的记录被广播到temp的大小:

ncap2 -s '*big_mask=0*temp+tmask;where(big_mask == 0) temp=temp.get_miss()' data.nc out.nc

It's unclear what you wish to do with the mask. Here is a common procedure, use the mask to replace the actual values with missing values:

ncks -A -v tmask mask.nc data.nc
ncap2 -s 'where(tmask == 0) temp=temp.get_miss()' data.nc out.nc

Documentation for where and get_miss is in the manual.

If temp has more records than tmask then make the where() condition operate on a copy of tmask that has been broadcast to the size of temp:

ncap2 -s '*big_mask=0*temp+tmask;where(big_mask == 0) temp=temp.get_miss()' data.nc out.nc
奈何桥上唱咆哮 2025-01-30 15:17:22

要在cdo中执行相同的操作,您可以尝试此操作,该操作在服用产品之前先在掩码中设置为零:

cdo setctomiss,0 mask.nc maskm.nc
cdo mul data.nc maskm.nc masked_data.nc

cdo自动重复掩码以使其相同时间长度为数据文件,称为数据“广播”。

我在 broadcasting

To do the same operation in cdo you could try this, which sets zero to missing in the mask first before taking the product:

cdo setctomiss,0 mask.nc maskm.nc
cdo mul data.nc maskm.nc masked_data.nc

cdo automatically repeats the mask to make it the same length in time as the data file, known as data "broadcasting".

I have a youtube video on masking here for further guidance, and other material on temporal broadcasting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文