- 积分
- 20524
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-2-16
- 最后登录
- 1970-1-1
|
发表于 2020-3-6 14:00:21
|
显示全部楼层
本帖最后由 lleoiu 于 2020-3-6 14:01 编辑
谢谢回复。
简单写了一个计算入偏差的脚本,正常运行。但是结果不对。也不知道哪里出错。
- import netCDF4 as nc
- import numpy as np
- import xarray as xr
-
- dyst = 1
- dyed = 7
- ndy = 7
-
- dir2 = "/mnt/d/data/jra55/daily/surface/"
- dir4 = "/mnt/d/data/jra55/long_term_mean/daily/surface/"
-
- tmfile = dir2 + "air.*.nc"
- t2mfile = dir4 + "t2m.day.ltm.nc"
-
- ds = xr.open_mfdataset(tmfile,concat_dim="time",combine="by_coords", engine="netcdf4")
- lon = ds.variables['lon'][:]
- lat = ds.variables['lat'][:]
- data = ds['air']-273.15
- ds5 = xr.open_dataset(t2mfile)
- tc = ds5.variables['t2m'][dyst:dyed,:,:] - 273.15
- airf = data.loc[data.time.dt.month==7]
- air = airf.loc[airf.time.dt.dayofyear<=dyed]
- time = air.time
- airdt = air.values
-
- nlon = np.shape(air)[2]
- nlat = np.shape(air)[1]
- ntim = np.shape(air)[0]
- nyr = int(float(ntim)/ndy)
- dtm = np.zeros(np.shape(airdt))
- cdtm = np.zeros(np.shape(airdt))
- for i in range (0,ndy):
- cdtm[i:ndy:ntim,:,:] = tc[i,:,:]
- dtm = airdt - cdtm
复制代码
|
|