循环遍历多个 netcdf 中的单个变量并计算 R

问题描述

我对使用 NetCDF 文件和包的新手了解 R 脚本。我有多个 TROPOMI CH4 NetCDF 每日文件,我正在尝试计算所有 NetCDF 每日文件中名为 methane_mixing_ratio 的变量的平均值并计算月平均值。尺寸为 215 X 3245 X 1 意味着只是单日数据。以下是我打开的单个 netcdf 文件的详细信息:

 87 variables (excluding dimension variables):
    int PRODUCT/delta_time[PRODUCT/scanline,PRODUCT/time]   (Chunking: [3245,1])  (Compression: shuffle,level 3)
        long_name: offset of start time of measurement relative to time_reference
        units: milliseconds since 2019-05-31 00:00:00
        _FillValue: -2147483647
    string PRODUCT/time_utc[PRODUCT/scanline,level 3)
        long_name: Time of observation as ISO 8601 date-time string
        _FillValue: 
    unsigned byte PRODUCT/qa_value[PRODUCT/ground_pixel,PRODUCT/scanline,PRODUCT/time]   (Chunking: [215,3245,level 3)
        units: 1
        scale_factor: 0.00999999977648258
        add_offset: 0
        valid_min_: 0
        valid_max_: 100
        long_name: data quality value
        comment: A continuous quality descriptor,varying between 0 (no data) and 1 (full quality data). Recommend to ignore data with qa_value < 0.5
        coordinates: longitude latitude
        _FillValue: 255
    float PRODUCT/latitude[PRODUCT/ground_pixel,level 3)
        long_name: pixel center latitude
        units: degrees_north
        standard_name: latitude
        valid_min: -90
        valid_max: 90
        bounds: /PRODUCT/SUPPORT_DATA/GEOLOCATIONS/latitude_bounds
        _FillValue: 9.96920996838687e+36
    float PRODUCT/longitude[PRODUCT/ground_pixel,level 3)
        long_name: pixel center longitude
        units: degrees_east
        standard_name: longitude
        valid_min: -180
        valid_max: 180
        bounds: /PRODUCT/SUPPORT_DATA/GEOLOCATIONS/longitude_bounds
        _FillValue: 9.96920996838687e+36
    float PRODUCT/methane_mixing_ratio[PRODUCT/ground_pixel,level 3)
        units: 1e-9
        standard_name: dry_atmosphere_mole_fraction_of_methane
        long_name: column averaged dry air mixing ratio of methane
        coordinates: longitude latitude
        ancillary_variables: methane_mixing_ratio_precision column_averaging_kernel chi_square degreess_of_freedom
        _FillValue: 9.96920996838687e+36
    float PRODUCT/methane_mixing_ratio_precision[PRODUCT/ground_pixel,level 3)
        units: 1e-9
        standard_name: dry_atmosphere_mole_fraction_of_methane standard_error
        long_name: precision of the column averaged dry air mixing ratio of methane
        coordinates: longitude latitude
        _FillValue: 9.96920996838687e+36
    float 

 9 dimensions:
    PRODUCT/scanline  Size:3245
        units: 1
        axis: Y
        long_name: along-track dimension index
        comment: This coordinate variable defines the indices along track; index starts at 0
        _FillValue: -2147483647
    PRODUCT/ground_pixel  Size:215
        units: 1
        axis: X
        long_name: across-track dimension index
        comment: This coordinate variable defines the indices across track,from west to east; index starts at 0
        _FillValue: -2147483647
    PRODUCT/corner  Size:4
        units: 1
        long_name: pixel corner index
        comment: This coordinate variable defines the indices for the pixel corners; index starts at 0 (counter-clockwise,starting from south-western corner of the pixel in ascending part of the orbit)
        _FillValue: -2147483647
    PRODUCT/time  Size:1
        units: seconds since 2010-01-01 00:00:00
        standard_name: time
        axis: T
        long_name: reference time for the measurements
        comment: The time in this variable corresponds to the time in the time_reference global attribute
        _FillValue: -2147483647
    PRODUCT/layer  Size:12
        axis: Z
        positive: down
        _FillValue: -2147483647
    PRODUCT/level  Size:13
        axis: Z
        positive: down
        _FillValue: -2147483647

53 global attributes:
 
    project: Sentinel 5 precursor/TROPOMI
    geospatial_lat_min: -78.6209411621094
    geospatial_lat_max: 89.9237365722656
    geospatial_lon_min: 179.999557495117
    geospatial_lon_max: -179.999969482422
    license: No conditions apply
    platform: S5P
    sensor: TROPOMI
    spatial_resolution: 7x7km2

我尝试了几种使用 cbind、lapply 的解决方案,但它总是显示行或列被视为平均值而不是一起here is an example I used this code and only rows show to be binded together since there were 5 files I used for testing so 215 X 5 = 1075 and columns show the same number which was 3245 and not 3245 X 5 = 16225

数据可以通过这个链接下载https://s5phub.copernicus.eu/dhus/#/home

先谢谢你。任何帮助将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...