GDAL을 사용하여 NetCDF 파일을 GeoTIFF로 변환 하시겠습니까?


10

영국의 비오는 날에 대한 데이터가 포함 된 NetCDF 파일이 있습니다. GeoTIFF로 변환하고 싶지만 GDAL을 올바르게 지리 참조 할 수는 없습니다. 아래 gdalinfo의 덤프를 참조하십시오.

"raindays_tmean_abs"변수를 보여주는 단일 밴드 TIFF가 필요합니다. "lat"및 "lon"변수는 영국에 데이터를 저장하기 위해 합리적인 최소 / 최대 값을 갖는 것으로 보이지만 gdal_translate로 변환하면 아프리카 서해안에서 끝납니다.

첫 번째 차원이 "시간 또는 수직"차원이 아니라는 경고가 표시됩니다. gdal은 데이터가 특정 순서로 나타날 것으로 예상하므로 이것이 문제 일지 모르지만 수정 방법을 모르겠습니다.

이 데이터를 어떻게 변환 / 재 투영합니까?

gdalinfo NETCDF : 비가 오는 날 1_1961-1990_LTA_25km.nc

Warning 1: dimension #0 (meaning_period) is not a Time or Vertical dimension.
Driver: netCDF/Network Common Data Format
Files: RainDays1_1961-1990_LTA_25km.nc
       RainDays1_1961-1990_LTA_25km.nc.aux.xml
