我目前正在将CANGRID气候数据(以Surfer Grid ascii,“。grd”文件提供)导入ArcGIS。网格大小为95行乘125列。元数据提供原始纬度/经度(左下角),像元大小(50公里)以及以中央子午线(纬度110度)和纬度纬度(北纬60度)的极地立体图形式进行的注释投影。
首次尝试将.grd转换为.ascii和.flt栅格失败后,我设法使用GDAL设置范围和投影,但是数据集未正确与目标区域的边界对齐。见下图。
是否存在公认的极地立体地理变换,可以解释这种缺乏对齐的情况?
例如,是否应该使用特定的转换因子或轮换?
数据集中的示例文件在此处:“ t201113.grd”
这是我目前在GDAL中使用的代码
ds = gdal.Open("t201113.grd")
array = ds.ReadAsArray()
x_rotation = 0
y_rotation = 0
xres = 1
yres = -1
llx = -129.8530
lly = 40.0451
ulx = -175.144
uly = 71.385
input_osr = osr.SpatialReference()
input_osr.ImportFromWkt(ds.GetProjection())
wgs84_osr = osr.SpatialReference()
wgs84_osr.ImportFromEPSG(4326)
wgs_to_nps_trans = osr.CoordinateTransformation(wgs84_osr, input_osr)
x, y, z = wgs_to_nps_trans.TransformPoint(llx,lly)
geo_transform = [ x, xres, x_rotation, y, y_rotation, yres ]
ncol = ds.RasterXSize
nrow = ds.RasterYSize
out_driver = gdal.GetDriverByName("HFA")
out_ds = out_driver.Create(t201113.img", ncol, nrow, 1, gdal.GDT_Float32)
out_ds.SetGeoTransform(geo_transform)
out_prj = 'PROJCS["North_Pole_Stereographic",GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Stereographic"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-110.0],PARAMETER["Scale_Factor",1.0],PARAMETER["Latitude_Of_Origin",60.0],UNIT["50_Kilometers",50000.0]]'
out_ds.SetProjection(out_prj)
out_ds.GetRasterBand(1).WriteArray(array)
out_ds.GetRasterBand(1).SetNoDataValue(1.70141e+038)
out_ds.FlushCache()
out_ds = None
`
另外,这是输入定义的投影信息,即来自“ GetProjection()”的信息:
'PROJCS [“ North_Pole_Stereographic”,GEOGCS [“ GCS_WGS_1984”,DATUM [“ WGS_1984”,SPHEROID [“ WGS_1984”,6378137.0,298.257223563]],PRIMEM [“格林威治”,0.0],UNIT [“同意”,0.0174532925199433]],投影[“ Stereographic”],PARAMETER [“ False_Easting”,0.0],PARAMETER [“ False_Northing”,0.0],PARAMETER [“ Central_Meridian”,0.0],PARAMETER [“ Scale_Factor”,1.0],PARAMETER [“ Latitude_Of_Origin”,90.0 ],UNIT [“ 50_公里”,50000.0]]'
并输入GeoTransform:
(-0.5, 1.0, 0.0, 94.5, 0.0, -1.0)
通常,还会提供长的网格坐标,并且在投影坐标系中进行查看时,如下所示。当通过左下(黄色)或右上(粉红色)坐标的坐标定义地理变换时,我可以有效地设置范围,但是整个栅格中仍然存在对齐问题。