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!

Posts: 2287
Joined: Wed Feb 14, 2018 9:21 pm

Re: write to netcdf issue

Post by kwerner » Tue Nov 03, 2020 9:23 pm

Hi Ben,
I just stumbled across this post when reviewing some others in this section, and noticed that there was never a reply for this. I apologize for the very long delay. It was certainly not intentional.

As for the problem, since you posted this so long ago, I assume that you may have gotten past the problem. If not, unfortunately we are unable to support code that has been modified, as many errors can be introduced in the code and it could take a while to track down. We don't have the resources for that. Furthermore, it seems that the problem is likely related to either your code changes, or to the netcdf library on your system. I would test this with a non-modified newest version of the WRF code (WRFV4.2.1). If it works okay with that version, then you'll know it likely has to do with some of your code modifications. If you are still seeing the problem, you will probably need to discuss the issue with a systems administrator at your institution, as they will know more about your system, environment, libraries, etc.

Post Reply

Return to “Miscellaneous”