Giter VIP home page Giter VIP logo

Comments (3)

coroa avatar coroa commented on June 4, 2024

Ah ok, it's clear why that happens. Windows puts locks on all open files, so that one cannot delete or actually even read from an already open file and i'm trying to delete the temporary files seemingly at a point in time, when the libnetcdf library used by xarray hasn't released them just yet. Instead i will have to schedule deletion somehow and then only execute them a tiny bit later. Will not affect linux or macos as they don't use these locks.

Will have to experiment a bit.

from atlite.

euronion avatar euronion commented on June 4, 2024

Update on tracking down the problem:

The PermissionError pops up at this point, where merging of the different feature datasets happens:

https://github.com/FRESNA/atlite/blob/6f3559d5e20a05c79fa55596623c732930581178/atlite/data.py#L163

Then the weakref.finalize(...) is triggered calling the unlink. At first I thought that was too early, but then I figured we just have to close the xarray.Dataset properly... .
I'll create a PR in a moment.

from atlite.

coroa avatar coroa commented on June 4, 2024

the whole point of the finalizer was to delete the file automatically after xarray itself decides it's time to close the file. So closing it yourself kind of defeats the purpose (even if it works in this particular case). I dug a bit deeper into xarrays code and found that it is always using a (Caching)FileManager to handle cleaning up of open files, and thus moved the finalizer there. So that as soon as the filemanager handling the file is garbage collected the finalizer is called and deletes the file. I just pushed the code (f3ab9b0). It works fine in a Win7 virtualbox for me.

from atlite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.