Skip to content

Error with PROJ #18

@flbray

Description

@flbray

Hello,
I recently installed Polymer and am encountering an error with proj (see below) when using run_atm_corr.
It seems that since PROJ6, you should no longer use the syntax “+init=:<auth_code>” but rather “:<auth_code>”. This is explained in more detail in this article: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6

The error may also be due to my usage, so please let me know if this is the case!

Have a nice day,

Flore BRAY


CRSError Traceback (most recent call last)
Cell In[4], line 1
----> 1 run_atm_corr(Level1(input_l1),
2 Level2_NETCDF(output),
3 multiprocessing = -1)

File /work/datalake/watcal/sandbox/git/polymer/polymer/main.py:501, in run_atm_corr(level1, level2, **kwargs)
498 print('Starting processing at {}'.format(t0))
500 # initialize level1 and level2 instances
--> 501 with level2 as l2, level1 as l1:
503 params = Params(l1.sensor, **kwargs)
504 params.preprocess(l1)

File /work/datalake/watcal/sandbox/git/polymer/polymer/level1.py:108, in Level1.enter(self)
105 else:
106 raise Exception('Invalid sensor name "{}"'.format(self.sensor))
--> 108 self.level1 = L1(self.filename, **self.kwargs)
109 return self.level1

File /work/datalake/watcal/sandbox/git/polymer/polymer/level1_msi.py:200, in Level1_MSI.init(self, dirname, blocksize, resolution, sline, eline, scol, ecol, ancillary, landmask, altitude, srf_file, use_srf, add_noise)
190 break
192 self.init_shape(
193 totalheight=totalheight,
194 totalwidth=totalwidth,
(...) 197 scol=scol,
198 ecol=ecol)
--> 200 self.init_latlon()
201 self.init_geometry()
202 if self.ancillary == 'ECMWFT':

File /work/datalake/watcal/sandbox/git/polymer/polymer/level1_msi.py:254, in Level1_MSI.init_latlon(self)
250 code = self.geocoding.find('HORIZONTAL_CS_CODE').text
252 print('Initialize MSI projection {}'.format(code))
--> 254 proj = pyproj.Proj('+init={}'.format(code))
256 # lookup position in the UTM grid
257 for e in self.geocoding.findall('Geoposition'):

File /work/scratch/env/brayf/conda/polymer_env/lib/python3.13/site-packages/pyproj/proj.py:110, in Proj.init(self, projparams, preserve_units, **kwargs)
48 def init(
49 self, projparams: Any | None = None, preserve_units: bool = True, **kwargs
50 ) -> None:
51 """
52 A Proj class instance is initialized with proj map projection
53 control parameter key/value pairs. The key/value pairs can
(...) 108 '116.366 39.867'
109 """
--> 110 self.crs = CRS.from_user_input(projparams, **kwargs)
111 # make sure units are meters if preserve_units is False.
112 if not preserve_units and "foot" in self.crs.axis_info[0].unit_name:
113 # ignore export to PROJ string deprecation warning

File /work/scratch/env/brayf/conda/polymer_env/lib/python3.13/site-packages/pyproj/crs/crs.py:503, in CRS.from_user_input(cls, value, **kwargs)
501 if isinstance(value, cls):
502 return value
--> 503 return cls(value, **kwargs)

File /work/scratch/env/brayf/conda/polymer_env/lib/python3.13/site-packages/pyproj/crs/crs.py:350, in CRS.init(self, projparams, **kwargs)
348 self._local.crs = projparams
349 else:
--> 350 self._local.crs = _CRS(self.srs)

File /work/scratch/env/brayf/conda/polymer_env/lib/python3.13/site-packages/pyproj/_crs.pyx:2364, in pyproj._crs._CRS.init()

CRSError: Invalid projection: +init=epsg:32631 +type=crs: (Internal Proj Error: proj_create: no database context specified)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions