Skip to content

Modify dfs2 items not working #38

@daniel-caichac-DHI

Description

@daniel-caichac-DHI

Hi.

I have a bunch of files with wrong item type (I did not make them). I need to re-write the eumUnit and eumItem but re-writing the files is not an option since each file is +100GB.

I am currently using DataUtility which takes like a second but I need to click in each item of each file (it is 4 items and 50 files, so lots of clicks).

I tried this, but does not work. File date is updated, but the items remain unchanged.

def ModifyDfs2ItemInfo(filename):
# Open the file for editing
file = DfsFileFactory.Dfs2FileOpenEdit(filename);
# Original name is "Landuse" (7 characters), "GroundUse" is truncated to "GroundU"
file.ItemInfo[0].Name = "GroundUse";
# Provide a new quantity (updating the item and unit of the quantity directly does not work!)
file.ItemInfo[0].Quantity = eumQuantity(eumItem.eumIAreaFraction, eumUnit.eumUPerCent);
# done
file.Close();

is there any suggestion?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions