Skip to content

Repository files navigation

AquaCrop Project Converter

Tools for converting legacy AquaCrop project files to the AquaCrop 7.3 project layout.

Features

  • Reads AquaCrop projects from ZIP archives or a set of selected files.
  • Detects the project version and inspects referenced climate, crop, soil, and other input files.
  • Converts supported AquaCrop 5.x, 6.x, and 6.1 projects to the AquaCrop 7.3 layout.
  • Generates the matching AquaCrop 7.3 program-parameter file.
  • Packages existing AquaCrop 7.x projects without rewriting them.
  • Reports structural errors, missing references, and conversion warnings before download.
  • Supports strict validation and annual or preserve cultivation-year modes.

Conversion and validation are structural. AquaCrop is not bundled or executed, so a successful conversion does not confirm that the project runs in AquaCrop 7.3.

Supported Projects

The converter supports:

  • AquaCrop 5.x projects that use the V6-style run layout;
  • AquaCrop 6.x and 6.1 .PRM and .PRO projects;
  • AquaCrop 7.x projects for inspection and packaging without conversion.

Versions below 5 and projects with an unrecognized line layout are not supported. If an input contains more than one project file, select the project to inspect and convert.

Web Interface

The web interface processes project files in the browser. It does not upload them to a conversion service.

  1. Choose a ZIP archive or select the project files.
  2. Review the detected version, project file, references, warnings, and errors.
  3. Select the cultivation-year mode and, if needed, strict validation.
  4. Convert or package the project and download the ZIP archive.

The downloaded archive is named after the selected project. For example, maize.PRM produces maize.zip.

The web archive contains:

AQUACROP_INPUT_V73/
README.txt

AQUACROP_INPUT_V73 contains the selected project, its referenced input files, and any generated project or parameter file. README.txt records the source and target versions, inserted values, and warnings.

CLI

Node.js 22.12 or newer is required. Run the published package with npx:

npx @agrodt/aquacrop-converter inspect project.zip

npx @agrodt/aquacrop-converter convert project.zip \
  --output project-v73.zip \
  --strict \
  --cultivation-year-mode annual

The main options are:

  • --project <path> selects a project when the input contains multiple .PRM or .PRO files.
  • --strict treats structural warnings covered by strict mode as errors.
  • --cultivation-year-mode annual|preserve controls converted cultivation-year values.
  • --report=none|text|json controls stdout output; the default is text.
  • --report-file <path> writes the full conversion report to a separate JSON file.

The CLI returns a nonzero exit code when inspection or conversion fails.

Conversion Output

The converter preserves referenced input files and existing project values where the target format allows it. It adds the AquaCrop 7.3 CAL and OBS references as (None), inserts the required rainfall program-parameter defaults, and writes generated project and parameter files with CRLF line endings.

Executables, temporary output, source maps, browser metadata, absolute local paths, and unrelated files are not copied into the converted archive.

Repository Structure

  • packages/core contains the format inspection, validation, and conversion logic.
  • packages/cli contains the Node.js command-line interface.
  • apps/web contains the browser interface.
  • fixtures and packages/core/tests contain regression fixtures and tests.

Development

Install dependencies from the repository root:

pnpm install

Common commands:

pnpm check
pnpm typecheck
pnpm test
pnpm build
pnpm dev

The core regression tests compare generated project and parameter files byte-for-byte with the expected AquaCrop 7.3 fixtures.

Limitations

  • AquaCrop runtime validation is not performed.
  • Existing AquaCrop 7.x projects are packaged without conversion.
  • The preserve cultivation-year mode follows the reference converter's sequential run numbering.

Releases

Packages

Contributors

Languages