2015-07-21 340 views
2

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

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" 

谁能告诉我如何旋转坐标转换回正常的拉/长?谢谢。

+0

-180到180不是“正常的”经度。他们只是代表世界的一种方式。 0到360是另一种方式。 – 2015-07-22 00:48:35

+0

这两种方式都是常用的。转换到其中任何一个都可以。 – user1617676

+0

[gis response](http://gis.stackexchange.com/questions/10808/lon-lat-transformation)会回答你的问题吗? –

回答

4

我会用CDO用于此目的https://code.zmaw.de/boards/2/topics/102

另一种选择是只创建旋转和地理坐标之间的映射和使用原始数据,而无需插值。如有必要,我可以找到方程。

+0

嗨,我有类似的问题。你提到那里有方程式。我会感兴趣。我需要将使用0-360长范围的旋转经纬度转换成Datum OSGB36(英格兰)的常规经纬度。你指的是什么方程式? – FaCoffee

4

士官NCK上可以使用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

1

也有做,在R(如用户指的是它的问题)的可能性可能做到这一点的两个命令。当然,NCO和CDO效率更高(方式更快)。 请看看answer

library(ncdf4) 
library(raster) 

nsat<- stack (air_temperature.nc) 

##check the extent 
extent(nsat) 
## this will be in the form 0-360 degrees 

#change the coordinates 
nsat1<-rotate(nstat) 

#check result: 
extent(nsat1) 
##this should be in the format you are looking for: -180/180 

希望这会有所帮助。

相关问题