OGGM / oggm

Open Global Glacier Model
http://oggm.org
BSD 3-Clause "New" or "Revised" License
212 stars 102 forks source link

about: ValueError: cannot reshape array of size 1 into shape (13872,) #675

Open HoloceneCESI opened 5 years ago

HoloceneCESI commented 5 years ago

Dear Sir,

When I input the command 'python gcm_run.py cesm -e',there are some errors as shown in the attachment. 1

anoukvlug commented 5 years ago

I am not sure what causes the error, but I can try to help you.

To start there is a typo in: execute_entity_task(tasks.process_gcm_data, ......)

scalendar

should be

calendar

Could you correct the typo and check if the error stays the same?

HoloceneCESI commented 5 years ago

I am not sure what causes the error, but I can try to help you.

To start there is a typo in: execute_entity_task(tasks.process_gcm_data, ......)

scalendar

should be

calendar

Could you correct the typo and check if the error stays the same?

I am not sure what causes the error, but I can try to help you.

To start there is a typo in: execute_entity_task(tasks.process_gcm_data, ......)

scalendar

should be

calendar

Could you correct the typo and check if the error stays the same?

capture

HoloceneCESI commented 5 years ago

I am not sure what causes the error, but I can try to help you. To start there is a typo in: execute_entity_task(tasks.process_gcm_data, ......)

scalendar

should be

calendar

Could you correct the typo and check if the error stays the same?

I am not sure what causes the error, but I can try to help you. To start there is a typo in: execute_entity_task(tasks.process_gcm_data, ......)

scalendar

should be

calendar

Could you correct the typo and check if the error stays the same?

capture

Thank you,but this is not the point.....

fmaussion commented 5 years ago

Hi, a short checklist:

  1. Do you have the latest version of OGGM installed?
  2. Why are you using RGI Version 5? The default should be 61
  3. Can you show us the code that produces this error?
  4. Also, it would be much nicer to copy-paste the error log instead of an image.
HoloceneCESI commented 5 years ago

Hi, a short checklist:

  1. Do you have the latest version of OGGM installed?
  2. Why are you using RGI Version 5? The default should be 61
  3. Can you show us the code that produces this error?
  4. Also, it would be much nicer to copy-paste the error log instead of an image.

Hello, I am a PhD student in UCL, supervised bu Hugues Goosse who have been used the OGGM to model the Alpine Glaciers. Since we use the OGGM in our cluster, we can not update the OGGM except the manager. the code is:

#!/usr/bin/python
# 
# Author: PY. Barriat
# Date  : January 2018

# Python imports
from os import path
import shutil
import zipfile
import oggm
import pathlib
import argparse

# Module logger
import logging
log = logging.getLogger(__name__)

# Libs
import salem

# Locals
import oggm.cfg as cfg
from oggm import tasks, utils, workflow
from oggm.workflow import execute_entity_task

# For timing the run
import time

#############################

