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

Column names, Record does not match collection schema #171

Open
henrykironde opened this issue Jan 29, 2024 · 0 comments
Open

Column names, Record does not match collection schema #171

henrykironde opened this issue Jan 29, 2024 · 0 comments

Comments

@henrykironde
Copy link
Contributor

In nest_detection.py we provide the schema as below. However, in nest_detection.py:124: we get UserWarning: Column names longer than 10 characters will be truncated when saved to ESRI Shapefile. this could be and issue if the column names are truncated

  schema = {
        "geometry": "Polygon",
        "properties": {
            'matched_xmin': 'float',
            'matched_ymin': 'float',
            'xmax': 'float',
            'matched_ymax': 'float',
            'label': 'str',
            'score': 'float',
            'Site': 'str',
            'Date': 'str',
            'Year': 'str',
            'bird_id': 'int',
            'event': 'str',
            'target_index': 'int'
        }
    }
[Sun Jan 28 03:42:40 2024]
localrule detect_nests:
    input: /blue/ewhite/everglades/predictions/2020/Joule/Joule_2020_combined.shp
    output: /blue/ewhite/everglades/detected_nests/2020/Joule/Joule_2020_detected_nests.shp
    jobid: 1000
    reason: Missing output files: /blue/ewhite/everglades/detected_nests/2020/Joule/Joule_2020_detected_nests.shp; Updated input files: /blue/ewhite/everglades/predictions/2020/Joule/Joule_2020_combined.shp
    wildcards: year=2020, site=Joule
    resources: tmpdir=/scratch/local/22378485

python nest_detection.py /blue/ewhite/everglades/predictions/2020/Joule/Joule_2020_combined.shp
/orange/ewhite/PortalForecasts/.conda/envs/EvergladesTools/lib/python3.11/site-packages/pandas/core/arrays/masked.py:60: UserWarning: Pandas requires version '1.3.6' or newer of 'bottleneck' (version '1.3.5' currently installed).
  from pandas.core import (
/blue/ewhite/everglades/EvergladesTools/Zooniverse/nest_detection.py:124: UserWarning: Column names longer than 10 characters will be truncated when saved to ESRI Shapefile.
  result_shp.to_file(filename, schema=schema)
Traceback (most recent call last):
  File "/blue/ewhite/everglades/EvergladesTools/Zooniverse/nest_detection.py", line 262, in <module>
    detect_nests(path, year, site, savedir=savedir)
  File "/blue/ewhite/everglades/EvergladesTools/Zooniverse/nest_detection.py", line 124, in detect_nests
    result_shp.to_file(filename, schema=schema)
  File "/orange/ewhite/PortalForecasts/.conda/envs/EvergladesTools/lib/python3.11/site-packages/geopandas/geodataframe.py", line 1264, in to_file
    _to_file(self, filename, driver, schema, index, **kwargs)
  File "/orange/ewhite/PortalForecasts/.conda/envs/EvergladesTools/lib/python3.11/site-packages/geopandas/io/file.py", line 612, in _to_file
    _to_file_fiona(df, filename, driver, schema, crs, mode, **kwargs)
  File "/orange/ewhite/PortalForecasts/.conda/envs/EvergladesTools/lib/python3.11/site-packages/geopandas/io/file.py", line 641, in _to_file_fiona
    colxn.writerecords(df.iterfeatures())
  File "/orange/ewhite/PortalForecasts/.conda/envs/EvergladesTools/lib/python3.11/site-packages/fiona/collection.py", line 558, in writerecords
    self.session.writerecs(records, self)
  File "fiona/ogrext.pyx", line 1397, in fiona.ogrext.WritingSession.writerecs
ValueError: Record does not match collection schema: ['matched_xmin', 'matched_ymin', 'xmax', 'matched_ymax', 'label', 'score', 'image_path', 'Site', 'Date', 'Year', 'event', 'bird_id', 'target_index'] != ['Year', 'label', 'target_index', 'score', 'Site', 'event', 'bird_id', 'matched_xmin', 'xmax', 'Date', 'matched_ymax', 'matched_ymin']                                                                                                                      880,1         27%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant