gpt4 book ai didi

r - 如何将旋转的 NetCDF 转换回正常的纬度/经度网格?

转载 作者:行者123 更新时间:2023-12-02 05:30:21 26 4
gpt4 key购买 nike

我有一个带有旋转坐标的 NetCDF 文件。我需要将其转换为正常的纬度/经度坐标(经度为-180到180,纬度为-90到90)。

library(ncdf4)
nc_open('dat.nf')

对于尺寸,它显示:

[1] "     5 variables (excluding dimension variables):"
[1] " double time_bnds[bnds,time] "
[1] " double lon[rlon,rlat] "
[1] " long_name: longitude"
[1] " units: degrees_east"
[1] " double lat[rlon,rlat] "
[1] " long_name: latitude"
[1] " units: degrees_north"
[1] " char rotated_pole[] "
[1] " grid_mapping_name: rotated_latitude_longitude"
[1] " grid_north_pole_longitude: 83"
[1] " grid_north_pole_latitude: 42.5"
[1] " float tasmax[rlon,rlat,time] "
[1] " long_name: Daily Maximum Near-Surface Air Temperature"
[1] " standard_name: air_temperature"
[1] " units: K"
[1] " cell_methods: time:maximum within days time:mean over days"
[1] " coordinates: lon lat"
[1] " grid_mapping: rotated_pole"
[1] " _FillValue: 1.00000002004088e+20"

[1] " 4 dimensions:"
[1] " rlon Size:310"
[1] " long_name: longitude in rotated pole grid"
[1] " units: degrees"
[1] " axis: X"
[1] " standard_name: grid_longitude"
[1] " rlat Size:260"
[1] " long_name: latitude in rotated pole grid"
[1] " units: degrees"
[1] " axis: Y"
[1] " standard_name: grid_latitude"
[1] " bnds Size:2"

有人可以告诉我如何将旋转坐标转换回正常的纬度/经度吗?谢谢。

最佳答案

NCO 的 ncks 可能可以使用 MSA 通过两个命令来完成此操作

ncks -O -H --msa -d Lon,0.,180. -d Lon,-180.,-1.0 in.nc out.nc
ncap2 -O -s 'where(Lon < 0) Lon=Lon+360' out.nc out.nc

关于r - 如何将旋转的 NetCDF 转换回正常的纬度/经度网格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31549880/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com