Skip to content

ValueError: assignment destination is read-only with parallel processing #28

@pstradio

Description

@pstradio

With version v0.11 I am getting the following when trying to ts2img and > 1 n_proc.

ERROR:root:The following ERROR was raised in the parallelized function `_convert` but was ignored due to the chosen settings: Traceback (most recent call last):
  File "/home/pstradio/miniforge3/envs/rep/lib/python3.9/site-packages/repurpose/process.py", line 175, in run_with_error_handling
    r = FUNC(**kwargs)
  File "/home/pstradio/miniforge3/envs/rep/lib/python3.9/site-packages/repurpose/ts2img.py", line 59, in _convert
    writer.write_ts(ts, gpi)
  File "/home/pstradio/miniforge3/envs/rep/lib/python3.9/site-packages/repurpose/stack.py", line 357, in write_ts
    self.ds[var].values[t, row, col] = df[var].values
ValueError: assignment destination is read-only

I'm running the following:

...

inreader = CustomeReader()  # just a wrapper around a pynetcf reader
outgrid = BasicGrid(lon2d.flatten(), lat2d.flatten(), shape=(lats.size, lons.size))
dates = pd.date_range("2015-04-01T06:00:00", "2022-09-29T18:00:00", freq="12h")

conv = Ts2Img(inreader, outgrid, dates,)

conv.calc(
    path_out=os.path.join(BASEPATH, 'images'),
    format_out='slice',
    var_attrs=dict(sm=dict(long_name='soil moisture', units='m3 m-3')),
    n_proc=6,
    img_buffer=190,
    zlib=True,
)

I can reproduce the issue on 2 different machines.

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