[Python] Read multiple .nc files into a 3D pandas dataframe python

Discussão em 'Python' iniciado por Stack, Maio 5, 2025.

  1. Stack

    Stack Membro Participativo

    I would like to read in multiple SST netcdf files and from each file extract the SST data in selected lat, lon range and then store this data in a three dimensional panda dataframe. Closing each netcdf after it has been read to save memory.

    I would like to end with one dataframe of a years worth of daily data.

    I have read one file with NetCDF4 and stored each variable but that is as far as I have got.

    my_file = 'C:/Users/lisa/Desktop/Sean/20160719000127-UoS-L2i-SSTskin-ISAR_002-D054_PtA-v01.0-fv01.5.nc'
    fh = netCDF4.Dataset(my_file, mode='r')
    lon = fh.variables['lon'][:]
    lat = fh.variables['lat'][:]
    time = fh.variables['time'][:]
    sst = fh.variables['sea_surface_temperature'][:]


    The data is from OPeNDAP for 2016 from the following address.

    http://www.ifremer.fr/opendap/cerdap1/ghrsst/l4/saf/odyssea-nrt/data/

    Any help would be much appreciated!!

    Continue reading...

Compartilhe esta Página