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

Put projection info into files #518

Open
aaschwanden opened this issue Nov 14, 2022 · 1 comment
Open

Put projection info into files #518

aaschwanden opened this issue Nov 14, 2022 · 1 comment
Assignees

Comments

@aaschwanden
Copy link
Member

Right now, the PISM-supported projections are hard-coded in projection.cc. We should evaluate whether it makes sense to create a text file per projection that is read in by PISM at runtime. That way, a user can just create their own text file to support a new projection.

@ckhroulev
Copy link
Member

Here's an idea: we could use the NetCDF format for this, very much like we do to store PISM's configuration parameters.

PISM's source code would contain a pism_epsg.cdl file like this:

netcdf pism_epsg {
variables:
	int epsg_3413 ;
		epsg_3413:latitude_of_projection_origin = 90. ;
		epsg_3413:scale_factor_at_projection_origin = 1. ;
		epsg_3413:straight_vertical_longitude_from_pole = -45. ;
		epsg_3413:standard_parallel = 70. ;
		epsg_3413:false_northing = 0. ;
		epsg_3413:grid_mapping_name = "polar_stereographic" ;
		epsg_3413:false_easting = 0. ;
	int epsg_3031 ;
		epsg_3031:latitude_of_projection_origin = -90. ;
		epsg_3031:scale_factor_at_projection_origin = 1. ;
		epsg_3031:straight_vertical_longitude_from_pole = 0. ;
		epsg_3031:standard_parallel = -71. ;
		epsg_3031:false_northing = 0. ;
		epsg_3031:grid_mapping_name = "polar_stereographic" ;
		epsg_3031:false_easting = 0. ;
	int epsg_3057 ;
		epsg_3057:grid_mapping_name = "lambert_conformal_conic" ;
		epsg_3057:longitude_of_central_meridian = -19. ;
		epsg_3057:false_easting = 500000. ;
		epsg_3057:false_northing = 500000. ;
		epsg_3057:latitude_of_projection_origin = 65. ;
		epsg_3057:standard_parallel = 64.25, 65.75 ;
		epsg_3057:long_name = "CRS definition" ;
		epsg_3057:longitude_of_prime_meridian = 0. ;
		epsg_3057:semi_major_axis = 6378137. ;
		epsg_3057:inverse_flattening = 298.257222101 ;
	int epsg_5936 ;
		epsg_5936:latitude_of_projection_origin = 90. ;
		epsg_5936:scale_factor_at_projection_origin = 1. ;
		epsg_5936:straight_vertical_longitude_from_pole = -150. ;
		epsg_5936:standard_parallel = 90. ;
		epsg_5936:false_northing = 2000000. ;
		epsg_5936:grid_mapping_name = "polar_stereographic" ;
		epsg_5936:false_easting = 2000000. ;
	int epsg_26710 ;
		epsg_26710:longitude_of_central_meridian = -123. ;
		epsg_26710:false_easting = 500000. ;
		epsg_26710:false_northing = 0. ;
		epsg_26710:grid_mapping_name = "transverse_mercator" ;
		epsg_26710:inverse_flattening = 294.978698213898 ;
		epsg_26710:latitude_of_projection_origin = 0. ;
		epsg_26710:scale_factor_at_central_meridian = 0.9996 ;
		epsg_26710:semi_major_axis = 6378206.4 ;
		epsg_26710:unit = "metre" ;
}

that would be converted into a .nc file by the build system. During initialization PISM would read this file and iterate over all the variables to extract the map from EPSG codes to CF variable attributes. Then this map can be used to fill PISM's output files with appropriate CF-conformant metadata based on the EPSG code found in the input file.

Users would be able to create custom pism_epsg.nc file by editing the .cdl file and running ncgen. They would then be able to tell PISM to use this file by setting a command-line option.

Note that this is not needed to be able to generate lon and lat fields and their _bounds: we just need the EPSG code for that.

@ckhroulev ckhroulev self-assigned this Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants