【问题标题】:How to project Hydrologic Rainfall Analysis Data (MPE/AHPS) raster to a usable format?如何将水文降雨分析数据 (MPE/AHPS) 栅格投影为可用格式?
【发布时间】:2020-05-08 23:13:57
【问题描述】:

显然 NOAA 和 NWS 对他们的一些降雨数据使用了非传统的投影方式,并且在将其投影为传统格式以供其他用户使用方面并没有提供很多帮助。我在让栅格覆盖美国部分地区方面取得了一些成功,但仍然不太正确。

我希望有人可以帮助我破译我遗漏的内容并更正这些数据的投影。

您可以在此处找到有关此数据的更多信息:https://polyploid.net/blog/?p=216 https://water.weather.gov/precip/download.php

library(tidyverse)
library(raster)
library(rgdal)
library(sp)

setwd("C:/Users/MPE_Data/")

file_list <- list.files("201809")

grib0<-raster::brick("201809//ST4_2018091307_24h.nc", varname="APCP_SFC")[[1]]
grib0@crs
crs(grib0) <- "+proj=longlat +a=6371200 +b=6371200 +no_defs"
crs(grib0) <- "+proj=stere +lat_0=90 +lat_ts=60 +lon_0=-105 +x_0=0 +y_0=0 +a=6371200 +b=6371200 +units=m +no_defs"


us_shp <- rgdal::readOGR("C:/Users/cb_2017_us_state_500k/US_clipped.shp")
shp <- rgdal::readOGR("C:/Users/nc_sc_counties_wgs1984.shp")

wgs<-"+proj=longlat +datum=WGS84 +ellps=WGS84 +no_defs"
wgsraster <- projectRaster(grib0, crs=wgs)
plot(wgsraster)
shp <- spTransform(shp, CRS(wgs))
us_shp <- spTransform(us_shp, CRS(wgs))
plot(shp,add=TRUE)
plot(us_shp,add=TRUE)

【问题讨论】:

    标签: r gis raster projection reprojection-error


    【解决方案1】:

    我找不到您的确切地图,但这里有一个使用最近降水数据的示例。您不需要分配 CRS,因为 netCDF 文件已经有一个与之关联的 CRS,您可以简单地 projectRaster。此外,NOAA 网站还可以选择下载到 geoTIFF,如果您对此更满意,我会推荐它。

    require(raster)
    require(ncdf4)
    require(maptools)
    
    data(wrld_simpl)
    us_shp=wrld_simpl[which(wrld_simpl$NAME=="United States"),]
    
    rs=raster::brick("./nws_precip_1day_20200509_netcdf/nws_precip_1day_20200509_conus.nc",varname="observation")[[1]]
    rs@crs ##note already has a crs associated with it
    

    +proj=立体 +lat_0=90 +lat_ts=60 +lon_0=-105 +x_0=0 +y_0=0 +a=6371200 +b=6371200 +units=m +no_defs

    ##assign the pixels with -10000 to NA.    
    NAvalue(rs) = -10000
    
    ##reproject to longlat WGS84
    rs=projectRaster(rs,crs=crs(us_shp))
    plot(rs,col=rainbow(100))
    lines(us_shp)
    ##note the data extends outside the bounds of country
    

    ##use mask to remove data that is not over the land area
    rs=mask(rs,us_shp)
    plot(rs,col=rainbow(100)
    lines(us_shp)
    

    请注意,rs 的最大值从 7.8 变为 7.0,这是由于 projectRaster 中使用了双线性插值方法。您需要考虑是否需要双线性或最近邻插值,如果您需要具体说明输出栅格分辨率和范围,我建议为 to 参数提供模型栅格。

    已编辑以纳入 @Robert Hijmans 的建议。

    【讨论】:

    • 我猜你也可以使用NAvalue(rs) &lt;- -9999 来消除虚假值
    • @RobertHijmans 感谢您的建议,我已将其纳入答案。
    • 谢谢!我仍然收到一个奇怪的错误。警告消息:在 .getCRSfromGridMap4(atts) 中:无法处理 CRS 的这些部分:earth_radius=6371200; proj4=+proj=stere +lat_0=90 +lat_ts=60 +lon_0=-105 +x_0=0 +y_0=0 +a=6371200 +b=6371200 +units=m +no_defs; crs_wkt=PROJCS["NOAA_HRAP_Grid", GEOGCS["GCS_NOAA_HRAP", DATUM["D_NOAA_HRAP", SPHEROID["Sphere",6371200,0.0] ], PRIMEM["Greenwich",0.0], UNIT["Degree",0.0174532925199433] ] , PROJECTION["Polar_Stereographic"], PARAMETER["false_easting",0.0], PARAMETER["false_northing",0.0], ...
    • @drJones 我也不知道这是否有帮助,但我们使用的是每小时数据(AHPS 网站上不容易获得。相反,您可以找到我们正在使用的 .nc 文件这里:convection.meas.ncsu.edu:8080/thredds/catalog/ncep/mpe/netcdf/…
    猜你喜欢
    • 2021-08-23
    • 2020-06-07
    • 2014-05-30
    • 1970-01-01
    • 2019-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-07
    相关资源
    最近更新 更多