Skip to content

Support uploading NetCDF (.nc) files as documents #14588

Open

Description

@TheStarsBlink

Use case

I would like to upload NetCDF (.nc) files to GeoNode as documents, so users can catalogue, manage permissions, and download the original files. GeoServer publishing or map visualization is not required.

Current behavior

In my current checkout (GeoNode 5.1.0 dev), .nc is not included in DOCUMENT_TYPE_MAP. Adding nc to ALLOWED_DOCUMENT_TYPES alone does not enable it because the setting is filtered against that map. Uploads also require content-type validation configuration.

Questions

Is excluding NetCDF from document uploads intentional, or is this simply a file type that has not yet been added? What is the recommended way to support it, including NetCDF classic and NetCDF-4/HDF5 files?

Expected behavior

  • Allow valid .nc files to be uploaded as documents.
  • Preserve the original file for download.
  • Use the existing document metadata and permission controls.
  • Require no spatial parsing or GeoServer publishing.

Activity

  1. TheStarsBlink commented on Sep 8, 2026

    @TheStarsBlink
    ContributorAuthor

    scenario-results.zip

    I also tried uploading a ZIP containing NetCDF files as a document, but that failed too.

    Steps to reproduce

    1. Open the document upload page (/catalogue/#/upload/document).
    2. Upload scenario-results.zip (approximately 9.87 MiB), containing these files at the archive root:
    cloud.nc
    wind.nc
    rain.nc
    manifest.json
    
    1. The upload task fails with:
    A document must have a file or a url
    

    What I found in the failed task

    The action was document_upload, handled by DocumentFileHandler. The original temporary file parameters contained both base_file and zip_file, pointing to the uploaded ZIP. After preprocessing, the task's files contained only nc_file and json_file; base_file was missing.

    In the code running in my deployment, BaseHandler.pre_processing() extracts archives whenever zip_file is present and rebuilds the file mapping through organize_files_by_ext(..., kind="document"). Since the extracted .nc and .json files are not allowed document main-file types in my configuration, no base_file is selected. BaseDocumentFileHandler.is_valid() then raises the error above.

    Expected behavior

    When uploading a ZIP as a document, I would expect GeoNode to retain the complete original archive as one downloadable document, while still applying the existing ZIP safety and size checks. I am not asking it to import or publish the enclosed NetCDF files as datasets.

    Is this automatic extraction intended for document uploads, or should it be limited to archive-based dataset imports? This appears to be a separate ZIP document-upload issue in addition to the missing .nc document type support.

  2. mvanhorn commented on Nov 14, 2026

    @mvanhorn
    Contributor

    The document type, MIME, and magic-byte maps have no nc entry, and allowed document extensions are taken from the type map, so an allow-list entry alone never accepts the file. Content checks also have no NetCDF or HDF5 types to match against the file bytes.

    nc is registered as an archive document with MIME type application/x-netcdf.

    #14767

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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