NCAR / Topo

NCAR Global Model Topography Generation Software for Unstructured Grids
26 stars 16 forks source link

dealloc error for non var-res grids #43

Closed adamrher closed 2 years ago

adamrher commented 2 years ago

I just ran topowopts with this command for a ne30pg3 grid:

./cube_to_target --grid_descriptor_file='/glade/work/aherring/grids/uniform-res/ne30np4.pg3/grids/ne30pg3_scrip_170611.nc' --intermediate_cs_name='/glade/p/cgd/amp/pel/topo/cubedata/gmted2010_modis_bedmahcine-ncube3000-220518.nc' --output_grid='ne30pg3' -r -d -m --smoothing_scale=100.0 -u "Adam Herrington, aherring@ucar.edu"

After almost completing this job (it did get past writing the final file), I got this error:

 writing GBXAR  data   2.1727097902297268E-004   3.0458649516175928E-004
 done writing GBXAR data
 close file
At line 973 of file cube_to_target.F90
Fortran runtime error: Attempt to DEALLOCATE unallocated 'target_rrfac'

I suspect the target_rrfac pointer is not being allocated in read_target_grid when there is no rrfac on the SCRIP file.

JulioTBacmeister commented 2 years ago

I fixed this on my fork by adding allocate(target_rrfac) in read_target_grid even if not found on SCRIP file. Is this the best solution?

adamrher commented 2 years ago

I think this is the least invasive fix ... meaning you're not introducing new logic. so fine by me.

PeterHjortLauritzen commented 2 years ago

fixed by @JulioTBacmeister upcoming PR

JulioTBacmeister commented 2 years ago

What happened?