def run_from_climate(gdirs, filesuffix, gcm, equilibre, spinup):

  # Process GCM data
  if gcm == 'cesm':
    execute_entity_task(tasks.process_gcm_data, gdirs, filesuffix=filesuffix, scalendar='365_day')
  elif gcm == 'bcc-csm':
    execute_entity_task(tasks.process_gcm_data, gdirs, filesuffix=filesuffix, scalendar='365_day') 
  elif gcm == 'giss':
    execute_entity_task(tasks.process_gcm_data, gdirs, filesuffix=filesuffix, scalendar='365_day')
  elif gcm == 'ipsl':
    execute_entity_task(tasks.process_gcm_data, gdirs, filesuffix=filesuffix, scalendar='360_day')
  elif gcm == 'mpi':
    execute_entity_task(tasks.process_gcm_data, gdirs, filesuffix=filesuffix, scalendar='proleptic_gregorian')
  else:
    log.info('OGGM: problem in run_from_climate')
    return
  tasks.distribute_t_stars(gdirs)
  execute_entity_task(tasks.apparent_mb, gdirs)

  # Inversion tasks
  # fl.flux
  execute_entity_task(tasks.prepare_for_inversion, gdirs)
  # We use the default parameters for this run
  execute_entity_task(tasks.volume_inversion, gdirs, glen_a=cfg.A, fs=0)
  execute_entity_task(tasks.filter_inversion_output, gdirs)

  # Final preparation for the run
  execute_entity_task(tasks.init_present_time_glacier, gdirs)

  # Run the historical glacier evolution with GCM data
  if equilibre:
    efilesuffix = filesuffix + '_eqm'
    execute_entity_task(tasks.run_constant_climate, gdirs, climate_filename='cesm_data', climate_input_filesuffix=filesuffix,
        output_filesuffix=efilesuffix)
    ofilesuffix = filesuffix + '_with_eqm'
    execute_entity_task(tasks.run_from_climate_data, gdirs, climate_filename='cesm_data', climate_input_filesuffix=filesuffix,
        init_model_filesuffix=efilesuffix, output_filesuffix=ofilesuffix)
    filesuffix = ofilesuffix
    #execute_entity_task(tasks.run_from_gcm_eqm, gdirs, filename='cesm_data', input_filesuffix=filesuffix, filesuffix=filesuffix)
    #filesuffix = filesuffix + '_eqm'
  elif spinup:
    sfilesuffix = '_spinup'
    execute_entity_task(tasks.run_constant_climate, gdirs,nyears=300, bias=0, temperature_bias=-0.5, output_filesuffix=sfilesuffix)
    ofilesuffix = filesuffix + '_with_spinup'
    execute_entity_task(tasks.run_from_climate_data, gdirs, climate_filename='cesm_data', climate_input_filesuffix=filesuffix, 
        init_model_filesuffix=sfilesuffix, output_filesuffix=ofilesuffix)
    filesuffix = ofilesuffix
  else:
    execute_entity_task(tasks.run_from_climate_data, gdirs, climate_filename='cesm_data', climate_input_filesuffix=filesuffix, 
        output_filesuffix=filesuffix)

  # Compile output
  log.info('Compiling output')
  utils.glacier_characteristics(gdirs)
  utils.compile_run_output(gdirs, filesuffix=filesuffix)
  if equilibre:
    utils.compile_run_output(gdirs, filesuffix=efilesuffix)
  #elif spinup:
  #  utils.compile_run_output(gdirs, filesuffix=sfilesuffix)

start = time.time()
cfg.initialize()

# Initialize OGGM and set up the run parameters

parser = argparse.ArgumentParser(description='Initialize OGGM and set up the run parameters')
parser.add_argument('gcmval', action='store', help ="Set the input model: cesm, bcc-csm, giss, ipsl, mpi")
group = parser.add_mutually_exclusive_group()
group.add_argument('-e', '--equil', action='store_true', dest='eqmval',  help ="Start from an equilibrium", default=False)
group.add_argument('-s', '--spinup', action='store_true', dest='spinval',  help ="Start a past climate run based on a spinup", default=False)
results = parser.parse_args()

# Set the input model: cesm, bcc-csm, giss, ipsl, mpi 
GCM = format(results.gcmval)

# Set EQM True if you need to start from an equilibrium
EQM = results.eqmval

# Run a past climate run based on this spinup
SPIN = results.spinval

#############################

# Ensemble
# In the folder 'fens', you must have 'iens' temp_file, precc_file, precl_file
# Respect the naming rule: same name with '_001', '_002', ... 'iens' suffix (before '.nc')
ENS = False
iens = 3 # max 999
fens = 'ensemble/'

# Filesuffix of the shapefile to use
shpfilesuffix = '_forni'
shpfilesuffix = '_leclercq'
shpfilesuffix = '_5alps'
shpfilesuffix = '_argentiere'
#shpfilesuffix = '_5alps'
#Filesuffix for the output of the run
filesuffix = '_forni_eqm'
filesuffix = '_leclercq'
filesuffix = '_5alps'
filesuffix = '_argentiere'
#filesuffix = '_5alps'

cfg.PATHS['working_dir'] = '/afast/pbarriat/oggm_wkdir/'

# Use multiprocessing?
cfg.PARAMS['use_multiprocessing'] = True
cfg.PARAMS['optimize_inversion_params'] = True

# Here we override some of the default parameters
# How many grid points around the glacier?
# Make it large if you expect your glaciers to grow large
cfg.PARAMS['border'] = 100

# Set to True for operational runs
cfg.PARAMS['continue_on_error'] = False
cfg.PARAMS['ys'] = 851
cfg.PARAMS['ye'] = 2005

#############################

# Info
print("MODEL: %s" % GCM)
print("FROM EQUILIBRIUM: %s" % EQM)
print("FROM SPINUP: %s" % SPIN)
print("ENSEMBLE: %s" % ENS)
if ENS:
  print("MEMBERS: %f" % iens)

# Check path
cfg.PATHS['working_dir'] = path.join(cfg.PATHS['working_dir'], GCM)
pathlib.Path(cfg.PATHS['working_dir']).mkdir(parents=True, exist_ok=True)
rgi_selections = cfg.PATHS['rgi_dir'] + '/selections/'

# Don't use divides for now
#PEDRO#cfg.set_divides_db()

# But we use intersects
# (this is slow, it could be replaced with a subset of the global file)
rgi_dir = utils.get_rgi_intersects_dir()
cfg.set_intersects_db(path.join(rgi_dir, '00_rgi50_AllRegs', 'intersects_rgi50_AllRegs.shp'))

# Pre-download other files which will be needed later
utils.get_cru_file(var='tmp')
utils.get_cru_file(var='pre')

# Precalibrated t* values are already downloaded and stored in OGGM/wkdir/ref_tstars.csv
# They are used to interpolate the t* for other glaciers

# Read the RGI datafile
rgidf = salem.read_shapefile(path.join(rgi_selections, 'rgi_selection%s.shp' % shpfilesuffix))

# Sort for more efficient parallel computing
rgidf = rgidf.sort_values('Area', ascending=False)

log.info('Starting OGGM run')
log.info('Number of glaciers: {}'.format(len(rgidf)))

# Go - initialize working directories
gdirs = workflow.init_glacier_regions(rgidf)

# Preprocessing tasks
task_list = [
    tasks.glacier_masks,
    tasks.compute_centerlines,
    tasks.initialize_flowlines,
    tasks.compute_downstream_line,
    tasks.compute_downstream_bedshape,
    tasks.catchment_area,
    tasks.catchment_intersections,
    tasks.catchment_width_geom,
    tasks.catchment_width_correction,
    ]
for task in task_list:
  execute_entity_task(task, gdirs)

# Climate tasks -- processing of cru and cesm data, t* interpolation
execute_entity_task(tasks.process_cru_data, gdirs) # CRU data is needed for run_from_gcm

# Check CESM inputs files
cesm_files_list = [ 
    'TREFHT_Amon_CCSM4_LM_r1i1p1_085001-200512.nc',
    'PREC_Amon_CCSM4_LM_r1i1p1_085001-200512.nc',
    ]   
# Check BCC-CSM inputs files
bcccsm_files_list = [
    'TREFHT_Amon_bcc-csm1-1_LM_r1i1p1_085001-200512.nc',
    'PREC_Amon_bcc-csm1-1_LM_r1i1p1_085001-200512.nc',
    ]
# Check GISS inputs files
giss_files_list = [
    'TREFHT_Amon_GISS-E2-R_LM_r1i1p121_085001-200512.nc',
    'PREC_Amon_GISS-E2-R_LM_r1i1p121_085001-200512.nc',
    ]
# Check MPI inputs files
mpi_files_list = [
    'TREFHT_Amon_MPI-ESM-P_LM_r1i1p1_085001-200512.nc',
    'PREC_Amon_MPI-ESM-P_LM_r1i1p1_085001-200512.nc',
    ]
# Check IPSL inputs files
ipsl_files_list = [ 
    'TREFHT_Amon_IPSL-CM5A-LR_LM_r1i1p1_085001-200512.nc',
    'PREC_Amon_IPSL-CM5A-LR_LM_r1i1p1_085001-200512.nc',
    ]

