Plot Température x temps à partir d'un fichier netcdf

Postez ici vos questions, réponses, commentaires ou suggestions - Les sujets seront ultérieurement répartis dans les archives par les modérateurs

Modérateur : Groupe des modérateurs

Céline Barrier
Messages : 14
Enregistré le : 30 Mai 2018, 11:49

Plot Température x temps à partir d'un fichier netcdf

Messagepar Céline Barrier » 29 Mai 2020, 11:37

Bonjour à tous,

A partir d'un fichier netcdf et des packages ncdf4, ggplot2 et dplyr, j'aimerais faire une représentation graphique de ma température en fonction du temps. Pour cela j'utilise un fichier netcdf qui est une extraction de la variable température (TEMP) seulement à partir d'un gros fichier source netcdf. C'est un fichier représentant le mois d'avril, j'aimerais faire un graphique de l'évolution de la température jour après jour.

Mon message d'erreur est Error in temperature[4, ] : nombre de dimensions incorrect.
Je ne comprends pas où je me trompe dans la définition de mon nombre de dimensions.
Pour vous aiguiller, je vous copie mon code également un print de mon fichier.

Merci par avance pour votre aide !

Code : Tout sélectionner

print(temp)
File MENOR_avril_temp.nc (NC_FORMAT_NETCDF4_CLASSIC):

     3 variables (excluding dimension variables):
        double longitude[ni,nj]   
            standard_name: longitude
            long_name: longitude
            units: degrees_east
            _CoordinateAxisType: Lon
        double latitude[ni,nj]   
            standard_name: latitude
            long_name: latitude
            units: degrees_north
            _CoordinateAxisType: Lat
        short TEMP[ni,nj,level,time]   
            standard_name: sea_water_potential_temperature
            long_name: temperature
            units: degrees_Celsius
            coordinates: latitude longitude
            add_offset: 22.5
            scale_factor: 0.000839259009808302
            _FillValue: -32768
            missing_value: -32768

     4 dimensions:
        time  Size:240   *** is unlimited ***
            standard_name: time
            long_name: time in seconds (UT)
            units: seconds since 1900-01-01T00:00:00Z
            calendar: standard
            axis: T
        ni  Size:1101
            standard_name: projection_x_coordinate
            long_name: x-dimension of the grid
            axis: X
        nj  Size:463
            standard_name: projection_y_coordinate
            long_name: y-dimension of the grid
            axis: Y
        level  Size:60
            long_name: sigma level
            positive: up
            axis: Z
            c_grid_axis_shift: 0
            standard_name: ocean_s_coordinate
            formula_definition: z(n,k,j,i) = eta(n,j,i)*(1+s(k)) + depth_c*s(k) + (depth(j,i)-depth_c)*C(k)

    60 global attributes:
        _NCProperties: version=1|netcdflibversion=4.4.1.1|hdf5libversion=1.8.19
        CDI: Climate Data Interface version 1.9.6 (http://mpimet.mpg.de/cdi)
        history: Fri May 29 10:51:39 2020: cdo -select,name=TEMP MENOR_source.nc MENOR_avril_temp.nc
Mon Nov  6 14:09:55 2017: /appli/nco/nco-4.6.4__gcc-6.3.0/bin/ncrcat /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170401T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170401T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170401T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170401T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170401T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170401T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170401T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170401T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170402T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170402T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170402T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170402T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170402T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170402T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170402T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170402T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170403T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170403T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170403T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170403T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170403T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170403T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170403T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170403T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170404T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170404T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170404T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170404T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170404T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170404T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170404T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170404T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170405T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170405T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170405T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170405T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170405T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170405T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170405T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170405T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170406T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170406T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170406T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170406T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170406T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170406T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170406T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170406T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170407T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170407T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170407T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170407T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170407T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170407T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170407T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170407T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170408T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170408T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170408T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170408T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170408T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170408T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170408T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170408T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170409T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170409T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170409T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170409T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170409T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170409T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170409T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170409T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170410T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170410T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170410T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170410T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170410T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170410T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170410T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170410T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170411T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170411T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170411T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170411T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170411T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170411T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170411T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170411T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170412T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170412T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170412T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170412T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170412T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170412T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170412T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170412T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170413T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170413T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170413T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170413T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170413T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170413T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170413T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170413T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170414T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170414T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170414T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170414T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170414T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170414T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170414T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170414T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170415T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170415T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170415T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170415T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170415T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170415T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170415T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170415T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170416T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170416T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170416T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170416T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170416T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170416T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170416T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170416T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170417T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170417T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170417T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170417T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170417T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170417T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170417T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170417T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170418T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170418T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170418T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170418T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170418T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170418T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170418T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170418T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170419T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170419T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170419T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170419T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170419T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170419T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170419T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170419T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170420T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170420T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170420T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170420T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170420T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170420T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170420T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170420T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170421T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170421T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170421T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170421T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170421T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170421T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170421T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170421T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170422T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170422T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170422T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170422T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170422T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170422T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170422T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170422T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170423T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170423T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170423T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170423T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170423T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170423T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170423T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170423T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170424T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170424T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170424T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170424T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170424T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170424T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170424T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170424T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170425T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170425T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170425T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170425T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170425T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170425T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170425T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170425T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170426T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170426T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170426T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170426T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170426T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170426T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170426T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170426T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170427T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170427T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170427T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170427T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170427T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170427T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170427T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170427T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170428T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170428T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170428T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170428T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170428T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170428T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170428T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170428T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170429T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170429T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170429T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170429T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170429T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170429T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170429T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170429T2100Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170430T0000Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170430T0300Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170430T0600Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170430T0900Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170430T1200Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170430T1500Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170430T1800Z.nc /home1/datawork/scoudray/DATARESU/MENOR/201704BE/MARC_F2-MARS3D-MENOR1200_20170430T2100Z.nc /home1/datawork//scoudray/DATARESU/MENOR/2017BE/champs_meno_BE201704.nc
2017-04-04T21:09:49Z: creation
        source: MARS3D V10.10
        institution: IFREMER
        Conventions: CF-1.6 OCO-1.3.1 COMODO-1.0
        limi: 0
        lima: 1100
        pasi: 1
        ljmi: 0
        ljma: 462
        pasj: 1
        lkmi: 1
        lkma: 60
        pask: 1
        global_imin: 0
        global_imax: 1100
        global_jmin: 0
        global_jmax: 462
        data_type: OCO oriented grid
        format_version: 1.3.1
        netcdf_version: 4.1.2
        product_version: 1.0
        references: http://www.previmer.org/
        easting: longitude
        northing: latitude
        grid_projection: n/a
        distribution_statement: Data restrictions: for registered users only
        institution_references: http://www.ifremer.fr/
        data_centre: IFREMER OCO DATA CENTER
        data_centre_references: http://www.previmer.org/
        title: PREVIMER MENOR 1200 forecast
        creation_date: 2017-04-04T21:09:49Z
        run_time: 2017-04-04T21:09:49Z
        model_name: MARS
        arakawa_grid_type: C1
        area: North Western Mediterranean Sea
        southernmost_latitude: 39.5000
        northernmost_latitude: 44.5000
        latitude_resolution: 1.082250000000000E-002
        westernmost_longitude: 0.0000
        easternmost_longitude: 15.9999
        longitude_resolution: 1.454540000000000E-002
        minimum_depth: 5.000000
        maximum_depth: 3500.000
        depth_resolution: n/a
        forecast_range: 4-days forecast
        forecast_type: forecast
        operational_status: experimental
        NCO: "4.6.4"
        start_date: 2017-04-01T00:00:00Z
        stop_date: 2017-04-01T00:00:00Z
        software_version: PREVIMER forecasting system v2
        product_name: PREVIMER_F2-MARS3D-MENOR1200_20170401T0000Z.nc
        field_type: 3-hourly
        comment: Use of Meteo-France ARPEGEHR meteorological data
        contact: cdoco-exploit@ifremer.fr
        quality_index: 0
        nco_openmp_thread_number: 1
        CDO: Climate Data Operators version 1.9.6 (http://mpimet.mpg.de/cdo)


et ci-dessous le code que j'ai utilisé et qui me donne la fameuse erreur

Code : Tout sélectionner

#packages
library(ncdf4)
library(ggplot2)
library(dplyr)

# open netcdf file
had <- nc_open("nom_du_fichier.nc")

print(fichier) # ce que j'ai montré ci-dessus

# get the data

lon <- ncvar_get(had, "longitude")
lat <- ncvar_get(had, "latitude")
time <- ncvar_get(had, "time")
temperature <- ncvar_get(had, "TEMP")

nc_close(had) # done with the file

# ref origin for this one is diff than
time <- as.Date(time, origin="2017-04-01") #je ne suis pas sûre avec cette date

# pick a lat/lon pair

(lon[10])
## [1] -132.5

(lat[10])
## [1] -42.5

data_frame(month=time,
           temp=temperature[4,],
           col=ifelse(temp<0, "#b2182b", "#2166ac")) %>%
  ggplot(aes(month, temp)) +
  geom_point(aes(color=col), size=0.15) +
  scale_color_identity() +
  theme_bw()

Eric Casellas
Messages : 767
Enregistré le : 06 Jan 2009, 14:59

Re: Plot Température x temps à partir d'un fichier netcdf

Messagepar Eric Casellas » 29 Mai 2020, 12:10

Salut,

Alors je ne connais pas tes paquets et le code n'est pas reproductible, mais j'ai l'impression que ton objet temperature est un vecteur,
or quand tu l'utilise (temp=temperature[4,]), tu fait comme si c'était un data.frame (d'où le message d'erreur sur le nombre de dimensions), il faudrait que tu remplace par temp=temperature[4]

Eric
Eric

Céline Barrier
Messages : 14
Enregistré le : 30 Mai 2018, 11:49

Re: Plot Température x temps à partir d'un fichier netcdf

Messagepar Céline Barrier » 29 Mai 2020, 13:05

Bonjour,
Merci Eric,
Oui, en effet votre remarque est juste.
Pour résumer j'aimerais soit représenter très simplement la température en fonction du temps à partir de mon fichier, soit obtenir un tableau simple avec les températures tous les jours du mois d'avril de ce fichier netcdf.


Retourner vers « Questions en cours »

Qui est en ligne

Utilisateurs parcourant ce forum : Aucun utilisateur enregistré et 1 invité