小编Ep1*_*1aN的帖子

更改netCDF文件的网格大小

假设我有2个netCDF数据文件,这些数据文件具有相同区域(如南美,非洲等)的数据,但不同网格的大小分别为0.5度x 0.5度和1.0度x 1.0度。我想将其网格大小增加或减少到另一个值,例如0.25 x 0.25或1.0 x 1.0,以便可以轻松地将其用于栅格计算和比较等。

是否有使用任何bash脚本,CDO等执行此操作的方法?

可以从此处下载示例数据。https://www.dropbox.com/sh/0vdfn20p355st3i/AABKYO4do_raGHC34VnsXGPqa?dl

可以采用诸如双线性插值或三次插值的不同方法吗?使用ArcGIS和其他软件,这非常容易,但是有一种方法可以对包含大型数据集的大型netCDF文件进行处理。假设这只是数据的一个子集。我稍后将转换的是一组完整的年度数据。

结果文件应为.nc文件,其用户定义的网格大小会更改。

bash netcdf python-3.x netcdf4 cdo-climate

4
推荐指数
2
解决办法
390
查看次数

How to calculate total precipitation per day using hourly data for whole year?

I have hourly data from ERA5 for each day in a specific year. I want to convert that data from hourly to daily. I know the long and hard way to do it, but I need something which does that easily.

Copernicus has a code for this here https://confluence.ecmwf.int/display/CKB/ERA5%3A+How+to+calculate+daily+total+precipitation, which works fine if the data set is only converted for one day, but when converting for the whole year, i am having problems with that.

Link to download ERA5 …

analysis dataset python-3.x cdo-climate era5

3
推荐指数
1
解决办法
2925
查看次数

将 numpy 数据集转换为 netCDF

我在 python 中有一个 numpy 数组,大小 (16,250,186) 表示时间、纬度和经度。

我想将其转换为 netCDF 文件,以便将来可以使用坐标轻松读取数据。

我的 numpy 数组看起来像这样

RZS = np.load("/home/chandra/Data/rootzone_CHIRPS_era5_2003-2015_daily-analysis_annual-result.npy")
RZS.shape

Output: (16, 250, 186)
Run Code Online (Sandbox Code Playgroud)

如您所见,我上面的 numpy 数组表示 16 年的年度值。

chirps_precip =xarray.open_mfdataset("/home/chandra/Data/CHIRPS/chirps-v2.0.2000.days_p25.nc")
precip = chirps_precip.precip.sel(latitude = slice(-50,12.5), longitude = slice(-81.25,-34.75))
precip[0,:,:]

Output:
<xarray.DataArray 'precip' (latitude: 250, longitude: 186)>
dask.array<shape=(250, 186), dtype=float32, chunksize=(250, 186)>
Coordinates:
  * latitude   (latitude) float32 -49.875 -49.625 -49.375 ... 12.125 12.375
  * longitude  (longitude) float32 -81.125 -80.875 -80.625 ... -35.125 -34.875
    time       datetime64[ns] 2000-01-01
Attributes:
    units:               mm/day
    standard_name:       convective precipitation rate …
Run Code Online (Sandbox Code Playgroud)

dataset python-3.x python-xarray netcdf4

3
推荐指数
1
解决办法
3517
查看次数

在xarray中交换纬度和经度位置

我有一个交换纬度和经度位置的 NetCDF 文件。

我通常使用的 Netcdf 的标准方式定义如下:

<xarray.DataArray 'pev' (time: 365, latitude: 480, longitude: 1440)>
Coordinates:
  * time       (time) datetime64[ns] 2001-01-01T11:30:00 ... 2001-12-31T11:30:00
  * longitude  (longitude) float32 0.0 0.25 0.5 0.75 ... 359.25 359.5 359.75
  * latitude   (latitude) float32 59.75 59.5 59.25 59.0 ... -59.5 -59.75 -60.0
Run Code Online (Sandbox Code Playgroud)

但是我正在处理的 NetCDF 的规格如下:

<xarray.DataArray 'ETa' (time: 12, longitude: 720, latitude: 360)>
Coordinates:
  * latitude   (latitude) float64 89.75 89.25 88.75 ... -88.75 -89.25 -89.75
  * longitude  (longitude) float64 -179.8 -179.2 -178.8 ... 178.8 179.2 179.8 …
Run Code Online (Sandbox Code Playgroud)

coordinates python-xarray

3
推荐指数
1
解决办法
448
查看次数

两幅图像之间的散点图 Google Earth Engine

我在 Google Earth Engine 中有 2 张高分辨率图像。我想在这两个图像之间绘制散点图。但我遇到了一些错误Missing required arguments to function seriesByRegion(): reducer。我不知道如何纠正这个(或者这是否是由于图像造成的)。

首先,我导入了几何图形和我的图像:

var RZSC = ee.Image("users/chandrakant/Max_RZSC_Layer_Trail_3"),
    geometry = /* color: #d6cbbb */ee.Geometry.Polygon(
        [[[-81.375, -56.125],
          [-34.625, -56.125],
          [-34.625, 12.625],
          [-81.375, 12.625]]]);
Run Code Online (Sandbox Code Playgroud)

然后我将图像可视化

var vizParams = {
  bands: ['b1'],
  min: 0.0,
  max: 1500.0,
  palette: ['blue', 'green', 'red']
};
Map.setCenter(6.746, 46.529, 10);
Map.addLayer(RZSC.clip(geometry), vizParams, 'Rootzone Storage Capacity');
Map.centerObject(RZSC);
print('RZSC Projection, crs, and crs_transform:', RZSC.projection());
Run Code Online (Sandbox Code Playgroud)

可视化我的 MODIS 图像

var MODIStc = ee.ImageCollection('MODIS/051/MOD44B')
                  .filter(ee.Filter.date('2000-01-01', '2017-12-01')).mean();
var percentTreeCover = MODIStc.select('Percent_Tree_Cover');
var percentTreeCoverVis …
Run Code Online (Sandbox Code Playgroud)

scatter-plot google-earth-engine

1
推荐指数
1
解决办法
1345
查看次数

R中具有空间自相关的GAMM

据我了解,GAMM 具有随机误差或空间自相关误差结构。

我正在尝试运行具有空间自相关误差结构的 GAMM 模型,例如 corExp(参见https://stat.ethz.ch/R-manual/R-devel/library/nlme/html/corClasses.html)。

但是我对从 GAM 建模 GAMM 感到困惑。

下面是我的 GAM(广义加性模型)代码。

library(mgcv)
mod.gam <- gam(Chave~s(Band_3) + s(Band_7) + s(Band_8) + s(BaCo_3_2) + s(BaCo_5_2) + 
  s(BaCo_5_3) + s(BaCo_5_4) + s(BaCo_8_2) + s(BaCo_8A_2),data = data)
summary(mod.gam)
fits = predict(mod.gam, newdata=data, type='response')
plot(data$Chave, fits, col='blue', ylab = "Predicted AGB KNN", xlab = "Estimated AGB")
plot(mod.gam)
Run Code Online (Sandbox Code Playgroud)

我如何将其更改为 GAMM?当我尝试使用 GAMM 时(如下所述),我没有看到太大的变化:

model <- gamm(Chave~s(Band_3) + s(Band_7) + s(Band_8) + s(BaCo_3_2) +
 s(BaCo_5_2) + s(BaCo_5_3) + s(BaCo_5_4) + s(BaCo_8_2) + s(BaCo_8A_2),
 data …
Run Code Online (Sandbox Code Playgroud)

r spatial gam autocorrelation

1
推荐指数
1
解决办法
1697
查看次数