Closed Nick-Maurer closed 4 months ago
@Nick-Maurer please report generated netcdf header information.
ncdump -hc <FILE>
Not sure what is classed as header info, but here is the full output:
netcdf wo_data_1988-02 {
dimensions:
time = 2 ;
y = 3735 ;
x = 4485 ;
variables:
double time(time) ;
time:units = "seconds since 1970-01-01 00:00:00" ;
time:standard_name = "time" ;
time:long_name = "Time, unix time-stamp" ;
time:axis = "T" ;
time:calendar = "standard" ;
double y(y) ;
y:units = "metre" ;
y:standard_name = "projection_y_coordinate" ;
y:long_name = "y coordinate of projection" ;
double x(x) ;
x:units = "metre" ;
x:standard_name = "projection_x_coordinate" ;
x:long_name = "x coordinate of projection" ;
int spatial_ref ;
spatial_ref:grid_mapping_name = "albers_conical_equal_area" ;
spatial_ref:standard_parallel = -18., -36. ;
spatial_ref:longitude_of_central_meridian = 132. ;
spatial_ref:latitude_of_projection_origin = 0. ;
spatial_ref:false_easting = 0. ;
spatial_ref:false_northing = 0. ;
spatial_ref:long_name = "GDA94 / Australian Albers" ;
spatial_ref:semi_major_axis = 6378137. ;
spatial_ref:semi_minor_axis = 6356752.31414036 ;
spatial_ref:inverse_flattening = 298.257222101 ;
spatial_ref:crs_wkt = "PROJCS[\"GDA94 / Australian Albers\",GEOGCS[\"GDA94\",DATUM[\"Geocentric_Datum_of_Australia_1994\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6283\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4283\"]],PROJECTION[\"Albers_Conic_Equal_Area\"],PARAMETER[\"latitude_of_center\",0],PARAMETER[\"longitude_of_center\",132],PARAMETER[\"standard_parallel_1\",-18],PARAMETER[\"standard_parallel_2\",-36],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"3577\"]]" ;
spatial_ref:spatial_ref = "PROJCS[\"GDA94 / Australian Albers\",GEOGCS[\"GDA94\",DATUM[\"Geocentric_Datum_of_Australia_1994\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6283\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4283\"]],PROJECTION[\"Albers_Conic_Equal_Area\"],PARAMETER[\"latitude_of_center\",0],PARAMETER[\"longitude_of_center\",132],PARAMETER[\"standard_parallel_1\",-18],PARAMETER[\"standard_parallel_2\",-36],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"3577\"]]" ;
spatial_ref:GeoTransform = 1762560., 30., 0., -3017700., 0., -30. ;
ubyte water(time, y, x) ;
water:_FillValue = 1UB ;
water:grid_mapping = "spatial_ref" ;
water:units = "1" ;
// global attributes:
:date_created = "2024-05-20T05:29:18.575874" ;
:Conventions = "CF-1.6, ACDD-1.3" ;
:history = "NetCDF-CF file created by datacube version \'1.8.18\' at 20240520." ;
:coordinates = "spatial_ref" ;
:geospatial_bounds = "POLYGON ((149.9892826763886 -26.70206653307046, 150.13318516437332 -27.584615580444392, 150.15067994131257 -27.69094499164086, 151.1654933746167 -27.561225446527214, 151.51555238448833 -27.51478041075792, 151.3608565800874 -26.63362302607288, 151.34237987930615 -26.527417677862754, 150.33713377672046 -26.65842082410779, 149.9892826763886 -26.70206653307046))" ;
:geospatial_bounds_crs = "EPSG:4326" ;
:geospatial_lat_min = -27.6909449916409 ;
:geospatial_lat_max = -26.5274176778628 ;
:geospatial_lat_units = "degrees_north" ;
:geospatial_lon_min = 149.989282676389 ;
:geospatial_lon_max = 151.515552384488 ;
:geospatial_lon_units = "degrees_east" ;
}
@Nick-Maurer from this we can tell that water
is stored as ubyte
, so correct format for the original data, so issue is with xarray
or netcdf
handling of ubyte
data types at load time.
I'm not sure if this is an issue with
write_dataset_to_netcdf
or with xarray'sxr.open_dataset
, but as you can see in the screen shot the data changes type. This messes with the masking functions, as they are built to expect integers.