Skip to content

Resolving paths is not working between grandchildren and parents #191

Description

@noracato

Context

To enable grand parents, we updated the resolve_paths method for Derived datasets. This would make the grandchildren look for eg curves not just to their parent, but to their grand parent.

However, it does not work if the parent owns the file, and the grandchild looks upwards.

Steps to reproduce

Add the following fixture to spec/atlas/fixtures/datasets/groningen

# emissions.csv
etm_sector,etm_subsector,use,ghg,unit,value
Energy,Electricity and heat production,energetic,other_ghg,kg CO2eq,10.0
Energy,Electricity and heat production,energetic,co2,kg CO2eq,10.0
Households,Non-specified,energetic,other_ghg,kg CO2eq,5.0
Households,Non-specified,energetic,co2,kg CO2eq,15.0

Then add the following spec to spec/atlas/dataset/derived_dataset_spec.rb

describe 'emissions' do
    let(:grandchild_dataset) { described_class.find(:winschoten) }
    let(:dataset) { described_class.find(:groningen) }

    context 'when the dataset has its own emissions' do
      it 'grandchild dataset loads the parent dataset emissions' do
        expect(grandchild_dataset.emissions.get(
          [:energy, :electricity_and_heat_production, :energetic, :other_ghg],
          :value
        )).to be(10.0)
      end
    end
  end

First it will fail because resolve_paths is a private method. If moved to a public method. It throws an error on PathResolver. This class cannot handle more than two paths (dataset + parent) and should be adjusted to allow more ancestor paths

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions