Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDAL NetCDF Subdatasets #30

Open
aclel opened this issue Nov 8, 2019 · 0 comments
Open

GDAL NetCDF Subdatasets #30

aclel opened this issue Nov 8, 2019 · 0 comments

Comments

@aclel
Copy link

aclel commented Nov 8, 2019

I'm Andrew from TERN. This is a cool tool. We have NetCDFs and Geotiffs that we want to convert to COG.

I've got a question regarding NetCDF Subdatasets. From my understanding, GDAL thinks that a NetCDF file has Subdatasets if there is more than one data variable, like temperature and rainfall in one file. If a file just has temperature, then it will not be a Subdataset, there will just be Bands.

Based on this line in the conversion code, does this mean that all of your NetCDF files have Subdatasets?

Some of our files just have one data variable, so GDAL doesn't detect them as Subdatasets. I tried converting them with this tool but it didn't do anything. If we end up using the tool I'm happy to do a PR, but I just wanted to get in touch first to check that I'm not misunderstanding Subdatsets.

See below for ncdump and gdalinfo from one of our NetCDF files:

ncdump Output:

netcdf FPARchl_EVI.A2014091.aust.v01.5600m.terra {
dimensions:
	time = UNLIMITED ; // (1 currently)
	latitude = 670 ;
	longitude = 813 ;
variables:
	double time(time) ;
		time:long_name = "time" ;
		time:standard_name = "time" ;
		time:units = "days since 1800-01-01 00:00:00.0" ;
		time:calendar = "gregorian" ;
		time:axis = "T" ;
	double latitude(latitude) ;
		latitude:long_name = "latitude" ;
		latitude:standard_name = "latitude" ;
		latitude:axis = "Y" ;
		latitude:units = "degrees_north" ;
	double longitude(longitude) ;
		longitude:long_name = "longitude" ;
		longitude:standard_name = "longitude" ;
		longitude:axis = "X" ;
		longitude:units = "degrees_east" ;
	float FPARchl(time, latitude, longitude) ;
		FPARchl:_FillValue = -3000.f ;
		FPARchl:long_name = "Ecosystem fraction of photosynthetic radiation absorbed by chlorophyll (fPARchl)" ;
		FPARchl:units = "unitless" ;
		FPARchl:grid_mapping = "crs" ;
	int crs ;
		crs:grid_mapping_name = "latitude_longitude" ;
		crs:longitude_of_prime_meridian = 0. ;
		crs:semi_major_axis = 6378137. ;
		crs:inverse_flattening = 298.257223563 ;
}

gdalinfo output:

Driver: netCDF/Network Common Data Format
Files: /input_rasters/chla_fraction/FPARchl_EVI.A2014091.aust.v01.5600m.terra.nc
Size is 813, 670
Coordinate System is:
GEOGCRS["unknown",
    DATUM["unnamed",
        ELLIPSOID["Spheroid",6378137,298.257223563,
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433,
            ID["EPSG",9122]]],
    CS[ellipsoidal,2],
        AXIS["latitude",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433,
                ID["EPSG",9122]]],
        AXIS["longitude",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433,
                ID["EPSG",9122]]]]
Data axis to CRS axis mapping: 2,1
Origin = (112.924999999999997,-10.074999999999999)
Pixel Size = (0.050000000000000,-0.050000000000000)
Metadata:
  crs#grid_mapping_name=latitude_longitude
  crs#inverse_flattening=298.257223563
  crs#longitude_of_prime_meridian=0
  crs#semi_major_axis=6378137
  time#axis=T
  time#calendar=gregorian
  time#long_name=time
  time#standard_name=time
  time#units=days since 1800-01-01 00:00:00.0
Corner Coordinates:
Upper Left  ( 112.9250000, -10.0750000) (112d55'30.00"E, 10d 4'30.00"S)
Lower Left  ( 112.9250000, -43.5750000) (112d55'30.00"E, 43d34'30.00"S)
Upper Right ( 153.5750000, -10.0750000) (153d34'30.00"E, 10d 4'30.00"S)
Lower Right ( 153.5750000, -43.5750000) (153d34'30.00"E, 43d34'30.00"S)
Center      ( 133.2500000, -26.8250000) (133d15' 0.00"E, 26d49'30.00"S)
Band 1 Block=813x670 Type=Float32, ColorInterp=Undefined
  NoData Value=-3000
  Unit Type: unitless
  Metadata:
    grid_mapping=crs
    long_name=Ecosystem fraction of photosynthetic radiation absorbed by chlorophyll (fPARchl)
    NETCDF_DIM_time=78252
    NETCDF_VARNAME=FPARchl
    units=unitless
    _FillValue=-3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant