write to netcdf issue

Any miscellaneous question/problem/comment related to WRF support that does not fit under any of the other category
Post Reply
Posts: 6
Joined: Fri Apr 03, 2020 7:57 pm

write to netcdf issue

Post by stepheba » Tue Sep 15, 2020 4:07 pm

Hi all,

I am encountering a weird issue when using WRF to write some output to netcdf. This is custom code, not in the general WRF model, but it has been used before successfully.

When I compile the model in serial, what happens is some variables are being output to netcdf, and the netcdf file size is growing (the file size scales linearly with the length of the simulation, as expected), but the "time" dimension of the netcdf file remains zero. When I use ncdump to view the contents of the file, the only variables that drop out are lat/long and height---dimension variables. All of the other expected variables are listed, with the correct names, units, etc., but they do not appear as arrays in the file, and if I open the file for example with python and extract those variables, they are just empty arrays (not even zeros). So it's confusing that the file size is growing.

The only other clue I have is that when I compile the model in parallel instead of serial, I have gotten a runtime error for a statement of this form:

Code: Select all

   do j = 1, dim
      allocate( sample_file%var(j)%ptr(num_samples,1,nz) )
    end do
where the sample_file structure is what gets fed into the netcdf file. This error is just before the call to the subroutine that writes to netcdf. The error reads

Fortran runtime error: Index '1' of dimension 1 of array 'sample_file%var' above upper bound of 0.

I don't get this error when running in serial. The model completes successfully, rather I just get the weird behavior described above.

Thanks for any input!

Post Reply

Return to “Miscellaneous”