IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

MATLAB Discussion :

Extraire variable(s) fichier source netcdf


Sujet :

MATLAB

  1. #1
    Membre averti
    Femme Profil pro
    Scientifique
    Inscrit en
    Février 2017
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 36
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Scientifique

    Informations forums :
    Inscription : Février 2017
    Messages : 11
    Par défaut Extraire variable(s) fichier source netcdf
    Bonjour à tous,
    J'aimerais utiliser Matlab pour extraire un tableau de mes températures en fonction du temps (plus précisément température journalière).
    Pour cela je dispose d'un gros fichier netcdf MARS3D multidimensions, multivariable.
    J'aimerais obtenir en sortie soit un tableau des températures journalières, soit un graphe (l'essentiel est de pouvoir tirer cette information du fichier source .nc).
    Mes étapes seraient :
    1/comment à partir d'un fichier source je peux extraire des variables d’intérêt avec Matlab pour réécrire un fichier "épuré"
    2/comment à partir de ce fichier je peux produire un tableau de ma variable exprimée en fonction du temps (exemple température journalière chaque jour pour mon fichier mensuel).

    La variable qui m'intéresse est la température "TEMP", la latitude, la longitude et le temps.

    Voici ci-dessous les infos concernant mon fichier source, merci par avance pour votre aide !

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    Filename: 'C:\Users...\champs_meno_BE201704.nc'
              Name: '/'
        Dimensions: [1×10 struct]
         Variables: [1×31 struct]
        Attributes: [1×57 struct]
            Groups: []
            Format: 'netcdf4_classic'
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    ncdisp('champs_meno_BE201704.nc')
    Source:
               C:\Users\...\champs_meno_BE201704.nc
    Format:
               netcdf4_classic
    Global Attributes:
               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'
               Conventions              = 'CF-1.6 OCO-1.3.1 COMODO-1.0'
               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              = 'IFREMER'
               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'
               history                  = .../champs_meno_BE201704.nc
                                          2017-04-04T21:09:49Z: creation'
               model_name               = 'MARS'
               arakawa_grid_type        = 'C1'
               source                   = 'MARS3D V10.10'
               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
    Dimensions:
               ni    = 1101
               nj    = 463
               ni_u  = 1101
               nj_u  = 463
               ni_v  = 1101
               nj_v  = 463
               ni_f  = 1101
               nj_f  = 463
               time  = 240   (UNLIMITED)
               level = 60
    Variables:
        ni         
               Size:       1101x1
               Dimensions: ni
               Datatype:   single
               Attributes:
                           long_name            = 'x-dimension of the grid'
                           standard_name        = 'x_grid_index'
                           c_grid_axis_shift    = 0
                           axis                 = 'X'
                           c_grid_dynamic_range = '4:1088'
        nj         
               Size:       463x1
               Dimensions: nj
               Datatype:   single
               Attributes:
                           long_name            = 'y-dimension of the grid'
                           standard_name        = 'y_grid_index'
                           axis                 = 'Y'
                           c_grid_axis_shift    = 0
                           c_grid_dynamic_range = '3:456'
        ni_u       
               Size:       1101x1
               Dimensions: ni_u
               Datatype:   single
               Attributes:
                           long_name            = 'x-dimension of the grid at u location'
                           standard_name        = 'x_grid_index_at_u_location'
                           c_grid_axis_shift    = 0.5
                           axis                 = 'X'
                           c_grid_dynamic_range = '4:1087'
        nj_u       
               Size:       463x1
               Dimensions: nj_u
               Datatype:   single
               Attributes:
                           long_name            = 'y-dimension of the grid at u location'
                           standard_name        = 'y_grid_index_at_u_location'
                           axis                 = 'Y'
                           c_grid_axis_shift    = 0
                           c_grid_dynamic_range = '3:456'
        ni_v       
               Size:       1101x1
               Dimensions: ni_v
               Datatype:   single
               Attributes:
                           long_name            = 'x-dimension of the grid at v location'
                           standard_name        = 'x_grid_index_at_v_location'
                           c_grid_axis_shift    = 0
                           axis                 = 'X'
                           c_grid_dynamic_range = '4:1088'
        nj_v       
               Size:       463x1
               Dimensions: nj_v
               Datatype:   single
               Attributes:
                           long_name            = 'y-dimension of the grid at v location'
                           standard_name        = 'y_grid_index_at_v_location'
                           axis                 = 'Y'
                           c_grid_axis_shift    = 0.5
                           c_grid_dynamic_range = '2:455'
        ni_f       
               Size:       1101x1
               Dimensions: ni_f
               Datatype:   single
               Attributes:
                           long_name            = 'x-dimension of the grid at f location'
                           standard_name        = 'x_grid_index_at_f_location'
                           c_grid_axis_shift    = 0.5
                           axis                 = 'X'
                           c_grid_dynamic_range = '4:1087'
        nj_f       
               Size:       463x1
               Dimensions: nj_f
               Datatype:   single
               Attributes:
                           long_name            = 'y-dimension of the grid at f location'
                           standard_name        = 'y_grid_index_at_f_location'
                           axis                 = 'Y'
                           c_grid_axis_shift    = 0.5
                           c_grid_dynamic_range = '2:455'
        latitude   
               Size:       1101x463
               Dimensions: ni,nj
               Datatype:   double
               Attributes:
                           long_name     = 'latitude'
                           standard_name = 'latitude'
                           units         = 'degrees_north'
                           _FillValue    = 1.7e+38
                           valid_min     = -90
                           valid_max     = 90
        longitude  
               Size:       1101x463
               Dimensions: ni,nj
               Datatype:   double
               Attributes:
                           long_name     = 'longitude'
                           standard_name = 'longitude'
                           units         = 'degrees_east'
                           _FillValue    = 1.7e+38
                           valid_min     = -180
                           valid_max     = 180
        time       
               Size:       240x1
               Dimensions: time
               Datatype:   double
               Attributes:
                           long_name     = 'time in seconds (UT)'
                           standard_name = 'time'
                           units         = 'seconds since 1900-01-01T00:00:00Z'
                           axis          = 'T'
                           time_origin   = '01-JAN-1900 00:00:00'
                           conventions   = 'relative number of seconds with no decimal part'
        level      
               Size:       60x1
               Dimensions: level
               Datatype:   single
               Attributes:
                           long_name          = 'sigma level'
                           axis               = 'Z'
                           c_grid_axis_shift  = 0
                           positive           = 'up'
                           valid_min          = -1
                           valid_max          = 0
                           standard_name      = 'ocean_s_coordinate'
                           formula_terms      = 's: level eta: XE depth: H0 a: theta b: b depth_c: hc'
                           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)'
        longitude_u
               Size:       1101x463
               Dimensions: ni_u,nj_u
               Datatype:   int16
               Attributes:
                           long_name     = 'longitude at u location'
                           standard_name = 'longitude_at_u_location'
                           units         = 'degrees_east'
                           scale_factor  = 0.0002472
                           add_offset    = 8
                           valid_min     = -32767
                           valid_max     = 32767
                           _FillValue    = -32768
        longitude_v
               Size:       1101x463
               Dimensions: ni_v,nj_v
               Datatype:   int16
               Attributes:
                           long_name     = 'longitude at v location'
                           standard_name = 'longitude_at_v_location'
                           units         = 'degrees_east'
                           scale_factor  = 0.0002472
                           add_offset    = 8
                           valid_min     = -32767
                           valid_max     = 32767
                           _FillValue    = -32768
        latitude_u 
               Size:       1101x463
               Dimensions: ni_u,nj_u
               Datatype:   int16
               Attributes:
                           long_name     = 'latitude at u location'
                           standard_name = 'latitude_at_u_location'
                           units         = 'degrees_north'
                           scale_factor  = 7.9348e-05
                           add_offset    = 42
                           valid_min     = -32767
                           valid_max     = 32767
                           _FillValue    = -32768
        latitude_v 
               Size:       1101x463
               Dimensions: ni_v,nj_v
               Datatype:   int16
               Attributes:
                           long_name     = 'latitude at v location'
                           standard_name = 'latitude_at_v_location'
                           units         = 'degrees_north'
                           scale_factor  = 7.9348e-05
                           add_offset    = 42
                           valid_min     = -32767
                           valid_max     = 32767
                           _FillValue    = -32768
        SIG        
               Size:       60x1
               Dimensions: level
               Datatype:   single
               Attributes:
                           long_name     = 'sigma variable'
                           standard_name = 'ocean_s_variable'
                           units         = ''
                           valid_min     = -1
                           valid_max     = 0
                           _FillValue    = 999
        Csu_sig    
               Size:       60x1
               Dimensions: level
               Datatype:   single
               Attributes:
                           long_name          = 'C(s) law at mid layer'
                           standard_name      = 'ocean_s_coordinate_function_at_midlayer'
                           units              = ''
                           valid_min          = -2
                           valid_max          = 2
                           _FillValue         = 999
                           formula_definition = 'C(k) = (1-b)*sinh(a*s(k))/sinh(a) + b*[tanh(a*(s(k)+0.5))-tanh(0.5*a)]/(2*tanh(0.5*a))'
        hc         
               Size:       1101x463
               Dimensions: ni,nj
               Datatype:   int16
               Attributes:
                           long_name     = 'depth over which the resolution is increased'
                           standard_name = 'ocean_s_coordinate_thick_of_surface_resolution'
                           units         = 'm'
                           coordinates   = 'latitude longitude'
                           scale_factor  = 0.0079348
                           add_offset    = 240
                           valid_min     = -32767
                           valid_max     = 32767
                           _FillValue    = -32768
        b          
               Size:       1x1
               Dimensions: 
               Datatype:   single
               Attributes:
                           long_name     = 'bottom control parameter'
                           standard_name = 'ocean_s_coordinate_bottom_control'
                           units         = ''
                           valid_min     = 0
                           valid_max     = 1
                           _FillValue    = 999
        theta      
               Size:       1x1
               Dimensions: 
               Datatype:   single
               Attributes:
                           long_name     = 'surface control parameter'
                           standard_name = 'ocean_s_coordinate_surface_control'
                           units         = ''
                           valid_min     = 0
                           valid_max     = 20
                           _FillValue    = 999
        H0         
               Size:       1101x463
               Dimensions: ni,nj
               Datatype:   int16
               Attributes:
                           long_name     = 'bathymetry relative to the mean level'
                           standard_name = 'model_sea_floor_depth_below_geoid'
                           units         = 'm'
                           coordinates   = 'latitude longitude'
                           scale_factor  = 0.15336
                           add_offset    = 4975
                           valid_min     = -32767
                           valid_max     = 32767
                           _FillValue    = -32768
        HX         
               Size:       1101x463
               Dimensions: ni_u,nj_u
               Datatype:   int16
               Attributes:
                           long_name     = 'bathymetry at u-location relative to the mean level'
                           standard_name = 'model_sea_floor_depth_below_geoid_at_u_location'
                           units         = 'm'
                           coordinates   = 'latitude_u longitude_u'
                           scale_factor  = 0.15336
                           add_offset    = 4975
                           valid_min     = -32767
                           valid_max     = 32767
                           _FillValue    = -32768
        HY         
               Size:       1101x463
               Dimensions: ni_v,nj_v
               Datatype:   int16
               Attributes:
                           long_name     = 'bathymetry at v-location relative to the mean level'
                           standard_name = 'model_sea_floor_depth_below_geoid_at_v_location'
                           units         = 'm'
                           coordinates   = 'latitude_v longitude_v'
                           scale_factor  = 0.15336
                           add_offset    = 4975
                           valid_min     = -32767
                           valid_max     = 32767
                           _FillValue    = -32768
        XE         
               Size:       1101x463x240
               Dimensions: ni,nj,time
               Datatype:   int16
               Attributes:
                           long_name     = 'sea surface height'
                           standard_name = 'sea_surface_height_above_geoid'
                           units         = 'm'
                           coordinates   = 'latitude longitude'
                           scale_factor  = 0.0015259
                           add_offset    = 0
                           valid_min     = -32767
                           valid_max     = 32767
                           _FillValue    = -32768
        UZ         
               Size:       1101x463x60x240
               Dimensions: ni_u,nj_u,level,time
               Datatype:   int16
               Attributes:
                           long_name     = '3d zonal velocity'
                           standard_name = 'sea_water_x_velocity_at_u_location'
                           units         = 'm s-1'
                           coordinates   = 'latitude_u longitude_u'
                           scale_factor  = 0.00061037
                           add_offset    = 0
                           valid_min     = -32767
                           valid_max     = 32767
                           _FillValue    = -32768
        VZ         
               Size:       1101x463x60x240
               Dimensions: ni_v,nj_v,level,time
               Datatype:   int16
               Attributes:
                           long_name     = '3d meridional velocity'
                           standard_name = 'sea_water_y_velocity_at_v_location'
                           units         = 'm s-1'
                           coordinates   = 'latitude_v longitude_v'
                           scale_factor  = 0.00061037
                           add_offset    = 0
                           valid_min     = -32767
                           valid_max     = 32767
                           _FillValue    = -32768
        SAL        
               Size:       1101x463x60x240
               Dimensions: ni,nj,level,time
               Datatype:   int16
               Attributes:
                           long_name     = 'salinity'
                           standard_name = 'sea_water_salinity'
                           units         = '1e-3'
                           coordinates   = 'latitude longitude'
                           scale_factor  = 0.00083926
                           add_offset    = 22.5
                           valid_min     = -32767
                           valid_max     = 32767
                           _FillValue    = -32768
        TEMP       
               Size:       1101x463x60x240
               Dimensions: ni,nj,level,time
               Datatype:   int16
               Attributes:
                           long_name     = 'temperature'
                           standard_name = 'sea_water_potential_temperature'
                           units         = 'degrees_Celsius'
                           coordinates   = 'latitude longitude'
                           scale_factor  = 0.00083926
                           add_offset    = 22.5
                           valid_min     = -32767
                           valid_max     = 32767
                           _FillValue    = -32768
        TAUX       
               Size:       1101x463x240
               Dimensions: ni_u,nj_u,time
               Datatype:   int16
               Attributes:
                           long_name     = 'U-component of Surface Wind Stress'
                           standard_name = 'surface_downward_x_stress_at_u_location'
                           units         = 'N m-2'
                           coordinates   = 'latitude_u longitude_u'
                           scale_factor  = 0.0015259
                           add_offset    = 0
                           valid_min     = -32767
                           valid_max     = 32767
                           _FillValue    = -32768
        TAUY       
               Size:       1101x463x240
               Dimensions: ni_v,nj_v,time
               Datatype:   int16
               Attributes:
                           long_name     = 'V-component of Surface Wind Stress'
                           standard_name = 'surface_downward_y_stress_at_v_location'
                           units         = 'N m-2'
                           coordinates   = 'latitude_v longitude_v'
                           scale_factor  = 0.0015259
                           add_offset    = 0
                           valid_min     = -32767
                           valid_max     = 32767
                           _FillValue    = -32768

  2. #2
    Modérateur
    Avatar de le fab
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mars 2005
    Messages
    1 885
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2005
    Messages : 1 885
    Par défaut
    salut

    tu peux peut être regarder du coté des datastore

  3. #3
    Membre averti
    Femme Profil pro
    Scientifique
    Inscrit en
    Février 2017
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 36
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Scientifique

    Informations forums :
    Inscription : Février 2017
    Messages : 11
    Par défaut
    Citation Envoyé par le fab Voir le message
    salut

    tu peux peut être regarder du coté des datastore
    Bonjour et merci pour ce conseil,
    malheureusement j'ai regardé dans tous les types de datastore (https://fr.mathworks.com/help/matlab...datastore.html) et aucun ne fonctionne avec mon type de fichier netcdf.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    Error using xxxDatastore (line 137)
    Input folders or files contain non-standard file extensions.
     
    Use FileExtensions Name-Value pair to include the non-standard file extensions.
    Si quelqu'un sur le forum a déjà été amené à manipuler des gros fichiers netcdf type model_name: MARS, arakawa_grid_type: C1 (gros parce que de nombreuses variables, doubles latitudes/longitudes), je suis preneuse de conseils.

    Merci beaucoup !

  4. #4
    Modérateur
    Avatar de le fab
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mars 2005
    Messages
    1 885
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2005
    Messages : 1 885
    Par défaut
    et qu'a de particulier ce format ?

Discussions similaires

  1. Réponses: 0
    Dernier message: 13/05/2020, 12h07
  2. [XL-2003] Extraire des données d'un fichier source
    Par korni184 dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 14/07/2010, 10h37
  3. Extraire variables d'un fichier texte dans un tableau
    Par coincoin22 dans le forum Flash
    Réponses: 0
    Dernier message: 11/11/2008, 16h52
  4. Extraire d'un fichier.h des variables static ?
    Par Battosaiii dans le forum C
    Réponses: 1
    Dernier message: 14/03/2006, 15h43
  5. [Eclipe 2.1.1]Projet avec fichiers sources existants
    Par mfofana dans le forum Eclipse Java
    Réponses: 1
    Dernier message: 26/02/2004, 05h20

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo