Skip to content

Control over datatype in domain_cfg, mesh_mask and nemo files #112

@vopikamm

Description

@vopikamm

I noticed that NEMO output files and the domain_cfg files are of different dtype. When e.g. using thickness-weighted temperatures this changes the dtype from float32 to float64 doubling the arrays size in memory:

from xnemogcm import open_domain_cfg, open_nemo

domain = open_domain_cfg(
            files=['/path/to/domain_cfg/files']
        )

data   = open_nemo(domcfg=domain, files=['/path/to/nemo/files'])

# size of array doubles after multiplication with e3t
(domain.e3t_0 * data.toce).nbytes / (data.toce).nbytes # --> 2

#type of data
(domain.e3t_0 * data.toce).dtype     # --> float64
(data.toce).dtype                    # --> float32

Have you already considered this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions