GDAL का उपयोग करके जियोटीफ़ में एक NetCDF फ़ाइल परिवर्तित करना?


10

मेरे पास एक NetCDF फ़ाइल है जिसमें यूके में बारिश के दिनों की संख्या का डेटा है। मैं इसे एक GeoTIFF में परिवर्तित करना चाहता हूं, लेकिन GDAL को इसे सही ढंग से जियोफेरेंस नहीं दे सकता। नीचे gdalinfo से डंप देखें।

मैं एक एकल बैंड TIFF "रेनडे_टीन_एब्स" चर दिखा रहा हूं। "लाट" और "लोन" चर को ब्रिटेन में डेटा डालने के लिए समझदार न्यूनतम / अधिकतम मान लगता है, लेकिन जब मैं इसे gdal_translate के साथ परिवर्तित करता हूं तो यह अफ्रीका के पश्चिमी तट पर समाप्त हो जाता है।

पहले आयाम के बारे में एक चेतावनी है "टाइम या वर्टिकल" आयाम नहीं। मैंने पढ़ा कि गदल को एक निश्चित क्रम में डेटा की उम्मीद है, इसलिए शायद यह समस्या है, लेकिन मुझे नहीं पता कि इसे कैसे संशोधित किया जाए।

मैं इस डेटा को कैसे परिवर्तित / रीप्रोजेक्ट करूं?

gdalinfo NETCDF: RainDays1_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: RainDays1_1961-1990_LTA_25km.nc: अकेला

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: RainDays1_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 विवादास्पद नहीं है, इसलिए मैं एक टिप्पणी छोड़ने के बजाय 'जवाब' दूंगा; मैं एक cmd में बहुत रुचि होगी windows cmd- लाइन का उपयोग कर! मैं R का उपयोग gdal_translate कमांड को cmd-line को सौंपने के लिए कर रहा हूँ। मैंने अब तक क्या प्रयास किया है: `` data_source <- 'D: /user1/01_data/input.nc' data_output <- 'D: /user1/01_data/output.tif- प्रणाली (कमांड = पेस्ट (' gdal_translate) GTiff -sds -a_srs epsg: 4326 ', data_source, data_output)) `` यह काम कर रहा है, लेकिन मैं crs- जानकारी खो रहा हूँ ! किसी को पता नहीं कैसे सीआरएस जानकारी रखने के लिए !?
एक्सप्लोरर

जवाबों:


3

आपका netcdf एक घुमाए गए पोल ग्रिड का उपयोग करता है। GDAL नहीं संभाल पा रहा है।

इसके लिए एक टिकट है: http://trac.osgeo.org/gdal/ticket/4285 जो कुछ वर्कअराउंड देता है।

जीएमटी में एक उपकरण होता है जिसे 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_translate -of VRT -sds RainDays1_1961-1990_LTA_25km.nc output.vrt

दूसरा समाधान सभी सबडेटासेट्स को अलग-अलग फाइलों में निकाल देगा।

इसमें शामिल करना आवश्यक हो सकता है

-a_srs epsg:4326

झंडा


0

आपकी पिक्सेल का आकार आपकी फ़ाइलों में भिन्न है, GDAL ने उसके बारे में शिकायत की है, देखें:

Afaik, आपको एक समान पिक्सेल आकार की आवश्यकता होती है। आपको इसके लिए अपने ग्रिड को फिर से खोलना होगा या ग्रिड को स्क्रैच से फिर से खोलना होगा। GMT उस के लिए एक अच्छा उपकरण है।

हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.