# Select the list
if GCM == 'cesm':
  gcm_files_list = cesm_files_list
elif GCM == 'bcc-csm':
  gcm_files_list = bcccsm_files_list 
elif GCM == 'giss':
  gcm_files_list = giss_files_list
elif GCM == 'ipsl':
  gcm_files_list = ipsl_files_list
elif GCM == 'mpi':
  gcm_files_list = mpi_files_list
else:
  log.info('OGGM: problem in list selection')
  gcm_files_list = cesm_files_list

# Check GCM inputs files
gcm_dir = cfg.PATHS['rgi_dir'] + '/../mod/' + GCM + '/'
pathlib.Path(gcm_dir).mkdir(parents=True, exist_ok=True) 
if ENS:
  gcm_files_list = [
      'TREFHT.085001-200512',
      'PRECP.085001-200512',
      ]
  gcm_dir = gcm_dir + fens
  wkdir = cfg.PATHS['working_dir']
  for e in range(1, (iens+1)):
    print("Member is %d / %d" % (e, iens))
    if e < 10:
      mbmsuf = "00" + str(e)
    elif e < 100:
      mbmsuf = "0" + str(e)
    else:
      mbmsuf = str(e)
    cfg.PATHS['gcm_temp_file'] = path.join(gcm_dir, gcm_files_list[0] + '_' + mbmsuf + '.nc')
    print("Temp file is %s" % (cfg.PATHS['gcm_temp_file']))
    cfg.PATHS['gcm_precp_file'] = path.join(gcm_dir, gcm_files_list[1] + '_' + mbmsuf + '.nc')
    outdir = wkdir + '/' + fens + mbmsuf
    pathlib.Path(outdir).mkdir(parents=True, exist_ok=True)
    print("Output dir is %s" % (outdir))
    cfg.PATHS['working_dir'] = outdir
    #
    run_from_climate(gdirs, filesuffix, GCM, EQM, SPIN)
else:
  # Check forcings inputs files
  for gcm_file in gcm_files_list:
    test_file = path.join(gcm_dir, gcm_file)
    print("Check %s" % (test_file))
    if not path.exists(test_file):
      #url = 'https://nextcloud.cism.ucl.ac.be/s/1rB3hFWp3d2kq10/download?path=%2F' + GCM + '&files='
      url = 'http://www.climate.be/oggm/mod/' + GCM + '/'
      dfile = url + gcm_file
      print("Downloading %s" % (gcm_file))
      ofile = utils.file_downloader(dfile,reset=True)
      shutil.copyfile(ofile, test_file)
  cfg.PATHS['gcm_temp_file'] = path.join(gcm_dir, gcm_files_list[0])
  cfg.PATHS['gcm_precp_file'] = path.join(gcm_dir, gcm_files_list[1])
  #
  run_from_climate(gdirs, filesuffix, GCM, EQM, SPIN) 

# Log
m, s = divmod(time.time() - start, 60)
h, m = divmod(m, 60)
log.info("OGGM is done! Time needed: %d:%02d:%02d" % (h, m, s))

the error :: MODEL: cesm FROM EQUILIBRIUM: False FROM SPINUP: True ENSEMBLE: False 2019-01-21 21:59:55: main: Starting OGGM run 2019-01-21 21:59:55: main: Number of glaciers: 9 2019-01-21 21:59:55: oggm.workflow: Multiprocessing: using all available processors (N=36) 2019-01-21 21:59:55: oggm.core.gis: (RGI50-17.01332) glacier_masks 2019-01-21 21:59:55: oggm.core.gis: (RGI50-17.01797) glacier_masks 2019-01-21 21:59:55: oggm.core.gis: (RGI50-17.01333) glacier_masks 2019-01-21 21:59:55: oggm.core.gis: (RGI50-17.01556) glacier_masks 2019-01-21 21:59:55: oggm.core.gis: (RGI50-17.01303) glacier_masks 2019-01-21 21:59:55: oggm.core.gis: (RGI50-17.01488) glacier_masks 2019-01-21 21:59:55: oggm.core.gis: (RGI50-17.01508) glacier_masks 2019-01-21 21:59:55: oggm.core.gis: (RGI50-17.01319) glacier_masks 2019-01-21 21:59:55: oggm.core.gis: (RGI50-17.01302) glacier_masks 2019-01-21 21:59:56: oggm.core.gis: RGI50-17.01303: DEM needed interpolation. 2019-01-21 21:59:56: oggm.core.centerlines: (RGI50-17.01332) compute_centerlines 2019-01-21 21:59:56: oggm.core.centerlines: (RGI50-17.01303) compute_centerlines 2019-01-21 21:59:56: oggm.core.centerlines: (RGI50-17.01319) compute_centerlines 2019-01-21 21:59:56: oggm.core.centerlines: (RGI50-17.01556) compute_centerlines 2019-01-21 21:59:56: oggm.core.centerlines: (RGI50-17.01797) compute_centerlines 2019-01-21 21:59:56: oggm.core.centerlines: (RGI50-17.01333) compute_centerlines 2019-01-21 21:59:56: oggm.core.centerlines: (RGI50-17.01508) compute_centerlines 2019-01-21 21:59:56: oggm.core.centerlines: (RGI50-17.01488) compute_centerlines 2019-01-21 21:59:56: oggm.core.centerlines: (RGI50-17.01302) compute_centerlines 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01303) initialize_flowlines 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01332) initialize_flowlines 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01556) initialize_flowlines 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01333) initialize_flowlines 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01319) initialize_flowlines 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01797) initialize_flowlines 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01508) initialize_flowlines 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01488) initialize_flowlines 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01302) initialize_flowlines 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01303) compute_downstream_line 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01332) compute_downstream_line 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01319) compute_downstream_line 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01333) compute_downstream_line 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01797) compute_downstream_line 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01556) compute_downstream_line 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01508) compute_downstream_line 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01488) compute_downstream_line 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01302) compute_downstream_line 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01332) compute_downstream_bedshape 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01303) compute_downstream_bedshape 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01797) compute_downstream_bedshape 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01556) compute_downstream_bedshape 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01319) compute_downstream_bedshape 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01333) compute_downstream_bedshape 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01488) compute_downstream_bedshape 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01508) compute_downstream_bedshape 2019-01-21 21:59:57: oggm.core.centerlines: (RGI50-17.01302) compute_downstream_bedshape 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01797) catchment_area 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01303) catchment_area 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01332) catchment_area 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01333) catchment_area 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01319) catchment_area 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01556) catchment_area 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01508) catchment_area 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01488) catchment_area 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01302) catchment_area 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01797) catchment_intersections 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01332) catchment_intersections 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01303) catchment_intersections 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01319) catchment_intersections 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01333) catchment_intersections 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01556) catchment_intersections 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01488) catchment_intersections 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01508) catchment_intersections 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01302) catchment_intersections 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01797) catchment_width_geom 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01332) catchment_width_geom 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01303) catchment_width_geom 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01333) catchment_width_geom 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01556) catchment_width_geom 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01319) catchment_width_geom 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01488) catchment_width_geom 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01508) catchment_width_geom 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01302) catchment_width_geom 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01797) catchment_width_correction 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01332) catchment_width_correction 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01303) catchment_width_correction 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01333) catchment_width_correction 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01319) catchment_width_correction 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01556) catchment_width_correction 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01488) catchment_width_correction 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01508) catchment_width_correction 2019-01-21 21:59:58: oggm.core.centerlines: (RGI50-17.01302) catchment_width_correction 2019-01-21 21:59:58: oggm.core.climate: (RGI50-17.01797) process_cru_data 2019-01-21 21:59:58: oggm.core.climate: (RGI50-17.01332) process_cru_data 2019-01-21 21:59:58: oggm.core.climate: (RGI50-17.01303) process_cru_data 2019-01-21 21:59:58: oggm.core.climate: (RGI50-17.01333) process_cru_data 2019-01-21 21:59:58: oggm.core.climate: (RGI50-17.01319) process_cru_data 2019-01-21 21:59:58: oggm.core.climate: (RGI50-17.01556) process_cru_data 2019-01-21 21:59:58: oggm.core.climate: (RGI50-17.01508) process_cru_data 2019-01-21 21:59:58: oggm.core.climate: (RGI50-17.01488) process_cru_data 2019-01-21 21:59:58: oggm.core.climate: (RGI50-17.01302) process_cru_data /opt/software/Python/3.6.3-foss-2017b/lib/python3.6/site-packages/xarray/core/nanops.py:161: RuntimeWarning: Mean of empty slice return np.nanmean(a, axis=axis, dtype=dtype) /opt/software/Python/3.6.3-foss-2017b/lib/python3.6/site-packages/xarray/core/nanops.py:161: RuntimeWarning: Mean of empty slice return np.nanmean(a, axis=axis, dtype=dtype) /opt/software/Python/3.6.3-foss-2017b/lib/python3.6/site-packages/xarray/core/nanops.py:161: RuntimeWarning: Mean of empty slice return np.nanmean(a, axis=axis, dtype=dtype) /opt/software/Python/3.6.3-foss-2017b/lib/python3.6/site-packages/xarray/core/nanops.py:161: RuntimeWarning: Mean of empty slice return np.nanmean(a, axis=axis, dtype=dtype) /opt/software/Python/3.6.3-foss-2017b/lib/python3.6/site-packages/xarray/core/nanops.py:161: RuntimeWarning: Mean of empty slice return np.nanmean(a, axis=axis, dtype=dtype) /opt/software/Python/3.6.3-foss-2017b/lib/python3.6/site-packages/xarray/core/nanops.py:161: RuntimeWarning: Mean of empty slice return np.nanmean(a, axis=axis, dtype=dtype) /opt/software/Python/3.6.3-foss-2017b/lib/python3.6/site-packages/xarray/core/nanops.py:161: RuntimeWarning: Mean of empty slice return np.nanmean(a, axis=axis, dtype=dtype) /opt/software/Python/3.6.3-foss-2017b/lib/python3.6/site-packages/xarray/core/nanops.py:161: RuntimeWarning: Mean of empty slice return np.nanmean(a, axis=axis, dtype=dtype) /opt/software/Python/3.6.3-foss-2017b/lib/python3.6/site-packages/xarray/core/nanops.py:161: RuntimeWarning: Mean of empty slice return np.nanmean(a, axis=axis, dtype=dtype) /opt/software/Python/3.6.3-foss-2017b/lib/python3.6/site-packages/xarray/core/nanops.py:161: RuntimeWarning: Mean of empty slice return np.nanmean(a, axis=axis, dtype=dtype) Check /afast/zlyu/oggm_data/rgi/../mod/cesm/TREFHT_Amon_CCSM4_LM_r1i1p1_085001-200512.nc Check /afast/zlyu/oggm_data/rgi/../mod/cesm/PREC_Amon_CCSM4_LM_r1i1p1_085001-200512.nc 2019-01-21 21:59:59: oggm.workflow: Multiprocessing: using all available processors (N=36) 2019-01-21 21:59:59: oggm.core.climate: (RGI50-17.01797) process_gcm_dataSouthnAndes 2019-01-21 21:59:59: oggm.core.climate: (RGI50-17.01332) process_gcm_dataSouthnAndes 2019-01-21 21:59:59: oggm.core.climate: (RGI50-17.01556) process_gcm_dataSouthnAndes 2019-01-21 21:59:59: oggm.core.climate: (RGI50-17.01303) process_gcm_dataSouthnAndes 2019-01-21 21:59:59: oggm.core.climate: (RGI50-17.01508) process_gcm_dataSouthnAndes 2019-01-21 21:59:59: oggm.core.climate: (RGI50-17.01319) process_gcm_dataSouthnAndes 2019-01-21 21:59:59: oggm.core.climate: (RGI50-17.01333) process_gcm_dataSouthnAndes 2019-01-21 21:59:59: oggm.core.climate: (RGI50-17.01488) process_gcm_dataSouthnAndes 2019-01-21 21:59:59: oggm.core.climate: (RGI50-17.01302) process_gcm_dataSouthnAndes 2019-01-21 22:00:09: oggm.core.climate: ValueError occurred during task process_gcm_dataSouthnAndes on RGI50-17.01488: cannot reshape array of size 1 into shape (13872,) 2019-01-21 22:00:09: oggm.core.climate: ValueError occurred during task process_gcm_dataSouthnAndes on RGI50-17.01797: cannot reshape array of size 1 into shape (13872,) 2019-01-21 22:00:09: oggm.core.climate: ValueError occurred during task process_gcm_dataSouthnAndes on RGI50-17.01303: cannot reshape array of size 1 into shape (13872,) 2019-01-21 22:00:09: oggm.core.climate: ValueError occurred during task process_gcm_dataSouthnAndes on RGI50-17.01302: cannot reshape array of size 1 into shape (13872,) 2019-01-21 22:00:09: oggm.core.climate: ValueError occurred during task process_gcm_dataSouthnAndes on RGI50-17.01319: cannot reshape array of size 1 into shape (13872,) 2019-01-21 22:00:09: oggm.core.climate: ValueError occurred during task process_gcm_dataSouthnAndes on RGI50-17.01333: cannot reshape array of size 1 into shape (13872,) 2019-01-21 22:00:09: oggm.core.climate: ValueError occurred during task process_gcm_dataSouthnAndes on RGI50-17.01332: cannot reshape array of size 1 into shape (13872,) 2019-01-21 22:00:09: oggm.core.climate: ValueError occurred during task process_gcm_dataSouthnAndes on RGI50-17.01508: cannot reshape array of size 1 into shape (13872,) 2019-01-21 22:00:09: oggm.core.climate: ValueError occurred during task process_gcm_dataSouthnAndes on RGI50-17.01556: cannot reshape array of size 1 into shape (13872,) multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/afast/zlyu/oggm/oggm/workflow.py", line 86, in call return self.call_func(gdir, self.out_kwargs) File "/afast/zlyu/oggm/oggm/utils.py", line 2588, in _entity_task out = task_func(gdir, kwargs) File "/afast/zlyu/oggm/oggm/core/climate.py", line 1415, in process_gcm_data dsindex = salem.GeoNetcdf(fpath_temp, monthbegin=True) File "/opt/software/Python/3.6.3-foss-2017b/lib/python3.6/site-packages/salem/datasets.py", line 380, in init time = sio.netcdf_time(self._nc, monthbegin=monthbegin) File "/opt/software/Python/3.6.3-foss-2017b/lib/python3.6/site-packages/salem/sio.py", line 377, in netcdf_time time = netCDF4.num2date(var[:], var.units) File "cftime/_cftime.pyx", line 289, in cftime._cftime.num2date File "cftime/_cftime.pyx", line 1210, in cftime._cftime.utime.num2date File "/opt/software/Python/3.6.3-foss-2017b/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 257, in reshape return _wrapfunc(a, 'reshape', newshape, order=order) File "/opt/software/Python/3.6.3-foss-2017b/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 52, in _wrapfunc return getattr(obj, method)(*args, **kwds) ValueError: cannot reshape array of size 1 into shape (13872,)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/opt/software/Python/3.6.3-foss-2017b/lib/python3.6/multiprocessing/pool.py", line 119, in worker result = (True, func(*args, *kwds)) File "/opt/software/Python/3.6.3-foss-2017b/lib/python3.6/multiprocessing/pool.py", line 44, in mapstar return list(map(args)) File "/afast/zlyu/oggm/oggm/workflow.py", line 91, in call raise RuntimeError(err_msg) from e RuntimeError: (RGI50-17.01488) exception occured while processing task process_gcm_data: cannot reshape array of size 1 into shape (13872,) """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "gcm_run.py", line 293, in run_from_climate(gdirs, filesuffix, GCM, EQM, SPIN) File "gcm_run.py", line 35, in run_from_climate execute_entity_task(tasks.process_gcm_data, gdirs, filesuffix=filesuffix, scalendar='365_day') File "/afast/zlyu/oggm/oggm/workflow.py", line 141, in execute_entity_task mppool.map(pc, gdirs, chunksize=1) File "/opt/software/Python/3.6.3-foss-2017b/lib/python3.6/multiprocessing/pool.py", line 266, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/opt/software/Python/3.6.3-foss-2017b/lib/python3.6/multiprocessing/pool.py", line 644, in get raise self._value RuntimeError: (RGI50-17.01488) exception occured while processing task process_gcm_data: cannot reshape array of size 1 into shape (13872,)

anoukvlug commented 5 years ago

Is the process_gcm_data function you use, a function that originates from OGGM or did Pierre-Yves maybe made it? I am wondering about this because the scalendar keyword is currently not a part of the process_gcm_data function and as far as I remember has never been. Using the keyword anyway would probably give an error that looks like:

process_gcm_data() got an unexpected keyword argument 'scalendar'

Instead you got that error when changing it the keyword to calendar.

I think I run some time ago into a similar error as you have. I think it had to do with the version of xarray. You could check if that python package recently got updated.

HoloceneCESI commented 5 years ago

Hi,

we refreshed the newest version OGGM. when I run it, it shows the new error.as follows. Could you please help me?

Anouk Vlug notifications@github.com 于2019年1月22日周二 上午11:42写道:

Is the process_gcm_data function you use, a function that originates from OGGM or did Pierre-Yves maybe made it? I am wondering about this because the scalendar keyword is currently not a part of the process_gcm_data function and as far as I remember has never been. Using the keyword anyway would probably give an error that looks like:

process_gcm_data() got an unexpected keyword argument 'scalendar'

I think I run some time ago into a similar error as you have. I think it had to do with the version of xarray. Could you check if that python package recently got updated?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OGGM/oggm/issues/675#issuecomment-456353590, or mute the thread https://github.com/notifications/unsubscribe-auth/ArtXpWU2rZ9NAyJFz2tHdSK1FI4hDwGyks5vFusrgaJpZM4aLCOR .

anoukvlug commented 5 years ago

@HoloceneCESI somehow I can't see the error you're talking about. Could you try to post it again?

HoloceneCESI commented 5 years ago

error

anoukvlug commented 5 years ago

It is hard to answer questions based on a screenshot and I am not sure if I am the right person to help you with this new error, but I can give it a try.

At first sight it looks like an error that happens to some of the glaciers, one of the glaciers appears to have run successfully in your screen shot. Changing the following statement

cfg.PARAMS['continue_on_error'] = False to cfg.PARAMS['continue_on_error'] = True

might help you moving forward.

HoloceneCESI commented 5 years ago

erroe I think this error is related to Mu values. What do you think of this?

anoukvlug commented 5 years ago

The error is indeed caused by the mu values. This type of error is new to me, but I think it is meant to keep you from using mu values that are not reasonable without realizing it. I am aware of the error 'non finite mu', I guess this 'out of specified bounds' error is meant to put the requirement for mu higher than just being finite. (Increasing the boundaries for mu could be a practical solution for the error, but I don't know what the consequences of that would be.)

What I think about this depends a little on the context and to the amount of glaciers that get this error.

fmaussion commented 5 years ago

yes @anoukvlug you are correct. The error message changed a little but the result is the same. For a number of glaciers we can't calibrate the model properly.

Now, without context, it's hard to tell if it's normal or if there is a problem in @HoloceneCESI setup. If you are running on many glaciers, you should set cfg.PARAMS['continue_on_error'] to True.

In all cases: I'm in the process of documenting a new way to start OGGM runs which will completely suppress this error. I hope to get to it by the end of the week.

@HoloceneCESI : if you plan to use OGGM in depth, I recommend to reach to us by subscribing to https://mailman.zfn.uni-bremen.de/cgi-bin/mailman/listinfo/oggm-users and write us what your plans are - this will help us to understand better what's going on.