Skip to content

cf.Field.del_file_location fails with TypeError #707

@davidhassell

Description

@davidhassell

cf.Field.del_file_location fails with TypeError: del_file_location() got an unexpected keyword argument 'inplace':

>>> import cf
>>> f = cf.example_field(2)
>>> f.del_file_location('/home/data')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[90], line 1
----> 1 f.del_file_location('/home/data')

File ~/miniconda3/lib/python3.10/site-packages/cf/field.py:2546, in Field.del_file_location(self, location, constructs)
   2544 if constructs:
   2545     for c in self.constructs.filter_by_data(todict=True).values():
-> 2546         c.del_file_location(location, inplace=True)
   2548 return location

TypeError: del_file_location() got an unexpected keyword argument 'inplace'
>>>

This is simply fixed by removing the inplace keyword from the nested calls of del_file_location.

>>> cf.environment(paths=False)
Platform: Linux-5.15.0-91-generic-x86_64-with-glibc2.35
HDF5 library: 1.14.2
netcdf library: 4.9.2
udunits2 library: miniconda3/lib/libudunits2.so.0
esmpy/ESMF: 8.4.2
Python: 3.10.13
dask: 2023.12.1
netCDF4: 1.6.5
psutil: 5.9.4
packaging: 23.0
numpy: 1.26.0
scipy: 1.11.3
matplotlib: 3.8.0
cftime: 1.6.2
cfunits: 3.3.6
cfplot: 3.2.21
cfdm: 1.11.0.0
cf: 3.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions