import pyproj cf_string = 'grid_mapping_name = "latitude_longitude"' crs = pyproj.CRS.from_cf(cf_string) print(crs)
EPSG:4326
import netCDF4 import pyproj nc_file = netCDF4.Dataset('/path/to/myfile.nc') var = nc_file.variables['my_var'] crs = pyproj.CRS.from_cf(var.grid_mapping) print(crs)
EPSG:32632This example creates a pyproj CRS instance from a NetCDF variable that has a grid_mapping attribute defining the coordinate system. The resulting CRS instance represents the EPSG:32632 projected coordinate system. Package/library: pyproj is a Python package/library used for performing coordinate conversions and transformations. It is built on top of the PROJ.4 library, which provides a robust set of tools for working with various geospatial coordinate systems.