I try to make my downscaling software (PyClim-SDM) work. However netCDF downscaling errored, which causes the software cannot run. How to solve it?
Traceback (most recent call last):
File "/home/node04/Desktop/pyClim-SDM-master/src/.tmp_main.py", line 18, in <module>
main()
File "/home/node04/Desktop/pyClim-SDM-master/src/.tmp_main.py", line 9, in main
preprocess.preprocess()
File "/home/node04/Desktop/pyClim-SDM-master/src/../lib/preprocess.py", line 43, in preprocess
common()
File "/home/node04/Desktop/pyClim-SDM-master/src/../lib/preprocess.py", line 68, in common
standardization.get_mean_and_std_reanalysis(targetVar, fields_and_grid)
File "/home/node04/Desktop/pyClim-SDM-master/src/../lib/standardization.py", line 67, in get_mean_and_std_reanalysis
data = read.lres_data(targetVar, field=field, grid=grid)['data']
File "/home/node04/Desktop/pyClim-SDM-master/src/../lib/read.py", line 358, in lres_data
data[i] = one_direct_predictor('pr', level=None, grid='ext', model=model, scene=scene)['data'][idates];
ValueError: could not broadcast input array from shape (12784,21,0) into shape (12784,21,43)
>>> import netCDF4 as nc
>>> fn = 'pr_ACCESS-CM2_historical_r1i1p1f1_19500101-20141231.nc'
>>> ds = nc.Dataset(fn)
>>> print(ds)
<class 'netCDF4._netCDF4.Dataset'>
root group (NETCDF4 data model, file format HDF5):
CDI: Climate Data Interface version 2.2.3 (https://mpimet.mpg.de/cdi)
Conventions: CF-1.7 CMIP-6.2
source: ACCESS-CM2 (2019):
aerosol: UKCA-GLOMAP-mode
atmos: MetUM-HadGEM3-GA7.1 (N96; 192 x 144 longitude/latitude; 85 levels; top level 85 km)
atmosChem: none
land: CABLE2.5
landIce: none
ocean: ACCESS-OM2 (GFDL-MOM5, tripolar primarily 1deg; 360 x 300 longitude/latitude; 50 levels; top grid cell 0-10 m)
ocnBgchem: none
seaIce: CICE5.1.2 (same grid as ocean)
institution: CSIRO (Commonwealth Scientific and Industrial Research Organisation, Aspendale, Victoria 3195, Australia), ARCCSS (Australian Research Council Centre of Excellence for Climate System Science)
activity_id: CMIP
branch_method: standard
branch_time_in_child: 0.0
branch_time_in_parent: 0.0
creation_date: 2019-11-09T02:20:30Z
data_specs_version: 01.00.30
experiment: all-forcing simulation of the recent past
experiment_id: historical
external_variables: areacella
forcing_index: 1
frequency: day
further_info_url: https://furtherinfo.es-doc.org/CMIP6.CSIRO-ARCCSS.ACCESS-CM2.historical.none.r1i1p1f1
grid: native atmosphere N96 grid (144x192 latxlon)
grid_label: gn
history: Thu Jun 13 10:26:34 2024: cdo remapbil,docu01.txt input.nc output.nc
2019-11-09T02:20:30Z ; CMOR rewrote data to be consistent with CMIP6, CF-1.7 CMIP-6.2 and CF standards.
initialization_index: 1
institution_id: CSIRO-ARCCSS
mip_era: CMIP6
nominal_resolution: 250 km
notes: Exp: CM2-historical; Local ID: bj594; Variable: pr (['fld_s05i216'])
parent_activity_id: CMIP
parent_experiment_id: piControl
parent_mip_era: CMIP6
parent_source_id: ACCESS-CM2
parent_time_units: days since 0950-01-01
parent_variant_label: r1i1p1f1
physics_index: 1
product: model-output
realization_index: 1
realm: atmos
run_variant: forcing: GHG, Oz, SA, Sl, Vl, BC, OC, (GHG = CO2, N2O, CH4, CFC11, CFC12, CFC113, HCFC22, HFC125, HFC134a)
source_id: ACCESS-CM2
source_type: AOGCM
sub_experiment: none
sub_experiment_id: none
table_id: day
table_info: Creation Date:(30 April 2019) MD5:e14f55f257cceafb2523e41244962371
title: ACCESS-CM2 output prepared for CMIP6
variable_id: pr
variant_label: r1i1p1f1
version: v20191108
cmor_version: 3.4.0
tracking_id: hdl:21.14100/27a2a033-bc7e-45ff-8c30-02bf65722aaf
license: CMIP6 model data produced by CSIRO is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License (https://creativecommons.org/licenses/). Consult https://pcmdi.llnl.gov/CMIP6/TermsOfUse for terms of use governing CMIP6 output, including citation requirements and proper acknowledgment. Further information about this data, including some limitations, can be found via the further_info_url (recorded as a global attribute in this file). The data producers and data providers make no warranty, either express or implied, including, but not limited to, warranties of merchantability and fitness for a particular purpose. All liabilities arising from the supply of the information (including any liability arising in negligence) are excluded to the fullest extent permitted by law.
CDO: Climate Data Operators version 2.2.1 (https://mpimet.mpg.de/cdo)
dimensions(sizes): time(23741), bnds(2), lon(60), lat(35)
variables(dimensions): float64 time(time), float64 time_bnds(time, bnds), float64 lon(lon), float64 lat(lat), float32 pr(time, lat, lon)
groups:
>>> fn = '/home/node04/Desktop/pyClim-SDM-master/input_data/reanalysis/tp_ERA5_19800101-20141231.nc'
>>> ds = nc.Dataset(fn)
>>> print(ds)
<class 'netCDF4._netCDF4.Dataset'>
root group (NETCDF4 data model, file format HDF5):
CDI: Climate Data Interface version 2.2.3 (https://mpimet.mpg.de/cdi)
Conventions: CF-1.6
history: Sun Jul 07 23:54:05 2024: cdo daysum mertp1980.nc tpsum1980.nc
2024-07-04 09:20:45 GMT by grib_to_netcdf-2.28.1: /opt/ecmwf/mars-client/bin/grib_to_netcdf -S param -o /cache/data4/adaptor.mars.internal-1720084818.869458-19807-1-8b2b23f7-84df-464d-ba58-373bf65a694e.nc /cache/tmp/8b2b23f7-84df-464d-ba58-373bf65a694e-adaptor.mars.internal-1720084168.613236-19807-1-tmp.grib
frequency: day
CDO: Climate Data Operators version 2.2.1 (https://mpimet.mpg.de/cdo)
dimensions(sizes): time(12784), bnds(2), longitude(63), latitude(39)
variables(dimensions): int32 time(time), int64 time_bnds(time, bnds), float32 longitude(longitude), float32 latitude(latitude), float32 tp(time, latitude, longitude)
I try to make the two netCDF documents have the same grid resolution and matched spatial range to make the software (PyClim-SDM) can run smoothly. Hope to find a solution to make these two .nc documents have the same shape, (12784,21,0) or (12784,21,43).
Won Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.