Skip to content
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

Gsw instead of seawater #128

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Gsw instead of seawater #128

wants to merge 5 commits into from

Conversation

JanStreffing
Copy link
Contributor

@JanStreffing JanStreffing commented Jul 24, 2024

Needs a thorough test. Not to be merged before #127

@JanStreffing
Copy link
Contributor Author

Found a first problem. I think this happens in:

 --> compute hslice_clim:
     --> compute: temp
          --> compute depth: 100
papermill.exceptions.PapermillExecutionError:
---------------------------------------------------------------------------
Exception encountered at "In [6]":
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[6], line 7
      5 if   vname=='temp' and  which_clim.lower()=='woa18': clim_vname = 't00an1'
      6 elif vname=='salt' and  which_clim.lower()=='woa18': clim_vname = 's00an1'
----> 7 clim = tpv.load_climatology(mesh, clim_path, clim_vname, depth=depth)
      8 print(' --> elasped time to load clim: {:3.2f} min.'.format( (clock.time()-ts)/60  ))
      9 print(' --> clim uses {:3.2f} Gb:'.format(clim.nbytes/(1024**3)))

File /work/ab0246/a270092/software/tripyview/tripyview/sub_climatology.py:69, in load_climatology(mesh, datapath, vname, depth, depidx, do_zarithm, do_hinterp, do_zinterp, descript, do_ptemp, pref, do_compute, do_load, do_persist, **kwargs)
     62     #data_depth = data[coord_zlev]
     63     #data_depth = data_depth.expand_dims({dim_lat:data[coord_lat].data,
     64                                          #dim_lon:data[coord_lon].data}
     65                                         #).transpose(dim_zlev,dim_lat,dim_lon)
     66     data_depth = data[coord_zlev].expand_dims(
     67                     dict({dim_lat:data[coord_lat].data, dim_lon:data[coord_lon].data})
     68                     ).transpose(dim_zlev,dim_lat,dim_lon)
---> 69     data[vname_temp].data = sw.ptmp(data[vname_salt].data, data[vname_temp].data, data_depth )
     71 #___________________________________________________________________________
     72 # if there are multiple variables, than kick out varaible that is not needed
     73 vname_drop = list(data.keys())

AttributeError: module 'gsw' has no attribute 'ptmp'

@JanStreffing
Copy link
Contributor Author

JanStreffing commented Jul 24, 2024

I think it's ok to replace ptmp from https://pythonhosted.org/seawater/eos80.html with https://teos-10.github.io/GSW-Python/_modules/gsw/_wrapped_ufuncs.html#pt_from_t. We would update from EOS80 to TEOS10, which I think is good. Need to be sure this does not clash with our obs input file or FESOM2 output units. We also have to give pref=0, which used to be a default with the old function.

gsw.pt_from_t:
fesom_26rc1_bugfix_hnode_hslice_clim_temp_rob_z100

sw.ptmp:
fesom_26rc1_bugfix_hnode_hslice_clim_temp_rob_z100

@patrickscholz
Copy link
Collaborator

Ich hatte das vorm urlaub auch schon mal ins auge gefasst. Hab dann aber gemerkt das man da vorsichtig sein muss. Da die gsw routinen als input nicht mehr potentielle temperatur haben sondern CT conservative temperature. Wenn mann das glaub ich korrect machen will muss man da noch einen zwischen schritt einbauen mit PT --> CT. Ich wollte das ohnehin nach dem urlaub mit machen.

@JanStreffing
Copy link
Contributor Author

Are you sure? There is also CT to T, but this function is specifically called PT to T. Same checks should be done for the lastest commit where I switch from sw.dens to gsw.rho.

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.

2 participants