Skip to content

NestedField from FieldSet.from_nemo #1429

@pablohs27

Description

@pablohs27

Hello
I'm testing OceanParcels' NestedField function as I have two fields with different resolutions from a FieldSet.from_nemo field. Until now, when I run the code with the structure suggested in the function, it does not recognize the second field when loading the nestings in U and V, but it does not give me any errors either.

This is the structure I am following:

# Field 1
mfpathu = 'E:/MAESTRIA/DATOS/U/'
mfpathv = 'E:/MAESTRIA/DATOS/V/'
mfpathd = 'E:/MAESTRIA/DATOS/Domain/1_domain_cfg.nc'
mfufiles = (mfpathu + '1_CARIB_1h_20090101_20090131_grid_U.nc')
mfvfiles = (mfpathv + '1_CARIB_1h_20090101_20090131_grid_V.nc')

mffilenames = {'U': {'lon': mfpathd,'lat': mfpathd,'data': mfufiles},
             'V': {'lon': mfpathd,'lat': mfpathd,'data': mfvfiles}}
mfvariables = {'U': 'uo', 'V': 'vo'}
mfdimensions = {'lat': 'gphif','lon': 'glamf','time': 'time_counter'}

mffieldset = FieldSet.from_nemo(mffilenames, mfvariables, mfdimensions, allow_time_extrapolation=False)

# Field 2
mgpathu = 'E:/MAESTRIA/DATOS/MallaGrande/'
mgpathv = 'E:/MAESTRIA/DATOS/MallaGrande/'
mgpathd = 'E:/MAESTRIA/DATOS/MallaGrande/domain_cfg.nc'
mgufiles = (mgpathu + 'CARIB_1h_20090101_20090131_grid_U.nc')
mgvfiles = (mgpathv + 'CARIB_1h_20090101_20090131_grid_V.nc')

mgfilenames = {'U': {'lon': mgpathd,'lat': mgpathd,'data': mgufiles},
             'V': {'lon': mgpathd,'lat': mgpathd,'data': mgvfiles}}
mgvariables = {'U': 'uo', 'V': 'vo'}
mgdimensions = {'lat': 'gphif','lon': 'glamf','time': 'time_counter'}

mgfieldset = FieldSet.from_nemo(mgfilenames, mgvariables, mgdimensions, allow_time_extrapolation=False)

U = NestedField('U', [mffieldset.U, mgfieldset.U])
V = NestedField('V', [mffieldset.V, mgfieldset.V])

fieldset = FieldSet(U, V)

Why could it not read the second field? I've noticed that when I reverse the fields in NestedField for U and V, it still doesn't recognize the second input field.
Greetings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions