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

Convert velocity input to optional (obs have no velocity input) #74

Closed
durack1 opened this issue Feb 15, 2019 · 23 comments
Closed

Convert velocity input to optional (obs have no velocity input) #74

durack1 opened this issue Feb 15, 2019 · 23 comments

Comments

@durack1
Copy link
Collaborator

durack1 commented Feb 15, 2019

EN4 and other obs datasets have no corresponding velocity time series. Consequently current code won’t process obs.

@eguil
Copy link
Owner

eguil commented Feb 18, 2019

Option added and input arguments slightly revisited:

densityBin(fileT,fileS,fileFx,fileV='none',outFile='out.nc',debug=True,timeint='all',\
mthout=False,gridfT='none',gridfS='none',gridfV='none'):

if fileV='none' the MSF calculation is ignored and V read is not required.

@eguil
Copy link
Owner

eguil commented Feb 18, 2019

Tested and ok

@eguil eguil closed this as completed Feb 18, 2019
@durack1
Copy link
Collaborator Author

durack1 commented Feb 28, 2019

@eguil I'm still hitting problems with this:

(cdat80py2) duro@ocean:[Density_bining]:[issue71_durack1_UpdateObsUpdateESMPCalls*]:[11638]> python drive_obs.py
Processing:  0
areacello:  ~Shared/190213_data_density/obs.EN4.historical.r0i0p0.mo.ocn.Omon.so.ver-1.latestX.xml
so:         ~Shared/190213_data_density/obs.EN4.historical.r0i0p0.mo.ocn.Omon.thetao.ver-1.latestX.xml
thetao:     ~Shared/190213_data_density/obs.JAMSTEC.historical.r0i0p0.mo.ocn.Omon.so.ver-1.latestX.xml
Warning: ID reference not found: bounds=bounds_latitude
Warning: ID reference not found: bounds=bounds_longitude
Warning: ID reference not found: bounds=bounds_pressure
Warning: ID reference not found: bounds=bounds_time
Warning: ID reference not found: bounds=depth_bnds
Warning: ID reference not found: bounds=bounds_lat
Warning: ID reference not found: bounds=bounds_lon
Warning: ID reference not found: bounds=time_bnds
Warning: ID reference not found: bounds=depth_bnds
Warning: ID reference not found: bounds=bounds_lat
Warning: ID reference not found: bounds=bounds_lon
Warning: ID reference not found: bounds=time_bnds
Traceback (most recent call last):
  File "drive_obs.py", line 87, in <module>
    densityBin(thetao,so,areacello,'none',outfileDensity,debug=True,timeint='all')
  File "~git/Density_bining/binDensity.py", line 358, in densityBin
    thetao_h    = ft('thetao', time = slice(1,10)) ; # remove handle for non cmor files
  File "~anaconda2/envs/cdat80py2/lib/python2.7/site-packages/cdms2/cudsinterface.py", line 33, in __call__
    raise CDMSError("No such variable, " + id)
cdms2.error.CDMSError: No such variable, thetao

@durack1 durack1 reopened this Feb 28, 2019
@eguil
Copy link
Owner

eguil commented Mar 5, 2019

@durack1 can you put the files somewhere on crunchy ? It is probably due to non CMOR format. Is the temperature variable name thetao ?

@durack1
Copy link
Collaborator Author

durack1 commented Mar 5, 2019

@eguil it still seems to be an issue:

(cdat80py2) durack1@oceanonly:[Density_bining]:[issue71_durack1_UpdateObsUpdateESMPCalls*]:[11506]> python drive_obs.py
Processing:  0
areacello:  /work/durack1/Shared/190213_data_density/obs.EN4.historical.r0i0p0.mo.ocn.Omon.areacello.ver-1.latestX.nc
so:         /work/durack1/Shared/190213_data_density/obs.EN4.historical.r0i0p0.mo.ocn.Omon.so.ver-1.latestX.xml
thetao:     /work/durack1/Shared/190213_data_density/obs.EN4.historical.r0i0p0.mo.ocn.Omon.thetao.ver-1.latestX.xml
Warning: ID reference not found: bounds=depth_bnds
Warning: ID reference not found: bounds=bounds_lat
Warning: ID reference not found: bounds=bounds_lon
Warning: ID reference not found: bounds=time_bnds
Warning: ID reference not found: bounds=depth_bnds
Warning: ID reference not found: bounds=bounds_lat
Warning: ID reference not found: bounds=bounds_lon
Warning: ID reference not found: bounds=time_bnds
Traceback (most recent call last):
  File "drive_obs.py", line 89, in <module>
    densityBin(thetao,so,areacello,'none',outfileDensity,debug=True,timeint='all')
  File "/export/durack1/git/Density_bining/binDensity.py", line 364, in densityBin
    vo_h        = fv('vo'    , time = slice(1,10)) ; #
  File "/export/durack1/anaconda2/envs/cdat80py2/lib/python2.7/site-packages/cdms2/cudsinterface.py", line 33, in __call__
    raise CDMSError("No such variable, " + id)
cdms2.error.CDMSError: No such variable, vo

I'll email the paths to data

@eguil
Copy link
Owner

eguil commented Mar 5, 2019

