Skip to main content

eseas is a Python package that serves as a wrapper for the jwsacruncher Java package. This tool allows users to process Demetra workspace XML files, create batch files, execute them, and collect the desired outputs into individual Excel files.

Project description

PyPI t Windows Ubuntu / Mac

Downloads Downloads Downloads

eseas

eseas is a Python package that acts as a wrapper for the jwsacruncher Java package. This tool allows users to process Demetra workspace XML files, create batch files, execute them, and collect the desired outputs into individual Excel files.

Installation

eseas

You can install the eseas package via pip:

pip install eseas -U

Note: eseas v2.0.0+ requires Python 3.10 or higher. If you are installing via pip on Python 3.9 or older, pip will automatically download the last compatible 1.x version without the v2.0.0 features.

Prerequisites

jwsacruncher

eseas requires the jwsacruncher Java package. You can download it from the jwsacruncher GitHub releases page.

Setup Instructions

  1. Download the latest release of jwsacruncher from the releases page.
  2. Unzip the downloaded file.
  3. Note the path to the bin directory inside the unzipped folder.

After downloading jwsacruncher, you need to specify its location when using the Options function from the eseas package.

Usage

Here's an example of how to use the eseas package:

    from eseas import Seasonal, Options


    def main():
        # Specify the path to the jwsacruncher bin directory
        java_folder = r"C:\path\to\jwsacruncher\bin"

        # Folder containing Demetra XML files
        demetra_source_folder = r"C:\Data\demetra_source_folder"

        # Workspace where output files will be stored
        local_folder = r"C:\Data\test_out"

        options = Options(
            demetra_source_folder,
            java_folder,
            local_folder,
            result_file_names=("sa", "s_f", "cal"),  # See "Demetra Components" below
            workspace_mode=True,
            file_name_explanation=True
        )

        # Initialize the Seasonal process
        seas = Seasonal(options)

        # Execute the two-step process synchronously
        seas.run() # Equivalent to seas.part1() immediately followed by seas.part2()
        
    if __name__ == "__main__":
        main()

Advanced Usage: Specifying Java Executable Path (java_bin)

If your system struggles to locate the Java executables (or if you have multiple Java versions and want to point eseas directly to a specific one), you can provide java_bin.

    # For a specific JDK installed on Windows:
    java_bin = r"C:\Program Files\Java\jdk-17\bin"
    # Or in Unix systems if not in PATH natively: java_bin = r"/usr/bin"
    
    options = Options(
        demetra_source_folder=r"C:\Data\demetra_source",
        java_folder=r"C:\path\to\jwsacruncher\bin",
        local_folder=r"C:\Data\test_out",
        java_bin=java_bin   # Forces eseas to inject this into the environment PATH automatically
    )
    
    seas = Seasonal(options)
    seas.run()

Auto-Downloading jwsacruncher

Instead of manually deploying JDemetra+ binaries or configuring .env paths, eseas can now automatically download, extract, and execute jwsacruncher on the fly.

Here is an example utilizing auto_download=True with Windows-based path structures:

from eseas import Seasonal, Options

def main():
    # Folder containing Demetra XML workspace files
    demetra_source_folder = r"C:\Data\demetra_source_folder"

    # Workspace where output Excel files will be stored
    local_folder = r"C:\Data\test_out"

    # We do not need a 'java_folder' path if auto_download is enabled!
    options = Options(
        demetra_source_folder=demetra_source_folder,
        local_folder=local_folder,
        result_file_names=("sa", "s_f", "cal"),
        workspace_mode=True,
        file_name_explanation=True,
        auto_download=True,  # Seamlessly fetches jwsacruncher
        auto_approve=True    # Skips CLI yes/no prompts during file generation
    )

    # Initialize and execute the seasonal adjustment process synchronously
    seas = Seasonal(options)
    seas.run()

if __name__ == "__main__":
    main()

Documentation

For more detailed information, refer to the following guides:

Documentation

How it Works

  1. Input Directory: The user specifies the directory of the Demetra workspace where XML files are located.
  2. Batch File Creation: The package creates batch files for all XML files in the specified directory.
  3. Execution: It runs the batch files using the jwsacruncher tool.
  4. Output Collection: The specified outputs are collected and compiled into individual Excel files for each XML file processed.

Acknowledgments

This package (eseas) is an independent Python wrapper that interacts with the jwsacruncher application.
Users must download jwsacruncher separately. This package is not affiliated with or derived from jwsacruncher.

jwsacruncher is a Java-based implementation of the .NET application WSACruncher. It is a command-line tool that allows users to re-estimate all multi-processing tasks defined in a Demetra workspace.

The workspace can be generated by:

  • Demetra+ (.NET)
  • JDemetra+ (Java)
  • Any compatible user tool

For more information, visit the jwsacruncher GitHub repository.

License

This project is licensed under the EUPL-1.2 License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eseas-2.0.12.tar.gz (58.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eseas-2.0.12-py3-none-any.whl (86.8 kB view details)

Uploaded Python 3

File details

Details for the file eseas-2.0.12.tar.gz.

File metadata

  • Download URL: eseas-2.0.12.tar.gz
  • Upload date:
  • Size: 58.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for eseas-2.0.12.tar.gz
Algorithm Hash digest
SHA256 235d834a5d8a4432f792316a089999926cd3dbbf693b318e3e3674d507c28937
MD5 392b0f19d7a86954c445e140354680b2
BLAKE2b-256 404b703b5e06028ac398848c8dd26da8f643e910eb9eeb6d9ac869761d834a8f

See more details on using hashes here.

File details

Details for the file eseas-2.0.12-py3-none-any.whl.

File metadata

  • Download URL: eseas-2.0.12-py3-none-any.whl
  • Upload date:
  • Size: 86.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for eseas-2.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 094fa04ab5a71803453fb5d3e1f7c71f6559a4fee9ae2b4d2baa9e85c36a31a1
MD5 0e8510aedf56234bc736351f992e3233
BLAKE2b-256 8c89d4d2a3af8f11879ec5e03be8896c9fdb3fa794bddf10dcdf08e2e6e2682e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page