Skip to content

Handle coordinate axis variables (x/y vs. lat/lon) #7

@jameshiebert

Description

@jameshiebert

Some NetCDF files record lat/lon as coordinate axis variables as a function of x/y dimensions. For example:

james@basalt ~ $ ncdump -v lon pr_EUR-11_MPI-M-MPI-ESM-LR_historical_r1i1p1_SMHI-RCA4_v1a_day_19890101-20101231_cut.nc 
netcdf pr_EUR-11_MPI-M-MPI-ESM-LR_historical_r1i1p1_SMHI-RCA4_v1a_day_19890101-20101231_cut {
dimensions:
	x = 7 ;
	y = 9 ;
	time = UNLIMITED ; // (8035 currently)
	nb2 = 2 ;
variables:
	double lon(y, x) ;
		lon:standard_name = "longitude" ;
		lon:long_name = "longitude" ;
		lon:units = "degrees_east" ;
		lon:_CoordinateAxisType = "Lon" ;
	double lat(y, x) ;
		lat:standard_name = "latitude" ;
		lat:long_name = "latitude" ;
		lat:units = "degrees_north" ;
		lat:_CoordinateAxisType = "Lat" ;

Unfortunately, ClimDown's dimension handling code is very naive and only looks for variables named lat and lon:
https://github.com/pacificclimate/ClimDown/blob/master/R/CI.R#L203

Fixing this would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions