Skip to content

Add rename for fourier varnames based on attributes #274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
7 of 8 tasks
veenstrajelmer opened this issue Mar 14, 2023 · 0 comments · Fixed by #283
Closed
7 of 8 tasks

Add rename for fourier varnames based on attributes #274

veenstrajelmer opened this issue Mar 14, 2023 · 0 comments · Fixed by #283

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Mar 14, 2023

would consist of:

  • set up translation dictionary with help of fourier_analysis.f90.
  • get quantity and maybe analysistype from long_name (e.g. "temperature, average value"). Issue for m
  • maybe get analysistype from varname (e.g. "mesh2d_fourier001_mean") instead (standard_name is not always present), this prevents unclarities with underscores/spaces. However, is there always an underscore present there?
  • get tstart/tstop datestrings from numstart+numstop+reftime. However, numstart/numstop are defined twice and would have to be merged: starttime_fourier_analysis_in_minutes_since_reference_date and starttime_min_max_analysis_in_minutes_since_reference_date
  • rename variable to something like f"{quantity}_{analysistype}_{tstart}_{tstop}" names would then probably make most sense. However, some quantities have spaces/underscores in them, so it might be better to have shorter names like ux/uy/wl etc.
  • possible to include tidal constituent translations? Only numcycles/numstart/numstop is available there, so computed freq would have to be matched to closest value in some online list? (see below) This is source for errors, so warn user. Also, the columns knfac+v0 from the inputfile are not available in the output, also add warning.
  • select all tidal variables by filtering vars that have numcyc attr: xarray.Dataset.filter_by_attrs
  • in case of a 3D model with sigma/z-sigma layers, which z-values are written to the file?

Getting Foreman tidal frequencies:

import pandas as pd
file_freqs = 'https://raw.githubusercontent.com/Deltares/hatyan/main/hatyan/data/data_foreman_frequencies.txt'
freqs = pd.read_csv(file_freqs,names=['freq','dependents'],delim_whitespace=True,comment='#')
print(freqs.loc['M2','freq'])

Used example files:

  • p:\archivedprojects\11203379-005-mwra-updated-bem\03_model\02_final\A72_ntsu0_kzlb2\DFM_OUTPUT_MB_02_fou\MB_02_0000_fou.nc
  • p:\1230882-emodnet_hrsm\GTSMv3.0EMODnet\EMOD_MichaelTUM_yearcomponents\GTSMv4.1_yeartide_2014_2.20.06\output\gtsm_model_0000_fou.nc
@veenstrajelmer veenstrajelmer changed the title Maybe add parser for fourier files Add rename for fourier varnames based on attributes Mar 14, 2023
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 a pull request may close this issue.

1 participant