Size is 39, 52
Coordinate System is `'
Origin = (-17.650008352179277,11.329999312758446)
Pixel Size = (0.219999614514803,-0.219999998807907)
Metadata:
  axis_0#units=
  meaning_period#comment=Meaning periods are all months (12) beginning January, all seasons (4) beginning Winter (DJF) and Annual (1)
  meaning_period#long_name=meaning_period
  meaning_period#units=
  NC_GLOBAL#Conventions=CF-1.0
  NETCDF_DIM_EXTRA={meaning_period}
  NETCDF_DIM_meaning_period_DEF={17,6}
  NETCDF_DIM_meaning_period_VALUES={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}
  raindays_tmean_abs#comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
  raindays_tmean_abs#coordinates=lon lat
  raindays_tmean_abs#long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
  raindays_tmean_abs#missing_value=1e+020
  raindays_tmean_abs#name=rain_days
  raindays_tmean_abs#title=rain_days
  raindays_tmean_abs#units=days
  rlat#axis=Y
  rlat#bounds=bounds_rlat
  rlat#long_name=latitude in rotated pole grid
  rlat#standard_name=grid_latitude
  rlat#units=degrees
  rlon#axis=X
  rlon#bounds=bounds_rlon
  rlon#long_name=longitude in rotated pole grid
  rlon#modulo=360
  rlon#standard_name=grid_longitude
  rlon#topology=circular
  rlon#units=degrees
Subdatasets:
  SUBDATASET_1_NAME=NETCDF:"RainDays1_1961-1990_LTA_25km.nc":bounds_rlat
  SUBDATASET_1_DESC=[52x2] bounds_rlat (64-bit floating-point)
  SUBDATASET_2_NAME=NETCDF:"RainDays1_1961-1990_LTA_25km.nc":bounds_rlon
  SUBDATASET_2_DESC=[39x2] bounds_rlon (64-bit floating-point)
  SUBDATASET_3_NAME=NETCDF:"RainDays1_1961-1990_LTA_25km.nc":lat
  SUBDATASET_3_DESC=[52x39] latitude (32-bit floating-point)
  SUBDATASET_4_NAME=NETCDF:"RainDays1_1961-1990_LTA_25km.nc":lon
  SUBDATASET_4_DESC=[52x39] longitude (32-bit floating-point)
  SUBDATASET_5_NAME=NETCDF:"RainDays1_1961-1990_LTA_25km.nc":raindays_tmean_abs
  SUBDATASET_5_DESC=[17x52x39] raindays_tmean_abs (32-bit floating-point)
Geolocation:
  LINE_OFFSET=0
  LINE_STEP=1
  PIXEL_OFFSET=0
  PIXEL_STEP=1
  SRS=GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]]
  X_BAND=1
  X_DATASET=NETCDF:"RainDays1_1961-1990_LTA_25km.nc":lon
  Y_BAND=1
  Y_DATASET=NETCDF:"RainDays1_1961-1990_LTA_25km.nc":lat
Corner Coordinates:
Upper Left  ( -17.6500084,  11.3299993) 
Lower Left  ( -17.6500084,  -0.1100006) 
Upper Right (  -9.0700234,  11.3299993) 
Lower Right (  -9.0700234,  -0.1100006) 
Center      ( -13.3600159,   5.6099993) 
Band 1 Block=39x1 Type=Float32, ColorInterp=Undefined
  Min=10.658 Max=22.949 
  Minimum=10.658, Maximum=22.949, Mean=15.625, StdDev=3.151
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=0
    NETCDF_VARNAME=raindays_tmean_abs
    STATISTICS_MAXIMUM=22.949373245239
    STATISTICS_MEAN=15.624619410087
    STATISTICS_MINIMUM=10.657625198364
    STATISTICS_STDDEV=3.1508820627895
    title=rain_days
    units=days
Band 2 Block=39x1 Type=Float32, ColorInterp=Undefined
  Min=7.893 Max=17.172 
  Minimum=7.893, Maximum=17.172, Mean=11.591, StdDev=2.282
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=1
    NETCDF_VARNAME=raindays_tmean_abs
    STATISTICS_MAXIMUM=17.172254562378
    STATISTICS_MEAN=11.591275386767
    STATISTICS_MINIMUM=7.8926663398743
    STATISTICS_STDDEV=2.28225356537
    title=rain_days
    units=days
Band 3 Block=39x1 Type=Float32, ColorInterp=Undefined
  Min=9.700 Max=21.762 
  Minimum=9.700, Maximum=21.762, Mean=13.882, StdDev=2.988
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=2
    NETCDF_VARNAME=raindays_tmean_abs
    STATISTICS_MAXIMUM=21.761842727661
    STATISTICS_MEAN=13.88236379732
    STATISTICS_MINIMUM=9.7001943588257
    STATISTICS_STDDEV=2.9875935432638
    title=rain_days
    units=days
Band 4 Block=39x1 Type=Float32, ColorInterp=Undefined
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=3
    NETCDF_VARNAME=raindays_tmean_abs
    title=rain_days
    units=days
Band 5 Block=39x1 Type=Float32, ColorInterp=Undefined
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=4
    NETCDF_VARNAME=raindays_tmean_abs
    title=rain_days
    units=days
Band 6 Block=39x1 Type=Float32, ColorInterp=Undefined
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=5
    NETCDF_VARNAME=raindays_tmean_abs
    title=rain_days
    units=days
Band 7 Block=39x1 Type=Float32, ColorInterp=Undefined
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=6
    NETCDF_VARNAME=raindays_tmean_abs
    title=rain_days
    units=days
Band 8 Block=39x1 Type=Float32, ColorInterp=Undefined
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=7
    NETCDF_VARNAME=raindays_tmean_abs
    title=rain_days
    units=days
Band 9 Block=39x1 Type=Float32, ColorInterp=Undefined
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=8
    NETCDF_VARNAME=raindays_tmean_abs
    title=rain_days
    units=days
Band 10 Block=39x1 Type=Float32, ColorInterp=Undefined
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=9
    NETCDF_VARNAME=raindays_tmean_abs
    title=rain_days
    units=days
Band 11 Block=39x1 Type=Float32, ColorInterp=Undefined
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=10
    NETCDF_VARNAME=raindays_tmean_abs
    title=rain_days
    units=days
Band 12 Block=39x1 Type=Float32, ColorInterp=Undefined
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=11
    NETCDF_VARNAME=raindays_tmean_abs
    title=rain_days
    units=days
Band 13 Block=39x1 Type=Float32, ColorInterp=Undefined
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=12
    NETCDF_VARNAME=raindays_tmean_abs
    title=rain_days
    units=days
Band 14 Block=39x1 Type=Float32, ColorInterp=Undefined
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=13
    NETCDF_VARNAME=raindays_tmean_abs
    title=rain_days
    units=days
Band 15 Block=39x1 Type=Float32, ColorInterp=Undefined
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=14
    NETCDF_VARNAME=raindays_tmean_abs
    title=rain_days
    units=days
Band 16 Block=39x1 Type=Float32, ColorInterp=Undefined
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=15
    NETCDF_VARNAME=raindays_tmean_abs
    title=rain_days
    units=days
Band 17 Block=39x1 Type=Float32, ColorInterp=Undefined
  NoData Value=1.0000000200408773e+020
  Metadata:
    comment=Converted from UKCP09 monthly data to climatologies and then averaged to 25km rotated pole grid.
    coordinates=lon lat
    long_name=Number of days per meaning period having a rainfall >= 1 mm (days)
    missing_value=1e+020
    name=rain_days
    NETCDF_DIM_meaning_period=16
    NETCDF_VARNAME=raindays_tmean_abs
    title=rain_days
    units=days

gdalinfo NETCDF : 비가 오는 날 1_1961-1990_LTA_25km.nc:lon

Driver: netCDF/Network Common Data Format
Files: RainDays1_1961-1990_LTA_25km.nc
       RainDays1_1961-1990_LTA_25km.nc.aux.xml
Size is 39, 52
Coordinate System is `'
Origin = (-17.650008352179277,11.329999312758446)
Pixel Size = (0.219999614514803,-0.219999998807907)
Metadata:
  axis_0#units=
  lon#long_name=longitude
  lon#missing_value=1e+020
  lon#name=lon
  lon#standard_name=longitude
  lon#units=degrees_east
  meaning_period#comment=Meaning periods are all months (12) beginning January, all seasons (4) beginning Winter (DJF) and Annual (1)
  meaning_period#long_name=meaning_period
  meaning_period#units=
  NC_GLOBAL#Conventions=CF-1.0
  rlat#axis=Y
  rlat#bounds=bounds_rlat
  rlat#long_name=latitude in rotated pole grid
  rlat#standard_name=grid_latitude
  rlat#units=degrees
  rlon#axis=X
  rlon#bounds=bounds_rlon
  rlon#long_name=longitude in rotated pole grid
  rlon#modulo=360
  rlon#standard_name=grid_longitude
  rlon#topology=circular
  rlon#units=degrees
Corner Coordinates:
Upper Left  ( -17.6500084,  11.3299993) 
Lower Left  ( -17.6500084,  -0.1100006) 
Upper Right (  -9.0700234,  11.3299993) 
Lower Right (  -9.0700234,  -0.1100006) 
Center      ( -13.3600159,   5.6099993) 
Band 1 Block=39x1 Type=Float32, ColorInterp=Undefined
  Min=-15.830 Max=3.672 
  Minimum=-15.830, Maximum=3.672, Mean=-5.246, StdDev=4.393
  NoData Value=1.0000000200408773e+020
  Metadata:
    long_name=longitude
    missing_value=1e+020
    name=lon
    NETCDF_VARNAME=lon
    standard_name=longitude
    STATISTICS_MAXIMUM=3.671746969223
    STATISTICS_MEAN=-5.2457962955782
    STATISTICS_MINIMUM=-15.830010414124
    STATISTICS_STDDEV=4.3927366732513
    units=degrees_east

gdalinfo NETCDF : 비가 오는 날 1_1961-1990_LTA_25km.nc:lat

Driver: netCDF/Network Common Data Format
Files: RainDays1_1961-1990_LTA_25km.nc
       RainDays1_1961-1990_LTA_25km.nc.aux.xml
Size is 39, 52
Coordinate System is `'
Origin = (-17.650008352179277,11.329999312758446)
Pixel Size = (0.219999614514803,-0.219999998807907)
Metadata:
  axis_0#units=
  lat#long_name=latitude
  lat#missing_value=1e+020
  lat#name=lat
  lat#standard_name=latitude
  lat#units=degrees_north
  meaning_period#comment=Meaning periods are all months (12) beginning January, all seasons (4) beginning Winter (DJF) and Annual (1)
  meaning_period#long_name=meaning_period
  meaning_period#units=
  NC_GLOBAL#Conventions=CF-1.0
  rlat#axis=Y
  rlat#bounds=bounds_rlat
  rlat#long_name=latitude in rotated pole grid
  rlat#standard_name=grid_latitude
  rlat#units=degrees
  rlon#axis=X
  rlon#bounds=bounds_rlon
  rlon#long_name=longitude in rotated pole grid
  rlon#modulo=360
  rlon#standard_name=grid_longitude
  rlon#topology=circular
  rlon#units=degrees
Corner Coordinates:
Upper Left  ( -17.6500084,  11.3299993) 
Lower Left  ( -17.6500084,  -0.1100006) 
Upper Right (  -9.0700234,  11.3299993) 
Lower Right (  -9.0700234,  -0.1100006) 
Center      ( -13.3600159,   5.6099993) 
Band 1 Block=39x1 Type=Float32, ColorInterp=Undefined
  Min=47.594 Max=60.806 
  Minimum=47.594, Maximum=60.806, Mean=54.186, StdDev=3.229
  NoData Value=1.0000000200408773e+020
  Metadata:
    long_name=latitude
    missing_value=1e+020
    name=lat
    NETCDF_VARNAME=lat
    standard_name=latitude
    STATISTICS_MAXIMUM=60.805950164795
    STATISTICS_MEAN=54.185836173138
    STATISTICS_MINIMUM=47.594329833984
    STATISTICS_STDDEV=3.228754901642
    units=degrees_north

... 안타깝게도 아직 50 평판이 없으므로 의견을 남기지 않고 '응답'합니다. Windows cmd-line을 사용하는 gdal 솔루션에 매우 관심이 있습니다! R을 사용하여 gdal_translate 명령을 cmd 라인에 넘겨줍니다. 내가 지금까지 시도한 것은 다음과 같습니다.```data_source <- 'D : /user1/01_data/input.nc'data_output <- 'D : /user1/01_data/output.tif'system (command = paste ( 'gdal_translate- GTiff -sds -a_srs epsg : 4326 ', data_source, data_output))```이 작동하지만 crs 정보를 잃어 버리고 있습니다 ! crs 정보를 유지하는 방법을 아는 사람이 있습니까?
ExploreR

답변:


3

netcdf는 회전 극 그리드를 사용합니다. GDAL은이를 처리 할 수 ​​없습니다.

이에 대한 티켓이 있습니다 : http://trac.osgeo.org/gdal/ticket/4285 몇 가지 해결 방법이 있습니다.

GMT에는 grdrotater회전 극을 사용할 수 있는 도구 가 있지만 아직 사용하지는 않았습니다.

GRASS에 익숙한 경우이 해결 방법을 시도 할 수 있습니다.

http://osgeo-org.1560.x6.nabble.com/NetCDF-rotated-pole-td4634232.html


2

gdal_translate로 변환하려고 했습니까?

일반적으로 다음 두 가지 가능성 중 하나를 사용하여 작동합니다.

첫 번째 해결책 : 모든 하위 데이터 세트를 수동으로 추출

gdal_translate -of VRT NETCDF:"RainDays1_1961-1990_LTA_25km.nc":raindays_tmean_abs output_RD.vrt 
gdal_translate -of VRT NETCDF:"RainDays1_1961-1990_LTA_25km.nc":lat output_lat.vrt 
gdal_translate -of VRT NETCDF:"RainDays1_1961-1990_LTA_25km.nc":lon output_lon.vrt

두 번째 해결책 : gdal이 하위 데이터 세트를 자동으로 추출하도록하십시오.

gdal_translate -of VRT -sds RainDays1_1961-1990_LTA_25km.nc output.vrt

두 번째 솔루션은 모든 하위 데이터 세트를 추출하여 파일을 분리합니다.

포함해야 할 수도 있습니다

-a_srs epsg:4326

깃발


당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.