NetCDF:将变量设置为时间常数 [英] NetCDF : set variable as constant in time

查看:54
本文介绍了NetCDF:将变量设置为时间常数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理具有以下结构的 netCDF 文件:

I am dealing with netCDF files with the following structure :

netcdf YYY {
dimensions:
    Time = UNLIMITED ; // (XXX currently)
    lat = XX ;
    lon = XX ;
variables:
    double U_p_500hPa(Time, lat, lon) ;
        U_p_500hPa:units = "m/s" ;
        U_p_500hPa:_FillValue = -9999. ;
        U_p_500hPa:description = "U at 500hPa" ;
        U_p_500hPa:PlotLevelID = "500 hPa" ;
    float XLAT(Time, lat, lon) ;
        XLAT:FieldType = 104 ;
        XLAT:MemoryOrder = "XY " ;
        XLAT:description = "LATITUDE, SOUTH IS NEGATIVE" ;
        XLAT:units = "degree_north" ;
        XLAT:stagger = "" ;
    float XLONG(Time, lat, lon) ;
        XLONG:FieldType = 104 ;
        XLONG:MemoryOrder = "XY " ;
        XLONG:description = "LONGITUDE, WEST IS NEGATIVE" ;
        XLONG:units = "degree_east" ;
        XLONG:stagger = "" ;

问题是 XLONG 和 XLAT 实际上并不取决于时间.

The thing is XLONG and XLAT do not actually depend of time.

因此我想知道是否有办法将坐标变量设置为独立于时间以获得更轻的文件?

Therefore i wonder if there is a way to set the coordinates variables as independent of time in order to get lighter files ?

我曾考虑使用 nco,但我找不到这样做的方法.

I was thinking about using nco but I couldn't find the way to do so.

在此先感谢您的帮助!

推荐答案

阅读手册以找到以下含义,一种将时间相关变量子集到一个文件中,将时间维度从坐标中取平均值的方法,然后将时间常数坐标附加回带有时变变量的文件中.

Read the manual to find the meaning of the following, an approach that subsets the time-dependent variable into one file, averages the Time dimension out of the coordinates, and then appends the time-constant coordinates back into the file with the time-varying variable.

ncks -v U_p_500hPa in.nc u.nc
ncwa -a Time -v XLAT,XLONG in.nc latlon.nc
ncks -A latlon.nc u.nc

这篇关于NetCDF:将变量设置为时间常数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