NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Could anyone advise me as to whether it is possible to aggregate NetCDF data using both x and y dimensions using NcML? Aggregating on a time dimension is well covered in the many examples provided online, but I have struggled to find much about spatial aggregation. We have a set of NetCDF files which together represent a Land Cover map for Great Britain at 25m resolution. Each file represents 100km square surface area as 4000x4000 "x" & "y" grid points - each point on the grid associated with a single numeric value representing the land cover classification at that location. We would like to use NcML aggregation to "stitch" them together so that users can exploit an OPeNDAP service to access just the spatial area they need. To test this we are using a subset of 6 of the "tiles" in a 2x3 grid. Firstly, we aggregated "vertically" (on the "y" dimension) creating two virtual files each 1 tile wide by 3 tiles tall: <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> <aggregation dimName="y" type="joinExisting"> <netcdf location="../Detail/sd.nc"/> <netcdf location="../Detail/sj.nc"/> <netcdf location="../Detail/so.nc"/> </aggregation> </netcdf> And: <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> <aggregation dimName="y" type="joinExisting"> <netcdf location="../Detail/se.nc"/> <netcdf location="../Detail/sk.nc"/> <netcdf location="../Detail/sp.nc"/> </aggregation> </netcdf> This seems to work just fine, we get 2 new virtual files each with 4000x12000 grid points. OPeNDAP and WMS work OK, and the NCDump seems to confirm that all is well - the "y" variable now has 12000 values, and the shape of the LandCover variable is now 4000 by 12000. So far so good. Then, a further aggregation attempts to stitch these together on the "x" dimension: <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> <aggregation dimName="x" type="joinExisting"> <netcdf location="VerticalSlice01.ncml"/> <netcdf location="VerticalSlice02.ncml"/> </aggregation> </netcdf> The odd thing is that in the single resultant virtual file, the grid points for the second "half" are not accessible. WMS only shows half the data, and OPeNDAP gives this message when you attempt to access any "x" grid points beyond the first 4000: Error { code = 3; message = "Invalid Parameter Exception: DArrayDimension.setProjection: Bad Projection Request: stop >= size: 5010:4000"; }; Additionally, NCDump for the overall aggregate shows a discrepancy between the length of the x and y variables (8000 & 12000 respectively, as we would expect) and the shape of the LandCover variable which is still only 4000x12000. netcdf file:W:/thredds/public/LCM/LCM2007/LCM2007_25m/Aggregation/DetailWholeDataset.ncml { dimensions: y = 12000; x = 8000; variables: int transverse_mercator; :long_name = "coordinate_reference_system"; :grid_mapping_name = "transverse_mercator"; :semi_major_axis = "6377563.396"; :semi_minor_axis = "6356256.910"; :inverse_flattening = "299.3249646"; :latitude_of_projection_origin = "49.0"; :longitude_of_projection_origin = "-2.0"; :false_easting = "400000.0"; :false_northing = "-100000.0"; :scale_factor_at_projection_origin = "0.9996012717"; double y(y=12000); :long_name = "northing - OSGB36 grid reference"; :standard_name = "projection_y_coordinate"; :units = "m"; :point_spacing = "even"; float LandCover(y=12000, x=4000); :_FillValue = 255.0f; // float :long_name = "Land Cover Map 2007 Great Britain 25 m"; :coordinates = "x y"; :valid_min = 0.0f; // float :valid_max = 23.0f; // float :grid_mapping = "transverse_mercator"; :missing_value = 255.0f; // float double x(x=8000); :long_name = "easting - OSGB36 grid reference"; :standard_name = "projection_x_coordinate"; :units = "m"; :point_spacing = "even"; :title = "Land Cover Map 2007 Great Britain 25 m"; :institution = "Centre for Ecology & Hydrology (CEH) Lancaster"; :source = "Centre for Ecology & Hydrology (CEH) Lancaster"; :reference = "reference"; :description = "Land Cover Map 2007 Great Britain 25 m"; :grid_mapping = "crs"; :history = "history"; :summary = "Land Cover Map 2007 Great Britain 25 m"; :keywords = "Land cover, Great Britain, 25 m"; :date_created = "2013-12-02"; :date_modified = "2013-12-02"; :date_issued = "2013-12-02"; :creator_name = "Simon Wright"; :creator_url = "http://www.ceh.ac.uk/staffwebpages/simonwright.html"; :creator_email = "smw@xxxxxxxxx<mailto:smw@xxxxxxxxx>"; :geospatial_lon_min = -2.0014688301358983; // double :geospatial_lat_min = 53.49670173328351; // double :geospatial_lon_max = -0.4616603484663878; // double :geospatial_lat_max = 54.38567886302655; // double :licence = "ECOMAPS research."; :publisher_name = "Centre for Ecology & Hydrology"; :publisher_url = "http://www.ceh.ac.uk"; :publisher_email = "enquiries@xxxxxxxxx<mailto:enquiries@xxxxxxxxx>"; :Conventions = "CF-1.6"; :comment = "comment"; } Any feedback gratefully received! Thanks. Peter Vodden Informatics Data Analyst Centre for Ecology & Hydrology Lancaster Environment Centre Library Avenue, Bailrigg Lancaster, LA1 4AP, UK www.ceh.ac.uk<http://www.ceh.ac.uk> Tel: +44 (0)1524 595 843 ________________________________ This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system.
thredds
archives: