如何将Lambert Conic Conformal栅格投影更改为latlon度R [英] How to change a Lambert Conic Conformal raster projection to latlon degree R

查看:845
本文介绍了如何将Lambert Conic Conformal栅格投影更改为latlon度R的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个栅格,该栅格是从(兰伯特圆锥形投影)中的netcdf获得的:

I have a raster, obtained from a netcdf which is in (Lambert Conic Conformal projection):

    library(meteoForecast)
    wrf_temporary <- getRaster("temp", day = Sys.Date(), frames = 'complete', resolution = 36, service = "meteogalicia")
    wrf_temporary

extent      : -18, 4230, -18, 3726  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=lcc +lat_1=43 +lat_2=43 +lat_0=34.82300186157227 +lon_0=-14.10000038146973 +x_0=536402.34 +y_0=-18558.61 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=km +no_defs 

现在,我想将wrf_temporary栅格转换为"+proj=longlat +datum=WGS84"(纬度).该怎么办? 我想要这样的东西:

Now I want to transform that wrf_temporary raster to "+proj=longlat +datum=WGS84" (lat long degree). What to do? I want something like this:

    mfExtent('meteogalicia', resolution = 36)

class       : Extent 
xmin        : -49.18259 
xmax        : 18.789 
ymin        : 24.03791 
ymax        : 56.06608 

已经尝试了很多选择,但是没有一个给出正确的结果...

Already tried a lot of options but none of them give the right results...

推荐答案

这应该有效:

> ll = projectRaster(wrf_temporary,crs="+init=epsg:4326")
> plot(ll[[1]])

并产生这个:

乍一看似乎不错,但格林威治子午线(经度= 0)并未穿过伦敦.

which looks right at first glance but the Greenwich meridian (longitude=0) doesn't go through London.

将分辨率设置为其他值4或12不会发生此问题.以resolution = 36调用时,您得到的光栅的范围比其他范围大,但投影字符串相同.这是不对的.例如,以下图上的(0,0)坐标应该是地球上的同一点,因为它们声称是相同的投影,但是它们不相干.

The problem doesn't occur for resolution set to the other values, 4 or 12. When called with resolution=36, you get a raster with a larger extent than the others, but with an identical projection string. This can't be right. For example, the (0,0) coordinate on the following plots should be the same point on the earth because they claim to be the same projection, but they arent.

我认为分辨率= 12是正确的.这是栅格被转换为经纬度并覆盖了欧盟矢量覆盖率的情况:

I think the resolution=12 ones are correct. Here's that raster transformed to lat-long with an EU vector coverage overlaid:

排列完美.

所以我要说这是一个错误-getRaster是在猜测投影并弄错了它,或者裁剪后没有应用投影的变化,或者它使用的任何服务都围绕投影.

So I would say its a bug - either getRaster is guessing the projection and getting it wrong, or not applying a change in projection after cropping, or whatever service it uses is lying about the projection.

getRaster正在猜测.投影信息位于下载的NetCDF文件中.以另一种格式.对于resolution = 36文件,投影信息部分是这样的:

getRaster is guessing. The projection info is in the downloaded NetCDF file. In another format. For the resolution=36 file the projection info section is this:

int Lambert_Conformal ;
    Lambert_Conformal:standard_parallel = 43., 43. ;
    Lambert_Conformal:latitude_of_projection_origin = 24.2280006408691 ;
    Lambert_Conformal:false_easting = 2182.62935 ;
    Lambert_Conformal:false_northing = -269.65597 ;
    Lambert_Conformal:grid_mapping_name = "lambert_conformal_conic" ;
    Lambert_Conformal:longitude_of_central_meridian = -14.1000003814697 ;
    Lambert_Conformal:_CoordinateTransformType = "Projection" ;
    Lambert_Conformal:_CoordinateAxisTypes = "GeoX GeoY" ;

,与R包使用的resolution = 12投影有些不同.因此,使一个合规的人:

which is a bit different to the resolution=12 projection used by the R package. So make a compliant one:

p = "+proj=lcc +lat_1=43 +lat_2=43 +lat_0=24.2280006408691 +lon_0=-14.1000003814697 +x_0=2182629.35 +y_0=-269655.97 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=km +no_defs"
 wrf <- getRaster('temp', day = testDay, resolution=36)
 projection(wrf) = p

然后用EU叠加层进行测试....

Then my test with EU overlay....

请注意,这一次我重新规划了欧盟.对latlong进行projectRaster也可以:

Note this time I've reprojected the EU. Doing projectRaster to latlong works too:

> wrfLL = projectRaster(wrf, crs="+init=epsg:4326")
> plot(wrfLL[[1]])
> abline(v=0)

将格林威治子午线置于其应有的位置.

with the Greenwich meridian in its rightful place.

这篇关于如何将Lambert Conic Conformal栅格投影更改为latlon度R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