Skip to content

Conversation

@adrimourits
Copy link
Contributor

Commit Description

ec_typedefs::tEcNetCDF: Register what variables are time varying

ec_netcdf_timeseries.f90::ecNetCDFInit:

  • Fill array time_varying_var
  • Vertical layering should be identified with "axis=Z" instead of "positive = notEmpty"
  • Vertical layering: accept standard_names "z, zcoordinate, zcoordinate_c", exclude "zcoordinate_w, zcoordinate_wu"

ec_netcdf_timeseries.f90::ecNetCDFScan:

  • ltl is defined by calling len_trim_nobnd

ec_netcdf_timeseries.f90::len_trim_nobnd:

  • New function, returning the length of a string excluding "bnd" at the end

What was done

  • Get Theo's testcase running
  • Preparations to also facilitate the revival of testcases e02_f005_c151/c152

TODO

  • Reanimate testcases e02_f005_c151/c152

Evidence of the work done

  • Video/figures
    <add video/figures if applicable>
  • Clear from the issue description
  • Not applicable

Tests

  • Tests updated
    <add testcase numbers if applicable, Issue number>
  • Not applicable
  • Theo's test will be added to the testbench later

Documentation

  • Documentation updated
    <add description of changes if applicable, Issue number>
  • Not applicable

Issue link

UNST-9376

ec_typedefs::tEcNetCDF: Register what variables are time varying

ec_netcdf_timeseries.f90::ecNetCDFInit:
- Fill array time_varying_var
- Vertical layering should be identified with "axis=Z" instead of "positive = notEmpty"
- Vertical layering: accept standard_names "z, zcoordinate, zcoordinate_c", exclude "zcoordinate_w, zcoordinate_wu"

ec_netcdf_timeseries.f90::ecNetCDFScan:
- ltl is defined by calling len_trim_nobnd

ec_netcdf_timeseries.f90::len_trim_nobnd:
- New function, returning the length of a string excluding "bnd" at the end
@adrimourits adrimourits requested a review from arthurvd November 7, 2025 17:21
@adrimourits
Copy link
Contributor Author

@arthurvd : At some point we need to discuss how to facilitate 3D quantities for nesting, including z-coordinates varying in time. This PR is a first step, enabling Theo to continue.

When reading "zcoordinate_c"-related info, the nesting functionality is ruined. TODO: find out why and implement a proper fix.
Copy link
Member

@arthurvd arthurvd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adri and Arthur will followup with some improved design under UNST-9376 first.

if (ncptr%vptyp < 1) then
call setECMessage("ec_bcreader::ecNetCDFCreate: Unable to determine vertical coordinate system.")
! This line does not work: if (any((/ 'z ', 'zcoordinate ', 'zcoordinate_c'/) == ncptr%standard_names(iVars))) then
if (any((/ 'z ', 'zcoordinate '/) == ncptr%standard_names(iVars))) then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we need to do this differently, let's refine a proper 3D initialization under the other dedicated issue: UNST-8909 (so not do this here)

if (ncptr%vptyp < 1) then
call setECMessage("ec_bcreader::ecNetCDFCreate: Unable to determine vertical coordinate system.")
! This line does not work: if (any((/ 'z ', 'zcoordinate ', 'zcoordinate_c'/) == ncptr%standard_names(iVars))) then
if (any((/ 'z ', 'zcoordinate '/) == ncptr%standard_names(iVars))) then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p.s. Coding guidelines require the modern format for initialization arrays, namely: [ .. ] instead of (/ .. /).

Comment on lines +286 to +289
if (ncptr%nLayer > size(ncptr%vp)) then
call realloc (ncptr%vp, ncptr%nLayer, stat=ierr, keepExisting=.true.)
end if
if (ierr /= 0) return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If 3D work is postponed until UNST-8909, why not simply have an if .. cycle here?

Suggested change
if (ncptr%nLayer > size(ncptr%vp)) then
call realloc (ncptr%vp, ncptr%nLayer, stat=ierr, keepExisting=.true.)
end if
if (ierr /= 0) return
allocate (ncptr%vp(ncptr%nLayer), stat=ierr)
if (ierr /= 0) cycle

do ivar = 1, ncptr%nVars
ltl = len_trim(quantity)
if (strcmpi(trim(ncptr%standard_names(ivar)), trim(quantity))) exit
if (strcmpi(trim(ncptr%standard_names(ivar)), trim(quantity), ltl)) exit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would hope we can make this work instead using the existing ncstdnames approach, by having something like this in ecProviderCreateNetCdfItems():

      case ('waterlevelbnd')
         ncvarnames(1) = 'waterlevel'
         ncstdnames(1) = 'sea_surface_height'

Let's refine this together under UNST-9376 for proper followup in next sprint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants