-
Notifications
You must be signed in to change notification settings - Fork 18
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
Selection of a variable based on values of another variable that shares one dimension #404
Comments
It seems as if your dimensions and the values of your array are flipped. Could you provide an example file that I could look at? |
Ok. The file is too large, so I send it by we transfer: Here is the output of my datset, "ds":
As a side note, I have noted that it does not print the name of the last variable ("longitude") in a new line, but at the end of the previous line (I have introduced a carriage return in the text after pasting it here). Perhaps it is an issue for DimensionalData. |
I had a look at the data and it seems that you have converted the dataset from GRIB to netcdf? Have you tried opening the original GRIB data with Rasters and the GRIBDatasets package? |
Yes, they are converted from Grib. I can open the gribs with GRIBDatasets with no problem. In fact, I converted the grib files to netcdf by opeing the gribs in julia with NCDatasets and saving them with NCDatasets. |
I have to correct myself: Raters correctly interprets the structure. I tested it a long time ago and it seem not to do it, but now it does!. |
I have the answer to my question. In order to select the variable msl depending on the values of latitude (which is not a dimension, but another variable that shares the dimension "values" with the variable msl), I have to do (supposing I want to select data at longitudes below 40º):
However, if I read the data with Rasters, it returns the result instantly and correctly. |
I guess that you opened the data in Rasters with lazy=false which is the default. |
Wow! It runs now instantaneously. But, due to my particular data structure, I have to read the variables msl and longitude in different variables:
because, if not:
|
|
But, is there a way to load a dataset into memory, other then |
I will summarize the answer here: The selection of one variable based on the values of another variable with which it shares a dimension, can be done via:
Where |
Thanks for the write up. Do you want to open a pull request to add this info to the docs? This would fit well into the how to section. |
Ok, but I am learning github right now. So I am going to take a while... |
That is no problem, feel free to ask questions if you feel stuck in the process of opening a PR. |
Ok, I am doing it. |
Pull request done! |
Hi, @felixcremer , I have opened a pull request. Could you tell me if I have to do anything else or If I have made the pull request correctly? |
what PR was it? should we close this? |
The pull request is #414 and it has been already accepted and closed. So, yes, this issue can be closed too. |
Hello:
I have to select data within a geographical window given as longitudes east and west and latitudes north and south. But the spatial coordinate of my data is "values", and I have the variables "msl" (mean sea level pressure), "longitude" and "latitude".
I think that the name of the spatial dimension, "values", is a bit confusing, because you can think that they are values of a meteorological variable, but they are not. "values" is a spatial dimension taking values from 1 to the total number of grid points.
The dimensions of the msl variable are: "values" and "Ti". The longitude and latitude variables, both have only one dimension: "values".
So, each datum in msl can be assigned a unique longitude and latitude via the common dimension: "values".
So, how can accomplish this?
The text was updated successfully, but these errors were encountered: