combining netcdf data - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: combining netcdf data (/thread-31040.html) |
combining netcdf data - sebastiansieloff - Nov-19-2020 Hi all, I would like to combine netcdf files from the copernicus platform (climate data, i.e. NDVI and soil moisture). The files are provided in form of a grid of coordinates and respective measurements per set of coordinates in a single file for each time of measurement. I do not have any experience in coding, therefore I researched the solution below. That however leads to an extremely large filesize. I therefore would like to cut the data in one timeseries for a specific set of coordinates in the same step. I work on a win10 machine with the latest anaconda / python environment. Any input is greatly appreciated! 1. import netCDF4 import numpy import xarray 2. ds = xarray.open_mfdataset(‚filename.*.nc',combine = 'by_coords', concat_dim="time") 3. ds.to_netcdf('filename_combined.nc') Thank you! here is description I pulled from one of the files: <xarray.Dataset> Dimensions: (lat: 720, lon: 1440, time: 1) Coordinates: * lat (lat) float32 89.875 89.625 89.375 ... -89.375 -89.625 -89.875 * lon (lon) float32 -179.875 -179.625 -179.375 ... 179.625 179.875 * time (time) datetime64[ns] 2000-01-01 Data variables: nobs (time, lat, lon) float32 dask.array<shape=(1, 720, 1440), chunksize=(1, 720, 1440)> sensor (time, lat, lon) float32 dask.array<shape=(1, 720, 1440), chunksize=(1, 720, 1440)> freqbandID (time, lat, lon) float32 dask.array<shape=(1, 720, 1440), chunksize=(1, 720, 1440)> sm (time, lat, lon) float32 dask.array<shape=(1, 720, 1440), chunksize=(1, 720, 1440)> Attributes: title: C3S Surface Soil Moisture merged PASSIVE Product institution: EODC (AUT); TU Wien (AUT); VanderSat B.V. (NL) contact: [email protected] source: LPRMv05/SMMR/Nimbus 7 L3 Surface Soil Moistur... platform: Nimbus 7, DMSP, TRMM, AQUA, Coriolis, GCOM-W1... sensor: SMMR, SSM/I, TMI, AMSR-E, WindSat, AMSR2, MIRAS references: http://www.esa-soilmoisture-cci.org; Liu, Y.Y... product_version: v201912.0.0 Conventions: CF-1.6 standard_name_vocabulary: NetCDF Climate and Forecast (CF) Metadata Con... summary: The data set was produced with funding from t... keywords: Soil Moisture/Water Content naming_authority: EODC keywords_vocabulary: NASA Global Change Master Directory (GCMD) Sc... cdm_data_type: Grid comment: These data were produced as part of the Coper... creator_name: Earth Observation Data Center (EODC) creator_url: https://www.eodc.eu creator_email: [email protected] project: Copernicus Climate Change Service. license: Copernicus Data License time_coverage_resolution: P1D geospatial_lat_min: -90.0 geospatial_lat_max: 90.0 geospatial_lon_min: -180.0 geospatial_lon_max: 180.0 geospatial_vertical_min: 0.0 geospatial_vertical_max: 0.0 geospatial_lat_units: degrees_north geospatial_lon_units: degrees_east geospatial_lat_resolution: 0.25 degree geospatial_lon_resolution: 0.25 degree spatial_resolution: 25km time_coverage_start: 1999-12-31T12:00:00Z time_coverage_end: 2000-01-31T12:00:00Z time_coverage_duration: P1M id: C3S-SOILMOISTURE-L3S-SSMV-PASSIVE-MONTHLY-200... tracking_id: 504295ec-67ef-4c6e-a2ba-5f5ed376cad2 date_created: 2020-05-15T07:18:11Z history: 2020-05-15T07:18:11.833569 mean calculated RE: combining netcdf data - Larz60+ - Nov-19-2020 My suggestion would be to post under jobs and offer compensation. |