1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] xarray fails to lacate a file that exists

Discussão em 'Python' iniciado por Stack, Setembro 15, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to load a .nc file to python but xarray can't find it. I even tried with other packages and they work, but not xarray, what could be wrong? This is my code:

    from scipy.io import netcdf
    import xarray as xr
    import numpy as np
    import matplotlib.pyplot as plt

    psl = netcdf.NetCDFFile('C:/Users/chala/OneDrive - fcien.edu.uy/PBMA 2025/Práctico 2/psl_2022.nc', 'r') # Works

    psl2 = xr.load_dataset('C:/Users/chala/OneDrive - fcien.edu.uy/PBMA 2025/Práctico 2/psl_2022.nc') # Doesn't work



    The error message I get is "FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\chala\OneDrive - fcien.edu.uy\PBMA 2025\Práctico 2\psl_2022.nc'"

    Continue reading...

Compartilhe esta Página