Quick Tip: Large (2GB+) wrfsfdda files for WRF OBSGRID nudging

Dec 11, 2020

Recently I’ve ran into an issue where my WRF nudging runs are so long that OBSGRID cannot correctly generate the wrfsfdda_d0* files because they’re too large for the netCDF file limit.

The solution is to go to the nf_create call in src/proc_final_analysis.F90 and enable NetCDF’s large file support, which creates 64-bit files. Find this:

   IF ( ( icount .EQ. 1 ) .AND. ( fdda_loop .EQ. 2 ) ) THEN
      ilen = len_trim(root_filename)
      sfcfile = 'wrfsfdda_'//root_filename(ilen-2:ilen)
      rcode = nf_create( sfcfile, 0, sfc_ncid )

Replace the nf_create’s flag 0 with IOR(NF_NOCLOBBER,NF_64BIT_OFFSET), then rebuild. This should fix the issue.

This is a quick tip post. They are written in a way to help users quickly resolve a problem that I ran into in my daily work and usually don’t go in depth about the details of ‘why’. Please feel free to comment or contribute to the knowledge.