NOAA-ORR-ERD / PyGnome

The General NOAA Operational Modeling Environment
https://gnome.orr.noaa.gov/doc/pygnome/index.html
Other
59 stars 44 forks source link

How to Import ROMS current netcdf file in Pygnome #92

Open DoctorHamzeh opened 3 years ago

DoctorHamzeh commented 3 years ago

Hello Dears, As it seems, PyCurrentMover class is considered for importing current netcdf files from GNOME Online Oceanographic Data Server in which specific global attributes and variables names are according to GNOME acceptable format. However, for an output netcdf current file from a ROMS model installed in a linux os, is there any function for direct importing of netcdf file? Whats is the best method to import this file to Pygnome? Thank you in advance

ChrisBarker-NOAA commented 3 years ago

Sorry for the confusion:

We have two different Gridded Current Mover implementations:

GridCurrentMover: The "old" one, written largely in C++ -- it is needed to support some not-quite conforming grids that we need, and get from GOODS. It only understands "GNOME format" netcdf files -- as you say, with specific variable names and metadata.

PyCurrentMover is the newer, pure-Python implementation. It support the "GNOME format" netcdf files, as well as (theoretically) any CF and SGRID or UGRID compliant netcdf files (and many semi-compliant files).

ROMS uses an SGRID (http://sgrid.github.io/sgrid/), so ideally, should use the SGRID conventions.

I've lost track a bit of what ROMS is outputting by default, but it didn't used to be SGRID compliant.

However, you can also tell GNOME a bit about the file, and then it should be able to load it.

The PyCurrentMover takes an optional grid_topology parameter, where you can specify what variable hold the grid topology.

This is minimally documented here:

https://gnome.orr.noaa.gov/doc/pygnome/env_obj/examples.html?highlight=grid_topology

with an example here:

https://gnome.orr.noaa.gov/doc/pygnome/env_obj/env_obj_examples.html?highlight=grid_topology

For all the grid "parts" see the (also minimal :-( ) documentation for the gridded package:

https://noaa-orr-erd.github.io/gridded/non_conforming_data.html#if-your-files-conform-to-the-underlying-data-model

If you can't figure it out, post and (ideally small!) sample file, and we can help.

Also: Documentation PRs excepted -- and "out of the box ROMS" example would be a good one to have in the docs.

-CHB

DoctorHamzeh commented 3 years ago

Thank you Dr.Barker for complete response to this issue. For example, would you please guide me how to use PyCurrentMover class for importing a netcdf current file in which variables are as below:

Dimensions:
           xi_rho     = 295
           xi_u       = 294
           xi_v       = 295
           xi_psi     = 294
           eta_rho    = 217
           eta_u      = 217
           eta_v      = 216
           eta_psi    = 216
           N          = 25
           s_rho      = 25
           s_w        = 26
           tracer     = 2
           boundary   = 4
           ocean_time = 2     (UNLIMITED)
Variables:
    ntimes         
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name = 'number of long time-steps'
    ndtfast        
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name = 'number of short time-steps'
    dt             
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'size of long time-steps'
                       units     = 'second'
    dtfast         
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'size of short time-steps'
                       units     = 'second'
    dstart         
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'time stamp assigned to model initilization'
                       units     = 'days since 2010-01-01 00:00:00'
                       calendar  = 'proleptic_gregorian'
    nHIS           
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name = 'number of time-steps between history records'
    ndefHIS        
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name = 'number of time-steps between the creation of history files'
    nRST           
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name = 'number of time-steps between restart records'
                       cycle     = 'only latest two records are maintained'
    ntsAVG         
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name = 'starting time-step for accumulation of time-averaged fields'
    nAVG           
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name = 'number of time-steps between time-averaged records'
    ndefAVG        
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name = 'number of time-steps between the creation of average files'
    Falpha         
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'Power-law shape barotropic filter parameter'
    Fbeta          
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'Power-law shape barotropic filter parameter'
    Fgamma         
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'Power-law shape barotropic filter parameter'
    nl_tnu2        
           Size:       2x1
           Dimensions: tracer
           Datatype:   double
           Attributes:
                       long_name = 'nonlinear model Laplacian mixing coefficient for tracers'
                       units     = 'meter2 second-1'
    nl_visc2       
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'nonlinear model Laplacian mixing coefficient for momentum'
                       units     = 'meter2 second-1'
    LuvSponge      
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name     = 'horizontal viscosity sponge activation switch'
                       flag_values   = [0  1]
                       flag_meanings = '.FALSE. .TRUE.'
    LtracerSponge  
           Size:       2x1
           Dimensions: tracer
           Datatype:   int32
           Attributes:
                       long_name     = 'horizontal diffusivity sponge activation switch'
                       flag_values   = [0  1]
                       flag_meanings = '.FALSE. .TRUE.'
    Akt_bak        
           Size:       2x1
           Dimensions: tracer
           Datatype:   double
           Attributes:
                       long_name = 'background vertical mixing coefficient for tracers'
                       units     = 'meter2 second-1'
    Akv_bak        
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'background vertical mixing coefficient for momentum'
                       units     = 'meter2 second-1'
    Akk_bak        
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'background vertical mixing coefficient for turbulent energy'
                       units     = 'meter2 second-1'
    Akp_bak        
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'background vertical mixing coefficient for length scale'
                       units     = 'meter2 second-1'
    rdrg           
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'linear drag coefficient'
                       units     = 'meter second-1'
    rdrg2          
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'quadratic drag coefficient'
    Zob            
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'bottom roughness'
                       units     = 'meter'
    Zos            
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'surface roughness'
                       units     = 'meter'
    gls_p          
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'stability exponent'
    gls_m          
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'turbulent kinetic energy exponent'
    gls_n          
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'turbulent length scale exponent'
    gls_cmu0       
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'stability coefficient'
    gls_c1         
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'shear production coefficient'
    gls_c2         
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'dissipation coefficient'
    gls_c3m        
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'buoyancy production coefficient (minus)'
    gls_c3p        
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'buoyancy production coefficient (plus)'
    gls_sigk       
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'constant Schmidt number for TKE'
    gls_sigp       
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'constant Schmidt number for PSI'
    gls_Kmin       
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'minimum value of specific turbulent kinetic energy'
    gls_Pmin       
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'minimum Value of dissipation'
    Charnok_alpha  
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'Charnok factor for surface roughness'
    Zos_hsig_alpha 
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'wave amplitude factor for surface roughness'
    sz_alpha       
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'surface flux from wave dissipation'
    CrgBan_cw      
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'surface flux due to Craig and Banner wave breaking'
    Znudg          
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'free-surface nudging/relaxation inverse time scale'
                       units     = 'day-1'
    M2nudg         
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = '2D momentum nudging/relaxation inverse time scale'
                       units     = 'day-1'
    M3nudg         
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = '3D momentum nudging/relaxation inverse time scale'
                       units     = 'day-1'
    Tnudg          
           Size:       2x1
           Dimensions: tracer
           Datatype:   double
           Attributes:
                       long_name = 'Tracers nudging/relaxation inverse time scale'
                       units     = 'day-1'
    Tnudg_SSS      
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'SSS nudging/relaxation inverse time scale'
                       units     = 'day-1'
    FSobc_in       
           Size:       4x1
           Dimensions: boundary
           Datatype:   double
           Attributes:
                       long_name = 'free-surface inflow, nudging inverse time scale'
                       units     = 'second-1'
    FSobc_out      
           Size:       4x1
           Dimensions: boundary
           Datatype:   double
           Attributes:
                       long_name = 'free-surface outflow, nudging inverse time scale'
                       units     = 'second-1'
    M2obc_in       
           Size:       4x1
           Dimensions: boundary
           Datatype:   double
           Attributes:
                       long_name = '2D momentum inflow, nudging inverse time scale'
                       units     = 'second-1'
    M2obc_out      
           Size:       4x1
           Dimensions: boundary
           Datatype:   double
           Attributes:
                       long_name = '2D momentum outflow, nudging inverse time scale'
                       units     = 'second-1'
    Tobc_in        
           Size:       2x4
           Dimensions: tracer,boundary
           Datatype:   double
           Attributes:
                       long_name = 'tracers inflow, nudging inverse time scale'
                       units     = 'second-1'
    Tobc_out       
           Size:       2x4
           Dimensions: tracer,boundary
           Datatype:   double
           Attributes:
                       long_name = 'tracers outflow, nudging inverse time scale'
                       units     = 'second-1'
    M3obc_in       
           Size:       4x1
           Dimensions: boundary
           Datatype:   double
           Attributes:
                       long_name = '3D momentum inflow, nudging inverse time scale'
                       units     = 'second-1'
    M3obc_out      
           Size:       4x1
           Dimensions: boundary
           Datatype:   double
           Attributes:
                       long_name = '3D momentum outflow, nudging inverse time scale'
                       units     = 'second-1'
    rho0           
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'mean density used in Boussinesq approximation'
                       units     = 'kilogram meter-3'
    gamma2         
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'slipperiness parameter'
    LuvSrc         
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name     = 'momentum point sources and sink activation switch'
                       flag_values   = [0  1]
                       flag_meanings = '.FALSE. .TRUE.'
    LwSrc          
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name     = 'mass point sources and sink activation switch'
                       flag_values   = [0  1]
                       flag_meanings = '.FALSE. .TRUE.'
    LtracerSrc     
           Size:       2x1
           Dimensions: tracer
           Datatype:   int32
           Attributes:
                       long_name     = 'tracer point sources and sink activation switch'
                       flag_values   = [0  1]
                       flag_meanings = '.FALSE. .TRUE.'
    LsshCLM        
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name     = 'sea surface height climatology processing switch'
                       flag_values   = [0  1]
                       flag_meanings = '.FALSE. .TRUE.'
    Lm2CLM         
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name     = '2D momentum climatology processing switch'
                       flag_values   = [0  1]
                       flag_meanings = '.FALSE. .TRUE.'
    Lm3CLM         
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name     = '3D momentum climatology processing switch'
                       flag_values   = [0  1]
                       flag_meanings = '.FALSE. .TRUE.'
    LtracerCLM     
           Size:       2x1
           Dimensions: tracer
           Datatype:   int32
           Attributes:
                       long_name     = 'tracer climatology processing switch'
                       flag_values   = [0  1]
                       flag_meanings = '.FALSE. .TRUE.'
    LnudgeM2CLM    
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name     = '2D momentum climatology nudging activation switch'
                       flag_values   = [0  1]
                       flag_meanings = '.FALSE. .TRUE.'
    LnudgeM3CLM    
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name     = '3D momentum climatology nudging activation switch'
                       flag_values   = [0  1]
                       flag_meanings = '.FALSE. .TRUE.'
    LnudgeTCLM     
           Size:       2x1
           Dimensions: tracer
           Datatype:   int32
           Attributes:
                       long_name     = 'tracer climatology nudging activation switch'
                       flag_values   = [0  1]
                       flag_meanings = '.FALSE. .TRUE.'
    spherical      
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name     = 'grid type logical switch'
                       flag_values   = [0  1]
                       flag_meanings = 'Cartesian spherical'
    xl             
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'domain length in the XI-direction'
                       units     = 'meter'
    el             
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'domain length in the ETA-direction'
                       units     = 'meter'
    Vtransform     
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name = 'vertical terrain-following transformation equation'
    Vstretching    
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       long_name = 'vertical terrain-following stretching function'
    theta_s        
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'S-coordinate surface control parameter'
    theta_b        
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'S-coordinate bottom control parameter'
    Tcline         
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'S-coordinate surface/bottom layer width'
                       units     = 'meter'
    hc             
           Size:       1x1
           Dimensions: 
           Datatype:   double
           Attributes:
                       long_name = 'S-coordinate parameter, critical depth'
                       units     = 'meter'
    grid           
           Size:       1x1
           Dimensions: 
           Datatype:   int32
           Attributes:
                       cf_role             = 'grid_topology'
                       topology_dimension  = 2
                       node_dimensions     = 'xi_psi eta_psi'
                       face_dimensions     = 'xi_rho: xi_psi (padding: both) eta_rho: eta_psi (padding: both)'
                       edge1_dimensions    = 'xi_u: xi_psi eta_u: eta_psi (padding: both)'
                       edge2_dimensions    = 'xi_v: xi_psi (padding: both) eta_v: eta_psi'
                       node_coordinates    = 'lon_psi lat_psi'
                       face_coordinates    = 'lon_rho lat_rho'
                       edge1_coordinates   = 'lon_u lat_u'
                       edge2_coordinates   = 'lon_v lat_v'
                       vertical_dimensions = 's_rho: s_w (padding: none)'
    s_rho          
           Size:       25x1
           Dimensions: s_rho
           Datatype:   double
           Attributes:
                       long_name     = 'S-coordinate at RHO-points'
                       valid_min     = -1
                       valid_max     = 0
                       positive      = 'up'
                       standard_name = 'ocean_s_coordinate_g2'
                       formula_terms = 's: s_rho C: Cs_r eta: zeta depth: h depth_c: hc'
                       field         = 's_rho, scalar'
    s_w            
           Size:       26x1
           Dimensions: s_w
           Datatype:   double
           Attributes:
                       long_name     = 'S-coordinate at W-points'
                       valid_min     = -1
                       valid_max     = 0
                       positive      = 'up'
                       standard_name = 'ocean_s_coordinate_g2'
                       formula_terms = 's: s_w C: Cs_w eta: zeta depth: h depth_c: hc'
                       field         = 's_w, scalar'
    Cs_r           
           Size:       25x1
           Dimensions: s_rho
           Datatype:   double
           Attributes:
                       long_name = 'S-coordinate stretching curves at RHO-points'
                       valid_min = -1
                       valid_max = 0
                       field     = 'Cs_r, scalar'
    Cs_w           
           Size:       26x1
           Dimensions: s_w
           Datatype:   double
           Attributes:
                       long_name = 'S-coordinate stretching curves at W-points'
                       valid_min = -1
                       valid_max = 0
                       field     = 'Cs_w, scalar'
    h              
           Size:       295x217
           Dimensions: xi_rho,eta_rho
           Datatype:   double
           Attributes:
                       long_name   = 'bathymetry at RHO-points'
                       units       = 'meter'
                       grid        = 'grid'
                       location    = 'face'
                       coordinates = 'lon_rho lat_rho'
                       field       = 'bath, scalar'
    f              
           Size:       295x217
           Dimensions: xi_rho,eta_rho
           Datatype:   double
           Attributes:
                       long_name   = 'Coriolis parameter at RHO-points'
                       units       = 'second-1'
                       grid        = 'grid'
                       location    = 'face'
                       coordinates = 'lon_rho lat_rho'
                       field       = 'coriolis, scalar'
    pm             
           Size:       295x217
           Dimensions: xi_rho,eta_rho
           Datatype:   double
           Attributes:
                       long_name   = 'curvilinear coordinate metric in XI'
                       units       = 'meter-1'
                       grid        = 'grid'
                       location    = 'face'
                       coordinates = 'lon_rho lat_rho'
                       field       = 'pm, scalar'
    pn             
           Size:       295x217
           Dimensions: xi_rho,eta_rho
           Datatype:   double
           Attributes:
                       long_name   = 'curvilinear coordinate metric in ETA'
                       units       = 'meter-1'
                       grid        = 'grid'
                       location    = 'face'
                       coordinates = 'lon_rho lat_rho'
                       field       = 'pn, scalar'
    lon_rho        
           Size:       295x217
           Dimensions: xi_rho,eta_rho
           Datatype:   double
           Attributes:
                       long_name     = 'longitude of RHO-points'
                       units         = 'degree_east'
                       standard_name = 'longitude'
                       field         = 'lon_rho, scalar'
    lat_rho        
           Size:       295x217
           Dimensions: xi_rho,eta_rho
           Datatype:   double
           Attributes:
                       long_name     = 'latitude of RHO-points'
                       units         = 'degree_north'
                       standard_name = 'latitude'
                       field         = 'lat_rho, scalar'
    lon_u          
           Size:       294x217
           Dimensions: xi_u,eta_u
           Datatype:   double
           Attributes:
                       long_name     = 'longitude of U-points'
                       units         = 'degree_east'
                       standard_name = 'longitude'
                       field         = 'lon_u, scalar'
    lat_u          
           Size:       294x217
           Dimensions: xi_u,eta_u
           Datatype:   double
           Attributes:
                       long_name     = 'latitude of U-points'
                       units         = 'degree_north'
                       standard_name = 'latitude'
                       field         = 'lat_u, scalar'
    lon_v          
           Size:       295x216
           Dimensions: xi_v,eta_v
           Datatype:   double
           Attributes:
                       long_name     = 'longitude of V-points'
                       units         = 'degree_east'
                       standard_name = 'longitude'
                       field         = 'lon_v, scalar'
    lat_v          
           Size:       295x216
           Dimensions: xi_v,eta_v
           Datatype:   double
           Attributes:
                       long_name     = 'latitude of V-points'
                       units         = 'degree_north'
                       standard_name = 'latitude'
                       field         = 'lat_v, scalar'
    lon_psi        
           Size:       294x216
           Dimensions: xi_psi,eta_psi
           Datatype:   double
           Attributes:
                       long_name     = 'longitude of PSI-points'
                       units         = 'degree_east'
                       standard_name = 'longitude'
                       field         = 'lon_psi, scalar'
    lat_psi        
           Size:       294x216
           Dimensions: xi_psi,eta_psi
           Datatype:   double
           Attributes:
                       long_name     = 'latitude of PSI-points'
                       units         = 'degree_north'
                       standard_name = 'latitude'
                       field         = 'lat_psi, scalar'
    angle          
           Size:       295x217
           Dimensions: xi_rho,eta_rho
           Datatype:   double
           Attributes:
                       long_name   = 'angle between XI-axis and EAST'
                       units       = 'radians'
                       grid        = 'grid'
                       location    = 'face'
                       coordinates = 'lon_rho lat_rho'
                       field       = 'angle, scalar'
    mask_rho       
           Size:       295x217
           Dimensions: xi_rho,eta_rho
           Datatype:   double
           Attributes:
                       long_name     = 'mask on RHO-points'
                       flag_values   = [0  1]
                       flag_meanings = 'land water'
                       grid          = 'grid'
                       location      = 'face'
                       coordinates   = 'lon_rho lat_rho'
    mask_u         
           Size:       294x217
           Dimensions: xi_u,eta_u
           Datatype:   double
           Attributes:
                       long_name     = 'mask on U-points'
                       flag_values   = [0  1]
                       flag_meanings = 'land water'
                       grid          = 'grid'
                       location      = 'edge1'
                       coordinates   = 'lon_u lat_u'
    mask_v         
           Size:       295x216
           Dimensions: xi_v,eta_v
           Datatype:   double
           Attributes:
                       long_name     = 'mask on V-points'
                       flag_values   = [0  1]
                       flag_meanings = 'land water'
                       grid          = 'grid'
                       location      = 'edge2'
                       coordinates   = 'lon_v lat_v'
    mask_psi       
           Size:       294x216
           Dimensions: xi_psi,eta_psi
           Datatype:   double
           Attributes:
                       long_name     = 'mask on psi-points'
                       flag_values   = [0  1]
                       flag_meanings = 'land water'
                       grid          = 'grid'
                       location      = 'node'
                       coordinates   = 'lon_psi lat_psi'
    ocean_time     
           Size:       2x1
           Dimensions: ocean_time
           Datatype:   double
           Attributes:
                       long_name = 'time since initialization'
                       units     = 'seconds since 2010-01-01 00:00:00'
                       calendar  = 'proleptic_gregorian'
                       field     = 'time, scalar, series'
    wetdry_mask_psi
           Size:       294x216x2
           Dimensions: xi_psi,eta_psi,ocean_time
           Datatype:   double
           Attributes:
                       long_name     = 'wet/dry mask on PSI-points'
                       flag_values   = [0  1]
                       flag_meanings = 'land water'
                       time          = 'ocean_time'
                       grid          = 'grid'
                       location      = 'node'
                       coordinates   = 'lon_psi lat_psi ocean_time'
                       field         = 'wetdry_mask_psi, scalar, series'
    wetdry_mask_rho
           Size:       295x217x2
           Dimensions: xi_rho,eta_rho,ocean_time
           Datatype:   double
           Attributes:
                       long_name     = 'wet/dry mask on RHO-points'
                       flag_values   = [0  1]
                       flag_meanings = 'land water'
                       time          = 'ocean_time'
                       grid          = 'grid'
                       location      = 'face'
                       coordinates   = 'lon_rho lat_rho ocean_time'
                       field         = 'wetdry_mask_rho, scalar, series'
    wetdry_mask_u  
           Size:       294x217x2
           Dimensions: xi_u,eta_u,ocean_time
           Datatype:   double
           Attributes:
                       long_name     = 'wet/dry mask on U-points'
                       flag_values   = [0  1]
                       flag_meanings = 'land water'
                       time          = 'ocean_time'
                       grid          = 'grid'
                       location      = 'edge1'
                       coordinates   = 'lon_u lat_u ocean_time'
                       field         = 'wetdry_mask_u, scalar, series'
    wetdry_mask_v  
           Size:       295x216x2
           Dimensions: xi_v,eta_v,ocean_time
           Datatype:   double
           Attributes:
                       long_name     = 'wet/dry mask on V-points'
                       flag_values   = [0  1]
                       flag_meanings = 'land water'
                       time          = 'ocean_time'
                       grid          = 'grid'
                       location      = 'edge2'
                       coordinates   = 'lon_v lat_v ocean_time'
                       field         = 'wetdry_mask_v, scalar, series'
    zeta           
           Size:       295x217x2
           Dimensions: xi_rho,eta_rho,ocean_time
           Datatype:   double
           Attributes:
                       long_name   = 'free-surface'
                       units       = 'meter'
                       time        = 'ocean_time'
                       grid        = 'grid'
                       location    = 'face'
                       coordinates = 'lon_rho lat_rho ocean_time'
                       field       = 'free-surface, scalar, series'
    ubar           
           Size:       294x217x2
           Dimensions: xi_u,eta_u,ocean_time
           Datatype:   double
           Attributes:
                       long_name   = 'vertically integrated u-momentum component'
                       units       = 'meter second-1'
                       time        = 'ocean_time'
                       grid        = 'grid'
                       location    = 'edge1'
                       coordinates = 'lon_u lat_u ocean_time'
                       field       = 'ubar-velocity, scalar, series'
                       _FillValue  = 1e+37
    vbar           
           Size:       295x216x2
           Dimensions: xi_v,eta_v,ocean_time
           Datatype:   double
           Attributes:
                       long_name   = 'vertically integrated v-momentum component'
                       units       = 'meter second-1'
                       time        = 'ocean_time'
                       grid        = 'grid'
                       location    = 'edge2'
                       coordinates = 'lon_v lat_v ocean_time'
                       field       = 'vbar-velocity, scalar, series'
                       _FillValue  = 1e+37
    u              
           Size:       294x217x25x2
           Dimensions: xi_u,eta_u,s_rho,ocean_time
           Datatype:   double
           Attributes:
                       long_name   = 'u-momentum component'
                       units       = 'meter second-1'
                       time        = 'ocean_time'
                       grid        = 'grid'
                       location    = 'edge1'
                       coordinates = 'lon_u lat_u s_rho ocean_time'
                       field       = 'u-velocity, scalar, series'
                       _FillValue  = 1e+37
    v              
           Size:       295x216x25x2
           Dimensions: xi_v,eta_v,s_rho,ocean_time
           Datatype:   double
           Attributes:
                       long_name   = 'v-momentum component'
                       units       = 'meter second-1'
                       time        = 'ocean_time'
                       grid        = 'grid'
                       location    = 'edge2'
                       coordinates = 'lon_v lat_v s_rho ocean_time'
                       field       = 'v-velocity, scalar, series'
                       _FillValue  = 1e+37
    temp           
           Size:       295x217x25x2
           Dimensions: xi_rho,eta_rho,s_rho,ocean_time
           Datatype:   double
           Attributes:
                       long_name   = 'potential temperature'
                       units       = 'Celsius'
                       time        = 'ocean_time'
                       grid        = 'grid'
                       location    = 'face'
                       coordinates = 'lon_rho lat_rho s_rho ocean_time'
                       field       = 'temperature, scalar, series'
                       _FillValue  = 1e+37
    salt           
           Size:       295x217x25x2
           Dimensions: xi_rho,eta_rho,s_rho,ocean_time
           Datatype:   double
           Attributes:
                       long_name   = 'salinity'
                       time        = 'ocean_time'
                       grid        = 'grid'
                       location    = 'face'
                       coordinates = 'lon_rho lat_rho s_rho ocean_time'
                       field       = 'salinity, scalar, series'
                       _FillValue  = 1e+37
    rho            
           Size:       295x217x25x2
           Dimensions: xi_rho,eta_rho,s_rho,ocean_time
           Datatype:   double
           Attributes:
                       long_name   = 'density anomaly'
                       units       = 'kilogram meter-3'
                       time        = 'ocean_time'
                       grid        = 'grid'
                       location    = 'face'
                       coordinates = 'lon_rho lat_rho s_rho ocean_time'
                       field       = 'density, scalar, series'
                       _FillValue  = 1e+37
    AKv            
           Size:       295x217x26x2
           Dimensions: xi_rho,eta_rho,s_w,ocean_time
           Datatype:   double
           Attributes:
                       long_name   = 'vertical viscosity coefficient'
                       units       = 'meter2 second-1'
                       time        = 'ocean_time'
                       grid        = 'grid'
                       location    = 'face'
                       coordinates = 'lon_rho lat_rho s_w ocean_time'
                       field       = 'AKv, scalar, series'
    AKt            
           Size:       295x217x26x2
           Dimensions: xi_rho,eta_rho,s_w,ocean_time
           Datatype:   double
           Attributes:
                       long_name   = 'temperature vertical diffusion coefficient'
                       units       = 'meter2 second-1'
                       time        = 'ocean_time'
                       grid        = 'grid'
                       location    = 'face'
                       coordinates = 'lon_rho lat_rho s_w ocean_time'
                       field       = 'AKt, scalar, series'
    AKs            
           Size:       295x217x26x2
           Dimensions: xi_rho,eta_rho,s_w,ocean_time
           Datatype:   double
           Attributes:
                       long_name   = 'salinity vertical diffusion coefficient'
                       units       = 'meter2 second-1'
                       time        = 'ocean_time'
                       grid        = 'grid'
                       location    = 'face'
                       coordinates = 'lon_rho lat_rho s_w ocean_time'
                       field       = 'AKs, scalar, series'

I write this text grid_topo = {'node_lon': 'lon_rho', 'node_lat': 'lat_rho'} C_mover = gs.PyCurrentMover(filename='pg_ocean_rst.nc',grid_topology=grid_topo) but resulted in this error" File "/home/myusername/anaconda2/envs/myenv/lib/python2.7/site-packages/gridded/pysgrid/sgrid.py", line 639, in apply_padding_to_idxs for dim, typ in enumerate(padding): TypeError: 'NoneType' object is not iterable

Thank you in advance

ChrisBarker-NOAA commented 3 years ago

There is an issue with the "padding" for a staggered grid:

http://sgrid.github.io/sgrid/

hard to tell from the header exactly what's goin on.

Can you enclose (Or post somewhere) an actual netcdf file -- that will make it easier to debug.

@jay-hennen: any ideas?

Rintei commented 2 years ago

Has the issue been resolved(ROMS result -> GNOME input)? I tried to solve it using the function of PyMovers, but the addresses you linked above did not work, so I can't compare them by checking examples. Please reply if that had already been resolved.

Thank you in advance.

ChrisBarker-NOAA commented 2 years ago

As it happens, we are working on some of these issues right now.

If you could provide a link to a data file (ideally pretty small -- e.g. only a couple timesteps) -- we can figure it out.

@jay-hennen: any ideas here -- does this look like ROMS files we have already?

jay-hennen commented 2 years ago

Sorry I missed this issue. I think your grid_topo definition is incorrect. The 'nodes' of a ROMS grid are the psi points. Try defining node_lon as lon_psi and node_lat as lat_psi and see if that helps. Alternatively, don't pass in a topology at all, because it should be able to autodetect those names.

Rintei commented 2 years ago

Thanks for the quick reply. Since I can provide you with the file you requested, I shared a link with limited access(100 counted access times). If you can't access the link, please let us know again.

roms_mapping = {'node_lon': 'lon_psi','node lat': 'lat_psi'}
u_mover = PyCurrentMover(roms_file,
                         grid_topology=roms_mapping)
model.movers += u_mover

data file link : http://naver.me/51Q2w2av

I've tried as you advised, but following error:

Traceback (most recent call last): File "PyGnome03_1.py", line 189, in model = make_model(x) File "PyGnome03_1.py", line 67, in make_model u_mover = PyCurrentMover(roms_file, File "\py_gnome\gnome\movers\py_current_movers.py", line 99, in init self.current = GridCurrent.from_netCDF(filename=self.filename, File "\py_gnome\gnome\environment\gridded_objects_base.py", line 884, in from_netCDF var.init_from_netCDF(*args, *kwargs) File "\py_gnome\gnome\environment\gridded_objects_base.py", line 861, in init_from_netCDF self.init(name=name, File "\py_gnome\gnome\environment\environment_objects.py", line 246, in init self.angle = Variable(name='angle', File "\py_gnome\gnome\environment\gridded_objects_base.py", line 424, in init super(Variable, self).init(args, **kwargs) File ".conda\envs\gnome\lib\site-packages\gridded\variable.py", line 114, in init self.data = data File ".conda\envs\gnome\lib\site-packages\gridded\variable.py", line 371, in data raise ValueError("Data/grid shape mismatch: Data shape is {0}, " ValueError: Data/grid shape mismatch: Data shape is (720, 700), Grid shape is (719, 699)

jay-hennen commented 2 years ago

Can you post the ncdump -h of the file you are trying to use? It is too large for us to download.

Rintei commented 2 years ago

Can you post the ncdump -h of the file you are trying to use? It is too large for us to download.

I put the "ncdump_result.log" file on the linked drive. thank you

jay-hennen commented 2 years ago

I suggest you can remove the roms_mapping = line from your code and see what happens. As far as I can tell that file should work with no special arguments required.

EDIT: Although, nevermind that. It won't work because of depth related bugs that I am working on fixing right now

Rintei commented 2 years ago

I suggest you can remove the line from your code and see what happens. As far as I can tell that file should work with no special arguments required.roms_mapping =

Traceback (most recent call last): File "PyGnome03_2.py", line 195, in for step in model: File "gnome\model.py", line 1163, in next return self.step() File "gnome\model.py", line 1083, in step (msgs, isValid) = self.check_inputs() File "gnome\model.py", line 1612, in check_inputs bounds = mover.get_bounds() File "gnome\movers\py_current_movers.py", line 206, in get_bounds longs, lats = self.get_lat_lon_data() File "gnome\movers\py_current_movers.py", line 200, in get_lat_lon_data return lons.reshape(-1), lats.reshape(-1) File "src\netCDF4_netCDF4.pyx", line 4358, in netCDF4._netCDF4.Variable.getattr File "src\netCDF4_netCDF4.pyx", line 4164, in netCDF4._netCDF4.Variable.getncattr File "src\netCDF4_netCDF4.pyx", line 1445, in netCDF4._netCDF4._get_att File "src\netCDF4_netCDF4.pyx", line 1927, in netCDF4._netCDF4._ensure_nc_success AttributeError: NetCDF: Attribute not found

EDIT: Although, nevermind that. It won't work because of depth related bugs that I am working on fixing right now

So, Didn't work PyGnome by input data of 3D layers? I'm confused by your reply. Please clarify whether it is a compatibility issue with the result of the ROMS model, or just a happening because PyGnome is under development. If the latter is your opinions, then let's come up with the ideas need to apply them.

Thanks.