CICE-Consortium / CICE

Development repository for the CICE sea-ice model
Other
53 stars 128 forks source link

PIO createfile where path is a symlink #950

Open anton-seaice opened 2 months ago

anton-seaice commented 2 months ago

In the UFS model configuration, the output files can be configured as symlinks which are created before the model is run.

e.g. a symlink is created to point to the desired locations of history / restart files, but the target of the symlink doesn't exist yet. CICE creates the actual file during the model execution.

@DeniseWorthen has found that using _format = 'hdf5' this fails with this error:

 (ice_pio_init) ERROR: Failed to create file .

This is because : https://github.com/CICE-Consortium/CICE/blob/0af031d785d3bc622cd19af48a2e9465b5abe9a0/cicecore/cicedyn/infrastructure/io/io_pio2/ice_pio.F90#L200

gives exists=True where filename is a symlink, even if the target is not does not exist. Therefore the file is created with "NOCLOBBER" and it fails.

We think we can remove this "NOCLOBBER" case, and create the file with "CLOBBER" irrespective of whether it already exists=True or not. This works with modern PIO (e.g. 2.6.2) builds.

We should check with older PIO builds also and possibly raise with the PIO developers (as its not clear why you can't create with NOCLOBBER).