is the call you make to density bin correct (arguments have been re-organised) ?

@durack1
Copy link
Collaborator Author

durack1 commented Mar 5, 2019

@eguil looks right to me:

densityBin(thetao,so,areacello,'none',outfileDensity,debug=True,timeint='all')

https://github.com/eguil/Density_bining/blob/master/binDensity.py#L244-L266

def densityBin(fileT,fileS,fileFx,fileV='none',outFile='out.nc',debug=True,timeint='all',mthout=False,gridfT='none',gridfS='none',gridfV='none'):
    '''
    The densityBin() function takes file and variable arguments and creates
    density persistence fields which are written to a specified outfile
    Author:    Eric Guilyardi : Eric.Guilyardi@locean-ipsl.upmc.fr
    Co-author: Paul J. Durack : pauldurack@llnl.gov : @durack1.
    Created on Sun Sep 14 21:13:30 2014
    Inputs:
    ------
    - fileT(time,lev,lat,lon)   - 4D potential temperature array
    - fileS(time,lev,lat,lon)   - 4D salinity array
    - fileFx(lat,lon)           - 2D array containing the cell area values
    -> options:
    - fileV(time,lev,lat,lon)   - 4D meridional velocity array
    - outFile(str)              - output file with full path specified.
    - debug <optional>          - boolean value
    - timeint <optional>        - specify temporal step for binning <init_idx>,<ncount>
    - mthout <optional>         - write annual data (False) or all monthly data (True)
    - gridfT <optional>         - file to get T grid info from
    - gridfS <optional>         - file to get S grid info from
    - gridfV <optional>         - file to get V grid info from
...

@eguil
Copy link
Owner

eguil commented Mar 7, 2019

ok I managed to run my latest version of binDensity (i.e. without your last changes) on the first year of EN4 and it is running. Here is my test script:

from binDensity import densityBin

obsThetao = '/data/ericglod/Density_binning/190213_data_density/180723_EN4.2.1.g10_monthly_TAndS_190001-190912_5-5350m.nc'
obsSo = '/data/ericglod/Density_binning/190213_data_density/180723_EN4.2.1.g10_monthly_TAndS_190001-190912_5-5350m.nc'
obsAreacello = '/data/ericglod/Density_binning/190213_data_density/obs.EN4.historical.r0i0p0.mo.ocn.Omon.areacello.ver-1.latestX.nc'

outfileDensity = '/home/ericglod/Density_bining/test/EN4.mon.ocean.Omon.density.nc'

densityBin(obsThetao,obsSo,obsAreacello,'none',outFile=outfileDensity,timeint='1,12')

Not sure what is going on on your side. Maybe we should do a call with screen sharing.

@durack1
Copy link
Collaborator Author

durack1 commented Mar 7, 2019

@eguil what the the version of CDAT that you're running this against? A conda env?

@eguil
Copy link
Owner

eguil commented Mar 7, 2019

an old PMP installation version

@durack1
Copy link
Collaborator Author

durack1 commented Mar 7, 2019

Got any more details? If it's conda (probably not), you can peruse through /work/eguilyardi/anaconda2/envs/ - if it's CICLAD (looks like it), I'm not sure..

@eguil
Copy link
Owner

eguil commented Mar 7, 2019

I am running on ciclad and it is not a conda install.

@durack1
Copy link
Collaborator Author

durack1 commented Mar 7, 2019

Probably time to make the change #69, download anaconda

conda create -n cdat81py2 -c cdat/label/v81 -c conda-forge cdat "python<3"

@ysilvy
Copy link
Collaborator

ysilvy commented Mar 7, 2019 via email

@durack1
Copy link
Collaborator Author

durack1 commented Mar 7, 2019

@ysilvy it's a good move to update yourselves and the way you work. Creating conda environments means that you can have versions side by side, which is a real advantage, particularly as new/beta releases become available where you can validate older libraries/code works

@eguil
Copy link
Owner

eguil commented Mar 15, 2019

Ok I managed to sync again binDensity on Crunchy. I will try there.

@durack1
Copy link
Collaborator Author

durack1 commented Mar 15, 2019

@eguil let me know

@eguil
Copy link
Owner

eguil commented Mar 16, 2019

Ok let's try that (I will transfer all the EN4 data). I can now sync git on crunchy but the python is now v3 and binDensity is v2. Where is the cdat that would work for python2 ?

@eguil
Copy link
Owner

eguil commented Mar 16, 2019

the program is running on ciclad (old set up) but I have issues with the negative masking values in En4. Is it easy to change this in the files or should I work around in the code ?

@durack1
Copy link
Collaborator Author

durack1 commented Mar 17, 2019

@eguil make sure you included the "python<3" from the #74 (comment), otherwise it will default to py3

@eguil
Copy link
Owner

eguil commented Mar 17, 2019

I know this is confusing but my previous comment was for my tests on crunchy where I did not install CDAT.

@durack1
Copy link
Collaborator Author

durack1 commented Mar 18, 2019

@eguil I'm having trouble following the thread of this discussion above, facetime/skype?

@eguil
Copy link
Owner

eguil commented Apr 30, 2019

closing this

@eguil eguil closed this as completed Apr 30, 2019
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

No branches or pull requests

3 participants